From 53b5e6c138192adb387014a3285dc055b403614d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 8 Jan 2021 03:48:08 +0000 Subject: [PATCH 001/103] chore: add initial files for launch --- .../google-cloud-retail/CODE_OF_CONDUCT.md | 94 ++++++++ packages/google-cloud-retail/CONTRIBUTING.md | 74 +++++++ packages/google-cloud-retail/LICENSE | 202 ++++++++++++++++++ packages/google-cloud-retail/README.md | 1 + packages/google-cloud-retail/synth.py | 41 ++++ 5 files changed, 412 insertions(+) create mode 100644 packages/google-cloud-retail/CODE_OF_CONDUCT.md create mode 100644 packages/google-cloud-retail/CONTRIBUTING.md create mode 100644 packages/google-cloud-retail/LICENSE create mode 100644 packages/google-cloud-retail/README.md create mode 100644 packages/google-cloud-retail/synth.py diff --git a/packages/google-cloud-retail/CODE_OF_CONDUCT.md b/packages/google-cloud-retail/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-retail/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/packages/google-cloud-retail/CONTRIBUTING.md b/packages/google-cloud-retail/CONTRIBUTING.md new file mode 100644 index 00000000000..72c44cada5e --- /dev/null +++ b/packages/google-cloud-retail/CONTRIBUTING.md @@ -0,0 +1,74 @@ +# How to become a contributor and submit your own code + +**Table of contents** + +* [Contributor License Agreements](#contributor-license-agreements) +* [Contributing a patch](#contributing-a-patch) +* [Running the tests](#running-the-tests) +* [Releasing the library](#releasing-the-library) + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the code to which + you are contributing. +1. Ensure that your code has an appropriate set of tests which all pass. +1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. +1. Submit a pull request. + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + + +## Running the tests + +1. [Prepare your environment for Node.js setup][setup]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + # Run unit tests. + npm test + + # Run sample integration tests. + npm run samples-test + + # Run all system tests. + npm run system-test + +1. Lint (and maybe fix) any changes: + + npm run fix + +[setup]: https://cloud.google.com/nodejs/docs/setup +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing + +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-retail/LICENSE b/packages/google-cloud-retail/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-retail/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/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md new file mode 100644 index 00000000000..822c4573817 --- /dev/null +++ b/packages/google-cloud-retail/README.md @@ -0,0 +1 @@ +Retail: Nodejs Client diff --git a/packages/google-cloud-retail/synth.py b/packages/google-cloud-retail/synth.py new file mode 100644 index 00000000000..885a237f8db --- /dev/null +++ b/packages/google-cloud-retail/synth.py @@ -0,0 +1,41 @@ +# 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.node as node +import subprocess +import logging + +logging.basicConfig(level=logging.DEBUG) + +# run the gapic generator +gapic = gcp.GAPICBazel() +versions = ["v2","v2alpha","v2beta"] +name = 'retail' +for version in versions: + library = gapic.node_library( + name, + version, + bazel_target=f"//google/cloud/retail/{version}:retail-{version}-nodejs") + s.copy(library, excludes=[]) + +# Copy common templates +common_templates = gcp.CommonTemplates() +templates = common_templates.node_library( + source_location='build/src', versions=["v2","v2alpha","v2beta"], default_version="v2beta") +s.copy(templates, excludes=[]) + +node.postprocess_gapic_library() From 369ad394c4480518381b362962ef1881d669a5bf Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 12 Jan 2021 01:39:17 +0000 Subject: [PATCH 002/103] feat!: initial stub of library --- packages/google-cloud-retail/.eslintignore | 6 + packages/google-cloud-retail/.eslintrc.json | 3 + packages/google-cloud-retail/.gitattributes | 4 + packages/google-cloud-retail/.gitignore | 14 + packages/google-cloud-retail/.jsdoc.js | 55 + packages/google-cloud-retail/.mocharc.js | 29 + packages/google-cloud-retail/.nycrc | 24 + packages/google-cloud-retail/.prettierignore | 6 + packages/google-cloud-retail/.prettierrc.js | 17 + .../google-cloud-retail/api-extractor.json | 369 + .../linkinator.config.json | 1 + packages/google-cloud-retail/package.json | 69 + .../google/cloud/retail/v2/catalog.proto | 111 + .../cloud/retail/v2/catalog_service.proto | 136 + .../google/cloud/retail/v2/common.proto | 161 + .../cloud/retail/v2/import_config.proto | 251 + .../cloud/retail/v2/prediction_service.proto | 190 + .../google/cloud/retail/v2/product.proto | 283 + .../cloud/retail/v2/product_service.proto | 186 + .../google/cloud/retail/v2/purge_config.proto | 79 + .../google/cloud/retail/v2/user_event.proto | 227 + .../cloud/retail/v2/user_event_service.proto | 188 + .../google/cloud/retail/v2alpha/catalog.proto | 111 + .../retail/v2alpha/catalog_service.proto | 136 + .../google/cloud/retail/v2alpha/common.proto | 161 + .../cloud/retail/v2alpha/import_config.proto | 251 + .../retail/v2alpha/prediction_service.proto | 190 + .../google/cloud/retail/v2alpha/product.proto | 286 + .../retail/v2alpha/product_service.proto | 186 + .../cloud/retail/v2alpha/purge_config.proto | 80 + .../cloud/retail/v2alpha/user_event.proto | 228 + .../retail/v2alpha/user_event_service.proto | 188 + .../google/cloud/retail/v2beta/catalog.proto | 111 + .../cloud/retail/v2beta/catalog_service.proto | 136 + .../google/cloud/retail/v2beta/common.proto | 161 + .../cloud/retail/v2beta/import_config.proto | 251 + .../retail/v2beta/prediction_service.proto | 190 + .../google/cloud/retail/v2beta/product.proto | 285 + .../cloud/retail/v2beta/product_service.proto | 186 + .../cloud/retail/v2beta/purge_config.proto | 80 + .../cloud/retail/v2beta/user_event.proto | 228 + .../retail/v2beta/user_event_service.proto | 188 + .../google-cloud-retail/protos/protos.d.ts | 20372 +++++++ packages/google-cloud-retail/protos/protos.js | 50075 ++++++++++++++++ .../google-cloud-retail/protos/protos.json | 5166 ++ .../google-cloud-retail/samples/package.json | 23 + .../google-cloud-retail/samples/quickstart.js | 51 + .../samples/test/quickstart.js | 50 + packages/google-cloud-retail/src/index.ts | 51 + .../src/v2/catalog_service_client.ts | 849 + .../src/v2/catalog_service_client_config.json | 36 + .../src/v2/catalog_service_proto_list.json | 12 + .../src/v2/gapic_metadata.json | 199 + packages/google-cloud-retail/src/v2/index.ts | 22 + .../src/v2/prediction_service_client.ts | 624 + .../v2/prediction_service_client_config.json | 31 + .../src/v2/prediction_service_proto_list.json | 12 + .../src/v2/product_service_client.ts | 1113 + .../src/v2/product_service_client_config.json | 51 + .../src/v2/product_service_proto_list.json | 12 + .../src/v2/user_event_service_client.ts | 1185 + .../v2/user_event_service_client_config.json | 51 + .../src/v2/user_event_service_proto_list.json | 12 + .../src/v2alpha/catalog_service_client.ts | 861 + .../catalog_service_client_config.json | 36 + .../v2alpha/catalog_service_proto_list.json | 12 + .../src/v2alpha/gapic_metadata.json | 199 + .../google-cloud-retail/src/v2alpha/index.ts | 22 + .../src/v2alpha/prediction_service_client.ts | 624 + .../prediction_service_client_config.json | 31 + .../prediction_service_proto_list.json | 12 + .../src/v2alpha/product_service_client.ts | 1133 + .../product_service_client_config.json | 51 + .../v2alpha/product_service_proto_list.json | 12 + .../src/v2alpha/user_event_service_client.ts | 1198 + .../user_event_service_client_config.json | 51 + .../user_event_service_proto_list.json | 12 + .../src/v2beta/catalog_service_client.ts | 861 + .../v2beta/catalog_service_client_config.json | 36 + .../v2beta/catalog_service_proto_list.json | 12 + .../src/v2beta/gapic_metadata.json | 199 + .../google-cloud-retail/src/v2beta/index.ts | 22 + .../src/v2beta/prediction_service_client.ts | 624 + .../prediction_service_client_config.json | 31 + .../v2beta/prediction_service_proto_list.json | 12 + .../src/v2beta/product_service_client.ts | 1133 + .../v2beta/product_service_client_config.json | 51 + .../v2beta/product_service_proto_list.json | 12 + .../src/v2beta/user_event_service_client.ts | 1198 + .../user_event_service_client_config.json | 51 + .../v2beta/user_event_service_proto_list.json | 12 + packages/google-cloud-retail/synth.metadata | 55 + packages/google-cloud-retail/synth.py | 2 +- .../system-test/fixtures/sample/src/index.js | 29 + .../system-test/fixtures/sample/src/index.ts | 55 + .../system-test/install.ts | 51 + .../test/gapic_catalog_service_v2.ts | 800 + .../test/gapic_catalog_service_v2alpha.ts | 806 + .../test/gapic_catalog_service_v2beta.ts | 806 + .../test/gapic_prediction_service_v2.ts | 398 + .../test/gapic_prediction_service_v2alpha.ts | 408 + .../test/gapic_prediction_service_v2beta.ts | 408 + .../test/gapic_product_service_v2.ts | 1044 + .../test/gapic_product_service_v2alpha.ts | 1044 + .../test/gapic_product_service_v2beta.ts | 1044 + .../test/gapic_user_event_service_v2.ts | 1130 + .../test/gapic_user_event_service_v2alpha.ts | 1130 + .../test/gapic_user_event_service_v2beta.ts | 1130 + packages/google-cloud-retail/tsconfig.json | 19 + .../google-cloud-retail/webpack.config.js | 64 + 110 files changed, 104969 insertions(+), 1 deletion(-) create mode 100644 packages/google-cloud-retail/.eslintignore create mode 100644 packages/google-cloud-retail/.eslintrc.json create mode 100644 packages/google-cloud-retail/.gitattributes create mode 100644 packages/google-cloud-retail/.gitignore create mode 100644 packages/google-cloud-retail/.jsdoc.js create mode 100644 packages/google-cloud-retail/.mocharc.js create mode 100644 packages/google-cloud-retail/.nycrc create mode 100644 packages/google-cloud-retail/.prettierignore create mode 100644 packages/google-cloud-retail/.prettierrc.js create mode 100644 packages/google-cloud-retail/api-extractor.json create mode 100644 packages/google-cloud-retail/linkinator.config.json create mode 100644 packages/google-cloud-retail/package.json create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto create mode 100644 packages/google-cloud-retail/protos/protos.d.ts create mode 100644 packages/google-cloud-retail/protos/protos.js create mode 100644 packages/google-cloud-retail/protos/protos.json create mode 100644 packages/google-cloud-retail/samples/package.json create mode 100644 packages/google-cloud-retail/samples/quickstart.js create mode 100644 packages/google-cloud-retail/samples/test/quickstart.js create mode 100644 packages/google-cloud-retail/src/index.ts create mode 100644 packages/google-cloud-retail/src/v2/catalog_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/catalog_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/catalog_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2/gapic_metadata.json create mode 100644 packages/google-cloud-retail/src/v2/index.ts create mode 100644 packages/google-cloud-retail/src/v2/prediction_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/prediction_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/prediction_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2/product_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/product_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/product_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2/user_event_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/user_event_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/user_event_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/gapic_metadata.json create mode 100644 packages/google-cloud-retail/src/v2alpha/index.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/product_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/product_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/catalog_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/gapic_metadata.json create mode 100644 packages/google-cloud-retail/src/v2beta/index.ts create mode 100644 packages/google-cloud-retail/src/v2beta/prediction_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/product_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/product_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/product_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/user_event_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json create mode 100644 packages/google-cloud-retail/synth.metadata create mode 100644 packages/google-cloud-retail/system-test/fixtures/sample/src/index.js create mode 100644 packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts create mode 100644 packages/google-cloud-retail/system-test/install.ts create mode 100644 packages/google-cloud-retail/test/gapic_catalog_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts create mode 100644 packages/google-cloud-retail/test/gapic_prediction_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts create mode 100644 packages/google-cloud-retail/test/gapic_product_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_product_service_v2beta.ts create mode 100644 packages/google-cloud-retail/test/gapic_user_event_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts create mode 100644 packages/google-cloud-retail/tsconfig.json create mode 100644 packages/google-cloud-retail/webpack.config.js diff --git a/packages/google-cloud-retail/.eslintignore b/packages/google-cloud-retail/.eslintignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-retail/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-retail/.eslintrc.json b/packages/google-cloud-retail/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-retail/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-retail/.gitattributes b/packages/google-cloud-retail/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-retail/.gitattributes @@ -0,0 +1,4 @@ +*.ts text eol=lf +*.js text eol=lf +protos/* linguist-generated +**/api-extractor.json linguist-language=JSON-with-Comments diff --git a/packages/google-cloud-retail/.gitignore b/packages/google-cloud-retail/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-retail/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/packages/google-cloud-retail/.jsdoc.js b/packages/google-cloud-retail/.jsdoc.js new file mode 100644 index 00000000000..3e02f383e17 --- /dev/null +++ b/packages/google-cloud-retail/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: 'retail', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-retail/.mocharc.js b/packages/google-cloud-retail/.mocharc.js new file mode 100644 index 00000000000..0b600509bed --- /dev/null +++ b/packages/google-cloud-retail/.mocharc.js @@ -0,0 +1,29 @@ +// 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. +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000, + "recursive": true +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/packages/google-cloud-retail/.nycrc b/packages/google-cloud-retail/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-retail/.nycrc @@ -0,0 +1,24 @@ +{ + "report-dir": "./.coverage", + "reporter": ["text", "lcov"], + "exclude": [ + "**/*-test", + "**/.coverage", + "**/apis", + "**/benchmark", + "**/conformance", + "**/docs", + "**/samples", + "**/scripts", + "**/protos", + "**/test", + "**/*.d.ts", + ".jsdoc.js", + "**/.jsdoc.js", + "karma.conf.js", + "webpack-tests.config.js", + "webpack.config.js" + ], + "exclude-after-remap": false, + "all": true +} diff --git a/packages/google-cloud-retail/.prettierignore b/packages/google-cloud-retail/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-retail/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-retail/.prettierrc.js b/packages/google-cloud-retail/.prettierrc.js new file mode 100644 index 00000000000..d1b95106f4c --- /dev/null +++ b/packages/google-cloud-retail/.prettierrc.js @@ -0,0 +1,17 @@ +// 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. + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/packages/google-cloud-retail/api-extractor.json b/packages/google-cloud-retail/api-extractor.json new file mode 100644 index 00000000000..de228294b23 --- /dev/null +++ b/packages/google-cloud-retail/api-extractor.json @@ -0,0 +1,369 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/protos/protos.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we can specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + */ + "bundledPackages": [ ], + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + // "tsconfigFilePath": "/tsconfig.json", + + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true, + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/etc/" + */ + // "reportFolder": "/etc/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/" + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": true, + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true, + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + // "untrimmedFilePath": "/dist/.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "publicTrimmedFilePath": "/dist/-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + // "enabled": true, + + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning", + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + }, + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning", + // "addToApiReportFile": false + }, + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "warning", + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } + +} diff --git a/packages/google-cloud-retail/linkinator.config.json b/packages/google-cloud-retail/linkinator.config.json new file mode 100644 index 00000000000..0947c2e0e5b --- /dev/null +++ b/packages/google-cloud-retail/linkinator.config.json @@ -0,0 +1 @@ +{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io"],"silent":true,"concurrency":10} \ No newline at end of file diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json new file mode 100644 index 00000000000..44475e4ec7a --- /dev/null +++ b/packages/google-cloud-retail/package.json @@ -0,0 +1,69 @@ +{ + "name": "@google-cloud/retail", + "version": "0.1.0", + "description": "Retail client for Node.js", + "repository": "googleapis/nodejs-retail", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google retail", + "retail", + "catalog service", + "prediction service", + "product service", + "user event service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test", + "samples-test": "cd samples/ && npm link ../ && npm test", + "prelint": "cd samples; npm link ../; npm i" + }, + "dependencies": { + "google-gax": "^2.9.2" + }, + "devDependencies": { + "@types/mocha": "^8.0.4", + "@types/node": "^14.14.10", + "@types/sinon": "^9.0.9", + "c8": "^7.3.5", + "gts": "^3.0.3", + "jsdoc": "^3.6.6", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.6", + "linkinator": "^2.7.0", + "mocha": "^8.2.1", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^9.2.1", + "ts-loader": "^8.0.11", + "typescript": "^4.1.2", + "webpack": "^5.9.0", + "webpack-cli": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto new file mode 100644 index 00000000000..ded4ebd06ec --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto new file mode 100644 index 00000000000..4adda8df700 --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto new file mode 100644 index 00000000000..341126afcd9 --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto new file mode 100644 index 00000000000..cece6d5d2ec --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto new file mode 100644 index 00000000000..d5f68ebd2fe --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto new file mode 100644 index 00000000000..0d2cece6a56 --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto new file mode 100644 index 00000000000..2c659064eb3 --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto new file mode 100644 index 00000000000..d9cf6b82705 --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto new file mode 100644 index 00000000000..ca7083e501c --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto new file mode 100644 index 00000000000..a73b63e1f7b --- /dev/null +++ b/packages/google-cloud-retail/protos/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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto new file mode 100644 index 00000000000..151522ef312 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "CatalogProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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.v2alpha.Product]s allowed to be + // ingested into the catalog. Acceptable values are: + // + // * `primary` (default): You can only ingest + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]s. This means + // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] + // can only be empty or set to the same value as + // [Product.id][google.cloud.retail.v2alpha.Product.id]. + // * `variant`: You can only ingest + // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s. + // This means + // [Product.primary_product_id][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto new file mode 100644 index 00000000000..00bf9ffd920 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +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/v2alpha/catalog.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "CatalogServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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.v2alpha.Catalog]s associated + // with the project. + rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*}/catalogs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s. + rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog) { + option (google.api.http) = { + patch: "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}" + body: "catalog" + }; + option (google.api.method_signature) = "catalog,update_mask"; + } +} + +// Request for +// [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.ListCatalogsResponse.next_page_token], + // received from a previous + // [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.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.v2alpha.CatalogService.ListCatalogs] +// method. +message ListCatalogsResponse { + // All the customer's [Catalog][google.cloud.retail.v2alpha.Catalog]s. + repeated Catalog catalogs = 1; + + // A token that can be sent as + // [ListCatalogsRequest.page_token][google.cloud.retail.v2alpha.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.v2alpha.CatalogService.UpdateCatalog] +// method. +message UpdateCatalogRequest { + // Required. The [Catalog][google.cloud.retail.v2alpha.Catalog] to update. + // + // If the caller does not have permission to update the + // [Catalog][google.cloud.retail.v2alpha.Catalog], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + // + // If the [Catalog][google.cloud.retail.v2alpha.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.v2alpha.Catalog] to update. If not set, will + // only update the + // [Catalog.product_level_config][google.cloud.retail.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto new file mode 100644 index 00000000000..be62c883b39 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// A custom attribute that is not explicitly modeled in +// [Product][google.cloud.retail.v2alpha.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.v2alpha.CustomAttribute.text] or + // [numbers][google.cloud.retail.v2alpha.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.v2alpha.CustomAttribute.text] or + // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be + // set. Otherwise, an INVALID_ARGUMENT error is returned. + repeated double numbers = 2; +} + +// [Product][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.PriceInfo.price] - + // [cost][google.cloud.retail.v2alpha.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.v2alpha.UserEventService.CollectUserEvent] + // or if + // [direct_user_request][google.cloud.retail.v2alpha.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.v2alpha.UserEventService.CollectUserEvent] + // or if + // [direct_user_request][google.cloud.retail.v2alpha.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.v2alpha.UserInfo.ip_address] and + // [user_agent][google.cloud.retail.v2alpha.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.v2alpha.UserEventService.CollectUserEvent]. + bool direct_user_request = 4; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto new file mode 100644 index 00000000000..dc3ffe925d7 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2alpha/product.proto"; +import "google/cloud/retail/v2alpha/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.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ImportConfigProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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.v2alpha.Product] per line. Each product must + // have a valid [Product.id][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.Product] per line. Each product must + // have a valid [Product.id][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto new file mode 100644 index 00000000000..2b17a0739d9 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2alpha/user_event.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "PredictionServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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: "/v2alpha/{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.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto new file mode 100644 index 00000000000..c1ed3198c61 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -0,0 +1,286 @@ +// 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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2alpha/common.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ProductProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; +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.v2alpha.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.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product] is grouped with multiple + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s. + PRIMARY = 1; + + // The variant type. + // + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s usually share some common + // attributes on the same + // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]s or + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.Product] identifier, which + // is the final component of [name][google.cloud.retail.v2alpha.Product.name]. + // For example, this field is "id_1", if + // [name][google.cloud.retail.v2alpha.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.v2alpha.Product.id], with the same parent branch + // with this product. Otherwise, an error is thrown. + // + // For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]s, this field can only be + // empty or set to the same value as + // [id][google.cloud.retail.v2alpha.Product.id]. + // + // For VARIANT [Product][google.cloud.retail.v2alpha.Product]s, this field + // cannot be empty. A maximum of 2,000 products are allowed to share the same + // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product] otherwise an + // INVALID_ARGUMENT error is returned. + // + // At most 250 values are allowed per + // [Product][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.Product] + // becomes available recommendation and search. + google.protobuf.Timestamp available_time = 18; + + // The online availability of the + // [Product][google.cloud.retail.v2alpha.Product]. Default to + // [Availability.IN_STOCK][google.cloud.retail.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto new file mode 100644 index 00000000000..1259b32b361 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +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/v2alpha/import_config.proto"; +import "google/cloud/retail/v2alpha/product.proto"; +import "google/cloud/retail/v2alpha/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.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ProductServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Service for ingesting [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]. + rpc CreateProduct(CreateProductRequest) returns (Product) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + body: "product" + }; + option (google.api.method_signature) = "parent,product,product_id"; + } + + // Gets a [Product][google.cloud.retail.v2alpha.Product]. + rpc GetProduct(GetProductRequest) returns (Product) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a [Product][google.cloud.retail.v2alpha.Product]. + rpc UpdateProduct(UpdateProductRequest) returns (Product) { + option (google.api.http) = { + patch: "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + body: "product" + }; + option (google.api.method_signature) = "product,update_mask"; + } + + // Deletes a [Product][google.cloud.retail.v2alpha.Product]. + rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Bulk import of multiple [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s to be successfully updated. + rpc ImportProducts(ImportProductsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.ImportProductsResponse" + metadata_type: "google.cloud.retail.v2alpha.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.v2alpha.Product] to create. + Product product = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the + // [Product][google.cloud.retail.v2alpha.Product], which will become the final + // component of the [Product.name][google.cloud.retail.v2alpha.Product.name]. + // + // If the caller does not have permission to create the + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s with the same + // [parent][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + // + // If the requested [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto new file mode 100644 index 00000000000..d4a4d85e7cf --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto @@ -0,0 +1,80 @@ +// 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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "PurgeConfigProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto new file mode 100644 index 00000000000..bf3a6b6fd19 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -0,0 +1,228 @@ +// 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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/product.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "UserEventProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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.v2alpha.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.v2alpha.PredictionService.Predict]. + // This field enables accurate attribution of recommendation model + // performance. + // + // The value must be a valid + // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] + // for user events that are the result of + // [PredictionService.Predict][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.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.v2alpha.Product] information. + // + // Only [Product.id][google.cloud.retail.v2alpha.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.v2alpha.PurchaseTransaction.revenue] - + // [tax][google.cloud.retail.v2alpha.PurchaseTransaction.tax] - + // [cost][google.cloud.retail.v2alpha.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/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto new file mode 100644 index 00000000000..aa66b0a74e4 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/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.v2alpha; + +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/v2alpha/import_config.proto"; +import "google/cloud/retail/v2alpha/purge_config.proto"; +import "google/cloud/retail/v2alpha/user_event.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "UserEventServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// 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: "/v2alpha/{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: "/v2alpha/{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: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.PurgeUserEventsResponse" + metadata_type: "google.cloud.retail.v2alpha.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: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.ImportUserEventsResponse" + metadata_type: "google.cloud.retail.v2alpha.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: "/v2alpha/{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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto new file mode 100644 index 00000000000..c63bdf0eaff --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "CatalogProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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.v2beta.Product]s allowed to be + // ingested into the catalog. Acceptable values are: + // + // * `primary` (default): You can only ingest + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]s. This means + // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id] + // can only be empty or set to the same value as + // [Product.id][google.cloud.retail.v2beta.Product.id]. + // * `variant`: You can only ingest + // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s. + // This means + // [Product.primary_product_id][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto new file mode 100644 index 00000000000..322aa50e9d0 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +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/v2beta/catalog.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "CatalogServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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.v2beta.Catalog]s associated + // with the project. + rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*}/catalogs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the [Catalog][google.cloud.retail.v2beta.Catalog]s. + rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog) { + option (google.api.http) = { + patch: "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}" + body: "catalog" + }; + option (google.api.method_signature) = "catalog,update_mask"; + } +} + +// Request for +// [CatalogService.ListCatalogs][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.ListCatalogsResponse.next_page_token], + // received from a previous + // [CatalogService.ListCatalogs][google.cloud.retail.v2beta.CatalogService.ListCatalogs] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [CatalogService.ListCatalogs][google.cloud.retail.v2beta.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.v2beta.CatalogService.ListCatalogs] +// method. +message ListCatalogsResponse { + // All the customer's [Catalog][google.cloud.retail.v2beta.Catalog]s. + repeated Catalog catalogs = 1; + + // A token that can be sent as + // [ListCatalogsRequest.page_token][google.cloud.retail.v2beta.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.v2beta.CatalogService.UpdateCatalog] +// method. +message UpdateCatalogRequest { + // Required. The [Catalog][google.cloud.retail.v2beta.Catalog] to update. + // + // If the caller does not have permission to update the + // [Catalog][google.cloud.retail.v2beta.Catalog], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + // + // If the [Catalog][google.cloud.retail.v2beta.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.v2beta.Catalog] to update. If not set, will + // only update the + // [Catalog.product_level_config][google.cloud.retail.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto new file mode 100644 index 00000000000..24f18f433f7 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// A custom attribute that is not explicitly modeled in +// [Product][google.cloud.retail.v2beta.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.v2beta.CustomAttribute.text] or + // [numbers][google.cloud.retail.v2beta.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.v2beta.CustomAttribute.text] or + // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be + // set. Otherwise, an INVALID_ARGUMENT error is returned. + repeated double numbers = 2; +} + +// [Product][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.PriceInfo.price] - + // [cost][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent] + // or if + // [direct_user_request][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent] + // or if + // [direct_user_request][google.cloud.retail.v2beta.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.v2beta.UserInfo.ip_address] and + // [user_agent][google.cloud.retail.v2beta.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.v2beta.UserEventService.CollectUserEvent]. + bool direct_user_request = 4; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto new file mode 100644 index 00000000000..4ea8f651e9f --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2beta/product.proto"; +import "google/cloud/retail/v2beta/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.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ImportConfigProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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.v2beta.Product] per line. Each product must + // have a valid [Product.id][google.cloud.retail.v2beta.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.v2beta.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.v2beta.Product] per line. Each product must + // have a valid [Product.id][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto new file mode 100644 index 00000000000..7d106347113 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2beta/user_event.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "PredictionServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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: "/v2beta/{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.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto new file mode 100644 index 00000000000..20f9d389e03 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -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 +// +// 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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2beta/common.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ProductProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; +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.v2beta.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.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product] is grouped with multiple + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s. + PRIMARY = 1; + + // The variant type. + // + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s usually share some common + // attributes on the same + // [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.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.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]s or + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.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.v2beta.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.v2beta.Product] identifier, which + // is the final component of [name][google.cloud.retail.v2beta.Product.name]. + // For example, this field is "id_1", if + // [name][google.cloud.retail.v2beta.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.v2beta.Product.id], with the same parent branch + // with this product. Otherwise, an error is thrown. + // + // For [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]s, this field can only be + // empty or set to the same value as + // [id][google.cloud.retail.v2beta.Product.id]. + // + // For VARIANT [Product][google.cloud.retail.v2beta.Product]s, this field + // cannot be empty. A maximum of 2,000 products are allowed to share the same + // [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.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.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product] otherwise an INVALID_ARGUMENT + // error is returned. + // + // At most 250 values are allowed per + // [Product][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.Product] + // becomes available recommendation and search. + google.protobuf.Timestamp available_time = 18; + + // The online availability of the + // [Product][google.cloud.retail.v2beta.Product]. Default to + // [Availability.IN_STOCK][google.cloud.retail.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto new file mode 100644 index 00000000000..5e7615ebd64 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +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/v2beta/import_config.proto"; +import "google/cloud/retail/v2beta/product.proto"; +import "google/cloud/retail/v2beta/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.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ProductServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Service for ingesting [Product][google.cloud.retail.v2beta.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.v2beta.Product]. + rpc CreateProduct(CreateProductRequest) returns (Product) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + body: "product" + }; + option (google.api.method_signature) = "parent,product,product_id"; + } + + // Gets a [Product][google.cloud.retail.v2beta.Product]. + rpc GetProduct(GetProductRequest) returns (Product) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a [Product][google.cloud.retail.v2beta.Product]. + rpc UpdateProduct(UpdateProductRequest) returns (Product) { + option (google.api.http) = { + patch: "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + body: "product" + }; + option (google.api.method_signature) = "product,update_mask"; + } + + // Deletes a [Product][google.cloud.retail.v2beta.Product]. + rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Bulk import of multiple [Product][google.cloud.retail.v2beta.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.v2beta.Product]s to be successfully updated. + rpc ImportProducts(ImportProductsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.ImportProductsResponse" + metadata_type: "google.cloud.retail.v2beta.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.v2beta.Product] to create. + Product product = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the + // [Product][google.cloud.retail.v2beta.Product], which will become the final + // component of the [Product.name][google.cloud.retail.v2beta.Product.name]. + // + // If the caller does not have permission to create the + // [Product][google.cloud.retail.v2beta.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.v2beta.Product]s with the same + // [parent][google.cloud.retail.v2beta.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.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + // + // If the requested [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto new file mode 100644 index 00000000000..a2db3110a2d --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto @@ -0,0 +1,80 @@ +// 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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "PurgeConfigProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto new file mode 100644 index 00000000000..a8efad4dd78 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -0,0 +1,228 @@ +// 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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/retail/v2beta/common.proto"; +import "google/cloud/retail/v2beta/product.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "UserEventProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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.v2beta.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.v2beta.PredictionService.Predict]. + // This field enables accurate attribution of recommendation model + // performance. + // + // The value must be a valid + // [PredictResponse.attribution_token][google.cloud.retail.v2beta.PredictResponse.attribution_token] + // for user events that are the result of + // [PredictionService.Predict][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.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.v2beta.Product] information. + // + // Only [Product.id][google.cloud.retail.v2beta.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.v2beta.PurchaseTransaction.revenue] - + // [tax][google.cloud.retail.v2beta.PurchaseTransaction.tax] - + // [cost][google.cloud.retail.v2beta.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/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto new file mode 100644 index 00000000000..9c2f86d9ecd --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/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.v2beta; + +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/v2beta/import_config.proto"; +import "google/cloud/retail/v2beta/purge_config.proto"; +import "google/cloud/retail/v2beta/user_event.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "UserEventServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// 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: "/v2beta/{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: "/v2beta/{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: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.PurgeUserEventsResponse" + metadata_type: "google.cloud.retail.v2beta.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: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.ImportUserEventsResponse" + metadata_type: "google.cloud.retail.v2beta.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: "/v2beta/{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/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts new file mode 100644 index 00000000000..aea15df9967 --- /dev/null +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -0,0 +1,20372 @@ +// Copyright 2021 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. + +import * as Long from "long"; +import {protobuf as $protobuf} from "google-gax"; +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace retail. */ + namespace retail { + + /** Namespace v2. */ + namespace v2 { + + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { + + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); + } + + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { + + /** + * Constructs a new ProductLevelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductLevelConfig); + + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductLevelConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IProductLevelConfig): google.cloud.retail.v2.ProductLevelConfig; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductLevelConfig; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductLevelConfig; + + /** + * Verifies a ProductLevelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductLevelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductLevelConfig; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductLevelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2.IProductLevelConfig|null); + } + + /** Represents a Catalog. */ + class Catalog implements ICatalog { + + /** + * Constructs a new Catalog. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2.IProductLevelConfig|null); + + /** + * Creates a new Catalog instance using the specified properties. + * @param [properties] Properties to set + * @returns Catalog instance + */ + public static create(properties?: google.cloud.retail.v2.ICatalog): google.cloud.retail.v2.Catalog; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Catalog; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Catalog; + + /** + * Verifies a Catalog message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Catalog + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Catalog; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Catalog to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { + + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; + } + + namespace CatalogService { + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; + } + + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { + + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); + + /** ListCatalogsRequest parent. */ + public parent: string; + + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; + + /** + * Verifies a ListCatalogsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { + + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2.ICatalog[]|null); + + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { + + /** + * Constructs a new ListCatalogsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); + + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2.ICatalog[]; + + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; + + /** + * Verifies a ListCatalogsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { + + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2.ICatalog|null); + + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { + + /** + * Constructs a new UpdateCatalogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); + + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2.ICatalog|null); + + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCatalogRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; + + /** + * Verifies an UpdateCatalogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCatalogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + } + + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { + + /** + * Constructs a new CustomAttribute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomAttribute instance + */ + public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; + + /** + * Verifies a CustomAttribute message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomAttribute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomAttribute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image uri */ + uri?: (string|null); + + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImage); + + /** Image uri. */ + public uri: string; + + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.retail.v2.IImage): google.cloud.retail.v2.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Image message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Image; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Image; + + /** + * Verifies an Image message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Image + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Image; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PriceInfo. */ + interface IPriceInfo { + + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { + + /** + * Constructs a new PriceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance + */ + public static create(properties?: google.cloud.retail.v2.IPriceInfo): google.cloud.retail.v2.PriceInfo; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo; + + /** + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); + + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { + + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserInfo); + + /** UserInfo userId. */ + public userId: string; + + /** UserInfo ipAddress. */ + public ipAddress: string; + + /** UserInfo userAgent. */ + public userAgent: string; + + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; + + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2.IUserInfo): google.cloud.retail.v2.UserInfo; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserInfo; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserInfo; + + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserInfo; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource inputUris */ + inputUris?: (string[]|null); + + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IGcsSource); + + /** GcsSource inputUris. */ + public inputUris: string[]; + + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; + + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { + + /** + * Constructs a new BigQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IBigQuerySource); + + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQuerySource instance + */ + public static create(properties?: google.cloud.retail.v2.IBigQuerySource): google.cloud.retail.v2.BigQuerySource; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.BigQuerySource; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.BigQuerySource; + + /** + * Verifies a BigQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.BigQuerySource; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { + + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2.IProduct[]|null); + } + + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { + + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductInlineSource); + + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2.IProduct[]; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2.IProductInlineSource): google.cloud.retail.v2.ProductInlineSource; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInlineSource; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInlineSource; + + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInlineSource; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { + + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2.IUserEvent[]|null); + } + + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { + + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserEventInlineSource); + + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2.IUserEvent[]; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2.IUserEventInlineSource): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { + + /** + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix: string; + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IImportErrorsConfig): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { + + /** ImportProductsRequest parent */ + parent?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { + + /** + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportProductsRequest); + + /** ImportProductsRequest parent. */ + public parent: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportProductsRequest): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ + parent?: (string|null); + + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { + + /** + * Constructs a new ImportUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportUserEventsRequest); + + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportUserEventsRequest): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Verifies an ImportUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { + + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + } + + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { + + /** + * Constructs a new ProductInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductInputConfig); + + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IProductInputConfig): google.cloud.retail.v2.ProductInputConfig; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInputConfig; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInputConfig; + + /** + * Verifies a ProductInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInputConfig; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { + + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + } + + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { + + /** + * Constructs a new UserEventInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserEventInputConfig); + + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IUserEventInputConfig): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Verifies a UserEventInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportMetadata. */ + interface IImportMetadata { + + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + } + + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { + + /** + * Constructs a new ImportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportMetadata); + + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IImportMetadata): google.cloud.retail.v2.ImportMetadata; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportMetadata; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportMetadata; + + /** + * Verifies an ImportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportMetadata; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { + + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + } + + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { + + /** + * Constructs a new ImportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportProductsResponse); + + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IImportProductsResponse): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Verifies an ImportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { + + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + } + + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { + + /** + * Constructs a new ImportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportUserEventsResponse); + + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IImportUserEventsResponse): google.cloud.retail.v2.ImportUserEventsResponse; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsResponse; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsResponse; + + /** + * Verifies an ImportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsResponse; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { + + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); + + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); + } + + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { + + /** + * Constructs a new UserEventImportSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserEventImportSummary); + + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); + + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventImportSummary instance + */ + public static create(properties?: google.cloud.retail.v2.IUserEventImportSummary): google.cloud.retail.v2.UserEventImportSummary; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventImportSummary; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventImportSummary; + + /** + * Verifies a UserEventImportSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventImportSummary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventImportSummary; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventImportSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Product. */ + interface IProduct { + + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product categories */ + categories?: (string[]|null); + + /** Product title */ + title?: (string|null); + + /** Product description */ + description?: (string|null); + + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2.IImage[]|null); + } + + /** Represents a Product. */ + class Product implements IProduct { + + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProduct); + + /** Product name. */ + public name: string; + + /** Product id. */ + public id: string; + + /** Product type. */ + public type: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type); + + /** Product primaryProductId. */ + public primaryProductId: string; + + /** Product categories. */ + public categories: string[]; + + /** Product title. */ + public title: string; + + /** Product description. */ + public description: string; + + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** Product tags. */ + public tags: string[]; + + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability. */ + public availability: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability); + + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product uri. */ + public uri: string; + + /** Product images. */ + public images: google.cloud.retail.v2.IImage[]; + + /** + * Creates a new Product instance using the specified properties. + * @param [properties] Properties to set + * @returns Product instance + */ + public static create(properties?: google.cloud.retail.v2.IProduct): google.cloud.retail.v2.Product; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Product message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Product; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Product; + + /** + * Verifies a Product message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Product + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Product; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Product to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Product { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } + + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } + } + + /** Properties of a UserEvent. */ + interface IUserEvent { + + /** UserEvent eventType */ + eventType?: (string|null); + + /** UserEvent visitorId */ + visitorId?: (string|null); + + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); + + /** UserEvent attributionToken */ + attributionToken?: (string|null); + + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2.IProductDetail[]|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } + + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { + + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserEvent); + + /** UserEvent eventType. */ + public eventType: string; + + /** UserEvent visitorId. */ + public visitorId: string; + + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2.IProductDetail[]; + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; + + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + public static create(properties?: google.cloud.retail.v2.IUserEvent): google.cloud.retail.v2.UserEvent; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEvent; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEvent; + + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEvent; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductDetail. */ + interface IProductDetail { + + /** ProductDetail product */ + product?: (google.cloud.retail.v2.IProduct|null); + + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); + } + + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { + + /** + * Constructs a new ProductDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductDetail); + + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2.IProduct|null); + + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new ProductDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductDetail instance + */ + public static create(properties?: google.cloud.retail.v2.IProductDetail): google.cloud.retail.v2.ProductDetail; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductDetail; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductDetail; + + /** + * Verifies a ProductDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductDetail; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { + + /** PurchaseTransaction id */ + id?: (string|null); + + /** PurchaseTransaction revenue */ + revenue?: (number|null); + + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); + } + + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { + + /** + * Constructs a new PurchaseTransaction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurchaseTransaction); + + /** PurchaseTransaction id. */ + public id: string; + + /** PurchaseTransaction revenue. */ + public revenue: number; + + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @param [properties] Properties to set + * @returns PurchaseTransaction instance + */ + public static create(properties?: google.cloud.retail.v2.IPurchaseTransaction): google.cloud.retail.v2.PurchaseTransaction; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurchaseTransaction; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurchaseTransaction; + + /** + * Verifies a PurchaseTransaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurchaseTransaction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurchaseTransaction; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurchaseTransaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { + + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2.IPredictRequest, callback: google.cloud.retail.v2.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2.IPredictRequest): Promise; + } + + namespace PredictionService { + + /** + * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPredictRequest); + + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IPredictRequest): google.cloud.retail.v2.PredictRequest; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictRequest; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictRequest; + + /** + * Verifies a PredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictRequest; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PredictResponse. */ + interface IPredictResponse { + + /** PredictResponse results */ + results?: (google.cloud.retail.v2.PredictResponse.IPredictionResult[]|null); + + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { + + /** + * Constructs a new PredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPredictResponse); + + /** PredictResponse results. */ + public results: google.cloud.retail.v2.PredictResponse.IPredictionResult[]; + + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IPredictResponse): google.cloud.retail.v2.PredictResponse; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictResponse; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictResponse; + + /** + * Verifies a PredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictResponse; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PredictResponse { + + /** Properties of a PredictionResult. */ + interface IPredictionResult { + + /** PredictionResult id */ + id?: (string|null); + + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { + + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.PredictResponse.IPredictionResult); + + /** PredictionResult id. */ + public id: string; + + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2.PredictResponse.IPredictionResult): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public createProduct(request: google.cloud.retail.v2.ICreateProductRequest, callback: google.cloud.retail.v2.ProductService.CreateProductCallback): void; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2.ICreateProductRequest): Promise; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2.IGetProductRequest, callback: google.cloud.retail.v2.ProductService.GetProductCallback): void; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise + */ + public getProduct(request: google.cloud.retail.v2.IGetProductRequest): Promise; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public updateProduct(request: google.cloud.retail.v2.IUpdateProductRequest, callback: google.cloud.retail.v2.ProductService.UpdateProductCallback): void; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2.IUpdateProductRequest): Promise; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2.IDeleteProductRequest, callback: google.cloud.retail.v2.ProductService.DeleteProductCallback): void; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise + */ + public deleteProduct(request: google.cloud.retail.v2.IDeleteProductRequest): Promise; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importProducts(request: google.cloud.retail.v2.IImportProductsRequest, callback: google.cloud.retail.v2.ProductService.ImportProductsCallback): void; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise + */ + public importProducts(request: google.cloud.retail.v2.IImportProductsRequest): Promise; + } + + namespace ProductService { + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { + + /** + * Constructs a new CreateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICreateProductRequest); + + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2.ICreateProductRequest): google.cloud.retail.v2.CreateProductRequest; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CreateProductRequest; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CreateProductRequest; + + /** + * Verifies a CreateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CreateProductRequest; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); + } + + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { + + /** + * Constructs a new GetProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IGetProductRequest): google.cloud.retail.v2.GetProductRequest; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetProductRequest; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetProductRequest; + + /** + * Verifies a GetProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetProductRequest; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { + + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2.IProduct|null); + + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { + + /** + * Constructs a new UpdateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUpdateProductRequest); + + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2.IProduct|null); + + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IUpdateProductRequest): google.cloud.retail.v2.UpdateProductRequest; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateProductRequest; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateProductRequest; + + /** + * Verifies an UpdateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateProductRequest; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { + + /** DeleteProductRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { + + /** + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IDeleteProductRequest): google.cloud.retail.v2.DeleteProductRequest; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.DeleteProductRequest; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.DeleteProductRequest; + + /** + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.DeleteProductRequest; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } + + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { + + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; + + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { + + /** PurgeUserEventsRequest parent */ + parent?: (string|null); + + /** PurgeUserEventsRequest filter */ + filter?: (string|null); + + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); + + /** PurgeUserEventsRequest parent. */ + public parent: string; + + /** PurgeUserEventsRequest filter. */ + public filter: string; + + /** PurgeUserEventsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { + + /** + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent + */ + public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest, callback: google.cloud.retail.v2.UserEventService.WriteUserEventCallback): void; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise + */ + public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest): Promise; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody + */ + public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest, callback: google.cloud.retail.v2.UserEventService.CollectUserEventCallback): void; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise + */ + public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest): Promise; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback): void; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise + */ + public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest): Promise; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.ImportUserEventsCallback): void; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise + */ + public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest): Promise; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback): void; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise + */ + public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest): Promise; + } + + namespace UserEventService { + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent + */ + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2.UserEvent) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody + */ + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { + + /** WriteUserEventRequest parent */ + parent?: (string|null); + + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2.IUserEvent|null); + } + + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { + + /** + * Constructs a new WriteUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IWriteUserEventRequest); + + /** WriteUserEventRequest parent. */ + public parent: string; + + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IWriteUserEventRequest): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Verifies a WriteUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { + + /** CollectUserEventRequest parent */ + parent?: (string|null); + + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); + } + + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { + + /** + * Constructs a new CollectUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICollectUserEventRequest); + + /** CollectUserEventRequest parent. */ + public parent: string; + + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2.ICollectUserEventRequest): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Verifies a CollectUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { + + /** RejoinUserEventsRequest parent */ + parent?: (string|null); + + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null); + } + + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + + /** + * Constructs a new RejoinUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest); + + /** RejoinUserEventsRequest parent. */ + public parent: string; + + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope); + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Verifies a RejoinUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace RejoinUserEventsRequest { + + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + + /** + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { + } + + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + + /** + * Constructs a new RejoinUserEventsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata); + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace v2alpha. */ + namespace v2alpha { + + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { + + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); + } + + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { + + /** + * Constructs a new ProductLevelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductLevelConfig); + + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductLevelConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductLevelConfig): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Verifies a ProductLevelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductLevelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductLevelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + } + + /** Represents a Catalog. */ + class Catalog implements ICatalog { + + /** + * Constructs a new Catalog. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + + /** + * Creates a new Catalog instance using the specified properties. + * @param [properties] Properties to set + * @returns Catalog instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + + /** + * Verifies a Catalog message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Catalog + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Catalog to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { + + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest, callback: google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback): void; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest): Promise; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback): void; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest): Promise; + } + + namespace CatalogService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; + } + + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { + + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); + + /** ListCatalogsRequest parent. */ + public parent: string; + + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest): google.cloud.retail.v2alpha.ListCatalogsRequest; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsRequest; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsRequest; + + /** + * Verifies a ListCatalogsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsRequest; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { + + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2alpha.ICatalog[]|null); + + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { + + /** + * Constructs a new ListCatalogsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse); + + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2alpha.ICatalog[]; + + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse): google.cloud.retail.v2alpha.ListCatalogsResponse; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsResponse; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsResponse; + + /** + * Verifies a ListCatalogsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsResponse; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { + + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2alpha.ICatalog|null); + + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { + + /** + * Constructs a new UpdateCatalogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest); + + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2alpha.ICatalog|null); + + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCatalogRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest): google.cloud.retail.v2alpha.UpdateCatalogRequest; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateCatalogRequest; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateCatalogRequest; + + /** + * Verifies an UpdateCatalogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCatalogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateCatalogRequest; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + } + + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { + + /** + * Constructs a new CustomAttribute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomAttribute instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICustomAttribute): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Verifies a CustomAttribute message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomAttribute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomAttribute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image uri */ + uri?: (string|null); + + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImage); + + /** Image uri. */ + public uri: string; + + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImage): google.cloud.retail.v2alpha.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Image message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Image; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Image; + + /** + * Verifies an Image message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Image + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Image; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PriceInfo. */ + interface IPriceInfo { + + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { + + /** + * Constructs a new PriceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPriceInfo): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); + + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { + + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserInfo); + + /** UserInfo userId. */ + public userId: string; + + /** UserInfo ipAddress. */ + public ipAddress: string; + + /** UserInfo userAgent. */ + public userAgent: string; + + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; + + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserInfo): google.cloud.retail.v2alpha.UserInfo; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserInfo; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserInfo; + + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserInfo; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource inputUris */ + inputUris?: (string[]|null); + + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGcsSource); + + /** GcsSource inputUris. */ + public inputUris: string[]; + + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGcsSource): google.cloud.retail.v2alpha.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GcsSource; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GcsSource; + + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GcsSource; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { + + /** + * Constructs a new BigQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IBigQuerySource); + + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQuerySource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IBigQuerySource): google.cloud.retail.v2alpha.BigQuerySource; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.BigQuerySource; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.BigQuerySource; + + /** + * Verifies a BigQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.BigQuerySource; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { + + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2alpha.IProduct[]|null); + } + + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { + + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductInlineSource); + + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2alpha.IProduct[]; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductInlineSource): google.cloud.retail.v2alpha.ProductInlineSource; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInlineSource; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInlineSource; + + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInlineSource; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { + + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2alpha.IUserEvent[]|null); + } + + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { + + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource); + + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2alpha.IUserEvent[]; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource): google.cloud.retail.v2alpha.UserEventInlineSource; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInlineSource; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInlineSource; + + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInlineSource; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { + + /** + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix: string; + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig): google.cloud.retail.v2alpha.ImportErrorsConfig; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportErrorsConfig; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportErrorsConfig; + + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportErrorsConfig; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { + + /** ImportProductsRequest parent */ + parent?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { + + /** + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImportProductsRequest); + + /** ImportProductsRequest parent. */ + public parent: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportProductsRequest): google.cloud.retail.v2alpha.ImportProductsRequest; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsRequest; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsRequest; + + /** + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsRequest; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ + parent?: (string|null); + + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { + + /** + * Constructs a new ImportUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest); + + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest): google.cloud.retail.v2alpha.ImportUserEventsRequest; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsRequest; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsRequest; + + /** + * Verifies an ImportUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsRequest; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { + + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); + + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + } + + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { + + /** + * Constructs a new ProductInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductInputConfig); + + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); + + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductInputConfig): google.cloud.retail.v2alpha.ProductInputConfig; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInputConfig; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInputConfig; + + /** + * Verifies a ProductInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInputConfig; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { + + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + } + + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { + + /** + * Constructs a new UserEventInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig); + + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig): google.cloud.retail.v2alpha.UserEventInputConfig; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInputConfig; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInputConfig; + + /** + * Verifies a UserEventInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInputConfig; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportMetadata. */ + interface IImportMetadata { + + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + } + + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { + + /** + * Constructs a new ImportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImportMetadata); + + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportMetadata): google.cloud.retail.v2alpha.ImportMetadata; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportMetadata; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportMetadata; + + /** + * Verifies an ImportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportMetadata; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { + + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + } + + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { + + /** + * Constructs a new ImportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImportProductsResponse); + + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportProductsResponse): google.cloud.retail.v2alpha.ImportProductsResponse; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsResponse; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsResponse; + + /** + * Verifies an ImportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsResponse; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { + + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); + } + + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { + + /** + * Constructs a new ImportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse); + + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse): google.cloud.retail.v2alpha.ImportUserEventsResponse; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsResponse; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsResponse; + + /** + * Verifies an ImportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsResponse; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { + + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); + + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); + } + + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { + + /** + * Constructs a new UserEventImportSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary); + + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); + + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventImportSummary instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary): google.cloud.retail.v2alpha.UserEventImportSummary; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventImportSummary; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventImportSummary; + + /** + * Verifies a UserEventImportSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventImportSummary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventImportSummary; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventImportSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Product. */ + interface IProduct { + + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product categories */ + categories?: (string[]|null); + + /** Product title */ + title?: (string|null); + + /** Product description */ + description?: (string|null); + + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2alpha.IImage[]|null); + } + + /** Represents a Product. */ + class Product implements IProduct { + + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProduct); + + /** Product name. */ + public name: string; + + /** Product id. */ + public id: string; + + /** Product type. */ + public type: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type); + + /** Product primaryProductId. */ + public primaryProductId: string; + + /** Product categories. */ + public categories: string[]; + + /** Product title. */ + public title: string; + + /** Product description. */ + public description: string; + + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** Product tags. */ + public tags: string[]; + + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability. */ + public availability: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability); + + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product uri. */ + public uri: string; + + /** Product images. */ + public images: google.cloud.retail.v2alpha.IImage[]; + + /** + * Creates a new Product instance using the specified properties. + * @param [properties] Properties to set + * @returns Product instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProduct): google.cloud.retail.v2alpha.Product; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Product message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Product; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Product; + + /** + * Verifies a Product message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Product + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Product; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Product to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Product { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } + + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } + } + + /** Properties of a UserEvent. */ + interface IUserEvent { + + /** UserEvent eventType */ + eventType?: (string|null); + + /** UserEvent visitorId */ + visitorId?: (string|null); + + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); + + /** UserEvent attributionToken */ + attributionToken?: (string|null); + + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2alpha.IProductDetail[]|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } + + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { + + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserEvent); + + /** UserEvent eventType. */ + public eventType: string; + + /** UserEvent visitorId. */ + public visitorId: string; + + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2alpha.IProductDetail[]; + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; + + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserEvent): google.cloud.retail.v2alpha.UserEvent; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEvent; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEvent; + + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEvent; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductDetail. */ + interface IProductDetail { + + /** ProductDetail product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); + } + + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { + + /** + * Constructs a new ProductDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductDetail); + + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new ProductDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductDetail instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductDetail): google.cloud.retail.v2alpha.ProductDetail; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductDetail; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductDetail; + + /** + * Verifies a ProductDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductDetail; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { + + /** PurchaseTransaction id */ + id?: (string|null); + + /** PurchaseTransaction revenue */ + revenue?: (number|null); + + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); + } + + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { + + /** + * Constructs a new PurchaseTransaction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction); + + /** PurchaseTransaction id. */ + public id: string; + + /** PurchaseTransaction revenue. */ + public revenue: number; + + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @param [properties] Properties to set + * @returns PurchaseTransaction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction): google.cloud.retail.v2alpha.PurchaseTransaction; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurchaseTransaction; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurchaseTransaction; + + /** + * Verifies a PurchaseTransaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurchaseTransaction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurchaseTransaction; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurchaseTransaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { + + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; + } + + namespace PredictionService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); + + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Verifies a PredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PredictResponse. */ + interface IPredictResponse { + + /** PredictResponse results */ + results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); + + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { + + /** + * Constructs a new PredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); + + /** PredictResponse results. */ + public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; + + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Verifies a PredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PredictResponse { + + /** Properties of a PredictionResult. */ + interface IPredictionResult { + + /** PredictionResult id */ + id?: (string|null); + + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { + + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); + + /** PredictionResult id. */ + public id: string; + + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise + */ + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise + */ + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise + */ + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; + } + + namespace ProductService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { + + /** + * Constructs a new CreateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); + + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Verifies a CreateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); + } + + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { + + /** + * Constructs a new GetProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Verifies a GetProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { + + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { + + /** + * Constructs a new UpdateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); + + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Verifies an UpdateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { + + /** DeleteProductRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { + + /** + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } + + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { + + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeMetadata); + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeMetadata): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { + + /** PurgeUserEventsRequest parent */ + parent?: (string|null); + + /** PurgeUserEventsRequest filter */ + filter?: (string|null); + + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest); + + /** PurgeUserEventsRequest parent. */ + public parent: string; + + /** PurgeUserEventsRequest filter. */ + public filter: string; + + /** PurgeUserEventsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { + + /** + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent + */ + public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback): void; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise + */ + public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest): Promise; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody + */ + public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback): void; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise + */ + public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest): Promise; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback): void; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise + */ + public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): Promise; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback): void; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise + */ + public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest): Promise; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback): void; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise + */ + public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): Promise; + } + + namespace UserEventService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent + */ + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.UserEvent) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody + */ + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { + + /** WriteUserEventRequest parent */ + parent?: (string|null); + + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + } + + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { + + /** + * Constructs a new WriteUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest); + + /** WriteUserEventRequest parent. */ + public parent: string; + + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Verifies a WriteUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { + + /** CollectUserEventRequest parent */ + parent?: (string|null); + + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); + } + + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { + + /** + * Constructs a new CollectUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest); + + /** CollectUserEventRequest parent. */ + public parent: string; + + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Verifies a CollectUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { + + /** RejoinUserEventsRequest parent */ + parent?: (string|null); + + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null); + } + + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + + /** + * Constructs a new RejoinUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest); + + /** RejoinUserEventsRequest parent. */ + public parent: string; + + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope); + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Verifies a RejoinUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace RejoinUserEventsRequest { + + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + + /** + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { + } + + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + + /** + * Constructs a new RejoinUserEventsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata); + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace v2beta. */ + namespace v2beta { + + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { + + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); + } + + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { + + /** + * Constructs a new ProductLevelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductLevelConfig); + + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductLevelConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductLevelConfig): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Verifies a ProductLevelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductLevelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductLevelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + } + + /** Represents a Catalog. */ + class Catalog implements ICatalog { + + /** + * Constructs a new Catalog. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + + /** + * Creates a new Catalog instance using the specified properties. + * @param [properties] Properties to set + * @returns Catalog instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICatalog): google.cloud.retail.v2beta.Catalog; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Catalog; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Catalog; + + /** + * Verifies a Catalog message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Catalog + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Catalog; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Catalog to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { + + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest, callback: google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback): void; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest): Promise; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback): void; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest): Promise; + } + + namespace CatalogService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListCatalogsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Catalog) => void; + } + + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { + + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListCatalogsRequest); + + /** ListCatalogsRequest parent. */ + public parent: string; + + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListCatalogsRequest): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Verifies a ListCatalogsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { + + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2beta.ICatalog[]|null); + + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { + + /** + * Constructs a new ListCatalogsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListCatalogsResponse); + + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2beta.ICatalog[]; + + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListCatalogsResponse): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Verifies a ListCatalogsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { + + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2beta.ICatalog|null); + + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { + + /** + * Constructs a new UpdateCatalogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest); + + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2beta.ICatalog|null); + + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCatalogRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Verifies an UpdateCatalogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCatalogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + } + + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { + + /** + * Constructs a new CustomAttribute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomAttribute instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICustomAttribute): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Verifies a CustomAttribute message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomAttribute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomAttribute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image uri */ + uri?: (string|null); + + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImage); + + /** Image uri. */ + public uri: string; + + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImage): google.cloud.retail.v2beta.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Image message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Image; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Image; + + /** + * Verifies an Image message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Image + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Image; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PriceInfo. */ + interface IPriceInfo { + + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { + + /** + * Constructs a new PriceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPriceInfo): google.cloud.retail.v2beta.PriceInfo; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo; + + /** + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); + + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { + + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserInfo); + + /** UserInfo userId. */ + public userId: string; + + /** UserInfo ipAddress. */ + public ipAddress: string; + + /** UserInfo userAgent. */ + public userAgent: string; + + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; + + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserInfo): google.cloud.retail.v2beta.UserInfo; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserInfo; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserInfo; + + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserInfo; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource inputUris */ + inputUris?: (string[]|null); + + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGcsSource); + + /** GcsSource inputUris. */ + public inputUris: string[]; + + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGcsSource): google.cloud.retail.v2beta.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GcsSource; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GcsSource; + + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GcsSource; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { + + /** + * Constructs a new BigQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IBigQuerySource); + + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQuerySource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IBigQuerySource): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Verifies a BigQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { + + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2beta.IProduct[]|null); + } + + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { + + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductInlineSource); + + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2beta.IProduct[]; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductInlineSource): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { + + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2beta.IUserEvent[]|null); + } + + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { + + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventInlineSource); + + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2beta.IUserEvent[]; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventInlineSource): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { + + /** + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix: string; + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportErrorsConfig): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { + + /** ImportProductsRequest parent */ + parent?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { + + /** + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportProductsRequest); + + /** ImportProductsRequest parent. */ + public parent: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportProductsRequest): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ + parent?: (string|null); + + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { + + /** + * Constructs a new ImportUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest); + + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Verifies an ImportUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { + + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + } + + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { + + /** + * Constructs a new ProductInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductInputConfig); + + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductInputConfig): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Verifies a ProductInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { + + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + } + + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { + + /** + * Constructs a new UserEventInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventInputConfig); + + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventInputConfig): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Verifies a UserEventInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportMetadata. */ + interface IImportMetadata { + + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + } + + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { + + /** + * Constructs a new ImportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportMetadata); + + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportMetadata): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Verifies an ImportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { + + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + } + + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { + + /** + * Constructs a new ImportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportProductsResponse); + + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportProductsResponse): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Verifies an ImportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { + + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); + } + + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { + + /** + * Constructs a new ImportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse); + + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Verifies an ImportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { + + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); + + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); + } + + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { + + /** + * Constructs a new UserEventImportSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventImportSummary); + + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); + + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventImportSummary instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventImportSummary): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Verifies a UserEventImportSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventImportSummary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventImportSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Product. */ + interface IProduct { + + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product categories */ + categories?: (string[]|null); + + /** Product title */ + title?: (string|null); + + /** Product description */ + description?: (string|null); + + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2beta.IImage[]|null); + } + + /** Represents a Product. */ + class Product implements IProduct { + + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProduct); + + /** Product name. */ + public name: string; + + /** Product id. */ + public id: string; + + /** Product type. */ + public type: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type); + + /** Product primaryProductId. */ + public primaryProductId: string; + + /** Product categories. */ + public categories: string[]; + + /** Product title. */ + public title: string; + + /** Product description. */ + public description: string; + + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + + /** Product tags. */ + public tags: string[]; + + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability. */ + public availability: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability); + + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product uri. */ + public uri: string; + + /** Product images. */ + public images: google.cloud.retail.v2beta.IImage[]; + + /** + * Creates a new Product instance using the specified properties. + * @param [properties] Properties to set + * @returns Product instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProduct): google.cloud.retail.v2beta.Product; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Product message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Product; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Product; + + /** + * Verifies a Product message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Product + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Product; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Product to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Product { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } + + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } + } + + /** Properties of a UserEvent. */ + interface IUserEvent { + + /** UserEvent eventType */ + eventType?: (string|null); + + /** UserEvent visitorId */ + visitorId?: (string|null); + + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); + + /** UserEvent attributionToken */ + attributionToken?: (string|null); + + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2beta.IProductDetail[]|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } + + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { + + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEvent); + + /** UserEvent eventType. */ + public eventType: string; + + /** UserEvent visitorId. */ + public visitorId: string; + + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2beta.IProductDetail[]; + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; + + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEvent): google.cloud.retail.v2beta.UserEvent; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEvent; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEvent; + + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEvent; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductDetail. */ + interface IProductDetail { + + /** ProductDetail product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); + } + + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { + + /** + * Constructs a new ProductDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductDetail); + + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new ProductDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductDetail instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductDetail): google.cloud.retail.v2beta.ProductDetail; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductDetail; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductDetail; + + /** + * Verifies a ProductDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductDetail; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { + + /** PurchaseTransaction id */ + id?: (string|null); + + /** PurchaseTransaction revenue */ + revenue?: (number|null); + + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); + } + + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { + + /** + * Constructs a new PurchaseTransaction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurchaseTransaction); + + /** PurchaseTransaction id. */ + public id: string; + + /** PurchaseTransaction revenue. */ + public revenue: number; + + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @param [properties] Properties to set + * @returns PurchaseTransaction instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurchaseTransaction): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Verifies a PurchaseTransaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurchaseTransaction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurchaseTransaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { + + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; + } + + namespace PredictionService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); + + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPredictRequest): google.cloud.retail.v2beta.PredictRequest; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictRequest; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictRequest; + + /** + * Verifies a PredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictRequest; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PredictResponse. */ + interface IPredictResponse { + + /** PredictResponse results */ + results?: (google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]|null); + + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { + + /** + * Constructs a new PredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPredictResponse); + + /** PredictResponse results. */ + public results: google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]; + + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPredictResponse): google.cloud.retail.v2beta.PredictResponse; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse; + + /** + * Verifies a PredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PredictResponse { + + /** Properties of a PredictionResult. */ + interface IPredictionResult { + + /** PredictionResult id */ + id?: (string|null); + + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { + + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult); + + /** PredictionResult id. */ + public id: string; + + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest, callback: google.cloud.retail.v2beta.ProductService.CreateProductCallback): void; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest): Promise; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest, callback: google.cloud.retail.v2beta.ProductService.GetProductCallback): void; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise + */ + public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest): Promise; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest, callback: google.cloud.retail.v2beta.ProductService.UpdateProductCallback): void; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest): Promise; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest, callback: google.cloud.retail.v2beta.ProductService.DeleteProductCallback): void; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise + */ + public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest): Promise; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ImportProductsCallback): void; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise + */ + public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest): Promise; + } + + namespace ProductService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { + + /** + * Constructs a new CreateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICreateProductRequest); + + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICreateProductRequest): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Verifies a CreateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); + } + + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { + + /** + * Constructs a new GetProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGetProductRequest): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Verifies a GetProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { + + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { + + /** + * Constructs a new UpdateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUpdateProductRequest); + + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUpdateProductRequest): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Verifies an UpdateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { + + /** DeleteProductRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { + + /** + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IDeleteProductRequest): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } + + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { + + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeMetadata); + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurgeMetadata): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { + + /** PurgeUserEventsRequest parent */ + parent?: (string|null); + + /** PurgeUserEventsRequest filter */ + filter?: (string|null); + + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest); + + /** PurgeUserEventsRequest parent. */ + public parent: string; + + /** PurgeUserEventsRequest filter. */ + public filter: string; + + /** PurgeUserEventsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { + + /** + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent + */ + public writeUserEvent(request: google.cloud.retail.v2beta.IWriteUserEventRequest, callback: google.cloud.retail.v2beta.UserEventService.WriteUserEventCallback): void; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise + */ + public writeUserEvent(request: google.cloud.retail.v2beta.IWriteUserEventRequest): Promise; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody + */ + public collectUserEvent(request: google.cloud.retail.v2beta.ICollectUserEventRequest, callback: google.cloud.retail.v2beta.UserEventService.CollectUserEventCallback): void; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise + */ + public collectUserEvent(request: google.cloud.retail.v2beta.ICollectUserEventRequest): Promise; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeUserEvents(request: google.cloud.retail.v2beta.IPurgeUserEventsRequest, callback: google.cloud.retail.v2beta.UserEventService.PurgeUserEventsCallback): void; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise + */ + public purgeUserEvents(request: google.cloud.retail.v2beta.IPurgeUserEventsRequest): Promise; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importUserEvents(request: google.cloud.retail.v2beta.IImportUserEventsRequest, callback: google.cloud.retail.v2beta.UserEventService.ImportUserEventsCallback): void; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise + */ + public importUserEvents(request: google.cloud.retail.v2beta.IImportUserEventsRequest): Promise; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rejoinUserEvents(request: google.cloud.retail.v2beta.IRejoinUserEventsRequest, callback: google.cloud.retail.v2beta.UserEventService.RejoinUserEventsCallback): void; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise + */ + public rejoinUserEvents(request: google.cloud.retail.v2beta.IRejoinUserEventsRequest): Promise; + } + + namespace UserEventService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent + */ + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.UserEvent) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody + */ + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { + + /** WriteUserEventRequest parent */ + parent?: (string|null); + + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + } + + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { + + /** + * Constructs a new WriteUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IWriteUserEventRequest); + + /** WriteUserEventRequest parent. */ + public parent: string; + + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IWriteUserEventRequest): google.cloud.retail.v2beta.WriteUserEventRequest; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2beta.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.WriteUserEventRequest; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.WriteUserEventRequest; + + /** + * Verifies a WriteUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.WriteUserEventRequest; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { + + /** CollectUserEventRequest parent */ + parent?: (string|null); + + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); + } + + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { + + /** + * Constructs a new CollectUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICollectUserEventRequest); + + /** CollectUserEventRequest parent. */ + public parent: string; + + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICollectUserEventRequest): google.cloud.retail.v2beta.CollectUserEventRequest; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CollectUserEventRequest; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CollectUserEventRequest; + + /** + * Verifies a CollectUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CollectUserEventRequest; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { + + /** RejoinUserEventsRequest parent */ + parent?: (string|null); + + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope|null); + } + + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + + /** + * Constructs a new RejoinUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRejoinUserEventsRequest); + + /** RejoinUserEventsRequest parent. */ + public parent: string; + + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope); + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRejoinUserEventsRequest): google.cloud.retail.v2beta.RejoinUserEventsRequest; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RejoinUserEventsRequest; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RejoinUserEventsRequest; + + /** + * Verifies a RejoinUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RejoinUserEventsRequest; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace RejoinUserEventsRequest { + + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + + /** + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRejoinUserEventsResponse): google.cloud.retail.v2beta.RejoinUserEventsResponse; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RejoinUserEventsResponse; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RejoinUserEventsResponse; + + /** + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RejoinUserEventsResponse; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { + } + + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + + /** + * Constructs a new RejoinUserEventsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRejoinUserEventsMetadata); + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRejoinUserEventsMetadata): google.cloud.retail.v2beta.RejoinUserEventsMetadata; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RejoinUserEventsMetadata; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RejoinUserEventsMetadata; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RejoinUserEventsMetadata; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get: string; + + /** HttpRule put. */ + public put: string; + + /** HttpRule post. */ + public post: string; + + /** HttpRule delete. */ + public delete: string; + + /** HttpRule patch. */ + public patch: string; + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HttpBody. */ + interface IHttpBody { + + /** HttpBody contentType */ + contentType?: (string|null); + + /** HttpBody data */ + data?: (Uint8Array|string|null); + + /** HttpBody extensions */ + extensions?: (google.protobuf.IAny[]|null); + } + + /** Represents a HttpBody. */ + class HttpBody implements IHttpBody { + + /** + * Constructs a new HttpBody. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpBody); + + /** HttpBody contentType. */ + public contentType: string; + + /** HttpBody data. */ + public data: (Uint8Array|string); + + /** HttpBody extensions. */ + public extensions: google.protobuf.IAny[]; + + /** + * Creates a new HttpBody instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpBody instance + */ + public static create(properties?: google.api.IHttpBody): google.api.HttpBody; + + /** + * Encodes the specified HttpBody message. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. + * @param message HttpBody message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpBody message, length delimited. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. + * @param message HttpBody message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpBody message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpBody; + + /** + * Decodes a HttpBody message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpBody; + + /** + * Verifies a HttpBody message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpBody message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpBody + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpBody; + + /** + * Creates a plain object from a HttpBody message. Also converts values to other types if specified. + * @param message HttpBody + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpBody, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpBody to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions phpGenericServices */ + phpGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions phpGenericServices. */ + public phpGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + + /** MethodOptions .google.longrunning.operationInfo */ + ".google.longrunning.operationInfo"?: (google.longrunning.IOperationInfo|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DoubleValue. */ + interface IDoubleValue { + + /** DoubleValue value */ + value?: (number|null); + } + + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { + + /** + * Constructs a new DoubleValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDoubleValue); + + /** DoubleValue value. */ + public value: number; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @param [properties] Properties to set + * @returns DoubleValue instance + */ + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DoubleValue; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DoubleValue; + + /** + * Verifies a DoubleValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoubleValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @param message DoubleValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoubleValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FloatValue. */ + interface IFloatValue { + + /** FloatValue value */ + value?: (number|null); + } + + /** Represents a FloatValue. */ + class FloatValue implements IFloatValue { + + /** + * Constructs a new FloatValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFloatValue); + + /** FloatValue value. */ + public value: number; + + /** + * Creates a new FloatValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FloatValue instance + */ + public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FloatValue; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FloatValue; + + /** + * Verifies a FloatValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FloatValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @param message FloatValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FloatValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Int64Value. */ + interface IInt64Value { + + /** Int64Value value */ + value?: (number|Long|string|null); + } + + /** Represents an Int64Value. */ + class Int64Value implements IInt64Value { + + /** + * Constructs a new Int64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt64Value); + + /** Int64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new Int64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int64Value instance + */ + public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int64Value; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int64Value; + + /** + * Verifies an Int64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @param message Int64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UInt64Value. */ + interface IUInt64Value { + + /** UInt64Value value */ + value?: (number|Long|string|null); + } + + /** Represents a UInt64Value. */ + class UInt64Value implements IUInt64Value { + + /** + * Constructs a new UInt64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt64Value); + + /** UInt64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new UInt64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt64Value instance + */ + public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt64Value; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt64Value; + + /** + * Verifies a UInt64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @param message UInt64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Int32Value. */ + interface IInt32Value { + + /** Int32Value value */ + value?: (number|null); + } + + /** Represents an Int32Value. */ + class Int32Value implements IInt32Value { + + /** + * Constructs a new Int32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt32Value); + + /** Int32Value value. */ + public value: number; + + /** + * Creates a new Int32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int32Value instance + */ + public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int32Value; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int32Value; + + /** + * Verifies an Int32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @param message Int32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UInt32Value. */ + interface IUInt32Value { + + /** UInt32Value value */ + value?: (number|null); + } + + /** Represents a UInt32Value. */ + class UInt32Value implements IUInt32Value { + + /** + * Constructs a new UInt32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt32Value); + + /** UInt32Value value. */ + public value: number; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt32Value instance + */ + public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt32Value; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt32Value; + + /** + * Verifies a UInt32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @param message UInt32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoolValue. */ + interface IBoolValue { + + /** BoolValue value */ + value?: (boolean|null); + } + + /** Represents a BoolValue. */ + class BoolValue implements IBoolValue { + + /** + * Constructs a new BoolValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBoolValue); + + /** BoolValue value. */ + public value: boolean; + + /** + * Creates a new BoolValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BoolValue instance + */ + public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BoolValue; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BoolValue; + + /** + * Verifies a BoolValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoolValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @param message BoolValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoolValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StringValue. */ + interface IStringValue { + + /** StringValue value */ + value?: (string|null); + } + + /** Represents a StringValue. */ + class StringValue implements IStringValue { + + /** + * Constructs a new StringValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStringValue); + + /** StringValue value. */ + public value: string; + + /** + * Creates a new StringValue instance using the specified properties. + * @param [properties] Properties to set + * @returns StringValue instance + */ + public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.StringValue; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.StringValue; + + /** + * Verifies a StringValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StringValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @param message StringValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StringValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BytesValue. */ + interface IBytesValue { + + /** BytesValue value */ + value?: (Uint8Array|string|null); + } + + /** Represents a BytesValue. */ + class BytesValue implements IBytesValue { + + /** + * Constructs a new BytesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBytesValue); + + /** BytesValue value. */ + public value: (Uint8Array|string); + + /** + * Creates a new BytesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BytesValue instance + */ + public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BytesValue; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BytesValue; + + /** + * Verifies a BytesValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BytesValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @param message BytesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BytesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Struct. */ + interface IStruct { + + /** Struct fields */ + fields?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a Struct. */ + class Struct implements IStruct { + + /** + * Constructs a new Struct. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStruct); + + /** Struct fields. */ + public fields: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new Struct instance using the specified properties. + * @param [properties] Properties to set + * @returns Struct instance + */ + public static create(properties?: google.protobuf.IStruct): google.protobuf.Struct; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Struct; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Struct; + + /** + * Verifies a Struct message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Struct + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Struct; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @param message Struct + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Struct, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Struct to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value nullValue */ + nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue */ + numberValue?: (number|null); + + /** Value stringValue */ + stringValue?: (string|null); + + /** Value boolValue */ + boolValue?: (boolean|null); + + /** Value structValue */ + structValue?: (google.protobuf.IStruct|null); + + /** Value listValue */ + listValue?: (google.protobuf.IListValue|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IValue); + + /** Value nullValue. */ + public nullValue: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue); + + /** Value numberValue. */ + public numberValue: number; + + /** Value stringValue. */ + public stringValue: string; + + /** Value boolValue. */ + public boolValue: boolean; + + /** Value structValue. */ + public structValue?: (google.protobuf.IStruct|null); + + /** Value listValue. */ + public listValue?: (google.protobuf.IListValue|null); + + /** Value kind. */ + public kind?: ("nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"); + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.protobuf.IValue): google.protobuf.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** NullValue enum. */ + enum NullValue { + NULL_VALUE = 0 + } + + /** Properties of a ListValue. */ + interface IListValue { + + /** ListValue values */ + values?: (google.protobuf.IValue[]|null); + } + + /** Represents a ListValue. */ + class ListValue implements IListValue { + + /** + * Constructs a new ListValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IListValue); + + /** ListValue values. */ + public values: google.protobuf.IValue[]; + + /** + * Creates a new ListValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ListValue instance + */ + public static create(properties?: google.protobuf.IListValue): google.protobuf.ListValue; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ListValue; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ListValue; + + /** + * Verifies a ListValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ListValue; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @param message ListValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ListValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; + + /** + * Verifies a Status message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace longrunning. */ + namespace longrunning { + + /** Represents an Operations */ + class Operations extends $protobuf.rpc.Service { + + /** + * Constructs a new Operations service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Operations service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Operations; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListOperationsResponse + */ + public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @returns Promise + */ + public listOperations(request: google.longrunning.IListOperationsRequest): Promise; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @returns Promise + */ + public getOperation(request: google.longrunning.IGetOperationRequest): Promise; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @returns Promise + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @returns Promise + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @returns Promise + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; + } + + namespace Operations { + + /** + * Callback as used by {@link google.longrunning.Operations#listOperations}. + * @param error Error, if any + * @param [response] ListOperationsResponse + */ + type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#getOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation name */ + name?: (string|null); + + /** Operation metadata */ + metadata?: (google.protobuf.IAny|null); + + /** Operation done */ + done?: (boolean|null); + + /** Operation error */ + error?: (google.rpc.IStatus|null); + + /** Operation response */ + response?: (google.protobuf.IAny|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperation); + + /** Operation name. */ + public name: string; + + /** Operation metadata. */ + public metadata?: (google.protobuf.IAny|null); + + /** Operation done. */ + public done: boolean; + + /** Operation error. */ + public error?: (google.rpc.IStatus|null); + + /** Operation response. */ + public response?: (google.protobuf.IAny|null); + + /** Operation result. */ + public result?: ("error"|"response"); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.Operation; + + /** + * Verifies an Operation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetOperationRequest. */ + interface IGetOperationRequest { + + /** GetOperationRequest name */ + name?: (string|null); + } + + /** Represents a GetOperationRequest. */ + class GetOperationRequest implements IGetOperationRequest { + + /** + * Constructs a new GetOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IGetOperationRequest); + + /** GetOperationRequest name. */ + public name: string; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetOperationRequest instance + */ + public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.GetOperationRequest; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.GetOperationRequest; + + /** + * Verifies a GetOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @param message GetOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListOperationsRequest. */ + interface IListOperationsRequest { + + /** ListOperationsRequest name */ + name?: (string|null); + + /** ListOperationsRequest filter */ + filter?: (string|null); + + /** ListOperationsRequest pageSize */ + pageSize?: (number|null); + + /** ListOperationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListOperationsRequest. */ + class ListOperationsRequest implements IListOperationsRequest { + + /** + * Constructs a new ListOperationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsRequest); + + /** ListOperationsRequest name. */ + public name: string; + + /** ListOperationsRequest filter. */ + public filter: string; + + /** ListOperationsRequest pageSize. */ + public pageSize: number; + + /** ListOperationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsRequest instance + */ + public static create(properties?: google.longrunning.IListOperationsRequest): google.longrunning.ListOperationsRequest; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.ListOperationsRequest; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.ListOperationsRequest; + + /** + * Verifies a ListOperationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsRequest; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @param message ListOperationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListOperationsResponse. */ + interface IListOperationsResponse { + + /** ListOperationsResponse operations */ + operations?: (google.longrunning.IOperation[]|null); + + /** ListOperationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListOperationsResponse. */ + class ListOperationsResponse implements IListOperationsResponse { + + /** + * Constructs a new ListOperationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsResponse); + + /** ListOperationsResponse operations. */ + public operations: google.longrunning.IOperation[]; + + /** ListOperationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsResponse instance + */ + public static create(properties?: google.longrunning.IListOperationsResponse): google.longrunning.ListOperationsResponse; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.ListOperationsResponse; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.ListOperationsResponse; + + /** + * Verifies a ListOperationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsResponse; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @param message ListOperationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CancelOperationRequest. */ + interface ICancelOperationRequest { + + /** CancelOperationRequest name */ + name?: (string|null); + } + + /** Represents a CancelOperationRequest. */ + class CancelOperationRequest implements ICancelOperationRequest { + + /** + * Constructs a new CancelOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.ICancelOperationRequest); + + /** CancelOperationRequest name. */ + public name: string; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CancelOperationRequest instance + */ + public static create(properties?: google.longrunning.ICancelOperationRequest): google.longrunning.CancelOperationRequest; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.CancelOperationRequest; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.CancelOperationRequest; + + /** + * Verifies a CancelOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CancelOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.CancelOperationRequest; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @param message CancelOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.CancelOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CancelOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteOperationRequest. */ + interface IDeleteOperationRequest { + + /** DeleteOperationRequest name */ + name?: (string|null); + } + + /** Represents a DeleteOperationRequest. */ + class DeleteOperationRequest implements IDeleteOperationRequest { + + /** + * Constructs a new DeleteOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IDeleteOperationRequest); + + /** DeleteOperationRequest name. */ + public name: string; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteOperationRequest instance + */ + public static create(properties?: google.longrunning.IDeleteOperationRequest): google.longrunning.DeleteOperationRequest; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.DeleteOperationRequest; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.DeleteOperationRequest; + + /** + * Verifies a DeleteOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.DeleteOperationRequest; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @param message DeleteOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.DeleteOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a WaitOperationRequest. */ + interface IWaitOperationRequest { + + /** WaitOperationRequest name */ + name?: (string|null); + + /** WaitOperationRequest timeout */ + timeout?: (google.protobuf.IDuration|null); + } + + /** Represents a WaitOperationRequest. */ + class WaitOperationRequest implements IWaitOperationRequest { + + /** + * Constructs a new WaitOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IWaitOperationRequest); + + /** WaitOperationRequest name. */ + public name: string; + + /** WaitOperationRequest timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WaitOperationRequest instance + */ + public static create(properties?: google.longrunning.IWaitOperationRequest): google.longrunning.WaitOperationRequest; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.WaitOperationRequest; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.WaitOperationRequest; + + /** + * Verifies a WaitOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WaitOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.WaitOperationRequest; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @param message WaitOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.WaitOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WaitOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OperationInfo. */ + interface IOperationInfo { + + /** OperationInfo responseType */ + responseType?: (string|null); + + /** OperationInfo metadataType */ + metadataType?: (string|null); + } + + /** Represents an OperationInfo. */ + class OperationInfo implements IOperationInfo { + + /** + * Constructs a new OperationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperationInfo); + + /** OperationInfo responseType. */ + public responseType: string; + + /** OperationInfo metadataType. */ + public metadataType: string; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationInfo instance + */ + public static create(properties?: google.longrunning.IOperationInfo): google.longrunning.OperationInfo; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.OperationInfo; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.OperationInfo; + + /** + * Verifies an OperationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationInfo + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.OperationInfo; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @param message OperationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.OperationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } +} diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js new file mode 100644 index 00000000000..08ca231f374 --- /dev/null +++ b/packages/google-cloud-retail/protos/protos.js @@ -0,0 +1,50075 @@ +// Copyright 2021 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. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("google-gax").protobufMinimal); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots._google_cloud_retail_protos || ($protobuf.roots._google_cloud_retail_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.retail = (function() { + + /** + * Namespace retail. + * @memberof google.cloud + * @namespace + */ + var retail = {}; + + retail.v2 = (function() { + + /** + * Namespace v2. + * @memberof google.cloud.retail + * @namespace + */ + var v2 = {}; + + v2.ProductLevelConfig = (function() { + + /** + * Properties of a ProductLevelConfig. + * @memberof google.cloud.retail.v2 + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + */ + + /** + * Constructs a new ProductLevelConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig + * @constructor + * @param {google.cloud.retail.v2.IProductLevelConfig=} [properties] Properties to set + */ + function ProductLevelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.ingestionProductType = ""; + + /** + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductLevelConfig} ProductLevelConfig instance + */ + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); + }; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductLevelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + return writer; + }; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductLevelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductLevelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ingestionProductType = reader.string(); + break; + case 2: + message.merchantCenterProductIdField = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductLevelConfig message. + * @function verify + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductLevelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; + return null; + }; + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ProductLevelConfig} ProductLevelConfig + */ + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductLevelConfig) + return object; + var message = new $root.google.cloud.retail.v2.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + return message; + }; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2.ProductLevelConfig} message ProductLevelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductLevelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; + } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; + return object; + }; + + /** + * Converts this ProductLevelConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @instance + * @returns {Object.} JSON object + */ + ProductLevelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductLevelConfig; + })(); + + v2.Catalog = (function() { + + /** + * Properties of a Catalog. + * @memberof google.cloud.retail.v2 + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + */ + + /** + * Constructs a new Catalog. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a Catalog. + * @implements ICatalog + * @constructor + * @param {google.cloud.retail.v2.ICatalog=} [properties] Properties to set + */ + function Catalog(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2.Catalog + * @instance + */ + Catalog.prototype.name = ""; + + /** + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; + + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; + + /** + * Creates a new Catalog instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {google.cloud.retail.v2.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Catalog} Catalog instance + */ + Catalog.create = function create(properties) { + return new Catalog(properties); + }; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {google.cloud.retail.v2.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {google.cloud.retail.v2.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + return null; + }; + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Catalog} Catalog + */ + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Catalog) + return object; + var message = new $root.google.cloud.retail.v2.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.fromObject(object.productLevelConfig); + } + return message; + }; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {google.cloud.retail.v2.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.toObject(message.productLevelConfig, options); + return object; + }; + + /** + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Catalog + * @instance + * @returns {Object.} JSON object + */ + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Catalog; + })(); + + v2.CatalogService = (function() { + + /** + * Constructs a new CatalogService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance + */ + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); + }; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + */ + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) + return object; + var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsRequest; + })(); + + v2.ListCatalogsResponse = (function() { + + /** + * Properties of a ListCatalogsResponse. + * @memberof google.cloud.retail.v2 + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + */ + + /** + * Constructs a new ListCatalogsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse + * @constructor + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + */ + function ListCatalogsResponse(properties) { + this.catalogs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + + /** + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance + */ + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); + }; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + */ + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsResponse; + })(); + + v2.UpdateCatalogRequest = (function() { + + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ + + /** + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest + * @constructor + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + */ + function UpdateCatalogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.catalog = null; + + /** + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance + */ + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCatalogRequest message. + * @function verify + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCatalogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + */ + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) + return object; + var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCatalogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCatalogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCatalogRequest; + })(); + + v2.CustomAttribute = (function() { + + /** + * Properties of a CustomAttribute. + * @memberof google.cloud.retail.v2 + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + */ + + /** + * Constructs a new CustomAttribute. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute + * @constructor + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + */ + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.text = $util.emptyArray; + + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance + */ + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); + }; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + case 2: + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomAttribute message. + * @function verify + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomAttribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + return null; + }; + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + */ + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) + return object; + var message = new $root.google.cloud.retail.v2.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + return message; + }; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomAttribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + return object; + }; + + /** + * Converts this CustomAttribute to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + * @returns {Object.} JSON object + */ + CustomAttribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomAttribute; + })(); + + v2.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.retail.v2 + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.retail.v2.IImage=} [properties] Properties to set + */ + function Image(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.Image + * @instance + */ + Image.prototype.uri = ""; + + /** + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Image + * @static + * @param {google.cloud.retail.v2.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Image + * @static + * @param {google.cloud.retail.v2.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Image + * @static + * @param {google.cloud.retail.v2.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Image message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Image message. + * @function verify + * @memberof google.cloud.retail.v2.Image + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Image.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + return null; + }; + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Image) + return object; + var message = new $root.google.cloud.retail.v2.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Image + * @static + * @param {google.cloud.retail.v2.Image} message Image + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Image.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.height = 0; + object.width = 0; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Image + * @instance + * @returns {Object.} JSON object + */ + Image.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Image; + })(); + + v2.PriceInfo = (function() { + + /** + * Properties of a PriceInfo. + * @memberof google.cloud.retail.v2 + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + */ + + /** + * Constructs a new PriceInfo. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo + * @constructor + * @param {google.cloud.retail.v2.IPriceInfo=} [properties] Properties to set + */ + function PriceInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.currencyCode = ""; + + /** + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; + + /** + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.originalPrice = 0; + + /** + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {google.cloud.retail.v2.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo instance + */ + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); + }; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {google.cloud.retail.v2.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + return writer; + }; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {google.cloud.retail.v2.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PriceInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceInfo message. + * @function verify + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + return null; + }; + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo + */ + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PriceInfo) + return object; + var message = new $root.google.cloud.retail.v2.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + return message; + }; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {google.cloud.retail.v2.PriceInfo} message PriceInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + return object; + }; + + /** + * Converts this PriceInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + * @returns {Object.} JSON object + */ + PriceInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceInfo; + })(); + + v2.UserInfo = (function() { + + /** + * Properties of a UserInfo. + * @memberof google.cloud.retail.v2 + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + */ + + /** + * Constructs a new UserInfo. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserInfo. + * @implements IUserInfo + * @constructor + * @param {google.cloud.retail.v2.IUserInfo=} [properties] Properties to set + */ + function UserInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.userId = ""; + + /** + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.ipAddress = ""; + + /** + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {google.cloud.retail.v2.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserInfo} UserInfo instance + */ + UserInfo.create = function create(properties) { + return new UserInfo(properties); + }; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {google.cloud.retail.v2.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + return writer; + }; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {google.cloud.retail.v2.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserInfo message. + * @function verify + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; + return null; + }; + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UserInfo} UserInfo + */ + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserInfo) + return object; + var message = new $root.google.cloud.retail.v2.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); + return message; + }; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {google.cloud.retail.v2.UserInfo} message UserInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; + } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; + return object; + }; + + /** + * Converts this UserInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserInfo + * @instance + * @returns {Object.} JSON object + */ + UserInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserInfo; + })(); + + v2.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.retail.v2 + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + this.inputUris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2.GcsSource + * @instance + */ + GcsSource.prototype.inputUris = $util.emptyArray; + + /** + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + case 2: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSource message. + * @function verify + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GcsSource) + return object; + var message = new $root.google.cloud.retail.v2.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); + } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.GcsSource} message GcsSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v2.BigQuerySource = (function() { + + /** + * Properties of a BigQuerySource. + * @memberof google.cloud.retail.v2 + * @interface IBigQuerySource + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema + */ + + /** + * Constructs a new BigQuerySource. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource + * @constructor + * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set + */ + function BigQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.projectId = ""; + + /** + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource instance + */ + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); + }; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + return writer; + }; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.BigQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.projectId = reader.string(); + break; + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQuerySource message. + * @function verify + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + */ + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.BigQuerySource) + return object; + var message = new $root.google.cloud.retail.v2.BigQuerySource(); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {google.cloud.retail.v2.BigQuerySource} message BigQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + return object; + }; + + /** + * Converts this BigQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + * @returns {Object.} JSON object + */ + BigQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQuerySource; + })(); + + v2.ProductInlineSource = (function() { + + /** + * Properties of a ProductInlineSource. + * @memberof google.cloud.retail.v2 + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products + */ + + /** + * Constructs a new ProductInlineSource. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource + * @constructor + * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set + */ + function ProductInlineSource(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2.ProductInlineSource + * @instance + */ + ProductInlineSource.prototype.products = $util.emptyArray; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource instance + */ + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); + }; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + return null; + }; + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + */ + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductInlineSource) + return object; + var message = new $root.google.cloud.retail.v2.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {google.cloud.retail.v2.ProductInlineSource} message ProductInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); + } + return object; + }; + + /** + * Converts this ProductInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ProductInlineSource + * @instance + * @returns {Object.} JSON object + */ + ProductInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInlineSource; + })(); + + v2.UserEventInlineSource = (function() { + + /** + * Properties of a UserEventInlineSource. + * @memberof google.cloud.retail.v2 + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + */ + + /** + * Constructs a new UserEventInlineSource. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource + * @constructor + * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set + */ + function UserEventInlineSource(properties) { + this.userEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource instance + */ + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); + }; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource + */ + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventInlineSource) + return object; + var message = new $root.google.cloud.retail.v2.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.UserEventInlineSource} message UserEventInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvents[j], options); + } + return object; + }; + + /** + * Converts this UserEventInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @instance + * @returns {Object.} JSON object + */ + UserEventInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInlineSource; + })(); + + v2.ImportErrorsConfig = (function() { + + /** + * Properties of an ImportErrorsConfig. + * @memberof google.cloud.retail.v2 + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ImportErrorsConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set + */ + function ImportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportErrorsConfig gcsPrefix. + * @member {string} gcsPrefix + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @instance + */ + ImportErrorsConfig.prototype.gcsPrefix = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @instance + */ + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig instance + */ + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); + }; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig + */ + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2.ImportErrorsConfig} message ImportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ImportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportErrorsConfig; + })(); + + v2.ImportProductsRequest = (function() { + + /** + * Properties of an ImportProductsRequest. + * @memberof google.cloud.retail.v2 + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {google.cloud.retail.v2.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + */ + + /** + * Constructs a new ImportProductsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest + * @constructor + * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set + */ + function ImportProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.parent = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest instance + */ + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); + }; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest + */ + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2.ImportProductsRequest} message ImportProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this ImportProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsRequest; + })(); + + v2.ImportUserEventsRequest = (function() { + + /** + * Properties of an ImportUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + */ + + /** + * Constructs a new ImportUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2.IImportUserEventsRequest=} [properties] Properties to set + */ + function ImportUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.parent = ""; + + /** + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.inputConfig = null; + + /** + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.errorsConfig = null; + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest instance + */ + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); + }; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest + */ + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsRequest; + })(); + + v2.ProductInputConfig = (function() { + + /** + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2 + * @interface IProductInputConfig + * @property {google.cloud.retail.v2.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + */ + + /** + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig + * @constructor + * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set + */ + function ProductInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.productInlineSource = null; + + /** + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig instance + */ + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); + }; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {google.cloud.retail.v2.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + * @returns {Object.} JSON object + */ + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2.UserEventInputConfig = (function() { + + /** + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2 + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + */ + + /** + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.userEventInlineSource = null; + + /** + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.gcsSource = null; + + /** + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig instance + */ + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + */ + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventInputConfig) + return object; + var message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.fromObject(object.userEventInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.UserEventInputConfig} message UserEventInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this UserEventInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + * @returns {Object.} JSON object + */ + UserEventInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInputConfig; + })(); + + v2.ImportMetadata = (function() { + + /** + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2 + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + */ + + /** + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata + * @constructor + * @param {google.cloud.retail.v2.IImportMetadata=} [properties] Properties to set + */ + function ImportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.createTime = null; + + /** + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.updateTime = null; + + /** + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {google.cloud.retail.v2.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata instance + */ + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); + }; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {google.cloud.retail.v2.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + return writer; + }; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {google.cloud.retail.v2.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + return null; + }; + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata + */ + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportMetadata) + return object; + var message = new $root.google.cloud.retail.v2.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {google.cloud.retail.v2.ImportMetadata} message ImportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + return object; + }; + + /** + * Converts this ImportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportMetadata; + })(); + + v2.ImportProductsResponse = (function() { + + /** + * Properties of an ImportProductsResponse. + * @memberof google.cloud.retail.v2 + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + */ + + /** + * Constructs a new ImportProductsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse + * @constructor + * @param {google.cloud.retail.v2.IImportProductsResponse=} [properties] Properties to set + */ + function ImportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse instance + */ + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); + }; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse + */ + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2.ImportProductsResponse} message ImportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsResponse; + })(); + + v2.ImportUserEventsResponse = (function() { + + /** + * Properties of an ImportUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + */ + + /** + * Constructs a new ImportUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2.IImportUserEventsResponse=} [properties] Properties to set + */ + function ImportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse instance + */ + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse + */ + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.fromObject(object.importSummary); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.toObject(message.importSummary, options); + return object; + }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsResponse; + })(); + + v2.UserEventImportSummary = (function() { + + /** + * Properties of a UserEventImportSummary. + * @memberof google.cloud.retail.v2 + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + */ + + /** + * Constructs a new UserEventImportSummary. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary + * @constructor + * @param {google.cloud.retail.v2.IUserEventImportSummary=} [properties] Properties to set + */ + function UserEventImportSummary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary instance + */ + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); + }; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + return writer; + }; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventImportSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.joinedEventsCount = reader.int64(); + break; + case 2: + message.unjoinedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventImportSummary message. + * @function verify + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventImportSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary + */ + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventImportSummary) + return object; + var message = new $root.google.cloud.retail.v2.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2.UserEventImportSummary} message UserEventImportSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventImportSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; + } + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + return object; + }; + + /** + * Converts this UserEventImportSummary to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @instance + * @returns {Object.} JSON object + */ + UserEventImportSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventImportSummary; + })(); + + v2.Product = (function() { + + /** + * Properties of a Product. + * @memberof google.cloud.retail.v2 + * @interface IProduct + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {string|null} [description] Product description + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + */ + + /** + * Constructs a new Product. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set + */ + function Product(properties) { + this.categories = []; + this.attributes = {}; + this.tags = []; + this.images = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.name = ""; + + /** + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.id = ""; + + /** + * Product type. + * @member {google.cloud.retail.v2.Product.Type} type + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.type = 0; + + /** + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.primaryProductId = ""; + + /** + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.categories = $util.emptyArray; + + /** + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.title = ""; + + /** + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.description = ""; + + /** + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.availableTime = null; + + /** + * Product availability. + * @member {google.cloud.retail.v2.Product.Availability} availability + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.availability = 0; + + /** + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.availableQuantity = null; + + /** + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.uri = ""; + + /** + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.images = $util.emptyArray; + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Product + * @static + * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Product + * @static + * @param {google.cloud.retail.v2.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Product + * @static + * @param {google.cloud.retail.v2.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Product message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Product(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 10: + message.description = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2.Image.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Product message. + * @function verify + * @memberof google.cloud.retail.v2.Product + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Product.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + return null; + }; + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Product + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Product} Product + */ + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Product) + return object; + var message = new $root.google.cloud.retail.v2.Product(); + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.fromObject(object.priceInfo); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2.Image.fromObject(object.images[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Product + * @static + * @param {google.cloud.retail.v2.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.categories = []; + object.tags = []; + object.images = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.title = ""; + object.description = ""; + object.priceInfo = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2.PriceInfo.toObject(message.priceInfo, options); + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2.Image.toObject(message.images[j], options); + } + return object; + }; + + /** + * Converts this Product to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Product + * @instance + * @returns {Object.} JSON object + */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.retail.v2.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; + })(); + + v2.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2 + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId + */ + + /** + * Constructs a new UserEvent. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEvent. + * @implements IUserEvent + * @constructor + * @param {google.cloud.retail.v2.IUserEvent=} [properties] Properties to set + */ + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.eventType = ""; + + /** + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.visitorId = ""; + + /** + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.eventTime = null; + + /** + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.experimentIds = $util.emptyArray; + + /** + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.attributionToken = ""; + + /** + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.productDetails = $util.emptyArray; + + /** + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.attributes = $util.emptyObject; + + /** + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.cartId = ""; + + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; + + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; + + /** + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.pageCategories = $util.emptyArray; + + /** + * UserEvent userInfo. + * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.userInfo = null; + + /** + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {google.cloud.retail.v2.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEvent} UserEvent instance + */ + UserEvent.create = function create(properties) { + return new UserEvent(properties); + }; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {google.cloud.retail.v2.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + return writer; + }; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {google.cloud.retail.v2.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEvent(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventType = reader.string(); + break; + case 2: + message.visitorId = reader.string(); + break; + case 3: + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2.ProductDetail.decode(reader, reader.uint32())); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEvent message. + * @function verify + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; + } + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; + return null; + }; + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UserEvent} UserEvent + */ + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEvent) + return object; + var message = new $root.google.cloud.retail.v2.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); + } + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2.ProductDetail.fromObject(object.productDetails[i]); + } + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {google.cloud.retail.v2.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + return object; + }; + + /** + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserEvent + * @instance + * @returns {Object.} JSON object + */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEvent; + })(); + + v2.ProductDetail = (function() { + + /** + * Properties of a ProductDetail. + * @memberof google.cloud.retail.v2 + * @interface IProductDetail + * @property {google.cloud.retail.v2.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + */ + + /** + * Constructs a new ProductDetail. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductDetail. + * @implements IProductDetail + * @constructor + * @param {google.cloud.retail.v2.IProductDetail=} [properties] Properties to set + */ + function ProductDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductDetail product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.ProductDetail + * @instance + */ + ProductDetail.prototype.product = null; + + /** + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2.ProductDetail + * @instance + */ + ProductDetail.prototype.quantity = null; + + /** + * Creates a new ProductDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {google.cloud.retail.v2.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail instance + */ + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); + }; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {google.cloud.retail.v2.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {google.cloud.retail.v2.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + case 2: + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductDetail message. + * @function verify + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; + } + return null; + }; + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail + */ + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductDetail) + return object; + var message = new $root.google.cloud.retail.v2.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + } + return message; + }; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {google.cloud.retail.v2.ProductDetail} message ProductDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.quantity = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + return object; + }; + + /** + * Converts this ProductDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ProductDetail + * @instance + * @returns {Object.} JSON object + */ + ProductDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductDetail; + })(); + + v2.PurchaseTransaction = (function() { + + /** + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2 + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + */ + + /** + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction + * @constructor + * @param {google.cloud.retail.v2.IPurchaseTransaction=} [properties] Properties to set + */ + function PurchaseTransaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.id = ""; + + /** + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.revenue = 0; + + /** + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction instance + */ + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); + }; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + return writer; + }; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurchaseTransaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurchaseTransaction message. + * @function verify + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurchaseTransaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + */ + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurchaseTransaction) + return object; + var message = new $root.google.cloud.retail.v2.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.PurchaseTransaction} message PurchaseTransaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurchaseTransaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; + + /** + * Converts this PurchaseTransaction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + * @returns {Object.} JSON object + */ + PurchaseTransaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurchaseTransaction; + })(); + + v2.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. + * @memberof google.cloud.retail.v2.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2.PredictionService + * @instance + * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2.PredictRequest, $root.google.cloud.retail.v2.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2.PredictionService + * @instance + * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2 + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + */ + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictRequest) + return object; + var message = new $root.google.cloud.retail.v2.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.PredictRequest} message PredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this PredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + * @returns {Object.} JSON object + */ + PredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictRequest; + })(); + + v2.PredictResponse = (function() { + + /** + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2 + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly + */ + + /** + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.results = $util.emptyArray; + + /** + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse instance + */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictResponse message. + * @function verify + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + */ + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictResponse) + return object; + var message = new $root.google.cloud.retail.v2.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this PredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + * @returns {Object.} JSON object + */ + PredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + + /** + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + */ + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2.CreateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "CreateProduct" }); + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2.GetProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "GetProduct" }); + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2.UpdateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; + })(); + + v2.CreateProductRequest = (function() { + + /** + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2 + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId + */ + + /** + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest + * @constructor + * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set + */ + function CreateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest instance + */ + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); + }; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + return writer; + }; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + */ + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CreateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.CreateProductRequest} message CreateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this CreateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProductRequest; + })(); + + v2.GetProductRequest = (function() { + + /** + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name + */ + + /** + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest instance + */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.GetProductRequest + * @instance + * @returns {Object.} JSON object + */ + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProductRequest; + })(); + + v2.UpdateProductRequest = (function() { + + /** + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + */ + + /** + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProductRequest product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.product = null; + + /** + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest instance + */ + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + */ + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.UpdateProductRequest} message UpdateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.updateMask = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateProductRequest; + })(); + + v2.DeleteProductRequest = (function() { + + /** + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name + */ + + /** + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest + * @constructor + * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + */ + function DeleteProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @instance + */ + DeleteProductRequest.prototype.name = ""; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest instance + */ + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); + }; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + */ + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.DeleteProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.DeleteProductRequest} message DeleteProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProductRequest; + })(); + + v2.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeMetadata; + })(); + + v2.PurgeUserEventsRequest = (function() { + + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ + + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; + + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; + + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsRequest; + })(); + + v2.PurgeUserEventsResponse = (function() { + + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ + + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsResponse; + })(); + + v2.UserEventService = (function() { + + /** + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.UserEventService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + */ + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.UserEvent} [response] UserEvent + */ + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2.WriteUserEventRequest, $root.google.cloud.retail.v2.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UserEventService; + })(); + + v2.WriteUserEventRequest = (function() { + + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2 + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ + + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; + + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + return null; + }; + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + */ + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.WriteUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); + } + return message; + }; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.WriteUserEventRequest} message WriteUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + return object; + }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + WriteUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WriteUserEventRequest; + })(); + + v2.CollectUserEventRequest = (function() { + + /** + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2 + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets + */ + + /** + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest + * @constructor + * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set + */ + function CollectUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.parent = ""; + + /** + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.userEvent = ""; + + /** + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; + + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest instance + */ + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); + }; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); + return writer; + }; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; + return null; + }; + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest + */ + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CollectUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) + if ($util.Long) + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2.CollectUserEventRequest} message CollectUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ets = options.longs === String ? "0" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; + else + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; + return object; + }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + CollectUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CollectUserEventRequest; + })(); + + v2.RejoinUserEventsRequest = (function() { + + /** + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + */ + + /** + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + */ + function RejoinUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.parent = ""; + + /** + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest instance + */ + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); + }; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEventRejoinScope = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + */ + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + return object; + }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + */ + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; + })(); + + return RejoinUserEventsRequest; + })(); + + v2.RejoinUserEventsResponse = (function() { + + /** + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount + */ + + /** + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set + */ + function RejoinUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @instance + */ + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse instance + */ + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); + }; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rejoinedUserEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + */ + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + return object; + }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsResponse; + })(); + + v2.RejoinUserEventsMetadata = (function() { + + /** + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsMetadata + */ + + /** + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata + * @constructor + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set + */ + function RejoinUserEventsMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance + */ + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + */ + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsMetadata) + return object; + return new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); + }; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsMetadata; + })(); + + return v2; + })(); + + retail.v2alpha = (function() { + + /** + * Namespace v2alpha. + * @memberof google.cloud.retail + * @namespace + */ + var v2alpha = {}; + + v2alpha.ProductLevelConfig = (function() { + + /** + * Properties of a ProductLevelConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + */ + + /** + * Constructs a new ProductLevelConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set + */ + function ProductLevelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.ingestionProductType = ""; + + /** + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig instance + */ + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); + }; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + return writer; + }; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ingestionProductType = reader.string(); + break; + case 2: + message.merchantCenterProductIdField = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductLevelConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductLevelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; + return null; + }; + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + */ + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductLevelConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + return message; + }; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.ProductLevelConfig} message ProductLevelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductLevelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; + } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; + return object; + }; + + /** + * Converts this ProductLevelConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @instance + * @returns {Object.} JSON object + */ + ProductLevelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductLevelConfig; + })(); + + v2alpha.Catalog = (function() { + + /** + * Properties of a Catalog. + * @memberof google.cloud.retail.v2alpha + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + */ + + /** + * Constructs a new Catalog. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Catalog. + * @implements ICatalog + * @constructor + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + */ + function Catalog(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.name = ""; + + /** + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; + + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; + + /** + * Creates a new Catalog instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance + */ + Catalog.create = function create(properties) { + return new Catalog(properties); + }; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + return null; + }; + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + */ + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + return object; + var message = new $root.google.cloud.retail.v2alpha.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); + } + return message; + }; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); + return object; + }; + + /** + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + * @returns {Object.} JSON object + */ + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Catalog; + })(); + + v2alpha.CatalogService = (function() { + + /** + * Constructs a new CatalogService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2alpha.ListCatalogsRequest, $root.google.cloud.retail.v2alpha.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2alpha.UpdateCatalogRequest, $root.google.cloud.retail.v2alpha.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2alpha.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest instance + */ + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); + }; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + */ + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2alpha.ListCatalogsRequest} message ListCatalogsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsRequest; + })(); + + v2alpha.ListCatalogsResponse = (function() { + + /** + * Properties of a ListCatalogsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + */ + + /** + * Constructs a new ListCatalogsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set + */ + function ListCatalogsResponse(properties) { + this.catalogs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + + /** + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse instance + */ + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); + }; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + */ + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalogs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} message ListCatalogsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalogs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsResponse; + })(); + + v2alpha.UpdateCatalogRequest = (function() { + + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2alpha.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ + + /** + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set + */ + function UpdateCatalogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2alpha.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.catalog = null; + + /** + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest instance + */ + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCatalogRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCatalogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + */ + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateCatalogRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCatalogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCatalogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCatalogRequest; + })(); + + v2alpha.CustomAttribute = (function() { + + /** + * Properties of a CustomAttribute. + * @memberof google.cloud.retail.v2alpha + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + */ + + /** + * Constructs a new CustomAttribute. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute + * @constructor + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + */ + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + CustomAttribute.prototype.text = $util.emptyArray; + + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance + */ + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); + }; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + case 2: + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomAttribute message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomAttribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + return null; + }; + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute + */ + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) + return object; + var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + return message; + }; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomAttribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + return object; + }; + + /** + * Converts this CustomAttribute to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + * @returns {Object.} JSON object + */ + CustomAttribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomAttribute; + })(); + + v2alpha.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.retail.v2alpha + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + */ + function Image(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Image + * @instance + */ + Image.prototype.uri = ""; + + /** + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2alpha.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2alpha.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Image message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Image message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Image.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + return null; + }; + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Image) + return object; + var message = new $root.google.cloud.retail.v2alpha.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {google.cloud.retail.v2alpha.Image} message Image + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Image.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.height = 0; + object.width = 0; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Image + * @instance + * @returns {Object.} JSON object + */ + Image.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Image; + })(); + + v2alpha.PriceInfo = (function() { + + /** + * Properties of a PriceInfo. + * @memberof google.cloud.retail.v2alpha + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + */ + + /** + * Constructs a new PriceInfo. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo + * @constructor + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + */ + function PriceInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.currencyCode = ""; + + /** + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; + + /** + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.originalPrice = 0; + + /** + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance + */ + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); + }; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + return writer; + }; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceInfo message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + return null; + }; + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + */ + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) + return object; + var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + return message; + }; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + return object; + }; + + /** + * Converts this PriceInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + * @returns {Object.} JSON object + */ + PriceInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceInfo; + })(); + + v2alpha.UserInfo = (function() { + + /** + * Properties of a UserInfo. + * @memberof google.cloud.retail.v2alpha + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + */ + + /** + * Constructs a new UserInfo. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserInfo. + * @implements IUserInfo + * @constructor + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + */ + function UserInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.userId = ""; + + /** + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.ipAddress = ""; + + /** + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance + */ + UserInfo.create = function create(properties) { + return new UserInfo(properties); + }; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + return writer; + }; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserInfo message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; + return null; + }; + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + */ + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) + return object; + var message = new $root.google.cloud.retail.v2alpha.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); + return message; + }; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; + } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; + return object; + }; + + /** + * Converts this UserInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + * @returns {Object.} JSON object + */ + UserInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserInfo; + })(); + + v2alpha.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.retail.v2alpha + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + this.inputUris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2alpha.GcsSource + * @instance + */ + GcsSource.prototype.inputUris = $util.emptyArray; + + /** + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + case 2: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSource message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) + return object; + var message = new $root.google.cloud.retail.v2alpha.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); + } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v2alpha.BigQuerySource = (function() { + + /** + * Properties of a BigQuerySource. + * @memberof google.cloud.retail.v2alpha + * @interface IBigQuerySource + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema + */ + + /** + * Constructs a new BigQuerySource. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource + * @constructor + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + */ + function BigQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.projectId = ""; + + /** + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance + */ + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); + }; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + return writer; + }; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.projectId = reader.string(); + break; + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQuerySource message. + * @function verify + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + */ + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) + return object; + var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + return object; + }; + + /** + * Converts this BigQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + * @returns {Object.} JSON object + */ + BigQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQuerySource; + })(); + + v2alpha.ProductInlineSource = (function() { + + /** + * Properties of a ProductInlineSource. + * @memberof google.cloud.retail.v2alpha + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products + */ + + /** + * Constructs a new ProductInlineSource. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource + * @constructor + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + */ + function ProductInlineSource(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @instance + */ + ProductInlineSource.prototype.products = $util.emptyArray; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance + */ + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); + }; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + return null; + }; + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + */ + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) + return object; + var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); + } + return object; + }; + + /** + * Converts this ProductInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @instance + * @returns {Object.} JSON object + */ + ProductInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInlineSource; + })(); + + v2alpha.UserEventInlineSource = (function() { + + /** + * Properties of a UserEventInlineSource. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + */ + + /** + * Constructs a new UserEventInlineSource. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource + * @constructor + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + */ + function UserEventInlineSource(properties) { + this.userEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance + */ + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); + }; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + */ + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) + return object; + var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); + } + return object; + }; + + /** + * Converts this UserEventInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @instance + * @returns {Object.} JSON object + */ + UserEventInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInlineSource; + })(); + + v2alpha.ImportErrorsConfig = (function() { + + /** + * Properties of an ImportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ImportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + */ + function ImportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportErrorsConfig gcsPrefix. + * @member {string} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @instance + */ + ImportErrorsConfig.prototype.gcsPrefix = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @instance + */ + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance + */ + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); + }; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + */ + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ImportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportErrorsConfig; + })(); + + v2alpha.ImportProductsRequest = (function() { + + /** + * Properties of an ImportProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + */ + + /** + * Constructs a new ImportProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + */ + function ImportProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.parent = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance + */ + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); + }; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + */ + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this ImportProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsRequest; + })(); + + v2alpha.ImportUserEventsRequest = (function() { + + /** + * Properties of an ImportUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + */ + + /** + * Constructs a new ImportUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + */ + function ImportUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.parent = ""; + + /** + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.inputConfig = null; + + /** + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.errorsConfig = null; + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance + */ + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); + }; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + */ + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsRequest; + })(); + + v2alpha.ProductInputConfig = (function() { + + /** + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IProductInputConfig + * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + */ + + /** + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + */ + function ProductInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.productInlineSource = null; + + /** + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance + */ + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); + }; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + * @returns {Object.} JSON object + */ + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2alpha.UserEventInputConfig = (function() { + + /** + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + */ + + /** + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.userEventInlineSource = null; + + /** + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.gcsSource = null; + + /** + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance + */ + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + */ + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this UserEventInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + * @returns {Object.} JSON object + */ + UserEventInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInputConfig; + })(); + + v2alpha.ImportMetadata = (function() { + + /** + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + */ + + /** + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + */ + function ImportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.createTime = null; + + /** + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.updateTime = null; + + /** + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance + */ + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); + }; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + return writer; + }; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + return null; + }; + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + */ + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + return object; + }; + + /** + * Converts this ImportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportMetadata; + })(); + + v2alpha.ImportProductsResponse = (function() { + + /** + * Properties of an ImportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + */ + + /** + * Constructs a new ImportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + */ + function ImportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance + */ + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); + }; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + */ + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsResponse; + })(); + + v2alpha.ImportUserEventsResponse = (function() { + + /** + * Properties of an ImportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + */ + + /** + * Constructs a new ImportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + */ + function ImportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance + */ + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + */ + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); + return object; + }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsResponse; + })(); + + v2alpha.UserEventImportSummary = (function() { + + /** + * Properties of a UserEventImportSummary. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + */ + + /** + * Constructs a new UserEventImportSummary. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary + * @constructor + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + */ + function UserEventImportSummary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance + */ + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); + }; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + return writer; + }; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.joinedEventsCount = reader.int64(); + break; + case 2: + message.unjoinedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventImportSummary message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventImportSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + */ + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) + return object; + var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventImportSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; + } + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + return object; + }; + + /** + * Converts this UserEventImportSummary to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @instance + * @returns {Object.} JSON object + */ + UserEventImportSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventImportSummary; + })(); + + v2alpha.Product = (function() { + + /** + * Properties of a Product. + * @memberof google.cloud.retail.v2alpha + * @interface IProduct + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {string|null} [description] Product description + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + */ + + /** + * Constructs a new Product. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + */ + function Product(properties) { + this.categories = []; + this.attributes = {}; + this.tags = []; + this.images = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.name = ""; + + /** + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.id = ""; + + /** + * Product type. + * @member {google.cloud.retail.v2alpha.Product.Type} type + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.type = 0; + + /** + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.primaryProductId = ""; + + /** + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.categories = $util.emptyArray; + + /** + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.title = ""; + + /** + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.description = ""; + + /** + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.availableTime = null; + + /** + * Product availability. + * @member {google.cloud.retail.v2alpha.Product.Availability} availability + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.availability = 0; + + /** + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.availableQuantity = null; + + /** + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.uri = ""; + + /** + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.images = $util.emptyArray; + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2alpha.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Product message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Product(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 10: + message.description = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Product message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Product.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + return null; + }; + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Product} Product + */ + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Product) + return object; + var message = new $root.google.cloud.retail.v2alpha.Product(); + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2alpha.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2alpha.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2alpha.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2alpha.Image.fromObject(object.images[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.categories = []; + object.tags = []; + object.images = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.title = ""; + object.description = ""; + object.priceInfo = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2alpha.Image.toObject(message.images[j], options); + } + return object; + }; + + /** + * Converts this Product to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Product + * @instance + * @returns {Object.} JSON object + */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.retail.v2alpha.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2alpha.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; + })(); + + v2alpha.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2alpha.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId + */ + + /** + * Constructs a new UserEvent. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEvent. + * @implements IUserEvent + * @constructor + * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set + */ + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.eventType = ""; + + /** + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.visitorId = ""; + + /** + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.eventTime = null; + + /** + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.experimentIds = $util.emptyArray; + + /** + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.attributionToken = ""; + + /** + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.productDetails = $util.emptyArray; + + /** + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.attributes = $util.emptyObject; + + /** + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.cartId = ""; + + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2alpha.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; + + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; + + /** + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.pageCategories = $util.emptyArray; + + /** + * UserEvent userInfo. + * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.userInfo = null; + + /** + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent instance + */ + UserEvent.create = function create(properties) { + return new UserEvent(properties); + }; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2alpha.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2alpha.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + return writer; + }; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEvent(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventType = reader.string(); + break; + case 2: + message.visitorId = reader.string(); + break; + case 3: + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEvent message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; + } + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2alpha.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; + return null; + }; + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + */ + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEvent) + return object; + var message = new $root.google.cloud.retail.v2alpha.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); + } + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2alpha.ProductDetail.fromObject(object.productDetails[i]); + } + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {google.cloud.retail.v2alpha.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2alpha.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + return object; + }; + + /** + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + * @returns {Object.} JSON object + */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEvent; + })(); + + v2alpha.ProductDetail = (function() { + + /** + * Properties of a ProductDetail. + * @memberof google.cloud.retail.v2alpha + * @interface IProductDetail + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + */ + + /** + * Constructs a new ProductDetail. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductDetail. + * @implements IProductDetail + * @constructor + * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set + */ + function ProductDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductDetail product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @instance + */ + ProductDetail.prototype.product = null; + + /** + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @instance + */ + ProductDetail.prototype.quantity = null; + + /** + * Creates a new ProductDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail instance + */ + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); + }; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 2: + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductDetail message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; + } + return null; + }; + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + */ + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductDetail) + return object; + var message = new $root.google.cloud.retail.v2alpha.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + } + return message; + }; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {google.cloud.retail.v2alpha.ProductDetail} message ProductDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.quantity = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + return object; + }; + + /** + * Converts this ProductDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @instance + * @returns {Object.} JSON object + */ + ProductDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductDetail; + })(); + + v2alpha.PurchaseTransaction = (function() { + + /** + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2alpha + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + */ + + /** + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction + * @constructor + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set + */ + function PurchaseTransaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.id = ""; + + /** + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.revenue = 0; + + /** + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction instance + */ + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); + }; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + return writer; + }; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurchaseTransaction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurchaseTransaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + */ + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurchaseTransaction) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2alpha.PurchaseTransaction} message PurchaseTransaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurchaseTransaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; + + /** + * Converts this PurchaseTransaction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + * @returns {Object.} JSON object + */ + PurchaseTransaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurchaseTransaction; + })(); + + v2alpha.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @memberof google.cloud.retail.v2alpha.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService + * @instance + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService + * @instance + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2alpha.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + */ + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this PredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + * @returns {Object.} JSON object + */ + PredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictRequest; + })(); + + v2alpha.PredictResponse = (function() { + + /** + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly + */ + + /** + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.results = $util.emptyArray; + + /** + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance + */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + */ + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this PredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + * @returns {Object.} JSON object + */ + PredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2alpha.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + + /** + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + */ + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "CreateProduct" }); + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "GetProduct" }); + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; + })(); + + v2alpha.CreateProductRequest = (function() { + + /** + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId + */ + + /** + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + */ + function CreateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance + */ + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); + }; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + return writer; + }; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + */ + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this CreateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProductRequest; + })(); + + v2alpha.GetProductRequest = (function() { + + /** + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name + */ + + /** + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance + */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @instance + * @returns {Object.} JSON object + */ + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProductRequest; + })(); + + v2alpha.UpdateProductRequest = (function() { + + /** + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + */ + + /** + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.product = null; + + /** + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance + */ + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + */ + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.updateMask = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateProductRequest; + })(); + + v2alpha.DeleteProductRequest = (function() { + + /** + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name + */ + + /** + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set + */ + function DeleteProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @instance + */ + DeleteProductRequest.prototype.name = ""; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance + */ + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); + }; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest + */ + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProductRequest; + })(); + + v2alpha.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeMetadata; + })(); + + v2alpha.PurgeUserEventsRequest = (function() { + + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ + + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; + + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; + + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsRequest; + })(); + + v2alpha.PurgeUserEventsResponse = (function() { + + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ + + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsResponse; + })(); + + v2alpha.UserEventService = (function() { + + /** + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + */ + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.UserEvent} [response] UserEvent + */ + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2alpha.WriteUserEventRequest, $root.google.cloud.retail.v2alpha.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2alpha.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2alpha.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UserEventService; + })(); + + v2alpha.WriteUserEventRequest = (function() { + + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ + + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; + + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + return null; + }; + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + */ + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.WriteUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); + } + return message; + }; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.WriteUserEventRequest} message WriteUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + return object; + }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + WriteUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WriteUserEventRequest; + })(); + + v2alpha.CollectUserEventRequest = (function() { + + /** + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets + */ + + /** + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + */ + function CollectUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.parent = ""; + + /** + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.userEvent = ""; + + /** + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; + + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest instance + */ + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); + }; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); + return writer; + }; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; + return null; + }; + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + */ + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CollectUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) + if ($util.Long) + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.CollectUserEventRequest} message CollectUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ets = options.longs === String ? "0" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; + else + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; + return object; + }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + CollectUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CollectUserEventRequest; + })(); + + v2alpha.RejoinUserEventsRequest = (function() { + + /** + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + */ + + /** + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + */ + function RejoinUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.parent = ""; + + /** + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest instance + */ + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); + }; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEventRejoinScope = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + */ + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + return object; + }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + */ + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; + })(); + + return RejoinUserEventsRequest; + })(); + + v2alpha.RejoinUserEventsResponse = (function() { + + /** + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount + */ + + /** + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set + */ + function RejoinUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @instance + */ + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse instance + */ + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); + }; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rejoinedUserEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + */ + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + return object; + }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsResponse; + })(); + + v2alpha.RejoinUserEventsMetadata = (function() { + + /** + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsMetadata + */ + + /** + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set + */ + function RejoinUserEventsMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance + */ + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + */ + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); + }; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsMetadata; + })(); + + return v2alpha; + })(); + + retail.v2beta = (function() { + + /** + * Namespace v2beta. + * @memberof google.cloud.retail + * @namespace + */ + var v2beta = {}; + + v2beta.ProductLevelConfig = (function() { + + /** + * Properties of a ProductLevelConfig. + * @memberof google.cloud.retail.v2beta + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + */ + + /** + * Constructs a new ProductLevelConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig + * @constructor + * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set + */ + function ProductLevelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.ingestionProductType = ""; + + /** + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig instance + */ + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); + }; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + return writer; + }; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ingestionProductType = reader.string(); + break; + case 2: + message.merchantCenterProductIdField = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductLevelConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductLevelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; + return null; + }; + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + */ + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductLevelConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + return message; + }; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.ProductLevelConfig} message ProductLevelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductLevelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; + } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; + return object; + }; + + /** + * Converts this ProductLevelConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @instance + * @returns {Object.} JSON object + */ + ProductLevelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductLevelConfig; + })(); + + v2beta.Catalog = (function() { + + /** + * Properties of a Catalog. + * @memberof google.cloud.retail.v2beta + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2beta.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + */ + + /** + * Constructs a new Catalog. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Catalog. + * @implements ICatalog + * @constructor + * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set + */ + function Catalog(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.name = ""; + + /** + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; + + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2beta.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; + + /** + * Creates a new Catalog instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Catalog} Catalog instance + */ + Catalog.create = function create(properties) { + return new Catalog(properties); + }; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2beta.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2beta.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + return null; + }; + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Catalog} Catalog + */ + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Catalog) + return object; + var message = new $root.google.cloud.retail.v2beta.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.fromObject(object.productLevelConfig); + } + return message; + }; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.toObject(message.productLevelConfig, options); + return object; + }; + + /** + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + * @returns {Object.} JSON object + */ + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Catalog; + })(); + + v2beta.CatalogService = (function() { + + /** + * Constructs a new CatalogService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2beta.ListCatalogsRequest, $root.google.cloud.retail.v2beta.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2beta.UpdateCatalogRequest, $root.google.cloud.retail.v2beta.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2beta.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest instance + */ + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); + }; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + */ + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.ListCatalogsRequest} message ListCatalogsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsRequest; + })(); + + v2beta.ListCatalogsResponse = (function() { + + /** + * Properties of a ListCatalogsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + */ + + /** + * Constructs a new ListCatalogsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + */ + function ListCatalogsResponse(properties) { + this.catalogs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + + /** + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse instance + */ + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); + }; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2beta.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + */ + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalogs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.ListCatalogsResponse} message ListCatalogsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalogs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsResponse; + })(); + + v2beta.UpdateCatalogRequest = (function() { + + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2beta.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ + + /** + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + */ + function UpdateCatalogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2beta.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.catalog = null; + + /** + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest instance + */ + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2beta.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCatalogRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCatalogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + */ + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateCatalogRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCatalogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCatalogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCatalogRequest; + })(); + + v2beta.CustomAttribute = (function() { + + /** + * Properties of a CustomAttribute. + * @memberof google.cloud.retail.v2beta + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + */ + + /** + * Constructs a new CustomAttribute. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute + * @constructor + * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + */ + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.text = $util.emptyArray; + + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute instance + */ + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); + }; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + case 2: + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomAttribute message. + * @function verify + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomAttribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + return null; + }; + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + */ + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CustomAttribute) + return object; + var message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + return message; + }; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.CustomAttribute} message CustomAttribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomAttribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + return object; + }; + + /** + * Converts this CustomAttribute to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + * @returns {Object.} JSON object + */ + CustomAttribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomAttribute; + })(); + + v2beta.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.retail.v2beta + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + */ + function Image(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.uri = ""; + + /** + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Image message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Image message. + * @function verify + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Image.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + return null; + }; + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Image) + return object; + var message = new $root.google.cloud.retail.v2beta.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.Image} message Image + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Image.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.height = 0; + object.width = 0; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Image + * @instance + * @returns {Object.} JSON object + */ + Image.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Image; + })(); + + v2beta.PriceInfo = (function() { + + /** + * Properties of a PriceInfo. + * @memberof google.cloud.retail.v2beta + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + */ + + /** + * Constructs a new PriceInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo + * @constructor + * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + */ + function PriceInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.currencyCode = ""; + + /** + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; + + /** + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.originalPrice = 0; + + /** + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo instance + */ + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); + }; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + return writer; + }; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + return null; + }; + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + */ + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + return message; + }; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.PriceInfo} message PriceInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + return object; + }; + + /** + * Converts this PriceInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + * @returns {Object.} JSON object + */ + PriceInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceInfo; + })(); + + v2beta.UserInfo = (function() { + + /** + * Properties of a UserInfo. + * @memberof google.cloud.retail.v2beta + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + */ + + /** + * Constructs a new UserInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserInfo. + * @implements IUserInfo + * @constructor + * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + */ + function UserInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.userId = ""; + + /** + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.ipAddress = ""; + + /** + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo instance + */ + UserInfo.create = function create(properties) { + return new UserInfo(properties); + }; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + return writer; + }; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; + return null; + }; + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + */ + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); + return message; + }; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.UserInfo} message UserInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; + } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; + return object; + }; + + /** + * Converts this UserInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + * @returns {Object.} JSON object + */ + UserInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserInfo; + })(); + + v2beta.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.retail.v2beta + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + this.inputUris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + */ + GcsSource.prototype.inputUris = $util.emptyArray; + + /** + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + case 2: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GcsSource) + return object; + var message = new $root.google.cloud.retail.v2beta.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2beta.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); + } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.GcsSource} message GcsSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v2beta.BigQuerySource = (function() { + + /** + * Properties of a BigQuerySource. + * @memberof google.cloud.retail.v2beta + * @interface IBigQuerySource + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema + */ + + /** + * Constructs a new BigQuerySource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource + * @constructor + * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + */ + function BigQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.projectId = ""; + + /** + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource instance + */ + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); + }; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + return writer; + }; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.projectId = reader.string(); + break; + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQuerySource message. + * @function verify + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + */ + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.BigQuerySource) + return object; + var message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.BigQuerySource} message BigQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + return object; + }; + + /** + * Converts this BigQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + * @returns {Object.} JSON object + */ + BigQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQuerySource; + })(); + + v2beta.ProductInlineSource = (function() { + + /** + * Properties of a ProductInlineSource. + * @memberof google.cloud.retail.v2beta + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products + */ + + /** + * Constructs a new ProductInlineSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource + * @constructor + * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + */ + function ProductInlineSource(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @instance + */ + ProductInlineSource.prototype.products = $util.emptyArray; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource instance + */ + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); + }; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + return null; + }; + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + */ + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductInlineSource) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.ProductInlineSource} message ProductInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); + } + return object; + }; + + /** + * Converts this ProductInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @instance + * @returns {Object.} JSON object + */ + ProductInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInlineSource; + })(); + + v2beta.UserEventInlineSource = (function() { + + /** + * Properties of a UserEventInlineSource. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + */ + + /** + * Constructs a new UserEventInlineSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + */ + function UserEventInlineSource(properties) { + this.userEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource instance + */ + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); + }; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + */ + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventInlineSource) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.UserEventInlineSource} message UserEventInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvents[j], options); + } + return object; + }; + + /** + * Converts this UserEventInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @instance + * @returns {Object.} JSON object + */ + UserEventInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInlineSource; + })(); + + v2beta.ImportErrorsConfig = (function() { + + /** + * Properties of an ImportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ImportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + */ + function ImportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportErrorsConfig gcsPrefix. + * @member {string} gcsPrefix + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + */ + ImportErrorsConfig.prototype.gcsPrefix = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + */ + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig instance + */ + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); + }; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + */ + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.ImportErrorsConfig} message ImportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ImportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportErrorsConfig; + })(); + + v2beta.ImportProductsRequest = (function() { + + /** + * Properties of an ImportProductsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {google.cloud.retail.v2beta.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + */ + + /** + * Constructs a new ImportProductsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + */ + function ImportProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.parent = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2beta.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest instance + */ + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); + }; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + */ + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.ImportProductsRequest} message ImportProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this ImportProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsRequest; + })(); + + v2beta.ImportUserEventsRequest = (function() { + + /** + * Properties of an ImportUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2beta.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + */ + + /** + * Constructs a new ImportUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + */ + function ImportUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.parent = ""; + + /** + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2beta.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.inputConfig = null; + + /** + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.errorsConfig = null; + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest instance + */ + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); + }; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + */ + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsRequest; + })(); + + v2beta.ProductInputConfig = (function() { + + /** + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface IProductInputConfig + * @property {google.cloud.retail.v2beta.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + */ + + /** + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + */ + function ProductInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2beta.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.productInlineSource = null; + + /** + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig instance + */ + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); + }; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2beta.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + * @returns {Object.} JSON object + */ + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2beta.UserEventInputConfig = (function() { + + /** + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2beta.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + */ + + /** + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2beta.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.userEventInlineSource = null; + + /** + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.gcsSource = null; + + /** + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig instance + */ + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2beta.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + */ + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.fromObject(object.userEventInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.UserEventInputConfig} message UserEventInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this UserEventInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + * @returns {Object.} JSON object + */ + UserEventInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInputConfig; + })(); + + v2beta.ImportMetadata = (function() { + + /** + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + */ + + /** + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + */ + function ImportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.createTime = null; + + /** + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.updateTime = null; + + /** + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata instance + */ + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); + }; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + return writer; + }; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + return null; + }; + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + */ + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportMetadata) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.ImportMetadata} message ImportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + return object; + }; + + /** + * Converts this ImportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportMetadata; + })(); + + v2beta.ImportProductsResponse = (function() { + + /** + * Properties of an ImportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + */ + + /** + * Constructs a new ImportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + */ + function ImportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse instance + */ + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); + }; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + */ + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.ImportProductsResponse} message ImportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsResponse; + })(); + + v2beta.ImportUserEventsResponse = (function() { + + /** + * Properties of an ImportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2beta.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + */ + + /** + * Constructs a new ImportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + */ + function ImportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2beta.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse instance + */ + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2beta.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2beta.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + */ + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.fromObject(object.importSummary); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.toObject(message.importSummary, options); + return object; + }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsResponse; + })(); + + v2beta.UserEventImportSummary = (function() { + + /** + * Properties of a UserEventImportSummary. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + */ + + /** + * Constructs a new UserEventImportSummary. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + */ + function UserEventImportSummary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary instance + */ + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); + }; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + return writer; + }; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.joinedEventsCount = reader.int64(); + break; + case 2: + message.unjoinedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventImportSummary message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventImportSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + */ + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventImportSummary) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.UserEventImportSummary} message UserEventImportSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventImportSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; + } + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + return object; + }; + + /** + * Converts this UserEventImportSummary to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + * @returns {Object.} JSON object + */ + UserEventImportSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventImportSummary; + })(); + + v2beta.Product = (function() { + + /** + * Properties of a Product. + * @memberof google.cloud.retail.v2beta + * @interface IProduct + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2beta.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {string|null} [description] Product description + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2beta.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2beta.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + */ + + /** + * Constructs a new Product. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + */ + function Product(properties) { + this.categories = []; + this.attributes = {}; + this.tags = []; + this.images = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.name = ""; + + /** + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.id = ""; + + /** + * Product type. + * @member {google.cloud.retail.v2beta.Product.Type} type + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.type = 0; + + /** + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.primaryProductId = ""; + + /** + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.categories = $util.emptyArray; + + /** + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.title = ""; + + /** + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.description = ""; + + /** + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2beta.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availableTime = null; + + /** + * Product availability. + * @member {google.cloud.retail.v2beta.Product.Availability} availability + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availability = 0; + + /** + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availableQuantity = null; + + /** + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.uri = ""; + + /** + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.images = $util.emptyArray; + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2beta.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2beta.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Product message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Product(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 10: + message.description = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Product message. + * @function verify + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Product.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2beta.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + return null; + }; + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Product} Product + */ + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Product) + return object; + var message = new $root.google.cloud.retail.v2beta.Product(); + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2beta.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2beta.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.fromObject(object.priceInfo); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2beta.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2beta.Image.fromObject(object.images[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.categories = []; + object.tags = []; + object.images = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.title = ""; + object.description = ""; + object.priceInfo = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.toObject(message.priceInfo, options); + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2beta.Image.toObject(message.images[j], options); + } + return object; + }; + + /** + * Converts this Product to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Product + * @instance + * @returns {Object.} JSON object + */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.retail.v2beta.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2beta.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; + })(); + + v2beta.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2beta + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2beta.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId + */ + + /** + * Constructs a new UserEvent. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEvent. + * @implements IUserEvent + * @constructor + * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + */ + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.eventType = ""; + + /** + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.visitorId = ""; + + /** + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.eventTime = null; + + /** + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.experimentIds = $util.emptyArray; + + /** + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.attributionToken = ""; + + /** + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.productDetails = $util.emptyArray; + + /** + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.attributes = $util.emptyObject; + + /** + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.cartId = ""; + + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2beta.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; + + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; + + /** + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.pageCategories = $util.emptyArray; + + /** + * UserEvent userInfo. + * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.userInfo = null; + + /** + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent instance + */ + UserEvent.create = function create(properties) { + return new UserEvent(properties); + }; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2beta.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2beta.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + return writer; + }; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEvent(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventType = reader.string(); + break; + case 2: + message.visitorId = reader.string(); + break; + case 3: + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEvent message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; + } + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2beta.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2beta.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; + return null; + }; + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + */ + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEvent) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); + } + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2beta.ProductDetail.fromObject(object.productDetails[i]); + } + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2beta.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + return object; + }; + + /** + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + * @returns {Object.} JSON object + */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEvent; + })(); + + v2beta.ProductDetail = (function() { + + /** + * Properties of a ProductDetail. + * @memberof google.cloud.retail.v2beta + * @interface IProductDetail + * @property {google.cloud.retail.v2beta.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + */ + + /** + * Constructs a new ProductDetail. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductDetail. + * @implements IProductDetail + * @constructor + * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + */ + function ProductDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductDetail product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + */ + ProductDetail.prototype.product = null; + + /** + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + */ + ProductDetail.prototype.quantity = null; + + /** + * Creates a new ProductDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail instance + */ + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); + }; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductDetail message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; + } + return null; + }; + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + */ + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductDetail) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + } + return message; + }; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.ProductDetail} message ProductDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.quantity = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + return object; + }; + + /** + * Converts this ProductDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + * @returns {Object.} JSON object + */ + ProductDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductDetail; + })(); + + v2beta.PurchaseTransaction = (function() { + + /** + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2beta + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + */ + + /** + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction + * @constructor + * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + */ + function PurchaseTransaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.id = ""; + + /** + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.revenue = 0; + + /** + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction instance + */ + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); + }; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + return writer; + }; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurchaseTransaction message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurchaseTransaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + */ + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurchaseTransaction) + return object; + var message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.PurchaseTransaction} message PurchaseTransaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurchaseTransaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; + + /** + * Converts this PurchaseTransaction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + * @returns {Object.} JSON object + */ + PurchaseTransaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurchaseTransaction; + })(); + + v2beta.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * @memberof google.cloud.retail.v2beta.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2beta.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + */ + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.PredictRequest} message PredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this PredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + * @returns {Object.} JSON object + */ + PredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictRequest; + })(); + + v2beta.PredictResponse = (function() { + + /** + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2beta + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly + */ + + /** + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.results = $util.emptyArray; + + /** + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse instance + */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + */ + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this PredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + * @returns {Object.} JSON object + */ + PredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2beta.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2beta.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2beta.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + + /** + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + */ + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2beta.CreateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "CreateProduct" }); + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2beta.GetProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "GetProduct" }); + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2beta.UpdateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2beta.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2beta.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; + })(); + + v2beta.CreateProductRequest = (function() { + + /** + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2beta.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId + */ + + /** + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + */ + function CreateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest instance + */ + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); + }; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + return writer; + }; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + */ + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.CreateProductRequest} message CreateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this CreateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProductRequest; + })(); + + v2beta.GetProductRequest = (function() { + + /** + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name + */ + + /** + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest instance + */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @instance + * @returns {Object.} JSON object + */ + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProductRequest; + })(); + + v2beta.UpdateProductRequest = (function() { + + /** + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2beta.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + */ + + /** + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProductRequest product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.product = null; + + /** + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest instance + */ + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + */ + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateProductRequest} message UpdateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.updateMask = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateProductRequest; + })(); + + v2beta.DeleteProductRequest = (function() { + + /** + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name + */ + + /** + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + */ + function DeleteProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @instance + */ + DeleteProductRequest.prototype.name = ""; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest instance + */ + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); + }; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + */ + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.DeleteProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.DeleteProductRequest} message DeleteProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProductRequest; + })(); + + v2beta.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2beta.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeMetadata; + })(); + + v2beta.PurgeUserEventsRequest = (function() { + + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ + + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; + + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; + + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsRequest; + })(); + + v2beta.PurgeUserEventsResponse = (function() { + + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ + + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsResponse; + })(); + + v2beta.UserEventService = (function() { + + /** + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + */ + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2beta.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.UserEvent} [response] UserEvent + */ + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2beta.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2beta.WriteUserEventRequest, $root.google.cloud.retail.v2beta.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2beta.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2beta.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2beta.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2beta.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2beta.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2beta.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2beta.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2beta.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2beta.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2beta.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2beta.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2beta.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2beta.UserEventService + * @instance + * @param {google.cloud.retail.v2beta.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UserEventService; + })(); + + v2beta.WriteUserEventRequest = (function() { + + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2beta + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ + + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2beta.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; + + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2beta.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.WriteUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + return null; + }; + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.WriteUserEventRequest} WriteUserEventRequest + */ + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.WriteUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2beta.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvent); + } + return message; + }; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.WriteUserEventRequest} message WriteUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvent, options); + return object; + }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + WriteUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WriteUserEventRequest; + })(); + + v2beta.CollectUserEventRequest = (function() { + + /** + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets + */ + + /** + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICollectUserEventRequest=} [properties] Properties to set + */ + function CollectUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.parent = ""; + + /** + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.userEvent = ""; + + /** + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; + + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CollectUserEventRequest} CollectUserEventRequest instance + */ + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); + }; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CollectUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); + return writer; + }; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CollectUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CollectUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; + return null; + }; + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CollectUserEventRequest} CollectUserEventRequest + */ + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CollectUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) + if ($util.Long) + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2beta.CollectUserEventRequest} message CollectUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ets = options.longs === String ? "0" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; + else + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; + return object; + }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + CollectUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CollectUserEventRequest; + })(); + + v2beta.RejoinUserEventsRequest = (function() { + + /** + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + */ + + /** + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IRejoinUserEventsRequest=} [properties] Properties to set + */ + function RejoinUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.parent = ""; + + /** + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RejoinUserEventsRequest} RejoinUserEventsRequest instance + */ + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); + }; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RejoinUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEventRejoinScope = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RejoinUserEventsRequest} RejoinUserEventsRequest + */ + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RejoinUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + return object; + }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + */ + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; + })(); + + return RejoinUserEventsRequest; + })(); + + v2beta.RejoinUserEventsResponse = (function() { + + /** + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount + */ + + /** + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IRejoinUserEventsResponse=} [properties] Properties to set + */ + function RejoinUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @instance + */ + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RejoinUserEventsResponse} RejoinUserEventsResponse instance + */ + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); + }; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RejoinUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rejoinedUserEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RejoinUserEventsResponse} RejoinUserEventsResponse + */ + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RejoinUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + return object; + }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsResponse; + })(); + + v2beta.RejoinUserEventsMetadata = (function() { + + /** + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IRejoinUserEventsMetadata + */ + + /** + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IRejoinUserEventsMetadata=} [properties] Properties to set + */ + function RejoinUserEventsMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance + */ + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RejoinUserEventsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2beta.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RejoinUserEventsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RejoinUserEventsMetadata} RejoinUserEventsMetadata + */ + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RejoinUserEventsMetadata) + return object; + return new $root.google.cloud.retail.v2beta.RejoinUserEventsMetadata(); + }; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2beta.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsMetadata; + })(); + + return v2beta; + })(); + + return retail; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = ""; + + /** + * HttpRule put. + * @member {string} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = ""; + + /** + * HttpRule post. + * @member {string} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = ""; + + /** + * HttpRule delete. + * @member {string} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = ""; + + /** + * HttpRule patch. + * @member {string} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = ""; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message["delete"] = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomHttpPattern; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + case 3: + message.nameField = reader.string(); + break; + case 4: + message.history = reader.int32(); + break; + case 5: + message.plural = reader.string(); + break; + case 6: + message.singular = reader.string(); + break; + case 10: + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.childType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResourceReference; + })(); + + api.HttpBody = (function() { + + /** + * Properties of a HttpBody. + * @memberof google.api + * @interface IHttpBody + * @property {string|null} [contentType] HttpBody contentType + * @property {Uint8Array|null} [data] HttpBody data + * @property {Array.|null} [extensions] HttpBody extensions + */ + + /** + * Constructs a new HttpBody. + * @memberof google.api + * @classdesc Represents a HttpBody. + * @implements IHttpBody + * @constructor + * @param {google.api.IHttpBody=} [properties] Properties to set + */ + function HttpBody(properties) { + this.extensions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpBody contentType. + * @member {string} contentType + * @memberof google.api.HttpBody + * @instance + */ + HttpBody.prototype.contentType = ""; + + /** + * HttpBody data. + * @member {Uint8Array} data + * @memberof google.api.HttpBody + * @instance + */ + HttpBody.prototype.data = $util.newBuffer([]); + + /** + * HttpBody extensions. + * @member {Array.} extensions + * @memberof google.api.HttpBody + * @instance + */ + HttpBody.prototype.extensions = $util.emptyArray; + + /** + * Creates a new HttpBody instance using the specified properties. + * @function create + * @memberof google.api.HttpBody + * @static + * @param {google.api.IHttpBody=} [properties] Properties to set + * @returns {google.api.HttpBody} HttpBody instance + */ + HttpBody.create = function create(properties) { + return new HttpBody(properties); + }; + + /** + * Encodes the specified HttpBody message. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. + * @function encode + * @memberof google.api.HttpBody + * @static + * @param {google.api.IHttpBody} message HttpBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpBody.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contentType != null && Object.hasOwnProperty.call(message, "contentType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.contentType); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.extensions != null && message.extensions.length) + for (var i = 0; i < message.extensions.length; ++i) + $root.google.protobuf.Any.encode(message.extensions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HttpBody message, length delimited. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpBody + * @static + * @param {google.api.IHttpBody} message HttpBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpBody.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpBody message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpBody} HttpBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpBody.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpBody(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contentType = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + if (!(message.extensions && message.extensions.length)) + message.extensions = []; + message.extensions.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpBody message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpBody} HttpBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpBody.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpBody message. + * @function verify + * @memberof google.api.HttpBody + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpBody.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contentType != null && message.hasOwnProperty("contentType")) + if (!$util.isString(message.contentType)) + return "contentType: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.extensions != null && message.hasOwnProperty("extensions")) { + if (!Array.isArray(message.extensions)) + return "extensions: array expected"; + for (var i = 0; i < message.extensions.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.extensions[i]); + if (error) + return "extensions." + error; + } + } + return null; + }; + + /** + * Creates a HttpBody message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpBody + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpBody} HttpBody + */ + HttpBody.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpBody) + return object; + var message = new $root.google.api.HttpBody(); + if (object.contentType != null) + message.contentType = String(object.contentType); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.extensions) { + if (!Array.isArray(object.extensions)) + throw TypeError(".google.api.HttpBody.extensions: array expected"); + message.extensions = []; + for (var i = 0; i < object.extensions.length; ++i) { + if (typeof object.extensions[i] !== "object") + throw TypeError(".google.api.HttpBody.extensions: object expected"); + message.extensions[i] = $root.google.protobuf.Any.fromObject(object.extensions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpBody message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpBody + * @static + * @param {google.api.HttpBody} message HttpBody + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpBody.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.extensions = []; + if (options.defaults) { + object.contentType = ""; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.contentType != null && message.hasOwnProperty("contentType")) + object.contentType = message.contentType; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.extensions && message.extensions.length) { + object.extensions = []; + for (var j = 0; j < message.extensions.length; ++j) + object.extensions[j] = $root.google.protobuf.Any.toObject(message.extensions[j], options); + } + return object; + }; + + /** + * Converts this HttpBody to JSON. + * @function toJSON + * @memberof google.api.HttpBody + * @instance + * @returns {Object.} JSON object + */ + HttpBody.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpBody; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message["package"] = reader.string(); + break; + case 3: + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + case 10: + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + case 11: + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + case 4: + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = reader.int32(); + break; + case 5: + message.type = reader.int32(); + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + case 17: + message.proto3Optional = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = reader.int32(); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 42: + message.phpGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1053: + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (typeof message.phpGenericServices !== "boolean") + return "phpGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.phpGenericServices != null) + message.phpGenericServices = Boolean(object.phpGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpGenericServices = false; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + object.phpGenericServices = message.phpGenericServices; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1053: + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { + writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.int32(message[".google.api.fieldBehavior"][i]); + writer.ldelim(); + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = reader.int32(); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32(); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1052: + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + case 1055: + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1049: + message[".google.api.defaultHost"] = reader.string(); + break; + case 1050: + message[".google.api.oauthScopes"] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.methodSignature"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.idempotencyLevel = 0; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * MethodOptions .google.longrunning.operationInfo. + * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotencyLevel = reader.int32(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 72295728: + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + case 1051: + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + case 1049: + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) { + var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"]); + if (error) + return ".google.longrunning.operationInfo." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + if (object[".google.longrunning.operationInfo"] != null) { + if (typeof object[".google.longrunning.operationInfo"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.longrunning.operationInfo: object expected"); + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.fromObject(object[".google.longrunning.operationInfo"]); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.methodSignature"] = []; + } + if (options.defaults) { + object.deprecated = false; + object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object[".google.longrunning.operationInfo"] = null; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) + object[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.toObject(message[".google.longrunning.operationInfo"], options); + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FieldMask; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Timestamp; + })(); + + protobuf.DoubleValue = (function() { + + /** + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value + */ + + /** + * Constructs a new DoubleValue. + * @memberof google.protobuf + * @classdesc Represents a DoubleValue. + * @implements IDoubleValue + * @constructor + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + */ + function DoubleValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue + * @instance + */ + DoubleValue.prototype.value = 0; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @function create + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @returns {google.protobuf.DoubleValue} DoubleValue instance + */ + DoubleValue.create = function create(properties) { + return new DoubleValue(properties); + }; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + return writer; + }; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoubleValue message. + * @function verify + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoubleValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DoubleValue} DoubleValue + */ + DoubleValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DoubleValue) + return object; + var message = new $root.google.protobuf.DoubleValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.DoubleValue} message DoubleValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoubleValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this DoubleValue to JSON. + * @function toJSON + * @memberof google.protobuf.DoubleValue + * @instance + * @returns {Object.} JSON object + */ + DoubleValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DoubleValue; + })(); + + protobuf.FloatValue = (function() { + + /** + * Properties of a FloatValue. + * @memberof google.protobuf + * @interface IFloatValue + * @property {number|null} [value] FloatValue value + */ + + /** + * Constructs a new FloatValue. + * @memberof google.protobuf + * @classdesc Represents a FloatValue. + * @implements IFloatValue + * @constructor + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + */ + function FloatValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue + * @instance + */ + FloatValue.prototype.value = 0; + + /** + * Creates a new FloatValue instance using the specified properties. + * @function create + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance + */ + FloatValue.create = function create(properties) { + return new FloatValue(properties); + }; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); + return writer; + }; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FloatValue message. + * @function verify + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FloatValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FloatValue} FloatValue + */ + FloatValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FloatValue) + return object; + var message = new $root.google.protobuf.FloatValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.FloatValue} message FloatValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FloatValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this FloatValue to JSON. + * @function toJSON + * @memberof google.protobuf.FloatValue + * @instance + * @returns {Object.} JSON object + */ + FloatValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FloatValue; + })(); + + protobuf.Int64Value = (function() { + + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ + + /** + * Constructs a new Int64Value. + * @memberof google.protobuf + * @classdesc Represents an Int64Value. + * @implements IInt64Value + * @constructor + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + */ + function Int64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Int64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @returns {google.protobuf.Int64Value} Int64Value instance + */ + Int64Value.create = function create(properties) { + return new Int64Value(properties); + }; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + return writer; + }; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int64Value message. + * @function verify + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int64Value} Int64Value + */ + Int64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int64Value) + return object; + var message = new $root.google.protobuf.Int64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.Int64Value} message Int64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + return object; + }; + + /** + * Converts this Int64Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int64Value + * @instance + * @returns {Object.} JSON object + */ + Int64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Int64Value; + })(); + + protobuf.UInt64Value = (function() { + + /** + * Properties of a UInt64Value. + * @memberof google.protobuf + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value + */ + + /** + * Constructs a new UInt64Value. + * @memberof google.protobuf + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value + * @constructor + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + */ + function UInt64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value + * @instance + */ + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new UInt64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance + */ + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); + }; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); + return writer; + }; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt64Value message. + * @function verify + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt64Value} UInt64Value + */ + UInt64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt64Value) + return object; + var message = new $root.google.protobuf.UInt64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = true; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; + return object; + }; + + /** + * Converts this UInt64Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt64Value + * @instance + * @returns {Object.} JSON object + */ + UInt64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UInt64Value; + })(); + + protobuf.Int32Value = (function() { + + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ + + /** + * Constructs a new Int32Value. + * @memberof google.protobuf + * @classdesc Represents an Int32Value. + * @implements IInt32Value + * @constructor + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + */ + function Int32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int32Value value. + * @member {number} value + * @memberof google.protobuf.Int32Value + * @instance + */ + Int32Value.prototype.value = 0; + + /** + * Creates a new Int32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @returns {google.protobuf.Int32Value} Int32Value instance + */ + Int32Value.create = function create(properties) { + return new Int32Value(properties); + }; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); + return writer; + }; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int32Value message. + * @function verify + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int32Value} Int32Value + */ + Int32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int32Value) + return object; + var message = new $root.google.protobuf.Int32Value(); + if (object.value != null) + message.value = object.value | 0; + return message; + }; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.Int32Value} message Int32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Int32Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int32Value + * @instance + * @returns {Object.} JSON object + */ + Int32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Int32Value; + })(); + + protobuf.UInt32Value = (function() { + + /** + * Properties of a UInt32Value. + * @memberof google.protobuf + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value + */ + + /** + * Constructs a new UInt32Value. + * @memberof google.protobuf + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value + * @constructor + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + */ + function UInt32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value + * @instance + */ + UInt32Value.prototype.value = 0; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance + */ + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); + }; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); + return writer; + }; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt32Value message. + * @function verify + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt32Value} UInt32Value + */ + UInt32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt32Value) + return object; + var message = new $root.google.protobuf.UInt32Value(); + if (object.value != null) + message.value = object.value >>> 0; + return message; + }; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this UInt32Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt32Value + * @instance + * @returns {Object.} JSON object + */ + UInt32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UInt32Value; + })(); + + protobuf.BoolValue = (function() { + + /** + * Properties of a BoolValue. + * @memberof google.protobuf + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value + */ + + /** + * Constructs a new BoolValue. + * @memberof google.protobuf + * @classdesc Represents a BoolValue. + * @implements IBoolValue + * @constructor + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + */ + function BoolValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue + * @instance + */ + BoolValue.prototype.value = false; + + /** + * Creates a new BoolValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance + */ + BoolValue.create = function create(properties) { + return new BoolValue(properties); + }; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); + return writer; + }; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoolValue message. + * @function verify + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoolValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "boolean") + return "value: boolean expected"; + return null; + }; + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BoolValue} BoolValue + */ + BoolValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BoolValue) + return object; + var message = new $root.google.protobuf.BoolValue(); + if (object.value != null) + message.value = Boolean(object.value); + return message; + }; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.BoolValue} message BoolValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoolValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = false; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this BoolValue to JSON. + * @function toJSON + * @memberof google.protobuf.BoolValue + * @instance + * @returns {Object.} JSON object + */ + BoolValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoolValue; + })(); + + protobuf.StringValue = (function() { + + /** + * Properties of a StringValue. + * @memberof google.protobuf + * @interface IStringValue + * @property {string|null} [value] StringValue value + */ + + /** + * Constructs a new StringValue. + * @memberof google.protobuf + * @classdesc Represents a StringValue. + * @implements IStringValue + * @constructor + * @param {google.protobuf.IStringValue=} [properties] Properties to set + */ + function StringValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue + * @instance + */ + StringValue.prototype.value = ""; + + /** + * Creates a new StringValue instance using the specified properties. + * @function create + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance + */ + StringValue.create = function create(properties) { + return new StringValue(properties); + }; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringValue message. + * @function verify + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.StringValue} StringValue + */ + StringValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.StringValue) + return object; + var message = new $root.google.protobuf.StringValue(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.StringValue} message StringValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this StringValue to JSON. + * @function toJSON + * @memberof google.protobuf.StringValue + * @instance + * @returns {Object.} JSON object + */ + StringValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StringValue; + })(); + + protobuf.BytesValue = (function() { + + /** + * Properties of a BytesValue. + * @memberof google.protobuf + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value + */ + + /** + * Constructs a new BytesValue. + * @memberof google.protobuf + * @classdesc Represents a BytesValue. + * @implements IBytesValue + * @constructor + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + */ + function BytesValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue + * @instance + */ + BytesValue.prototype.value = $util.newBuffer([]); + + /** + * Creates a new BytesValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance + */ + BytesValue.create = function create(properties) { + return new BytesValue(properties); + }; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BytesValue message. + * @function verify + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BytesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BytesValue} BytesValue + */ + BytesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BytesValue) + return object; + var message = new $root.google.protobuf.BytesValue(); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.BytesValue} message BytesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BytesValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this BytesValue to JSON. + * @function toJSON + * @memberof google.protobuf.BytesValue + * @instance + * @returns {Object.} JSON object + */ + BytesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BytesValue; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type_url = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Any; + })(); + + protobuf.Struct = (function() { + + /** + * Properties of a Struct. + * @memberof google.protobuf + * @interface IStruct + * @property {Object.|null} [fields] Struct fields + */ + + /** + * Constructs a new Struct. + * @memberof google.protobuf + * @classdesc Represents a Struct. + * @implements IStruct + * @constructor + * @param {google.protobuf.IStruct=} [properties] Properties to set + */ + function Struct(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Struct fields. + * @member {Object.} fields + * @memberof google.protobuf.Struct + * @instance + */ + Struct.prototype.fields = $util.emptyObject; + + /** + * Creates a new Struct instance using the specified properties. + * @function create + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct=} [properties] Properties to set + * @returns {google.protobuf.Struct} Struct instance + */ + Struct.create = function create(properties) { + return new Struct(properties); + }; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Struct(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.fields[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Struct message. + * @function verify + * @memberof google.protobuf.Struct + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Struct.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fields != null && message.hasOwnProperty("fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.fields[key[i]]); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Struct + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Struct} Struct + */ + Struct.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Struct) + return object; + var message = new $root.google.protobuf.Struct(); + if (object.fields) { + if (typeof object.fields !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (typeof object.fields[keys[i]] !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.Struct} message Struct + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Struct.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) + object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options); + } + return object; + }; + + /** + * Converts this Struct to JSON. + * @function toJSON + * @memberof google.protobuf.Struct + * @instance + * @returns {Object.} JSON object + */ + Struct.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Struct; + })(); + + protobuf.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.protobuf + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {number|null} [numberValue] Value numberValue + * @property {string|null} [stringValue] Value stringValue + * @property {boolean|null} [boolValue] Value boolValue + * @property {google.protobuf.IStruct|null} [structValue] Value structValue + * @property {google.protobuf.IListValue|null} [listValue] Value listValue + */ + + /** + * Constructs a new Value. + * @memberof google.protobuf + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.protobuf.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue} nullValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.nullValue = 0; + + /** + * Value numberValue. + * @member {number} numberValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.numberValue = 0; + + /** + * Value stringValue. + * @member {string} stringValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.stringValue = ""; + + /** + * Value boolValue. + * @member {boolean} boolValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.boolValue = false; + + /** + * Value structValue. + * @member {google.protobuf.IStruct|null|undefined} structValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.structValue = null; + + /** + * Value listValue. + * @member {google.protobuf.IListValue|null|undefined} listValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.listValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value kind. + * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind + * @memberof google.protobuf.Value + * @instance + */ + Object.defineProperty(Value.prototype, "kind", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue=} [properties] Properties to set + * @returns {google.protobuf.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue); + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue); + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) + $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) + $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nullValue = reader.int32(); + break; + case 2: + message.numberValue = reader.double(); + break; + case 3: + message.stringValue = reader.string(); + break; + case 4: + message.boolValue = reader.bool(); + break; + case 5: + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 6: + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.protobuf.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + properties.kind = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.numberValue !== "number") + return "numberValue: number expected"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.Struct.verify(message.structValue); + if (error) + return "structValue." + error; + } + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.ListValue.verify(message.listValue); + if (error) + return "listValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Value} Value + */ + Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Value) + return object; + var message = new $root.google.protobuf.Value(); + switch (object.nullValue) { + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.numberValue != null) + message.numberValue = Number(object.numberValue); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.structValue != null) { + if (typeof object.structValue !== "object") + throw TypeError(".google.protobuf.Value.structValue: object expected"); + message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue); + } + if (object.listValue != null) { + if (typeof object.listValue !== "object") + throw TypeError(".google.protobuf.Value.listValue: object expected"); + message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.kind = "nullValue"; + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue; + if (options.oneofs) + object.kind = "numberValue"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.kind = "stringValue"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.kind = "boolValue"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options); + if (options.oneofs) + object.kind = "structValue"; + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options); + if (options.oneofs) + object.kind = "listValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.protobuf.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Value; + })(); + + /** + * NullValue enum. + * @name google.protobuf.NullValue + * @enum {number} + * @property {number} NULL_VALUE=0 NULL_VALUE value + */ + protobuf.NullValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NULL_VALUE"] = 0; + return values; + })(); + + protobuf.ListValue = (function() { + + /** + * Properties of a ListValue. + * @memberof google.protobuf + * @interface IListValue + * @property {Array.|null} [values] ListValue values + */ + + /** + * Constructs a new ListValue. + * @memberof google.protobuf + * @classdesc Represents a ListValue. + * @implements IListValue + * @constructor + * @param {google.protobuf.IListValue=} [properties] Properties to set + */ + function ListValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListValue values. + * @member {Array.} values + * @memberof google.protobuf.ListValue + * @instance + */ + ListValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ListValue instance using the specified properties. + * @function create + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue=} [properties] Properties to set + * @returns {google.protobuf.ListValue} ListValue instance + */ + ListValue.create = function create(properties) { + return new ListValue(properties); + }; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ListValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListValue message. + * @function verify + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.values[i]); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ListValue} ListValue + */ + ListValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ListValue) + return object; + var message = new $root.google.protobuf.ListValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.protobuf.ListValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.protobuf.ListValue.values: object expected"); + message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.ListValue} message ListValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options); + } + return object; + }; + + /** + * Converts this ListValue to JSON. + * @function toJSON + * @memberof google.protobuf.ListValue + * @instance + * @returns {Object.} JSON object + */ + ListValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListValue; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Duration; + })(); + + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.int32(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Status; + })(); + + return rpc; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations#listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.done = reader.bool(); + break; + case 4: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 5: + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.response != null && message.hasOwnProperty("response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.Operation) + return object; + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.response != null) { + if (typeof object.response !== "object") + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.metadata = null; + object.done = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && message.hasOwnProperty("response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options); + if (options.oneofs) + object.result = "response"; + } + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.longrunning.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Operation; + })(); + + longrunning.GetOperationRequest = (function() { + + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ + + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetOperationRequest message. + * @function verify + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + */ + GetOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.GetOperationRequest) + return object; + var message = new $root.google.longrunning.GetOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.GetOperationRequest} message GetOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.GetOperationRequest + * @instance + * @returns {Object.} JSON object + */ + GetOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetOperationRequest; + })(); + + longrunning.ListOperationsRequest = (function() { + + /** + * Properties of a ListOperationsRequest. + * @memberof google.longrunning + * @interface IListOperationsRequest + * @property {string|null} [name] ListOperationsRequest name + * @property {string|null} [filter] ListOperationsRequest filter + * @property {number|null} [pageSize] ListOperationsRequest pageSize + * @property {string|null} [pageToken] ListOperationsRequest pageToken + */ + + /** + * Constructs a new ListOperationsRequest. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsRequest. + * @implements IListOperationsRequest + * @constructor + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + */ + function ListOperationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsRequest name. + * @member {string} name + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.name = ""; + + /** + * ListOperationsRequest filter. + * @member {string} filter + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.filter = ""; + + /** + * ListOperationsRequest pageSize. + * @member {number} pageSize + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageSize = 0; + + /** + * ListOperationsRequest pageToken. + * @member {string} pageToken + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance + */ + ListOperationsRequest.create = function create(properties) { + return new ListOperationsRequest(properties); + }; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.name = reader.string(); + break; + case 1: + message.filter = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsRequest message. + * @function verify + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + */ + ListOperationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsRequest) + return object; + var message = new $root.google.longrunning.ListOperationsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListOperationsRequest to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListOperationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListOperationsRequest; + })(); + + longrunning.ListOperationsResponse = (function() { + + /** + * Properties of a ListOperationsResponse. + * @memberof google.longrunning + * @interface IListOperationsResponse + * @property {Array.|null} [operations] ListOperationsResponse operations + * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken + */ + + /** + * Constructs a new ListOperationsResponse. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsResponse. + * @implements IListOperationsResponse + * @constructor + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + */ + function ListOperationsResponse(properties) { + this.operations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsResponse operations. + * @member {Array.} operations + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.operations = $util.emptyArray; + + /** + * ListOperationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance + */ + ListOperationsResponse.create = function create(properties) { + return new ListOperationsResponse(properties); + }; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operations != null && message.operations.length) + for (var i = 0; i < message.operations.length; ++i) + $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsResponse message. + * @function verify + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operations != null && message.hasOwnProperty("operations")) { + if (!Array.isArray(message.operations)) + return "operations: array expected"; + for (var i = 0; i < message.operations.length; ++i) { + var error = $root.google.longrunning.Operation.verify(message.operations[i]); + if (error) + return "operations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + */ + ListOperationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsResponse) + return object; + var message = new $root.google.longrunning.ListOperationsResponse(); + if (object.operations) { + if (!Array.isArray(object.operations)) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); + message.operations = []; + for (var i = 0; i < object.operations.length; ++i) { + if (typeof object.operations[i] !== "object") + throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); + message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.operations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.operations && message.operations.length) { + object.operations = []; + for (var j = 0; j < message.operations.length; ++j) + object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListOperationsResponse to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListOperationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListOperationsResponse; + })(); + + longrunning.CancelOperationRequest = (function() { + + /** + * Properties of a CancelOperationRequest. + * @memberof google.longrunning + * @interface ICancelOperationRequest + * @property {string|null} [name] CancelOperationRequest name + */ + + /** + * Constructs a new CancelOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a CancelOperationRequest. + * @implements ICancelOperationRequest + * @constructor + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + */ + function CancelOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelOperationRequest name. + * @member {string} name + * @memberof google.longrunning.CancelOperationRequest + * @instance + */ + CancelOperationRequest.prototype.name = ""; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance + */ + CancelOperationRequest.create = function create(properties) { + return new CancelOperationRequest(properties); + }; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelOperationRequest message. + * @function verify + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + */ + CancelOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.CancelOperationRequest) + return object; + var message = new $root.google.longrunning.CancelOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CancelOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.CancelOperationRequest + * @instance + * @returns {Object.} JSON object + */ + CancelOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CancelOperationRequest; + })(); + + longrunning.DeleteOperationRequest = (function() { + + /** + * Properties of a DeleteOperationRequest. + * @memberof google.longrunning + * @interface IDeleteOperationRequest + * @property {string|null} [name] DeleteOperationRequest name + */ + + /** + * Constructs a new DeleteOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a DeleteOperationRequest. + * @implements IDeleteOperationRequest + * @constructor + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + */ + function DeleteOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteOperationRequest name. + * @member {string} name + * @memberof google.longrunning.DeleteOperationRequest + * @instance + */ + DeleteOperationRequest.prototype.name = ""; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance + */ + DeleteOperationRequest.create = function create(properties) { + return new DeleteOperationRequest(properties); + }; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteOperationRequest message. + * @function verify + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + */ + DeleteOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.DeleteOperationRequest) + return object; + var message = new $root.google.longrunning.DeleteOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.DeleteOperationRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteOperationRequest; + })(); + + longrunning.WaitOperationRequest = (function() { + + /** + * Properties of a WaitOperationRequest. + * @memberof google.longrunning + * @interface IWaitOperationRequest + * @property {string|null} [name] WaitOperationRequest name + * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout + */ + + /** + * Constructs a new WaitOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a WaitOperationRequest. + * @implements IWaitOperationRequest + * @constructor + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + */ + function WaitOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitOperationRequest name. + * @member {string} name + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.name = ""; + + /** + * WaitOperationRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.timeout = null; + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance + */ + WaitOperationRequest.create = function create(properties) { + return new WaitOperationRequest(properties); + }; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitOperationRequest message. + * @function verify + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + return null; + }; + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + */ + WaitOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.WaitOperationRequest) + return object; + var message = new $root.google.longrunning.WaitOperationRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + return message; + }; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.timeout = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + return object; + }; + + /** + * Converts this WaitOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.WaitOperationRequest + * @instance + * @returns {Object.} JSON object + */ + WaitOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WaitOperationRequest; + })(); + + longrunning.OperationInfo = (function() { + + /** + * Properties of an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType + */ + + /** + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo + * @constructor + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + */ + function OperationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.responseType = ""; + + /** + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.metadataType = ""; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @function create + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance + */ + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); + }; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encode + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); + return writer; + }; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.responseType = reader.string(); + break; + case 2: + message.metadataType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationInfo message. + * @function verify + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseType != null && message.hasOwnProperty("responseType")) + if (!$util.isString(message.responseType)) + return "responseType: string expected"; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + if (!$util.isString(message.metadataType)) + return "metadataType: string expected"; + return null; + }; + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.OperationInfo} OperationInfo + */ + OperationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.OperationInfo) + return object; + var message = new $root.google.longrunning.OperationInfo(); + if (object.responseType != null) + message.responseType = String(object.responseType); + if (object.metadataType != null) + message.metadataType = String(object.metadataType); + return message; + }; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.OperationInfo} message OperationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseType = ""; + object.metadataType = ""; + } + if (message.responseType != null && message.hasOwnProperty("responseType")) + object.responseType = message.responseType; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + object.metadataType = message.metadataType; + return object; + }; + + /** + * Converts this OperationInfo to JSON. + * @function toJSON + * @memberof google.longrunning.OperationInfo + * @instance + * @returns {Object.} JSON object + */ + OperationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationInfo; + })(); + + return longrunning; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json new file mode 100644 index 00000000000..e571c8f0a6b --- /dev/null +++ b/packages/google-cloud-retail/protos/protos.json @@ -0,0 +1,5166 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "retail": { + "nested": { + "v2": { + "options": { + "csharp_namespace": "Google.Cloud.Retail.V2", + "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2;retail", + "java_multiple_files": true, + "java_outer_classname": "UserEventServiceProto", + "java_package": "com.google.cloud.retail.v2", + "objc_class_prefix": "RETAIL", + "php_namespace": "Google\\Cloud\\Retail\\V2", + "ruby_package": "Google::Cloud::Retail::V2", + "(google.api.resource_definition).type": "retail.googleapis.com/Branch", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" + }, + "nested": { + "ProductLevelConfig": { + "fields": { + "ingestionProductType": { + "type": "string", + "id": 1 + }, + "merchantCenterProductIdField": { + "type": "string", + "id": 2 + } + } + }, + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "productLevelConfig": { + "type": "ProductLevelConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CatalogService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/catalogs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", + "options": { + "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCatalogsResponse": { + "fields": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateCatalogRequest": { + "fields": { + "catalog": { + "type": "Catalog", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "CustomAttribute": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "numbers": { + "rule": "repeated", + "type": "double", + "id": 2 + } + } + }, + "Image": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "height": { + "type": "int32", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + } + } + }, + "PriceInfo": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "price": { + "type": "float", + "id": 2 + }, + "originalPrice": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + } + } + }, + "UserInfo": { + "fields": { + "userId": { + "type": "string", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "userAgent": { + "type": "string", + "id": 3 + }, + "directUserRequest": { + "type": "bool", + "id": 4 + } + } + }, + "GcsSource": { + "fields": { + "inputUris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataSchema": { + "type": "string", + "id": 2 + } + } + }, + "BigQuerySource": { + "fields": { + "projectId": { + "type": "string", + "id": 5 + }, + "datasetId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tableId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsStagingDir": { + "type": "string", + "id": 3 + }, + "dataSchema": { + "type": "string", + "id": 4 + } + } + }, + "ProductInlineSource": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UserEventInlineSource": { + "fields": { + "userEvents": { + "rule": "repeated", + "type": "UserEvent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ImportProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfig": { + "type": "ProductInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + } + } + }, + "ImportUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfig": { + "type": "UserEventInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + } + } + }, + "ProductInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "productInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "productInlineSource": { + "type": "ProductInlineSource", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3 + } + } + }, + "UserEventInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "userEventInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "userEventInlineSource": { + "type": "UserEventInlineSource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "successCount": { + "type": "int64", + "id": 3 + }, + "failureCount": { + "type": "int64", + "id": 4 + } + } + }, + "ImportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + } + } + }, + "ImportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + }, + "importSummary": { + "type": "UserEventImportSummary", + "id": 3 + } + } + }, + "UserEventImportSummary": { + "fields": { + "joinedEventsCount": { + "type": "int64", + "id": 1 + }, + "unjoinedEventsCount": { + "type": "int64", + "id": 2 + } + } + }, + "Product": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Product", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "id": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "type": { + "type": "Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "primaryProductId": { + "type": "string", + "id": 4 + }, + "categories": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "title": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 10 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 12 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 14 + }, + "availableTime": { + "type": "google.protobuf.Timestamp", + "id": 18 + }, + "availability": { + "type": "Availability", + "id": 19 + }, + "availableQuantity": { + "type": "google.protobuf.Int32Value", + "id": 20 + }, + "uri": { + "type": "string", + "id": 22 + }, + "images": { + "rule": "repeated", + "type": "Image", + "id": 23 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "VARIANT": 2, + "COLLECTION": 3 + } + }, + "Availability": { + "values": { + "AVAILABILITY_UNSPECIFIED": 0, + "IN_STOCK": 1, + "OUT_OF_STOCK": 2, + "PREORDER": 3, + "BACKORDER": 4 + } + } + } + }, + "UserEvent": { + "fields": { + "eventType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "visitorId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "experimentIds": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "productDetails": { + "rule": "repeated", + "type": "ProductDetail", + "id": 6 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 7 + }, + "cartId": { + "type": "string", + "id": 8 + }, + "purchaseTransaction": { + "type": "PurchaseTransaction", + "id": 9 + }, + "searchQuery": { + "type": "string", + "id": 10 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 11 + }, + "userInfo": { + "type": "UserInfo", + "id": 12 + }, + "uri": { + "type": "string", + "id": 13 + }, + "referrerUri": { + "type": "string", + "id": 14 + }, + "pageViewId": { + "type": "string", + "id": 15 + } + } + }, + "ProductDetail": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "quantity": { + "type": "google.protobuf.Int32Value", + "id": 2 + } + } + }, + "PurchaseTransaction": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "revenue": { + "type": "float", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tax": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "currencyCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*" + } + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" + } + ] + }, + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" + } + }, + { + "(google.api.method_signature)": "product,update_mask" + } + ] + }, + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } + } + ] + } + } + }, + "CreateProductRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "UpdateProductRequest": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeUserEventsResponse": { + "fields": { + "purgedEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "UserEventService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "WriteUserEvent": { + "requestType": "WriteUserEventRequest", + "responseType": "UserEvent", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "(google.api.http).body": "user_event" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "body": "user_event" + } + } + ] + }, + "CollectUserEvent": { + "requestType": "CollectUserEventRequest", + "responseType": "google.api.HttpBody", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + } + } + ] + }, + "PurgeUserEvents": { + "requestType": "PurgeUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.PurgeUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.PurgeMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.PurgeUserEventsResponse", + "metadata_type": "google.cloud.retail.v2.PurgeMetadata" + } + } + ] + }, + "ImportUserEvents": { + "requestType": "ImportUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportUserEventsResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } + } + ] + }, + "RejoinUserEvents": { + "requestType": "RejoinUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "RejoinUserEventsResponse", + "metadata_type": "RejoinUserEventsMetadata" + } + } + ] + } + } + }, + "WriteUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CollectUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uri": { + "type": "string", + "id": 3 + }, + "ets": { + "type": "int64", + "id": 4 + } + } + }, + "RejoinUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEventRejoinScope": { + "type": "UserEventRejoinScope", + "id": 2 + } + }, + "nested": { + "UserEventRejoinScope": { + "values": { + "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, + "JOINED_EVENTS": 1, + "UNJOINED_EVENTS": 2 + } + } + } + }, + "RejoinUserEventsResponse": { + "fields": { + "rejoinedUserEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "RejoinUserEventsMetadata": { + "fields": {} + } + } + }, + "v2alpha": { + "options": { + "csharp_namespace": "Google.Cloud.Retail.V2Alpha", + "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail", + "java_multiple_files": true, + "java_outer_classname": "UserEventServiceProto", + "java_package": "com.google.cloud.retail.v2alpha", + "objc_class_prefix": "RETAIL", + "php_namespace": "Google\\Cloud\\Retail\\V2alpha", + "ruby_package": "Google::Cloud::Retail::V2alpha", + "(google.api.resource_definition).type": "retail.googleapis.com/Branch", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" + }, + "nested": { + "ProductLevelConfig": { + "fields": { + "ingestionProductType": { + "type": "string", + "id": 1 + }, + "merchantCenterProductIdField": { + "type": "string", + "id": 2 + } + } + }, + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "productLevelConfig": { + "type": "ProductLevelConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CatalogService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*}/catalogs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", + "options": { + "(google.api.http).patch": "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCatalogsResponse": { + "fields": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateCatalogRequest": { + "fields": { + "catalog": { + "type": "Catalog", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "CustomAttribute": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "numbers": { + "rule": "repeated", + "type": "double", + "id": 2 + } + } + }, + "Image": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "height": { + "type": "int32", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + } + } + }, + "PriceInfo": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "price": { + "type": "float", + "id": 2 + }, + "originalPrice": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + } + } + }, + "UserInfo": { + "fields": { + "userId": { + "type": "string", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "userAgent": { + "type": "string", + "id": 3 + }, + "directUserRequest": { + "type": "bool", + "id": 4 + } + } + }, + "GcsSource": { + "fields": { + "inputUris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataSchema": { + "type": "string", + "id": 2 + } + } + }, + "BigQuerySource": { + "fields": { + "projectId": { + "type": "string", + "id": 5 + }, + "datasetId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tableId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsStagingDir": { + "type": "string", + "id": 3 + }, + "dataSchema": { + "type": "string", + "id": 4 + } + } + }, + "ProductInlineSource": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UserEventInlineSource": { + "fields": { + "userEvents": { + "rule": "repeated", + "type": "UserEvent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ImportProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfig": { + "type": "ProductInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + } + } + }, + "ImportUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfig": { + "type": "UserEventInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + } + } + }, + "ProductInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "productInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "productInlineSource": { + "type": "ProductInlineSource", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3 + } + } + }, + "UserEventInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "userEventInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "userEventInlineSource": { + "type": "UserEventInlineSource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "successCount": { + "type": "int64", + "id": 3 + }, + "failureCount": { + "type": "int64", + "id": 4 + } + } + }, + "ImportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + } + } + }, + "ImportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + }, + "importSummary": { + "type": "UserEventImportSummary", + "id": 3 + } + } + }, + "UserEventImportSummary": { + "fields": { + "joinedEventsCount": { + "type": "int64", + "id": 1 + }, + "unjoinedEventsCount": { + "type": "int64", + "id": 2 + } + } + }, + "Product": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Product", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "id": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "type": { + "type": "Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "primaryProductId": { + "type": "string", + "id": 4 + }, + "categories": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "title": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 10 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 12 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 14 + }, + "availableTime": { + "type": "google.protobuf.Timestamp", + "id": 18 + }, + "availability": { + "type": "Availability", + "id": 19 + }, + "availableQuantity": { + "type": "google.protobuf.Int32Value", + "id": 20 + }, + "uri": { + "type": "string", + "id": 22 + }, + "images": { + "rule": "repeated", + "type": "Image", + "id": 23 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "VARIANT": 2, + "COLLECTION": 3 + } + }, + "Availability": { + "values": { + "AVAILABILITY_UNSPECIFIED": 0, + "IN_STOCK": 1, + "OUT_OF_STOCK": 2, + "PREORDER": 3, + "BACKORDER": 4 + } + } + } + }, + "UserEvent": { + "fields": { + "eventType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "visitorId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "experimentIds": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "productDetails": { + "rule": "repeated", + "type": "ProductDetail", + "id": 6 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 7 + }, + "cartId": { + "type": "string", + "id": 8 + }, + "purchaseTransaction": { + "type": "PurchaseTransaction", + "id": 9 + }, + "searchQuery": { + "type": "string", + "id": 10 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 11 + }, + "userInfo": { + "type": "UserInfo", + "id": 12 + }, + "uri": { + "type": "string", + "id": 13 + }, + "referrerUri": { + "type": "string", + "id": 14 + }, + "pageViewId": { + "type": "string", + "id": 15 + } + } + }, + "ProductDetail": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "quantity": { + "type": "google.protobuf.Int32Value", + "id": 2 + } + } + }, + "PurchaseTransaction": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "revenue": { + "type": "float", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tax": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "currencyCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*" + } + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" + } + ] + }, + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" + } + }, + { + "(google.api.method_signature)": "product,update_mask" + } + ] + }, + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + } + } + ] + } + } + }, + "CreateProductRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "UpdateProductRequest": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeUserEventsResponse": { + "fields": { + "purgedEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "UserEventService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "WriteUserEvent": { + "requestType": "WriteUserEventRequest", + "responseType": "UserEvent", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "(google.api.http).body": "user_event" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "body": "user_event" + } + } + ] + }, + "CollectUserEvent": { + "requestType": "CollectUserEventRequest", + "responseType": "google.api.HttpBody", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + } + } + ] + }, + "PurgeUserEvents": { + "requestType": "PurgeUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.PurgeUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.PurgeMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.PurgeUserEventsResponse", + "metadata_type": "google.cloud.retail.v2alpha.PurgeMetadata" + } + } + ] + }, + "ImportUserEvents": { + "requestType": "ImportUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.ImportUserEventsResponse", + "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + } + } + ] + }, + "RejoinUserEvents": { + "requestType": "RejoinUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "RejoinUserEventsResponse", + "metadata_type": "RejoinUserEventsMetadata" + } + } + ] + } + } + }, + "WriteUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CollectUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uri": { + "type": "string", + "id": 3 + }, + "ets": { + "type": "int64", + "id": 4 + } + } + }, + "RejoinUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEventRejoinScope": { + "type": "UserEventRejoinScope", + "id": 2 + } + }, + "nested": { + "UserEventRejoinScope": { + "values": { + "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, + "JOINED_EVENTS": 1, + "UNJOINED_EVENTS": 2 + } + } + } + }, + "RejoinUserEventsResponse": { + "fields": { + "rejoinedUserEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "RejoinUserEventsMetadata": { + "fields": {} + } + } + }, + "v2beta": { + "options": { + "csharp_namespace": "Google.Cloud.Retail.V2Beta", + "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail", + "java_multiple_files": true, + "java_outer_classname": "UserEventServiceProto", + "java_package": "com.google.cloud.retail.v2beta", + "objc_class_prefix": "RETAIL", + "php_namespace": "Google\\Cloud\\Retail\\V2beta", + "ruby_package": "Google::Cloud::Retail::V2beta", + "(google.api.resource_definition).type": "retail.googleapis.com/Branch", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" + }, + "nested": { + "ProductLevelConfig": { + "fields": { + "ingestionProductType": { + "type": "string", + "id": 1 + }, + "merchantCenterProductIdField": { + "type": "string", + "id": 2 + } + } + }, + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "productLevelConfig": { + "type": "ProductLevelConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CatalogService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*}/catalogs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", + "options": { + "(google.api.http).patch": "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCatalogsResponse": { + "fields": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateCatalogRequest": { + "fields": { + "catalog": { + "type": "Catalog", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "CustomAttribute": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "numbers": { + "rule": "repeated", + "type": "double", + "id": 2 + } + } + }, + "Image": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "height": { + "type": "int32", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + } + } + }, + "PriceInfo": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "price": { + "type": "float", + "id": 2 + }, + "originalPrice": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + } + } + }, + "UserInfo": { + "fields": { + "userId": { + "type": "string", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "userAgent": { + "type": "string", + "id": 3 + }, + "directUserRequest": { + "type": "bool", + "id": 4 + } + } + }, + "GcsSource": { + "fields": { + "inputUris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataSchema": { + "type": "string", + "id": 2 + } + } + }, + "BigQuerySource": { + "fields": { + "projectId": { + "type": "string", + "id": 5 + }, + "datasetId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tableId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsStagingDir": { + "type": "string", + "id": 3 + }, + "dataSchema": { + "type": "string", + "id": 4 + } + } + }, + "ProductInlineSource": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UserEventInlineSource": { + "fields": { + "userEvents": { + "rule": "repeated", + "type": "UserEvent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ImportProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfig": { + "type": "ProductInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + } + } + }, + "ImportUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfig": { + "type": "UserEventInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + } + } + }, + "ProductInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "productInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "productInlineSource": { + "type": "ProductInlineSource", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3 + } + } + }, + "UserEventInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "userEventInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "userEventInlineSource": { + "type": "UserEventInlineSource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "successCount": { + "type": "int64", + "id": 3 + }, + "failureCount": { + "type": "int64", + "id": 4 + } + } + }, + "ImportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + } + } + }, + "ImportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + }, + "importSummary": { + "type": "UserEventImportSummary", + "id": 3 + } + } + }, + "UserEventImportSummary": { + "fields": { + "joinedEventsCount": { + "type": "int64", + "id": 1 + }, + "unjoinedEventsCount": { + "type": "int64", + "id": 2 + } + } + }, + "Product": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Product", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "id": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "type": { + "type": "Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "primaryProductId": { + "type": "string", + "id": 4 + }, + "categories": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "title": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 10 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 12 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 14 + }, + "availableTime": { + "type": "google.protobuf.Timestamp", + "id": 18 + }, + "availability": { + "type": "Availability", + "id": 19 + }, + "availableQuantity": { + "type": "google.protobuf.Int32Value", + "id": 20 + }, + "uri": { + "type": "string", + "id": 22 + }, + "images": { + "rule": "repeated", + "type": "Image", + "id": 23 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "VARIANT": 2, + "COLLECTION": 3 + } + }, + "Availability": { + "values": { + "AVAILABILITY_UNSPECIFIED": 0, + "IN_STOCK": 1, + "OUT_OF_STOCK": 2, + "PREORDER": 3, + "BACKORDER": 4 + } + } + } + }, + "UserEvent": { + "fields": { + "eventType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "visitorId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "experimentIds": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "productDetails": { + "rule": "repeated", + "type": "ProductDetail", + "id": 6 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 7 + }, + "cartId": { + "type": "string", + "id": 8 + }, + "purchaseTransaction": { + "type": "PurchaseTransaction", + "id": 9 + }, + "searchQuery": { + "type": "string", + "id": 10 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 11 + }, + "userInfo": { + "type": "UserInfo", + "id": 12 + }, + "uri": { + "type": "string", + "id": 13 + }, + "referrerUri": { + "type": "string", + "id": 14 + }, + "pageViewId": { + "type": "string", + "id": 15 + } + } + }, + "ProductDetail": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "quantity": { + "type": "google.protobuf.Int32Value", + "id": 2 + } + } + }, + "PurchaseTransaction": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "revenue": { + "type": "float", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tax": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "currencyCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*" + } + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" + } + ] + }, + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" + } + }, + { + "(google.api.method_signature)": "product,update_mask" + } + ] + }, + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + } + } + ] + } + } + }, + "CreateProductRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "UpdateProductRequest": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeUserEventsResponse": { + "fields": { + "purgedEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "UserEventService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "WriteUserEvent": { + "requestType": "WriteUserEventRequest", + "responseType": "UserEvent", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "(google.api.http).body": "user_event" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "body": "user_event" + } + } + ] + }, + "CollectUserEvent": { + "requestType": "CollectUserEventRequest", + "responseType": "google.api.HttpBody", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + } + } + ] + }, + "PurgeUserEvents": { + "requestType": "PurgeUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.PurgeUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.PurgeMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.PurgeUserEventsResponse", + "metadata_type": "google.cloud.retail.v2beta.PurgeMetadata" + } + } + ] + }, + "ImportUserEvents": { + "requestType": "ImportUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.ImportUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.ImportUserEventsResponse", + "metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + } + } + ] + }, + "RejoinUserEvents": { + "requestType": "RejoinUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "RejoinUserEventsResponse", + "metadata_type": "RejoinUserEventsMetadata" + } + } + ] + } + } + }, + "WriteUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CollectUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uri": { + "type": "string", + "id": 3 + }, + "ets": { + "type": "int64", + "id": 4 + } + } + }, + "RejoinUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEventRejoinScope": { + "type": "UserEventRejoinScope", + "id": 2 + } + }, + "nested": { + "UserEventRejoinScope": { + "values": { + "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, + "JOINED_EVENTS": 1, + "UNJOINED_EVENTS": 2 + } + } + } + }, + "RejoinUserEventsResponse": { + "fields": { + "rejoinedUserEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "RejoinUserEventsMetadata": { + "fields": {} + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/httpbody;httpbody", + "java_multiple_files": true, + "java_outer_classname": "HttpBodyProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI", + "cc_enable_arenas": true + }, + "nested": { + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "HttpBody": { + "fields": { + "contentType": { + "type": "string", + "id": 1 + }, + "data": { + "type": "bytes", + "id": 2 + }, + "extensions": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + } + }, + "FileDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10, + "options": { + "packed": false + } + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11, + "options": { + "packed": false + } + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + } + } + }, + "DescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "FieldDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3 + } + } + } + }, + "OneofDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + } + }, + "MethodDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "phpGenericServices": { + "type": "bool", + "id": 42, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + } + } + }, + "OneofOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "SourceCodeInfo": { + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + } + } + } + } + }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "DoubleValue": { + "fields": { + "value": { + "type": "double", + "id": 1 + } + } + }, + "FloatValue": { + "fields": { + "value": { + "type": "float", + "id": 1 + } + } + }, + "Int64Value": { + "fields": { + "value": { + "type": "int64", + "id": 1 + } + } + }, + "UInt64Value": { + "fields": { + "value": { + "type": "uint64", + "id": 1 + } + } + }, + "Int32Value": { + "fields": { + "value": { + "type": "int32", + "id": 1 + } + } + }, + "UInt32Value": { + "fields": { + "value": { + "type": "uint32", + "id": 1 + } + } + }, + "BoolValue": { + "fields": { + "value": { + "type": "bool", + "id": 1 + } + } + }, + "StringValue": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + }, + "BytesValue": { + "fields": { + "value": { + "type": "bytes", + "id": 1 + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Struct": { + "fields": { + "fields": { + "keyType": "string", + "type": "Value", + "id": 1 + } + } + }, + "Value": { + "oneofs": { + "kind": { + "oneof": [ + "nullValue", + "numberValue", + "stringValue", + "boolValue", + "structValue", + "listValue" + ] + } + }, + "fields": { + "nullValue": { + "type": "NullValue", + "id": 1 + }, + "numberValue": { + "type": "double", + "id": 2 + }, + "stringValue": { + "type": "string", + "id": 3 + }, + "boolValue": { + "type": "bool", + "id": 4 + }, + "structValue": { + "type": "Struct", + "id": 5 + }, + "listValue": { + "type": "ListValue", + "id": 6 + } + } + }, + "NullValue": { + "values": { + "NULL_VALUE": 0 + } + }, + "ListValue": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + }, + "longrunning": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.LongRunning", + "go_package": "google.golang.org/genproto/googleapis/longrunning;longrunning", + "java_multiple_files": true, + "java_outer_classname": "OperationsProto", + "java_package": "com.google.longrunning", + "php_namespace": "Google\\LongRunning" + }, + "nested": { + "operationInfo": { + "type": "google.longrunning.OperationInfo", + "id": 1049, + "extend": "google.protobuf.MethodOptions" + }, + "Operations": { + "options": { + "(google.api.default_host)": "longrunning.googleapis.com" + }, + "methods": { + "ListOperations": { + "requestType": "ListOperationsRequest", + "responseType": "ListOperationsResponse", + "options": { + "(google.api.http).get": "/v1/{name=operations}", + "(google.api.method_signature)": "name,filter" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations}" + } + }, + { + "(google.api.method_signature)": "name,filter" + } + ] + }, + "GetOperation": { + "requestType": "GetOperationRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteOperation": { + "requestType": "DeleteOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CancelOperation": { + "requestType": "CancelOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{name=operations/**}:cancel", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "WaitOperation": { + "requestType": "WaitOperationRequest", + "responseType": "Operation" + } + } + }, + "Operation": { + "oneofs": { + "result": { + "oneof": [ + "error", + "response" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "metadata": { + "type": "google.protobuf.Any", + "id": 2 + }, + "done": { + "type": "bool", + "id": 3 + }, + "error": { + "type": "google.rpc.Status", + "id": 4 + }, + "response": { + "type": "google.protobuf.Any", + "id": 5 + } + } + }, + "GetOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "ListOperationsRequest": { + "fields": { + "name": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListOperationsResponse": { + "fields": { + "operations": { + "rule": "repeated", + "type": "Operation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CancelOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "DeleteOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "WaitOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 2 + } + } + }, + "OperationInfo": { + "fields": { + "responseType": { + "type": "string", + "id": 1 + }, + "metadataType": { + "type": "string", + "id": 2 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json new file mode 100644 index 00000000000..e01267ae6c0 --- /dev/null +++ b/packages/google-cloud-retail/samples/package.json @@ -0,0 +1,23 @@ +{ + "name": "nodejs-retail", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=10" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": { + "@google-cloud/retail": "^0.1.0" + }, + "devDependencies": { + "c8": "^7.1.0", + "chai": "^4.2.0", + "mocha": "^8.0.0" + } +} diff --git a/packages/google-cloud-retail/samples/quickstart.js b/packages/google-cloud-retail/samples/quickstart.js new file mode 100644 index 00000000000..04cce91ff84 --- /dev/null +++ b/packages/google-cloud-retail/samples/quickstart.js @@ -0,0 +1,51 @@ +// 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. +// + +'use strict'; + +async function main() { + // [START nodejs_retail_quickstart] + // Imports the Google Cloud client library + + // remove this line after package is released + // eslint-disable-next-line node/no-missing-require + const {UserEventServiceClient} = require('@google-cloud/retail'); + + // TODO(developer): replace with your prefered project ID. + // const projectId = 'my-project' + + // Creates a client + // eslint-disable-next-line no-unused-vars + const client = new {UserEventServiceClient}(); + + //TODO(library generator): write the actual function you will be testing + async function doSomething() { + console.log( + 'Developer! Change this code so that it shows how to use the library! See comments below on structure.' + ); + // const [thing] = await client.methodName({ + // }); + // console.info(thing); + } + doSomething(); + // [END nodejs_retail_quickstart] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/packages/google-cloud-retail/samples/test/quickstart.js b/packages/google-cloud-retail/samples/test/quickstart.js new file mode 100644 index 00000000000..2d076f85c73 --- /dev/null +++ b/packages/google-cloud-retail/samples/test/quickstart.js @@ -0,0 +1,50 @@ +// +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +const path = require('path'); +const cp = require('child_process'); +const {before, describe, it} = require('mocha'); +// eslint-disable-next-line node/no-missing-require +const {UserEventServiceClient} = require('@google-cloud/retail'); +// eslint-disable-next-line no-unused-vars, node/no-missing-require +const {assert} = require('chai'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const cwd = path.join(__dirname, '..'); + +const client = new {UserEventServiceClient}(); + +describe('Quickstart', () => { + //TODO: remove this if not using the projectId + // eslint-disable-next-line no-unused-vars + let projectId; + + before(async () => { + // eslint-disable-next-line no-unused-vars + projectId = await client.getProjectId(); + }); + + it('should run quickstart', async () => { + //TODO: remove this disability + // eslint-disable-next-line no-unused-vars + const stdout = execSync('node ./quickstart.js', {cwd}); + //assert(stdout, stdout !== null); + }); +}); diff --git a/packages/google-cloud-retail/src/index.ts b/packages/google-cloud-retail/src/index.ts new file mode 100644 index 00000000000..b31a78058cd --- /dev/null +++ b/packages/google-cloud-retail/src/index.ts @@ -0,0 +1,51 @@ +// 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. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +import * as v2alpha from './v2alpha'; +import * as v2beta from './v2beta'; + +const CatalogServiceClient = v2beta.CatalogServiceClient; +type CatalogServiceClient = v2beta.CatalogServiceClient; +const PredictionServiceClient = v2beta.PredictionServiceClient; +type PredictionServiceClient = v2beta.PredictionServiceClient; +const ProductServiceClient = v2beta.ProductServiceClient; +type ProductServiceClient = v2beta.ProductServiceClient; +const UserEventServiceClient = v2beta.UserEventServiceClient; +type UserEventServiceClient = v2beta.UserEventServiceClient; + +export { + v2, + v2alpha, + v2beta, + CatalogServiceClient, + PredictionServiceClient, + ProductServiceClient, + UserEventServiceClient, +}; +export default { + v2, + v2alpha, + v2beta, + CatalogServiceClient, + PredictionServiceClient, + ProductServiceClient, + UserEventServiceClient, +}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts new file mode 100644 index 00000000000..87b28f49839 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -0,0 +1,849 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2/catalog_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './catalog_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing catalog configuration. + * @class + * @memberof v2 + */ +export class CatalogServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + catalogServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CatalogServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CatalogServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCatalogs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'catalogs' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.CatalogService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.catalogServiceStub) { + return this.catalogServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.CatalogService. + this.catalogServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.CatalogService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.CatalogService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; + for (const methodName of catalogServiceStubMethods) { + const callPromise = this.catalogServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.catalogServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + updateCatalog( + request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | undefined, + {} | undefined + ] + >; + updateCatalog( + request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, + {} | null | undefined + > + ): void; + updateCatalog( + request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + callback: Callback< + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the {@link google.cloud.retail.v2.Catalog|Catalog}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.Catalog} request.catalog + * Required. The {@link google.cloud.retail.v2.Catalog|Catalog} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2.Catalog|Catalog}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2.Catalog|Catalog} to update does not exist, + * a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.Catalog|Catalog} to update. If not set, will only + * update the + * {@link google.cloud.retail.v2.Catalog.product_level_config|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2.Catalog}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateCatalog(request); + */ + updateCatalog( + request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.ICatalog, + | protos.google.cloud.retail.v2.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'catalog.name': request.catalog!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCatalog(request, options, callback); + } + + listCatalogs( + request: protos.google.cloud.retail.v2.IListCatalogsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICatalog[], + protos.google.cloud.retail.v2.IListCatalogsRequest | null, + protos.google.cloud.retail.v2.IListCatalogsResponse + ] + >; + listCatalogs( + request: protos.google.cloud.retail.v2.IListCatalogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListCatalogsRequest, + protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, + protos.google.cloud.retail.v2.ICatalog + > + ): void; + listCatalogs( + request: protos.google.cloud.retail.v2.IListCatalogsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListCatalogsRequest, + protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, + protos.google.cloud.retail.v2.ICatalog + > + ): void; + /** + * Lists all the {@link google.cloud.retail.v2.Catalog|Catalog}s associated with + * the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2.Catalog|Catalog}s under this location, regardless + * of whether or not this location exists, a PERMISSION_DENIED error is + * returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Catalog]{@link google.cloud.retail.v2.Catalog}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCatalogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCatalogs( + request: protos.google.cloud.retail.v2.IListCatalogsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2.IListCatalogsRequest, + | protos.google.cloud.retail.v2.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2.ICatalog + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2.IListCatalogsRequest, + protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, + protos.google.cloud.retail.v2.ICatalog + > + ): Promise< + [ + protos.google.cloud.retail.v2.ICatalog[], + protos.google.cloud.retail.v2.IListCatalogsRequest | null, + protos.google.cloud.retail.v2.IListCatalogsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCatalogs(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2.Catalog|Catalog}s under this location, regardless + * of whether or not this location exists, a PERMISSION_DENIED error is + * returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Catalog]{@link google.cloud.retail.v2.Catalog} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCatalogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCatalogsStream( + request?: protos.google.cloud.retail.v2.IListCatalogsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCatalogs.createStream( + this.innerApiCalls.listCatalogs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listCatalogs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2.Catalog|Catalog}s under this location, regardless + * of whether or not this location exists, a PERMISSION_DENIED error is + * returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Catalog]{@link google.cloud.retail.v2.Catalog}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listCatalogsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listCatalogsAsync( + request?: protos.google.cloud.retail.v2.IListCatalogsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCatalogs.asyncIterate( + this.innerApiCalls['listCatalogs'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.catalogServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json new file mode 100644 index 00000000000..15cd68637f2 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.retail.v2.CatalogService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListCatalogs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCatalog": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json new file mode 100644 index 00000000000..607b04beea5 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/gapic_metadata.json b/packages/google-cloud-retail/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..07e3d21abf3 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/gapic_metadata.json @@ -0,0 +1,199 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.retail.v2", + "libraryPackage": "retail", + "services": { + "CatalogService": { + "clients": { + "grpc": { + "libraryClient": "CatalogServiceClient", + "rpcs": { + "UpdateCatalog": { + "methods": [ + "updateCatalog" + ] + }, + "ListCatalogs": { + "methods": [ + "listCatalogs", + "listCatalogsStream", + "listCatalogsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CatalogServiceClient", + "rpcs": { + "UpdateCatalog": { + "methods": [ + "updateCatalog" + ] + }, + "ListCatalogs": { + "methods": [ + "listCatalogs", + "listCatalogsStream", + "listCatalogsAsync" + ] + } + } + } + } + }, + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionServiceClient", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "PredictionServiceClient", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + } + } + }, + "ProductService": { + "clients": { + "grpc": { + "libraryClient": "ProductServiceClient", + "rpcs": { + "CreateProduct": { + "methods": [ + "createProduct" + ] + }, + "GetProduct": { + "methods": [ + "getProduct" + ] + }, + "UpdateProduct": { + "methods": [ + "updateProduct" + ] + }, + "DeleteProduct": { + "methods": [ + "deleteProduct" + ] + }, + "ImportProducts": { + "methods": [ + "importProducts" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ProductServiceClient", + "rpcs": { + "CreateProduct": { + "methods": [ + "createProduct" + ] + }, + "GetProduct": { + "methods": [ + "getProduct" + ] + }, + "UpdateProduct": { + "methods": [ + "updateProduct" + ] + }, + "DeleteProduct": { + "methods": [ + "deleteProduct" + ] + }, + "ImportProducts": { + "methods": [ + "importProducts" + ] + } + } + } + } + }, + "UserEventService": { + "clients": { + "grpc": { + "libraryClient": "UserEventServiceClient", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "writeUserEvent" + ] + }, + "CollectUserEvent": { + "methods": [ + "collectUserEvent" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purgeUserEvents" + ] + }, + "ImportUserEvents": { + "methods": [ + "importUserEvents" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoinUserEvents" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "UserEventServiceClient", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "writeUserEvent" + ] + }, + "CollectUserEvent": { + "methods": [ + "collectUserEvent" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purgeUserEvents" + ] + }, + "ImportUserEvents": { + "methods": [ + "importUserEvents" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoinUserEvents" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/index.ts b/packages/google-cloud-retail/src/v2/index.ts new file mode 100644 index 00000000000..dbfefa59d67 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/index.ts @@ -0,0 +1,22 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CatalogServiceClient} from './catalog_service_client'; +export {PredictionServiceClient} from './prediction_service_client'; +export {ProductServiceClient} from './product_service_client'; +export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts new file mode 100644 index 00000000000..cbae29e9982 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -0,0 +1,624 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2/prediction_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './prediction_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for making recommendation prediction. + * @class + * @memberof v2 + */ +export class PredictionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + predictionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of PredictionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof PredictionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.PredictionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.predictionServiceStub) { + return this.predictionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.PredictionService. + this.predictionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.PredictionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.PredictionService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const predictionServiceStubMethods = ['predict']; + for (const methodName of predictionServiceStubMethods) { + const callPromise = this.predictionServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.predictionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + predict( + request: protos.google.cloud.retail.v2.IPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | undefined, + {} | undefined + ] + >; + predict( + request: protos.google.cloud.retail.v2.IPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + predict( + request: protos.google.cloud.retail.v2.IPredictRequest, + callback: Callback< + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Makes a recommendation prediction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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 + * @param {google.cloud.retail.v2.UserEvent} request.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. + * @param {number} request.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. + * @param {string} request.pageToken + * The previous PredictResponse.next_page_token. + * @param {string} request.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`. + * @param {boolean} request.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. + * @param {number[]} request.params + * 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. + * @param {number[]} request.labels + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PredictResponse]{@link google.cloud.retail.v2.PredictResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.predict(request); + */ + predict( + request: protos.google.cloud.retail.v2.IPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + this.initialize(); + return this.innerApiCalls.predict(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.predictionServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client_config.json b/packages/google-cloud-retail/src/v2/prediction_service_client_config.json new file mode 100644 index 00000000000..799726feef3 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/prediction_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2.PredictionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Predict": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json new file mode 100644 index 00000000000..607b04beea5 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts new file mode 100644 index 00000000000..0a866861e8b --- /dev/null +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -0,0 +1,1113 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2/product_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './product_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting {@link google.cloud.retail.v2.Product|Product} information + * of the customer's website. + * @class + * @memberof v2 + */ +export class ProductServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + productServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProductServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ProductServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importProductsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ImportProductsResponse' + ) as gax.protobuf.Type; + const importProductsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ImportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + importProducts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importProductsResponse.decode.bind(importProductsResponse), + importProductsMetadata.decode.bind(importProductsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.ProductService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.productServiceStub) { + return this.productServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.ProductService. + this.productServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.ProductService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.ProductService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const productServiceStubMethods = [ + 'createProduct', + 'getProduct', + 'updateProduct', + 'deleteProduct', + 'importProducts', + ]; + for (const methodName of productServiceStubMethods) { + const callPromise = this.productServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.productServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProduct( + request: protos.google.cloud.retail.v2.ICreateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protos.google.cloud.retail.v2.ICreateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, + {} | null | undefined + > + ): void; + createProduct( + request: protos.google.cloud.retail.v2.ICreateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a {@link google.cloud.retail.v2.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch". + * @param {google.cloud.retail.v2.Product} request.product + * Required. The {@link google.cloud.retail.v2.Product|Product} to create. + * @param {string} request.productId + * Required. The ID to use for the {@link google.cloud.retail.v2.Product|Product}, + * which will become the final component of the + * {@link google.cloud.retail.v2.Product.name|Product.name}. + * + * If the caller does not have permission to create the + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * + * This field must be unique among all + * {@link google.cloud.retail.v2.Product|Product}s with the same + * {@link google.cloud.retail.v2.CreateProductRequest.parent|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createProduct(request); + */ + createProduct( + request: protos.google.cloud.retail.v2.ICreateProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IProduct, + | protos.google.cloud.retail.v2.ICreateProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createProduct(request, options, callback); + } + getProduct( + request: protos.google.cloud.retail.v2.IGetProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IGetProductRequest | undefined, + {} | undefined + ] + >; + getProduct( + request: protos.google.cloud.retail.v2.IGetProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): void; + getProduct( + request: protos.google.cloud.retail.v2.IGetProductRequest, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a {@link google.cloud.retail.v2.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * + * If the requested {@link google.cloud.retail.v2.Product|Product} does not exist, + * a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getProduct(request); + */ + getProduct( + request: protos.google.cloud.retail.v2.IGetProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IGetProductRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IGetProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getProduct(request, options, callback); + } + updateProduct( + request: protos.google.cloud.retail.v2.IUpdateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protos.google.cloud.retail.v2.IUpdateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, + {} | null | undefined + > + ): void; + updateProduct( + request: protos.google.cloud.retail.v2.IUpdateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates a {@link google.cloud.retail.v2.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.Product} request.product + * Required. The product to update/create. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2.Product|Product} to update does not exist, + * a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.Product|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateProduct(request); + */ + updateProduct( + request: protos.google.cloud.retail.v2.IUpdateProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IProduct, + | protos.google.cloud.retail.v2.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateProduct(request, options, callback); + } + deleteProduct( + request: protos.google.cloud.retail.v2.IDeleteProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protos.google.cloud.retail.v2.IDeleteProductRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteProduct( + request: protos.google.cloud.retail.v2.IDeleteProductRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a {@link google.cloud.retail.v2.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2.Product|Product} to delete does not exist, + * a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteProduct(request); + */ + deleteProduct( + request: protos.google.cloud.retail.v2.IDeleteProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteProduct(request, options, callback); + } + + importProducts( + request: protos.google.cloud.retail.v2.IImportProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProducts( + request: protos.google.cloud.retail.v2.IImportProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importProducts( + request: protos.google.cloud.retail.v2.IImportProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Bulk import of multiple {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}s to be successfully updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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. + * @param {google.cloud.retail.v2.ProductInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided imported 'products' to update. If + * not set, will by default update all fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importProducts(request); + * const [response] = await operation.promise(); + */ + importProducts( + request: protos.google.cloud.retail.v2.IImportProductsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importProducts(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importProducts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportProductsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportProductsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.ImportProductsResponse, + protos.google.cloud.retail.v2.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importProducts, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.ImportProductsResponse, + protos.google.cloud.retail.v2.ImportMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.productServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/product_service_client_config.json b/packages/google-cloud-retail/src/v2/product_service_client_config.json new file mode 100644 index 00000000000..d4f7d741409 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/product_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.retail.v2.ProductService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/product_service_proto_list.json b/packages/google-cloud-retail/src/v2/product_service_proto_list.json new file mode 100644 index 00000000000..607b04beea5 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/product_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts new file mode 100644 index 00000000000..48cbb2518c0 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -0,0 +1,1185 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2/user_event_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './user_event_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting end user actions on the customer website. + * @class + * @memberof v2 + */ +export class UserEventServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + userEventServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of UserEventServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof UserEventServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const purgeUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.PurgeUserEventsResponse' + ) as gax.protobuf.Type; + const purgeUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.PurgeMetadata' + ) as gax.protobuf.Type; + const importUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ImportUserEventsResponse' + ) as gax.protobuf.Type; + const importUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ImportMetadata' + ) as gax.protobuf.Type; + const rejoinUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.RejoinUserEventsResponse' + ) as gax.protobuf.Type; + const rejoinUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.RejoinUserEventsMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + purgeUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + purgeUserEventsResponse.decode.bind(purgeUserEventsResponse), + purgeUserEventsMetadata.decode.bind(purgeUserEventsMetadata) + ), + importUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importUserEventsResponse.decode.bind(importUserEventsResponse), + importUserEventsMetadata.decode.bind(importUserEventsMetadata) + ), + rejoinUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rejoinUserEventsResponse.decode.bind(rejoinUserEventsResponse), + rejoinUserEventsMetadata.decode.bind(rejoinUserEventsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.UserEventService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.userEventServiceStub) { + return this.userEventServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.UserEventService. + this.userEventServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.UserEventService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.UserEventService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const userEventServiceStubMethods = [ + 'writeUserEvent', + 'collectUserEvent', + 'purgeUserEvents', + 'importUserEvents', + 'rejoinUserEvents', + ]; + for (const methodName of userEventServiceStubMethods) { + const callPromise = this.userEventServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.userEventServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + writeUserEvent( + request: protos.google.cloud.retail.v2.IWriteUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IUserEvent, + protos.google.cloud.retail.v2.IWriteUserEventRequest | undefined, + {} | undefined + ] + >; + writeUserEvent( + request: protos.google.cloud.retail.v2.IWriteUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IUserEvent, + protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, + {} | null | undefined + > + ): void; + writeUserEvent( + request: protos.google.cloud.retail.v2.IWriteUserEventRequest, + callback: Callback< + protos.google.cloud.retail.v2.IUserEvent, + protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Writes a single user event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {google.cloud.retail.v2.UserEvent} request.userEvent + * Required. User event to write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2.UserEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.writeUserEvent(request); + */ + writeUserEvent( + request: protos.google.cloud.retail.v2.IWriteUserEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IUserEvent, + | protos.google.cloud.retail.v2.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IUserEvent, + protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IUserEvent, + protos.google.cloud.retail.v2.IWriteUserEventRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.writeUserEvent(request, options, callback); + } + collectUserEvent( + request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | undefined, + {} | undefined + ] + >; + collectUserEvent( + request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, + {} | null | undefined + > + ): void; + collectUserEvent( + request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {string} request.userEvent + * Required. URL encoded UserEvent proto with a length limit of 2,000,000 + * characters. + * @param {string} request.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. + * @param {number} request.ets + * The event timestamp in milliseconds. This prevents browser caching of + * otherwise identical get requests. The name is abbreviated to reduce the + * payload bytes. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.collectUserEvent(request); + */ + collectUserEvent( + request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.collectUserEvent(request, options, callback); + } + + purgeUserEvents( + request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeUserEvents( + request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeUserEvents( + request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the catalog under which the events are + * created. The format is + * "projects/${projectId}/locations/global/catalogs/${catalogId}" + * @param {string} request.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 + * {@link google.cloud.retail.v2.UserEvent.event_type|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. + * @param {boolean} request.force + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any user events. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.purgeUserEvents(request); + * const [response] = await operation.promise(); + */ + purgeUserEvents( + request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.purgeUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `purgeUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkPurgeUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkPurgeUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.PurgeUserEventsResponse, + protos.google.cloud.retail.v2.PurgeMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.purgeUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.PurgeUserEventsResponse, + protos.google.cloud.retail.v2.PurgeMetadata + >; + } + importUserEvents( + request: protos.google.cloud.retail.v2.IImportUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importUserEvents( + request: protos.google.cloud.retail.v2.IImportUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importUserEvents( + request: protos.google.cloud.retail.v2.IImportUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. "projects/1234/locations/global/catalogs/default_catalog" + * @param {google.cloud.retail.v2.UserEventInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importUserEvents(request); + * const [response] = await operation.promise(); + */ + importUserEvents( + request: protos.google.cloud.retail.v2.IImportUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.ImportUserEventsResponse, + protos.google.cloud.retail.v2.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.ImportUserEventsResponse, + protos.google.cloud.retail.v2.ImportMetadata + >; + } + rejoinUserEvents( + request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + rejoinUserEvents( + request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + rejoinUserEvents( + request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.rejoinUserEvents(request); + * const [response] = await operation.promise(); + */ + rejoinUserEvents( + request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.rejoinUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `rejoinUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRejoinUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRejoinUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.RejoinUserEventsResponse, + protos.google.cloud.retail.v2.RejoinUserEventsMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.rejoinUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.RejoinUserEventsResponse, + protos.google.cloud.retail.v2.RejoinUserEventsMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.userEventServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2/user_event_service_client_config.json new file mode 100644 index 00000000000..1baf6f127b8 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/user_event_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.retail.v2.UserEventService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "WriteUserEvent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CollectUserEvent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PurgeUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RejoinUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json new file mode 100644 index 00000000000..607b04beea5 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts new file mode 100644 index 00000000000..f5125242fda --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -0,0 +1,861 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/catalog_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './catalog_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing catalog configuration. + * @class + * @memberof v2alpha + */ +export class CatalogServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + catalogServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CatalogServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CatalogServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCatalogs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'catalogs' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.CatalogService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.catalogServiceStub) { + return this.catalogServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.CatalogService. + this.catalogServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.CatalogService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.CatalogService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; + for (const methodName of catalogServiceStubMethods) { + const callPromise = this.catalogServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.catalogServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + updateCatalog( + request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICatalog, + protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest | undefined, + {} | undefined + ] + >; + updateCatalog( + request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICatalog, + | protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCatalog( + request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICatalog, + | protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the {@link google.cloud.retail.v2alpha.Catalog|Catalog}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.Catalog} request.catalog + * Required. The {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2alpha.Catalog|Catalog}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update does not + * exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. If not set, will + * only update the + * {@link google.cloud.retail.v2alpha.Catalog.product_level_config|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2alpha.Catalog}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateCatalog(request); + */ + updateCatalog( + request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.ICatalog, + | protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.ICatalog, + | protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICatalog, + protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'catalog.name': request.catalog!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCatalog(request, options, callback); + } + + listCatalogs( + request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICatalog[], + protos.google.cloud.retail.v2alpha.IListCatalogsRequest | null, + protos.google.cloud.retail.v2alpha.IListCatalogsResponse + ] + >; + listCatalogs( + request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + | protos.google.cloud.retail.v2alpha.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.ICatalog + > + ): void; + listCatalogs( + request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + | protos.google.cloud.retail.v2alpha.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.ICatalog + > + ): void; + /** + * Lists all the {@link google.cloud.retail.v2alpha.Catalog|Catalog}s associated + * with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Catalog]{@link google.cloud.retail.v2alpha.Catalog}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCatalogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCatalogs( + request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + | protos.google.cloud.retail.v2alpha.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.ICatalog + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + | protos.google.cloud.retail.v2alpha.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.ICatalog + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICatalog[], + protos.google.cloud.retail.v2alpha.IListCatalogsRequest | null, + protos.google.cloud.retail.v2alpha.IListCatalogsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCatalogs(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Catalog]{@link google.cloud.retail.v2alpha.Catalog} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCatalogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCatalogsStream( + request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCatalogs.createStream( + this.innerApiCalls.listCatalogs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listCatalogs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Catalog]{@link google.cloud.retail.v2alpha.Catalog}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listCatalogsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listCatalogsAsync( + request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCatalogs.asyncIterate( + this.innerApiCalls['listCatalogs'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.catalogServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json new file mode 100644 index 00000000000..2ac65f6da85 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.CatalogService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListCatalogs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCatalog": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json new file mode 100644 index 00000000000..241ed02fecb --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json new file mode 100644 index 00000000000..efd83677449 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json @@ -0,0 +1,199 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.retail.v2alpha", + "libraryPackage": "retail", + "services": { + "CatalogService": { + "clients": { + "grpc": { + "libraryClient": "CatalogServiceClient", + "rpcs": { + "UpdateCatalog": { + "methods": [ + "updateCatalog" + ] + }, + "ListCatalogs": { + "methods": [ + "listCatalogs", + "listCatalogsStream", + "listCatalogsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CatalogServiceClient", + "rpcs": { + "UpdateCatalog": { + "methods": [ + "updateCatalog" + ] + }, + "ListCatalogs": { + "methods": [ + "listCatalogs", + "listCatalogsStream", + "listCatalogsAsync" + ] + } + } + } + } + }, + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionServiceClient", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "PredictionServiceClient", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + } + } + }, + "ProductService": { + "clients": { + "grpc": { + "libraryClient": "ProductServiceClient", + "rpcs": { + "CreateProduct": { + "methods": [ + "createProduct" + ] + }, + "GetProduct": { + "methods": [ + "getProduct" + ] + }, + "UpdateProduct": { + "methods": [ + "updateProduct" + ] + }, + "DeleteProduct": { + "methods": [ + "deleteProduct" + ] + }, + "ImportProducts": { + "methods": [ + "importProducts" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ProductServiceClient", + "rpcs": { + "CreateProduct": { + "methods": [ + "createProduct" + ] + }, + "GetProduct": { + "methods": [ + "getProduct" + ] + }, + "UpdateProduct": { + "methods": [ + "updateProduct" + ] + }, + "DeleteProduct": { + "methods": [ + "deleteProduct" + ] + }, + "ImportProducts": { + "methods": [ + "importProducts" + ] + } + } + } + } + }, + "UserEventService": { + "clients": { + "grpc": { + "libraryClient": "UserEventServiceClient", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "writeUserEvent" + ] + }, + "CollectUserEvent": { + "methods": [ + "collectUserEvent" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purgeUserEvents" + ] + }, + "ImportUserEvents": { + "methods": [ + "importUserEvents" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoinUserEvents" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "UserEventServiceClient", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "writeUserEvent" + ] + }, + "CollectUserEvent": { + "methods": [ + "collectUserEvent" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purgeUserEvents" + ] + }, + "ImportUserEvents": { + "methods": [ + "importUserEvents" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoinUserEvents" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/index.ts b/packages/google-cloud-retail/src/v2alpha/index.ts new file mode 100644 index 00000000000..dbfefa59d67 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/index.ts @@ -0,0 +1,22 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CatalogServiceClient} from './catalog_service_client'; +export {PredictionServiceClient} from './prediction_service_client'; +export {ProductServiceClient} from './product_service_client'; +export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts new file mode 100644 index 00000000000..7bebb167ba2 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -0,0 +1,624 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/prediction_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './prediction_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for making recommendation prediction. + * @class + * @memberof v2alpha + */ +export class PredictionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + predictionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of PredictionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof PredictionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.PredictionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.predictionServiceStub) { + return this.predictionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.PredictionService. + this.predictionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.PredictionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.PredictionService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const predictionServiceStubMethods = ['predict']; + for (const methodName of predictionServiceStubMethods) { + const callPromise = this.predictionServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.predictionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + predict( + request: protos.google.cloud.retail.v2alpha.IPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | undefined, + {} | undefined + ] + >; + predict( + request: protos.google.cloud.retail.v2alpha.IPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + predict( + request: protos.google.cloud.retail.v2alpha.IPredictRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Makes a recommendation prediction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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 + * @param {google.cloud.retail.v2alpha.UserEvent} request.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. + * @param {number} request.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. + * @param {string} request.pageToken + * The previous PredictResponse.next_page_token. + * @param {string} request.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`. + * @param {boolean} request.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. + * @param {number[]} request.params + * 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. + * @param {number[]} request.labels + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PredictResponse]{@link google.cloud.retail.v2alpha.PredictResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.predict(request); + */ + predict( + request: protos.google.cloud.retail.v2alpha.IPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + this.initialize(); + return this.innerApiCalls.predict(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.predictionServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json new file mode 100644 index 00000000000..2982aa11161 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.PredictionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Predict": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json new file mode 100644 index 00000000000..241ed02fecb --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts new file mode 100644 index 00000000000..367078cfc4a --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -0,0 +1,1133 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/product_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './product_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting {@link google.cloud.retail.v2alpha.Product|Product} + * information of the customer's website. + * @class + * @memberof v2alpha + */ +export class ProductServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + productServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProductServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ProductServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importProductsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.ImportProductsResponse' + ) as gax.protobuf.Type; + const importProductsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.ImportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + importProducts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importProductsResponse.decode.bind(importProductsResponse), + importProductsMetadata.decode.bind(importProductsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.ProductService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.productServiceStub) { + return this.productServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.ProductService. + this.productServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.ProductService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.ProductService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const productServiceStubMethods = [ + 'createProduct', + 'getProduct', + 'updateProduct', + 'deleteProduct', + 'importProducts', + ]; + for (const methodName of productServiceStubMethods) { + const callPromise = this.productServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.productServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProduct( + request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProduct( + request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a {@link google.cloud.retail.v2alpha.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch". + * @param {google.cloud.retail.v2alpha.Product} request.product + * Required. The {@link google.cloud.retail.v2alpha.Product|Product} to create. + * @param {string} request.productId + * Required. The ID to use for the + * {@link google.cloud.retail.v2alpha.Product|Product}, which will become the final + * component of the {@link google.cloud.retail.v2alpha.Product.name|Product.name}. + * + * If the caller does not have permission to create the + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * This field must be unique among all + * {@link google.cloud.retail.v2alpha.Product|Product}s with the same + * {@link google.cloud.retail.v2alpha.CreateProductRequest.parent|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2alpha.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createProduct(request); + */ + createProduct( + request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.ICreateProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.ICreateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createProduct(request, options, callback); + } + getProduct( + request: protos.google.cloud.retail.v2alpha.IGetProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IGetProductRequest | undefined, + {} | undefined + ] + >; + getProduct( + request: protos.google.cloud.retail.v2alpha.IGetProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): void; + getProduct( + request: protos.google.cloud.retail.v2alpha.IGetProductRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a {@link google.cloud.retail.v2alpha.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * If the requested {@link google.cloud.retail.v2alpha.Product|Product} does not + * exist, a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2alpha.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getProduct(request); + */ + getProduct( + request: protos.google.cloud.retail.v2alpha.IGetProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IGetProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IGetProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getProduct(request, options, callback); + } + updateProduct( + request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateProduct( + request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates a {@link google.cloud.retail.v2alpha.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.Product} request.product + * Required. The product to update/create. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2alpha.Product|Product} to update does not + * exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.Product|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2alpha.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateProduct(request); + */ + updateProduct( + request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IUpdateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateProduct(request, options, callback); + } + deleteProduct( + request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteProduct( + request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a {@link google.cloud.retail.v2alpha.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2alpha.Product|Product} to delete does not + * exist, a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteProduct(request); + */ + deleteProduct( + request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteProduct(request, options, callback); + } + + importProducts( + request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProducts( + request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importProducts( + request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Bulk import of multiple {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}s to be successfully updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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. + * @param {google.cloud.retail.v2alpha.ProductInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided imported 'products' to update. If + * not set, will by default update all fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importProducts(request); + * const [response] = await operation.promise(); + */ + importProducts( + request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importProducts(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importProducts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportProductsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportProductsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.ImportProductsResponse, + protos.google.cloud.retail.v2alpha.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importProducts, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.ImportProductsResponse, + protos.google.cloud.retail.v2alpha.ImportMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.productServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json new file mode 100644 index 00000000000..0b6753696ce --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.ProductService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json new file mode 100644 index 00000000000..241ed02fecb --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts new file mode 100644 index 00000000000..34b654f5b89 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -0,0 +1,1198 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/user_event_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './user_event_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting end user actions on the customer website. + * @class + * @memberof v2alpha + */ +export class UserEventServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + userEventServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of UserEventServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof UserEventServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const purgeUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.PurgeUserEventsResponse' + ) as gax.protobuf.Type; + const purgeUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.PurgeMetadata' + ) as gax.protobuf.Type; + const importUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.ImportUserEventsResponse' + ) as gax.protobuf.Type; + const importUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.ImportMetadata' + ) as gax.protobuf.Type; + const rejoinUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RejoinUserEventsResponse' + ) as gax.protobuf.Type; + const rejoinUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RejoinUserEventsMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + purgeUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + purgeUserEventsResponse.decode.bind(purgeUserEventsResponse), + purgeUserEventsMetadata.decode.bind(purgeUserEventsMetadata) + ), + importUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importUserEventsResponse.decode.bind(importUserEventsResponse), + importUserEventsMetadata.decode.bind(importUserEventsMetadata) + ), + rejoinUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rejoinUserEventsResponse.decode.bind(rejoinUserEventsResponse), + rejoinUserEventsMetadata.decode.bind(rejoinUserEventsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.UserEventService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.userEventServiceStub) { + return this.userEventServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.UserEventService. + this.userEventServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.UserEventService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.UserEventService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const userEventServiceStubMethods = [ + 'writeUserEvent', + 'collectUserEvent', + 'purgeUserEvents', + 'importUserEvents', + 'rejoinUserEvents', + ]; + for (const methodName of userEventServiceStubMethods) { + const callPromise = this.userEventServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.userEventServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + writeUserEvent( + request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IUserEvent, + protos.google.cloud.retail.v2alpha.IWriteUserEventRequest | undefined, + {} | undefined + ] + >; + writeUserEvent( + request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IUserEvent, + | protos.google.cloud.retail.v2alpha.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + writeUserEvent( + request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IUserEvent, + | protos.google.cloud.retail.v2alpha.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Writes a single user event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent + * Required. User event to write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2alpha.UserEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.writeUserEvent(request); + */ + writeUserEvent( + request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IUserEvent, + | protos.google.cloud.retail.v2alpha.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IUserEvent, + | protos.google.cloud.retail.v2alpha.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IUserEvent, + protos.google.cloud.retail.v2alpha.IWriteUserEventRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.writeUserEvent(request, options, callback); + } + collectUserEvent( + request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2alpha.ICollectUserEventRequest | undefined, + {} | undefined + ] + >; + collectUserEvent( + request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + collectUserEvent( + request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {string} request.userEvent + * Required. URL encoded UserEvent proto with a length limit of 2,000,000 + * characters. + * @param {string} request.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. + * @param {number} request.ets + * The event timestamp in milliseconds. This prevents browser caching of + * otherwise identical get requests. The name is abbreviated to reduce the + * payload bytes. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.collectUserEvent(request); + */ + collectUserEvent( + request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2alpha.ICollectUserEventRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.collectUserEvent(request, options, callback); + } + + purgeUserEvents( + request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeUserEvents( + request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeUserEvents( + request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the catalog under which the events are + * created. The format is + * "projects/${projectId}/locations/global/catalogs/${catalogId}" + * @param {string} request.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 + * {@link google.cloud.retail.v2alpha.UserEvent.event_type|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. + * @param {boolean} request.force + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any user events. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.purgeUserEvents(request); + * const [response] = await operation.promise(); + */ + purgeUserEvents( + request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.purgeUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `purgeUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkPurgeUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkPurgeUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.PurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.PurgeMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.purgeUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.PurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.PurgeMetadata + >; + } + importUserEvents( + request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importUserEvents( + request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importUserEvents( + request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. "projects/1234/locations/global/catalogs/default_catalog" + * @param {google.cloud.retail.v2alpha.UserEventInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importUserEvents(request); + * const [response] = await operation.promise(); + */ + importUserEvents( + request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.ImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.ImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.ImportMetadata + >; + } + rejoinUserEvents( + request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + rejoinUserEvents( + request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + rejoinUserEvents( + request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.rejoinUserEvents(request); + * const [response] = await operation.promise(); + */ + rejoinUserEvents( + request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.rejoinUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `rejoinUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRejoinUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRejoinUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.RejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.RejoinUserEventsMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.rejoinUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.RejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.RejoinUserEventsMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.userEventServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json new file mode 100644 index 00000000000..555875a5f65 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.UserEventService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "WriteUserEvent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CollectUserEvent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PurgeUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RejoinUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json new file mode 100644 index 00000000000..241ed02fecb --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts new file mode 100644 index 00000000000..e6979275172 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -0,0 +1,861 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2beta/catalog_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './catalog_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing catalog configuration. + * @class + * @memberof v2beta + */ +export class CatalogServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + catalogServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CatalogServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CatalogServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listCatalogs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'catalogs' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.CatalogService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.catalogServiceStub) { + return this.catalogServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.CatalogService. + this.catalogServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.CatalogService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.CatalogService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; + for (const methodName of catalogServiceStubMethods) { + const callPromise = this.catalogServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.catalogServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + updateCatalog( + request: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICatalog, + protos.google.cloud.retail.v2beta.IUpdateCatalogRequest | undefined, + {} | undefined + ] + >; + updateCatalog( + request: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.ICatalog, + | protos.google.cloud.retail.v2beta.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCatalog( + request: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.ICatalog, + | protos.google.cloud.retail.v2beta.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the {@link google.cloud.retail.v2beta.Catalog|Catalog}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.Catalog} request.catalog + * Required. The {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2beta.Catalog|Catalog}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2beta.Catalog|Catalog} to update does not + * exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. If not set, will + * only update the + * {@link google.cloud.retail.v2beta.Catalog.product_level_config|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2beta.Catalog}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateCatalog(request); + */ + updateCatalog( + request: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.ICatalog, + | protos.google.cloud.retail.v2beta.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.ICatalog, + | protos.google.cloud.retail.v2beta.IUpdateCatalogRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICatalog, + protos.google.cloud.retail.v2beta.IUpdateCatalogRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'catalog.name': request.catalog!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCatalog(request, options, callback); + } + + listCatalogs( + request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICatalog[], + protos.google.cloud.retail.v2beta.IListCatalogsRequest | null, + protos.google.cloud.retail.v2beta.IListCatalogsResponse + ] + >; + listCatalogs( + request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListCatalogsRequest, + | protos.google.cloud.retail.v2beta.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.ICatalog + > + ): void; + listCatalogs( + request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListCatalogsRequest, + | protos.google.cloud.retail.v2beta.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.ICatalog + > + ): void; + /** + * Lists all the {@link google.cloud.retail.v2beta.Catalog|Catalog}s associated + * with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2beta.Catalog|Catalog}s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Catalog]{@link google.cloud.retail.v2beta.Catalog}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCatalogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCatalogs( + request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2beta.IListCatalogsRequest, + | protos.google.cloud.retail.v2beta.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.ICatalog + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2beta.IListCatalogsRequest, + | protos.google.cloud.retail.v2beta.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.ICatalog + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICatalog[], + protos.google.cloud.retail.v2beta.IListCatalogsRequest | null, + protos.google.cloud.retail.v2beta.IListCatalogsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCatalogs(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2beta.Catalog|Catalog}s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Catalog]{@link google.cloud.retail.v2beta.Catalog} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCatalogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCatalogsStream( + request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCatalogs.createStream( + this.innerApiCalls.listCatalogs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listCatalogs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The account resource name with an associated location. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2beta.Catalog|Catalog}s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Catalog|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. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.CatalogService.ListCatalogs|CatalogService.ListCatalogs} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Catalog]{@link google.cloud.retail.v2beta.Catalog}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listCatalogsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listCatalogsAsync( + request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listCatalogs.asyncIterate( + this.innerApiCalls['listCatalogs'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.catalogServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json new file mode 100644 index 00000000000..53824c46752 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.CatalogService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListCatalogs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCatalog": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json new file mode 100644 index 00000000000..d02281cd8fb --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json new file mode 100644 index 00000000000..75610a1f22a --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json @@ -0,0 +1,199 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.retail.v2beta", + "libraryPackage": "retail", + "services": { + "CatalogService": { + "clients": { + "grpc": { + "libraryClient": "CatalogServiceClient", + "rpcs": { + "UpdateCatalog": { + "methods": [ + "updateCatalog" + ] + }, + "ListCatalogs": { + "methods": [ + "listCatalogs", + "listCatalogsStream", + "listCatalogsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CatalogServiceClient", + "rpcs": { + "UpdateCatalog": { + "methods": [ + "updateCatalog" + ] + }, + "ListCatalogs": { + "methods": [ + "listCatalogs", + "listCatalogsStream", + "listCatalogsAsync" + ] + } + } + } + } + }, + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionServiceClient", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "PredictionServiceClient", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + } + } + }, + "ProductService": { + "clients": { + "grpc": { + "libraryClient": "ProductServiceClient", + "rpcs": { + "CreateProduct": { + "methods": [ + "createProduct" + ] + }, + "GetProduct": { + "methods": [ + "getProduct" + ] + }, + "UpdateProduct": { + "methods": [ + "updateProduct" + ] + }, + "DeleteProduct": { + "methods": [ + "deleteProduct" + ] + }, + "ImportProducts": { + "methods": [ + "importProducts" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ProductServiceClient", + "rpcs": { + "CreateProduct": { + "methods": [ + "createProduct" + ] + }, + "GetProduct": { + "methods": [ + "getProduct" + ] + }, + "UpdateProduct": { + "methods": [ + "updateProduct" + ] + }, + "DeleteProduct": { + "methods": [ + "deleteProduct" + ] + }, + "ImportProducts": { + "methods": [ + "importProducts" + ] + } + } + } + } + }, + "UserEventService": { + "clients": { + "grpc": { + "libraryClient": "UserEventServiceClient", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "writeUserEvent" + ] + }, + "CollectUserEvent": { + "methods": [ + "collectUserEvent" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purgeUserEvents" + ] + }, + "ImportUserEvents": { + "methods": [ + "importUserEvents" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoinUserEvents" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "UserEventServiceClient", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "writeUserEvent" + ] + }, + "CollectUserEvent": { + "methods": [ + "collectUserEvent" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purgeUserEvents" + ] + }, + "ImportUserEvents": { + "methods": [ + "importUserEvents" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoinUserEvents" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/index.ts b/packages/google-cloud-retail/src/v2beta/index.ts new file mode 100644 index 00000000000..dbfefa59d67 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/index.ts @@ -0,0 +1,22 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CatalogServiceClient} from './catalog_service_client'; +export {PredictionServiceClient} from './prediction_service_client'; +export {ProductServiceClient} from './product_service_client'; +export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts new file mode 100644 index 00000000000..34caddd4654 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -0,0 +1,624 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2beta/prediction_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './prediction_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for making recommendation prediction. + * @class + * @memberof v2beta + */ +export class PredictionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + predictionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of PredictionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof PredictionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.PredictionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.predictionServiceStub) { + return this.predictionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.PredictionService. + this.predictionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.PredictionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.PredictionService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const predictionServiceStubMethods = ['predict']; + for (const methodName of predictionServiceStubMethods) { + const callPromise = this.predictionServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.predictionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + predict( + request: protos.google.cloud.retail.v2beta.IPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | undefined, + {} | undefined + ] + >; + predict( + request: protos.google.cloud.retail.v2beta.IPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + predict( + request: protos.google.cloud.retail.v2beta.IPredictRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Makes a recommendation prediction. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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 + * @param {google.cloud.retail.v2beta.UserEvent} request.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. + * @param {number} request.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. + * @param {string} request.pageToken + * The previous PredictResponse.next_page_token. + * @param {string} request.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`. + * @param {boolean} request.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. + * @param {number[]} request.params + * 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. + * @param {number[]} request.labels + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PredictResponse]{@link google.cloud.retail.v2beta.PredictResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.predict(request); + */ + predict( + request: protos.google.cloud.retail.v2beta.IPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + this.initialize(); + return this.innerApiCalls.predict(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.predictionServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json b/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json new file mode 100644 index 00000000000..caff0cc3ecd --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.PredictionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Predict": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json new file mode 100644 index 00000000000..d02281cd8fb --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts new file mode 100644 index 00000000000..4cad5dac5ed --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -0,0 +1,1133 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2beta/product_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './product_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting {@link google.cloud.retail.v2beta.Product|Product} + * information of the customer's website. + * @class + * @memberof v2beta + */ +export class ProductServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + productServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProductServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ProductServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importProductsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.ImportProductsResponse' + ) as gax.protobuf.Type; + const importProductsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.ImportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + importProducts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importProductsResponse.decode.bind(importProductsResponse), + importProductsMetadata.decode.bind(importProductsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.ProductService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.productServiceStub) { + return this.productServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.ProductService. + this.productServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.ProductService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.ProductService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const productServiceStubMethods = [ + 'createProduct', + 'getProduct', + 'updateProduct', + 'deleteProduct', + 'importProducts', + ]; + for (const methodName of productServiceStubMethods) { + const callPromise = this.productServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.productServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProduct( + request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProduct( + request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a {@link google.cloud.retail.v2beta.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch". + * @param {google.cloud.retail.v2beta.Product} request.product + * Required. The {@link google.cloud.retail.v2beta.Product|Product} to create. + * @param {string} request.productId + * Required. The ID to use for the + * {@link google.cloud.retail.v2beta.Product|Product}, which will become the final + * component of the {@link google.cloud.retail.v2beta.Product.name|Product.name}. + * + * If the caller does not have permission to create the + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * This field must be unique among all + * {@link google.cloud.retail.v2beta.Product|Product}s with the same + * {@link google.cloud.retail.v2beta.CreateProductRequest.parent|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2beta.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createProduct(request); + */ + createProduct( + request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.ICreateProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.ICreateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createProduct(request, options, callback); + } + getProduct( + request: protos.google.cloud.retail.v2beta.IGetProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IGetProductRequest | undefined, + {} | undefined + ] + >; + getProduct( + request: protos.google.cloud.retail.v2beta.IGetProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): void; + getProduct( + request: protos.google.cloud.retail.v2beta.IGetProductRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a {@link google.cloud.retail.v2beta.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * If the requested {@link google.cloud.retail.v2beta.Product|Product} does not + * exist, a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2beta.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getProduct(request); + */ + getProduct( + request: protos.google.cloud.retail.v2beta.IGetProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IGetProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IGetProductRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IGetProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getProduct(request, options, callback); + } + updateProduct( + request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateProduct( + request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates a {@link google.cloud.retail.v2beta.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.Product} request.product + * Required. The product to update/create. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2beta.Product|Product} to update does not + * exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.Product|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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2beta.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateProduct(request); + */ + updateProduct( + request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IUpdateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateProduct(request, options, callback); + } + deleteProduct( + request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteProduct( + request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a {@link google.cloud.retail.v2beta.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2beta.Product|Product} to delete does not + * exist, a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteProduct(request); + */ + deleteProduct( + request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteProduct(request, options, callback); + } + + importProducts( + request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProducts( + request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importProducts( + request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Bulk import of multiple {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}s to be successfully updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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. + * @param {google.cloud.retail.v2beta.ProductInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided imported 'products' to update. If + * not set, will by default update all fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importProducts(request); + * const [response] = await operation.promise(); + */ + importProducts( + request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importProducts(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importProducts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportProductsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportProductsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.ImportProductsResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importProducts, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.ImportProductsResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.productServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json new file mode 100644 index 00000000000..50b700e6528 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.ProductService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json new file mode 100644 index 00000000000..d02281cd8fb --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts new file mode 100644 index 00000000000..116724fea44 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -0,0 +1,1198 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v2beta/user_event_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './user_event_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for ingesting end user actions on the customer website. + * @class + * @memberof v2beta + */ +export class UserEventServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + userEventServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of UserEventServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof UserEventServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const purgeUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.PurgeUserEventsResponse' + ) as gax.protobuf.Type; + const purgeUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.PurgeMetadata' + ) as gax.protobuf.Type; + const importUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.ImportUserEventsResponse' + ) as gax.protobuf.Type; + const importUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.ImportMetadata' + ) as gax.protobuf.Type; + const rejoinUserEventsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.RejoinUserEventsResponse' + ) as gax.protobuf.Type; + const rejoinUserEventsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.RejoinUserEventsMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + purgeUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + purgeUserEventsResponse.decode.bind(purgeUserEventsResponse), + purgeUserEventsMetadata.decode.bind(purgeUserEventsMetadata) + ), + importUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importUserEventsResponse.decode.bind(importUserEventsResponse), + importUserEventsMetadata.decode.bind(importUserEventsMetadata) + ), + rejoinUserEvents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + rejoinUserEventsResponse.decode.bind(rejoinUserEventsResponse), + rejoinUserEventsMetadata.decode.bind(rejoinUserEventsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.UserEventService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.userEventServiceStub) { + return this.userEventServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.UserEventService. + this.userEventServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.UserEventService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.UserEventService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const userEventServiceStubMethods = [ + 'writeUserEvent', + 'collectUserEvent', + 'purgeUserEvents', + 'importUserEvents', + 'rejoinUserEvents', + ]; + for (const methodName of userEventServiceStubMethods) { + const callPromise = this.userEventServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.userEventServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + writeUserEvent( + request: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IUserEvent, + protos.google.cloud.retail.v2beta.IWriteUserEventRequest | undefined, + {} | undefined + ] + >; + writeUserEvent( + request: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IUserEvent, + | protos.google.cloud.retail.v2beta.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + writeUserEvent( + request: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IUserEvent, + | protos.google.cloud.retail.v2beta.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Writes a single user event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {google.cloud.retail.v2beta.UserEvent} request.userEvent + * Required. User event to write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2beta.UserEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.writeUserEvent(request); + */ + writeUserEvent( + request: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IUserEvent, + | protos.google.cloud.retail.v2beta.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IUserEvent, + | protos.google.cloud.retail.v2beta.IWriteUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IUserEvent, + protos.google.cloud.retail.v2beta.IWriteUserEventRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.writeUserEvent(request, options, callback); + } + collectUserEvent( + request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2beta.ICollectUserEventRequest | undefined, + {} | undefined + ] + >; + collectUserEvent( + request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2beta.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + collectUserEvent( + request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2beta.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {string} request.userEvent + * Required. URL encoded UserEvent proto with a length limit of 2,000,000 + * characters. + * @param {string} request.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. + * @param {number} request.ets + * The event timestamp in milliseconds. This prevents browser caching of + * otherwise identical get requests. The name is abbreviated to reduce the + * payload bytes. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.collectUserEvent(request); + */ + collectUserEvent( + request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2beta.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2beta.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2beta.ICollectUserEventRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.collectUserEvent(request, options, callback); + } + + purgeUserEvents( + request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeUserEvents( + request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeUserEvents( + request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the catalog under which the events are + * created. The format is + * "projects/${projectId}/locations/global/catalogs/${catalogId}" + * @param {string} request.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 + * {@link google.cloud.retail.v2beta.UserEvent.event_type|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. + * @param {boolean} request.force + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any user events. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.purgeUserEvents(request); + * const [response] = await operation.promise(); + */ + purgeUserEvents( + request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.purgeUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `purgeUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkPurgeUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkPurgeUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.PurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.PurgeMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.purgeUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.PurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.PurgeMetadata + >; + } + importUserEvents( + request: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importUserEvents( + request: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importUserEvents( + request: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. "projects/1234/locations/global/catalogs/default_catalog" + * @param {google.cloud.retail.v2beta.UserEventInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importUserEvents(request); + * const [response] = await operation.promise(); + */ + importUserEvents( + request: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.ImportUserEventsResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.ImportUserEventsResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + >; + } + rejoinUserEvents( + request: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + rejoinUserEvents( + request: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + rejoinUserEvents( + request: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * "projects/1234/locations/global/catalogs/default_catalog". + * @param {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.rejoinUserEvents(request); + * const [response] = await operation.promise(); + */ + rejoinUserEvents( + request: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.rejoinUserEvents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `rejoinUserEvents()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRejoinUserEventsProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRejoinUserEventsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.RejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.RejoinUserEventsMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.rejoinUserEvents, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.RejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.RejoinUserEventsMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.userEventServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json new file mode 100644 index 00000000000..4b5af274c74 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.UserEventService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "WriteUserEvent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CollectUserEvent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PurgeUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RejoinUserEvents": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json new file mode 100644 index 00000000000..d02281cd8fb --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata new file mode 100644 index 00000000000..cb92f150b97 --- /dev/null +++ b/packages/google-cloud-retail/synth.metadata @@ -0,0 +1,55 @@ +{ + "sources": [ + { + "git": { + "name": ".", + "remote": "sso://user/sofialeon/nodejs-retail", + "sha": "f208eeb3030d243d9a4f3cc7d02d8a2e2eaaaf5e" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "b241bbc1ad920771707fe03e4cedd4e8c492e143", + "internalRef": "350670798" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "fb53b6fb373b7c3edf4e55f3e8036bc6d73fa483" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "retail", + "apiVersion": "v2", + "language": "nodejs", + "generator": "bazel" + } + }, + { + "client": { + "source": "googleapis", + "apiName": "retail", + "apiVersion": "v2alpha", + "language": "nodejs", + "generator": "bazel" + } + }, + { + "client": { + "source": "googleapis", + "apiName": "retail", + "apiVersion": "v2beta", + "language": "nodejs", + "generator": "bazel" + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-retail/synth.py b/packages/google-cloud-retail/synth.py index 885a237f8db..503882982b9 100644 --- a/packages/google-cloud-retail/synth.py +++ b/packages/google-cloud-retail/synth.py @@ -30,7 +30,7 @@ name, version, bazel_target=f"//google/cloud/retail/{version}:retail-{version}-nodejs") - s.copy(library, excludes=[]) + s.copy(library, excludes=["package.json","linkinator.config.json", "system-test/fixtures/sample/src/index.js","system-test/fixtures/sample/src/index.ts"]) # Copy common templates common_templates = gcp.CommonTemplates() diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..78bdfc2bba8 --- /dev/null +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js @@ -0,0 +1,29 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const retail = require('@google-cloud/retail'); + +function main() { + const catalogServiceClient = new retail.CatalogServiceClient(); + const predictionServiceClient = new retail.PredictionServiceClient(); + const productServiceClient = new retail.ProductServiceClient(); + const userEventServiceClient = new retail.UserEventServiceClient(); +} + +main(); diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..e0f415ea4df --- /dev/null +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,55 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { + CatalogServiceClient, + PredictionServiceClient, + ProductServiceClient, + UserEventServiceClient, +} from '@google-cloud/retail'; + +// check that the client class type name can be used +function doStuffWithCatalogServiceClient(client: CatalogServiceClient) { + client.close(); +} +function doStuffWithPredictionServiceClient(client: PredictionServiceClient) { + client.close(); +} +function doStuffWithProductServiceClient(client: ProductServiceClient) { + client.close(); +} +function doStuffWithUserEventServiceClient(client: UserEventServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const catalogServiceClient = new CatalogServiceClient(); + doStuffWithCatalogServiceClient(catalogServiceClient); + // check that the client instance can be created + const predictionServiceClient = new PredictionServiceClient(); + doStuffWithPredictionServiceClient(predictionServiceClient); + // check that the client instance can be created + const productServiceClient = new ProductServiceClient(); + doStuffWithProductServiceClient(productServiceClient); + // check that the client instance can be created + const userEventServiceClient = new UserEventServiceClient(); + doStuffWithUserEventServiceClient(userEventServiceClient); +} + +main(); diff --git a/packages/google-cloud-retail/system-test/install.ts b/packages/google-cloud-retail/system-test/install.ts new file mode 100644 index 00000000000..d2d61c0396f --- /dev/null +++ b/packages/google-cloud-retail/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts new file mode 100644 index 00000000000..ff99a8a106f --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -0,0 +1,800 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as catalogserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.CatalogServiceClient', () => { + it('has servicePath', () => { + const servicePath = + catalogserviceModule.v2.CatalogServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + catalogserviceModule.v2.CatalogServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = catalogserviceModule.v2.CatalogServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new catalogserviceModule.v2.CatalogServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + await client.initialize(); + assert(client.catalogServiceStub); + }); + + it('has close method', () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('updateCatalog', () => { + it('invokes updateCatalog without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Catalog() + ); + client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); + const [response] = await client.updateCatalog(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCatalog without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Catalog() + ); + client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateCatalog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.ICatalog | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateCatalog with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCatalog = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateCatalog(request), expectedError); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listCatalogs', () => { + it('invokes listCatalogs without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + ]; + client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); + const [response] = await client.listCatalogs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listCatalogs without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + ]; + client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listCatalogs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.ICatalog[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listCatalogs with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCatalogs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listCatalogs(request), expectedError); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listCatalogsStream without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + ]; + client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listCatalogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.Catalog[] = []; + stream.on('data', (response: protos.google.cloud.retail.v2.Catalog) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCatalogs, request) + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listCatalogsStream with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listCatalogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.Catalog[] = []; + stream.on('data', (response: protos.google.cloud.retail.v2.Catalog) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCatalogs, request) + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCatalogs without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), + ]; + client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.retail.v2.ICatalog[] = []; + const iterable = client.listCatalogsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCatalogs with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listCatalogsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2.ICatalog[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts new file mode 100644 index 00000000000..e92d12f8ea9 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -0,0 +1,806 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as catalogserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.CatalogServiceClient', () => { + it('has servicePath', () => { + const servicePath = + catalogserviceModule.v2alpha.CatalogServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + catalogserviceModule.v2alpha.CatalogServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = catalogserviceModule.v2alpha.CatalogServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + await client.initialize(); + assert(client.catalogServiceStub); + }); + + it('has close method', () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('updateCatalog', () => { + it('invokes updateCatalog without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Catalog() + ); + client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); + const [response] = await client.updateCatalog(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCatalog without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Catalog() + ); + client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateCatalog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.ICatalog | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateCatalog with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCatalog = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateCatalog(request), expectedError); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listCatalogs', () => { + it('invokes listCatalogs without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + ]; + client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); + const [response] = await client.listCatalogs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listCatalogs without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + ]; + client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listCatalogs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.ICatalog[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listCatalogs with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCatalogs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listCatalogs(request), expectedError); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listCatalogsStream without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + ]; + client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listCatalogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Catalog) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCatalogs, request) + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listCatalogsStream with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listCatalogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Catalog) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCatalogs, request) + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCatalogs without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), + ]; + client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; + const iterable = client.listCatalogsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCatalogs with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listCatalogsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts new file mode 100644 index 00000000000..72bbb12c702 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -0,0 +1,806 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as catalogserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.CatalogServiceClient', () => { + it('has servicePath', () => { + const servicePath = + catalogserviceModule.v2beta.CatalogServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + catalogserviceModule.v2beta.CatalogServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = catalogserviceModule.v2beta.CatalogServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + await client.initialize(); + assert(client.catalogServiceStub); + }); + + it('has close method', () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('updateCatalog', () => { + it('invokes updateCatalog without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Catalog() + ); + client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); + const [response] = await client.updateCatalog(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCatalog without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Catalog() + ); + client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateCatalog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.ICatalog | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateCatalog with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCatalog = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateCatalog(request), expectedError); + assert( + (client.innerApiCalls.updateCatalog as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listCatalogs', () => { + it('invokes listCatalogs without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + ]; + client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); + const [response] = await client.listCatalogs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listCatalogs without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + ]; + client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listCatalogs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.ICatalog[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listCatalogs with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCatalogs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listCatalogs(request), expectedError); + assert( + (client.innerApiCalls.listCatalogs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listCatalogsStream without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + ]; + client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listCatalogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Catalog[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Catalog) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCatalogs, request) + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listCatalogsStream with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listCatalogsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Catalog[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Catalog) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCatalogs, request) + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCatalogs without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), + ]; + client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.retail.v2beta.ICatalog[] = []; + const iterable = client.listCatalogsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCatalogs with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListCatalogsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listCatalogsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2beta.ICatalog[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts new file mode 100644 index 00000000000..46d7609dafd --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -0,0 +1,398 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as predictionserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +describe('v2.PredictionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + predictionserviceModule.v2.PredictionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + predictionserviceModule.v2.PredictionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = predictionserviceModule.v2.PredictionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new predictionserviceModule.v2.PredictionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + await client.initialize(); + assert(client.predictionServiceStub); + }); + + it('has close method', () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('predict', () => { + it('invokes predict without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.PredictResponse() + ); + client.innerApiCalls.predict = stubSimpleCall(expectedResponse); + const [response] = await client.predict(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes predict without error using callback', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.PredictResponse() + ); + client.innerApiCalls.predict = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.predict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes predict with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.predict(request), expectedError); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts new file mode 100644 index 00000000000..d800b9a2bb3 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -0,0 +1,408 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as predictionserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +describe('v2alpha.PredictionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + predictionserviceModule.v2alpha.PredictionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + predictionserviceModule.v2alpha.PredictionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = predictionserviceModule.v2alpha.PredictionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + await client.initialize(); + assert(client.predictionServiceStub); + }); + + it('has close method', () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('predict', () => { + it('invokes predict without error', async () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PredictResponse() + ); + client.innerApiCalls.predict = stubSimpleCall(expectedResponse); + const [response] = await client.predict(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes predict without error using callback', async () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PredictResponse() + ); + client.innerApiCalls.predict = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.predict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes predict with error', async () => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.predict(request), expectedError); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2alpha.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new predictionserviceModule.v2alpha.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts new file mode 100644 index 00000000000..681fb26fbf6 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -0,0 +1,408 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as predictionserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +describe('v2beta.PredictionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + predictionserviceModule.v2beta.PredictionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + predictionserviceModule.v2beta.PredictionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = predictionserviceModule.v2beta.PredictionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + await client.initialize(); + assert(client.predictionServiceStub); + }); + + it('has close method', () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2beta.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2beta.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('predict', () => { + it('invokes predict without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PredictResponse() + ); + client.innerApiCalls.predict = stubSimpleCall(expectedResponse); + const [response] = await client.predict(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes predict without error using callback', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PredictResponse() + ); + client.innerApiCalls.predict = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.predict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes predict with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.predict(request), expectedError); + assert( + (client.innerApiCalls.predict as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts new file mode 100644 index 00000000000..dba06a83fbe --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -0,0 +1,1044 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as productserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2.ProductServiceClient', () => { + it('has servicePath', () => { + const servicePath = + productserviceModule.v2.ProductServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + productserviceModule.v2.ProductServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = productserviceModule.v2.ProductServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new productserviceModule.v2.ProductServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new productserviceModule.v2.ProductServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + await client.initialize(); + assert(client.productServiceStub); + }); + + it('has close method', () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createProduct', () => { + it('invokes createProduct without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Product() + ); + client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); + const [response] = await client.createProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createProduct without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Product() + ); + client.innerApiCalls.createProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createProduct with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createProduct(request), expectedError); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getProduct', () => { + it('invokes getProduct without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Product() + ); + client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); + const [response] = await client.getProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProduct without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Product() + ); + client.innerApiCalls.getProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getProduct with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getProduct(request), expectedError); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateProduct', () => { + it('invokes updateProduct without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Product() + ); + client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); + const [response] = await client.updateProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateProduct without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Product() + ); + client.innerApiCalls.updateProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateProduct with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateProduct(request), expectedError); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteProduct', () => { + it('invokes deleteProduct without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); + const [response] = await client.deleteProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProduct without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteProduct( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProduct with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteProduct(request), expectedError); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('importProducts', () => { + it('invokes importProducts without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importProducts = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.importProducts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importProducts without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importProducts = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importProducts( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importProducts with call error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importProducts = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importProducts(request), expectedError); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importProducts with LRO error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importProducts = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importProducts(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportProductsProgress without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportProductsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportProductsProgress with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportProductsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts new file mode 100644 index 00000000000..3f708cc3314 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -0,0 +1,1044 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as productserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2alpha.ProductServiceClient', () => { + it('has servicePath', () => { + const servicePath = + productserviceModule.v2alpha.ProductServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + productserviceModule.v2alpha.ProductServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = productserviceModule.v2alpha.ProductServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new productserviceModule.v2alpha.ProductServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + await client.initialize(); + assert(client.productServiceStub); + }); + + it('has close method', () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createProduct', () => { + it('invokes createProduct without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Product() + ); + client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); + const [response] = await client.createProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createProduct without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Product() + ); + client.innerApiCalls.createProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createProduct with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createProduct(request), expectedError); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getProduct', () => { + it('invokes getProduct without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Product() + ); + client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); + const [response] = await client.getProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProduct without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Product() + ); + client.innerApiCalls.getProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getProduct with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getProduct(request), expectedError); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateProduct', () => { + it('invokes updateProduct without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Product() + ); + client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); + const [response] = await client.updateProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateProduct without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Product() + ); + client.innerApiCalls.updateProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateProduct with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateProduct(request), expectedError); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteProduct', () => { + it('invokes deleteProduct without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); + const [response] = await client.deleteProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProduct without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteProduct( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProduct with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteProduct(request), expectedError); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('importProducts', () => { + it('invokes importProducts without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importProducts = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.importProducts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importProducts without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importProducts = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importProducts( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importProducts with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importProducts = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importProducts(request), expectedError); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importProducts with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importProducts = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importProducts(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportProductsProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportProductsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportProductsProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportProductsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts new file mode 100644 index 00000000000..6844b31681b --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -0,0 +1,1044 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as productserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2beta.ProductServiceClient', () => { + it('has servicePath', () => { + const servicePath = + productserviceModule.v2beta.ProductServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + productserviceModule.v2beta.ProductServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = productserviceModule.v2beta.ProductServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new productserviceModule.v2beta.ProductServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + await client.initialize(); + assert(client.productServiceStub); + }); + + it('has close method', () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createProduct', () => { + it('invokes createProduct without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Product() + ); + client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); + const [response] = await client.createProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createProduct without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Product() + ); + client.innerApiCalls.createProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createProduct with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createProduct(request), expectedError); + assert( + (client.innerApiCalls.createProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getProduct', () => { + it('invokes getProduct without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Product() + ); + client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); + const [response] = await client.getProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProduct without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Product() + ); + client.innerApiCalls.getProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getProduct with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getProduct(request), expectedError); + assert( + (client.innerApiCalls.getProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateProduct', () => { + it('invokes updateProduct without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Product() + ); + client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); + const [response] = await client.updateProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateProduct without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Product() + ); + client.innerApiCalls.updateProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateProduct( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IProduct | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateProduct with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateProduct(request), expectedError); + assert( + (client.innerApiCalls.updateProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteProduct', () => { + it('invokes deleteProduct without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); + const [response] = await client.deleteProduct(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProduct without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteProduct( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProduct with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProduct = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteProduct(request), expectedError); + assert( + (client.innerApiCalls.deleteProduct as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('importProducts', () => { + it('invokes importProducts without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importProducts = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.importProducts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importProducts without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importProducts = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importProducts( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importProducts with call error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importProducts = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importProducts(request), expectedError); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importProducts with LRO error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importProducts = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importProducts(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportProductsProgress without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportProductsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportProductsProgress with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportProductsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts new file mode 100644 index 00000000000..7fde3d9fa31 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -0,0 +1,1130 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as usereventserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2.UserEventServiceClient', () => { + it('has servicePath', () => { + const servicePath = + usereventserviceModule.v2.UserEventServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + usereventserviceModule.v2.UserEventServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = usereventserviceModule.v2.UserEventServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new usereventserviceModule.v2.UserEventServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + await client.initialize(); + assert(client.userEventServiceStub); + }); + + it('has close method', () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('writeUserEvent', () => { + it('invokes writeUserEvent without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.UserEvent() + ); + client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); + const [response] = await client.writeUserEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes writeUserEvent without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.UserEvent() + ); + client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.writeUserEvent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IUserEvent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes writeUserEvent with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.writeUserEvent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.writeUserEvent(request), expectedError); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('collectUserEvent', () => { + it('invokes collectUserEvent without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); + const [response] = await client.collectUserEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes collectUserEvent without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.collectUserEvent( + request, + (err?: Error | null, result?: protos.google.api.IHttpBody | null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes collectUserEvent with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.collectUserEvent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.collectUserEvent(request), expectedError); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('purgeUserEvents', () => { + it('invokes purgeUserEvents without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.purgeUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.purgeUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes purgeUserEvents with call error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.purgeUserEvents(request), expectedError); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.purgeUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkPurgeUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkPurgeUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPurgeUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkPurgeUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importUserEvents', () => { + it('invokes importUserEvents without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.importUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IImportUserEventsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importUserEvents with call error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importUserEvents(request), expectedError); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('rejoinUserEvents', () => { + it('invokes rejoinUserEvents without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.rejoinUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes rejoinUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.rejoinUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2.IRejoinUserEventsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes rejoinUserEvents with call error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.rejoinUserEvents(request), expectedError); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes rejoinUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.rejoinUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRejoinUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRejoinUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRejoinUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRejoinUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts new file mode 100644 index 00000000000..7aec2211deb --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -0,0 +1,1130 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as usereventserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2alpha.UserEventServiceClient', () => { + it('has servicePath', () => { + const servicePath = + usereventserviceModule.v2alpha.UserEventServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + usereventserviceModule.v2alpha.UserEventServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = usereventserviceModule.v2alpha.UserEventServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + await client.initialize(); + assert(client.userEventServiceStub); + }); + + it('has close method', () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('writeUserEvent', () => { + it('invokes writeUserEvent without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UserEvent() + ); + client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); + const [response] = await client.writeUserEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes writeUserEvent without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UserEvent() + ); + client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.writeUserEvent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IUserEvent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes writeUserEvent with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.writeUserEvent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.writeUserEvent(request), expectedError); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('collectUserEvent', () => { + it('invokes collectUserEvent without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); + const [response] = await client.collectUserEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes collectUserEvent without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.collectUserEvent( + request, + (err?: Error | null, result?: protos.google.api.IHttpBody | null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes collectUserEvent with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.collectUserEvent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.collectUserEvent(request), expectedError); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('purgeUserEvents', () => { + it('invokes purgeUserEvents without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.purgeUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.purgeUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes purgeUserEvents with call error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.purgeUserEvents(request), expectedError); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.purgeUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkPurgeUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkPurgeUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPurgeUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkPurgeUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importUserEvents', () => { + it('invokes importUserEvents without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.importUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IImportUserEventsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importUserEvents with call error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importUserEvents(request), expectedError); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('rejoinUserEvents', () => { + it('invokes rejoinUserEvents without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.rejoinUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes rejoinUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.rejoinUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2alpha.IRejoinUserEventsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes rejoinUserEvents with call error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.rejoinUserEvents(request), expectedError); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes rejoinUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.rejoinUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRejoinUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRejoinUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRejoinUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRejoinUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts new file mode 100644 index 00000000000..29329e9e4c4 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -0,0 +1,1130 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as usereventserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2beta.UserEventServiceClient', () => { + it('has servicePath', () => { + const servicePath = + usereventserviceModule.v2beta.UserEventServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + usereventserviceModule.v2beta.UserEventServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = usereventserviceModule.v2beta.UserEventServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + await client.initialize(); + assert(client.userEventServiceStub); + }); + + it('has close method', () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('writeUserEvent', () => { + it('invokes writeUserEvent without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UserEvent() + ); + client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); + const [response] = await client.writeUserEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes writeUserEvent without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UserEvent() + ); + client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.writeUserEvent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IUserEvent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes writeUserEvent with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.writeUserEvent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.writeUserEvent(request), expectedError); + assert( + (client.innerApiCalls.writeUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('collectUserEvent', () => { + it('invokes collectUserEvent without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); + const [response] = await client.collectUserEvent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes collectUserEvent without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.collectUserEvent( + request, + (err?: Error | null, result?: protos.google.api.IHttpBody | null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes collectUserEvent with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.collectUserEvent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.collectUserEvent(request), expectedError); + assert( + (client.innerApiCalls.collectUserEvent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('purgeUserEvents', () => { + it('invokes purgeUserEvents without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.purgeUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.purgeUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes purgeUserEvents with call error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.purgeUserEvents(request), expectedError); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.purgeUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.purgeUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkPurgeUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkPurgeUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPurgeUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkPurgeUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importUserEvents', () => { + it('invokes importUserEvents without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.importUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IImportUserEventsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importUserEvents with call error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importUserEvents(request), expectedError); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('rejoinUserEvents', () => { + it('invokes rejoinUserEvents without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.rejoinUserEvents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes rejoinUserEvents without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.rejoinUserEvents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IRejoinUserEventsResponse, + protos.google.cloud.retail.v2beta.IRejoinUserEventsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes rejoinUserEvents with call error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.rejoinUserEvents(request), expectedError); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes rejoinUserEvents with LRO error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.rejoinUserEvents(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.rejoinUserEvents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRejoinUserEventsProgress without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRejoinUserEventsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRejoinUserEventsProgress with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRejoinUserEventsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/tsconfig.json b/packages/google-cloud-retail/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-retail/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-retail/webpack.config.js b/packages/google-cloud-retail/webpack.config.js new file mode 100644 index 00000000000..4e1e2d47cfa --- /dev/null +++ b/packages/google-cloud-retail/webpack.config.js @@ -0,0 +1,64 @@ +// 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'CatalogService', + filename: './catalog-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/, + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader', + }, + ], + }, + mode: 'production', +}; From 56fa48f417457c132efc53624b735089fdb3735e Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Wed, 13 Jan 2021 10:49:15 -0800 Subject: [PATCH 003/103] feat: add initial samples (#2) * feat: add samples and tests --- .../google-cloud-retail/.repo-metadata.json | 13 ++ packages/google-cloud-retail/CONTRIBUTING.md | 6 +- packages/google-cloud-retail/README.md | 159 +++++++++++++++++- .../linkinator.config.json | 2 +- .../google-cloud-retail/samples/README.md | 50 ++++++ .../google-cloud-retail/samples/quickstart.js | 29 ++-- .../samples/test/quickstart.js | 15 +- packages/google-cloud-retail/synth.metadata | 10 +- packages/google-cloud-retail/synth.py | 2 +- 9 files changed, 248 insertions(+), 38 deletions(-) create mode 100644 packages/google-cloud-retail/.repo-metadata.json create mode 100644 packages/google-cloud-retail/samples/README.md diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json new file mode 100644 index 00000000000..cf86785c85a --- /dev/null +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "retail", + "name_pretty": "Retail API", + "product_documentation": "https://cloud.google.com/recommendations/", + "client_documentation": "https://googleapis.dev/nodejs/retail/latest/", + "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues", + "release_level": "beta", + "language": "nodejs", + "repo": "googleapis/nodejs-retail", + "distribution_name": "@google-cloud/retail", + "api_id": "retail.googleapis.com", + "requires_billing": true + } \ No newline at end of file diff --git a/packages/google-cloud-retail/CONTRIBUTING.md b/packages/google-cloud-retail/CONTRIBUTING.md index 72c44cada5e..0e48f15b5f0 100644 --- a/packages/google-cloud-retail/CONTRIBUTING.md +++ b/packages/google-cloud-retail/CONTRIBUTING.md @@ -39,7 +39,9 @@ accept your pull requests. ### Before you begin -1. [Select or create a Cloud Platform project][projects]. +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Retail API API][enable_api]. 1. [Set up authentication with a service account][auth] so you can access the API from your local workstation. @@ -70,5 +72,5 @@ accept your pull requests. [setup]: https://cloud.google.com/nodejs/docs/setup [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing - +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=retail.googleapis.com [auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index 822c4573817..0401f5d8fb5 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -1 +1,158 @@ -Retail: Nodejs Client +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Retail API: Node.js Client](https://github.com/googleapis/nodejs-retail) + +[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![npm version](https://img.shields.io/npm/v/@google-cloud/retail.svg)](https://www.npmjs.org/package/@google-cloud/retail) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-retail/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-retail) + + + + +Retail client for Node.js + + +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/nodejs-retail/blob/master/CHANGELOG.md). + +* [Retail API Node.js Client API Reference][client-docs] +* [Retail API Documentation][product-docs] +* [github.com/googleapis/nodejs-retail](https://github.com/googleapis/nodejs-retail) + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + * [Using the client library](#using-the-client-library) +* [Samples](#samples) +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Retail API API][enable_api]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + +### Installing the client library + +```bash +npm install @google-cloud/retail +``` + + +### Using the client library + +```javascript + +// Imports the Google Cloud client library +const {CatalogServiceClient} = require('@google-cloud/retail'); + +// TODO(developer): uncomment these variables with your information +// const projectId = 'my-project' +// const location = 'global' + +// Creates a client +const client = new CatalogServiceClient(); + +async function listCatalogs() { + const catalogs = await client.listCatalogs({ + parent: `projects/${projectId}/locations/${location}`, + }); + console.info(catalogs); +} +listCatalogs(); + +``` + + + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-retail/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Quickstart | [source code](https://github.com/googleapis/nodejs-retail/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | + + + +The [Retail API Node.js Client API Reference][client-docs] documentation +also contains samples. + +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. + +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. + +_Legacy Node.js versions are supported as a best effort:_ + +* Legacy versions will not be tested in continuous integration. +* Some security patches may not be able to be backported. +* Dependencies will not be kept up-to-date, and features will not be backported. + +#### Legacy tags available + +* `legacy-8`: install client libraries from this dist-tag for versions + compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + +This library is considered to be in **beta**. This means it is expected to be +mostly stable while we work toward a general availability release; however, +complete stability is not guaranteed. We will address issues and requests +against beta libraries with a high priority. + + + + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-retail/blob/master/CONTRIBUTING.md). + +Please note that this `README.md`, the `samples/README.md`, +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) +are generated from a central template. To edit one of these files, make an edit +to its template in this +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/nodejs-retail/blob/master/LICENSE) + +[client-docs]: https://googleapis.dev/nodejs/retail/latest/ +[product-docs]: https://cloud.google.com/recommendations/ +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=retail.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-retail/linkinator.config.json b/packages/google-cloud-retail/linkinator.config.json index 0947c2e0e5b..bd60574617a 100644 --- a/packages/google-cloud-retail/linkinator.config.json +++ b/packages/google-cloud-retail/linkinator.config.json @@ -1 +1 @@ -{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io"],"silent":true,"concurrency":10} \ No newline at end of file +{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io", "https://googleapis.dev/nodejs/retail/latest/", "https://github.com/googleapis/nodejs-retail/blob/master/CHANGELOG.md"],"silent":true,"concurrency":10} \ No newline at end of file diff --git a/packages/google-cloud-retail/samples/README.md b/packages/google-cloud-retail/samples/README.md new file mode 100644 index 00000000000..aef36e146ed --- /dev/null +++ b/packages/google-cloud-retail/samples/README.md @@ -0,0 +1,50 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Retail API: Node.js Samples](https://github.com/googleapis/nodejs-retail) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Quickstart](#quickstart) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-retail#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-retail/blob/master/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node samples/quickstart.js` + + + + + + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/recommendations/ diff --git a/packages/google-cloud-retail/samples/quickstart.js b/packages/google-cloud-retail/samples/quickstart.js index 04cce91ff84..e8b65192f32 100644 --- a/packages/google-cloud-retail/samples/quickstart.js +++ b/packages/google-cloud-retail/samples/quickstart.js @@ -13,31 +13,26 @@ 'use strict'; -async function main() { +async function main(projectId, location) { // [START nodejs_retail_quickstart] - // Imports the Google Cloud client library - // remove this line after package is released - // eslint-disable-next-line node/no-missing-require - const {UserEventServiceClient} = require('@google-cloud/retail'); + // Imports the Google Cloud client library + const {CatalogServiceClient} = require('@google-cloud/retail'); - // TODO(developer): replace with your prefered project ID. + // TODO(developer): uncomment these variables with your information // const projectId = 'my-project' + // const location = 'global' // Creates a client - // eslint-disable-next-line no-unused-vars - const client = new {UserEventServiceClient}(); + const client = new CatalogServiceClient(); - //TODO(library generator): write the actual function you will be testing - async function doSomething() { - console.log( - 'Developer! Change this code so that it shows how to use the library! See comments below on structure.' - ); - // const [thing] = await client.methodName({ - // }); - // console.info(thing); + async function listCatalogs() { + const catalogs = await client.listCatalogs({ + parent: `projects/${projectId}/locations/${location}`, + }); + console.info(catalogs); } - doSomething(); + listCatalogs(); // [END nodejs_retail_quickstart] } diff --git a/packages/google-cloud-retail/samples/test/quickstart.js b/packages/google-cloud-retail/samples/test/quickstart.js index 2d076f85c73..5f93004506a 100644 --- a/packages/google-cloud-retail/samples/test/quickstart.js +++ b/packages/google-cloud-retail/samples/test/quickstart.js @@ -20,31 +20,24 @@ const path = require('path'); const cp = require('child_process'); const {before, describe, it} = require('mocha'); -// eslint-disable-next-line node/no-missing-require -const {UserEventServiceClient} = require('@google-cloud/retail'); -// eslint-disable-next-line no-unused-vars, node/no-missing-require +const {CatalogServiceClient} = require('@google-cloud/retail'); const {assert} = require('chai'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); -const client = new {UserEventServiceClient}(); +const client = new CatalogServiceClient(); describe('Quickstart', () => { - //TODO: remove this if not using the projectId - // eslint-disable-next-line no-unused-vars let projectId; before(async () => { - // eslint-disable-next-line no-unused-vars projectId = await client.getProjectId(); }); it('should run quickstart', async () => { - //TODO: remove this disability - // eslint-disable-next-line no-unused-vars - const stdout = execSync('node ./quickstart.js', {cwd}); - //assert(stdout, stdout !== null); + const stdout = execSync(`node ./quickstart.js ${projectId} global`, {cwd}); + assert.match(stdout, /default_catalog/); }); }); diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata index cb92f150b97..1e5f5c15891 100644 --- a/packages/google-cloud-retail/synth.metadata +++ b/packages/google-cloud-retail/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "sso://user/sofialeon/nodejs-retail", - "sha": "f208eeb3030d243d9a4f3cc7d02d8a2e2eaaaf5e" + "remote": "git@github.com:googleapis/nodejs-retail.git", + "sha": "718b2af37036eb9c54428282c8184dca502b4518" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "b241bbc1ad920771707fe03e4cedd4e8c492e143", - "internalRef": "350670798" + "sha": "463702142d32ffd81db5d3dbcc9f7986e1689690", + "internalRef": "351489155" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "fb53b6fb373b7c3edf4e55f3e8036bc6d73fa483" + "sha": "16ec872dd898d7de6e1822badfac32484b5d9031" } } ], diff --git a/packages/google-cloud-retail/synth.py b/packages/google-cloud-retail/synth.py index 503882982b9..732e0d2d7e0 100644 --- a/packages/google-cloud-retail/synth.py +++ b/packages/google-cloud-retail/synth.py @@ -30,7 +30,7 @@ name, version, bazel_target=f"//google/cloud/retail/{version}:retail-{version}-nodejs") - s.copy(library, excludes=["package.json","linkinator.config.json", "system-test/fixtures/sample/src/index.js","system-test/fixtures/sample/src/index.ts"]) + s.copy(library, excludes=["package.json","README.md"]) # Copy common templates common_templates = gcp.CommonTemplates() From c8232d5d52f75d87c067fa72b495362c074fab80 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 13 Jan 2021 15:02:12 -0800 Subject: [PATCH 004/103] chore: release 1.0.0 (#1) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 13 +++++++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-retail/CHANGELOG.md diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md new file mode 100644 index 00000000000..7343541e5e3 --- /dev/null +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +## 1.0.0 (2021-01-13) + + +### ⚠ BREAKING CHANGES + +* initial stub of library + +### Features + +* add initial samples ([#2](https://www.github.com/googleapis/nodejs-retail/issues/2)) ([8a64439](https://www.github.com/googleapis/nodejs-retail/commit/8a644390cc834141304d8903a0ab9da344221412)) +* initial stub of library ([82b5f8d](https://www.github.com/googleapis/nodejs-retail/commit/82b5f8d167189dd9eab0ff6209878a727014f0f7)) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 44475e4ec7a..0c865d3f12f 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "0.1.0", + "version": "1.0.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index e01267ae6c0..bbee8126c66 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^0.1.0" + "@google-cloud/retail": "^1.0.0" }, "devDependencies": { "c8": "^7.1.0", From 2ef9b118ec9521a5bba906c4d181d9e8cec8cb86 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 6 Feb 2021 08:08:01 -0800 Subject: [PATCH 005/103] chore: update package name, build config, protos (#14) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * docs: Put resource paths in code spans and use absolute URLs PiperOrigin-RevId: 352807727 Source-Author: Google APIs Source-Date: Wed Jan 20 09:24:51 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: dc9821e4005ff8fecc3bfccae1c61b5815cdf9d3 Source-Link: https://github.com/googleapis/googleapis/commit/dc9821e4005ff8fecc3bfccae1c61b5815cdf9d3 * build(node): add package-name for npm PiperOrigin-RevId: 355707039 Source-Author: Google APIs Source-Date: Thu Feb 4 14:04:01 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: d5259926ab0cc4b7d4c195b38a8c9ddceee005a1 Source-Link: https://github.com/googleapis/googleapis/commit/d5259926ab0cc4b7d4c195b38a8c9ddceee005a1 --- packages/google-cloud-retail/.jsdoc.js | 2 +- .../google-cloud-retail/linkinator.config.json | 11 ++++++++++- .../google/cloud/retail/v2/import_config.proto | 15 ++++++++------- .../protos/google/cloud/retail/v2/product.proto | 4 ++-- .../google/cloud/retail/v2/product_service.proto | 6 +++--- .../cloud/retail/v2/user_event_service.proto | 6 +++--- packages/google-cloud-retail/protos/protos.d.ts | 3 ++- packages/google-cloud-retail/protos/protos.js | 7 +++++++ packages/google-cloud-retail/protos/protos.json | 3 ++- .../src/v2/gapic_metadata.json | 2 +- .../src/v2/product_service_client.ts | 8 ++++---- .../src/v2/user_event_service_client.ts | 8 ++++---- .../src/v2alpha/gapic_metadata.json | 2 +- .../src/v2beta/gapic_metadata.json | 2 +- packages/google-cloud-retail/synth.metadata | 8 ++++---- 15 files changed, 53 insertions(+), 34 deletions(-) diff --git a/packages/google-cloud-retail/.jsdoc.js b/packages/google-cloud-retail/.jsdoc.js index 3e02f383e17..65875741d0a 100644 --- a/packages/google-cloud-retail/.jsdoc.js +++ b/packages/google-cloud-retail/.jsdoc.js @@ -43,7 +43,7 @@ module.exports = { copyright: 'Copyright 2021 Google LLC', includeDate: false, sourceFiles: false, - systemName: 'retail', + systemName: '@google-cloud/retail', theme: 'lumen', default: { outputSourceFiles: false diff --git a/packages/google-cloud-retail/linkinator.config.json b/packages/google-cloud-retail/linkinator.config.json index bd60574617a..29a223b6db6 100644 --- a/packages/google-cloud-retail/linkinator.config.json +++ b/packages/google-cloud-retail/linkinator.config.json @@ -1 +1,10 @@ -{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io", "https://googleapis.dev/nodejs/retail/latest/", "https://github.com/googleapis/nodejs-retail/blob/master/CHANGELOG.md"],"silent":true,"concurrency":10} \ No newline at end of file +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index cece6d5d2ec..3d4c26867f2 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -38,10 +38,11 @@ option ruby_package = "Google::Cloud::Retail::V2"; 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 + // `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) + // [Importing product + // information](https://cloud.google.com/recommendations-ai/docs/upload-catalog) // for the expected file format and setup instructions. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; @@ -53,7 +54,7 @@ message GcsSource { // 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). + // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). // // Supported values for user events imports: // @@ -92,7 +93,7 @@ message BigQuerySource { // 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). + // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). // // Supported values for user events imports: // @@ -132,7 +133,7 @@ message ImportErrorsConfig { // Request message for Import methods. message ImportProductsRequest { // Required. - // "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + // `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. @@ -151,7 +152,7 @@ message ImportProductsRequest { // Request message for the ImportUserEvents request. message ImportUserEventsRequest { - // Required. "projects/1234/locations/global/catalogs/default_catalog" + // Required. `projects/1234/locations/global/catalogs/default_catalog` string parent = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The desired input location of the data. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 0d2cece6a56..d93b0717231 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -101,7 +101,7 @@ message Product { } // Immutable. Full resource name of the product, such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id". + // `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]; @@ -110,7 +110,7 @@ message Product { // 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". + // `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. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index 2c659064eb3..b4130502352 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -100,7 +100,7 @@ service ProductService { // Request message for [CreateProduct][] method. message CreateProductRequest { // Required. The parent catalog resource name, such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch". + // `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" } @@ -131,7 +131,7 @@ message CreateProductRequest { 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". + // `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 @@ -171,7 +171,7 @@ message UpdateProductRequest { 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". + // `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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto index a73b63e1f7b..4dbd1dc7f11 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto @@ -117,7 +117,7 @@ service UserEventService { // Request message for WriteUserEvent method. message WriteUserEventRequest { // Required. The parent catalog resource name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `projects/1234/locations/global/catalogs/default_catalog`. string parent = 1 [(google.api.field_behavior) = REQUIRED]; // Required. User event to write. @@ -127,7 +127,7 @@ message WriteUserEventRequest { // Request message for CollectUserEvent method. message CollectUserEventRequest { // Required. The parent catalog name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `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 @@ -168,7 +168,7 @@ message RejoinUserEventsRequest { } // Required. The parent catalog resource name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `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 diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index aea15df9967..da9cee99d27 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -14291,7 +14291,8 @@ export namespace google { REQUIRED = 2, OUTPUT_ONLY = 3, INPUT_ONLY = 4, - IMMUTABLE = 5 + IMMUTABLE = 5, + UNORDERED_LIST = 6 } /** Properties of a ResourceDescriptor. */ diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 08ca231f374..7545289e638 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -34610,6 +34610,7 @@ * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value * @property {number} INPUT_ONLY=4 INPUT_ONLY value * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -34619,6 +34620,7 @@ values[valuesById[3] = "OUTPUT_ONLY"] = 3; values[valuesById[4] = "INPUT_ONLY"] = 4; values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; return values; })(); @@ -41049,6 +41051,7 @@ case 3: case 4: case 5: + case 6: break; } } @@ -41149,6 +41152,10 @@ case 5: message[".google.api.fieldBehavior"][i] = 5; break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; } } if (object[".google.api.resourceReference"] != null) { diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index e571c8f0a6b..3b3156325c9 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -3720,7 +3720,8 @@ "REQUIRED": 2, "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, - "IMMUTABLE": 5 + "IMMUTABLE": 5, + "UNORDERED_LIST": 6 } }, "resourceReference": { diff --git a/packages/google-cloud-retail/src/v2/gapic_metadata.json b/packages/google-cloud-retail/src/v2/gapic_metadata.json index 07e3d21abf3..14e6414a2a9 100644 --- a/packages/google-cloud-retail/src/v2/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2/gapic_metadata.json @@ -3,7 +3,7 @@ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", "language": "typescript", "protoPackage": "google.cloud.retail.v2", - "libraryPackage": "retail", + "libraryPackage": "@google-cloud/retail", "services": { "CatalogService": { "clients": { diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 0a866861e8b..02eb955de08 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -373,7 +373,7 @@ export class ProductServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. * @param {google.cloud.retail.v2.Product} request.product * Required. The {@link google.cloud.retail.v2.Product|Product} to create. * @param {string} request.productId @@ -479,7 +479,7 @@ export class ProductServiceClient { * @param {string} request.name * Required. Full resource name of {@link google.cloud.retail.v2.Product|Product}, * such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to access the * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it @@ -673,7 +673,7 @@ export class ProductServiceClient { * @param {string} request.name * Required. Full resource name of {@link google.cloud.retail.v2.Product|Product}, * such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to delete the * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it @@ -783,7 +783,7 @@ export class ProductServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. - * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + * `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. diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 48cbb2518c0..c104d166949 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -391,7 +391,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {google.cloud.retail.v2.UserEvent} request.userEvent * Required. User event to write. * @param {object} [options] @@ -484,7 +484,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {string} request.userEvent * Required. URL encoded UserEvent proto with a length limit of 2,000,000 * characters. @@ -773,7 +773,7 @@ export class UserEventServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. "projects/1234/locations/global/catalogs/default_catalog" + * Required. `projects/1234/locations/global/catalogs/default_catalog` * @param {google.cloud.retail.v2.UserEventInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig @@ -927,7 +927,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} request.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 diff --git a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json index efd83677449..2106f3f9952 100644 --- a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json @@ -3,7 +3,7 @@ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", "language": "typescript", "protoPackage": "google.cloud.retail.v2alpha", - "libraryPackage": "retail", + "libraryPackage": "@google-cloud/retail", "services": { "CatalogService": { "clients": { diff --git a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json index 75610a1f22a..a3b0a9c8a80 100644 --- a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json @@ -3,7 +3,7 @@ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", "language": "typescript", "protoPackage": "google.cloud.retail.v2beta", - "libraryPackage": "retail", + "libraryPackage": "@google-cloud/retail", "services": { "CatalogService": { "clients": { diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata index 1e5f5c15891..b7f55005c40 100644 --- a/packages/google-cloud-retail/synth.metadata +++ b/packages/google-cloud-retail/synth.metadata @@ -3,16 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-retail.git", - "sha": "718b2af37036eb9c54428282c8184dca502b4518" + "remote": "https://github.com/googleapis/nodejs-retail.git", + "sha": "592ba421438b6bae9dd04d58670b97c6a0d62b17" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "463702142d32ffd81db5d3dbcc9f7986e1689690", - "internalRef": "351489155" + "sha": "d5259926ab0cc4b7d4c195b38a8c9ddceee005a1", + "internalRef": "355707039" } }, { From fac314b61047f8f7a64c5458585e0639b0193420 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 7 Feb 2021 06:17:31 -0800 Subject: [PATCH 006/103] refactor(nodejs): move build cop to flakybot (#16) Source-Author: Benjamin E. Coe Source-Date: Tue Jan 26 16:48:20 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 57c23fa5705499a4181095ced81f0ee0933b64f6 Source-Link: https://github.com/googleapis/synthtool/commit/57c23fa5705499a4181095ced81f0ee0933b64f6 --- packages/google-cloud-retail/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata index b7f55005c40..c722c2477d4 100644 --- a/packages/google-cloud-retail/synth.metadata +++ b/packages/google-cloud-retail/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-retail.git", - "sha": "592ba421438b6bae9dd04d58670b97c6a0d62b17" + "sha": "9ea6f9b76989c0b6d15c4cdf9dcf115a97829153" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "16ec872dd898d7de6e1822badfac32484b5d9031" + "sha": "57c23fa5705499a4181095ced81f0ee0933b64f6" } } ], From 0671bff72bc011753ab53e1a06277d80560cd9cb Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 1 Mar 2021 16:20:17 -0800 Subject: [PATCH 007/103] feat(docs): promote to ga (#18) * feat(docs): promote to ga * chore: address code review --- packages/google-cloud-retail/.repo-metadata.json | 4 ++-- packages/google-cloud-retail/README.md | 11 ++++++----- packages/google-cloud-retail/synth.metadata | 15 ++++----------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json index cf86785c85a..0552dbdb30b 100644 --- a/packages/google-cloud-retail/.repo-metadata.json +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -4,10 +4,10 @@ "product_documentation": "https://cloud.google.com/recommendations/", "client_documentation": "https://googleapis.dev/nodejs/retail/latest/", "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues", - "release_level": "beta", + "release_level": "ga", "language": "nodejs", "repo": "googleapis/nodejs-retail", "distribution_name": "@google-cloud/retail", "api_id": "retail.googleapis.com", "requires_billing": true - } \ No newline at end of file + } diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index 0401f5d8fb5..eb92625d433 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -4,7 +4,7 @@ # [Retail API: Node.js Client](https://github.com/googleapis/nodejs-retail) -[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/retail.svg)](https://www.npmjs.org/package/@google-cloud/retail) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-retail/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-retail) @@ -120,11 +120,12 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). +This library is considered to be **General Availability (GA)**. This means it +is stable; the code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **GA** libraries +are addressed with the highest priority. -This library is considered to be in **beta**. This means it is expected to be -mostly stable while we work toward a general availability release; however, -complete stability is not guaranteed. We will address issues and requests -against beta libraries with a high priority. diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata index c722c2477d4..2fc19322cc7 100644 --- a/packages/google-cloud-retail/synth.metadata +++ b/packages/google-cloud-retail/synth.metadata @@ -4,22 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-retail.git", - "sha": "9ea6f9b76989c0b6d15c4cdf9dcf115a97829153" + "sha": "800cd46ddc56ef33fec7ad656cd7558fd23fbcc1" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d5259926ab0cc4b7d4c195b38a8c9ddceee005a1", - "internalRef": "355707039" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "57c23fa5705499a4181095ced81f0ee0933b64f6" + "sha": "7f8b19bd26b01ddf0cdb00a61dcf90b2b8179955", + "internalRef": "360255957" } } ], @@ -52,4 +45,4 @@ } } ] -} \ No newline at end of file +} From 881b625971f4eb17e239110fff4eb3e65e517e45 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:42:47 -0800 Subject: [PATCH 008/103] chore: release 1.1.0 (#19) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 7343541e5e3..d23218d7a19 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.1.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.0.0...v1.1.0) (2021-03-02) + + +### Features + +* **docs:** promote to ga ([#18](https://www.github.com/googleapis/nodejs-retail/issues/18)) ([e54b324](https://www.github.com/googleapis/nodejs-retail/commit/e54b32404d2de0cb6b460e9ca0cada6bd0e5b856)) + ## 1.0.0 (2021-01-13) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 0c865d3f12f..1ea4bfb1ef1 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.0.0", + "version": "1.1.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index bbee8126c66..18be1c5089c 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.0.0" + "@google-cloud/retail": "^1.1.0" }, "devDependencies": { "c8": "^7.1.0", From 78943e353efc5fedb5f1d6a9bd87fb3458f736ec Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 7 Mar 2021 09:02:06 -0800 Subject: [PATCH 009/103] build: update gapic-generator-typescript to v1.2.10. (#20) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/cb5a7bf7-f080-4698-bd24-ff5880d64fc8/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 361273630 Source-Link: https://github.com/googleapis/googleapis/commit/5477122b3e8037a1dc5bc920536158edbd151dc4 --- packages/google-cloud-retail/synth.metadata | 15 +++++++++++---- packages/google-cloud-retail/webpack.config.js | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata index 2fc19322cc7..89b863610a2 100644 --- a/packages/google-cloud-retail/synth.metadata +++ b/packages/google-cloud-retail/synth.metadata @@ -4,15 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-retail.git", - "sha": "800cd46ddc56ef33fec7ad656cd7558fd23fbcc1" + "sha": "9ee09f8f5856eeb8e5feb1c73d91c4c96702a639" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "7f8b19bd26b01ddf0cdb00a61dcf90b2b8179955", - "internalRef": "360255957" + "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", + "internalRef": "361273630" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "9583f62749edab8e1a5ccd613fe59cf553c189a1" } } ], @@ -45,4 +52,4 @@ } } ] -} +} \ No newline at end of file diff --git a/packages/google-cloud-retail/webpack.config.js b/packages/google-cloud-retail/webpack.config.js index 4e1e2d47cfa..4ac1ab4448f 100644 --- a/packages/google-cloud-retail/webpack.config.js +++ b/packages/google-cloud-retail/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 86ea366846609cc33a25408bb47be953af3ff780 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Thu, 18 Mar 2021 15:45:07 -0700 Subject: [PATCH 010/103] chore: migrate to owl bot (#21) --- .../google-cloud-retail/.github/.OwlBot.yaml | 23 ++++++++ .../google-cloud-retail/.repo-metadata.json | 25 +++++---- packages/google-cloud-retail/synth.metadata | 55 ------------------- packages/google-cloud-retail/synth.py | 41 -------------- 4 files changed, 36 insertions(+), 108 deletions(-) create mode 100644 packages/google-cloud-retail/.github/.OwlBot.yaml delete mode 100644 packages/google-cloud-retail/synth.metadata delete mode 100644 packages/google-cloud-retail/synth.py diff --git a/packages/google-cloud-retail/.github/.OwlBot.yaml b/packages/google-cloud-retail/.github/.OwlBot.yaml new file mode 100644 index 00000000000..d47a2000f2b --- /dev/null +++ b/packages/google-cloud-retail/.github/.OwlBot.yaml @@ -0,0 +1,23 @@ +# Copyright 2021 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. +docker: + image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/retail/(.*)/.*-nodejs/(.*) + dest: /owl-bot-staging/$1/$2 + diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json index 0552dbdb30b..380ed2c6f0a 100644 --- a/packages/google-cloud-retail/.repo-metadata.json +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -1,13 +1,14 @@ { - "name": "retail", - "name_pretty": "Retail API", - "product_documentation": "https://cloud.google.com/recommendations/", - "client_documentation": "https://googleapis.dev/nodejs/retail/latest/", - "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues", - "release_level": "ga", - "language": "nodejs", - "repo": "googleapis/nodejs-retail", - "distribution_name": "@google-cloud/retail", - "api_id": "retail.googleapis.com", - "requires_billing": true - } + "client_documentation": "https://googleapis.dev/nodejs/retail/latest/", + "api_id": "retail.googleapis.com", + "distribution_name": "@google-cloud/retail", + "release_level": "ga", + "default_version": "v2beta", + "language": "nodejs", + "name_pretty": "Retail API", + "repo": "googleapis/nodejs-retail", + "product_documentation": "https://cloud.google.com/recommendations/", + "requires_billing": true, + "name": "retail", + "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues" +} diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata deleted file mode 100644 index 89b863610a2..00000000000 --- a/packages/google-cloud-retail/synth.metadata +++ /dev/null @@ -1,55 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/nodejs-retail.git", - "sha": "9ee09f8f5856eeb8e5feb1c73d91c4c96702a639" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", - "internalRef": "361273630" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "9583f62749edab8e1a5ccd613fe59cf553c189a1" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "retail", - "apiVersion": "v2", - "language": "nodejs", - "generator": "bazel" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "retail", - "apiVersion": "v2alpha", - "language": "nodejs", - "generator": "bazel" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "retail", - "apiVersion": "v2beta", - "language": "nodejs", - "generator": "bazel" - } - } - ] -} \ No newline at end of file diff --git a/packages/google-cloud-retail/synth.py b/packages/google-cloud-retail/synth.py deleted file mode 100644 index 732e0d2d7e0..00000000000 --- a/packages/google-cloud-retail/synth.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.node as node -import subprocess -import logging - -logging.basicConfig(level=logging.DEBUG) - -# run the gapic generator -gapic = gcp.GAPICBazel() -versions = ["v2","v2alpha","v2beta"] -name = 'retail' -for version in versions: - library = gapic.node_library( - name, - version, - bazel_target=f"//google/cloud/retail/{version}:retail-{version}-nodejs") - s.copy(library, excludes=["package.json","README.md"]) - -# Copy common templates -common_templates = gcp.CommonTemplates() -templates = common_templates.node_library( - source_location='build/src', versions=["v2","v2alpha","v2beta"], default_version="v2beta") -s.copy(templates, excludes=[]) - -node.postprocess_gapic_library() From 0399e273cd291d4ce3c6931f90e99f5a31c9c8d6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 23 Mar 2021 17:50:32 +0100 Subject: [PATCH 011/103] chore(deps): update dependency sinon to v10 (#28) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^9.2.1` -> `^10.0.0`](https://renovatebot.com/diffs/npm/sinon/9.2.4/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/compatibility-slim/9.2.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/confidence-slim/9.2.4)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v10.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1000--2021-03-22) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v9.2.4...v10.0.0) ================== - Upgrade nise to 4.1.0 - Use [@​sinonjs/eslint-config](https://togithub.com/sinonjs/eslint-config)[@​4](https://togithub.com/4) => Adopts ES2017 => Drops support for IE 11, Legacy Edge and legacy Safari
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 1ea4bfb1ef1..92462cf7403 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -57,7 +57,7 @@ "mocha": "^8.2.1", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", - "sinon": "^9.2.1", + "sinon": "^10.0.0", "ts-loader": "^8.0.11", "typescript": "^4.1.2", "webpack": "^5.9.0", From c63c668daf8acaf9e65e18d27bc74a7d7526ba00 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Apr 2021 23:54:03 +0200 Subject: [PATCH 012/103] chore(deps): update dependency @types/sinon to v10 (#39) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^9.0.9` -> `^10.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/9.0.11/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/compatibility-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/confidence-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 92462cf7403..34439bfa9db 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -47,7 +47,7 @@ "devDependencies": { "@types/mocha": "^8.0.4", "@types/node": "^14.14.10", - "@types/sinon": "^9.0.9", + "@types/sinon": "^10.0.0", "c8": "^7.3.5", "gts": "^3.0.3", "jsdoc": "^3.6.6", From 29c6922410ebb6395f9cff9b6815d48f94ab3801 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 20 Apr 2021 00:56:36 +0200 Subject: [PATCH 013/103] chore(deps): update dependency ts-loader to v9 (#43) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ts-loader](https://togithub.com/TypeStrong/ts-loader) | [`^8.0.11` -> `^9.0.0`](https://renovatebot.com/diffs/npm/ts-loader/8.1.0/9.0.0) | [![age](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/compatibility-slim/8.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/confidence-slim/8.1.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
TypeStrong/ts-loader ### [`v9.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v900) [Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v8.1.0...v9.0.0) Breaking changes: - minimum webpack version: 5 - minimum node version: 12 Changes: - [webpack 5 migration](https://togithub.com/TypeStrong/ts-loader/pull/1251) - thanks [@​johnnyreilly](https://togithub.com/johnnyreilly), [@​jonwallsten](https://togithub.com/jonwallsten), [@​sokra](https://togithub.com/sokra), [@​appzuka](https://togithub.com/appzuka), [@​alexander-akait](https://togithub.com/alexander-akait)
--- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 34439bfa9db..2ec3da894c6 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -58,7 +58,7 @@ "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", "sinon": "^10.0.0", - "ts-loader": "^8.0.11", + "ts-loader": "^9.0.0", "typescript": "^4.1.2", "webpack": "^5.9.0", "webpack-cli": "^4.2.0" From 38b6f53240d110e4fe6c7aa77bda455a450aa27d Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 6 May 2021 17:52:37 -0700 Subject: [PATCH 014/103] fix(deps): require google-gax v2.12.0 (#47) --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 2ec3da894c6..0136b6892a1 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,7 +42,7 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^2.9.2" + "google-gax": "^2.12.0" }, "devDependencies": { "@types/mocha": "^8.0.4", From 9ad54c494e685f5f96e3c7bd229c899505ba856f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 17:02:10 +0000 Subject: [PATCH 015/103] chore: new owl bot post processor docker image (#49) gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f --- .../google-cloud-retail/protos/protos.d.ts | 24 +++---- packages/google-cloud-retail/protos/protos.js | 48 ++++++------- .../src/v2/catalog_service_client.ts | 53 +++++++------- .../src/v2/prediction_service_client.ts | 24 +++---- .../src/v2/product_service_client.ts | 60 ++++++++-------- .../src/v2/user_event_service_client.ts | 60 ++++++++-------- .../src/v2alpha/catalog_service_client.ts | 53 +++++++------- .../src/v2alpha/prediction_service_client.ts | 24 +++---- .../src/v2alpha/product_service_client.ts | 60 ++++++++-------- .../src/v2alpha/user_event_service_client.ts | 60 ++++++++-------- .../src/v2beta/catalog_service_client.ts | 53 +++++++------- .../src/v2beta/prediction_service_client.ts | 24 +++---- .../src/v2beta/product_service_client.ts | 60 ++++++++-------- .../src/v2beta/user_event_service_client.ts | 60 ++++++++-------- .../test/gapic_catalog_service_v2.ts | 71 ++++++++----------- .../test/gapic_catalog_service_v2alpha.ts | 71 ++++++++----------- .../test/gapic_catalog_service_v2beta.ts | 71 ++++++++----------- .../test/gapic_prediction_service_v2.ts | 12 ++-- .../test/gapic_prediction_service_v2alpha.ts | 50 ++++++------- .../test/gapic_prediction_service_v2beta.ts | 12 ++-- .../test/gapic_product_service_v2.ts | 37 ++++------ .../test/gapic_product_service_v2alpha.ts | 37 ++++------ .../test/gapic_product_service_v2beta.ts | 37 ++++------ .../test/gapic_user_event_service_v2.ts | 47 +++++------- .../test/gapic_user_event_service_v2alpha.ts | 47 +++++------- .../test/gapic_user_event_service_v2beta.ts | 47 +++++------- 26 files changed, 542 insertions(+), 660 deletions(-) diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index da9cee99d27..113813bb115 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -1405,7 +1405,7 @@ export namespace google { constructor(properties?: google.cloud.retail.v2.IImportErrorsConfig); /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix: string; + public gcsPrefix?: (string|null); /** ImportErrorsConfig destination. */ public destination?: "gcsPrefix"; @@ -6044,7 +6044,7 @@ export namespace google { constructor(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig); /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix: string; + public gcsPrefix?: (string|null); /** ImportErrorsConfig destination. */ public destination?: "gcsPrefix"; @@ -10683,7 +10683,7 @@ export namespace google { constructor(properties?: google.cloud.retail.v2beta.IImportErrorsConfig); /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix: string; + public gcsPrefix?: (string|null); /** ImportErrorsConfig destination. */ public destination?: "gcsPrefix"; @@ -14088,19 +14088,19 @@ export namespace google { public selector: string; /** HttpRule get. */ - public get: string; + public get?: (string|null); /** HttpRule put. */ - public put: string; + public put?: (string|null); /** HttpRule post. */ - public post: string; + public post?: (string|null); /** HttpRule delete. */ - public delete: string; + public delete?: (string|null); /** HttpRule patch. */ - public patch: string; + public patch?: (string|null); /** HttpRule custom. */ public custom?: (google.api.ICustomHttpPattern|null); @@ -19066,16 +19066,16 @@ export namespace google { constructor(properties?: google.protobuf.IValue); /** Value nullValue. */ - public nullValue: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue); + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); /** Value numberValue. */ - public numberValue: number; + public numberValue?: (number|null); /** Value stringValue. */ - public stringValue: string; + public stringValue?: (string|null); /** Value boolValue. */ - public boolValue: boolean; + public boolValue?: (boolean|null); /** Value structValue. */ public structValue?: (google.protobuf.IStruct|null); diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 7545289e638..1bbefd56c22 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -3231,11 +3231,11 @@ /** * ImportErrorsConfig gcsPrefix. - * @member {string} gcsPrefix + * @member {string|null|undefined} gcsPrefix * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance */ - ImportErrorsConfig.prototype.gcsPrefix = ""; + ImportErrorsConfig.prototype.gcsPrefix = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -14439,11 +14439,11 @@ /** * ImportErrorsConfig gcsPrefix. - * @member {string} gcsPrefix + * @member {string|null|undefined} gcsPrefix * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ImportErrorsConfig.prototype.gcsPrefix = ""; + ImportErrorsConfig.prototype.gcsPrefix = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -25647,11 +25647,11 @@ /** * ImportErrorsConfig gcsPrefix. - * @member {string} gcsPrefix + * @member {string|null|undefined} gcsPrefix * @memberof google.cloud.retail.v2beta.ImportErrorsConfig * @instance */ - ImportErrorsConfig.prototype.gcsPrefix = ""; + ImportErrorsConfig.prototype.gcsPrefix = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -33971,43 +33971,43 @@ /** * HttpRule get. - * @member {string} get + * @member {string|null|undefined} get * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.get = ""; + HttpRule.prototype.get = null; /** * HttpRule put. - * @member {string} put + * @member {string|null|undefined} put * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.put = ""; + HttpRule.prototype.put = null; /** * HttpRule post. - * @member {string} post + * @member {string|null|undefined} post * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.post = ""; + HttpRule.prototype.post = null; /** * HttpRule delete. - * @member {string} delete + * @member {string|null|undefined} delete * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype["delete"] = ""; + HttpRule.prototype["delete"] = null; /** * HttpRule patch. - * @member {string} patch + * @member {string|null|undefined} patch * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.patch = ""; + HttpRule.prototype.patch = null; /** * HttpRule custom. @@ -47027,35 +47027,35 @@ /** * Value nullValue. - * @member {google.protobuf.NullValue} nullValue + * @member {google.protobuf.NullValue|null|undefined} nullValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.nullValue = 0; + Value.prototype.nullValue = null; /** * Value numberValue. - * @member {number} numberValue + * @member {number|null|undefined} numberValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.numberValue = 0; + Value.prototype.numberValue = null; /** * Value stringValue. - * @member {string} stringValue + * @member {string|null|undefined} stringValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.stringValue = ""; + Value.prototype.stringValue = null; /** * Value boolValue. - * @member {boolean} boolValue + * @member {boolean|null|undefined} boolValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.boolValue = false; + Value.prototype.boolValue = null; /** * Value structValue. diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 87b28f49839..79d5313de0a 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -236,13 +236,14 @@ export class CatalogServiceClient { const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -408,11 +409,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'catalog.name': request.catalog!.name || '', + }); this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } @@ -521,11 +521,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listCatalogs(request, options, callback); } @@ -578,11 +577,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( @@ -646,17 +644,16 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index cbae29e9982..ad39a04e484 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -213,13 +213,14 @@ export class PredictionServiceClient { const predictionServiceStubMethods = ['predict']; for (const methodName of predictionServiceStubMethods) { const callPromise = this.predictionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -462,11 +463,10 @@ export class PredictionServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - placement: request.placement || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 02eb955de08..fb4959086a2 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -261,13 +261,14 @@ export class ProductServiceClient { ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -436,11 +437,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); } @@ -529,11 +529,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); } @@ -630,11 +629,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product.name': request.product!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); } @@ -725,11 +723,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteProduct(request, options, callback); } @@ -848,11 +845,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.importProducts(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index c104d166949..c9d9e189ac0 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -279,13 +279,14 @@ export class UserEventServiceClient { ]; for (const methodName of userEventServiceStubMethods) { const callPromise = this.userEventServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -438,11 +439,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); } @@ -541,11 +541,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.collectUserEvent(request, options, callback); } @@ -680,11 +679,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.purgeUserEvents(request, options, callback); } @@ -833,11 +831,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.importUserEvents(request, options, callback); } @@ -987,11 +984,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.rejoinUserEvents(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index f5125242fda..0b6999f8d91 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -236,13 +236,14 @@ export class CatalogServiceClient { const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -414,11 +415,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'catalog.name': request.catalog!.name || '', + }); this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } @@ -533,11 +533,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listCatalogs(request, options, callback); } @@ -590,11 +589,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( @@ -658,17 +656,16 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 7bebb167ba2..c4c0f3007b9 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -213,13 +213,14 @@ export class PredictionServiceClient { const predictionServiceStubMethods = ['predict']; for (const methodName of predictionServiceStubMethods) { const callPromise = this.predictionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -462,11 +463,10 @@ export class PredictionServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - placement: request.placement || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 367078cfc4a..981173684ae 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -261,13 +261,14 @@ export class ProductServiceClient { ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -442,11 +443,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); } @@ -537,11 +537,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); } @@ -644,11 +643,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product.name': request.product!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); } @@ -745,11 +743,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteProduct(request, options, callback); } @@ -868,11 +865,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.importProducts(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 34b654f5b89..bd83f8dc2af 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -279,13 +279,14 @@ export class UserEventServiceClient { ]; for (const methodName of userEventServiceStubMethods) { const callPromise = this.userEventServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -444,11 +445,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); } @@ -553,11 +553,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.collectUserEvent(request, options, callback); } @@ -693,11 +692,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.purgeUserEvents(request, options, callback); } @@ -846,11 +844,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.importUserEvents(request, options, callback); } @@ -1000,11 +997,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.rejoinUserEvents(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index e6979275172..e5c5a6aba58 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -236,13 +236,14 @@ export class CatalogServiceClient { const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -414,11 +415,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'catalog.name': request.catalog!.name || '', + }); this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } @@ -533,11 +533,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listCatalogs(request, options, callback); } @@ -590,11 +589,10 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( @@ -658,17 +656,16 @@ export class CatalogServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 34caddd4654..91dae2d7ec2 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -213,13 +213,14 @@ export class PredictionServiceClient { const predictionServiceStubMethods = ['predict']; for (const methodName of predictionServiceStubMethods) { const callPromise = this.predictionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -462,11 +463,10 @@ export class PredictionServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - placement: request.placement || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 4cad5dac5ed..604066c7139 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -261,13 +261,14 @@ export class ProductServiceClient { ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -442,11 +443,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); } @@ -537,11 +537,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); } @@ -644,11 +643,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product.name': request.product!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); } @@ -745,11 +743,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteProduct(request, options, callback); } @@ -868,11 +865,10 @@ export class ProductServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.importProducts(request, options, callback); } diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 116724fea44..ad15071aa50 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -279,13 +279,14 @@ export class UserEventServiceClient { ]; for (const methodName of userEventServiceStubMethods) { const callPromise = this.userEventServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -444,11 +445,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); } @@ -553,11 +553,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.collectUserEvent(request, options, callback); } @@ -693,11 +692,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.purgeUserEvents(request, options, callback); } @@ -846,11 +844,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.importUserEvents(request, options, callback); } @@ -1000,11 +997,10 @@ export class UserEventServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.rejoinUserEvents(request, options, callback); } diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index ff99a8a106f..154e29b2e4a 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -251,9 +250,8 @@ describe('v2.CatalogServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Catalog() ); - client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateCatalog = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateCatalog( request, @@ -368,9 +366,8 @@ describe('v2.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), ]; - client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listCatalogs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listCatalogs( request, @@ -442,9 +439,8 @@ describe('v2.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), ]; - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listCatalogs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listCatalogsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.retail.v2.Catalog[] = []; @@ -466,10 +462,9 @@ describe('v2.CatalogServiceClient', () => { .calledWith(client.innerApiCalls.listCatalogs, request) ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -510,10 +505,9 @@ describe('v2.CatalogServiceClient', () => { .calledWith(client.innerApiCalls.listCatalogs, request) ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -534,9 +528,8 @@ describe('v2.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), ]; - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listCatalogs.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.retail.v2.ICatalog[] = []; const iterable = client.listCatalogsAsync(request); for await (const resource of iterable) { @@ -544,15 +537,15 @@ describe('v2.CatalogServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -569,10 +562,8 @@ describe('v2.CatalogServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listCatalogs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listCatalogsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.retail.v2.ICatalog[] = []; @@ -581,15 +572,15 @@ describe('v2.CatalogServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index e92d12f8ea9..2c29e1bed77 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -251,9 +250,8 @@ describe('v2alpha.CatalogServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Catalog() ); - client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateCatalog = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateCatalog( request, @@ -368,9 +366,8 @@ describe('v2alpha.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), ]; - client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listCatalogs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listCatalogs( request, @@ -442,9 +439,8 @@ describe('v2alpha.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), ]; - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listCatalogs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listCatalogsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; @@ -469,10 +465,9 @@ describe('v2alpha.CatalogServiceClient', () => { .calledWith(client.innerApiCalls.listCatalogs, request) ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -516,10 +511,9 @@ describe('v2alpha.CatalogServiceClient', () => { .calledWith(client.innerApiCalls.listCatalogs, request) ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -540,9 +534,8 @@ describe('v2alpha.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), ]; - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listCatalogs.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; const iterable = client.listCatalogsAsync(request); for await (const resource of iterable) { @@ -550,15 +543,15 @@ describe('v2alpha.CatalogServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -575,10 +568,8 @@ describe('v2alpha.CatalogServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listCatalogs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listCatalogsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; @@ -587,15 +578,15 @@ describe('v2alpha.CatalogServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 72bbb12c702..6433b142a5a 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -251,9 +250,8 @@ describe('v2beta.CatalogServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Catalog() ); - client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateCatalog = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateCatalog( request, @@ -368,9 +366,8 @@ describe('v2beta.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), ]; - client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listCatalogs = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listCatalogs( request, @@ -442,9 +439,8 @@ describe('v2beta.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), ]; - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listCatalogs.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listCatalogsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.retail.v2beta.Catalog[] = []; @@ -469,10 +465,9 @@ describe('v2beta.CatalogServiceClient', () => { .calledWith(client.innerApiCalls.listCatalogs, request) ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -516,10 +511,9 @@ describe('v2beta.CatalogServiceClient', () => { .calledWith(client.innerApiCalls.listCatalogs, request) ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -540,9 +534,8 @@ describe('v2beta.CatalogServiceClient', () => { generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), ]; - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listCatalogs.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.retail.v2beta.ICatalog[] = []; const iterable = client.listCatalogsAsync(request); for await (const resource of iterable) { @@ -550,15 +543,15 @@ describe('v2beta.CatalogServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -575,10 +568,8 @@ describe('v2beta.CatalogServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listCatalogs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listCatalogsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.retail.v2beta.ICatalog[] = []; @@ -587,15 +578,15 @@ describe('v2beta.CatalogServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listCatalogs - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listCatalogs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 46d7609dafd..96fcc59fd03 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -26,10 +26,9 @@ import * as predictionserviceModule from '../src'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -186,9 +185,8 @@ describe('v2.PredictionServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.PredictResponse() ); - client.innerApiCalls.predict = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.predict = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.predict( request, diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index d800b9a2bb3..05dd2edfb24 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -26,10 +26,9 @@ import * as predictionserviceModule from '../src'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -70,7 +69,8 @@ describe('v2alpha.PredictionServiceClient', () => { }); it('should create a client with no option', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient(); assert(client); }); @@ -135,12 +135,11 @@ describe('v2alpha.PredictionServiceClient', () => { describe('predict', () => { it('invokes predict without error', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient( - { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() @@ -168,12 +167,11 @@ describe('v2alpha.PredictionServiceClient', () => { }); it('invokes predict without error using callback', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient( - { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() @@ -190,9 +188,8 @@ describe('v2alpha.PredictionServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictResponse() ); - client.innerApiCalls.predict = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.predict = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.predict( request, @@ -218,12 +215,11 @@ describe('v2alpha.PredictionServiceClient', () => { }); it('invokes predict with error', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient( - { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() @@ -256,12 +252,11 @@ describe('v2alpha.PredictionServiceClient', () => { location: 'locationValue', catalog: 'catalogValue', }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient( - { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.catalogPathTemplate.render = sinon .stub() @@ -324,12 +319,11 @@ describe('v2alpha.PredictionServiceClient', () => { branch: 'branchValue', product: 'productValue', }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient( - { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.productPathTemplate.render = sinon .stub() diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index 681fb26fbf6..03ca999805f 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -26,10 +26,9 @@ import * as predictionserviceModule from '../src'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -190,9 +189,8 @@ describe('v2beta.PredictionServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictResponse() ); - client.innerApiCalls.predict = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.predict = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.predict( request, diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index dba06a83fbe..223212fbe59 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -26,10 +26,9 @@ import * as productserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -218,9 +217,8 @@ describe('v2.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); - client.innerApiCalls.createProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createProduct( request, @@ -330,9 +328,8 @@ describe('v2.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); - client.innerApiCalls.getProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getProduct( request, @@ -444,9 +441,8 @@ describe('v2.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); - client.innerApiCalls.updateProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateProduct( request, @@ -557,9 +553,8 @@ describe('v2.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteProduct( request, @@ -638,9 +633,8 @@ describe('v2.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importProducts = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.importProducts = + stubLongRunningCall(expectedResponse); const [operation] = await client.importProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -672,9 +666,8 @@ describe('v2.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importProducts = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importProducts = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importProducts( request, diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index 3f708cc3314..98b5cbd6de0 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -26,10 +26,9 @@ import * as productserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -218,9 +217,8 @@ describe('v2alpha.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); - client.innerApiCalls.createProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createProduct( request, @@ -330,9 +328,8 @@ describe('v2alpha.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); - client.innerApiCalls.getProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getProduct( request, @@ -444,9 +441,8 @@ describe('v2alpha.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); - client.innerApiCalls.updateProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateProduct( request, @@ -557,9 +553,8 @@ describe('v2alpha.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteProduct( request, @@ -638,9 +633,8 @@ describe('v2alpha.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importProducts = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.importProducts = + stubLongRunningCall(expectedResponse); const [operation] = await client.importProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -672,9 +666,8 @@ describe('v2alpha.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importProducts = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importProducts = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importProducts( request, diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 6844b31681b..0fb59443cd8 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -26,10 +26,9 @@ import * as productserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -218,9 +217,8 @@ describe('v2beta.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); - client.innerApiCalls.createProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createProduct( request, @@ -330,9 +328,8 @@ describe('v2beta.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); - client.innerApiCalls.getProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getProduct( request, @@ -444,9 +441,8 @@ describe('v2beta.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); - client.innerApiCalls.updateProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateProduct( request, @@ -557,9 +553,8 @@ describe('v2beta.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteProduct = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteProduct( request, @@ -638,9 +633,8 @@ describe('v2beta.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importProducts = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.importProducts = + stubLongRunningCall(expectedResponse); const [operation] = await client.importProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -672,9 +666,8 @@ describe('v2beta.ProductServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importProducts = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importProducts = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importProducts( request, diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index 7fde3d9fa31..246309144e2 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -26,10 +26,9 @@ import * as usereventserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -218,9 +217,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.UserEvent() ); - client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.writeUserEvent = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.writeUserEvent( request, @@ -330,9 +328,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); - client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.collectUserEvent = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.collectUserEvent( request, @@ -408,9 +405,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.purgeUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.purgeUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -442,9 +438,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.purgeUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.purgeUserEvents( request, @@ -604,9 +599,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.importUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.importUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -638,9 +632,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importUserEvents( request, @@ -800,9 +793,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.rejoinUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.rejoinUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -834,9 +826,8 @@ describe('v2.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.rejoinUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.rejoinUserEvents( request, diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index 7aec2211deb..91225ec816b 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -26,10 +26,9 @@ import * as usereventserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -218,9 +217,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UserEvent() ); - client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.writeUserEvent = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.writeUserEvent( request, @@ -330,9 +328,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); - client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.collectUserEvent = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.collectUserEvent( request, @@ -408,9 +405,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.purgeUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.purgeUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -442,9 +438,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.purgeUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.purgeUserEvents( request, @@ -604,9 +599,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.importUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.importUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -638,9 +632,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importUserEvents( request, @@ -800,9 +793,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.rejoinUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.rejoinUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -834,9 +826,8 @@ describe('v2alpha.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.rejoinUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.rejoinUserEvents( request, diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index 29329e9e4c4..fd1b4979a08 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -26,10 +26,9 @@ import * as usereventserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -218,9 +217,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.UserEvent() ); - client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.writeUserEvent = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.writeUserEvent( request, @@ -330,9 +328,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); - client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.collectUserEvent = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.collectUserEvent( request, @@ -408,9 +405,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.purgeUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.purgeUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -442,9 +438,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.purgeUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.purgeUserEvents( request, @@ -604,9 +599,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.importUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.importUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -638,9 +632,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.importUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.importUserEvents( request, @@ -800,9 +793,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.rejoinUserEvents = + stubLongRunningCall(expectedResponse); const [operation] = await client.rejoinUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -834,9 +826,8 @@ describe('v2beta.UserEventServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.rejoinUserEvents = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.rejoinUserEvents( request, From d46a263b18406dcd2c3074a182ae58e0f1bc6b10 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 21:58:24 +0000 Subject: [PATCH 016/103] fix: use require() to load JSON protos (#50) The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: https://github.com/googleapis/googleapis/commit/75880c3e6a6aa2597400582848e81bbbfac51dea Source-Link: https://github.com/googleapis/googleapis-gen/commit/77b18044813d4c8c415ff9ea68e76e307eb8e904 --- .../src/v2/catalog_service_client.ts | 18 ++----------- .../src/v2/prediction_service_client.ts | 18 ++----------- .../src/v2/product_service_client.ts | 26 +++---------------- .../src/v2/user_event_service_client.ts | 26 +++---------------- .../src/v2alpha/catalog_service_client.ts | 18 ++----------- .../src/v2alpha/prediction_service_client.ts | 18 ++----------- .../src/v2alpha/product_service_client.ts | 26 +++---------------- .../src/v2alpha/user_event_service_client.ts | 26 +++---------------- .../src/v2beta/catalog_service_client.ts | 18 ++----------- .../src/v2beta/prediction_service_client.ts | 18 ++----------- .../src/v2beta/product_service_client.ts | 26 +++---------------- .../src/v2beta/user_event_service_client.ts | 26 +++---------------- 12 files changed, 36 insertions(+), 228 deletions(-) diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 79d5313de0a..ce6e027c050 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -31,6 +31,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2/catalog_service_client_config.json`. @@ -145,22 +146,7 @@ export class CatalogServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index ad39a04e484..eebf6b01dc8 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2/prediction_service_client_config.json`. @@ -136,22 +137,7 @@ export class PredictionServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index fb4959086a2..2ef3668d44a 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -28,6 +28,7 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2/product_service_client_config.json`. @@ -144,22 +145,7 @@ export class ProductServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -176,15 +162,11 @@ export class ProductServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index c9d9e189ac0..b527923a92e 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -28,6 +28,7 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2/user_event_service_client_config.json`. @@ -143,22 +144,7 @@ export class UserEventServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -172,15 +158,11 @@ export class UserEventServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 0b6999f8d91..974f369678b 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -31,6 +31,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2alpha/catalog_service_client_config.json`. @@ -145,22 +146,7 @@ export class CatalogServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index c4c0f3007b9..fbb287a1cf3 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2alpha/prediction_service_client_config.json`. @@ -136,22 +137,7 @@ export class PredictionServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 981173684ae..f1fc7e4ae47 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -28,6 +28,7 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2alpha/product_service_client_config.json`. @@ -144,22 +145,7 @@ export class ProductServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -176,15 +162,11 @@ export class ProductServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index bd83f8dc2af..e5dc931c664 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -28,6 +28,7 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2alpha/user_event_service_client_config.json`. @@ -143,22 +144,7 @@ export class UserEventServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -172,15 +158,11 @@ export class UserEventServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index e5c5a6aba58..81e72e398b0 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -31,6 +31,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2beta/catalog_service_client_config.json`. @@ -145,22 +146,7 @@ export class CatalogServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 91dae2d7ec2..129d0e12add 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2beta/prediction_service_client_config.json`. @@ -136,22 +137,7 @@ export class PredictionServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 604066c7139..48e5344ee63 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -28,6 +28,7 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2beta/product_service_client_config.json`. @@ -144,22 +145,7 @@ export class ProductServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -176,15 +162,11 @@ export class ProductServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index ad15071aa50..353e40c7571 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -28,6 +28,7 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2beta/user_event_service_client_config.json`. @@ -143,22 +144,7 @@ export class UserEventServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -172,15 +158,11 @@ export class UserEventServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - const protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ From 2fa7c9529cb4ef5e6d6a99783288a49daee2fe65 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 23:13:00 +0000 Subject: [PATCH 017/103] chore: update gapic-generator-typescript to v1.3.2 (#51) Committer: @alexander-fenster PiperOrigin-RevId: 372656503 Source-Link: https://github.com/googleapis/googleapis/commit/6fa858c6489b1bbc505a7d7afe39f2dc45819c38 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d7c95df3ab1ea1b4c22a4542bad4924cc46d1388 --- packages/google-cloud-retail/src/v2/catalog_service_client.ts | 1 - packages/google-cloud-retail/src/v2/prediction_service_client.ts | 1 - packages/google-cloud-retail/src/v2/product_service_client.ts | 1 - packages/google-cloud-retail/src/v2/user_event_service_client.ts | 1 - .../google-cloud-retail/src/v2alpha/catalog_service_client.ts | 1 - .../google-cloud-retail/src/v2alpha/prediction_service_client.ts | 1 - .../google-cloud-retail/src/v2alpha/product_service_client.ts | 1 - .../google-cloud-retail/src/v2alpha/user_event_service_client.ts | 1 - .../google-cloud-retail/src/v2beta/catalog_service_client.ts | 1 - .../google-cloud-retail/src/v2beta/prediction_service_client.ts | 1 - .../google-cloud-retail/src/v2beta/product_service_client.ts | 1 - .../google-cloud-retail/src/v2beta/user_event_service_client.ts | 1 - 12 files changed, 12 deletions(-) diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index ce6e027c050..71db75fdd46 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; -import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index eebf6b01dc8..edcb5c314fe 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -19,7 +19,6 @@ /* global window */ import * as gax from 'google-gax'; import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 2ef3668d44a..ca0a3fcb8ae 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -25,7 +25,6 @@ import { ClientOptions, LROperation, } from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index b527923a92e..ed0da577cbf 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -25,7 +25,6 @@ import { ClientOptions, LROperation, } from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 974f369678b..41befd3b166 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; -import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index fbb287a1cf3..bf94087dd0f 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -19,7 +19,6 @@ /* global window */ import * as gax from 'google-gax'; import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index f1fc7e4ae47..884d3273ffb 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -25,7 +25,6 @@ import { ClientOptions, LROperation, } from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index e5dc931c664..8071f8cf149 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -25,7 +25,6 @@ import { ClientOptions, LROperation, } from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 81e72e398b0..a5ddd9c2401 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; -import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 129d0e12add..494aa1ba726 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -19,7 +19,6 @@ /* global window */ import * as gax from 'google-gax'; import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 48e5344ee63..08683571e29 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -25,7 +25,6 @@ import { ClientOptions, LROperation, } from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 353e40c7571..34aff0dbf8b 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -25,7 +25,6 @@ import { ClientOptions, LROperation, } from 'google-gax'; -import * as path from 'path'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); From 05291ce96999eebdcce71f79faf00d17f4ce2655 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 10:30:02 -0700 Subject: [PATCH 018/103] chore: release 1.1.1 (#48) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 8 ++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index d23218d7a19..3da389a0499 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [1.1.1](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.0...v1.1.1) (2021-05-12) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#47](https://www.github.com/googleapis/nodejs-retail/issues/47)) ([3ed1774](https://www.github.com/googleapis/nodejs-retail/commit/3ed1774f8c50a9f1e96610e1cef724d233b10cc3)) +* use require() to load JSON protos ([#50](https://www.github.com/googleapis/nodejs-retail/issues/50)) ([45348f3](https://www.github.com/googleapis/nodejs-retail/commit/45348f3958cb3e1b70f4e335c3aba5b255887e06)) + ## [1.1.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.0.0...v1.1.0) (2021-03-02) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 0136b6892a1..8a75be1401b 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.0", + "version": "1.1.1", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 18be1c5089c..cc7675fdb20 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.0" + "@google-cloud/retail": "^1.1.1" }, "devDependencies": { "c8": "^7.1.0", From 4f9500905ad7bffa7a18bd48a7a2dee3409f397a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 25 May 2021 17:58:26 +0200 Subject: [PATCH 019/103] chore(deps): update dependency sinon to v11 (#54) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^10.0.0` -> `^11.0.0`](https://renovatebot.com/diffs/npm/sinon/10.0.0/11.1.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/compatibility-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/confidence-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v11.1.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1110--2021-05-25) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.0.0...31be9a5d5a4762ef01cb195f29024616dfee9ce8) \================== - Add sinon.promise() implementation ([#​2369](https://togithub.com/sinonjs/sinon/issues/2369)) - Set wrappedMethod on getters/setters ([#​2378](https://togithub.com/sinonjs/sinon/issues/2378)) - \[Docs] Update fake-server usage & descriptions ([#​2365](https://togithub.com/sinonjs/sinon/issues/2365)) - Fake docs improvement ([#​2360](https://togithub.com/sinonjs/sinon/issues/2360)) - Update nise to 5.1.0 (fixed [#​2318](https://togithub.com/sinonjs/sinon/issues/2318)) ### [`v11.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1100--2021-05-24) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.1...v11.0.0) \================== - Explicitly use samsam 6.0.2 with fix for [#​2345](https://togithub.com/sinonjs/sinon/issues/2345) - Update most packages ([#​2371](https://togithub.com/sinonjs/sinon/issues/2371)) - Update compatibility docs ([#​2366](https://togithub.com/sinonjs/sinon/issues/2366)) - Update packages (includes breaking fake-timers change, see [#​2352](https://togithub.com/sinonjs/sinon/issues/2352)) - Warn of potential memory leaks ([#​2357](https://togithub.com/sinonjs/sinon/issues/2357)) - Fix clock test errors ### [`v10.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1001--2021-04-08) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.0...v10.0.1) \================== - Upgrade sinon components (bumps y18n to 4.0.1) - Bump y18n from 4.0.0 to 4.0.1
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 8a75be1401b..5e9cd6dc572 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -57,7 +57,7 @@ "mocha": "^8.2.1", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", - "sinon": "^10.0.0", + "sinon": "^11.0.0", "ts-loader": "^9.0.0", "typescript": "^4.1.2", "webpack": "^5.9.0", From ddfe74d7c537e26777f9d7b3de1042c6f670d986 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 20:48:49 +0000 Subject: [PATCH 020/103] fix: GoogleAdsError missing using generator version after 1.3.0 (#55) [PR](https://github.com/googleapis/gapic-generator-typescript/pull/878) within updated gapic-generator-typescript version 1.4.0 Committer: @summer-ji-eng PiperOrigin-RevId: 375759421 Source-Link: https://github.com/googleapis/googleapis/commit/95fa72fdd0d69b02d72c33b37d1e4cc66d4b1446 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f40a34377ad488a7c2bc3992b3c8d5faf5a15c46 --- packages/google-cloud-retail/src/v2/catalog_service_client.ts | 2 ++ .../google-cloud-retail/src/v2/prediction_service_client.ts | 2 ++ packages/google-cloud-retail/src/v2/product_service_client.ts | 2 ++ .../google-cloud-retail/src/v2/user_event_service_client.ts | 2 ++ .../google-cloud-retail/src/v2alpha/catalog_service_client.ts | 2 ++ .../src/v2alpha/prediction_service_client.ts | 2 ++ .../google-cloud-retail/src/v2alpha/product_service_client.ts | 2 ++ .../src/v2alpha/user_event_service_client.ts | 2 ++ .../google-cloud-retail/src/v2beta/catalog_service_client.ts | 2 ++ .../google-cloud-retail/src/v2beta/prediction_service_client.ts | 2 ++ .../google-cloud-retail/src/v2beta/product_service_client.ts | 2 ++ .../google-cloud-retail/src/v2beta/user_event_service_client.ts | 2 ++ 12 files changed, 24 insertions(+) diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 71db75fdd46..c0dde8bba9d 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -140,6 +140,8 @@ export class CatalogServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index edcb5c314fe..0f76e5a4ae8 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -131,6 +131,8 @@ export class PredictionServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index ca0a3fcb8ae..45e988d89d1 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -139,6 +139,8 @@ export class ProductServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index ed0da577cbf..94f2fd1b90f 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -138,6 +138,8 @@ export class UserEventServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 41befd3b166..c53331372ae 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -140,6 +140,8 @@ export class CatalogServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index bf94087dd0f..b52c55ab43d 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -131,6 +131,8 @@ export class PredictionServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 884d3273ffb..497b9bf8577 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -139,6 +139,8 @@ export class ProductServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 8071f8cf149..1580d864900 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -138,6 +138,8 @@ export class UserEventServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index a5ddd9c2401..491057d8db4 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -140,6 +140,8 @@ export class CatalogServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 494aa1ba726..e6dabd5300b 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -131,6 +131,8 @@ export class PredictionServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 08683571e29..412d005122f 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -139,6 +139,8 @@ export class ProductServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 34aff0dbf8b..ad8e3f67d0b 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -138,6 +138,8 @@ export class UserEventServiceClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); From 88a26be4f5c1b0b1464bc702c4905f2531bf737d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 18:17:52 -0400 Subject: [PATCH 021/103] chore: release 1.1.2 (#56) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 3da389a0499..f9329af1c3d 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.2](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.1...v1.1.2) (2021-05-25) + + +### Bug Fixes + +* GoogleAdsError missing using generator version after 1.3.0 ([#55](https://www.github.com/googleapis/nodejs-retail/issues/55)) ([907ba0c](https://www.github.com/googleapis/nodejs-retail/commit/907ba0cc02b8c02b85a2549b4d1e76bf8dc59c93)) + ### [1.1.1](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.0...v1.1.1) (2021-05-12) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 5e9cd6dc572..b5dd1d31a66 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.1", + "version": "1.1.2", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index cc7675fdb20..c0f971fb5ac 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.1" + "@google-cloud/retail": "^1.1.2" }, "devDependencies": { "c8": "^7.1.0", From 41842d5bea456507dba4efe76327625859063845 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:20:47 +0000 Subject: [PATCH 022/103] fix: make request optional in all cases (#62) ... chore: update gapic-generator-ruby to the latest commit chore: release gapic-generator-typescript 1.5.0 Committer: @miraleung PiperOrigin-RevId: 380641501 Source-Link: https://github.com/googleapis/googleapis/commit/076f7e9f0b258bdb54338895d7251b202e8f0de3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/27e4c88b4048e5f56508d4e1aa417d60a3380892 --- .../src/v2/catalog_service_client.ts | 8 ++++---- .../src/v2/prediction_service_client.ts | 4 ++-- .../src/v2/product_service_client.ts | 20 +++++++++---------- .../src/v2/user_event_service_client.ts | 20 +++++++++---------- .../src/v2alpha/catalog_service_client.ts | 8 ++++---- .../src/v2alpha/prediction_service_client.ts | 4 ++-- .../src/v2alpha/product_service_client.ts | 20 +++++++++---------- .../src/v2alpha/user_event_service_client.ts | 20 +++++++++---------- .../src/v2beta/catalog_service_client.ts | 8 ++++---- .../src/v2beta/prediction_service_client.ts | 4 ++-- .../src/v2beta/product_service_client.ts | 20 +++++++++---------- .../src/v2beta/user_event_service_client.ts | 20 +++++++++---------- 12 files changed, 78 insertions(+), 78 deletions(-) diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index c0dde8bba9d..6119ea639c3 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -303,7 +303,7 @@ export class CatalogServiceClient { // -- Service calls -- // ------------------- updateCatalog( - request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + request?: protos.google.cloud.retail.v2.IUpdateCatalogRequest, options?: CallOptions ): Promise< [ @@ -363,7 +363,7 @@ export class CatalogServiceClient { * const [response] = await client.updateCatalog(request); */ updateCatalog( - request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + request?: protos.google.cloud.retail.v2.IUpdateCatalogRequest, optionsOrCallback?: | CallOptions | Callback< @@ -405,7 +405,7 @@ export class CatalogServiceClient { } listCatalogs( - request: protos.google.cloud.retail.v2.IListCatalogsRequest, + request?: protos.google.cloud.retail.v2.IListCatalogsRequest, options?: CallOptions ): Promise< [ @@ -475,7 +475,7 @@ export class CatalogServiceClient { * for more details and examples. */ listCatalogs( - request: protos.google.cloud.retail.v2.IListCatalogsRequest, + request?: protos.google.cloud.retail.v2.IListCatalogsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 0f76e5a4ae8..9ea6c8defe2 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -280,7 +280,7 @@ export class PredictionServiceClient { // -- Service calls -- // ------------------- predict( - request: protos.google.cloud.retail.v2.IPredictRequest, + request?: protos.google.cloud.retail.v2.IPredictRequest, options?: CallOptions ): Promise< [ @@ -419,7 +419,7 @@ export class PredictionServiceClient { * const [response] = await client.predict(request); */ predict( - request: protos.google.cloud.retail.v2.IPredictRequest, + request?: protos.google.cloud.retail.v2.IPredictRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 45e988d89d1..6b018268e85 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -324,7 +324,7 @@ export class ProductServiceClient { // -- Service calls -- // ------------------- createProduct( - request: protos.google.cloud.retail.v2.ICreateProductRequest, + request?: protos.google.cloud.retail.v2.ICreateProductRequest, options?: CallOptions ): Promise< [ @@ -387,7 +387,7 @@ export class ProductServiceClient { * const [response] = await client.createProduct(request); */ createProduct( - request: protos.google.cloud.retail.v2.ICreateProductRequest, + request?: protos.google.cloud.retail.v2.ICreateProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -428,7 +428,7 @@ export class ProductServiceClient { return this.innerApiCalls.createProduct(request, options, callback); } getProduct( - request: protos.google.cloud.retail.v2.IGetProductRequest, + request?: protos.google.cloud.retail.v2.IGetProductRequest, options?: CallOptions ): Promise< [ @@ -481,7 +481,7 @@ export class ProductServiceClient { * const [response] = await client.getProduct(request); */ getProduct( - request: protos.google.cloud.retail.v2.IGetProductRequest, + request?: protos.google.cloud.retail.v2.IGetProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -520,7 +520,7 @@ export class ProductServiceClient { return this.innerApiCalls.getProduct(request, options, callback); } updateProduct( - request: protos.google.cloud.retail.v2.IUpdateProductRequest, + request?: protos.google.cloud.retail.v2.IUpdateProductRequest, options?: CallOptions ): Promise< [ @@ -579,7 +579,7 @@ export class ProductServiceClient { * const [response] = await client.updateProduct(request); */ updateProduct( - request: protos.google.cloud.retail.v2.IUpdateProductRequest, + request?: protos.google.cloud.retail.v2.IUpdateProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -620,7 +620,7 @@ export class ProductServiceClient { return this.innerApiCalls.updateProduct(request, options, callback); } deleteProduct( - request: protos.google.cloud.retail.v2.IDeleteProductRequest, + request?: protos.google.cloud.retail.v2.IDeleteProductRequest, options?: CallOptions ): Promise< [ @@ -673,7 +673,7 @@ export class ProductServiceClient { * const [response] = await client.deleteProduct(request); */ deleteProduct( - request: protos.google.cloud.retail.v2.IDeleteProductRequest, + request?: protos.google.cloud.retail.v2.IDeleteProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -715,7 +715,7 @@ export class ProductServiceClient { } importProducts( - request: protos.google.cloud.retail.v2.IImportProductsRequest, + request?: protos.google.cloud.retail.v2.IImportProductsRequest, options?: CallOptions ): Promise< [ @@ -788,7 +788,7 @@ export class ProductServiceClient { * const [response] = await operation.promise(); */ importProducts( - request: protos.google.cloud.retail.v2.IImportProductsRequest, + request?: protos.google.cloud.retail.v2.IImportProductsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 94f2fd1b90f..5d3290c3fe0 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -342,7 +342,7 @@ export class UserEventServiceClient { // -- Service calls -- // ------------------- writeUserEvent( - request: protos.google.cloud.retail.v2.IWriteUserEventRequest, + request?: protos.google.cloud.retail.v2.IWriteUserEventRequest, options?: CallOptions ): Promise< [ @@ -389,7 +389,7 @@ export class UserEventServiceClient { * const [response] = await client.writeUserEvent(request); */ writeUserEvent( - request: protos.google.cloud.retail.v2.IWriteUserEventRequest, + request?: protos.google.cloud.retail.v2.IWriteUserEventRequest, optionsOrCallback?: | CallOptions | Callback< @@ -430,7 +430,7 @@ export class UserEventServiceClient { return this.innerApiCalls.writeUserEvent(request, options, callback); } collectUserEvent( - request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + request?: protos.google.cloud.retail.v2.ICollectUserEventRequest, options?: CallOptions ): Promise< [ @@ -491,7 +491,7 @@ export class UserEventServiceClient { * const [response] = await client.collectUserEvent(request); */ collectUserEvent( - request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + request?: protos.google.cloud.retail.v2.ICollectUserEventRequest, optionsOrCallback?: | CallOptions | Callback< @@ -533,7 +533,7 @@ export class UserEventServiceClient { } purgeUserEvents( - request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + request?: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, options?: CallOptions ): Promise< [ @@ -622,7 +622,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ purgeUserEvents( - request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + request?: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -707,7 +707,7 @@ export class UserEventServiceClient { >; } importUserEvents( - request: protos.google.cloud.retail.v2.IImportUserEventsRequest, + request?: protos.google.cloud.retail.v2.IImportUserEventsRequest, options?: CallOptions ): Promise< [ @@ -774,7 +774,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ importUserEvents( - request: protos.google.cloud.retail.v2.IImportUserEventsRequest, + request?: protos.google.cloud.retail.v2.IImportUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -859,7 +859,7 @@ export class UserEventServiceClient { >; } rejoinUserEvents( - request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, + request?: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, options?: CallOptions ): Promise< [ @@ -927,7 +927,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ rejoinUserEvents( - request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, + request?: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index c53331372ae..cb3833b8598 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -303,7 +303,7 @@ export class CatalogServiceClient { // -- Service calls -- // ------------------- updateCatalog( - request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, + request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, options?: CallOptions ): Promise< [ @@ -367,7 +367,7 @@ export class CatalogServiceClient { * const [response] = await client.updateCatalog(request); */ updateCatalog( - request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, + request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, optionsOrCallback?: | CallOptions | Callback< @@ -411,7 +411,7 @@ export class CatalogServiceClient { } listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, options?: CallOptions ): Promise< [ @@ -485,7 +485,7 @@ export class CatalogServiceClient { * for more details and examples. */ listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index b52c55ab43d..01313e28382 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -280,7 +280,7 @@ export class PredictionServiceClient { // -- Service calls -- // ------------------- predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, + request?: protos.google.cloud.retail.v2alpha.IPredictRequest, options?: CallOptions ): Promise< [ @@ -419,7 +419,7 @@ export class PredictionServiceClient { * const [response] = await client.predict(request); */ predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, + request?: protos.google.cloud.retail.v2alpha.IPredictRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 497b9bf8577..970be1fae5f 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -324,7 +324,7 @@ export class ProductServiceClient { // -- Service calls -- // ------------------- createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, options?: CallOptions ): Promise< [ @@ -391,7 +391,7 @@ export class ProductServiceClient { * const [response] = await client.createProduct(request); */ createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -434,7 +434,7 @@ export class ProductServiceClient { return this.innerApiCalls.createProduct(request, options, callback); } getProduct( - request: protos.google.cloud.retail.v2alpha.IGetProductRequest, + request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, options?: CallOptions ): Promise< [ @@ -487,7 +487,7 @@ export class ProductServiceClient { * const [response] = await client.getProduct(request); */ getProduct( - request: protos.google.cloud.retail.v2alpha.IGetProductRequest, + request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -528,7 +528,7 @@ export class ProductServiceClient { return this.innerApiCalls.getProduct(request, options, callback); } updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, options?: CallOptions ): Promise< [ @@ -591,7 +591,7 @@ export class ProductServiceClient { * const [response] = await client.updateProduct(request); */ updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -634,7 +634,7 @@ export class ProductServiceClient { return this.innerApiCalls.updateProduct(request, options, callback); } deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, options?: CallOptions ): Promise< [ @@ -691,7 +691,7 @@ export class ProductServiceClient { * const [response] = await client.deleteProduct(request); */ deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -735,7 +735,7 @@ export class ProductServiceClient { } importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, options?: CallOptions ): Promise< [ @@ -808,7 +808,7 @@ export class ProductServiceClient { * const [response] = await operation.promise(); */ importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 1580d864900..a66f25c4bd7 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -342,7 +342,7 @@ export class UserEventServiceClient { // -- Service calls -- // ------------------- writeUserEvent( - request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, + request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, options?: CallOptions ): Promise< [ @@ -393,7 +393,7 @@ export class UserEventServiceClient { * const [response] = await client.writeUserEvent(request); */ writeUserEvent( - request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, + request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, optionsOrCallback?: | CallOptions | Callback< @@ -436,7 +436,7 @@ export class UserEventServiceClient { return this.innerApiCalls.writeUserEvent(request, options, callback); } collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, options?: CallOptions ): Promise< [ @@ -501,7 +501,7 @@ export class UserEventServiceClient { * const [response] = await client.collectUserEvent(request); */ collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, optionsOrCallback?: | CallOptions | Callback< @@ -545,7 +545,7 @@ export class UserEventServiceClient { } purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, options?: CallOptions ): Promise< [ @@ -635,7 +635,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -720,7 +720,7 @@ export class UserEventServiceClient { >; } importUserEvents( - request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, + request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, options?: CallOptions ): Promise< [ @@ -787,7 +787,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ importUserEvents( - request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, + request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -872,7 +872,7 @@ export class UserEventServiceClient { >; } rejoinUserEvents( - request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, + request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, options?: CallOptions ): Promise< [ @@ -940,7 +940,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ rejoinUserEvents( - request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, + request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 491057d8db4..023243f24ad 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -303,7 +303,7 @@ export class CatalogServiceClient { // -- Service calls -- // ------------------- updateCatalog( - request: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, + request?: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, options?: CallOptions ): Promise< [ @@ -367,7 +367,7 @@ export class CatalogServiceClient { * const [response] = await client.updateCatalog(request); */ updateCatalog( - request: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, + request?: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, optionsOrCallback?: | CallOptions | Callback< @@ -411,7 +411,7 @@ export class CatalogServiceClient { } listCatalogs( - request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, options?: CallOptions ): Promise< [ @@ -485,7 +485,7 @@ export class CatalogServiceClient { * for more details and examples. */ listCatalogs( - request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index e6dabd5300b..25ef77cd166 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -280,7 +280,7 @@ export class PredictionServiceClient { // -- Service calls -- // ------------------- predict( - request: protos.google.cloud.retail.v2beta.IPredictRequest, + request?: protos.google.cloud.retail.v2beta.IPredictRequest, options?: CallOptions ): Promise< [ @@ -419,7 +419,7 @@ export class PredictionServiceClient { * const [response] = await client.predict(request); */ predict( - request: protos.google.cloud.retail.v2beta.IPredictRequest, + request?: protos.google.cloud.retail.v2beta.IPredictRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 412d005122f..d5023f375f4 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -324,7 +324,7 @@ export class ProductServiceClient { // -- Service calls -- // ------------------- createProduct( - request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + request?: protos.google.cloud.retail.v2beta.ICreateProductRequest, options?: CallOptions ): Promise< [ @@ -391,7 +391,7 @@ export class ProductServiceClient { * const [response] = await client.createProduct(request); */ createProduct( - request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + request?: protos.google.cloud.retail.v2beta.ICreateProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -434,7 +434,7 @@ export class ProductServiceClient { return this.innerApiCalls.createProduct(request, options, callback); } getProduct( - request: protos.google.cloud.retail.v2beta.IGetProductRequest, + request?: protos.google.cloud.retail.v2beta.IGetProductRequest, options?: CallOptions ): Promise< [ @@ -487,7 +487,7 @@ export class ProductServiceClient { * const [response] = await client.getProduct(request); */ getProduct( - request: protos.google.cloud.retail.v2beta.IGetProductRequest, + request?: protos.google.cloud.retail.v2beta.IGetProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -528,7 +528,7 @@ export class ProductServiceClient { return this.innerApiCalls.getProduct(request, options, callback); } updateProduct( - request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + request?: protos.google.cloud.retail.v2beta.IUpdateProductRequest, options?: CallOptions ): Promise< [ @@ -591,7 +591,7 @@ export class ProductServiceClient { * const [response] = await client.updateProduct(request); */ updateProduct( - request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + request?: protos.google.cloud.retail.v2beta.IUpdateProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -634,7 +634,7 @@ export class ProductServiceClient { return this.innerApiCalls.updateProduct(request, options, callback); } deleteProduct( - request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + request?: protos.google.cloud.retail.v2beta.IDeleteProductRequest, options?: CallOptions ): Promise< [ @@ -691,7 +691,7 @@ export class ProductServiceClient { * const [response] = await client.deleteProduct(request); */ deleteProduct( - request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + request?: protos.google.cloud.retail.v2beta.IDeleteProductRequest, optionsOrCallback?: | CallOptions | Callback< @@ -735,7 +735,7 @@ export class ProductServiceClient { } importProducts( - request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + request?: protos.google.cloud.retail.v2beta.IImportProductsRequest, options?: CallOptions ): Promise< [ @@ -808,7 +808,7 @@ export class ProductServiceClient { * const [response] = await operation.promise(); */ importProducts( - request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + request?: protos.google.cloud.retail.v2beta.IImportProductsRequest, optionsOrCallback?: | CallOptions | Callback< diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index ad8e3f67d0b..61674b98eb6 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -342,7 +342,7 @@ export class UserEventServiceClient { // -- Service calls -- // ------------------- writeUserEvent( - request: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, + request?: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, options?: CallOptions ): Promise< [ @@ -393,7 +393,7 @@ export class UserEventServiceClient { * const [response] = await client.writeUserEvent(request); */ writeUserEvent( - request: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, + request?: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, optionsOrCallback?: | CallOptions | Callback< @@ -436,7 +436,7 @@ export class UserEventServiceClient { return this.innerApiCalls.writeUserEvent(request, options, callback); } collectUserEvent( - request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + request?: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, options?: CallOptions ): Promise< [ @@ -501,7 +501,7 @@ export class UserEventServiceClient { * const [response] = await client.collectUserEvent(request); */ collectUserEvent( - request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + request?: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, optionsOrCallback?: | CallOptions | Callback< @@ -545,7 +545,7 @@ export class UserEventServiceClient { } purgeUserEvents( - request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + request?: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, options?: CallOptions ): Promise< [ @@ -635,7 +635,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ purgeUserEvents( - request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + request?: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -720,7 +720,7 @@ export class UserEventServiceClient { >; } importUserEvents( - request: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, + request?: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, options?: CallOptions ): Promise< [ @@ -787,7 +787,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ importUserEvents( - request: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, + request?: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -872,7 +872,7 @@ export class UserEventServiceClient { >; } rejoinUserEvents( - request: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, + request?: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, options?: CallOptions ): Promise< [ @@ -940,7 +940,7 @@ export class UserEventServiceClient { * const [response] = await operation.promise(); */ rejoinUserEvents( - request: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, + request?: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, optionsOrCallback?: | CallOptions | Callback< From d762344a5630dfedbcdbc7ec2290b5f3864f34ba Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 25 Jun 2021 10:01:18 -0700 Subject: [PATCH 023/103] chore: release 1.1.3 (#63) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index f9329af1c3d..c9c32e37af0 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.3](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.2...v1.1.3) (2021-06-22) + + +### Bug Fixes + +* make request optional in all cases ([#62](https://www.github.com/googleapis/nodejs-retail/issues/62)) ([ea912e8](https://www.github.com/googleapis/nodejs-retail/commit/ea912e887a5a0b0695bcc54d506ec8e7c4c605c3)) + ### [1.1.2](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.1...v1.1.2) (2021-05-25) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index b5dd1d31a66..11f5a4fdfe9 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.2", + "version": "1.1.3", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index c0f971fb5ac..49864f6dcba 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.2" + "@google-cloud/retail": "^1.1.3" }, "devDependencies": { "c8": "^7.1.0", From a2ae895cbab3fc799db36446d9f5068a34cea2f7 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Thu, 1 Jul 2021 12:00:17 -0400 Subject: [PATCH 024/103] fix(deps): require google-gax v2.17.0 (#66) --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 11f5a4fdfe9..a0972d500c1 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,7 +42,7 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^2.12.0" + "google-gax": "^2.17.0" }, "devDependencies": { "@types/mocha": "^8.0.4", From efb568cca11d0dae37ec7da1627ccbb5506d1280 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 1 Jul 2021 16:06:09 +0000 Subject: [PATCH 025/103] chore: release 1.1.4 (#68) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.4](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.3...v1.1.4) (2021-07-01) ### Bug Fixes * **deps:** require google-gax v2.17.0 ([#66](https://www.github.com/googleapis/nodejs-retail/issues/66)) ([94fd8a8](https://www.github.com/googleapis/nodejs-retail/commit/94fd8a842f4fc7cfb480e72d4b3375ec0293cc09)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index c9c32e37af0..35e98a6fb0d 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.4](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.3...v1.1.4) (2021-07-01) + + +### Bug Fixes + +* **deps:** require google-gax v2.17.0 ([#66](https://www.github.com/googleapis/nodejs-retail/issues/66)) ([94fd8a8](https://www.github.com/googleapis/nodejs-retail/commit/94fd8a842f4fc7cfb480e72d4b3375ec0293cc09)) + ### [1.1.3](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.2...v1.1.3) (2021-06-22) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index a0972d500c1..394aa75ad62 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.3", + "version": "1.1.4", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 49864f6dcba..0863d971887 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.3" + "@google-cloud/retail": "^1.1.4" }, "devDependencies": { "c8": "^7.1.0", From 2420c65f4cd1c40e57d300cbaeb3149aba09c1e3 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 12 Jul 2021 17:48:12 -0400 Subject: [PATCH 026/103] fix(deps): google-gax v2.17.1 (#69) --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 394aa75ad62..8e383269893 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,7 +42,7 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^2.17.0" + "google-gax": "^2.17.1" }, "devDependencies": { "@types/mocha": "^8.0.4", From 0ef5edbfa373de3b775a8736e34fc451b5447add Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 13 Jul 2021 15:36:06 -0700 Subject: [PATCH 027/103] chore: release 1.1.5 (#70) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 35e98a6fb0d..43797ba3a54 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.5](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.4...v1.1.5) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#69](https://www.github.com/googleapis/nodejs-retail/issues/69)) ([b414012](https://www.github.com/googleapis/nodejs-retail/commit/b4140124e136a75e3a33baece43ef7ee5a717c7a)) + ### [1.1.4](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.3...v1.1.4) (2021-07-01) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 8e383269893..73a4eb536d2 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.4", + "version": "1.1.5", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 0863d971887..983de279fb0 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.4" + "@google-cloud/retail": "^1.1.5" }, "devDependencies": { "c8": "^7.1.0", From 8987bca7a4fa12064e1dee1b4cf0dca852a27c76 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 13 Jul 2021 22:42:14 +0000 Subject: [PATCH 028/103] chore: release 1.1.5 (#71) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.5](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.4...v1.1.5) (2021-07-13) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#69](https://www.github.com/googleapis/nodejs-retail/issues/69)) ([b414012](https://www.github.com/googleapis/nodejs-retail/commit/b4140124e136a75e3a33baece43ef7ee5a717c7a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 43797ba3a54..643d452081f 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.5](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.4...v1.1.5) (2021-07-13) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#69](https://www.github.com/googleapis/nodejs-retail/issues/69)) ([b414012](https://www.github.com/googleapis/nodejs-retail/commit/b4140124e136a75e3a33baece43ef7ee5a717c7a)) + ### [1.1.5](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.4...v1.1.5) (2021-07-12) From e4618e192ce78bb521c35a6047ceeba92a44a68c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 19:12:14 +0000 Subject: [PATCH 029/103] fix: Updating WORKSPACE files to use the newest version of the Typescript generator. (#73) Also removing the explicit generator tag for the IAMPolicy mixin for the kms and pubsub APIS as the generator will now read it from the .yaml file. PiperOrigin-RevId: 385101839 Source-Link: https://github.com/googleapis/googleapis/commit/80f404215a9346259db760d80d0671f28c433453 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d3509d2520fb8db862129633f1cf8406d17454e1 --- .../src/v2/catalog_service_client.ts | 11 ++++++++++- .../src/v2/prediction_service_client.ts | 11 ++++++++++- .../src/v2/product_service_client.ts | 11 ++++++++++- .../src/v2/user_event_service_client.ts | 11 ++++++++++- .../src/v2alpha/catalog_service_client.ts | 11 ++++++++++- .../src/v2alpha/prediction_service_client.ts | 11 ++++++++++- .../src/v2alpha/product_service_client.ts | 11 ++++++++++- .../src/v2alpha/user_event_service_client.ts | 11 ++++++++++- .../src/v2beta/catalog_service_client.ts | 11 ++++++++++- .../src/v2beta/prediction_service_client.ts | 11 ++++++++++- .../src/v2beta/product_service_client.ts | 11 ++++++++++- .../src/v2beta/user_event_service_client.ts | 11 ++++++++++- 12 files changed, 120 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 6119ea639c3..ed0aacbdeb7 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -48,6 +48,7 @@ const version = require('../../../package.json').version; export class CatalogServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -59,6 +60,7 @@ export class CatalogServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; catalogServiceStub?: Promise<{[name: string]: Function}>; @@ -102,6 +104,9 @@ export class CatalogServiceClient { const staticMembers = this.constructor as typeof CatalogServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -187,6 +192,9 @@ export class CatalogServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -215,7 +223,8 @@ export class CatalogServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2.CatalogService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 9ea6c8defe2..a9167342eac 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -39,6 +39,7 @@ const version = require('../../../package.json').version; export class PredictionServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -50,6 +51,7 @@ export class PredictionServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; predictionServiceStub?: Promise<{[name: string]: Function}>; @@ -93,6 +95,9 @@ export class PredictionServiceClient { const staticMembers = this.constructor as typeof PredictionServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -164,6 +169,9 @@ export class PredictionServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -192,7 +200,8 @@ export class PredictionServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2.PredictionService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 6b018268e85..b3edece1403 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -46,6 +46,7 @@ const version = require('../../../package.json').version; export class ProductServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -57,6 +58,7 @@ export class ProductServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -101,6 +103,9 @@ export class ProductServiceClient { const staticMembers = this.constructor as typeof ProductServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -202,6 +207,9 @@ export class ProductServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -230,7 +238,8 @@ export class ProductServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2.ProductService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 5d3290c3fe0..276851eee9c 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -45,6 +45,7 @@ const version = require('../../../package.json').version; export class UserEventServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -56,6 +57,7 @@ export class UserEventServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -100,6 +102,9 @@ export class UserEventServiceClient { const staticMembers = this.constructor as typeof UserEventServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -220,6 +225,9 @@ export class UserEventServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -248,7 +256,8 @@ export class UserEventServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2.UserEventService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index cb3833b8598..8d2d1f1252f 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -48,6 +48,7 @@ const version = require('../../../package.json').version; export class CatalogServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -59,6 +60,7 @@ export class CatalogServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; catalogServiceStub?: Promise<{[name: string]: Function}>; @@ -102,6 +104,9 @@ export class CatalogServiceClient { const staticMembers = this.constructor as typeof CatalogServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -187,6 +192,9 @@ export class CatalogServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -215,7 +223,8 @@ export class CatalogServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2alpha.CatalogService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 01313e28382..ae50925b4ac 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -39,6 +39,7 @@ const version = require('../../../package.json').version; export class PredictionServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -50,6 +51,7 @@ export class PredictionServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; predictionServiceStub?: Promise<{[name: string]: Function}>; @@ -93,6 +95,9 @@ export class PredictionServiceClient { const staticMembers = this.constructor as typeof PredictionServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -164,6 +169,9 @@ export class PredictionServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -192,7 +200,8 @@ export class PredictionServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2alpha.PredictionService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 970be1fae5f..b886371b73a 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -46,6 +46,7 @@ const version = require('../../../package.json').version; export class ProductServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -57,6 +58,7 @@ export class ProductServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -101,6 +103,9 @@ export class ProductServiceClient { const staticMembers = this.constructor as typeof ProductServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -202,6 +207,9 @@ export class ProductServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -230,7 +238,8 @@ export class ProductServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2alpha.ProductService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index a66f25c4bd7..e75b9ef61f4 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -45,6 +45,7 @@ const version = require('../../../package.json').version; export class UserEventServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -56,6 +57,7 @@ export class UserEventServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -100,6 +102,9 @@ export class UserEventServiceClient { const staticMembers = this.constructor as typeof UserEventServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -220,6 +225,9 @@ export class UserEventServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -248,7 +256,8 @@ export class UserEventServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2alpha.UserEventService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 023243f24ad..c5055458e2b 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -48,6 +48,7 @@ const version = require('../../../package.json').version; export class CatalogServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -59,6 +60,7 @@ export class CatalogServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; catalogServiceStub?: Promise<{[name: string]: Function}>; @@ -102,6 +104,9 @@ export class CatalogServiceClient { const staticMembers = this.constructor as typeof CatalogServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -187,6 +192,9 @@ export class CatalogServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -215,7 +223,8 @@ export class CatalogServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2beta.CatalogService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 25ef77cd166..19c31eef639 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -39,6 +39,7 @@ const version = require('../../../package.json').version; export class PredictionServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -50,6 +51,7 @@ export class PredictionServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; predictionServiceStub?: Promise<{[name: string]: Function}>; @@ -93,6 +95,9 @@ export class PredictionServiceClient { const staticMembers = this.constructor as typeof PredictionServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -164,6 +169,9 @@ export class PredictionServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -192,7 +200,8 @@ export class PredictionServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2beta.PredictionService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index d5023f375f4..f5a0487a068 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -46,6 +46,7 @@ const version = require('../../../package.json').version; export class ProductServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -57,6 +58,7 @@ export class ProductServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -101,6 +103,9 @@ export class ProductServiceClient { const staticMembers = this.constructor as typeof ProductServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -202,6 +207,9 @@ export class ProductServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -230,7 +238,8 @@ export class ProductServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2beta.ProductService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 61674b98eb6..09bc567fce5 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -45,6 +45,7 @@ const version = require('../../../package.json').version; export class UserEventServiceClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -56,6 +57,7 @@ export class UserEventServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -100,6 +102,9 @@ export class UserEventServiceClient { const staticMembers = this.constructor as typeof UserEventServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -220,6 +225,9 @@ export class UserEventServiceClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -248,7 +256,8 @@ export class UserEventServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.retail.v2beta.UserEventService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides From 6724d8a76f45ad882a8e5279937fee0e18c7001d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 13:00:08 -0700 Subject: [PATCH 030/103] chore: release 1.1.6 (#74) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 643d452081f..bd43565a3b8 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.6](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.5...v1.1.6) (2021-07-16) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#73](https://www.github.com/googleapis/nodejs-retail/issues/73)) ([9ba9a09](https://www.github.com/googleapis/nodejs-retail/commit/9ba9a09c270b0ed2ef3eae76a284bb19af789317)) + ### [1.1.5](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.4...v1.1.5) (2021-07-13) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 73a4eb536d2..b09e48caadf 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.5", + "version": "1.1.6", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 983de279fb0..7ed2ee30fa2 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.5" + "@google-cloud/retail": "^1.1.6" }, "devDependencies": { "c8": "^7.1.0", From a6b9129189d988c4500dfc5c4ea38ca212726696 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 30 Jul 2021 09:25:10 -0700 Subject: [PATCH 031/103] feat: Add restricted Retail Search features for Retail API v2beta. (#79) PiperOrigin-RevId: 387438934 feat: Add restricted Retail Search features for Retail API v2 PiperOrigin-RevId: 387366941 feat: Add restricted Retail Search features for Retail API v2alpha PiperOrigin-RevId: 386944882 --- .../google/cloud/retail/v2/catalog.proto | 14 +- .../cloud/retail/v2/catalog_service.proto | 117 +- .../google/cloud/retail/v2/common.proto | 271 +- .../cloud/retail/v2/completion_service.proto | 193 + .../cloud/retail/v2/import_config.proto | 151 +- .../cloud/retail/v2/prediction_service.proto | 63 +- .../google/cloud/retail/v2/product.proto | 280 +- .../cloud/retail/v2/product_service.proto | 457 +- .../google/cloud/retail/v2/purge_config.proto | 2 +- .../cloud/retail/v2/search_service.proto | 805 + .../google/cloud/retail/v2/user_event.proto | 95 +- .../google/cloud/retail/v2alpha/catalog.proto | 57 +- .../retail/v2alpha/catalog_service.proto | 119 +- .../google/cloud/retail/v2alpha/common.proto | 282 +- .../retail/v2alpha/completion_service.proto | 192 + .../cloud/retail/v2alpha/export_config.proto | 78 + .../cloud/retail/v2alpha/import_config.proto | 166 +- .../retail/v2alpha/prediction_service.proto | 65 +- .../google/cloud/retail/v2alpha/product.proto | 293 +- .../retail/v2alpha/product_service.proto | 492 +- .../cloud/retail/v2alpha/purge_config.proto | 4 +- .../cloud/retail/v2alpha/search_service.proto | 844 + .../cloud/retail/v2alpha/user_event.proto | 100 +- .../retail/v2alpha/user_event_service.proto | 9 +- .../google/cloud/retail/v2beta/catalog.proto | 16 +- .../cloud/retail/v2beta/catalog_service.proto | 119 +- .../google/cloud/retail/v2beta/common.proto | 281 +- .../retail/v2beta/completion_service.proto | 193 + .../cloud/retail/v2beta/export_config.proto | 78 + .../cloud/retail/v2beta/import_config.proto | 166 +- .../retail/v2beta/prediction_service.proto | 65 +- .../google/cloud/retail/v2beta/product.proto | 291 +- .../cloud/retail/v2beta/product_service.proto | 468 +- .../cloud/retail/v2beta/purge_config.proto | 4 +- .../cloud/retail/v2beta/search_service.proto | 812 + .../cloud/retail/v2beta/user_event.proto | 98 +- .../retail/v2beta/user_event_service.proto | 9 +- .../google-cloud-retail/protos/protos.d.ts | 26599 ++++-- packages/google-cloud-retail/protos/protos.js | 68496 ++++++++++++---- .../google-cloud-retail/protos/protos.json | 7090 +- packages/google-cloud-retail/src/index.ts | 8 + .../src/v2/catalog_service_client.ts | 308 +- .../src/v2/catalog_service_client_config.json | 10 + .../src/v2/catalog_service_proto_list.json | 2 + .../src/v2/completion_service_client.ts | 785 + .../v2/completion_service_client_config.json | 36 + .../src/v2/completion_service_proto_list.json | 14 + .../src/v2/gapic_metadata.json | 126 + packages/google-cloud-retail/src/v2/index.ts | 2 + .../src/v2/prediction_service_client.ts | 63 +- .../src/v2/prediction_service_proto_list.json | 2 + .../src/v2/product_service_client.ts | 1139 +- .../src/v2/product_service_client_config.json | 20 + .../src/v2/product_service_proto_list.json | 2 + .../src/v2/search_service_client.ts | 1167 + .../src/v2/search_service_client_config.json | 31 + .../src/v2/search_service_proto_list.json | 14 + .../src/v2/user_event_service_client.ts | 2 +- .../src/v2/user_event_service_proto_list.json | 2 + .../src/v2alpha/catalog_service_client.ts | 320 +- .../catalog_service_client_config.json | 10 + .../v2alpha/catalog_service_proto_list.json | 3 + .../src/v2alpha/completion_service_client.ts | 790 + .../completion_service_client_config.json | 36 + .../completion_service_proto_list.json | 15 + .../src/v2alpha/gapic_metadata.json | 126 + .../google-cloud-retail/src/v2alpha/index.ts | 2 + .../src/v2alpha/prediction_service_client.ts | 63 +- .../prediction_service_proto_list.json | 3 + .../src/v2alpha/product_service_client.ts | 1184 +- .../product_service_client_config.json | 20 + .../v2alpha/product_service_proto_list.json | 3 + .../src/v2alpha/search_service_client.ts | 1203 + .../v2alpha/search_service_client_config.json | 31 + .../v2alpha/search_service_proto_list.json | 15 + .../src/v2alpha/user_event_service_client.ts | 10 +- .../user_event_service_proto_list.json | 3 + .../src/v2beta/catalog_service_client.ts | 320 +- .../v2beta/catalog_service_client_config.json | 10 + .../v2beta/catalog_service_proto_list.json | 3 + .../src/v2beta/completion_service_client.ts | 791 + .../completion_service_client_config.json | 36 + .../v2beta/completion_service_proto_list.json | 15 + .../src/v2beta/gapic_metadata.json | 126 + .../google-cloud-retail/src/v2beta/index.ts | 2 + .../src/v2beta/prediction_service_client.ts | 63 +- .../v2beta/prediction_service_proto_list.json | 3 + .../src/v2beta/product_service_client.ts | 1159 +- .../v2beta/product_service_client_config.json | 20 + .../v2beta/product_service_proto_list.json | 3 + .../src/v2beta/search_service_client.ts | 1173 + .../v2beta/search_service_client_config.json | 31 + .../src/v2beta/search_service_proto_list.json | 15 + .../src/v2beta/user_event_service_client.ts | 10 +- .../v2beta/user_event_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 2 + .../system-test/fixtures/sample/src/index.ts | 14 + .../test/gapic_catalog_service_v2.ts | 298 + .../test/gapic_catalog_service_v2alpha.ts | 298 + .../test/gapic_catalog_service_v2beta.ts | 298 + .../test/gapic_completion_service_v2.ts | 625 + .../test/gapic_completion_service_v2alpha.ts | 637 + .../test/gapic_completion_service_v2beta.ts | 647 + .../test/gapic_product_service_v2.ts | 926 + .../test/gapic_product_service_v2alpha.ts | 932 + .../test/gapic_product_service_v2beta.ts | 932 + .../test/gapic_search_service_v2.ts | 735 + .../test/gapic_search_service_v2alpha.ts | 737 + .../test/gapic_search_service_v2beta.ts | 737 + 109 files changed, 105941 insertions(+), 23164 deletions(-) create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto create mode 100644 packages/google-cloud-retail/src/v2/completion_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/completion_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/completion_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2/search_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/search_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/search_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/completion_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/search_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/search_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/completion_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/completion_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/search_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/search_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/search_service_proto_list.json create mode 100644 packages/google-cloud-retail/test/gapic_completion_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts create mode 100644 packages/google-cloud-retail/test/gapic_search_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_search_service_v2beta.ts diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto index ded4ebd06ec..20cd402c8c6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto @@ -19,6 +19,8 @@ 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/cloud/retail/v2/import_config.proto"; option csharp_namespace = "Google.Cloud.Retail.V2"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; @@ -55,9 +57,9 @@ message ProductLevelConfig { // [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. + // See [Using product + // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // for more details. string ingestion_product_type = 1; // Which field of [Merchant Center @@ -77,9 +79,9 @@ message ProductLevelConfig { // [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. + // See [Using product + // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // for more details. string merchant_center_product_id_field = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto index 4adda8df700..30858061b72 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto @@ -57,6 +57,67 @@ service CatalogService { }; option (google.api.method_signature) = "catalog,update_mask"; } + + // Set a specified branch id as default branch. API methods such as + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search], + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + // will treat requests using "default_branch" to the actual branch id set as + // default. + // + // For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as + // default, setting + // [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to + // `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent + // to setting + // [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to + // `projects/*/locations/*/catalogs/*/branches/1`. + // + // Using multiple branches can be useful when developers would like + // to have a staging branch to test and verify for future usage. When it + // becomes ready, developers switch on the staging branch using this API while + // keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` + // as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to + // route the traffic to this staging branch. + // + // CAUTION: If you have live predict/search traffic, switching the default + // branch could potentially cause outages if the ID space of the new branch is + // very different from the old one. + // + // More specifically: + // + // * PredictionService will only return product IDs from branch {newBranch}. + // * SearchService will only return product IDs from branch {newBranch} + // (if branch is not explicitly set). + // * UserEventService will only join events with products from branch + // {newBranch}. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc SetDefaultBranch(SetDefaultBranchRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch" + body: "*" + }; + option (google.api.method_signature) = "catalog"; + } + + // Get which branch is currently default branch set by + // [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] + // method under a specified parent catalog. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc GetDefaultBranch(GetDefaultBranchRequest) + returns (GetDefaultBranchResponse) { + option (google.api.http) = { + get: "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + }; + option (google.api.method_signature) = "catalog"; + } } // Request for @@ -125,12 +186,60 @@ message UpdateCatalogRequest { 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. + // [Catalog][google.cloud.retail.v2.Catalog] to update. // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. google.protobuf.FieldMask update_mask = 2; } + +// Request message to set a specified branch as new default_branch. +message SetDefaultBranchRequest { + // Full resource name of the catalog, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // The final component of the resource name of a branch. + // + // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + // error is returned. + string branch_id = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Some note on this request, this can be retrieved by + // [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch] + // before next valid default branch set occurs. + // + // This field must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string note = 3; +} + +// Request message to show which branch is currently the default branch. +message GetDefaultBranchRequest { + // The parent catalog resource name, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; +} + +// Response message of +// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]. +message GetDefaultBranchResponse { + // Full resource name of the branch id currently set as default branch. + string branch = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // The time when this branch is set to default. + google.protobuf.Timestamp set_time = 2; + + // This corresponds to + // [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note] + // field, when this branch was set as default. + string note = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 341126afcd9..e1e06f87c46 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -29,8 +29,73 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2"; option ruby_package = "Google::Cloud::Retail::V2"; +// An intended audience of the [Product][google.cloud.retail.v2.Product] for +// whom it's sold. +message Audience { + // The genders of the audience. Strongly encouraged to use the standard + // values: "male", "female", "unisex". + // + // At most 5 values are allowed. Each value 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 + // [gender](https://support.google.com/merchants/answer/6324479). Schema.org + // property + // [Product.audience.suggestedGender](https://schema.org/suggestedGender). + repeated string genders = 1; + + // The age groups of the audience. Strongly encouraged to use the standard + // values: "newborn" (up to 3 months old), "infant" (3–12 months old), + // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically + // teens or older). + // + // At most 5 values are allowed. Each value 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 + // [age_group](https://support.google.com/merchants/answer/6324463). + // Schema.org property + // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and + // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). + repeated string age_groups = 2; +} + +// The color information of a [Product][google.cloud.retail.v2.Product]. +message ColorInfo { + // The standard color families. Strongly recommended to use the following + // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", + // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and + // "Mixed". Normally it is expected to have only 1 color family. May consider + // using single "Mixed" instead of multiple values. + // + // A maximum of 5 values are allowed. Each value 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 + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + repeated string color_families = 1; + + // The color display names, which may be different from standard color family + // names, such as the color aliases used in the website frontend. Normally + // it is expected to have only 1 color. May consider using single "Mixed" + // instead of multiple values. + // + // A maximum of 5 colors are allowed. Each value 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 + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + repeated string colors = 2; +} + // A custom attribute that is not explicitly modeled in -// [Product][google.cloud.retail.v2.Product]]. +// [Product][google.cloud.retail.v2.Product]. message CustomAttribute { // The textual values of this custom attribute. For example, `["yellow", // "green"]` when the key is "color". @@ -54,6 +119,63 @@ message CustomAttribute { // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set. // Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; + + // If true, custom attribute values are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + // + // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. + // + // Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is + // set. Otherwise, a INVALID_ARGUMENT error is returned. + optional bool searchable = 3; + + // If true, custom attribute values are indexed, so that it can be filtered, + // faceted or boosted in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + // + // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. + // + // See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter], + // [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs] + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] + // for more details. + optional bool indexable = 4; +} + +// Fulfillment information, such as the store IDs for in-store pickup or region +// IDs for different shipping methods. +message FulfillmentInfo { + // The fulfillment type, including commonly used types (such as pickup in + // store and same day delivery), and custom types. Customers have to map + // custom types to their display names before rendering UI. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + string type = 1; + + // The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such + // as the store IDs for + // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type] + // or the region IDs for + // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type]. + // + // A maximum of 2000 values are allowed. Each value must be a string with a + // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as + // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. + repeated string place_ids = 2; } // [Product][google.cloud.retail.v2.Product] thumbnail/detail image. @@ -81,13 +203,71 @@ message Image { int32 width = 3; } +// A floating point interval. +message Interval { + // The lower bound of the interval. If neither of the min fields are set, then + // the lower bound is negative infinity. + // + // This field must be not larger than + // [max][google.cloud.retail.v2.Interval.max]. Otherwise, an INVALID_ARGUMENT + // error is returned. + oneof min { + // Inclusive lower bound. + double minimum = 1; + + // Exclusive lower bound. + double exclusive_minimum = 2; + } + + // The upper bound of the interval. If neither of the max fields are set, then + // the upper bound is positive infinity. + // + // This field must be not smaller than + // [min][google.cloud.retail.v2.Interval.min]. Otherwise, an INVALID_ARGUMENT + // error is returned. + oneof max { + // Inclusive upper bound. + double maximum = 3; + + // Exclusive upper bound. + double exclusive_maximum = 4; + } +} + // The price information of a [Product][google.cloud.retail.v2.Product]. message PriceInfo { + // The price range of all + // [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]. + message PriceRange { + // The inclusive + // [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price] + // interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]. + Interval price = 1; + + // The inclusive + // [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price] + // internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]. + Interval original_price = 2; + } + // 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. + // + // The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s with the same + // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id] + // must share the same + // [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise, + // a FAILED_PRECONDITION error is returned. string currency_code = 1; // Price of the product. @@ -110,6 +290,73 @@ message PriceInfo { // Google Merchant Center property // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). float cost = 4; + + // The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price] + // starts to be effective. This can be set as a future timestamp, and the + // [price][google.cloud.retail.v2.PriceInfo.price] is only used for search + // after + // [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time]. + // If so, the + // [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be + // set and [original_price][google.cloud.retail.v2.PriceInfo.original_price] + // is used before + // [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time]. + // + // Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always + // effective because it will cause additional latency during search. + google.protobuf.Timestamp price_effective_time = 5; + + // The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price] + // stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price] + // is used for search before + // [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If + // this field is set, the + // [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be + // set and [original_price][google.cloud.retail.v2.PriceInfo.original_price] + // is used after + // [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. + // + // Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always + // effective because it will cause additional latency during search. + google.protobuf.Timestamp price_expire_time = 6; + + // Output only. The price range of all the child + // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s grouped together on the + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]. Only populated for + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]s. + // + // Note: This field is OUTPUT_ONLY for + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]. + // Do not set this field in API requests. + PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The rating of a [Product][google.cloud.retail.v2.Product]. +message Rating { + // The total number of ratings. This value is independent of the value of + // [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram]. + // + // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + // returned. + int32 rating_count = 1; + + // The average rating of the [Product][google.cloud.retail.v2.Product]. + // + // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is + // returned. + float average_rating = 2; + + // List of rating counts per rating value (index = rating - 1). The list is + // empty if there is no rating. If the list is non-empty, its size is + // always 5. Otherwise, an INVALID_ARGUMENT error is returned. + // + // For example, [41, 14, 13, 47, 303]. It means that the + // [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14 + // ratings with 2 star, and so on. + repeated int32 rating_histogram = 3; } // Information of an end user. @@ -121,8 +368,9 @@ message UserInfo { // 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. + // The end user's IP address. Required for getting + // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results]. + // 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 @@ -135,7 +383,8 @@ message UserInfo { // is set. string ip_address = 2; - // User agent as included in the HTTP header. + // User agent as included in the HTTP header. Required for getting + // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results]. // // The field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -159,3 +408,17 @@ message UserInfo { // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]. bool direct_user_request = 4; } + +// Promotion information. +message Promotion { + // ID of the promotion. For example, "free gift". + // + // The value value must be a UTF-8 encoded string with a length limit of 128 + // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, + // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Google Merchant Center property + // [promotion](https://support.google.com/merchants/answer/7050148). + string promotion_id = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto new file mode 100644 index 00000000000..478dac63e1c --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -0,0 +1,193 @@ +// 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/common.proto"; +import "google/cloud/retail/v2/import_config.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 = "CompletionServiceProto"; +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"; + +// Auto-completion service for retail. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com) if you are +// interested in using Retail Search. +service CompletionService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Completes the specified prefix with keyword suggestions. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { + option (google.api.http) = { + get: "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }; + } + + // Bulk import of processed completion dataset. + // + // Request processing may be synchronous. Partial updating is not supported. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc ImportCompletionData(ImportCompletionDataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.ImportCompletionDataResponse" + metadata_type: "google.cloud.retail.v2.ImportMetadata" + }; + } +} + +// Auto-complete parameters. +message CompleteQueryRequest { + // Required. Catalog for which the completion is performed. + // + // Full resource name of catalog, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The query used to generate suggestions. + // + // The maximum number of allowed characters is 255. + string query = 2 [(google.api.field_behavior) = 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 logs in or 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 = 7; + + // The list of languages of the query. This is + // the BCP-47 language code, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // The maximum number of allowed characters is 255. + // Only "en-US" is currently supported. + repeated string language_codes = 3; + + // The device type context for completion suggestions. + // It is useful to apply different suggestions on different device types, e.g. + // DESKTOP, MOBILE. If it is empty, the suggestions are across all device + // types. + // + // Supported formats: + // + // * UNKNOWN_DEVICE_TYPE + // + // * DESKTOP + // + // * MOBILE + // + // * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + string device_type = 4; + + // Determines which dataset to use for fetching completion. "user-data" will + // use the imported dataset through + // [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. + // "cloud-retail" will use the dataset generated by cloud retail based on user + // events. If leave empty, it will use the "user-data". + // + // Current supported values: + // + // * user-data + // + // * cloud-retail + // This option is not automatically enabled. Before using cloud-retail, + // contact retail-search-support@google.com first. + string dataset = 6; + + // Completion max suggestions. + // + // The maximum allowed max suggestions is 20. The default value is 20. + int32 max_suggestions = 5; +} + +// Response of the auto-complete query. +message CompleteQueryResponse { + // Resource that represents completion results. + message CompletionResult { + // The suggestion for the query. + string suggestion = 1; + + // Additional custom attributes ingested through BigQuery. + map attributes = 2; + } + + // Recent search of this user. + message RecentSearchResult { + // The recent search query. + string recent_search = 1; + } + + // Results of the matching suggestions. The result list is ordered and the + // first result is top suggestion. + repeated CompletionResult completion_results = 1; + + // A unique complete token. This should be included in the + // [SearchRequest][google.cloud.retail.v2.SearchRequest] resulting from this + // completion, which enables accurate attribution of complete model + // performance. + string attribution_token = 2; + + // Matched recent searches of this user. This field is a restricted feature. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in enabling it. + // + // This feature is only available when + // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id] + // field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported. + // The recent searches satisfy the follow rules: + // * They are ordered from latest to oldest. + // * They are matched with + // [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query] + // case insensitively. + // * They are transformed to lower cases. + // * They are UTF-8 safe. + // + // Recent searches are deduplicated. More recent searches will be reserved + // when duplication happens. + repeated RecentSearchResult recent_search_results = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index 3d4c26867f2..1fb849daf08 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -18,11 +18,13 @@ 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/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"; +import "google/type/date.proto"; option csharp_namespace = "Google.Cloud.Retail.V2"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; @@ -42,7 +44,7 @@ message GcsSource { // 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](https://cloud.google.com/recommendations-ai/docs/upload-catalog) + // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) // for the expected file format and setup instructions. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; @@ -61,15 +63,26 @@ message GcsSource { // * `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. + // https://support.google.com/analytics/answer/3437719. 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 + // BigQuery table partition info. Leave this empty if the BigQuery table + // is not partitioned. + oneof partition { + // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + google.type.Date partition_date = 6; + } + + // 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. + // ID from the parent request. string project_id = 5; // Required. The BigQuery data set to copy the data from with a length limit @@ -100,7 +113,7 @@ message BigQuerySource { // * `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. + // https://support.google.com/analytics/answer/3437719. string data_schema = 4; } @@ -108,7 +121,7 @@ message BigQuerySource { 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. + // 100 items. repeated Product products = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -132,12 +145,51 @@ message ImportErrorsConfig { // Request message for Import methods. message ImportProductsRequest { + // Indicates how imported products are reconciled with the existing products + // created or imported before. + enum ReconciliationMode { + // Defaults to INCREMENTAL. + RECONCILIATION_MODE_UNSPECIFIED = 0; + + // Inserts new products or updates existing products. + INCREMENTAL = 1; + + // Calculates diff and replaces the entire product dataset. Existing + // products may be deleted if they are not present in the source location. + // + // Can only be while using + // [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. + // + // Add the IAM permission “BigQuery Data Viewer” for + // cloud-retail-customer-data-access@system.gserviceaccount.com before + // using this feature otherwise an error is thrown. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + FULL = 2; + } + // 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]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Unique identifier provided by client, within the ancestor + // dataset scope. Ensures idempotency and used for request deduplication. + // Server-generated if unspecified. Up to 128 characters long and must match + // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + // [ImportMetadata][google.cloud.retail.v2.ImportMetadata]. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + string request_id = 6; // Required. The desired input location of the data. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -148,12 +200,31 @@ message ImportProductsRequest { // 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; + + // The mode of reconciliation between existing products and the products to be + // imported. Defaults to + // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + ReconciliationMode reconciliation_mode = 5; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + string notification_pubsub_topic = 7; } // Request message for the ImportUserEvents request. message ImportUserEventsRequest { // Required. `projects/1234/locations/global/catalogs/default_catalog` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // Required. The desired input location of the data. UserEventInputConfig input_config = 2 @@ -164,6 +235,28 @@ message ImportUserEventsRequest { ImportErrorsConfig errors_config = 3; } +// Request message for ImportCompletionData methods. +message ImportCompletionDataRequest { + // Required. The catalog which the suggestions dataset belongs to. + // + // Format: `projects/1234/locations/global/catalogs/default_catalog`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The desired input location of the data. + CompletionDataInputConfig input_config = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + string notification_pubsub_topic = 3; +} + // The input config source for products. message ProductInputConfig { // Required. The source of the input. @@ -196,6 +289,28 @@ message UserEventInputConfig { } } +// The input config source for completion data. +message CompletionDataInputConfig { + // The source of the input. + // + // Supported + // [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema] + // values for suggestions imports: + // + // * `suggestions` (default): One JSON completion suggestion per line. + // * `denylist`: One JSON deny suggestion per line. + // * `allowlist`: One JSON allow suggestion per line. + oneof source { + // Required. BigQuery input source. + // + // Add the IAM permission “BigQuery Data Viewer” for + // cloud-retail-customer-data-access@system.gserviceaccount.com before + // using this feature otherwise an error is thrown. + BigQuerySource big_query_source = 1 + [(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 { @@ -211,6 +326,17 @@ message ImportMetadata { // Count of entries that encountered errors while processing. int64 failure_count = 4; + + // Id of the request / operation. This is parroting back the requestId + // that was passed in the request. + string request_id = 5; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + string notification_pubsub_topic = 6; } // Response of the @@ -250,3 +376,12 @@ message UserEventImportSummary { // in the imported catalog. int64 unjoined_events_count = 2; } + +// Response of the +// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest]. +// If the long running operation is done, this message is returned by the +// google.longrunning.Operations.response field if the operation is successful. +message ImportCompletionDataResponse { + // A sample of errors encountered while processing the request. + repeated google.rpc.Status error_samples = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto index d5f68ebd2fe..067f872bf9d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto @@ -50,30 +50,10 @@ service PredictionService { 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 ID of the Recommendations AI placement. Before you can request + // predictions from your model, you must create at least one placement for it. + // For more information, see [Managing + // placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). // // The full list of available placements can be seen at // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements @@ -104,6 +84,9 @@ message PredictRequest { // `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings // with a size limit of 1,000 characters. // + // Note: "Recently viewed" models don't support tag filtering at the + // moment. + // // * filterOutOfStockItems. Restricts predictions to products that do not // have a // stockState value of OUT_OF_STOCK. @@ -140,17 +123,35 @@ message PredictRequest { // * `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. + // * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + // it needs to be one of {'no-price-reranking', 'low-price-reranking', + // 'medium-price-reranking', 'high-price-reranking'}. This gives + // request-level control and adjusts prediction results based on product + // price. + // * `diversityLevel`: String. Default empty. If set to be non-empty, then + // it needs to be one of {'no-diversity', 'low-diversity', + // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + // request-level control and adjusts prediction results based on product + // category. map params = 7; - // The labels for the predict request. + // The labels applied to a resource must meet the following requirements: // - // * 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. + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters, and cannot be empty. Values can be empty, and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. // - // See https://goo.gl/xmQnxf for more information on and examples of labels. + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. map labels = 8; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index d93b0717231..746dc6259e2 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -20,6 +20,7 @@ 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/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; @@ -48,7 +49,8 @@ message Product { // The type of this product. enum Type { // Default value. Default to - // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if unset. + // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type] + // if unset. TYPE_UNSPECIFIED = 0; // The primary type. @@ -100,6 +102,43 @@ message Product { BACKORDER = 4; } + oneof expiration { + // The timestamp when this product becomes unavailable for + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + // + // If it is set, the [Product][google.cloud.retail.v2.Product] is not + // available for + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after + // [expire_time][google.cloud.retail.v2.Product.expire_time]. However, the + // product can still be retrieved by + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // and + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // + // Google Merchant Center property + // [expiration_date](https://support.google.com/merchants/answer/6324499). + google.protobuf.Timestamp expire_time = 16; + + // Input only. The TTL (time to live) of the product. + // + // If it is set, [expire_time][google.cloud.retail.v2.Product.expire_time] + // is set as current timestamp plus + // [ttl][google.cloud.retail.v2.Product.ttl]. The derived + // [expire_time][google.cloud.retail.v2.Product.expire_time] is returned in + // the output and [ttl][google.cloud.retail.v2.Product.ttl] is left blank + // when retrieving the [Product][google.cloud.retail.v2.Product]. + // + // If it is set, the product is not available for + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after + // current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. + // However, the product can still be retrieved by + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // and + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + google.protobuf.Duration ttl = 17 + [(google.api.field_behavior) = INPUT_ONLY]; + } + // Immutable. Full resource name of the product, such as // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`. // @@ -120,7 +159,9 @@ message Product { // 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. + // Immutable. The type of the product. Default to + // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type] + // if unset. Type type = 3 [(google.api.field_behavior) = IMMUTABLE]; // Variant group identifier. Must be an @@ -146,6 +187,31 @@ message Product { // more](/recommendations-ai/docs/catalog#item-group-id). string primary_product_id = 4; + // The [id][google.cloud.retail.v2.Product.id] of the collection members when + // [type][google.cloud.retail.v2.Product.type] is + // [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]. + // + // Should not set it for other types. A maximum of 1000 values are allowed. + // Otherwise, an INVALID_ARGUMENT error is return. + repeated string collection_member_ids = 5; + + // The Global Trade Item Number (GTIN) of the product. + // + // 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 + // [gtin](https://support.google.com/merchants/answer/6324461). + // Schema.org property + // [Product.isbn](https://schema.org/isbn) or + // [Product.gtin8](https://schema.org/gtin8) or + // [Product.gtin12](https://schema.org/gtin12) or + // [Product.gtin13](https://schema.org/gtin13) or + // [Product.gtin14](https://schema.org/gtin14). + // + // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. + string gtin = 6; + // 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. @@ -184,7 +250,7 @@ message Product { // Required. Product title. // - // This field must be a UTF-8 encoded string with a length limit of 128 + // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // Google Merchant Center property @@ -192,6 +258,17 @@ message Product { // property [Product.name](https://schema.org/name). string title = 8 [(google.api.field_behavior) = REQUIRED]; + // The brands of the product. + // + // A maximum of 30 brands are allowed. Each brand must be a UTF-8 encoded + // string with a length limit of 1,000 characters. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [brand](https://support.google.com/merchants/answer/6324351). Schema.org + // property [Product.brand](https://schema.org/brand). + repeated string brands = 9; + // Product description. // // This field must be a UTF-8 encoded string with a length limit of 5,000 @@ -202,6 +279,18 @@ message Product { // schema.org property [Product.description](https://schema.org/description). string description = 10; + // Language of the title/description and other string attributes. Use language + // tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt]. + // + // For product prediction, this field is ignored and the model automatically + // detects the text language. The [Product][google.cloud.retail.v2.Product] + // can include text in different languages, but duplicating + // [Product][google.cloud.retail.v2.Product]s to provide text in multiple + // languages can result in degraded model performance. + // + // For product search this field is in use. It defaults to "en-US" if unset. + string language_code = 11; + // 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 @@ -218,11 +307,18 @@ message Product { // "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. + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * Max entries count: 200 by default; 100 for + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. + // * The key must be a UTF-8 encoded string with a length limit of 128 + // characters. + // * Max indexable entries count: 200 by default; 40 for + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. + // * Max searchable entries count: 30. + // * For indexable attribute, the key must match the pattern: + // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; // Custom tags associated with the product. @@ -246,8 +342,12 @@ message Product { // [price](https://support.google.com/merchants/answer/6324371). PriceInfo price_info = 14; + // The rating of this product. + Rating rating = 15; + // The timestamp when this [Product][google.cloud.retail.v2.Product] becomes - // available recommendation and search. + // available for + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. google.protobuf.Timestamp available_time = 18; // The online availability of the [Product][google.cloud.retail.v2.Product]. @@ -262,8 +362,19 @@ message Product { // The available quantity of the item. google.protobuf.Int32Value available_quantity = 20; + // Fulfillment information, such as the store IDs for in-store pickup or + // region IDs for different shipping methods. + // + // All the elements must have distinct + // [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]. + // Otherwise, an INVALID_ARGUMENT error is returned. + repeated FulfillmentInfo fulfillment_info = 21; + // Canonical URL directly linking to the product detail page. // + // It is strongly recommended to provide a valid uri for the product, + // otherwise the service performance could be significantly degraded. + // // This field must be a UTF-8 encoded string with a length limit of 5,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // @@ -272,7 +383,8 @@ message Product { // property [Offer.url](https://schema.org/url). string uri = 22; - // Product images for the product. + // Product images for the product.Highly recommended to put the main image + // to the first. // // A maximum of 300 images are allowed. // @@ -280,4 +392,152 @@ message Product { // [image_link](https://support.google.com/merchants/answer/6324350). // Schema.org property [Product.image](https://schema.org/image). repeated Image images = 23; + + // The target group associated with a given audience (e.g. male, veterans, + // car owners, musicians, etc.) of the product. + Audience audience = 24; + + // The color of the product. + // + // Google Merchant Center property + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + ColorInfo color_info = 25; + + // The size of the product. To represent different size systems or size types, + // consider using this format: [[[size_system:]size_type:]size_value]. + // + // For example, in "US:MENS:M", "US" represents size system; "MENS" represents + // size type; "M" represents size value. In "GIRLS:27", size system is empty; + // "GIRLS" represents size type; "27" represents size value. In "32 inches", + // both size system and size type are empty, while size value is "32 inches". + // + // A maximum of 20 values are allowed per + // [Product][google.cloud.retail.v2.Product]. Each value 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 + // [size](https://support.google.com/merchants/answer/6324492), + // [size_type](https://support.google.com/merchants/answer/6324497) and + // [size_system](https://support.google.com/merchants/answer/6324502). + // Schema.org property [Product.size](https://schema.org/size). + repeated string sizes = 26; + + // The material of the product. For example, "leather", "wooden". + // + // A maximum of 5 values are allowed. Each value 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 + // [material](https://support.google.com/merchants/answer/6324410). Schema.org + // property [Product.material](https://schema.org/material). + repeated string materials = 27; + + // The pattern or graphic print of the product. For example, "striped", "polka + // dot", "paisley". + // + // A maximum of 5 values are allowed per + // [Product][google.cloud.retail.v2.Product]. Each value 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 + // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org + // property [Product.pattern](https://schema.org/pattern). + repeated string patterns = 28; + + // The condition of the product. Strongly encouraged to use the standard + // values: "new", "refurbished", "used". + // + // A maximum of 5 values are allowed per + // [Product][google.cloud.retail.v2.Product]. Each value 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 + // [condition](https://support.google.com/merchants/answer/6324469). + // Schema.org property + // [Offer.itemCondition](https://schema.org/itemCondition). + repeated string conditions = 29; + + // The promotions applied to the product. A maximum of 10 values are allowed + // per [Product][google.cloud.retail.v2.Product]. + repeated Promotion promotions = 34; + + // The timestamp when the product is published by the retailer for the first + // time, which indicates the freshness of the products. Note that this field + // is different from + // [available_time][google.cloud.retail.v2.Product.available_time], given it + // purely describes product freshness regardless of when it is available on + // search and recommendation. + google.protobuf.Timestamp publish_time = 33; + + // Indicates which fields in the [Product][google.cloud.retail.v2.Product]s + // are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse]. + // + // Supported fields for all [type][google.cloud.retail.v2.Product.type]s: + // + // * [audience][google.cloud.retail.v2.Product.audience] + // * [availability][google.cloud.retail.v2.Product.availability] + // * [brands][google.cloud.retail.v2.Product.brands] + // * [color_info][google.cloud.retail.v2.Product.color_info] + // * [conditions][google.cloud.retail.v2.Product.conditions] + // * [gtin][google.cloud.retail.v2.Product.gtin] + // * [materials][google.cloud.retail.v2.Product.materials] + // * [name][google.cloud.retail.v2.Product.name] + // * [patterns][google.cloud.retail.v2.Product.patterns] + // * [price_info][google.cloud.retail.v2.Product.price_info] + // * [rating][google.cloud.retail.v2.Product.rating] + // * [sizes][google.cloud.retail.v2.Product.sizes] + // * [title][google.cloud.retail.v2.Product.title] + // * [uri][google.cloud.retail.v2.Product.uri] + // + // Supported fields only for + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and + // [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]: + // + // * [categories][google.cloud.retail.v2.Product.categories] + // * [description][google.cloud.retail.v2.Product.description] + // * [images][google.cloud.retail.v2.Product.images] + // + // Supported fields only for + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]: + // + // * Only the first image in [images][google.cloud.retail.v2.Product.images] + // + // To mark [attributes][google.cloud.retail.v2.Product.attributes] as + // retrievable, include paths of the form "attributes.key" where "key" is the + // key of a custom attribute, as specified in + // [attributes][google.cloud.retail.v2.Product.attributes]. + // + // For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and + // [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the + // following fields are always returned in + // [SearchResponse][google.cloud.retail.v2.SearchResponse] by default: + // + // * [name][google.cloud.retail.v2.Product.name] + // + // For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the + // following fields are always returned in by default: + // + // * [name][google.cloud.retail.v2.Product.name] + // * [color_info][google.cloud.retail.v2.Product.color_info] + // + // Maximum number of paths is 20. Otherwise, an INVALID_ARGUMENT error is + // returned. + google.protobuf.FieldMask retrievable_fields = 30; + + // Output only. Product variants grouped together on primary product which + // share similar product attributes. It's automatically grouped by + // [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for + // all the product variants. Only populated for + // [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]s. + // + // Note: This field is OUTPUT_ONLY for + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]. + // Do not set this field in API requests. + repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index b4130502352..dac78fbc5e7 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -26,6 +26,7 @@ import "google/cloud/retail/v2/purge_config.proto"; import "google/longrunning/operations.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"; @@ -60,6 +61,14 @@ service ProductService { option (google.api.method_signature) = "name"; } + // Gets a list of [Product][google.cloud.retail.v2.Product]s. + rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + }; + option (google.api.method_signature) = "parent"; + } + // Updates a [Product][google.cloud.retail.v2.Product]. rpc UpdateProduct(UpdateProductRequest) returns (Product) { option (google.api.http) = { @@ -95,6 +104,114 @@ service ProductService { metadata_type: "google.cloud.retail.v2.ImportMetadata" }; } + + // Updates inventory information for a + // [Product][google.cloud.retail.v2.Product] while respecting the last update + // timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, updates are not immediately manifested in the + // [Product][google.cloud.retail.v2.Product] queried by + // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // + // When inventory is updated with + // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and + // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the + // specified inventory field value(s) will overwrite any existing value(s) + // while ignoring the last update time for this field. Furthermore, the last + // update time for the specified inventory fields will be overwritten to the + // time of the + // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or + // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + // request. + // + // If no inventory fields are set in + // [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], + // then any pre-existing inventory information for this product will be used. + // + // If no inventory fields are set in [UpdateProductRequest.set_mask][], + // then any existing inventory information will be preserved. + // + // Pre-existing inventory information can only be updated with + // [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], + // [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], + // and + // [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" + body: "*" + }; + option (google.api.method_signature) = "inventory,set_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.SetInventoryResponse" + metadata_type: "google.cloud.retail.v2.SetInventoryMetadata" + }; + } + + // Incrementally adds place IDs to + // [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, the added place IDs are not immediately manifested in the + // [Product][google.cloud.retail.v2.Product] queried by + // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.AddFulfillmentPlacesResponse" + metadata_type: "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" + }; + } + + // Incrementally removes place IDs from a + // [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, the removed place IDs are not immediately manifested in the + // [Product][google.cloud.retail.v2.Product] queried by + // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse" + metadata_type: "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" + }; + } } // Request message for [CreateProduct][] method. @@ -153,8 +270,10 @@ message UpdateProductRequest { // [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. + // If the [Product][google.cloud.retail.v2.Product] to update does not exist + // and + // [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing] + // is not set, a NOT_FOUND error is returned. Product product = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which fields in the provided @@ -165,6 +284,11 @@ message UpdateProductRequest { // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the [Product][google.cloud.retail.v2.Product] is not + // found, a new [Product][google.cloud.retail.v2.Product] will be created. In + // this situation, `update_mask` is ignored. + bool allow_missing = 3; } // Request message for [DeleteProduct][] method. @@ -179,8 +303,337 @@ message DeleteProductRequest { // // If the [Product][google.cloud.retail.v2.Product] to delete does not exist, // a NOT_FOUND error is returned. + // + // The [Product][google.cloud.retail.v2.Product] to delete can neither be a + // [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2.Product] member nor a + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product] with more than one + // [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // All inventory information for the named + // [Product][google.cloud.retail.v2.Product] will be deleted. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } ]; } + +// Request message for +// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] +// method. +message ListProductsRequest { + // Required. The parent branch resource name, such as + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use + // `default_branch` as the branch ID, to list products under the default + // branch. + // + // If the caller does not have permission to list + // [Product][google.cloud.retail.v2.Product]s under this branch, regardless of + // whether or not this branch exists, a PERMISSION_DENIED error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If + // unspecified, defaults to 100. The maximum allowed value is 1000. Values + // above 1000 will be coerced to 1000. + // + // If this field is negative, an INVALID_ARGUMENT error is returned. + int32 page_size = 2; + + // A page token + // [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token], + // received from a previous + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + // must match the call that provided the page token. Otherwise, an + // INVALID_ARGUMENT error is returned. + string page_token = 3; + + // A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset. + // * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s sharing the same + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product]. For example: + // `primary_product_id = "some_product_id"` + // * List [Product][google.cloud.retail.v2.Product]s bundled in a + // [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2.Product]. + // For example: + // `collection_product_id = "some_product_id"` + // * List [Product][google.cloud.retail.v2.Product]s with a partibular type. + // For example: + // `type = "PRIMARY"` + // `type = "VARIANT"` + // `type = "COLLECTION"` + // + // If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + // + // If the specified + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2.Product] or + // [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error + // is returned. + string filter = 4; + + // The fields of [Product][google.cloud.retail.v2.Product] to return in the + // responses. If not set or empty, the following fields are returned: + // + // * [Product.name][google.cloud.retail.v2.Product.name] + // * [Product.id][google.cloud.retail.v2.Product.id] + // * [Product.title][google.cloud.retail.v2.Product.title] + // * [Product.uri][google.cloud.retail.v2.Product.uri] + // * [Product.images][google.cloud.retail.v2.Product.images] + // * [Product.price_info][google.cloud.retail.v2.Product.price_info] + // * [Product.brands][google.cloud.retail.v2.Product.brands] + // + // If "*" is provided, all fields are returned. + // [Product.name][google.cloud.retail.v2.Product.name] is always returned no + // matter what mask is set. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned. + google.protobuf.FieldMask read_mask = 5; +} + +// Response message for +// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] +// method. +message ListProductsResponse { + // The [Product][google.cloud.retail.v2.Product]s. + repeated Product products = 1; + + // A token that can be sent as + // [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 2; +} + +// Request message for [SetInventory][] method. +message SetInventoryRequest { + // Required. The inventory information to update. The allowable fields to + // update are: + // * [Product.price_info][google.cloud.retail.v2.Product.price_info] + // * [Product.availability][google.cloud.retail.v2.Product.availability] + // * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] + // * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] + // The updated inventory fields must be specified in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]. + // + // If [SetInventoryRequest.inventory.name][] is empty or invalid, an + // INVALID_ARGUMENT error is returned. + // + // If the caller does not have permission to update the + // [Product][google.cloud.retail.v2.Product] named in + // [Product.name][google.cloud.retail.v2.Product.name], 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 have + // existing inventory information, the provided inventory information will be + // inserted. + // + // If the [Product][google.cloud.retail.v2.Product] to update has existing + // inventory information, the provided inventory information will be merged + // while respecting the last update time for each inventory field, using the + // provided or default value for + // [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time]. + // + // The last update time is recorded for the following inventory fields: + // * [Product.price_info][google.cloud.retail.v2.Product.price_info] + // * [Product.availability][google.cloud.retail.v2.Product.availability] + // * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] + // * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] + // + // If a full overwrite of inventory information while ignoring timestamps is + // needed, [UpdateProduct][] should be invoked instead. + Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided + // [Product][google.cloud.retail.v2.Product] to update. If not set or set with + // empty paths, all inventory fields will be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask set_mask = 2; + + // The time when the request is issued, used to prevent + // out-of-order updates on inventory fields with the last update time + // recorded. If not provided, the internal system time will be used. + google.protobuf.Timestamp set_time = 3; + + // If set to true, and the [Product][google.cloud.retail.v2.Product] with name + // [Product.name][google.cloud.retail.v2.Product.name] is not found, the + // inventory update will still be processed and retained for at most 1 day + // until the [Product][google.cloud.retail.v2.Product] is created. If set to + // false, an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2.Product] is not found. + bool allow_missing = 4; +} + +// Metadata related to the progress of the SetInventory operation. +// Currently empty because there is no meaningful metadata populated from the +// [SetInventory][] method. +message SetInventoryMetadata {} + +// Response of the SetInventoryRequest. Currently empty because +// there is no meaningful response populated from the [SetInventory][] +// method. +message SetInventoryResponse {} + +// Request message for [AddFulfillmentPlaces][] method. +message AddFulfillmentPlacesRequest { + // 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. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. The fulfillment type, including commonly used types (such as + // pickup in store and same day delivery), and custom types. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // This field directly corresponds to [Product.fulfillment_info.type][]. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IDs for this + // [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as + // the store IDs for "pickup-in-store" or the region IDs for + // "same-day-delivery" to be added for this + // [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate + // IDs will be automatically ignored. + // + // At least 1 value is required, and a maximum of 2000 values are allowed. + // Each value must be a string with a length limit of 10 characters, matching + // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // If the total number of place IDs exceeds 2000 for this + // [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after + // adding, then the update will be rejected. + repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; + + // The time when the fulfillment updates are issued, used to prevent + // out-of-order updates on fulfillment information. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 4; + + // If set to true, and the [Product][google.cloud.retail.v2.Product] is not + // found, the fulfillment information will still be processed and retained for + // at most 1 day and processed once the + // [Product][google.cloud.retail.v2.Product] is created. If set to false, an + // INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2.Product] is not found. + bool allow_missing = 5; +} + +// Metadata related to the progress of the AddFulfillmentPlaces operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddFulfillmentPlaces][] method. +message AddFulfillmentPlacesMetadata {} + +// Response of the RemoveFulfillmentPlacesRequest. Currently empty because +// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// method. +message AddFulfillmentPlacesResponse {} + +// Request message for [RemoveFulfillmentPlaces][] method. +message RemoveFulfillmentPlacesRequest { + // 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. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. The fulfillment type, including commonly used types (such as + // pickup in store and same day delivery), and custom types. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // This field directly corresponds to [Product.fulfillment_info.type][]. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IDs for this + // [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as + // the store IDs for "pickup-in-store" or the region IDs for + // "same-day-delivery", to be removed for this + // [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]. + // + // At least 1 value is required, and a maximum of 2000 values are allowed. + // Each value must be a string with a length limit of 10 characters, matching + // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // INVALID_ARGUMENT error is returned. + repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; + + // The time when the fulfillment updates are issued, used to prevent + // out-of-order updates on fulfillment information. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp remove_time = 4; + + // If set to true, and the [Product][google.cloud.retail.v2.Product] is not + // found, the fulfillment information will still be processed and retained for + // at most 1 day and processed once the + // [Product][google.cloud.retail.v2.Product] is created. If set to false, an + // INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2.Product] is not found. + bool allow_missing = 5; +} + +// Metadata related to the progress of the RemoveFulfillmentPlaces operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveFulfillmentPlaces][] method. +message RemoveFulfillmentPlacesMetadata {} + +// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there +// is no meaningful response populated from the [RemoveFulfillmentPlaces][] +// method. +message RemoveFulfillmentPlacesResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto index d9cf6b82705..588bb39b76f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto @@ -36,7 +36,7 @@ message PurgeMetadata {} message PurgeUserEventsRequest { // Required. The resource name of the catalog under which the events are // created. The format is - // "projects/${projectId}/locations/global/catalogs/${catalogId}" + // `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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto new file mode 100644 index 00000000000..36b46041e43 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -0,0 +1,805 @@ +// 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/common.proto"; +import "google/cloud/retail/v2/product.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.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 = "SearchServiceProto"; +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 search. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com) if you are +// interested in using Retail Search. +service SearchService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Performs a search. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc Search(SearchRequest) returns (SearchResponse) { + option (google.api.http) = { + post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" + body: "*" + }; + } +} + +// Request message for +// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method. +message SearchRequest { + // A facet specification to perform faceted search. + message FacetSpec { + // Specifies how a facet is computed. + message FacetKey { + // Required. Supported textual and numerical facet keys in + // [Product][google.cloud.retail.v2.Product] object, over which the facet + // values are computed. Facet key is case-sensitive. + // + // Allowed facet keys when + // [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query] + // is not specified: + // + // * textual_field =
+ // + // *# The + // [Product.brands][google.cloud.retail.v2.Product.brands].
* + //
+ // "brands"; + //
+ // + // *# The + // [Product.categories][google.cloud.retail.v2.Product.categories].
* + //
+ // "categories"; + //
+ // + // *# The + // [Audience.genders][google.cloud.retail.v2.Audience.genders].
* + //
+ // | "genders"; + //
+ // + // *# The + // [Audience.age_groups][google.cloud.retail.v2.Audience.age_groups].
* + //
+ // | "ageGroups"; + //
+ // + // *# The + // [Product.availability][google.cloud.retail.v2.Product.availability]. + // Value is one of
* + // *# "IN_STOCK", "OUT_OF_STOCK", PREORDER", "BACKORDER".
* + //
+ // | "availability"; + //
+ // + // *# The + // [ColorInfo.color_families][google.cloud.retail.v2.ColorInfo.color_families].
* + //
+ // | "colorFamilies"; + //
+ // + // *# The + // [ColorInfo.colors][google.cloud.retail.v2.ColorInfo.colors].
* + //
+ // | "colors"; + //
+ // + // *# The [Product.sizes][google.cloud.retail.v2.Product.sizes].
* + //
+ // | "sizes"; + //
+ // + // *# The + // [Product.materials][google.cloud.retail.v2.Product.materials].
* + //
+ // | "materials"; + //
+ // + // *# The + // [Product.patterns][google.cloud.retail.v2.Product.patterns].
* + //
+ // | "patterns"; + //
+ // + // *# The + // [Product.conditions][google.cloud.retail.v2.Product.conditions].
* + //
+ // | "conditions"; + //
+ // + // *# The textual custom attribute in + // [Product][google.cloud.retail.v2.Product] object. Key can
* + // *# be any key in the + // [Product.attributes][google.cloud.retail.v2.Product.attributes] + // map
* + // *# if the attribute values are textual.
* + // *# map.
* + //
+ // | "attributes.key"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.PICKUP_IN_STORE][].
* + //
+ // | "pickupInStore"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.SHIP_TO_STORE][].
* + //
+ // | "shipToStore"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
* + //
+ // | "sameDayDelivery"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
* + //
+ // | "nextDayDelivery"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
* + //
+ // | "customFulfillment1"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
* + //
+ // | "customFulfillment2"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
* + //
+ // | "customFulfillment3"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
* + //
+ // | "customFulfillment4"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
* + //
+ // | "customFulfillment5"; + // + // * numerical_field =
+ // + // *# The + // [PriceInfo.price][google.cloud.retail.v2.PriceInfo.price].
* + //
+ // "price"; + //
+ // + // *# The discount. Computed by (original_price-price)/price
* + //
+ // "discount"; + //
+ // + // *# The + // [Rating.average_rating][google.cloud.retail.v2.Rating.average_rating].
* + //
+ // "rating"; + //
+ // + // *# The + // [Rating.rating_count][google.cloud.retail.v2.Rating.rating_count].
* + //
+ // "ratingCount"; + //
+ // + // *# The numerical custom attribute in + // [Product][google.cloud.retail.v2.Product] object. Key can
* + // *# be any key in the + // [Product.attributes][google.cloud.retail.v2.Product.attributes] + // map
* + // *# if the attribute values are numerical.
* + //
+ // | "attributes.key"; + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Set only if values should be bucketized into intervals. Must be set + // for facets with numerical values. Must not be set for facet with text + // values. Maximum number of intervals is 30. + repeated Interval intervals = 2; + + // Only get facet for the given restricted values. For example, when using + // "pickupInStore" as key and set restricted values to + // ["store123", "store456"], only facets for "store123" and "store456" are + // returned. Only supported on textual fields and fulfillments. + // Maximum is 20. + // + // Must be set for the fulfillment facet keys: + // + // * pickupInStore + // + // * shipToStore + // + // * sameDayDelivery + // + // * nextDayDelivery + // + // * customFulfillment1 + // + // * customFulfillment2 + // + // * customFulfillment3 + // + // * customFulfillment4 + // + // * customFulfillment5 + repeated string restricted_values = 3; + + // Only get facet values that start with the given string prefix. For + // example, suppose "categories" has three values "Women > Shoe", + // "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the + // "categories" facet will give only "Women > Shoe" and "Women > Dress". + // Only supported on textual fields. Maximum is 10. + repeated string prefixes = 8; + + // Only get facet values that contains the given strings. For example, + // suppose "categories" has three values "Women > Shoe", + // "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the + // "categories" facet will give only "Women > Shoe" and "Men > Shoe". + // Only supported on textual fields. Maximum is 10. + repeated string contains = 9; + + // The order in which [Facet.values][] are returned. + // + // Allowed values are: + // + // * "count desc", which means order by [Facet.FacetValue.count][] + // descending. + // + // * "value desc", which means order by [Facet.FacetValue.value][] + // descending. + // Only applies to textual facets. + // + // If not set, textual values are sorted in [natural + // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical + // intervals are sorted in the order given by + // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]; + // [FulfillmentInfo.ids][] are sorted in the order given by + // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]. + string order_by = 4; + + // The query that is used to compute facet for the given facet key. + // When provided, it will override the default behavior of facet + // computation. The query syntax is the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + // detail syntax and limitations. Notice that there is no limitation on + // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] + // when query is specified. + // + // In the response, [FacetValue.value][] will be always "1" and + // [FacetValue.count][] will be the number of results that matches the + // query. + // + // For example, you can set a customized facet for "shipToStore", + // where + // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] + // is "customizedShipToStore", and + // [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query] + // is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". + // Then the facet will count the products that are both in stock and ship + // to store "123". + string query = 5; + } + + // Required. The facet key specification. + FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Maximum of facet values that should be returned for this facet. If + // unspecified, defaults to 20. The maximum allowed value is 300. Values + // above 300 will be coerced to 300. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 limit = 2; + + // List of keys to exclude when faceting. + // + // By default, + // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] + // is not excluded from the filter unless it is listed in this field. + // + // For example, suppose there are 100 products with color facet "Red" and + // 200 products with color facet "Blue". A query containing the filter + // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] + // will by default return the "Red" with count 100. + // + // If this field contains "colorFamilies", then the query returns both the + // "Red" with count 100 and "Blue" with count 200, because the + // "colorFamilies" key is now excluded from the filter. + // + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + repeated string excluded_filter_keys = 3; + + // Enables dynamic position for this facet. If set to true, the position of + // this facet among all facets in the response is determined by Google + // Retail Search. It will be ordered together with dynamic facets if dynamic + // facets is enabled. If set to false, the position of this facet in the + // response will be the same as in the request, and it will be ranked before + // the facets with dynamic position enable and all dynamic facets. + // + // For example, you may always want to have rating facet returned in + // the response, but it's not necessarily to always display the rating facet + // at the top. In that case, you can set enable_dynamic_position to true so + // that the position of rating facet in response will be determined by + // Google Retail Search. + // + // Another example, assuming you have the following facets in the request: + // + // * "rating", enable_dynamic_position = true + // + // * "price", enable_dynamic_position = false + // + // * "brands", enable_dynamic_position = false + // + // And also you have a dynamic facets enable, which will generate a facet + // 'gender'. Then the final order of the facets in the response can be + // ("price", "brands", "rating", "gender") or ("price", "brands", "gender", + // "rating") depends on how Google Retail Search orders "gender" and + // "rating" facets. However, notice that "price" and "brands" will always be + // ranked at 1st and 2nd position since their enable_dynamic_position are + // false. + bool enable_dynamic_position = 4; + } + + // The specifications of dynamically generated facets. + message DynamicFacetSpec { + // Enum to control DynamicFacet mode + enum Mode { + // Default value. + MODE_UNSPECIFIED = 0; + + // Disable Dynamic Facet. + DISABLED = 1; + + // Automatic mode built by Google Retail Search. + ENABLED = 2; + } + + // Mode of the DynamicFacet feature. + // Defaults to + // [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED] + // if it's unset. + Mode mode = 1; + } + + // Boost specification to boost certain items. + message BoostSpec { + // Boost applies to products which match a condition. + message ConditionBoostSpec { + // An expression which specifies a boost condition. The syntax and + // supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + // detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string condition = 1; + + // Strength of the condition boost, which should be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 2; + } + + // Condition boost specifications. If a product matches multiple conditions + // in the specifictions, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 10. + repeated ConditionBoostSpec condition_boost_specs = 1; + } + + // Specification to determine under which conditions query expansion should + // occur. + message QueryExpansionSpec { + // Enum describing under which condition query expansion should occur. + enum Condition { + // Unspecified query expansion condition. This defaults to + // [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. + CONDITION_UNSPECIFIED = 0; + + // Disabled query expansion. Only the exact search query is used, even if + // [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size] + // is zero. + DISABLED = 1; + + // Automatic query expansion built by Google Retail Search. + AUTO = 3; + } + + // The condition under which query expansion should occur. Default to + // [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. + Condition condition = 1; + } + + // Required. The resource name of the search engine placement, such as + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + // This field is used to identify the set of models that will be used to make + // the search. + // + // We currently support one placement with the following ID: + // + // * `default_search`. + string placement = 1 [(google.api.field_behavior) = REQUIRED]; + + // The branch resource name, such as + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. + // + // Use "default_branch" as the branch ID or leave this field empty, to search + // products under the default branch. + string branch = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Raw search query. + string query = 3; + + // 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 logs in or 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 = 4 [(google.api.field_behavior) = REQUIRED]; + + // User information. + UserInfo user_info = 5; + + // Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If + // unspecified, defaults to a reasonable value. The maximum allowed value is + // 120. Values above 120 will be coerced to 120. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 page_size = 7; + + // A page token + // [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token], + // received from a previous + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must + // match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + // error is returned. + string page_token = 8; + + // A 0-indexed integer that specifies the current offset (that is, starting + // result location, amongst the [Product][google.cloud.retail.v2.Product]s + // deemed by the API as relevant) in search results. This field is only + // considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token] + // is unset. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 offset = 9; + + // The filter syntax consists of an expression language for constructing a + // predicate from one or more fields of the products being filtered. Filter + // expression is case-sensitive. See more details at this [user + // guide](/retail/private/docs/filter-and-order#filter). + // + // If this field is unrecognizable, an INVALID_ARGUMENT is returned. + string filter = 10; + + // The filter applied to every search request when quality improvement such as + // query expansion is needed. For example, if a query does not have enough + // results, an expanded query with + // [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter] + // will be returned as a supplement of the original query. This field is + // strongly recommended to achieve high search quality. + // + // See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + // more details about filter syntax. + string canonical_filter = 28; + + // The order in which products are returned. Products can be ordered by + // a field in an [Product][google.cloud.retail.v2.Product] object. Leave it + // unset if ordered by relevance. OrderBy expression is case-sensitive. See + // more details at this [user + // guide](/retail/private/docs/filter-and-order#order). + // + // If this field is unrecognizable, an INVALID_ARGUMENT is returned. + string order_by = 11; + + // Facet specifications for faceted search. If empty, no facets are returned. + // + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + repeated FacetSpec facet_specs = 12; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // This feature requires additional allowlisting. Contact Retail Support + // (retail-search-support@google.com) if you are interested in using dynamic + // facet feature. + DynamicFacetSpec dynamic_facet_spec = 21; + + // Boost specification to boost certain products. See more details at this + // [user guide](/retail/private/docs/boosting). + BoostSpec boost_spec = 13; + + // The query expansion specification that specifies the conditions under which + // query expansion will occur. See more details at this [user + // guide](/retail/private/docs/result-size#query_expansion). + QueryExpansionSpec query_expansion_spec = 14; + + // The keys to fetch and rollup the matching + // [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s attributes. The attributes from + // all the matching [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s are merged and de-duplicated. + // Notice that rollup [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s attributes will lead to extra + // query latency. Maximum number of keys is 10. + // + // For + // [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info], + // a fulfillment type and a fulfillment ID must be provided in the format of + // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + // "pickupInStore" is fulfillment type and "store123" is the store ID. + // + // Supported keys are: + // + // * colorFamilies + // * price + // * originalPrice + // * discount + // * attributes.key, where key is any key in the + // [Product.attributes][google.cloud.retail.v2.Product.attributes] map. + // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.PICKUP_IN_STORE][]. + // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.SHIP_TO_STORE][]. + // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][]. + // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][]. + // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_1][]. + // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_2][]. + // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_3][]. + // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_4][]. + // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_5][]. + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + repeated string variant_rollup_keys = 17; + + // The categories associated with a category page. Required for category + // navigation queries to achieve good search quality. The format should be + // the same as + // [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories]; + // + // 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"]. + repeated string page_categories = 23; +} + +// Response message for +// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method. +message SearchResponse { + // Represents the search results. + message SearchResult { + // [Product.id][google.cloud.retail.v2.Product.id] of the searched + // [Product][google.cloud.retail.v2.Product]. + string id = 1; + + // The product data snippet in the search response. Only + // [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be + // populated. + // + // [Product.variants][google.cloud.retail.v2.Product.variants] contains the + // product variants that match the search query. If there are multiple + // product variants matching the query, top 5 most relevant product variants + // are returned and ordered by relevancy. + // + // If relevancy can be deternmined, use + // [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields] + // to look up matched product variants fields. If relevancy cannot be + // determined, e.g. when searching "shoe" all products in a shoe product can + // be a match, 5 product variants are returned but order is meaningless. + Product product = 2; + + // The count of matched + // [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s. + int32 matching_variant_count = 3; + + // If a [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product] matches the search query, this + // map indicates which [Product][google.cloud.retail.v2.Product] fields are + // matched. The key is the + // [Product.name][google.cloud.retail.v2.Product.name], the value is a field + // mask of the matched [Product][google.cloud.retail.v2.Product] fields. If + // matched attributes cannot be determined, this map will be empty. + // + // For example, a key "sku1" with field mask + // "products.color_info" indicates there is a match between + // "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query. + map matching_variant_fields = 4; + + // The rollup matching + // [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product] attributes. The key is one of + // the + // [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys]. + // The values are the merged and de-duplicated + // [Product][google.cloud.retail.v2.Product] attributes. Notice that the + // rollup values are respect filter. For example, when filtering by + // "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is + // returned. + // + // For textual and numerical attributes, the rollup values is a list of + // string or double values with type + // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if + // there are two variants with colors "red" and "blue", the rollup values + // are { key: "colorFamilies" + // value { + // list_value { + // values { string_value: "red" } + // values { string_value: "blue" } + // } + // } + // } + // + // For + // [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info], + // the rollup values is a double value with type + // [google.protobuf.Value][google.protobuf.Value]. For example, {key: + // "pickupInStore.store1" value { number_value: 10 }} means a there are 10 + // variants in this product are available in the store "store1". + map variant_rollup_values = 5; + } + + // A facet result. + message Facet { + // A facet value which contains value names and their count. + message FacetValue { + // A facet value which contains values. + oneof facet_value { + // Text value of a facet, such as "Black" for facet "colorFamilies". + string value = 1; + + // Interval value for a facet, such as [10, 20) for facet "price". + Interval interval = 2; + } + + // Number of items that have this facet value. + int64 count = 3; + } + + // The key for this facet. E.g., "colorFamilies" or "price" or + // "attributes.attr1". + string key = 1; + + // The facet values for this field. + repeated FacetValue values = 2; + + // Whether the facet is dynamically generated. + bool dynamic_facet = 3; + } + + // Information describing query expansion including whether expansion has + // occurred. + message QueryExpansionInfo { + // Bool describing whether query expansion has occurred. + bool expanded_query = 1; + } + + // A list of matched items. The order represents the ranking. + repeated SearchResult results = 1; + + // Results of facets requested by user. + repeated Facet facets = 2; + + // The estimated total count of matched items irrespective of pagination. The + // count of [results][google.cloud.retail.v2.SearchResponse.results] returned + // by pagination may be less than the + // [total_size][google.cloud.retail.v2.SearchResponse.total_size] that + // matches. + int32 total_size = 3; + + // If spell correction applies, the corrected query. Otherwise, empty. + string corrected_query = 4; + + // A unique search token. This should be included in the + // [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this + // search, which enables accurate attribution of search model performance. + string attribution_token = 5; + + // A token that can be sent as + // [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 6; + + // Query expansion information for the returned results. + QueryExpansionInfo query_expansion_info = 7; + + // The URI of a customer-defined redirect page. If redirect action is + // triggered, no search will be performed, and only + // [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and + // [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token] + // will be set in the response. + string redirect_uri = 10; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto index ca7083e501c..7534edf3de9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto @@ -40,8 +40,11 @@ message UserEvent { // * `add-to-cart`: Products being added to cart. // * `category-page-view`: Special pages such as sale or promotion pages // viewed. + // * `completion`: Completion query result showed/clicked. // * `detail-page-view`: Products detail page viewed. // * `home-page-view`: Homepage viewed. + // * `promotion-offered`: Promotion is offered to a user. + // * `promotion-not-offered`: Promotion is not offered to a user. // * `purchase-complete`: User finishing a purchase. // * `search`: Product search. // * `shopping-cart-page-view`: User viewing a shopping cart. @@ -55,8 +58,23 @@ message UserEvent { // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // The field should not contain PII or user-data. We recommend to use Google + // Analystics [Client + // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) + // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; + // A unique identifier for tracking a visitor session with a length limit of + // 128 bytes. A session is an aggregation of an end user behavior in a time + // span. + // + // A general guideline to populate the sesion_id: + // 1. If user has no activity for 30 min, a new session_id should be assigned. + // 2. The session_id should be unique across users, suggest use uuid or add + // visitor_id as prefix. + string session_id = 21; + // Only required for // [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents] // method. Timestamp of when the user event happened. @@ -77,6 +95,10 @@ message UserEvent { // [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]. + // The value must be a valid + // [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token] + // for user events that are the result of + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This token enables us to accurately attribute page view or purchase back to // the event and the particular predict response containing this @@ -106,6 +128,13 @@ message UserEvent { // desired. The end user may have not finished broswing the whole page yet. repeated ProductDetail product_details = 6; + // The main completion details related to the event. + // + // In a `completion` event, this field represents the completions returned to + // the end user and the clicked completion by the end user. In a `search` + // event, it represents the search event happens after clicking completion. + CompletionDetail completion_detail = 22; + // 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 @@ -132,13 +161,53 @@ message UserEvent { // The user's search query. // + // See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for + // definition. + // // 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. + // At least one of + // [search_query][google.cloud.retail.v2.UserEvent.search_query] or + // [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is + // required for `search` events. Other event types should not set this field. // Otherwise, an INVALID_ARGUMENT error is returned. string search_query = 10; + // The filter syntax consists of an expression language for constructing a + // predicate from one or more fields of the products being filtered. + // + // See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + // definition and syntax. + // + // The value must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string filter = 16; + + // The order in which products are returned. + // + // See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by] + // for definition and syntax. + // + // The value must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // This can only be set for `search` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + string order_by = 17; + + // An integer that specifies the current offset for pagination (the 0-indexed + // starting location, amongst the products deemed by the API as relevant). + // + // See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for + // definition. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + // + // This can only be set for `search` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + int32 offset = 18; + // The categories associated with a category page. // // To represent full path of category, use '>' sign to separate different @@ -149,8 +218,11 @@ message UserEvent { // 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. + // Required for `category-page-view` events. At least one of + // [search_query][google.cloud.retail.v2.UserEvent.search_query] or + // [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is + // required for `search` events. Other event types should not set this field. + // Otherwise, an INVALID_ARGUMENT error is returned. repeated string page_categories = 11; // User information. @@ -199,6 +271,23 @@ message ProductDetail { google.protobuf.Int32Value quantity = 2; } +// Detailed completion information including completion attribution token and +// clicked completion info. +message CompletionDetail { + // Completion attribution token in + // [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token]. + string completion_attribution_token = 1; + + // End user selected + // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]. + string selected_suggestion = 2; + + // End user selected + // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion] + // position, starting from 0. + int32 selected_position = 3; +} + // A transaction represents the entire purchase transaction. message PurchaseTransaction { // The transaction ID with a length limit of 128 characters. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index 151522ef312..189232995c7 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ package google.cloud.retail.v2alpha; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/retail/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/import_config.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; @@ -55,9 +57,9 @@ message ProductLevelConfig { // [merchant_center_product_id_field][google.cloud.retail.v2alpha.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. + // See [Using product + // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // for more details. string ingestion_product_type = 1; // Which field of [Merchant Center @@ -77,12 +79,47 @@ message ProductLevelConfig { // [ingestion_product_type][google.cloud.retail.v2alpha.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. + // See [Using product + // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // for more details. string merchant_center_product_id_field = 2; } +// Represents a link between a Merchant Center account and a branch. +// Once a link is established, products from the linked merchant center account +// will be streamed to the linked branch. +message MerchantCenterLink { + // Required. The linked [Merchant center account + // id](https://developers.google.com/shopping-content/guides/accountstatuses). + // The account must be a standalone account or a sub-account of a MCA. + int64 merchant_center_account_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // The branch id (e.g. 0/1/2) within this catalog that products from + // merchant_center_account_id are streamed to. When updating this field, an + // empty value will use the currently configured default branch. However, + // changing the default branch later on won't change the linked branch here. + // + // A single branch id can only have one linked merchant center account id. + string branch_id = 2; + + // String representing the destination to import for, all if left empty. + // List of possible values can be found here. + // [https://support.google.com/merchants/answer/7501026?hl=en] + // List of allowed string values: + // "shopping-ads", "buy-on-google-listings", "display-ads", "local-inventory + // -ads", "free-listings", "free-local-listings" + // NOTE: The string values are case sensitive. + repeated string destinations = 3; +} + +// Configures Merchant Center linking. +// Links contained in the config will be used to sync data from a Merchant +// Center account to a Cloud Retail branch. +message MerchantCenterLinkingConfig { + // Links between Merchant Center accounts and branches. + repeated MerchantCenterLink links = 1; +} + // The catalog configuration. message Catalog { option (google.api.resource) = { @@ -108,4 +145,10 @@ message Catalog { // Required. The product level configuration. ProductLevelConfig product_level_config = 4 [(google.api.field_behavior) = REQUIRED]; + + // The Merchant Center linking configuration. + // Once a link is added, the data stream from Merchant Center to Cloud Retail + // will be enabled automatically. The requester must have access to the + // merchant center account in order to make changes to this field. + MerchantCenterLinkingConfig merchant_center_linking_config = 6; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto index 00bf9ffd920..59f839523e5 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -57,6 +57,67 @@ service CatalogService { }; option (google.api.method_signature) = "catalog,update_mask"; } + + // Set a specified branch id as default branch. API methods such as + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + // will treat requests using "default_branch" to the actual branch id set as + // default. + // + // For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as + // default, setting + // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to + // `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent + // to setting + // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to + // `projects/*/locations/*/catalogs/*/branches/1`. + // + // Using multiple branches can be useful when developers would like + // to have a staging branch to test and verify for future usage. When it + // becomes ready, developers switch on the staging branch using this API while + // keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` + // as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] + // to route the traffic to this staging branch. + // + // CAUTION: If you have live predict/search traffic, switching the default + // branch could potentially cause outages if the ID space of the new branch is + // very different from the old one. + // + // More specifically: + // + // * PredictionService will only return product IDs from branch {newBranch}. + // * SearchService will only return product IDs from branch {newBranch} + // (if branch is not explicitly set). + // * UserEventService will only join events with products from branch + // {newBranch}. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc SetDefaultBranch(SetDefaultBranchRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch" + body: "*" + }; + option (google.api.method_signature) = "catalog"; + } + + // Get which branch is currently default branch set by + // [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] + // method under a specified parent catalog. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc GetDefaultBranch(GetDefaultBranchRequest) + returns (GetDefaultBranchResponse) { + option (google.api.http) = { + get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + }; + option (google.api.method_signature) = "catalog"; + } } // Request for @@ -125,12 +186,60 @@ message UpdateCatalogRequest { Catalog catalog = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which fields in the provided - // [Catalog][google.cloud.retail.v2alpha.Catalog] to update. If not set, will - // only update the - // [Catalog.product_level_config][google.cloud.retail.v2alpha.Catalog.product_level_config] - // field, which is also the only currently supported field to update. + // [Catalog][google.cloud.retail.v2alpha.Catalog] to update. // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. google.protobuf.FieldMask update_mask = 2; } + +// Request message to set a specified branch as new default_branch. +message SetDefaultBranchRequest { + // Full resource name of the catalog, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // The final component of the resource name of a branch. + // + // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + // error is returned. + string branch_id = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Some note on this request, this can be retrieved by + // [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch] + // before next valid default branch set occurs. + // + // This field must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string note = 3; +} + +// Request message to show which branch is currently the default branch. +message GetDefaultBranchRequest { + // The parent catalog resource name, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; +} + +// Response message of +// [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch]. +message GetDefaultBranchResponse { + // Full resource name of the branch id currently set as default branch. + string branch = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // The time when this branch is set to default. + google.protobuf.Timestamp set_time = 2; + + // This corresponds to + // [SetDefaultBranchRequest.note][google.cloud.retail.v2alpha.SetDefaultBranchRequest.note] + // field, when this branch was set as default. + string note = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index be62c883b39..f74513951e3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,8 +29,73 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; option ruby_package = "Google::Cloud::Retail::V2alpha"; +// An intended audience of the [Product][google.cloud.retail.v2alpha.Product] +// for whom it's sold. +message Audience { + // The genders of the audience. Strongly encouraged to use the standard + // values: "male", "female", "unisex". + // + // At most 5 values are allowed. Each value 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 + // [gender](https://support.google.com/merchants/answer/6324479). Schema.org + // property + // [Product.audience.suggestedGender](https://schema.org/suggestedGender). + repeated string genders = 1; + + // The age groups of the audience. Strongly encouraged to use the standard + // values: "newborn" (up to 3 months old), "infant" (3–12 months old), + // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically + // teens or older). + // + // At most 5 values are allowed. Each value 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 + // [age_group](https://support.google.com/merchants/answer/6324463). + // Schema.org property + // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and + // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). + repeated string age_groups = 2; +} + +// The color information of a [Product][google.cloud.retail.v2alpha.Product]. +message ColorInfo { + // The standard color families. Strongly recommended to use the following + // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", + // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and + // "Mixed". Normally it is expected to have only 1 color family. May consider + // using single "Mixed" instead of multiple values. + // + // A maximum of 5 values are allowed. Each value 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 + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + repeated string color_families = 1; + + // The color display names, which may be different from standard color family + // names, such as the color aliases used in the website frontend. Normally + // it is expected to have only 1 color. May consider using single "Mixed" + // instead of multiple values. + // + // A maximum of 5 colors are allowed. Each value 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 + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + repeated string colors = 2; +} + // A custom attribute that is not explicitly modeled in -// [Product][google.cloud.retail.v2alpha.Product]]. +// [Product][google.cloud.retail.v2alpha.Product]. message CustomAttribute { // The textual values of this custom attribute. For example, `["yellow", // "green"]` when the key is "color". @@ -54,6 +119,66 @@ message CustomAttribute { // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; + + // If true, custom attribute values are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. + // + // This field is ignored in a + // [UserEvent][google.cloud.retail.v2alpha.UserEvent]. + // + // Only set if type [text][google.cloud.retail.v2alpha.CustomAttribute.text] + // is set. Otherwise, a INVALID_ARGUMENT error is returned. + optional bool searchable = 3; + + // If true, custom attribute values are indexed, so that it can be filtered, + // faceted or boosted in + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. + // + // This field is ignored in a + // [UserEvent][google.cloud.retail.v2alpha.UserEvent]. + // + // See + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], + // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] + // for more details. + optional bool indexable = 4; +} + +// Fulfillment information, such as the store IDs for in-store pickup or region +// IDs for different shipping methods. +message FulfillmentInfo { + // The fulfillment type, including commonly used types (such as pickup in + // store and same day delivery), and custom types. Customers have to map + // custom types to their display names before rendering UI. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + string type = 1; + + // The IDs for this [type][google.cloud.retail.v2alpha.FulfillmentInfo.type], + // such as the store IDs for + // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // or the region IDs for + // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2alpha.FulfillmentInfo.type]. + // + // A maximum of 2000 values are allowed. Each value must be a string with a + // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as + // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. + repeated string place_ids = 2; } // [Product][google.cloud.retail.v2alpha.Product] thumbnail/detail image. @@ -81,13 +206,74 @@ message Image { int32 width = 3; } +// A floating point interval. +message Interval { + // The lower bound of the interval. If neither of the min fields are set, then + // the lower bound is negative infinity. + // + // This field must be not larger than + // [max][google.cloud.retail.v2alpha.Interval.max]. Otherwise, an + // INVALID_ARGUMENT error is returned. + oneof min { + // Inclusive lower bound. + double minimum = 1; + + // Exclusive lower bound. + double exclusive_minimum = 2; + } + + // The upper bound of the interval. If neither of the max fields are set, then + // the upper bound is positive infinity. + // + // This field must be not smaller than + // [min][google.cloud.retail.v2alpha.Interval.min]. Otherwise, an + // INVALID_ARGUMENT error is returned. + oneof max { + // Inclusive upper bound. + double maximum = 3; + + // Exclusive upper bound. + double exclusive_maximum = 4; + } +} + // The price information of a [Product][google.cloud.retail.v2alpha.Product]. message PriceInfo { + // The price range of all + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. + message PriceRange { + // The inclusive + // [Product.pricing_info.price][google.cloud.retail.v2alpha.PriceInfo.price] + // interval of all + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. + Interval price = 1; + + // The inclusive + // [Product.pricing_info.original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] + // internal of all + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. + Interval original_price = 2; + } + // 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. + // + // The + // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s with the same + // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] + // must share the same + // [currency_code][google.cloud.retail.v2alpha.PriceInfo.currency_code]. + // Otherwise, a FAILED_PRECONDITION error is returned. string currency_code = 1; // Price of the product. @@ -110,6 +296,76 @@ message PriceInfo { // Google Merchant Center property // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). float cost = 4; + + // The timestamp when the [price][google.cloud.retail.v2alpha.PriceInfo.price] + // starts to be effective. This can be set as a future timestamp, and the + // [price][google.cloud.retail.v2alpha.PriceInfo.price] is only used for + // search after + // [price_effective_time][google.cloud.retail.v2alpha.PriceInfo.price_effective_time]. + // If so, the + // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] must + // be set and + // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] is + // used before + // [price_effective_time][google.cloud.retail.v2alpha.PriceInfo.price_effective_time]. + // + // Do not set if [price][google.cloud.retail.v2alpha.PriceInfo.price] is + // always effective because it will cause additional latency during search. + google.protobuf.Timestamp price_effective_time = 5; + + // The timestamp when the [price][google.cloud.retail.v2alpha.PriceInfo.price] + // stops to be effective. The + // [price][google.cloud.retail.v2alpha.PriceInfo.price] is used for search + // before + // [price_expire_time][google.cloud.retail.v2alpha.PriceInfo.price_expire_time]. + // If this field is set, the + // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] must + // be set and + // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] is + // used after + // [price_expire_time][google.cloud.retail.v2alpha.PriceInfo.price_expire_time]. + // + // Do not set if [price][google.cloud.retail.v2alpha.PriceInfo.price] is + // always effective because it will cause additional latency during search. + google.protobuf.Timestamp price_expire_time = 6; + + // Output only. The price range of all the child + // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s grouped together on the + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]. Only populated for + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]s. + // + // Note: This field is OUTPUT_ONLY for + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct]. + // Do not set this field in API requests. + PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The rating of a [Product][google.cloud.retail.v2alpha.Product]. +message Rating { + // The total number of ratings. This value is independent of the value of + // [rating_histogram][google.cloud.retail.v2alpha.Rating.rating_histogram]. + // + // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + // returned. + int32 rating_count = 1; + + // The average rating of the [Product][google.cloud.retail.v2alpha.Product]. + // + // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is + // returned. + float average_rating = 2; + + // List of rating counts per rating value (index = rating - 1). The list is + // empty if there is no rating. If the list is non-empty, its size is + // always 5. Otherwise, an INVALID_ARGUMENT error is returned. + // + // For example, [41, 14, 13, 47, 303]. It means that the + // [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star, + // 14 ratings with 2 star, and so on. + repeated int32 rating_histogram = 3; } // Information of an end user. @@ -121,8 +377,9 @@ message UserInfo { // 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. + // The end user's IP address. Required for getting + // [SearchResponse.sponsored_results][google.cloud.retail.v2alpha.SearchResponse.sponsored_results]. + // 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 @@ -135,7 +392,8 @@ message UserInfo { // is set. string ip_address = 2; - // User agent as included in the HTTP header. + // User agent as included in the HTTP header. Required for getting + // [SearchResponse.sponsored_results][google.cloud.retail.v2alpha.SearchResponse.sponsored_results]. // // The field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -159,3 +417,17 @@ message UserInfo { // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent]. bool direct_user_request = 4; } + +// Promotion information. +message Promotion { + // ID of the promotion. For example, "free gift". + // + // The value value must be a UTF-8 encoded string with a length limit of 128 + // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, + // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Google Merchant Center property + // [promotion](https://support.google.com/merchants/answer/7050148). + string promotion_id = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto new file mode 100644 index 00000000000..60179156bba --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto @@ -0,0 +1,192 @@ +// Copyright 2021 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.v2alpha; + +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/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/import_config.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "CompletionServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Auto-completion service for retail. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com) if you are +// interested in using Retail Search. +service CompletionService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Completes the specified prefix with keyword suggestions. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { + option (google.api.http) = { + get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }; + } + + // Bulk import of processed completion dataset. + // + // Request processing may be synchronous. Partial updating is not supported. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc ImportCompletionData(ImportCompletionDataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/completionData:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.ImportCompletionDataResponse" + metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" + }; + } +} + +// Auto-complete parameters. +message CompleteQueryRequest { + // Required. Catalog for which the completion is performed. + // + // Full resource name of catalog, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The query used to generate suggestions. + // + // The maximum number of allowed characters is 255. + string query = 2 [(google.api.field_behavior) = 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 logs in or 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 = 7; + + // The list of languages of the query. This is + // the BCP-47 language code, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // The maximum number of allowed characters is 255. + // Only "en-US" is currently supported. + repeated string language_codes = 3; + + // The device type context for completion suggestions. + // It is useful to apply different suggestions on different device types, e.g. + // DESKTOP, MOBILE. If it is empty, the suggestions are across all device + // types. + // + // Supported formats: + // + // * UNKNOWN_DEVICE_TYPE + // + // * DESKTOP + // + // * MOBILE + // + // * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + string device_type = 4; + + // Determines which dataset to use for fetching completion. "user-data" will + // use the imported dataset through [ImportCompletionData][]. "cloud-retail" + // will use the dataset generated by cloud retail based on user events. If + // leave empty, it will use the "user-data". + // + // Current supported values: + // + // * user-data + // + // * cloud-retail + // This option is not automatically enabled. Before using cloud-retail, + // contact retail-search-support@google.com first. + string dataset = 6; + + // Completion max suggestions. + // + // The maximum allowed max suggestions is 20. The default value is 20. + int32 max_suggestions = 5; +} + +// Response of the auto-complete query. +message CompleteQueryResponse { + // Resource that represents completion results. + message CompletionResult { + // The suggestion for the query. + string suggestion = 1; + + // Additional custom attributes ingested through BigQuery. + map attributes = 2; + } + + // Recent search of this user. + message RecentSearchResult { + // The recent search query. + string recent_search = 1; + } + + // Results of the matching suggestions. The result list is ordered and the + // first result is top suggestion. + repeated CompletionResult completion_results = 1; + + // A unique complete token. This should be included in the + // [SearchRequest][google.cloud.retail.v2alpha.SearchRequest] resulting from + // this completion, which enables accurate attribution of complete model + // performance. + string attribution_token = 2; + + // Matched recent searches of this user. This field is a restricted feature. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in enabling it. + // + // This feature is only available when + // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2alpha.CompleteQueryRequest.visitor_id] + // field is set and [UserEvent][google.cloud.retail.v2alpha.UserEvent] is + // imported. The recent searches satisfy the follow rules: + // * They are ordered from latest to oldest. + // * They are matched with + // [CompleteQueryRequest.query][google.cloud.retail.v2alpha.CompleteQueryRequest.query] + // case insensitively. + // * They are transformed to lower cases. + // * They are UTF-8 safe. + // + // Recent searches are deduplicated. More recent searches will be reserved + // when duplication happens. + repeated RecentSearchResult recent_search_results = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto new file mode 100644 index 00000000000..6b3934fa2cb --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto @@ -0,0 +1,78 @@ +// Copyright 2021 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.v2alpha; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ExportConfigProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Configuration of destination for Export related errors. +message ExportErrorsConfig { + // Required. Errors destination. + oneof destination { + // Google Cloud Storage path for import errors. This must be an empty, + // existing Cloud Storage bucket. Export 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; + } +} + +// Metadata related to the progress of the Export operation. This will be +// returned by the google.longrunning.Operation.metadata field. +message ExportMetadata { + // 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; +} + +// Response of the ExportProductsRequest. 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 ExportProductsResponse { + // 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. + ExportErrorsConfig errors_config = 2; +} + +// Response of the ExportUserEventsRequest. 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 ExportUserEventsResponse { + // 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. + ExportErrorsConfig errors_config = 2; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto index dc3ffe925d7..b120083ded9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,11 +18,13 @@ package google.cloud.retail.v2alpha; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/product.proto"; import "google/cloud/retail/v2alpha/user_event.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; +import "google/type/date.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; @@ -38,10 +40,11 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; 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 + // `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) + // [Importing product + // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) // for the expected file format and setup instructions. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; @@ -53,22 +56,33 @@ message GcsSource { // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id]. // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](/retail/recommendations-ai/docs/upload-catalog#mc). + // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). // // Supported values for user events imports: // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. // * `user_event_ga360`: Using - // https://support.google.com/analytics/answer/3437719?hl=en. + // https://support.google.com/analytics/answer/3437719. 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 + // BigQuery table partition info. Leave this empty if the BigQuery table + // is not partitioned. + oneof partition { + // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + google.type.Date partition_date = 6; + } + + // 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. + // ID from the parent request. string project_id = 5; // Required. The BigQuery data set to copy the data from with a length limit @@ -92,14 +106,14 @@ message BigQuerySource { // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id]. // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](/retail/recommendations-ai/docs/upload-catalog#mc). + // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). // // Supported values for user events imports: // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. // * `user_event_ga360`: Using - // https://support.google.com/analytics/answer/3437719?hl=en. + // https://support.google.com/analytics/answer/3437719. string data_schema = 4; } @@ -107,7 +121,7 @@ message BigQuerySource { message ProductInlineSource { // Required. A list of products to update/create. Each product must have a // valid [Product.id][google.cloud.retail.v2alpha.Product.id]. Recommended max - // of 10k items. + // of 100 items. repeated Product products = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -131,12 +145,51 @@ message ImportErrorsConfig { // Request message for Import methods. message ImportProductsRequest { + // Indicates how imported products are reconciled with the existing products + // created or imported before. + enum ReconciliationMode { + // Defaults to INCREMENTAL. + RECONCILIATION_MODE_UNSPECIFIED = 0; + + // Inserts new products or updates existing products. + INCREMENTAL = 1; + + // Calculates diff and replaces the entire product dataset. Existing + // products may be deleted if they are not present in the source location. + // + // Can only be while using + // [BigQuerySource][google.cloud.retail.v2alpha.BigQuerySource]. + // + // Add the IAM permission “BigQuery Data Viewer” for + // cloud-retail-customer-data-access@system.gserviceaccount.com before + // using this feature otherwise an error is thrown. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + FULL = 2; + } + // Required. - // "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + // `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]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Unique identifier provided by client, within the ancestor + // dataset scope. Ensures idempotency and used for request deduplication. + // Server-generated if unspecified. Up to 128 characters long and must match + // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + // [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata]. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + string request_id = 6; // Required. The desired input location of the data. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -147,12 +200,31 @@ message ImportProductsRequest { // 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; + + // The mode of reconciliation between existing products and the products to be + // imported. Defaults to + // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + ReconciliationMode reconciliation_mode = 5; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + string notification_pubsub_topic = 7; } // 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. `projects/1234/locations/global/catalogs/default_catalog` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // Required. The desired input location of the data. UserEventInputConfig input_config = 2 @@ -163,6 +235,28 @@ message ImportUserEventsRequest { ImportErrorsConfig errors_config = 3; } +// Request message for ImportCompletionData methods. +message ImportCompletionDataRequest { + // Required. The catalog which the suggestions dataset belongs to. + // + // Format: `projects/1234/locations/global/catalogs/default_catalog`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The desired input location of the data. + CompletionDataInputConfig input_config = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + string notification_pubsub_topic = 3; +} + // The input config source for products. message ProductInputConfig { // Required. The source of the input. @@ -195,6 +289,28 @@ message UserEventInputConfig { } } +// The input config source for completion data. +message CompletionDataInputConfig { + // The source of the input. + // + // Supported + // [BigQuerySource.data_schema][google.cloud.retail.v2alpha.BigQuerySource.data_schema] + // values for suggestions imports: + // + // * `suggestions` (default): One JSON completion suggestion per line. + // * `denylist`: One JSON deny suggestion per line. + // * `allowlist`: One JSON allow suggestion per line. + oneof source { + // Required. BigQuery input source. + // + // Add the IAM permission “BigQuery Data Viewer” for + // cloud-retail-customer-data-access@system.gserviceaccount.com before + // using this feature otherwise an error is thrown. + BigQuerySource big_query_source = 1 + [(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 { @@ -210,6 +326,17 @@ message ImportMetadata { // Count of entries that encountered errors while processing. int64 failure_count = 4; + + // Id of the request / operation. This is parroting back the requestId + // that was passed in the request. + string request_id = 5; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + string notification_pubsub_topic = 6; } // Response of the @@ -249,3 +376,12 @@ message UserEventImportSummary { // in the imported catalog. int64 unjoined_events_count = 2; } + +// Response of the +// [ImportCompletionDataRequest][google.cloud.retail.v2alpha.ImportCompletionDataRequest]. +// If the long running operation is done, this message is returned by the +// google.longrunning.Operations.response field if the operation is successful. +message ImportCompletionDataResponse { + // A sample of errors encountered while processing the request. + repeated google.rpc.Status error_samples = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto index 2b17a0739d9..b293caf76f0 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -50,30 +50,10 @@ service PredictionService { 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 ID of the Recommendations AI placement. Before you can request + // predictions from your model, you must create at least one placement for it. + // For more information, see [Managing + // placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). // // The full list of available placements can be seen at // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements @@ -104,6 +84,9 @@ message PredictRequest { // `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings // with a size limit of 1,000 characters. // + // Note: "Recently viewed" models don't support tag filtering at the + // moment. + // // * filterOutOfStockItems. Restricts predictions to products that do not // have a // stockState value of OUT_OF_STOCK. @@ -140,17 +123,35 @@ message PredictRequest { // * `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. + // * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + // it needs to be one of {'no-price-reranking', 'low-price-reranking', + // 'medium-price-reranking', 'high-price-reranking'}. This gives + // request-level control and adjusts prediction results based on product + // price. + // * `diversityLevel`: String. Default empty. If set to be non-empty, then + // it needs to be one of {'no-diversity', 'low-diversity', + // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + // request-level control and adjusts prediction results based on product + // category. map params = 7; - // The labels for the predict request. + // The labels applied to a resource must meet the following requirements: // - // * 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. + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters, and cannot be empty. Values can be empty, and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. // - // See https://goo.gl/xmQnxf for more information on and examples of labels. + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. map labels = 8; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index c1ed3198c61..d6c536bc963 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/common.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; @@ -48,8 +49,8 @@ message Product { // The type of this product. enum Type { // Default value. Default to - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] if - // unset. + // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] + // if unset. TYPE_UNSPECIFIED = 0; // The primary type. @@ -101,8 +102,48 @@ message Product { BACKORDER = 4; } + oneof expiration { + // The timestamp when this product becomes unavailable for + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. + // + // If it is set, the [Product][google.cloud.retail.v2alpha.Product] is not + // available for + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + // after [expire_time][google.cloud.retail.v2alpha.Product.expire_time]. + // However, the product can still be retrieved by + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // and + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // Google Merchant Center property + // [expiration_date](https://support.google.com/merchants/answer/6324499). + google.protobuf.Timestamp expire_time = 16; + + // Input only. The TTL (time to live) of the product. + // + // If it is set, + // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is set as + // current timestamp plus [ttl][google.cloud.retail.v2alpha.Product.ttl]. + // The derived + // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is + // returned in the output and [ttl][google.cloud.retail.v2alpha.Product.ttl] + // is left blank when retrieving the + // [Product][google.cloud.retail.v2alpha.Product]. + // + // If it is set, the product is not available for + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + // after current timestamp plus + // [ttl][google.cloud.retail.v2alpha.Product.ttl]. However, the product can + // still be retrieved by + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // and + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + google.protobuf.Duration ttl = 17 + [(google.api.field_behavior) = INPUT_ONLY]; + } + // Immutable. Full resource name of the product, such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id". + // `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]; @@ -111,7 +152,7 @@ message Product { // is the final component of [name][google.cloud.retail.v2alpha.Product.name]. // For example, this field is "id_1", if // [name][google.cloud.retail.v2alpha.Product.name] is - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1". + // `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. @@ -121,7 +162,9 @@ message Product { // 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. + // Immutable. The type of the product. Default to + // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] + // if unset. Type type = 3 [(google.api.field_behavior) = IMMUTABLE]; // Variant group identifier. Must be an @@ -148,6 +191,31 @@ message Product { // more](/recommendations-ai/docs/catalog#item-group-id). string primary_product_id = 4; + // The [id][google.cloud.retail.v2alpha.Product.id] of the collection members + // when [type][google.cloud.retail.v2alpha.Product.type] is + // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]. + // + // Should not set it for other types. A maximum of 1000 values are allowed. + // Otherwise, an INVALID_ARGUMENT error is return. + repeated string collection_member_ids = 5; + + // The Global Trade Item Number (GTIN) of the product. + // + // 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 + // [gtin](https://support.google.com/merchants/answer/6324461). + // Schema.org property + // [Product.isbn](https://schema.org/isbn) or + // [Product.gtin8](https://schema.org/gtin8) or + // [Product.gtin12](https://schema.org/gtin12) or + // [Product.gtin13](https://schema.org/gtin13) or + // [Product.gtin14](https://schema.org/gtin14). + // + // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. + string gtin = 6; + // 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. @@ -187,7 +255,7 @@ message Product { // Required. Product title. // - // This field must be a UTF-8 encoded string with a length limit of 128 + // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // Google Merchant Center property @@ -195,6 +263,17 @@ message Product { // property [Product.name](https://schema.org/name). string title = 8 [(google.api.field_behavior) = REQUIRED]; + // The brands of the product. + // + // A maximum of 30 brands are allowed. Each brand must be a UTF-8 encoded + // string with a length limit of 1,000 characters. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [brand](https://support.google.com/merchants/answer/6324351). Schema.org + // property [Product.brand](https://schema.org/brand). + repeated string brands = 9; + // Product description. // // This field must be a UTF-8 encoded string with a length limit of 5,000 @@ -205,6 +284,19 @@ message Product { // schema.org property [Product.description](https://schema.org/description). string description = 10; + // Language of the title/description and other string attributes. Use language + // tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt]. + // + // For product prediction, this field is ignored and the model automatically + // detects the text language. The + // [Product][google.cloud.retail.v2alpha.Product] can include text in + // different languages, but duplicating + // [Product][google.cloud.retail.v2alpha.Product]s to provide text in multiple + // languages can result in degraded model performance. + // + // For product search this field is in use. It defaults to "en-US" if unset. + string language_code = 11; + // 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 @@ -221,11 +313,18 @@ message Product { // "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. + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * Max entries count: 200 by default; 100 for + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. + // * The key must be a UTF-8 encoded string with a length limit of 128 + // characters. + // * Max indexable entries count: 200 by default; 40 for + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. + // * Max searchable entries count: 30. + // * For indexable attribute, the key must match the pattern: + // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; // Custom tags associated with the product. @@ -249,8 +348,12 @@ message Product { // [price](https://support.google.com/merchants/answer/6324371). PriceInfo price_info = 14; + // The rating of this product. + Rating rating = 15; + // The timestamp when this [Product][google.cloud.retail.v2alpha.Product] - // becomes available recommendation and search. + // becomes available for + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. google.protobuf.Timestamp available_time = 18; // The online availability of the @@ -265,8 +368,19 @@ message Product { // The available quantity of the item. google.protobuf.Int32Value available_quantity = 20; + // Fulfillment information, such as the store IDs for in-store pickup or + // region IDs for different shipping methods. + // + // All the elements must have distinct + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. + // Otherwise, an INVALID_ARGUMENT error is returned. + repeated FulfillmentInfo fulfillment_info = 21; + // Canonical URL directly linking to the product detail page. // + // It is strongly recommended to provide a valid uri for the product, + // otherwise the service performance could be significantly degraded. + // // This field must be a UTF-8 encoded string with a length limit of 5,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // @@ -275,7 +389,8 @@ message Product { // property [Offer.url](https://schema.org/url). string uri = 22; - // Product images for the product. + // Product images for the product.Highly recommended to put the main image + // to the first. // // A maximum of 300 images are allowed. // @@ -283,4 +398,154 @@ message Product { // [image_link](https://support.google.com/merchants/answer/6324350). // Schema.org property [Product.image](https://schema.org/image). repeated Image images = 23; + + // The target group associated with a given audience (e.g. male, veterans, + // car owners, musicians, etc.) of the product. + Audience audience = 24; + + // The color of the product. + // + // Google Merchant Center property + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + ColorInfo color_info = 25; + + // The size of the product. To represent different size systems or size types, + // consider using this format: [[[size_system:]size_type:]size_value]. + // + // For example, in "US:MENS:M", "US" represents size system; "MENS" represents + // size type; "M" represents size value. In "GIRLS:27", size system is empty; + // "GIRLS" represents size type; "27" represents size value. In "32 inches", + // both size system and size type are empty, while size value is "32 inches". + // + // A maximum of 20 values are allowed per + // [Product][google.cloud.retail.v2alpha.Product]. Each value 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 + // [size](https://support.google.com/merchants/answer/6324492), + // [size_type](https://support.google.com/merchants/answer/6324497) and + // [size_system](https://support.google.com/merchants/answer/6324502). + // Schema.org property [Product.size](https://schema.org/size). + repeated string sizes = 26; + + // The material of the product. For example, "leather", "wooden". + // + // A maximum of 5 values are allowed. Each value 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 + // [material](https://support.google.com/merchants/answer/6324410). Schema.org + // property [Product.material](https://schema.org/material). + repeated string materials = 27; + + // The pattern or graphic print of the product. For example, "striped", "polka + // dot", "paisley". + // + // A maximum of 5 values are allowed per + // [Product][google.cloud.retail.v2alpha.Product]. Each value 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 + // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org + // property [Product.pattern](https://schema.org/pattern). + repeated string patterns = 28; + + // The condition of the product. Strongly encouraged to use the standard + // values: "new", "refurbished", "used". + // + // A maximum of 5 values are allowed per + // [Product][google.cloud.retail.v2alpha.Product]. Each value 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 + // [condition](https://support.google.com/merchants/answer/6324469). + // Schema.org property + // [Offer.itemCondition](https://schema.org/itemCondition). + repeated string conditions = 29; + + // The promotions applied to the product. A maximum of 10 values are allowed + // per [Product][google.cloud.retail.v2alpha.Product]. + repeated Promotion promotions = 34; + + // The timestamp when the product is published by the retailer for the first + // time, which indicates the freshness of the products. Note that this field + // is different from + // [available_time][google.cloud.retail.v2alpha.Product.available_time], given + // it purely describes product freshness regardless of when it is available on + // search and recommendation. + google.protobuf.Timestamp publish_time = 33; + + // Indicates which fields in the + // [Product][google.cloud.retail.v2alpha.Product]s are returned in + // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse]. + // + // Supported fields for all [type][google.cloud.retail.v2alpha.Product.type]s: + // + // * [audience][google.cloud.retail.v2alpha.Product.audience] + // * [availability][google.cloud.retail.v2alpha.Product.availability] + // * [brands][google.cloud.retail.v2alpha.Product.brands] + // * [color_info][google.cloud.retail.v2alpha.Product.color_info] + // * [conditions][google.cloud.retail.v2alpha.Product.conditions] + // * [gtin][google.cloud.retail.v2alpha.Product.gtin] + // * [materials][google.cloud.retail.v2alpha.Product.materials] + // * [name][google.cloud.retail.v2alpha.Product.name] + // * [patterns][google.cloud.retail.v2alpha.Product.patterns] + // * [price_info][google.cloud.retail.v2alpha.Product.price_info] + // * [rating][google.cloud.retail.v2alpha.Product.rating] + // * [sizes][google.cloud.retail.v2alpha.Product.sizes] + // * [title][google.cloud.retail.v2alpha.Product.title] + // * [uri][google.cloud.retail.v2alpha.Product.uri] + // + // Supported fields only for + // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and + // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]: + // + // * [categories][google.cloud.retail.v2alpha.Product.categories] + // * [description][google.cloud.retail.v2alpha.Product.description] + // * [images][google.cloud.retail.v2alpha.Product.images] + // + // Supported fields only for + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]: + // + // * Only the first image in + // [images][google.cloud.retail.v2alpha.Product.images] + // + // To mark [attributes][google.cloud.retail.v2alpha.Product.attributes] as + // retrievable, include paths of the form "attributes.key" where "key" is the + // key of a custom attribute, as specified in + // [attributes][google.cloud.retail.v2alpha.Product.attributes]. + // + // For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and + // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], the + // following fields are always returned in + // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] by default: + // + // * [name][google.cloud.retail.v2alpha.Product.name] + // + // For [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT], the + // following fields are always returned in by default: + // + // * [name][google.cloud.retail.v2alpha.Product.name] + // * [color_info][google.cloud.retail.v2alpha.Product.color_info] + // + // Maximum number of paths is 20. Otherwise, an INVALID_ARGUMENT error is + // returned. + google.protobuf.FieldMask retrievable_fields = 30; + + // Output only. Product variants grouped together on primary product which + // share similar product attributes. It's automatically grouped by + // [primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] + // for all the product variants. Only populated for + // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]s. + // + // Note: This field is OUTPUT_ONLY for + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct]. + // Do not set this field in API requests. + repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index 1259b32b361..89f59e4900d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,12 +20,14 @@ 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/v2alpha/export_config.proto"; import "google/cloud/retail/v2alpha/import_config.proto"; import "google/cloud/retail/v2alpha/product.proto"; import "google/cloud/retail/v2alpha/purge_config.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; @@ -60,6 +62,14 @@ service ProductService { option (google.api.method_signature) = "name"; } + // Gets a list of [Product][google.cloud.retail.v2alpha.Product]s. + rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + }; + option (google.api.method_signature) = "parent"; + } + // Updates a [Product][google.cloud.retail.v2alpha.Product]. rpc UpdateProduct(UpdateProductRequest) returns (Product) { option (google.api.http) = { @@ -95,12 +105,122 @@ service ProductService { metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" }; } + + // Updates inventory information for a + // [Product][google.cloud.retail.v2alpha.Product] while respecting the last + // update timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2alpha.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, updates are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // When inventory is updated with + // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], + // the specified inventory field value(s) will overwrite any existing value(s) + // while ignoring the last update time for this field. Furthermore, the last + // update time for the specified inventory fields will be overwritten to the + // time of the + // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // or + // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // request. + // + // If no inventory fields are set in + // [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], + // then any pre-existing inventory information for this product will be used. + // + // If no inventory fields are set in [UpdateProductRequest.set_mask][], + // then any existing inventory information will be preserved. + // + // Pre-existing inventory information can only be updated with + // [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], + // [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], + // and + // [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" + body: "*" + }; + option (google.api.method_signature) = "inventory,set_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.SetInventoryResponse" + metadata_type: "google.cloud.retail.v2alpha.SetInventoryMetadata" + }; + } + + // Incrementally adds place IDs to + // [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2alpha.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, the added place IDs are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse" + metadata_type: "google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata" + }; + } + + // Incrementally removes place IDs from a + // [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2alpha.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, the removed place IDs are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse" + metadata_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" + }; + } } // Request message for [CreateProduct][] method. message CreateProductRequest { // Required. The parent catalog resource name, such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch". + // `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" } @@ -131,7 +251,7 @@ message CreateProductRequest { message GetProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + // `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.v2alpha.Product], regardless of whether or @@ -154,7 +274,9 @@ message UpdateProductRequest { // not it exists, a PERMISSION_DENIED error is returned. // // If the [Product][google.cloud.retail.v2alpha.Product] to update does not - // exist, a NOT_FOUND error is returned. + // exist and + // [allow_missing][google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing] + // is not set, a NOT_FOUND error is returned. Product product = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which fields in the provided @@ -165,13 +287,18 @@ message UpdateProductRequest { // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, a new [Product][google.cloud.retail.v2alpha.Product] will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; } // Request message for [DeleteProduct][] method. message DeleteProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + // `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.v2alpha.Product], regardless of whether or @@ -179,8 +306,363 @@ message DeleteProductRequest { // // If the [Product][google.cloud.retail.v2alpha.Product] to delete does not // exist, a NOT_FOUND error is returned. + // + // The [Product][google.cloud.retail.v2alpha.Product] to delete can neither be + // a + // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2alpha.Product] member nor a + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product] with more than one + // [variants][google.cloud.retail.v2alpha.Product.Type.VARIANT]. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // All inventory information for the named + // [Product][google.cloud.retail.v2alpha.Product] will be deleted. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } ]; } + +// Request message for +// [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] +// method. +message ListProductsRequest { + // Required. The parent branch resource name, such as + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use + // `default_branch` as the branch ID, to list products under the default + // branch. + // + // If the caller does not have permission to list + // [Product][google.cloud.retail.v2alpha.Product]s under this branch, + // regardless of whether or not this branch exists, a PERMISSION_DENIED error + // is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to + // return. If unspecified, defaults to 100. The maximum allowed value is 1000. + // Values above 1000 will be coerced to 1000. + // + // If this field is negative, an INVALID_ARGUMENT error is returned. + int32 page_size = 2; + + // A page token + // [ListProductsResponse.next_page_token][google.cloud.retail.v2alpha.ListProductsResponse.next_page_token], + // received from a previous + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + // must match the call that provided the page token. Otherwise, an + // INVALID_ARGUMENT error is returned. + string page_token = 3; + + // A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2alpha.ListProductsRequest.filter] is unset. + // * List + // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s sharing the same + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product]. For example: + // `primary_product_id = "some_product_id"` + // * List [Product][google.cloud.retail.v2alpha.Product]s bundled in a + // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2alpha.Product]. + // For example: + // `collection_product_id = "some_product_id"` + // * List [Product][google.cloud.retail.v2alpha.Product]s with a partibular + // type. For example: + // `type = "PRIMARY"` + // `type = "VARIANT"` + // `type = "COLLECTION"` + // + // If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + // + // If the specified + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2alpha.Product] or + // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2alpha.Product] does not exist, a NOT_FOUND + // error is returned. + string filter = 4; + + // The fields of [Product][google.cloud.retail.v2alpha.Product] to return in + // the responses. If not set or empty, the following fields are returned: + // + // * [Product.name][google.cloud.retail.v2alpha.Product.name] + // * [Product.id][google.cloud.retail.v2alpha.Product.id] + // * [Product.title][google.cloud.retail.v2alpha.Product.title] + // * [Product.uri][google.cloud.retail.v2alpha.Product.uri] + // * [Product.images][google.cloud.retail.v2alpha.Product.images] + // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + // * [Product.brands][google.cloud.retail.v2alpha.Product.brands] + // + // If "*" is provided, all fields are returned. + // [Product.name][google.cloud.retail.v2alpha.Product.name] is always returned + // no matter what mask is set. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned. + google.protobuf.FieldMask read_mask = 5; + + // If true and + // [page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] is + // empty, + // [ListProductsResponse.total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] + // is set to the total count of matched items irrespective of pagination. + // + // Notice that setting this field to true affects the performance. + bool require_total_size = 6; +} + +// Response message for +// [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] +// method. +message ListProductsResponse { + // The [Product][google.cloud.retail.v2alpha.Product]s. + repeated Product products = 1; + + // A token that can be sent as + // [ListProductsRequest.page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 2; + + // The total count of matched [Product][google.cloud.retail.v2alpha.Product]s + // irrespective of pagination. The total number of + // [Product][google.cloud.retail.v2alpha.Product]s returned by pagination may + // be less than the + // [total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] + // that matches. + // + // This field is ignored if + // [ListProductsRequest.require_total_size][google.cloud.retail.v2alpha.ListProductsRequest.require_total_size] + // is not set or + // [ListProductsRequest.page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] + // is not empty. + int32 total_size = 3; +} + +// Request message for [SetInventory][] method. +message SetInventoryRequest { + // Required. The inventory information to update. The allowable fields to + // update are: + // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] + // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] + // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] + // The updated inventory fields must be specified in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask]. + // + // If [SetInventoryRequest.inventory.name][] is empty or invalid, an + // INVALID_ARGUMENT error is returned. + // + // If the caller does not have permission to update the + // [Product][google.cloud.retail.v2alpha.Product] named in + // [Product.name][google.cloud.retail.v2alpha.Product.name], regardless of + // whether or not it exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2alpha.Product] to update does not + // have existing inventory information, the provided inventory information + // will be inserted. + // + // If the [Product][google.cloud.retail.v2alpha.Product] to update has + // existing inventory information, the provided inventory information will be + // merged while respecting the last update time for each inventory field, + // using the provided or default value for + // [SetInventoryRequest.set_time][google.cloud.retail.v2alpha.SetInventoryRequest.set_time]. + // + // The last update time is recorded for the following inventory fields: + // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] + // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] + // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] + // + // If a full overwrite of inventory information while ignoring timestamps is + // needed, [UpdateProduct][] should be invoked instead. + Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided + // [Product][google.cloud.retail.v2alpha.Product] to update. If not set or set + // with empty paths, all inventory fields will be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask set_mask = 2; + + // The time when the request is issued, used to prevent + // out-of-order updates on inventory fields with the last update time + // recorded. If not provided, the internal system time will be used. + google.protobuf.Timestamp set_time = 3; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] with + // name [Product.name][google.cloud.retail.v2alpha.Product.name] is not found, + // the inventory update will still be processed and retained for at most 1 day + // until the [Product][google.cloud.retail.v2alpha.Product] is created. If set + // to false, an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 4; +} + +// Metadata related to the progress of the SetInventory operation. +// Currently empty because there is no meaningful metadata populated from the +// [SetInventory][] method. +message SetInventoryMetadata {} + +// Response of the SetInventoryRequest. Currently empty because +// there is no meaningful response populated from the [SetInventory][] +// method. +message SetInventoryResponse {} + +// Request message for [AddFulfillmentPlaces][] method. +message AddFulfillmentPlacesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. The fulfillment type, including commonly used types (such as + // pickup in store and same day delivery), and custom types. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // This field directly corresponds to [Product.fulfillment_info.type][]. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IDs for this + // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type], such + // as the store IDs for "pickup-in-store" or the region IDs for + // "same-day-delivery" to be added for this + // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type]. + // Duplicate IDs will be automatically ignored. + // + // At least 1 value is required, and a maximum of 2000 values are allowed. + // Each value must be a string with a length limit of 10 characters, matching + // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // If the total number of place IDs exceeds 2000 for this + // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type] after + // adding, then the update will be rejected. + repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; + + // The time when the fulfillment updates are issued, used to prevent + // out-of-order updates on fulfillment information. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 4; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, the fulfillment information will still be processed and retained + // for at most 1 day and processed once the + // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + // an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 5; +} + +// Metadata related to the progress of the AddFulfillmentPlaces operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddFulfillmentPlaces][] method. +message AddFulfillmentPlacesMetadata {} + +// Response of the RemoveFulfillmentPlacesRequest. Currently empty because +// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// method. +message AddFulfillmentPlacesResponse {} + +// Request message for [RemoveFulfillmentPlaces][] method. +message RemoveFulfillmentPlacesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. The fulfillment type, including commonly used types (such as + // pickup in store and same day delivery), and custom types. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // This field directly corresponds to [Product.fulfillment_info.type][]. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IDs for this + // [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type], + // such as the store IDs for "pickup-in-store" or the region IDs for + // "same-day-delivery", to be removed for this + // [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type]. + // + // At least 1 value is required, and a maximum of 2000 values are allowed. + // Each value must be a string with a length limit of 10 characters, matching + // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // INVALID_ARGUMENT error is returned. + repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; + + // The time when the fulfillment updates are issued, used to prevent + // out-of-order updates on fulfillment information. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp remove_time = 4; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, the fulfillment information will still be processed and retained + // for at most 1 day and processed once the + // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + // an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 5; +} + +// Metadata related to the progress of the RemoveFulfillmentPlaces operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveFulfillmentPlaces][] method. +message RemoveFulfillmentPlacesMetadata {} + +// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there +// is no meaningful response populated from the [RemoveFulfillmentPlaces][] +// method. +message RemoveFulfillmentPlacesResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto index d4a4d85e7cf..269ae2ffe82 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ message PurgeMetadata {} message PurgeUserEventsRequest { // Required. The resource name of the catalog under which the events are // created. The format is - // "projects/${projectId}/locations/global/catalogs/${catalogId}" + // `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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto new file mode 100644 index 00000000000..49ea62704d9 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -0,0 +1,844 @@ +// Copyright 2021 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.v2alpha; + +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/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/product.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "SearchServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Service for search. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com) if you are +// interested in using Retail Search. +service SearchService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Performs a search. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc Search(SearchRequest) returns (SearchResponse) { + option (google.api.http) = { + post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" + body: "*" + }; + } +} + +// Request message for +// [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] +// method. +message SearchRequest { + // A facet specification to perform faceted search. + message FacetSpec { + // Specifies how a facet is computed. + message FacetKey { + // Required. Supported textual and numerical facet keys in + // [Product][google.cloud.retail.v2alpha.Product] object, over which the + // facet values are computed. Facet key is case-sensitive. + // + // Allowed facet keys when + // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] + // is not specified: + // + // * textual_field =
+ // + // *# The + // [Product.brands][google.cloud.retail.v2alpha.Product.brands].
* + //
+ // "brands"; + //
+ // + // *# The + // [Product.categories][google.cloud.retail.v2alpha.Product.categories].
* + //
+ // "categories"; + //
+ // + // *# The + // [Audience.genders][google.cloud.retail.v2alpha.Audience.genders].
* + //
+ // | "genders"; + //
+ // + // *# The + // [Audience.age_groups][google.cloud.retail.v2alpha.Audience.age_groups].
* + //
+ // | "ageGroups"; + //
+ // + // *# The + // [Product.availability][google.cloud.retail.v2alpha.Product.availability]. + // Value is one of
* + // *# "IN_STOCK", "OUT_OF_STOCK", PREORDER", "BACKORDER".
* + //
+ // | "availability"; + //
+ // + // *# The + // [ColorInfo.color_families][google.cloud.retail.v2alpha.ColorInfo.color_families].
* + //
+ // | "colorFamilies"; + //
+ // + // *# The + // [ColorInfo.colors][google.cloud.retail.v2alpha.ColorInfo.colors].
* + //
+ // | "colors"; + //
+ // + // *# The + // [Product.sizes][google.cloud.retail.v2alpha.Product.sizes].
* + //
+ // | "sizes"; + //
+ // + // *# The + // [Product.materials][google.cloud.retail.v2alpha.Product.materials].
* + //
+ // | "materials"; + //
+ // + // *# The + // [Product.patterns][google.cloud.retail.v2alpha.Product.patterns].
* + //
+ // | "patterns"; + //
+ // + // *# The + // [Product.conditions][google.cloud.retail.v2alpha.Product.conditions].
* + //
+ // | "conditions"; + //
+ // + // *# The textual custom attribute in + // [Product][google.cloud.retail.v2alpha.Product] object. Key can
* + // *# be any key in the + // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] + // map
* + // *# if the attribute values are textual.
* + // *# map.
* + //
+ // | "attributes.key"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.PICKUP_IN_STORE][].
* + //
+ // | "pickupInStore"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.SHIP_TO_STORE][].
* + //
+ // | "shipToStore"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
* + //
+ // | "sameDayDelivery"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
* + //
+ // | "nextDayDelivery"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
* + //
+ // | "customFulfillment1"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
* + //
+ // | "customFulfillment2"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
* + //
+ // | "customFulfillment3"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
* + //
+ // | "customFulfillment4"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
* + //
+ // | "customFulfillment5"; + // + // * numerical_field =
+ // + // *# The + // [PriceInfo.price][google.cloud.retail.v2alpha.PriceInfo.price].
* + //
+ // "price"; + //
+ // + // *# The discount. Computed by (original_price-price)/price
* + //
+ // "discount"; + //
+ // + // *# The + // [Rating.average_rating][google.cloud.retail.v2alpha.Rating.average_rating].
* + //
+ // "rating"; + //
+ // + // *# The + // [Rating.rating_count][google.cloud.retail.v2alpha.Rating.rating_count].
* + //
+ // "ratingCount"; + //
+ // + // *# The numerical custom attribute in + // [Product][google.cloud.retail.v2alpha.Product] object. Key can
* + // *# be any key in the + // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] + // map
* + // *# if the attribute values are numerical.
* + //
+ // | "attributes.key"; + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Set only if values should be bucketized into intervals. Must be set + // for facets with numerical values. Must not be set for facet with text + // values. Maximum number of intervals is 30. + repeated Interval intervals = 2; + + // Only get facet for the given restricted values. For example, when using + // "pickupInStore" as key and set restricted values to + // ["store123", "store456"], only facets for "store123" and "store456" are + // returned. Only supported on textual fields and fulfillments. + // Maximum is 20. + // + // Must be set for the fulfillment facet keys: + // + // * pickupInStore + // + // * shipToStore + // + // * sameDayDelivery + // + // * nextDayDelivery + // + // * customFulfillment1 + // + // * customFulfillment2 + // + // * customFulfillment3 + // + // * customFulfillment4 + // + // * customFulfillment5 + repeated string restricted_values = 3; + + // Only get facet values that start with the given string prefix. For + // example, suppose "categories" has three values "Women > Shoe", + // "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the + // "categories" facet will give only "Women > Shoe" and "Women > Dress". + // Only supported on textual fields. Maximum is 10. + repeated string prefixes = 8; + + // Only get facet values that contains the given strings. For example, + // suppose "categories" has three values "Women > Shoe", + // "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the + // "categories" facet will give only "Women > Shoe" and "Men > Shoe". + // Only supported on textual fields. Maximum is 10. + repeated string contains = 9; + + // The order in which [Facet.values][] are returned. + // + // Allowed values are: + // + // * "count desc", which means order by [Facet.FacetValue.count][] + // descending. + // + // * "value desc", which means order by [Facet.FacetValue.value][] + // descending. + // Only applies to textual facets. + // + // If not set, textual values are sorted in [natural + // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical + // intervals are sorted in the order given by + // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals]; + // [FulfillmentInfo.ids][] are sorted in the order given by + // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restricted_values]. + string order_by = 4; + + // The query that is used to compute facet for the given facet key. + // When provided, it will override the default behavior of facet + // computation. The query syntax is the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + // for detail syntax and limitations. Notice that there is no limitation + // on + // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] + // when query is specified. + // + // In the response, [FacetValue.value][] will be always "1" and + // [FacetValue.count][] will be the number of results that matches the + // query. + // + // For example, you can set a customized facet for "shipToStore", + // where + // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] + // is "customizedShipToStore", and + // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] + // is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". + // Then the facet will count the products that are both in stock and ship + // to store "123". + string query = 5; + } + + // Required. The facet key specification. + FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Maximum of facet values that should be returned for this facet. If + // unspecified, defaults to 20. The maximum allowed value is 300. Values + // above 300 will be coerced to 300. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 limit = 2; + + // List of keys to exclude when faceting. + // + // By default, + // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] + // is not excluded from the filter unless it is listed in this field. + // + // For example, suppose there are 100 products with color facet "Red" and + // 200 products with color facet "Blue". A query containing the filter + // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] + // will by default return the "Red" with count 100. + // + // If this field contains "colorFamilies", then the query returns both the + // "Red" with count 100 and "Blue" with count 200, because the + // "colorFamilies" key is now excluded from the filter. + // + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + repeated string excluded_filter_keys = 3; + + // Enables dynamic position for this facet. If set to true, the position of + // this facet among all facets in the response is determined by Google + // Retail Search. It will be ordered together with dynamic facets if dynamic + // facets is enabled. If set to false, the position of this facet in the + // response will be the same as in the request, and it will be ranked before + // the facets with dynamic position enable and all dynamic facets. + // + // For example, you may always want to have rating facet returned in + // the response, but it's not necessarily to always display the rating facet + // at the top. In that case, you can set enable_dynamic_position to true so + // that the position of rating facet in response will be determined by + // Google Retail Search. + // + // Another example, assuming you have the following facets in the request: + // + // * "rating", enable_dynamic_position = true + // + // * "price", enable_dynamic_position = false + // + // * "brands", enable_dynamic_position = false + // + // And also you have a dynamic facets enable, which will generate a facet + // 'gender'. Then the final order of the facets in the response can be + // ("price", "brands", "rating", "gender") or ("price", "brands", "gender", + // "rating") depends on how Google Retail Search orders "gender" and + // "rating" facets. However, notice that "price" and "brands" will always be + // ranked at 1st and 2nd position since their enable_dynamic_position are + // false. + bool enable_dynamic_position = 4; + } + + // The specifications of dynamically generated facets. + message DynamicFacetSpec { + // Enum to control DynamicFacet mode + enum Mode { + // Default value. + MODE_UNSPECIFIED = 0; + + // Disable Dynamic Facet. + DISABLED = 1; + + // Automatic mode built by Google Retail Search. + ENABLED = 2; + } + + // Mode of the DynamicFacet feature. + // Defaults to + // [Mode.DISABLED][google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode.DISABLED] + // if it's unset. + Mode mode = 1; + } + + // Boost specification to boost certain items. + message BoostSpec { + // Boost applies to products which match a condition. + message ConditionBoostSpec { + // An expression which specifies a boost condition. The syntax and + // supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + // for detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string condition = 1; + + // Strength of the condition boost, which should be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 2; + } + + // Condition boost specifications. If a product matches multiple conditions + // in the specifictions, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 10. + repeated ConditionBoostSpec condition_boost_specs = 1; + } + + // Specification to determine under which conditions query expansion should + // occur. + message QueryExpansionSpec { + // Enum describing under which condition query expansion should occur. + enum Condition { + // Unspecified query expansion condition. This defaults to + // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. + CONDITION_UNSPECIFIED = 0; + + // Disabled query expansion. Only the exact search query is used, even if + // [SearchResponse.total_size][google.cloud.retail.v2alpha.SearchResponse.total_size] + // is zero. + DISABLED = 1; + + // Automatic query expansion built by Google Retail Search. + AUTO = 3; + } + + // The condition under which query expansion should occur. Default to + // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. + Condition condition = 1; + } + + // The relevance threshold of the search results. The higher relevance + // threshold is, the higher relevant results are shown and the less number of + // results are returned. + enum RelevanceThreshold { + // Default value. Defaults to + // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH]. + RELEVANCE_THRESHOLD_UNSPECIFIED = 0; + + // High relevance threshold. + HIGH = 1; + + // Medium relevance threshold. + MEDIUM = 2; + + // Low relevance threshold. + LOW = 3; + + // Lowest relevance threshold. + LOWEST = 4; + } + + // Required. The resource name of the search engine placement, such as + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + // This field is used to identify the set of models that will be used to make + // the search. + // + // We currently support one placement with the following ID: + // + // * `default_search`. + string placement = 1 [(google.api.field_behavior) = REQUIRED]; + + // The branch resource name, such as + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. + // + // Use "default_branch" as the branch ID or leave this field empty, to search + // products under the default branch. + string branch = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Raw search query. + string query = 3; + + // 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 logs in or 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 = 4 [(google.api.field_behavior) = REQUIRED]; + + // User information. + UserInfo user_info = 5; + + // Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to + // return. If unspecified, defaults to a reasonable value. The maximum allowed + // value is 120. Values above 120 will be coerced to 120. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 page_size = 7; + + // A page token + // [SearchResponse.next_page_token][google.cloud.retail.v2alpha.SearchResponse.next_page_token], + // received from a previous + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + // must match the call that provided the page token. Otherwise, an + // INVALID_ARGUMENT error is returned. + string page_token = 8; + + // A 0-indexed integer that specifies the current offset (that is, starting + // result location, amongst the + // [Product][google.cloud.retail.v2alpha.Product]s deemed by the API as + // relevant) in search results. This field is only considered if + // [page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] is + // unset. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 offset = 9; + + // The filter syntax consists of an expression language for constructing a + // predicate from one or more fields of the products being filtered. Filter + // expression is case-sensitive. See more details at this [user + // guide](/retail/private/docs/filter-and-order#filter). + // + // If this field is unrecognizable, an INVALID_ARGUMENT is returned. + string filter = 10; + + // The filter applied to every search request when quality improvement such as + // query expansion is needed. For example, if a query does not have enough + // results, an expanded query with + // [SearchRequest.canonical_filter][google.cloud.retail.v2alpha.SearchRequest.canonical_filter] + // will be returned as a supplement of the original query. This field is + // strongly recommended to achieve high search quality. + // + // See + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + // for more details about filter syntax. + string canonical_filter = 28; + + // The order in which products are returned. Products can be ordered by + // a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave + // it unset if ordered by relevance. OrderBy expression is case-sensitive. See + // more details at this [user + // guide](/retail/private/docs/filter-and-order#order). + // + // If this field is unrecognizable, an INVALID_ARGUMENT is returned. + string order_by = 11; + + // Facet specifications for faceted search. If empty, no facets are returned. + // + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + repeated FacetSpec facet_specs = 12; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // This feature requires additional allowlisting. Contact Retail Support + // (retail-search-support@google.com) if you are interested in using dynamic + // facet feature. + DynamicFacetSpec dynamic_facet_spec = 21; + + // Boost specification to boost certain products. See more details at this + // [user guide](/retail/private/docs/boosting). + BoostSpec boost_spec = 13; + + // The query expansion specification that specifies the conditions under which + // query expansion will occur. See more details at this [user + // guide](/retail/private/docs/result-size#query_expansion). + QueryExpansionSpec query_expansion_spec = 14; + + // The relevance threshold of the search results. + // + // Defaults to + // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], + // which means only the most relevant results are shown, and the least number + // of results are returned. See more details at this [user + // guide](/retail/private/docs/result-size#relevance_thresholding). + RelevanceThreshold relevance_threshold = 15; + + // The keys to fetch and rollup the matching + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s attributes. The attributes + // from all the matching + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s are merged and + // de-duplicated. Notice that rollup + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s attributes will lead to + // extra query latency. Maximum number of keys is 10. + // + // For + // [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info], + // a fulfillment type and a fulfillment ID must be provided in the format of + // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + // "pickupInStore" is fulfillment type and "store123" is the store ID. + // + // Supported keys are: + // + // * colorFamilies + // * price + // * originalPrice + // * discount + // * attributes.key, where key is any key in the + // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. + // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.PICKUP_IN_STORE][]. + // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.SHIP_TO_STORE][]. + // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][]. + // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][]. + // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_1][]. + // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_2][]. + // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_3][]. + // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_4][]. + // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_5][]. + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + repeated string variant_rollup_keys = 17; + + // The categories associated with a category page. Required for category + // navigation queries to achieve good search quality. The format should be + // the same as + // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; + // + // 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"]. + repeated string page_categories = 23; +} + +// Response message for +// [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] +// method. +message SearchResponse { + // Represents the search results. + message SearchResult { + // [Product.id][google.cloud.retail.v2alpha.Product.id] of the searched + // [Product][google.cloud.retail.v2alpha.Product]. + string id = 1; + + // The product data snippet in the search response. Only + // [Product.name][google.cloud.retail.v2alpha.Product.name] is guaranteed to + // be populated. + // + // [Product.variants][google.cloud.retail.v2alpha.Product.variants] contains + // the product variants that match the search query. If there are multiple + // product variants matching the query, top 5 most relevant product variants + // are returned and ordered by relevancy. + // + // If relevancy can be deternmined, use + // [matching_variant_fields][google.cloud.retail.v2alpha.SearchResponse.SearchResult.matching_variant_fields] + // to look up matched product variants fields. If relevancy cannot be + // determined, e.g. when searching "shoe" all products in a shoe product can + // be a match, 5 product variants are returned but order is meaningless. + Product product = 2; + + // The count of matched + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s. + int32 matching_variant_count = 3; + + // If a [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product] matches the search query, + // this map indicates which [Product][google.cloud.retail.v2alpha.Product] + // fields are matched. The key is the + // [Product.name][google.cloud.retail.v2alpha.Product.name], the value is a + // field mask of the matched [Product][google.cloud.retail.v2alpha.Product] + // fields. If matched attributes cannot be determined, this map will be + // empty. + // + // For example, a key "sku1" with field mask + // "products.color_info" indicates there is a match between + // "sku1" [ColorInfo][google.cloud.retail.v2alpha.ColorInfo] and the query. + map matching_variant_fields = 4; + + // The rollup matching + // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product] attributes. The key is one + // of the + // [SearchRequest.variant_rollup_keys][google.cloud.retail.v2alpha.SearchRequest.variant_rollup_keys]. + // The values are the merged and de-duplicated + // [Product][google.cloud.retail.v2alpha.Product] attributes. Notice that + // the rollup values are respect filter. For example, when filtering by + // "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is + // returned. + // + // For textual and numerical attributes, the rollup values is a list of + // string or double values with type + // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if + // there are two variants with colors "red" and "blue", the rollup values + // are { key: "colorFamilies" + // value { + // list_value { + // values { string_value: "red" } + // values { string_value: "blue" } + // } + // } + // } + // + // For + // [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info], + // the rollup values is a double value with type + // [google.protobuf.Value][google.protobuf.Value]. For example, {key: + // "pickupInStore.store1" value { number_value: 10 }} means a there are 10 + // variants in this product are available in the store "store1". + map variant_rollup_values = 5; + } + + // A facet result. + message Facet { + // A facet value which contains value names and their count. + message FacetValue { + // A facet value which contains values. + oneof facet_value { + // Text value of a facet, such as "Black" for facet "colorFamilies". + string value = 1; + + // Interval value for a facet, such as [10, 20) for facet "price". + Interval interval = 2; + } + + // Number of items that have this facet value. + int64 count = 3; + } + + // The key for this facet. E.g., "colorFamilies" or "price" or + // "attributes.attr1". + string key = 1; + + // The facet values for this field. + repeated FacetValue values = 2; + + // Whether the facet is dynamically generated. + bool dynamic_facet = 3; + } + + // Information describing query expansion including whether expansion has + // occurred. + message QueryExpansionInfo { + // Bool describing whether query expansion has occurred. + bool expanded_query = 1; + } + + // A list of matched items. The order represents the ranking. + repeated SearchResult results = 1; + + // Results of facets requested by user. + repeated Facet facets = 2; + + // The estimated total count of matched items irrespective of pagination. The + // count of [results][google.cloud.retail.v2alpha.SearchResponse.results] + // returned by pagination may be less than the + // [total_size][google.cloud.retail.v2alpha.SearchResponse.total_size] that + // matches. + int32 total_size = 3; + + // If spell correction applies, the corrected query. Otherwise, empty. + string corrected_query = 4; + + // A unique search token. This should be included in the + // [UserEvent][google.cloud.retail.v2alpha.UserEvent] logs resulting from this + // search, which enables accurate attribution of search model performance. + string attribution_token = 5; + + // A token that can be sent as + // [SearchRequest.page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 6; + + // Query expansion information for the returned results. + QueryExpansionInfo query_expansion_info = 7; + + // The URI of a customer-defined redirect page. If redirect action is + // triggered, no search will be performed, and only + // [redirect_uri][google.cloud.retail.v2alpha.SearchResponse.redirect_uri] and + // [attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] + // will be set in the response. + string redirect_uri = 10; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto index bf3a6b6fd19..99a2941e3eb 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,8 +40,11 @@ message UserEvent { // * `add-to-cart`: Products being added to cart. // * `category-page-view`: Special pages such as sale or promotion pages // viewed. + // * `completion`: Completion query result showed/clicked. // * `detail-page-view`: Products detail page viewed. // * `home-page-view`: Homepage viewed. + // * `promotion-offered`: Promotion is offered to a user. + // * `promotion-not-offered`: Promotion is not offered to a user. // * `purchase-complete`: User finishing a purchase. // * `search`: Product search. // * `shopping-cart-page-view`: User viewing a shopping cart. @@ -55,8 +58,23 @@ message UserEvent { // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // The field should not contain PII or user-data. We recommend to use Google + // Analystics [Client + // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) + // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; + // A unique identifier for tracking a visitor session with a length limit of + // 128 bytes. A session is an aggregation of an end user behavior in a time + // span. + // + // A general guideline to populate the sesion_id: + // 1. If user has no activity for 30 min, a new session_id should be assigned. + // 2. The session_id should be unique across users, suggest use uuid or add + // visitor_id as prefix. + string session_id = 21; + // Only required for // [UserEventService.ImportUserEvents][google.cloud.retail.v2alpha.UserEventService.ImportUserEvents] // method. Timestamp of when the user event happened. @@ -77,6 +95,10 @@ message UserEvent { // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] // for user events that are the result of // [PredictionService.Predict][google.cloud.retail.v2alpha.PredictionService.Predict]. + // The value must be a valid + // [SearchResponse.attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] + // for user events that are the result of + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. // // This token enables us to accurately attribute page view or purchase back to // the event and the particular predict response containing this @@ -106,6 +128,13 @@ message UserEvent { // desired. The end user may have not finished broswing the whole page yet. repeated ProductDetail product_details = 6; + // The main completion details related to the event. + // + // In a `completion` event, this field represents the completions returned to + // the end user and the clicked completion by the end user. In a `search` + // event, it represents the search event happens after clicking completion. + CompletionDetail completion_detail = 22; + // 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 @@ -132,13 +161,56 @@ message UserEvent { // The user's search query. // + // See [SearchRequest.query][google.cloud.retail.v2alpha.SearchRequest.query] + // for definition. + // // 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. + // At least one of + // [search_query][google.cloud.retail.v2alpha.UserEvent.search_query] or + // [page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories] is + // required for `search` events. Other event types should not set this field. // Otherwise, an INVALID_ARGUMENT error is returned. string search_query = 10; + // The filter syntax consists of an expression language for constructing a + // predicate from one or more fields of the products being filtered. + // + // See + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + // for definition and syntax. + // + // The value must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string filter = 16; + + // The order in which products are returned. + // + // See + // [SearchRequest.order_by][google.cloud.retail.v2alpha.SearchRequest.order_by] + // for definition and syntax. + // + // The value must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // This can only be set for `search` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + string order_by = 17; + + // An integer that specifies the current offset for pagination (the 0-indexed + // starting location, amongst the products deemed by the API as relevant). + // + // See + // [SearchRequest.offset][google.cloud.retail.v2alpha.SearchRequest.offset] + // for definition. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + // + // This can only be set for `search` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + int32 offset = 18; + // The categories associated with a category page. // // To represent full path of category, use '>' sign to separate different @@ -149,8 +221,11 @@ message UserEvent { // 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. + // Required for `category-page-view` events. At least one of + // [search_query][google.cloud.retail.v2alpha.UserEvent.search_query] or + // [page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories] is + // required for `search` events. Other event types should not set this field. + // Otherwise, an INVALID_ARGUMENT error is returned. repeated string page_categories = 11; // User information. @@ -199,6 +274,23 @@ message ProductDetail { google.protobuf.Int32Value quantity = 2; } +// Detailed completion information including completion attribution token and +// clicked completion info. +message CompletionDetail { + // Completion attribution token in + // [CompleteQueryResponse.attribution_token][google.cloud.retail.v2alpha.CompleteQueryResponse.attribution_token]. + string completion_attribution_token = 1; + + // End user selected + // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.suggestion]. + string selected_suggestion = 2; + + // End user selected + // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.suggestion] + // position, starting from 0. + int32 selected_position = 3; +} + // A transaction represents the entire purchase transaction. message PurchaseTransaction { // The transaction ID with a length limit of 128 characters. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto index aa66b0a74e4..2e91984a99b 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ 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/v2alpha/export_config.proto"; import "google/cloud/retail/v2alpha/import_config.proto"; import "google/cloud/retail/v2alpha/purge_config.proto"; import "google/cloud/retail/v2alpha/user_event.proto"; @@ -117,7 +118,7 @@ service UserEventService { // Request message for WriteUserEvent method. message WriteUserEventRequest { // Required. The parent catalog resource name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `projects/1234/locations/global/catalogs/default_catalog`. string parent = 1 [(google.api.field_behavior) = REQUIRED]; // Required. User event to write. @@ -127,7 +128,7 @@ message WriteUserEventRequest { // Request message for CollectUserEvent method. message CollectUserEventRequest { // Required. The parent catalog name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `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 @@ -168,7 +169,7 @@ message RejoinUserEventsRequest { } // Required. The parent catalog resource name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto index c63bdf0eaff..aac00ef8d0c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ package google.cloud.retail.v2beta; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/retail/v2beta/common.proto"; +import "google/cloud/retail/v2beta/import_config.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; @@ -55,9 +57,9 @@ message ProductLevelConfig { // [merchant_center_product_id_field][google.cloud.retail.v2beta.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. + // See [Using product + // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // for more details. string ingestion_product_type = 1; // Which field of [Merchant Center @@ -77,9 +79,9 @@ message ProductLevelConfig { // [ingestion_product_type][google.cloud.retail.v2beta.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. + // See [Using product + // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // for more details. string merchant_center_product_id_field = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto index 322aa50e9d0..0d499d38327 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -57,6 +57,67 @@ service CatalogService { }; option (google.api.method_signature) = "catalog,update_mask"; } + + // Set a specified branch id as default branch. API methods such as + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct], + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + // will treat requests using "default_branch" to the actual branch id set as + // default. + // + // For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as + // default, setting + // [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to + // `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent + // to setting + // [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to + // `projects/*/locations/*/catalogs/*/branches/1`. + // + // Using multiple branches can be useful when developers would like + // to have a staging branch to test and verify for future usage. When it + // becomes ready, developers switch on the staging branch using this API while + // keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` + // as [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] + // to route the traffic to this staging branch. + // + // CAUTION: If you have live predict/search traffic, switching the default + // branch could potentially cause outages if the ID space of the new branch is + // very different from the old one. + // + // More specifically: + // + // * PredictionService will only return product IDs from branch {newBranch}. + // * SearchService will only return product IDs from branch {newBranch} + // (if branch is not explicitly set). + // * UserEventService will only join events with products from branch + // {newBranch}. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc SetDefaultBranch(SetDefaultBranchRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch" + body: "*" + }; + option (google.api.method_signature) = "catalog"; + } + + // Get which branch is currently default branch set by + // [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] + // method under a specified parent catalog. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc GetDefaultBranch(GetDefaultBranchRequest) + returns (GetDefaultBranchResponse) { + option (google.api.http) = { + get: "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + }; + option (google.api.method_signature) = "catalog"; + } } // Request for @@ -125,12 +186,60 @@ message UpdateCatalogRequest { Catalog catalog = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which fields in the provided - // [Catalog][google.cloud.retail.v2beta.Catalog] to update. If not set, will - // only update the - // [Catalog.product_level_config][google.cloud.retail.v2beta.Catalog.product_level_config] - // field, which is also the only currently supported field to update. + // [Catalog][google.cloud.retail.v2beta.Catalog] to update. // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. google.protobuf.FieldMask update_mask = 2; } + +// Request message to set a specified branch as new default_branch. +message SetDefaultBranchRequest { + // Full resource name of the catalog, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // The final component of the resource name of a branch. + // + // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + // error is returned. + string branch_id = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Some note on this request, this can be retrieved by + // [CatalogService.GetDefaultBranch][google.cloud.retail.v2beta.CatalogService.GetDefaultBranch] + // before next valid default branch set occurs. + // + // This field must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string note = 3; +} + +// Request message to show which branch is currently the default branch. +message GetDefaultBranchRequest { + // The parent catalog resource name, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; +} + +// Response message of +// [CatalogService.GetDefaultBranch][google.cloud.retail.v2beta.CatalogService.GetDefaultBranch]. +message GetDefaultBranchResponse { + // Full resource name of the branch id currently set as default branch. + string branch = 1 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // The time when this branch is set to default. + google.protobuf.Timestamp set_time = 2; + + // This corresponds to + // [SetDefaultBranchRequest.note][google.cloud.retail.v2beta.SetDefaultBranchRequest.note] + // field, when this branch was set as default. + string note = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index 24f18f433f7..a31c8f1b26e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,8 +29,73 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2beta"; option ruby_package = "Google::Cloud::Retail::V2beta"; +// An intended audience of the [Product][google.cloud.retail.v2beta.Product] for +// whom it's sold. +message Audience { + // The genders of the audience. Strongly encouraged to use the standard + // values: "male", "female", "unisex". + // + // At most 5 values are allowed. Each value 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 + // [gender](https://support.google.com/merchants/answer/6324479). Schema.org + // property + // [Product.audience.suggestedGender](https://schema.org/suggestedGender). + repeated string genders = 1; + + // The age groups of the audience. Strongly encouraged to use the standard + // values: "newborn" (up to 3 months old), "infant" (3–12 months old), + // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically + // teens or older). + // + // At most 5 values are allowed. Each value 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 + // [age_group](https://support.google.com/merchants/answer/6324463). + // Schema.org property + // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and + // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). + repeated string age_groups = 2; +} + +// The color information of a [Product][google.cloud.retail.v2beta.Product]. +message ColorInfo { + // The standard color families. Strongly recommended to use the following + // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", + // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and + // "Mixed". Normally it is expected to have only 1 color family. May consider + // using single "Mixed" instead of multiple values. + // + // A maximum of 5 values are allowed. Each value 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 + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + repeated string color_families = 1; + + // The color display names, which may be different from standard color family + // names, such as the color aliases used in the website frontend. Normally + // it is expected to have only 1 color. May consider using single "Mixed" + // instead of multiple values. + // + // A maximum of 5 colors are allowed. Each value 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 + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + repeated string colors = 2; +} + // A custom attribute that is not explicitly modeled in -// [Product][google.cloud.retail.v2beta.Product]]. +// [Product][google.cloud.retail.v2beta.Product]. message CustomAttribute { // The textual values of this custom attribute. For example, `["yellow", // "green"]` when the key is "color". @@ -54,6 +119,66 @@ message CustomAttribute { // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; + + // If true, custom attribute values are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. + // + // This field is ignored in a + // [UserEvent][google.cloud.retail.v2beta.UserEvent]. + // + // Only set if type [text][google.cloud.retail.v2beta.CustomAttribute.text] is + // set. Otherwise, a INVALID_ARGUMENT error is returned. + optional bool searchable = 3; + + // If true, custom attribute values are indexed, so that it can be filtered, + // faceted or boosted in + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. + // + // This field is ignored in a + // [UserEvent][google.cloud.retail.v2beta.UserEvent]. + // + // See + // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter], + // [SearchRequest.facet_specs][google.cloud.retail.v2beta.SearchRequest.facet_specs] + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2beta.SearchRequest.boost_spec] + // for more details. + optional bool indexable = 4; +} + +// Fulfillment information, such as the store IDs for in-store pickup or region +// IDs for different shipping methods. +message FulfillmentInfo { + // The fulfillment type, including commonly used types (such as pickup in + // store and same day delivery), and custom types. Customers have to map + // custom types to their display names before rendering UI. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + string type = 1; + + // The IDs for this [type][google.cloud.retail.v2beta.FulfillmentInfo.type], + // such as the store IDs for + // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2beta.FulfillmentInfo.type] + // or the region IDs for + // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2beta.FulfillmentInfo.type]. + // + // A maximum of 2000 values are allowed. Each value must be a string with a + // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as + // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. + repeated string place_ids = 2; } // [Product][google.cloud.retail.v2beta.Product] thumbnail/detail image. @@ -81,13 +206,73 @@ message Image { int32 width = 3; } +// A floating point interval. +message Interval { + // The lower bound of the interval. If neither of the min fields are set, then + // the lower bound is negative infinity. + // + // This field must be not larger than + // [max][google.cloud.retail.v2beta.Interval.max]. Otherwise, an + // INVALID_ARGUMENT error is returned. + oneof min { + // Inclusive lower bound. + double minimum = 1; + + // Exclusive lower bound. + double exclusive_minimum = 2; + } + + // The upper bound of the interval. If neither of the max fields are set, then + // the upper bound is positive infinity. + // + // This field must be not smaller than + // [min][google.cloud.retail.v2beta.Interval.min]. Otherwise, an + // INVALID_ARGUMENT error is returned. + oneof max { + // Inclusive upper bound. + double maximum = 3; + + // Exclusive upper bound. + double exclusive_maximum = 4; + } +} + // The price information of a [Product][google.cloud.retail.v2beta.Product]. message PriceInfo { + // The price range of all + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id]. + message PriceRange { + // The inclusive + // [Product.pricing_info.price][google.cloud.retail.v2beta.PriceInfo.price] + // interval of all + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id]. + Interval price = 1; + + // The inclusive + // [Product.pricing_info.original_price][google.cloud.retail.v2beta.PriceInfo.original_price] + // internal of all + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product] having the same + // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id]. + Interval original_price = 2; + } + // 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. + // + // The [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s with the same + // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id] + // must share the same + // [currency_code][google.cloud.retail.v2beta.PriceInfo.currency_code]. + // Otherwise, a FAILED_PRECONDITION error is returned. string currency_code = 1; // Price of the product. @@ -110,6 +295,76 @@ message PriceInfo { // Google Merchant Center property // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). float cost = 4; + + // The timestamp when the [price][google.cloud.retail.v2beta.PriceInfo.price] + // starts to be effective. This can be set as a future timestamp, and the + // [price][google.cloud.retail.v2beta.PriceInfo.price] is only used for search + // after + // [price_effective_time][google.cloud.retail.v2beta.PriceInfo.price_effective_time]. + // If so, the + // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] must + // be set and + // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] is + // used before + // [price_effective_time][google.cloud.retail.v2beta.PriceInfo.price_effective_time]. + // + // Do not set if [price][google.cloud.retail.v2beta.PriceInfo.price] is always + // effective because it will cause additional latency during search. + google.protobuf.Timestamp price_effective_time = 5; + + // The timestamp when the [price][google.cloud.retail.v2beta.PriceInfo.price] + // stops to be effective. The + // [price][google.cloud.retail.v2beta.PriceInfo.price] is used for search + // before + // [price_expire_time][google.cloud.retail.v2beta.PriceInfo.price_expire_time]. + // If this field is set, the + // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] must + // be set and + // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] is + // used after + // [price_expire_time][google.cloud.retail.v2beta.PriceInfo.price_expire_time]. + // + // Do not set if [price][google.cloud.retail.v2beta.PriceInfo.price] is always + // effective because it will cause additional latency during search. + google.protobuf.Timestamp price_expire_time = 6; + + // Output only. The price range of all the child + // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s grouped together on the + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]. Only populated for + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]s. + // + // Note: This field is OUTPUT_ONLY for + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct]. + // Do not set this field in API requests. + PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The rating of a [Product][google.cloud.retail.v2beta.Product]. +message Rating { + // The total number of ratings. This value is independent of the value of + // [rating_histogram][google.cloud.retail.v2beta.Rating.rating_histogram]. + // + // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + // returned. + int32 rating_count = 1; + + // The average rating of the [Product][google.cloud.retail.v2beta.Product]. + // + // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is + // returned. + float average_rating = 2; + + // List of rating counts per rating value (index = rating - 1). The list is + // empty if there is no rating. If the list is non-empty, its size is + // always 5. Otherwise, an INVALID_ARGUMENT error is returned. + // + // For example, [41, 14, 13, 47, 303]. It means that the + // [Product][google.cloud.retail.v2beta.Product] got 41 ratings with 1 star, + // 14 ratings with 2 star, and so on. + repeated int32 rating_histogram = 3; } // Information of an end user. @@ -121,8 +376,9 @@ message UserInfo { // 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. + // The end user's IP address. Required for getting + // [SearchResponse.sponsored_results][google.cloud.retail.v2beta.SearchResponse.sponsored_results]. + // 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 @@ -135,7 +391,8 @@ message UserInfo { // is set. string ip_address = 2; - // User agent as included in the HTTP header. + // User agent as included in the HTTP header. Required for getting + // [SearchResponse.sponsored_results][google.cloud.retail.v2beta.SearchResponse.sponsored_results]. // // The field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -159,3 +416,17 @@ message UserInfo { // [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]. bool direct_user_request = 4; } + +// Promotion information. +message Promotion { + // ID of the promotion. For example, "free gift". + // + // The value value must be a UTF-8 encoded string with a length limit of 128 + // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, + // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Google Merchant Center property + // [promotion](https://support.google.com/merchants/answer/7050148). + string promotion_id = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto new file mode 100644 index 00000000000..bb574675be4 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto @@ -0,0 +1,193 @@ +// Copyright 2021 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.v2beta; + +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/v2beta/common.proto"; +import "google/cloud/retail/v2beta/import_config.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "CompletionServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Auto-completion service for retail. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com) if you are +// interested in using Retail Search. +service CompletionService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Completes the specified prefix with keyword suggestions. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { + option (google.api.http) = { + get: "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }; + } + + // Bulk import of processed completion dataset. + // + // Request processing may be synchronous. Partial updating is not supported. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc ImportCompletionData(ImportCompletionDataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/completionData:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.ImportCompletionDataResponse" + metadata_type: "google.cloud.retail.v2beta.ImportMetadata" + }; + } +} + +// Auto-complete parameters. +message CompleteQueryRequest { + // Required. Catalog for which the completion is performed. + // + // Full resource name of catalog, such as + // `projects/*/locations/global/catalogs/default_catalog`. + string catalog = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The query used to generate suggestions. + // + // The maximum number of allowed characters is 255. + string query = 2 [(google.api.field_behavior) = 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 logs in or 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 = 7; + + // The list of languages of the query. This is + // the BCP-47 language code, such as "en-US" or "sr-Latn". + // For more information, see + // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + // + // The maximum number of allowed characters is 255. + // Only "en-US" is currently supported. + repeated string language_codes = 3; + + // The device type context for completion suggestions. + // It is useful to apply different suggestions on different device types, e.g. + // DESKTOP, MOBILE. If it is empty, the suggestions are across all device + // types. + // + // Supported formats: + // + // * UNKNOWN_DEVICE_TYPE + // + // * DESKTOP + // + // * MOBILE + // + // * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + string device_type = 4; + + // Determines which dataset to use for fetching completion. "user-data" will + // use the imported dataset through + // [CompletionService.ImportCompletionData][google.cloud.retail.v2beta.CompletionService.ImportCompletionData]. + // "cloud-retail" will use the dataset generated by cloud retail based on user + // events. If leave empty, it will use the "user-data". + // + // Current supported values: + // + // * user-data + // + // * cloud-retail + // This option is not automatically enabled. Before using cloud-retail, + // contact retail-search-support@google.com first. + string dataset = 6; + + // Completion max suggestions. + // + // The maximum allowed max suggestions is 20. The default value is 20. + int32 max_suggestions = 5; +} + +// Response of the auto-complete query. +message CompleteQueryResponse { + // Resource that represents completion results. + message CompletionResult { + // The suggestion for the query. + string suggestion = 1; + + // Additional custom attributes ingested through BigQuery. + map attributes = 2; + } + + // Recent search of this user. + message RecentSearchResult { + // The recent search query. + string recent_search = 1; + } + + // Results of the matching suggestions. The result list is ordered and the + // first result is top suggestion. + repeated CompletionResult completion_results = 1; + + // A unique complete token. This should be included in the + // [SearchRequest][google.cloud.retail.v2beta.SearchRequest] resulting from + // this completion, which enables accurate attribution of complete model + // performance. + string attribution_token = 2; + + // Matched recent searches of this user. This field is a restricted feature. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in enabling it. + // + // This feature is only available when + // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2beta.CompleteQueryRequest.visitor_id] + // field is set and [UserEvent][google.cloud.retail.v2beta.UserEvent] is + // imported. The recent searches satisfy the follow rules: + // * They are ordered from latest to oldest. + // * They are matched with + // [CompleteQueryRequest.query][google.cloud.retail.v2beta.CompleteQueryRequest.query] + // case insensitively. + // * They are transformed to lower cases. + // * They are UTF-8 safe. + // + // Recent searches are deduplicated. More recent searches will be reserved + // when duplication happens. + repeated RecentSearchResult recent_search_results = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto new file mode 100644 index 00000000000..0324d0edbe4 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto @@ -0,0 +1,78 @@ +// Copyright 2021 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.v2beta; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ExportConfigProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Configuration of destination for Export related errors. +message ExportErrorsConfig { + // Required. Errors destination. + oneof destination { + // Google Cloud Storage path for import errors. This must be an empty, + // existing Cloud Storage bucket. Export 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; + } +} + +// Metadata related to the progress of the Export operation. This will be +// returned by the google.longrunning.Operation.metadata field. +message ExportMetadata { + // 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; +} + +// Response of the ExportProductsRequest. 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 ExportProductsResponse { + // 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. + ExportErrorsConfig errors_config = 2; +} + +// Response of the ExportUserEventsRequest. 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 ExportUserEventsResponse { + // 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. + ExportErrorsConfig errors_config = 2; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index 4ea8f651e9f..bd8db707e03 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,11 +18,13 @@ package google.cloud.retail.v2beta; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/cloud/retail/v2beta/product.proto"; import "google/cloud/retail/v2beta/user_event.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; +import "google/type/date.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; @@ -38,10 +40,11 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; 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 + // `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) + // [Importing product + // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) // for the expected file format and setup instructions. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; @@ -53,22 +56,33 @@ message GcsSource { // [Product][google.cloud.retail.v2beta.Product] per line. Each product must // have a valid [Product.id][google.cloud.retail.v2beta.Product.id]. // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](/retail/recommendations-ai/docs/upload-catalog#mc). + // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). // // Supported values for user events imports: // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2beta.UserEvent] per line. // * `user_event_ga360`: Using - // https://support.google.com/analytics/answer/3437719?hl=en. + // https://support.google.com/analytics/answer/3437719. 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 + // BigQuery table partition info. Leave this empty if the BigQuery table + // is not partitioned. + oneof partition { + // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + google.type.Date partition_date = 6; + } + + // 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. + // ID from the parent request. string project_id = 5; // Required. The BigQuery data set to copy the data from with a length limit @@ -92,14 +106,14 @@ message BigQuerySource { // [Product][google.cloud.retail.v2beta.Product] per line. Each product must // have a valid [Product.id][google.cloud.retail.v2beta.Product.id]. // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](/retail/recommendations-ai/docs/upload-catalog#mc). + // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). // // Supported values for user events imports: // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2beta.UserEvent] per line. // * `user_event_ga360`: Using - // https://support.google.com/analytics/answer/3437719?hl=en. + // https://support.google.com/analytics/answer/3437719. string data_schema = 4; } @@ -107,7 +121,7 @@ message BigQuerySource { message ProductInlineSource { // Required. A list of products to update/create. Each product must have a // valid [Product.id][google.cloud.retail.v2beta.Product.id]. Recommended max - // of 10k items. + // of 100 items. repeated Product products = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -131,12 +145,51 @@ message ImportErrorsConfig { // Request message for Import methods. message ImportProductsRequest { + // Indicates how imported products are reconciled with the existing products + // created or imported before. + enum ReconciliationMode { + // Defaults to INCREMENTAL. + RECONCILIATION_MODE_UNSPECIFIED = 0; + + // Inserts new products or updates existing products. + INCREMENTAL = 1; + + // Calculates diff and replaces the entire product dataset. Existing + // products may be deleted if they are not present in the source location. + // + // Can only be while using + // [BigQuerySource][google.cloud.retail.v2beta.BigQuerySource]. + // + // Add the IAM permission “BigQuery Data Viewer” for + // cloud-retail-customer-data-access@system.gserviceaccount.com before + // using this feature otherwise an error is thrown. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + FULL = 2; + } + // Required. - // "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + // `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]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Unique identifier provided by client, within the ancestor + // dataset scope. Ensures idempotency and used for request deduplication. + // Server-generated if unspecified. Up to 128 characters long and must match + // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + // [ImportMetadata][google.cloud.retail.v2beta.ImportMetadata]. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + string request_id = 6; // Required. The desired input location of the data. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -147,12 +200,31 @@ message ImportProductsRequest { // 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; + + // The mode of reconciliation between existing products and the products to be + // imported. Defaults to + // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + ReconciliationMode reconciliation_mode = 5; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + string notification_pubsub_topic = 7; } // 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. `projects/1234/locations/global/catalogs/default_catalog` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // Required. The desired input location of the data. UserEventInputConfig input_config = 2 @@ -163,6 +235,28 @@ message ImportUserEventsRequest { ImportErrorsConfig errors_config = 3; } +// Request message for ImportCompletionData methods. +message ImportCompletionDataRequest { + // Required. The catalog which the suggestions dataset belongs to. + // + // Format: `projects/1234/locations/global/catalogs/default_catalog`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The desired input location of the data. + CompletionDataInputConfig input_config = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + string notification_pubsub_topic = 3; +} + // The input config source for products. message ProductInputConfig { // Required. The source of the input. @@ -195,6 +289,28 @@ message UserEventInputConfig { } } +// The input config source for completion data. +message CompletionDataInputConfig { + // The source of the input. + // + // Supported + // [BigQuerySource.data_schema][google.cloud.retail.v2beta.BigQuerySource.data_schema] + // values for suggestions imports: + // + // * `suggestions` (default): One JSON completion suggestion per line. + // * `denylist`: One JSON deny suggestion per line. + // * `allowlist`: One JSON allow suggestion per line. + oneof source { + // Required. BigQuery input source. + // + // Add the IAM permission “BigQuery Data Viewer” for + // cloud-retail-customer-data-access@system.gserviceaccount.com before + // using this feature otherwise an error is thrown. + BigQuerySource big_query_source = 1 + [(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 { @@ -210,6 +326,17 @@ message ImportMetadata { // Count of entries that encountered errors while processing. int64 failure_count = 4; + + // Id of the request / operation. This is parroting back the requestId + // that was passed in the request. + string request_id = 5; + + // Pub/Sub topic for receiving notification. If this field is set, + // when the import is finished, a notification will be sent to + // specified Pub/Sub topic. The message data will be JSON string of a + // [Operation][google.longrunning.Operation]. + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + string notification_pubsub_topic = 6; } // Response of the @@ -249,3 +376,12 @@ message UserEventImportSummary { // in the imported catalog. int64 unjoined_events_count = 2; } + +// Response of the +// [ImportCompletionDataRequest][google.cloud.retail.v2beta.ImportCompletionDataRequest]. +// If the long running operation is done, this message is returned by the +// google.longrunning.Operations.response field if the operation is successful. +message ImportCompletionDataResponse { + // A sample of errors encountered while processing the request. + repeated google.rpc.Status error_samples = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto index 7d106347113..37d364c8c12 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -50,30 +50,10 @@ service PredictionService { 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 ID of the Recommendations AI placement. Before you can request + // predictions from your model, you must create at least one placement for it. + // For more information, see [Managing + // placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). // // The full list of available placements can be seen at // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements @@ -104,6 +84,9 @@ message PredictRequest { // `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings // with a size limit of 1,000 characters. // + // Note: "Recently viewed" models don't support tag filtering at the + // moment. + // // * filterOutOfStockItems. Restricts predictions to products that do not // have a // stockState value of OUT_OF_STOCK. @@ -140,17 +123,35 @@ message PredictRequest { // * `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. + // * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + // it needs to be one of {'no-price-reranking', 'low-price-reranking', + // 'medium-price-reranking', 'high-price-reranking'}. This gives + // request-level control and adjusts prediction results based on product + // price. + // * `diversityLevel`: String. Default empty. If set to be non-empty, then + // it needs to be one of {'no-diversity', 'low-diversity', + // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + // request-level control and adjusts prediction results based on product + // category. map params = 7; - // The labels for the predict request. + // The labels applied to a resource must meet the following requirements: // - // * 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. + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters, and cannot be empty. Values can be empty, and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. // - // See https://goo.gl/xmQnxf for more information on and examples of labels. + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. map labels = 8; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 20f9d389e03..d729036bf3c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/common.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; @@ -48,7 +49,8 @@ message Product { // The type of this product. enum Type { // Default value. Default to - // [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] if unset. + // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2beta.ProductLevelConfig.ingestion_product_type] + // if unset. TYPE_UNSPECIFIED = 0; // The primary type. @@ -100,8 +102,47 @@ message Product { BACKORDER = 4; } + oneof expiration { + // The timestamp when this product becomes unavailable for + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. + // + // If it is set, the [Product][google.cloud.retail.v2beta.Product] is not + // available for + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + // after [expire_time][google.cloud.retail.v2beta.Product.expire_time]. + // However, the product can still be retrieved by + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // and + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // + // Google Merchant Center property + // [expiration_date](https://support.google.com/merchants/answer/6324499). + google.protobuf.Timestamp expire_time = 16; + + // Input only. The TTL (time to live) of the product. + // + // If it is set, + // [expire_time][google.cloud.retail.v2beta.Product.expire_time] is set as + // current timestamp plus [ttl][google.cloud.retail.v2beta.Product.ttl]. The + // derived [expire_time][google.cloud.retail.v2beta.Product.expire_time] is + // returned in the output and [ttl][google.cloud.retail.v2beta.Product.ttl] + // is left blank when retrieving the + // [Product][google.cloud.retail.v2beta.Product]. + // + // If it is set, the product is not available for + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + // after current timestamp plus + // [ttl][google.cloud.retail.v2beta.Product.ttl]. However, the product can + // still be retrieved by + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // and + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + google.protobuf.Duration ttl = 17 + [(google.api.field_behavior) = INPUT_ONLY]; + } + // Immutable. Full resource name of the product, such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id". + // `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]; @@ -110,7 +151,7 @@ message Product { // is the final component of [name][google.cloud.retail.v2beta.Product.name]. // For example, this field is "id_1", if // [name][google.cloud.retail.v2beta.Product.name] is - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1". + // `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. @@ -120,7 +161,9 @@ message Product { // 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. + // Immutable. The type of the product. Default to + // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2beta.ProductLevelConfig.ingestion_product_type] + // if unset. Type type = 3 [(google.api.field_behavior) = IMMUTABLE]; // Variant group identifier. Must be an @@ -147,6 +190,31 @@ message Product { // more](/recommendations-ai/docs/catalog#item-group-id). string primary_product_id = 4; + // The [id][google.cloud.retail.v2beta.Product.id] of the collection members + // when [type][google.cloud.retail.v2beta.Product.type] is + // [Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION]. + // + // Should not set it for other types. A maximum of 1000 values are allowed. + // Otherwise, an INVALID_ARGUMENT error is return. + repeated string collection_member_ids = 5; + + // The Global Trade Item Number (GTIN) of the product. + // + // 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 + // [gtin](https://support.google.com/merchants/answer/6324461). + // Schema.org property + // [Product.isbn](https://schema.org/isbn) or + // [Product.gtin8](https://schema.org/gtin8) or + // [Product.gtin12](https://schema.org/gtin12) or + // [Product.gtin13](https://schema.org/gtin13) or + // [Product.gtin14](https://schema.org/gtin14). + // + // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. + string gtin = 6; + // 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. @@ -186,7 +254,7 @@ message Product { // Required. Product title. // - // This field must be a UTF-8 encoded string with a length limit of 128 + // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // Google Merchant Center property @@ -194,6 +262,17 @@ message Product { // property [Product.name](https://schema.org/name). string title = 8 [(google.api.field_behavior) = REQUIRED]; + // The brands of the product. + // + // A maximum of 30 brands are allowed. Each brand must be a UTF-8 encoded + // string with a length limit of 1,000 characters. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // Google Merchant Center property + // [brand](https://support.google.com/merchants/answer/6324351). Schema.org + // property [Product.brand](https://schema.org/brand). + repeated string brands = 9; + // Product description. // // This field must be a UTF-8 encoded string with a length limit of 5,000 @@ -204,6 +283,19 @@ message Product { // schema.org property [Product.description](https://schema.org/description). string description = 10; + // Language of the title/description and other string attributes. Use language + // tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt]. + // + // For product prediction, this field is ignored and the model automatically + // detects the text language. The + // [Product][google.cloud.retail.v2beta.Product] can include text in different + // languages, but duplicating [Product][google.cloud.retail.v2beta.Product]s + // to provide text in multiple languages can result in degraded model + // performance. + // + // For product search this field is in use. It defaults to "en-US" if unset. + string language_code = 11; + // 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 @@ -220,11 +312,18 @@ message Product { // "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. + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * Max entries count: 200 by default; 100 for + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]. + // * The key must be a UTF-8 encoded string with a length limit of 128 + // characters. + // * Max indexable entries count: 200 by default; 40 for + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]. + // * Max searchable entries count: 30. + // * For indexable attribute, the key must match the pattern: + // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; // Custom tags associated with the product. @@ -248,8 +347,12 @@ message Product { // [price](https://support.google.com/merchants/answer/6324371). PriceInfo price_info = 14; + // The rating of this product. + Rating rating = 15; + // The timestamp when this [Product][google.cloud.retail.v2beta.Product] - // becomes available recommendation and search. + // becomes available for + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. google.protobuf.Timestamp available_time = 18; // The online availability of the @@ -264,8 +367,19 @@ message Product { // The available quantity of the item. google.protobuf.Int32Value available_quantity = 20; + // Fulfillment information, such as the store IDs for in-store pickup or + // region IDs for different shipping methods. + // + // All the elements must have distinct + // [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type]. + // Otherwise, an INVALID_ARGUMENT error is returned. + repeated FulfillmentInfo fulfillment_info = 21; + // Canonical URL directly linking to the product detail page. // + // It is strongly recommended to provide a valid uri for the product, + // otherwise the service performance could be significantly degraded. + // // This field must be a UTF-8 encoded string with a length limit of 5,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // @@ -274,7 +388,8 @@ message Product { // property [Offer.url](https://schema.org/url). string uri = 22; - // Product images for the product. + // Product images for the product.Highly recommended to put the main image + // to the first. // // A maximum of 300 images are allowed. // @@ -282,4 +397,154 @@ message Product { // [image_link](https://support.google.com/merchants/answer/6324350). // Schema.org property [Product.image](https://schema.org/image). repeated Image images = 23; + + // The target group associated with a given audience (e.g. male, veterans, + // car owners, musicians, etc.) of the product. + Audience audience = 24; + + // The color of the product. + // + // Google Merchant Center property + // [color](https://support.google.com/merchants/answer/6324487). Schema.org + // property [Product.color](https://schema.org/color). + ColorInfo color_info = 25; + + // The size of the product. To represent different size systems or size types, + // consider using this format: [[[size_system:]size_type:]size_value]. + // + // For example, in "US:MENS:M", "US" represents size system; "MENS" represents + // size type; "M" represents size value. In "GIRLS:27", size system is empty; + // "GIRLS" represents size type; "27" represents size value. In "32 inches", + // both size system and size type are empty, while size value is "32 inches". + // + // A maximum of 20 values are allowed per + // [Product][google.cloud.retail.v2beta.Product]. Each value 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 + // [size](https://support.google.com/merchants/answer/6324492), + // [size_type](https://support.google.com/merchants/answer/6324497) and + // [size_system](https://support.google.com/merchants/answer/6324502). + // Schema.org property [Product.size](https://schema.org/size). + repeated string sizes = 26; + + // The material of the product. For example, "leather", "wooden". + // + // A maximum of 5 values are allowed. Each value 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 + // [material](https://support.google.com/merchants/answer/6324410). Schema.org + // property [Product.material](https://schema.org/material). + repeated string materials = 27; + + // The pattern or graphic print of the product. For example, "striped", "polka + // dot", "paisley". + // + // A maximum of 5 values are allowed per + // [Product][google.cloud.retail.v2beta.Product]. Each value 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 + // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org + // property [Product.pattern](https://schema.org/pattern). + repeated string patterns = 28; + + // The condition of the product. Strongly encouraged to use the standard + // values: "new", "refurbished", "used". + // + // A maximum of 5 values are allowed per + // [Product][google.cloud.retail.v2beta.Product]. Each value 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 + // [condition](https://support.google.com/merchants/answer/6324469). + // Schema.org property + // [Offer.itemCondition](https://schema.org/itemCondition). + repeated string conditions = 29; + + // The promotions applied to the product. A maximum of 10 values are allowed + // per [Product][google.cloud.retail.v2beta.Product]. + repeated Promotion promotions = 34; + + // The timestamp when the product is published by the retailer for the first + // time, which indicates the freshness of the products. Note that this field + // is different from + // [available_time][google.cloud.retail.v2beta.Product.available_time], given + // it purely describes product freshness regardless of when it is available on + // search and recommendation. + google.protobuf.Timestamp publish_time = 33; + + // Indicates which fields in the + // [Product][google.cloud.retail.v2beta.Product]s are returned in + // [SearchResponse][google.cloud.retail.v2beta.SearchResponse]. + // + // Supported fields for all [type][google.cloud.retail.v2beta.Product.type]s: + // + // * [audience][google.cloud.retail.v2beta.Product.audience] + // * [availability][google.cloud.retail.v2beta.Product.availability] + // * [brands][google.cloud.retail.v2beta.Product.brands] + // * [color_info][google.cloud.retail.v2beta.Product.color_info] + // * [conditions][google.cloud.retail.v2beta.Product.conditions] + // * [gtin][google.cloud.retail.v2beta.Product.gtin] + // * [materials][google.cloud.retail.v2beta.Product.materials] + // * [name][google.cloud.retail.v2beta.Product.name] + // * [patterns][google.cloud.retail.v2beta.Product.patterns] + // * [price_info][google.cloud.retail.v2beta.Product.price_info] + // * [rating][google.cloud.retail.v2beta.Product.rating] + // * [sizes][google.cloud.retail.v2beta.Product.sizes] + // * [title][google.cloud.retail.v2beta.Product.title] + // * [uri][google.cloud.retail.v2beta.Product.uri] + // + // Supported fields only for + // [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] and + // [Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION]: + // + // * [categories][google.cloud.retail.v2beta.Product.categories] + // * [description][google.cloud.retail.v2beta.Product.description] + // * [images][google.cloud.retail.v2beta.Product.images] + // + // Supported fields only for + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]: + // + // * Only the first image in + // [images][google.cloud.retail.v2beta.Product.images] + // + // To mark [attributes][google.cloud.retail.v2beta.Product.attributes] as + // retrievable, include paths of the form "attributes.key" where "key" is the + // key of a custom attribute, as specified in + // [attributes][google.cloud.retail.v2beta.Product.attributes]. + // + // For [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] and + // [Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION], the + // following fields are always returned in + // [SearchResponse][google.cloud.retail.v2beta.SearchResponse] by default: + // + // * [name][google.cloud.retail.v2beta.Product.name] + // + // For [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT], the + // following fields are always returned in by default: + // + // * [name][google.cloud.retail.v2beta.Product.name] + // * [color_info][google.cloud.retail.v2beta.Product.color_info] + // + // Maximum number of paths is 20. Otherwise, an INVALID_ARGUMENT error is + // returned. + google.protobuf.FieldMask retrievable_fields = 30; + + // Output only. Product variants grouped together on primary product which + // share similar product attributes. It's automatically grouped by + // [primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id] + // for all the product variants. Only populated for + // [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]s. + // + // Note: This field is OUTPUT_ONLY for + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct]. + // Do not set this field in API requests. + repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index 5e7615ebd64..a8a1911f94e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,12 +20,14 @@ 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/v2beta/export_config.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/product.proto"; import "google/cloud/retail/v2beta/purge_config.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; @@ -60,6 +62,14 @@ service ProductService { option (google.api.method_signature) = "name"; } + // Gets a list of [Product][google.cloud.retail.v2beta.Product]s. + rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + }; + option (google.api.method_signature) = "parent"; + } + // Updates a [Product][google.cloud.retail.v2beta.Product]. rpc UpdateProduct(UpdateProductRequest) returns (Product) { option (google.api.http) = { @@ -95,12 +105,121 @@ service ProductService { metadata_type: "google.cloud.retail.v2beta.ImportMetadata" }; } + + // Updates inventory information for a + // [Product][google.cloud.retail.v2beta.Product] while respecting the last + // update timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2beta.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, updates are not immediately manifested in the + // [Product][google.cloud.retail.v2beta.Product] queried by + // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // + // When inventory is updated with + // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], + // the specified inventory field value(s) will overwrite any existing value(s) + // while ignoring the last update time for this field. Furthermore, the last + // update time for the specified inventory fields will be overwritten to the + // time of the + // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or + // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // request. + // + // If no inventory fields are set in + // [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], + // then any pre-existing inventory information for this product will be used. + // + // If no inventory fields are set in [UpdateProductRequest.set_mask][], + // then any existing inventory information will be preserved. + // + // Pre-existing inventory information can only be updated with + // [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], + // [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], + // and + // [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" + body: "*" + }; + option (google.api.method_signature) = "inventory,set_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.SetInventoryResponse" + metadata_type: "google.cloud.retail.v2beta.SetInventoryMetadata" + }; + } + + // Incrementally adds place IDs to + // [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2beta.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, the added place IDs are not immediately manifested in the + // [Product][google.cloud.retail.v2beta.Product] queried by + // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse" + metadata_type: "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" + }; + } + + // Incrementally removes place IDs from a + // [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2beta.Product] to exist before updating + // fulfillment information. If the request is valid, the update will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, the removed place IDs are not immediately manifested in the + // [Product][google.cloud.retail.v2beta.Product] queried by + // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse" + metadata_type: "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" + }; + } } // Request message for [CreateProduct][] method. message CreateProductRequest { // Required. The parent catalog resource name, such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch". + // `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" } @@ -131,7 +250,7 @@ message CreateProductRequest { message GetProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + // `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.v2beta.Product], regardless of whether or not @@ -154,7 +273,9 @@ message UpdateProductRequest { // it exists, a PERMISSION_DENIED error is returned. // // If the [Product][google.cloud.retail.v2beta.Product] to update does not - // exist, a NOT_FOUND error is returned. + // exist and + // [allow_missing][google.cloud.retail.v2beta.UpdateProductRequest.allow_missing] + // is not set, a NOT_FOUND error is returned. Product product = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which fields in the provided @@ -165,13 +286,18 @@ message UpdateProductRequest { // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + // not found, a new [Product][google.cloud.retail.v2beta.Product] will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; } // Request message for [DeleteProduct][] method. message DeleteProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as - // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + // `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.v2beta.Product], regardless of whether or not @@ -179,8 +305,340 @@ message DeleteProductRequest { // // If the [Product][google.cloud.retail.v2beta.Product] to delete does not // exist, a NOT_FOUND error is returned. + // + // The [Product][google.cloud.retail.v2beta.Product] to delete can neither be + // a + // [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2beta.Product] member nor a + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product] with more than one + // [variants][google.cloud.retail.v2beta.Product.Type.VARIANT]. Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // All inventory information for the named + // [Product][google.cloud.retail.v2beta.Product] will be deleted. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } ]; } + +// Request message for +// [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] +// method. +message ListProductsRequest { + // Required. The parent branch resource name, such as + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use + // `default_branch` as the branch ID, to list products under the default + // branch. + // + // If the caller does not have permission to list + // [Product][google.cloud.retail.v2beta.Product]s under this branch, + // regardless of whether or not this branch exists, a PERMISSION_DENIED error + // is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return. + // If unspecified, defaults to 100. The maximum allowed value is 1000. Values + // above 1000 will be coerced to 1000. + // + // If this field is negative, an INVALID_ARGUMENT error is returned. + int32 page_size = 2; + + // A page token + // [ListProductsResponse.next_page_token][google.cloud.retail.v2beta.ListProductsResponse.next_page_token], + // received from a previous + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + // must match the call that provided the page token. Otherwise, an + // INVALID_ARGUMENT error is returned. + string page_token = 3; + + // A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2beta.ListProductsRequest.filter] is unset. + // * List + // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s sharing the same + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product]. For example: + // `primary_product_id = "some_product_id"` + // * List [Product][google.cloud.retail.v2beta.Product]s bundled in a + // [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2beta.Product]. + // For example: + // `collection_product_id = "some_product_id"` + // * List [Product][google.cloud.retail.v2beta.Product]s with a partibular + // type. For example: + // `type = "PRIMARY"` + // `type = "VARIANT"` + // `type = "COLLECTION"` + // + // If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + // + // If the specified + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // [Product][google.cloud.retail.v2beta.Product] or + // [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] + // [Product][google.cloud.retail.v2beta.Product] does not exist, a NOT_FOUND + // error is returned. + string filter = 4; + + // The fields of [Product][google.cloud.retail.v2beta.Product] to return in + // the responses. If not set or empty, the following fields are returned: + // + // * [Product.name][google.cloud.retail.v2beta.Product.name] + // * [Product.id][google.cloud.retail.v2beta.Product.id] + // * [Product.title][google.cloud.retail.v2beta.Product.title] + // * [Product.uri][google.cloud.retail.v2beta.Product.uri] + // * [Product.images][google.cloud.retail.v2beta.Product.images] + // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + // * [Product.brands][google.cloud.retail.v2beta.Product.brands] + // + // If "*" is provided, all fields are returned. + // [Product.name][google.cloud.retail.v2beta.Product.name] is always returned + // no matter what mask is set. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned. + google.protobuf.FieldMask read_mask = 5; +} + +// Response message for +// [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] +// method. +message ListProductsResponse { + // The [Product][google.cloud.retail.v2beta.Product]s. + repeated Product products = 1; + + // A token that can be sent as + // [ListProductsRequest.page_token][google.cloud.retail.v2beta.ListProductsRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 2; +} + +// Request message for [SetInventory][] method. +message SetInventoryRequest { + // Required. The inventory information to update. The allowable fields to + // update are: + // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + // * [Product.availability][google.cloud.retail.v2beta.Product.availability] + // * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] + // * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] + // The updated inventory fields must be specified in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask]. + // + // If [SetInventoryRequest.inventory.name][] is empty or invalid, an + // INVALID_ARGUMENT error is returned. + // + // If the caller does not have permission to update the + // [Product][google.cloud.retail.v2beta.Product] named in + // [Product.name][google.cloud.retail.v2beta.Product.name], regardless of + // whether or not it exists, a PERMISSION_DENIED error is returned. + // + // If the [Product][google.cloud.retail.v2beta.Product] to update does not + // have existing inventory information, the provided inventory information + // will be inserted. + // + // If the [Product][google.cloud.retail.v2beta.Product] to update has existing + // inventory information, the provided inventory information will be merged + // while respecting the last update time for each inventory field, using the + // provided or default value for + // [SetInventoryRequest.set_time][google.cloud.retail.v2beta.SetInventoryRequest.set_time]. + // + // The last update time is recorded for the following inventory fields: + // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + // * [Product.availability][google.cloud.retail.v2beta.Product.availability] + // * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] + // * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] + // + // If a full overwrite of inventory information while ignoring timestamps is + // needed, [UpdateProduct][] should be invoked instead. + Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided + // [Product][google.cloud.retail.v2beta.Product] to update. If not set or set + // with empty paths, all inventory fields will be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask set_mask = 2; + + // The time when the request is issued, used to prevent + // out-of-order updates on inventory fields with the last update time + // recorded. If not provided, the internal system time will be used. + google.protobuf.Timestamp set_time = 3; + + // If set to true, and the [Product][google.cloud.retail.v2beta.Product] with + // name [Product.name][google.cloud.retail.v2beta.Product.name] is not found, + // the inventory update will still be processed and retained for at most 1 day + // until the [Product][google.cloud.retail.v2beta.Product] is created. If set + // to false, an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2beta.Product] is not found. + bool allow_missing = 4; +} + +// Metadata related to the progress of the SetInventory operation. +// Currently empty because there is no meaningful metadata populated from the +// [SetInventory][] method. +message SetInventoryMetadata {} + +// Response of the SetInventoryRequest. Currently empty because +// there is no meaningful response populated from the [SetInventory][] +// method. +message SetInventoryResponse {} + +// Request message for [AddFulfillmentPlaces][] method. +message AddFulfillmentPlacesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. The fulfillment type, including commonly used types (such as + // pickup in store and same day delivery), and custom types. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // This field directly corresponds to [Product.fulfillment_info.type][]. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IDs for this + // [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type], such + // as the store IDs for "pickup-in-store" or the region IDs for + // "same-day-delivery" to be added for this + // [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type]. + // Duplicate IDs will be automatically ignored. + // + // At least 1 value is required, and a maximum of 2000 values are allowed. + // Each value must be a string with a length limit of 10 characters, matching + // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // INVALID_ARGUMENT error is returned. + // + // If the total number of place IDs exceeds 2000 for this + // [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type] after + // adding, then the update will be rejected. + repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; + + // The time when the fulfillment updates are issued, used to prevent + // out-of-order updates on fulfillment information. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 4; + + // If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + // not found, the fulfillment information will still be processed and retained + // for at most 1 day and processed once the + // [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + // an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2beta.Product] is not found. + bool allow_missing = 5; +} + +// Metadata related to the progress of the AddFulfillmentPlaces operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddFulfillmentPlaces][] method. +message AddFulfillmentPlacesMetadata {} + +// Response of the RemoveFulfillmentPlacesRequest. Currently empty because +// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// method. +message AddFulfillmentPlacesResponse {} + +// Request message for [RemoveFulfillmentPlaces][] method. +message RemoveFulfillmentPlacesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. The fulfillment type, including commonly used types (such as + // pickup in store and same day delivery), and custom types. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // This field directly corresponds to [Product.fulfillment_info.type][]. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IDs for this + // [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type], + // such as the store IDs for "pickup-in-store" or the region IDs for + // "same-day-delivery", to be removed for this + // [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type]. + // + // At least 1 value is required, and a maximum of 2000 values are allowed. + // Each value must be a string with a length limit of 10 characters, matching + // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // INVALID_ARGUMENT error is returned. + repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; + + // The time when the fulfillment updates are issued, used to prevent + // out-of-order updates on fulfillment information. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp remove_time = 4; + + // If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + // not found, the fulfillment information will still be processed and retained + // for at most 1 day and processed once the + // [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + // an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2beta.Product] is not found. + bool allow_missing = 5; +} + +// Metadata related to the progress of the RemoveFulfillmentPlaces operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveFulfillmentPlaces][] method. +message RemoveFulfillmentPlacesMetadata {} + +// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there +// is no meaningful response populated from the [RemoveFulfillmentPlaces][] +// method. +message RemoveFulfillmentPlacesResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto index a2db3110a2d..0d87246fa7f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ message PurgeMetadata {} message PurgeUserEventsRequest { // Required. The resource name of the catalog under which the events are // created. The format is - // "projects/${projectId}/locations/global/catalogs/${catalogId}" + // `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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto new file mode 100644 index 00000000000..8b1489921fe --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -0,0 +1,812 @@ +// Copyright 2021 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.v2beta; + +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/v2beta/common.proto"; +import "google/cloud/retail/v2beta/product.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "SearchServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Service for search. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com) if you are +// interested in using Retail Search. +service SearchService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Performs a search. + // + // This feature is only available for users who have Retail Search enabled. + // Contact Retail Support (retail-search-support@google.com) if you are + // interested in using Retail Search. + rpc Search(SearchRequest) returns (SearchResponse) { + option (google.api.http) = { + post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" + body: "*" + }; + } +} + +// Request message for +// [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] +// method. +message SearchRequest { + // A facet specification to perform faceted search. + message FacetSpec { + // Specifies how a facet is computed. + message FacetKey { + // Required. Supported textual and numerical facet keys in + // [Product][google.cloud.retail.v2beta.Product] object, over which the + // facet values are computed. Facet key is case-sensitive. + // + // Allowed facet keys when + // [FacetKey.query][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.query] + // is not specified: + // + // * textual_field =
+ // + // *# The + // [Product.brands][google.cloud.retail.v2beta.Product.brands].
* + //
+ // "brands"; + //
+ // + // *# The + // [Product.categories][google.cloud.retail.v2beta.Product.categories].
* + //
+ // "categories"; + //
+ // + // *# The + // [Audience.genders][google.cloud.retail.v2beta.Audience.genders].
* + //
+ // | "genders"; + //
+ // + // *# The + // [Audience.age_groups][google.cloud.retail.v2beta.Audience.age_groups].
* + //
+ // | "ageGroups"; + //
+ // + // *# The + // [Product.availability][google.cloud.retail.v2beta.Product.availability]. + // Value is one of
* + // *# "IN_STOCK", "OUT_OF_STOCK", PREORDER", "BACKORDER".
* + //
+ // | "availability"; + //
+ // + // *# The + // [ColorInfo.color_families][google.cloud.retail.v2beta.ColorInfo.color_families].
* + //
+ // | "colorFamilies"; + //
+ // + // *# The + // [ColorInfo.colors][google.cloud.retail.v2beta.ColorInfo.colors].
* + //
+ // | "colors"; + //
+ // + // *# The + // [Product.sizes][google.cloud.retail.v2beta.Product.sizes].
* + //
+ // | "sizes"; + //
+ // + // *# The + // [Product.materials][google.cloud.retail.v2beta.Product.materials].
* + //
+ // | "materials"; + //
+ // + // *# The + // [Product.patterns][google.cloud.retail.v2beta.Product.patterns].
* + //
+ // | "patterns"; + //
+ // + // *# The + // [Product.conditions][google.cloud.retail.v2beta.Product.conditions].
* + //
+ // | "conditions"; + //
+ // + // *# The textual custom attribute in + // [Product][google.cloud.retail.v2beta.Product] object. Key can
* + // *# be any key in the + // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] + // map
* + // *# if the attribute values are textual.
* + // *# map.
* + //
+ // | "attributes.key"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.PICKUP_IN_STORE][].
* + //
+ // | "pickupInStore"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.SHIP_TO_STORE][].
* + //
+ // | "shipToStore"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
* + //
+ // | "sameDayDelivery"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
* + //
+ // | "nextDayDelivery"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
* + //
+ // | "customFulfillment1"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
* + //
+ // | "customFulfillment2"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
* + //
+ // | "customFulfillment3"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
* + //
+ // | "customFulfillment4"; + //
+ // + // *# The [FulfillmentInfo.ids][] for type + // *# [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
* + //
+ // | "customFulfillment5"; + // + // * numerical_field =
+ // + // *# The + // [PriceInfo.price][google.cloud.retail.v2beta.PriceInfo.price].
* + //
+ // "price"; + //
+ // + // *# The discount. Computed by (original_price-price)/price
* + //
+ // "discount"; + //
+ // + // *# The + // [Rating.average_rating][google.cloud.retail.v2beta.Rating.average_rating].
* + //
+ // "rating"; + //
+ // + // *# The + // [Rating.rating_count][google.cloud.retail.v2beta.Rating.rating_count].
* + //
+ // "ratingCount"; + //
+ // + // *# The numerical custom attribute in + // [Product][google.cloud.retail.v2beta.Product] object. Key can
* + // *# be any key in the + // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] + // map
* + // *# if the attribute values are numerical.
* + //
+ // | "attributes.key"; + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Set only if values should be bucketized into intervals. Must be set + // for facets with numerical values. Must not be set for facet with text + // values. Maximum number of intervals is 30. + repeated Interval intervals = 2; + + // Only get facet for the given restricted values. For example, when using + // "pickupInStore" as key and set restricted values to + // ["store123", "store456"], only facets for "store123" and "store456" are + // returned. Only supported on textual fields and fulfillments. + // Maximum is 20. + // + // Must be set for the fulfillment facet keys: + // + // * pickupInStore + // + // * shipToStore + // + // * sameDayDelivery + // + // * nextDayDelivery + // + // * customFulfillment1 + // + // * customFulfillment2 + // + // * customFulfillment3 + // + // * customFulfillment4 + // + // * customFulfillment5 + repeated string restricted_values = 3; + + // Only get facet values that start with the given string prefix. For + // example, suppose "categories" has three values "Women > Shoe", + // "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the + // "categories" facet will give only "Women > Shoe" and "Women > Dress". + // Only supported on textual fields. Maximum is 10. + repeated string prefixes = 8; + + // Only get facet values that contains the given strings. For example, + // suppose "categories" has three values "Women > Shoe", + // "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the + // "categories" facet will give only "Women > Shoe" and "Men > Shoe". + // Only supported on textual fields. Maximum is 10. + repeated string contains = 9; + + // The order in which [Facet.values][] are returned. + // + // Allowed values are: + // + // * "count desc", which means order by [Facet.FacetValue.count][] + // descending. + // + // * "value desc", which means order by [Facet.FacetValue.value][] + // descending. + // Only applies to textual facets. + // + // If not set, textual values are sorted in [natural + // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical + // intervals are sorted in the order given by + // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals]; + // [FulfillmentInfo.ids][] are sorted in the order given by + // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.restricted_values]. + string order_by = 4; + + // The query that is used to compute facet for the given facet key. + // When provided, it will override the default behavior of facet + // computation. The query syntax is the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + // for detail syntax and limitations. Notice that there is no limitation + // on + // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] + // when query is specified. + // + // In the response, [FacetValue.value][] will be always "1" and + // [FacetValue.count][] will be the number of results that matches the + // query. + // + // For example, you can set a customized facet for "shipToStore", + // where + // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] + // is "customizedShipToStore", and + // [FacetKey.query][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.query] + // is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". + // Then the facet will count the products that are both in stock and ship + // to store "123". + string query = 5; + } + + // Required. The facet key specification. + FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Maximum of facet values that should be returned for this facet. If + // unspecified, defaults to 20. The maximum allowed value is 300. Values + // above 300 will be coerced to 300. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 limit = 2; + + // List of keys to exclude when faceting. + // + // By default, + // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] + // is not excluded from the filter unless it is listed in this field. + // + // For example, suppose there are 100 products with color facet "Red" and + // 200 products with color facet "Blue". A query containing the filter + // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] + // will by default return the "Red" with count 100. + // + // If this field contains "colorFamilies", then the query returns both the + // "Red" with count 100 and "Blue" with count 200, because the + // "colorFamilies" key is now excluded from the filter. + // + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + repeated string excluded_filter_keys = 3; + + // Enables dynamic position for this facet. If set to true, the position of + // this facet among all facets in the response is determined by Google + // Retail Search. It will be ordered together with dynamic facets if dynamic + // facets is enabled. If set to false, the position of this facet in the + // response will be the same as in the request, and it will be ranked before + // the facets with dynamic position enable and all dynamic facets. + // + // For example, you may always want to have rating facet returned in + // the response, but it's not necessarily to always display the rating facet + // at the top. In that case, you can set enable_dynamic_position to true so + // that the position of rating facet in response will be determined by + // Google Retail Search. + // + // Another example, assuming you have the following facets in the request: + // + // * "rating", enable_dynamic_position = true + // + // * "price", enable_dynamic_position = false + // + // * "brands", enable_dynamic_position = false + // + // And also you have a dynamic facets enable, which will generate a facet + // 'gender'. Then the final order of the facets in the response can be + // ("price", "brands", "rating", "gender") or ("price", "brands", "gender", + // "rating") depends on how Google Retail Search orders "gender" and + // "rating" facets. However, notice that "price" and "brands" will always be + // ranked at 1st and 2nd position since their enable_dynamic_position are + // false. + bool enable_dynamic_position = 4; + } + + // The specifications of dynamically generated facets. + message DynamicFacetSpec { + // Enum to control DynamicFacet mode + enum Mode { + // Default value. + MODE_UNSPECIFIED = 0; + + // Disable Dynamic Facet. + DISABLED = 1; + + // Automatic mode built by Google Retail Search. + ENABLED = 2; + } + + // Mode of the DynamicFacet feature. + // Defaults to + // [Mode.DISABLED][google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode.DISABLED] + // if it's unset. + Mode mode = 1; + } + + // Boost specification to boost certain items. + message BoostSpec { + // Boost applies to products which match a condition. + message ConditionBoostSpec { + // An expression which specifies a boost condition. The syntax and + // supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + // for detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string condition = 1; + + // Strength of the condition boost, which should be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 2; + } + + // Condition boost specifications. If a product matches multiple conditions + // in the specifictions, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 10. + repeated ConditionBoostSpec condition_boost_specs = 1; + } + + // Specification to determine under which conditions query expansion should + // occur. + message QueryExpansionSpec { + // Enum describing under which condition query expansion should occur. + enum Condition { + // Unspecified query expansion condition. This defaults to + // [Condition.DISABLED][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. + CONDITION_UNSPECIFIED = 0; + + // Disabled query expansion. Only the exact search query is used, even if + // [SearchResponse.total_size][google.cloud.retail.v2beta.SearchResponse.total_size] + // is zero. + DISABLED = 1; + + // Automatic query expansion built by Google Retail Search. + AUTO = 3; + } + + // The condition under which query expansion should occur. Default to + // [Condition.DISABLED][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. + Condition condition = 1; + } + + // Required. The resource name of the search engine placement, such as + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + // This field is used to identify the set of models that will be used to make + // the search. + // + // We currently support one placement with the following ID: + // + // * `default_search`. + string placement = 1 [(google.api.field_behavior) = REQUIRED]; + + // The branch resource name, such as + // `projects/*/locations/global/catalogs/default_catalog/branches/0`. + // + // Use "default_branch" as the branch ID or leave this field empty, to search + // products under the default branch. + string branch = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Raw search query. + string query = 3; + + // 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 logs in or 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 = 4 [(google.api.field_behavior) = REQUIRED]; + + // User information. + UserInfo user_info = 5; + + // Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return. + // If unspecified, defaults to a reasonable value. The maximum allowed value + // is 120. Values above 120 will be coerced to 120. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 page_size = 7; + + // A page token + // [SearchResponse.next_page_token][google.cloud.retail.v2beta.SearchResponse.next_page_token], + // received from a previous + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + // call. Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + // must match the call that provided the page token. Otherwise, an + // INVALID_ARGUMENT error is returned. + string page_token = 8; + + // A 0-indexed integer that specifies the current offset (that is, starting + // result location, amongst the [Product][google.cloud.retail.v2beta.Product]s + // deemed by the API as relevant) in search results. This field is only + // considered if + // [page_token][google.cloud.retail.v2beta.SearchRequest.page_token] is unset. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + int32 offset = 9; + + // The filter syntax consists of an expression language for constructing a + // predicate from one or more fields of the products being filtered. Filter + // expression is case-sensitive. See more details at this [user + // guide](/retail/private/docs/filter-and-order#filter). + // + // If this field is unrecognizable, an INVALID_ARGUMENT is returned. + string filter = 10; + + // The filter applied to every search request when quality improvement such as + // query expansion is needed. For example, if a query does not have enough + // results, an expanded query with + // [SearchRequest.canonical_filter][google.cloud.retail.v2beta.SearchRequest.canonical_filter] + // will be returned as a supplement of the original query. This field is + // strongly recommended to achieve high search quality. + // + // See [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + // for more details about filter syntax. + string canonical_filter = 28; + + // The order in which products are returned. Products can be ordered by + // a field in an [Product][google.cloud.retail.v2beta.Product] object. Leave + // it unset if ordered by relevance. OrderBy expression is case-sensitive. See + // more details at this [user + // guide](/retail/private/docs/filter-and-order#order). + // + // If this field is unrecognizable, an INVALID_ARGUMENT is returned. + string order_by = 11; + + // Facet specifications for faceted search. If empty, no facets are returned. + // + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + repeated FacetSpec facet_specs = 12; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // This feature requires additional allowlisting. Contact Retail Support + // (retail-search-support@google.com) if you are interested in using dynamic + // facet feature. + DynamicFacetSpec dynamic_facet_spec = 21; + + // Boost specification to boost certain products. See more details at this + // [user guide](/retail/private/docs/boosting). + BoostSpec boost_spec = 13; + + // The query expansion specification that specifies the conditions under which + // query expansion will occur. See more details at this [user + // guide](/retail/private/docs/result-size#query_expansion). + QueryExpansionSpec query_expansion_spec = 14; + + // The keys to fetch and rollup the matching + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s attributes. The attributes + // from all the matching + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s are merged and + // de-duplicated. Notice that rollup + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s attributes will lead to + // extra query latency. Maximum number of keys is 10. + // + // For + // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info], + // a fulfillment type and a fulfillment ID must be provided in the format of + // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + // "pickupInStore" is fulfillment type and "store123" is the store ID. + // + // Supported keys are: + // + // * colorFamilies + // * price + // * originalPrice + // * discount + // * attributes.key, where key is any key in the + // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. + // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.PICKUP_IN_STORE][]. + // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.SHIP_TO_STORE][]. + // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][]. + // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][]. + // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_1][]. + // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_2][]. + // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_3][]. + // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_4][]. + // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type + // [FulfillmentInfo.Type.CUSTOM_TYPE_5][]. + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + repeated string variant_rollup_keys = 17; + + // The categories associated with a category page. Required for category + // navigation queries to achieve good search quality. The format should be + // the same as + // [UserEvent.page_categories][google.cloud.retail.v2beta.UserEvent.page_categories]; + // + // 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"]. + repeated string page_categories = 23; +} + +// Response message for +// [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] +// method. +message SearchResponse { + // Represents the search results. + message SearchResult { + // [Product.id][google.cloud.retail.v2beta.Product.id] of the searched + // [Product][google.cloud.retail.v2beta.Product]. + string id = 1; + + // The product data snippet in the search response. Only + // [Product.name][google.cloud.retail.v2beta.Product.name] is guaranteed to + // be populated. + // + // [Product.variants][google.cloud.retail.v2beta.Product.variants] contains + // the product variants that match the search query. If there are multiple + // product variants matching the query, top 5 most relevant product variants + // are returned and ordered by relevancy. + // + // If relevancy can be deternmined, use + // [matching_variant_fields][google.cloud.retail.v2beta.SearchResponse.SearchResult.matching_variant_fields] + // to look up matched product variants fields. If relevancy cannot be + // determined, e.g. when searching "shoe" all products in a shoe product can + // be a match, 5 product variants are returned but order is meaningless. + Product product = 2; + + // The count of matched + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s. + int32 matching_variant_count = 3; + + // If a [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product] matches the search query, + // this map indicates which [Product][google.cloud.retail.v2beta.Product] + // fields are matched. The key is the + // [Product.name][google.cloud.retail.v2beta.Product.name], the value is a + // field mask of the matched [Product][google.cloud.retail.v2beta.Product] + // fields. If matched attributes cannot be determined, this map will be + // empty. + // + // For example, a key "sku1" with field mask + // "products.color_info" indicates there is a match between + // "sku1" [ColorInfo][google.cloud.retail.v2beta.ColorInfo] and the query. + map matching_variant_fields = 4; + + // The rollup matching + // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product] attributes. The key is one + // of the + // [SearchRequest.variant_rollup_keys][google.cloud.retail.v2beta.SearchRequest.variant_rollup_keys]. + // The values are the merged and de-duplicated + // [Product][google.cloud.retail.v2beta.Product] attributes. Notice that the + // rollup values are respect filter. For example, when filtering by + // "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is + // returned. + // + // For textual and numerical attributes, the rollup values is a list of + // string or double values with type + // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if + // there are two variants with colors "red" and "blue", the rollup values + // are { key: "colorFamilies" + // value { + // list_value { + // values { string_value: "red" } + // values { string_value: "blue" } + // } + // } + // } + // + // For + // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info], + // the rollup values is a double value with type + // [google.protobuf.Value][google.protobuf.Value]. For example, {key: + // "pickupInStore.store1" value { number_value: 10 }} means a there are 10 + // variants in this product are available in the store "store1". + map variant_rollup_values = 5; + } + + // A facet result. + message Facet { + // A facet value which contains value names and their count. + message FacetValue { + // A facet value which contains values. + oneof facet_value { + // Text value of a facet, such as "Black" for facet "colorFamilies". + string value = 1; + + // Interval value for a facet, such as [10, 20) for facet "price". + Interval interval = 2; + } + + // Number of items that have this facet value. + int64 count = 3; + } + + // The key for this facet. E.g., "colorFamilies" or "price" or + // "attributes.attr1". + string key = 1; + + // The facet values for this field. + repeated FacetValue values = 2; + + // Whether the facet is dynamically generated. + bool dynamic_facet = 3; + } + + // Information describing query expansion including whether expansion has + // occurred. + message QueryExpansionInfo { + // Bool describing whether query expansion has occurred. + bool expanded_query = 1; + } + + // A list of matched items. The order represents the ranking. + repeated SearchResult results = 1; + + // Results of facets requested by user. + repeated Facet facets = 2; + + // The estimated total count of matched items irrespective of pagination. The + // count of [results][google.cloud.retail.v2beta.SearchResponse.results] + // returned by pagination may be less than the + // [total_size][google.cloud.retail.v2beta.SearchResponse.total_size] that + // matches. + int32 total_size = 3; + + // If spell correction applies, the corrected query. Otherwise, empty. + string corrected_query = 4; + + // A unique search token. This should be included in the + // [UserEvent][google.cloud.retail.v2beta.UserEvent] logs resulting from this + // search, which enables accurate attribution of search model performance. + string attribution_token = 5; + + // A token that can be sent as + // [SearchRequest.page_token][google.cloud.retail.v2beta.SearchRequest.page_token] + // to retrieve the next page. If this field is omitted, there are no + // subsequent pages. + string next_page_token = 6; + + // Query expansion information for the returned results. + QueryExpansionInfo query_expansion_info = 7; + + // The URI of a customer-defined redirect page. If redirect action is + // triggered, no search will be performed, and only + // [redirect_uri][google.cloud.retail.v2beta.SearchResponse.redirect_uri] and + // [attribution_token][google.cloud.retail.v2beta.SearchResponse.attribution_token] + // will be set in the response. + string redirect_uri = 10; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index a8efad4dd78..f132eedcc39 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,8 +40,11 @@ message UserEvent { // * `add-to-cart`: Products being added to cart. // * `category-page-view`: Special pages such as sale or promotion pages // viewed. + // * `completion`: Completion query result showed/clicked. // * `detail-page-view`: Products detail page viewed. // * `home-page-view`: Homepage viewed. + // * `promotion-offered`: Promotion is offered to a user. + // * `promotion-not-offered`: Promotion is not offered to a user. // * `purchase-complete`: User finishing a purchase. // * `search`: Product search. // * `shopping-cart-page-view`: User viewing a shopping cart. @@ -55,8 +58,23 @@ message UserEvent { // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // The field should not contain PII or user-data. We recommend to use Google + // Analystics [Client + // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) + // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; + // A unique identifier for tracking a visitor session with a length limit of + // 128 bytes. A session is an aggregation of an end user behavior in a time + // span. + // + // A general guideline to populate the sesion_id: + // 1. If user has no activity for 30 min, a new session_id should be assigned. + // 2. The session_id should be unique across users, suggest use uuid or add + // visitor_id as prefix. + string session_id = 21; + // Only required for // [UserEventService.ImportUserEvents][google.cloud.retail.v2beta.UserEventService.ImportUserEvents] // method. Timestamp of when the user event happened. @@ -77,6 +95,10 @@ message UserEvent { // [PredictResponse.attribution_token][google.cloud.retail.v2beta.PredictResponse.attribution_token] // for user events that are the result of // [PredictionService.Predict][google.cloud.retail.v2beta.PredictionService.Predict]. + // The value must be a valid + // [SearchResponse.attribution_token][google.cloud.retail.v2beta.SearchResponse.attribution_token] + // for user events that are the result of + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. // // This token enables us to accurately attribute page view or purchase back to // the event and the particular predict response containing this @@ -106,6 +128,13 @@ message UserEvent { // desired. The end user may have not finished broswing the whole page yet. repeated ProductDetail product_details = 6; + // The main completion details related to the event. + // + // In a `completion` event, this field represents the completions returned to + // the end user and the clicked completion by the end user. In a `search` + // event, it represents the search event happens after clicking completion. + CompletionDetail completion_detail = 22; + // 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 @@ -132,13 +161,54 @@ message UserEvent { // The user's search query. // + // See [SearchRequest.query][google.cloud.retail.v2beta.SearchRequest.query] + // for definition. + // // 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. + // At least one of + // [search_query][google.cloud.retail.v2beta.UserEvent.search_query] or + // [page_categories][google.cloud.retail.v2beta.UserEvent.page_categories] is + // required for `search` events. Other event types should not set this field. // Otherwise, an INVALID_ARGUMENT error is returned. string search_query = 10; + // The filter syntax consists of an expression language for constructing a + // predicate from one or more fields of the products being filtered. + // + // See [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + // for definition and syntax. + // + // The value must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + string filter = 16; + + // The order in which products are returned. + // + // See + // [SearchRequest.order_by][google.cloud.retail.v2beta.SearchRequest.order_by] + // for definition and syntax. + // + // The value must be a UTF-8 encoded string with a length limit of 1,000 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + // + // This can only be set for `search` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + string order_by = 17; + + // An integer that specifies the current offset for pagination (the 0-indexed + // starting location, amongst the products deemed by the API as relevant). + // + // See [SearchRequest.offset][google.cloud.retail.v2beta.SearchRequest.offset] + // for definition. + // + // If this field is negative, an INVALID_ARGUMENT is returned. + // + // This can only be set for `search` events. Other event types should not set + // this field. Otherwise, an INVALID_ARGUMENT error is returned. + int32 offset = 18; + // The categories associated with a category page. // // To represent full path of category, use '>' sign to separate different @@ -149,8 +219,11 @@ message UserEvent { // 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. + // Required for `category-page-view` events. At least one of + // [search_query][google.cloud.retail.v2beta.UserEvent.search_query] or + // [page_categories][google.cloud.retail.v2beta.UserEvent.page_categories] is + // required for `search` events. Other event types should not set this field. + // Otherwise, an INVALID_ARGUMENT error is returned. repeated string page_categories = 11; // User information. @@ -199,6 +272,23 @@ message ProductDetail { google.protobuf.Int32Value quantity = 2; } +// Detailed completion information including completion attribution token and +// clicked completion info. +message CompletionDetail { + // Completion attribution token in + // [CompleteQueryResponse.attribution_token][google.cloud.retail.v2beta.CompleteQueryResponse.attribution_token]. + string completion_attribution_token = 1; + + // End user selected + // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.suggestion]. + string selected_suggestion = 2; + + // End user selected + // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.suggestion] + // position, starting from 0. + int32 selected_position = 3; +} + // A transaction represents the entire purchase transaction. message PurchaseTransaction { // The transaction ID with a length limit of 128 characters. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto index 9c2f86d9ecd..c2da08739a8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ 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/v2beta/export_config.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/purge_config.proto"; import "google/cloud/retail/v2beta/user_event.proto"; @@ -117,7 +118,7 @@ service UserEventService { // Request message for WriteUserEvent method. message WriteUserEventRequest { // Required. The parent catalog resource name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `projects/1234/locations/global/catalogs/default_catalog`. string parent = 1 [(google.api.field_behavior) = REQUIRED]; // Required. User event to write. @@ -127,7 +128,7 @@ message WriteUserEventRequest { // Request message for CollectUserEvent method. message CollectUserEventRequest { // Required. The parent catalog name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `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 @@ -168,7 +169,7 @@ message RejoinUserEventsRequest { } // Required. The parent catalog resource name, such as - // "projects/1234/locations/global/catalogs/default_catalog". + // `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 diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 113813bb115..658ef36a606 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -224,457 +224,403 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { - - /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; - - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse - */ - public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; - - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise - */ - public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; - - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog - */ - public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; - - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise - */ - public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; - } - - namespace CatalogService { - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse - */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog - */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; - } - - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { + /** Properties of an Audience. */ + interface IAudience { - /** ListCatalogsRequest parent */ - parent?: (string|null); - - /** ListCatalogsRequest pageSize */ - pageSize?: (number|null); + /** Audience genders */ + genders?: (string[]|null); - /** ListCatalogsRequest pageToken */ - pageToken?: (string|null); + /** Audience ageGroups */ + ageGroups?: (string[]|null); } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents an Audience. */ + class Audience implements IAudience { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new Audience. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); - - /** ListCatalogsRequest parent. */ - public parent: string; + constructor(properties?: google.cloud.retail.v2.IAudience); - /** ListCatalogsRequest pageSize. */ - public pageSize: number; + /** Audience genders. */ + public genders: string[]; - /** ListCatalogsRequest pageToken. */ - public pageToken: string; + /** Audience ageGroups. */ + public ageGroups: string[]; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns Audience instance */ - public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2.IAudience): google.cloud.retail.v2.Audience; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Audience; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Audience; /** - * Verifies a ListCatalogsRequest message. + * Verifies an Audience message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns Audience */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Audience; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this Audience to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { + /** Properties of a ColorInfo. */ + interface IColorInfo { - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2.ICatalog[]|null); + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); - /** ListCatalogsResponse nextPageToken */ - nextPageToken?: (string|null); + /** ColorInfo colors */ + colors?: (string[]|null); } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { /** - * Constructs a new ListCatalogsResponse. + * Constructs a new ColorInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); + constructor(properties?: google.cloud.retail.v2.IColorInfo); - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2.ICatalog[]; + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; - /** ListCatalogsResponse nextPageToken. */ - public nextPageToken: string; + /** ColorInfo colors. */ + public colors: string[]; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance + * @returns ColorInfo instance */ - public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; + public static create(properties?: google.cloud.retail.v2.IColorInfo): google.cloud.retail.v2.ColorInfo; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ColorInfo; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ColorInfo; /** - * Verifies a ListCatalogsResponse message. + * Verifies a ColorInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns ColorInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ColorInfo; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ColorInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2.ICatalog|null); + /** CustomAttribute text */ + text?: (string[]|null); - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** CustomAttribute numbers */ + numbers?: (number[]|null); + + /** CustomAttribute searchable */ + searchable?: (boolean|null); + + /** CustomAttribute indexable */ + indexable?: (boolean|null); } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new CustomAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); + constructor(properties?: google.cloud.retail.v2.ICustomAttribute); - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2.ICatalog|null); + /** CustomAttribute text. */ + public text: string[]; - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); + + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new CustomAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns CustomAttribute instance */ - public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a CustomAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns CustomAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this CustomAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { - /** CustomAttribute text */ - text?: (string[]|null); + /** FulfillmentInfo type */ + type?: (string|null); - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { /** - * Constructs a new CustomAttribute. + * Constructs a new FulfillmentInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICustomAttribute); + constructor(properties?: google.cloud.retail.v2.IFulfillmentInfo); - /** CustomAttribute text. */ - public text: string[]; + /** FulfillmentInfo type. */ + public type: string; - /** CustomAttribute numbers. */ - public numbers: number[]; + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns FulfillmentInfo instance */ - public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; + public static create(properties?: google.cloud.retail.v2.IFulfillmentInfo): google.cloud.retail.v2.FulfillmentInfo; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.FulfillmentInfo; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.FulfillmentInfo; /** - * Verifies a CustomAttribute message. + * Verifies a FulfillmentInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns FulfillmentInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.FulfillmentInfo; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this FulfillmentInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -782,6 +728,120 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an Interval. */ + interface IInterval { + + /** Interval minimum */ + minimum?: (number|null); + + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); + + /** Interval maximum */ + maximum?: (number|null); + + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); + } + + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IInterval); + + /** Interval minimum. */ + public minimum?: (number|null); + + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); + + /** Interval maximum. */ + public maximum?: (number|null); + + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); + + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); + + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); + + /** + * Creates a new Interval instance using the specified properties. + * @param [properties] Properties to set + * @returns Interval instance + */ + public static create(properties?: google.cloud.retail.v2.IInterval): google.cloud.retail.v2.Interval; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Interval; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Interval; + + /** + * Verifies an Interval message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Interval + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Interval; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Interval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a PriceInfo. */ interface IPriceInfo { @@ -796,6 +856,15 @@ export namespace google { /** PriceInfo cost */ cost?: (number|null); + + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); } /** Represents a PriceInfo. */ @@ -819,6 +888,15 @@ export namespace google { /** PriceInfo cost. */ public cost: number; + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + /** * Creates a new PriceInfo instance using the specified properties. * @param [properties] Properties to set @@ -890,6 +968,207 @@ export namespace google { public toJSON(): { [k: string]: any }; } + namespace PriceInfo { + + /** Properties of a PriceRange. */ + interface IPriceRange { + + /** PriceRange price */ + price?: (google.cloud.retail.v2.IInterval|null); + + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2.IInterval|null); + } + + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { + + /** + * Constructs a new PriceRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange); + + /** PriceRange price. */ + public price?: (google.cloud.retail.v2.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2.IInterval|null); + + /** + * Creates a new PriceRange instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceRange instance + */ + public static create(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Verifies a PriceRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Rating. */ + interface IRating { + + /** Rating ratingCount */ + ratingCount?: (number|null); + + /** Rating averageRating */ + averageRating?: (number|null); + + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } + + /** Represents a Rating. */ + class Rating implements IRating { + + /** + * Constructs a new Rating. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRating); + + /** Rating ratingCount. */ + public ratingCount: number; + + /** Rating averageRating. */ + public averageRating: number; + + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; + + /** + * Creates a new Rating instance using the specified properties. + * @param [properties] Properties to set + * @returns Rating instance + */ + public static create(properties?: google.cloud.retail.v2.IRating): google.cloud.retail.v2.Rating; + + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rating; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rating; + + /** + * Verifies a Rating message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rating + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rating; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rating to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a UserInfo. */ interface IUserInfo { @@ -998,113 +1277,206 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource inputUris */ - inputUris?: (string[]|null); + /** Properties of a Promotion. */ + interface IPromotion { - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** Promotion promotionId */ + promotionId?: (string|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents a Promotion. */ + class Promotion implements IPromotion { /** - * Constructs a new GcsSource. + * Constructs a new Promotion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGcsSource); - - /** GcsSource inputUris. */ - public inputUris: string[]; + constructor(properties?: google.cloud.retail.v2.IPromotion); - /** GcsSource dataSchema. */ - public dataSchema: string; + /** Promotion promotionId. */ + public promotionId: string; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns Promotion instance */ - public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; + public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; /** - * Verifies a GcsSource message. + * Verifies a Promotion message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns Promotion */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this Promotion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { + /** Properties of a GcsSource. */ + interface IGcsSource { - /** BigQuerySource projectId */ - projectId?: (string|null); + /** GcsSource inputUris */ + inputUris?: (string[]|null); - /** BigQuerySource datasetId */ - datasetId?: (string|null); + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } - /** BigQuerySource tableId */ - tableId?: (string|null); + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IGcsSource); + + /** GcsSource inputUris. */ + public inputUris: string[]; + + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; + + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); /** BigQuerySource gcsStagingDir */ gcsStagingDir?: (string|null); @@ -1122,6 +1494,9 @@ export namespace google { */ constructor(properties?: google.cloud.retail.v2.IBigQuerySource); + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); + /** BigQuerySource projectId. */ public projectId: string; @@ -1137,6 +1512,9 @@ export namespace google { /** BigQuerySource dataSchema. */ public dataSchema: string; + /** BigQuerySource partition. */ + public partition?: "partitionDate"; + /** * Creates a new BigQuerySource instance using the specified properties. * @param [properties] Properties to set @@ -1487,6 +1865,9 @@ export namespace google { /** ImportProductsRequest parent */ parent?: (string|null); + /** ImportProductsRequest requestId */ + requestId?: (string|null); + /** ImportProductsRequest inputConfig */ inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); @@ -1495,6 +1876,12 @@ export namespace google { /** ImportProductsRequest updateMask */ updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null); + + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } /** Represents an ImportProductsRequest. */ @@ -1509,6 +1896,9 @@ export namespace google { /** ImportProductsRequest parent. */ public parent: string; + /** ImportProductsRequest requestId. */ + public requestId: string; + /** ImportProductsRequest inputConfig. */ public inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); @@ -1518,6 +1908,12 @@ export namespace google { /** ImportProductsRequest updateMask. */ public updateMask?: (google.protobuf.IFieldMask|null); + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode); + + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; + /** * Creates a new ImportProductsRequest instance using the specified properties. * @param [properties] Properties to set @@ -1589,6 +1985,16 @@ export namespace google { public toJSON(): { [k: string]: any }; } + namespace ImportProductsRequest { + + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } + } + /** Properties of an ImportUserEventsRequest. */ interface IImportUserEventsRequest { @@ -1691,6 +2097,108 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { + + /** ImportCompletionDataRequest parent */ + parent?: (string|null); + + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { + + /** + * Constructs a new ImportCompletionDataRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportCompletionDataRequest); + + /** ImportCompletionDataRequest parent. */ + public parent: string; + + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportCompletionDataRequest): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Verifies an ImportCompletionDataRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCompletionDataRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a ProductInputConfig. */ interface IProductInputConfig { @@ -1901,6 +2409,99 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { + + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + } + + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { + + /** + * Constructs a new CompletionDataInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICompletionDataInputConfig); + + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; + + /** + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDataInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.ICompletionDataInputConfig): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Verifies a CompletionDataInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDataInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionDataInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an ImportMetadata. */ interface IImportMetadata { @@ -1915,6 +2516,12 @@ export namespace google { /** ImportMetadata failureCount */ failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } /** Represents an ImportMetadata. */ @@ -1938,6 +2545,12 @@ export namespace google { /** ImportMetadata failureCount. */ public failureCount: (number|Long|string); + /** ImportMetadata requestId. */ + public requestId: string; + + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; + /** * Creates a new ImportMetadata instance using the specified properties. * @param [properties] Properties to set @@ -2303,30 +2916,138 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a Product. */ - interface IProduct { + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { - /** Product name */ - name?: (string|null); + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + } - /** Product id */ - id?: (string|null); + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { - /** Product type */ - type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); + /** + * Constructs a new ImportCompletionDataResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportCompletionDataResponse); - /** Product primaryProductId */ - primaryProductId?: (string|null); + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** Product categories */ - categories?: (string[]|null); + /** + * Creates a new ImportCompletionDataResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IImportCompletionDataResponse): google.cloud.retail.v2.ImportCompletionDataResponse; + + /** + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataResponse; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataResponse; + + /** + * Verifies an ImportCompletionDataResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataResponse; + + /** + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCompletionDataResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Product. */ + interface IProduct { + + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); + + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); + + /** Product gtin */ + gtin?: (string|null); + + /** Product categories */ + categories?: (string[]|null); /** Product title */ title?: (string|null); + /** Product brands */ + brands?: (string[]|null); + /** Product description */ description?: (string|null); + /** Product languageCode */ + languageCode?: (string|null); + /** Product attributes */ attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); @@ -2336,6 +3057,9 @@ export namespace google { /** Product priceInfo */ priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + /** Product rating */ + rating?: (google.cloud.retail.v2.IRating|null); + /** Product availableTime */ availableTime?: (google.protobuf.ITimestamp|null); @@ -2345,11 +3069,44 @@ export namespace google { /** Product availableQuantity */ availableQuantity?: (google.protobuf.IInt32Value|null); + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2.IFulfillmentInfo[]|null); + /** Product uri */ uri?: (string|null); /** Product images */ images?: (google.cloud.retail.v2.IImage[]|null); + + /** Product audience */ + audience?: (google.cloud.retail.v2.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); + + /** Product promotions */ + promotions?: (google.cloud.retail.v2.IPromotion[]|null); + + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants */ + variants?: (google.cloud.retail.v2.IProduct[]|null); } /** Represents a Product. */ @@ -2361,6 +3118,12 @@ export namespace google { */ constructor(properties?: google.cloud.retail.v2.IProduct); + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); + /** Product name. */ public name: string; @@ -2373,15 +3136,27 @@ export namespace google { /** Product primaryProductId. */ public primaryProductId: string; + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; + + /** Product gtin. */ + public gtin: string; + /** Product categories. */ public categories: string[]; /** Product title. */ public title: string; + /** Product brands. */ + public brands: string[]; + /** Product description. */ public description: string; + /** Product languageCode. */ + public languageCode: string; + /** Product attributes. */ public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; @@ -2391,6 +3166,9 @@ export namespace google { /** Product priceInfo. */ public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + /** Product rating. */ + public rating?: (google.cloud.retail.v2.IRating|null); + /** Product availableTime. */ public availableTime?: (google.protobuf.ITimestamp|null); @@ -2400,12 +3178,48 @@ export namespace google { /** Product availableQuantity. */ public availableQuantity?: (google.protobuf.IInt32Value|null); + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2.IFulfillmentInfo[]; + /** Product uri. */ public uri: string; /** Product images. */ public images: google.cloud.retail.v2.IImage[]; + /** Product audience. */ + public audience?: (google.cloud.retail.v2.IAudience|null); + + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + + /** Product sizes. */ + public sizes: string[]; + + /** Product materials. */ + public materials: string[]; + + /** Product patterns. */ + public patterns: string[]; + + /** Product conditions. */ + public conditions: string[]; + + /** Product promotions. */ + public promotions: google.cloud.retail.v2.IPromotion[]; + + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants. */ + public variants: google.cloud.retail.v2.IProduct[]; + + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); + /** * Creates a new Product instance using the specified properties. * @param [properties] Properties to set @@ -2506,6 +3320,9 @@ export namespace google { /** UserEvent visitorId */ visitorId?: (string|null); + /** UserEvent sessionId */ + sessionId?: (string|null); + /** UserEvent eventTime */ eventTime?: (google.protobuf.ITimestamp|null); @@ -2518,6 +3335,9 @@ export namespace google { /** UserEvent productDetails */ productDetails?: (google.cloud.retail.v2.IProductDetail[]|null); + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); + /** UserEvent attributes */ attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); @@ -2530,6 +3350,15 @@ export namespace google { /** UserEvent searchQuery */ searchQuery?: (string|null); + /** UserEvent filter */ + filter?: (string|null); + + /** UserEvent orderBy */ + orderBy?: (string|null); + + /** UserEvent offset */ + offset?: (number|null); + /** UserEvent pageCategories */ pageCategories?: (string[]|null); @@ -2561,6 +3390,9 @@ export namespace google { /** UserEvent visitorId. */ public visitorId: string; + /** UserEvent sessionId. */ + public sessionId: string; + /** UserEvent eventTime. */ public eventTime?: (google.protobuf.ITimestamp|null); @@ -2573,6 +3405,9 @@ export namespace google { /** UserEvent productDetails. */ public productDetails: google.cloud.retail.v2.IProductDetail[]; + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); + /** UserEvent attributes. */ public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; @@ -2585,6 +3420,15 @@ export namespace google { /** UserEvent searchQuery. */ public searchQuery: string; + /** UserEvent filter. */ + public filter: string; + + /** UserEvent orderBy. */ + public orderBy: string; + + /** UserEvent offset. */ + public offset: number; + /** UserEvent pageCategories. */ public pageCategories: string[]; @@ -2767,6 +3611,108 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { + + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); + + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); + + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); + } + + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { + + /** + * Constructs a new CompletionDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICompletionDetail); + + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; + + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; + + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; + + /** + * Creates a new CompletionDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDetail instance + */ + public static create(properties?: google.cloud.retail.v2.ICompletionDetail): google.cloud.retail.v2.CompletionDetail; + + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDetail; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDetail; + + /** + * Verifies a CompletionDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDetail; + + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a PurchaseTransaction. */ interface IPurchaseTransaction { @@ -2881,11 +3827,11 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { /** - * Constructs a new PredictionService service. + * Constructs a new CatalogService service. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited @@ -2893,9277 +3839,10206 @@ export namespace google { constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates new PredictionService service using the specified rpc implementation. + * Creates new CatalogService service using the specified rpc implementation. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse */ - public predict(request: google.cloud.retail.v2.IPredictRequest, callback: google.cloud.retail.v2.PredictionService.PredictCallback): void; + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; /** - * Calls Predict. - * @param request PredictRequest message or plain object + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object * @returns Promise */ - public predict(request: google.cloud.retail.v2.IPredictRequest): Promise; - } - - namespace PredictionService { + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; /** - * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. - * @param error Error, if any - * @param [response] PredictResponse + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2.PredictResponse) => void; - } - - /** Properties of a PredictRequest. */ - interface IPredictRequest { - - /** PredictRequest placement */ - placement?: (string|null); - - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2.IUserEvent|null); - - /** PredictRequest pageSize */ - pageSize?: (number|null); + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; - /** PredictRequest pageToken */ - pageToken?: (string|null); + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; - /** PredictRequest filter */ - filter?: (string|null); + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback): void; - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise + */ + public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest): Promise; - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + */ + public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback): void; - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise + */ + public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest): Promise; } - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + namespace CatalogService { /** - * Constructs a new PredictRequest. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse */ - constructor(properties?: google.cloud.retail.v2.IPredictRequest); + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; - /** PredictRequest placement. */ - public placement: string; + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; - /** PredictRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - /** PredictRequest pageSize. */ - public pageSize: number; + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2.GetDefaultBranchResponse) => void; + } - /** PredictRequest pageToken. */ - public pageToken: string; + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { - /** PredictRequest filter. */ - public filter: string; + /** ListCatalogsRequest parent */ + parent?: (string|null); - /** PredictRequest validateOnly. */ - public validateOnly: boolean; + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); - /** PredictRequest params. */ - public params: { [k: string]: google.protobuf.IValue }; + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } - /** PredictRequest labels. */ - public labels: { [k: string]: string }; + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { /** - * Creates a new PredictRequest instance using the specified properties. + * Constructs a new ListCatalogsRequest. * @param [properties] Properties to set - * @returns PredictRequest instance */ - public static create(properties?: google.cloud.retail.v2.IPredictRequest): google.cloud.retail.v2.PredictRequest; + constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); + + /** ListCatalogsRequest parent. */ + public parent: string; + + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Creates a new ListCatalogsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictRequest + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictRequest + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; /** - * Verifies a PredictRequest message. + * Verifies a ListCatalogsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictRequest + * @returns ListCatalogsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @param message PredictRequest + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictRequest to JSON. + * Converts this ListCatalogsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PredictResponse. */ - interface IPredictResponse { - - /** PredictResponse results */ - results?: (google.cloud.retail.v2.PredictResponse.IPredictionResult[]|null); - - /** PredictResponse attributionToken */ - attributionToken?: (string|null); + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { - /** PredictResponse missingIds */ - missingIds?: (string[]|null); + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2.ICatalog[]|null); - /** PredictResponse validateOnly */ - validateOnly?: (boolean|null); + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a PredictResponse. */ - class PredictResponse implements IPredictResponse { + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { /** - * Constructs a new PredictResponse. + * Constructs a new ListCatalogsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPredictResponse); - - /** PredictResponse results. */ - public results: google.cloud.retail.v2.PredictResponse.IPredictionResult[]; - - /** PredictResponse attributionToken. */ - public attributionToken: string; + constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); - /** PredictResponse missingIds. */ - public missingIds: string[]; + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2.ICatalog[]; - /** PredictResponse validateOnly. */ - public validateOnly: boolean; + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PredictResponse instance + * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2.IPredictResponse): google.cloud.retail.v2.PredictResponse; + public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictResponse + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictResponse + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; /** - * Verifies a PredictResponse message. + * Verifies a ListCatalogsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictResponse + * @returns ListCatalogsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. - * @param message PredictResponse + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictResponse to JSON. + * Converts this ListCatalogsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PredictResponse { - - /** Properties of a PredictionResult. */ - interface IPredictionResult { + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { - /** PredictionResult id */ - id?: (string|null); + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2.ICatalog|null); - /** PredictionResult metadata */ - metadata?: ({ [k: string]: google.protobuf.IValue }|null); - } + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } - /** Represents a PredictionResult. */ - class PredictionResult implements IPredictionResult { + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { - /** - * Constructs a new PredictionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.PredictResponse.IPredictionResult); + /** + * Constructs a new UpdateCatalogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); - /** PredictionResult id. */ - public id: string; + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2.ICatalog|null); - /** PredictionResult metadata. */ - public metadata: { [k: string]: google.protobuf.IValue }; + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** - * Creates a new PredictionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictionResult instance - */ - public static create(properties?: google.cloud.retail.v2.PredictResponse.IPredictionResult): google.cloud.retail.v2.PredictResponse.PredictionResult; + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCatalogRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictResponse.PredictionResult; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictResponse.PredictionResult; - - /** - * Verifies a PredictionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictResponse.PredictionResult; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @param message PredictionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PredictionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } - - /** Represents a ProductService */ - class ProductService extends $protobuf.rpc.Service { + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Constructs a new ProductService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Creates new ProductService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public createProduct(request: google.cloud.retail.v2.ICreateProductRequest, callback: google.cloud.retail.v2.ProductService.CreateProductCallback): void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise + * Verifies an UpdateCatalogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public createProduct(request: google.cloud.retail.v2.ICreateProductRequest): Promise; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCatalogRequest */ - public getProduct(request: google.cloud.retail.v2.IGetProductRequest, callback: google.cloud.retail.v2.ProductService.GetProductCallback): void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest + * @param [options] Conversion options + * @returns Plain object */ - public getProduct(request: google.cloud.retail.v2.IGetProductRequest): Promise; + public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Converts this UpdateCatalogRequest to JSON. + * @returns JSON object */ - public updateProduct(request: google.cloud.retail.v2.IUpdateProductRequest, callback: google.cloud.retail.v2.ProductService.UpdateProductCallback): void; + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { + + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); + + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); + + /** SetDefaultBranchRequest note */ + note?: (string|null); + } + + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise + * Constructs a new SetDefaultBranchRequest. + * @param [properties] Properties to set */ - public updateProduct(request: google.cloud.retail.v2.IUpdateProductRequest): Promise; + constructor(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest); + + /** SetDefaultBranchRequest catalog. */ + public catalog: string; + + /** SetDefaultBranchRequest branchId. */ + public branchId: string; + + /** SetDefaultBranchRequest note. */ + public note: string; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Creates a new SetDefaultBranchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultBranchRequest instance */ - public deleteProduct(request: google.cloud.retail.v2.IDeleteProductRequest, callback: google.cloud.retail.v2.ProductService.DeleteProductCallback): void; + public static create(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public deleteProduct(request: google.cloud.retail.v2.IDeleteProductRequest): Promise; + public static encode(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public importProducts(request: google.cloud.retail.v2.IImportProductsRequest, callback: google.cloud.retail.v2.ProductService.ImportProductsCallback): void; + public static encodeDelimited(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @returns Promise + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public importProducts(request: google.cloud.retail.v2.IImportProductsRequest): Promise; - } - - namespace ProductService { + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. - * @param error Error, if any - * @param [response] Product + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. - * @param error Error, if any - * @param [response] Product + * Verifies a SetDefaultBranchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. - * @param error Error, if any - * @param [response] Product + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultBranchRequest */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. - * @param error Error, if any - * @param [response] Empty + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest + * @param [options] Conversion options + * @returns Plain object */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static toObject(message: google.cloud.retail.v2.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. - * @param error Error, if any - * @param [response] Operation + * Converts this SetDefaultBranchRequest to JSON. + * @returns JSON object */ - type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { - - /** CreateProductRequest parent */ - parent?: (string|null); - - /** CreateProductRequest product */ - product?: (google.cloud.retail.v2.IProduct|null); + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { - /** CreateProductRequest productId */ - productId?: (string|null); + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); } - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { /** - * Constructs a new CreateProductRequest. + * Constructs a new GetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICreateProductRequest); - - /** CreateProductRequest parent. */ - public parent: string; - - /** CreateProductRequest product. */ - public product?: (google.cloud.retail.v2.IProduct|null); + constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest); - /** CreateProductRequest productId. */ - public productId: string; + /** GetDefaultBranchRequest catalog. */ + public catalog: string; /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CreateProductRequest instance + * @returns GetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2.ICreateProductRequest): google.cloud.retail.v2.CreateProductRequest; + public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateProductRequest + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CreateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateProductRequest + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CreateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Verifies a CreateProductRequest message. + * Verifies a GetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateProductRequest + * @returns GetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CreateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateProductRequest to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { - /** GetProductRequest name */ - name?: (string|null); + /** GetDefaultBranchResponse branch */ + branch?: (string|null); + + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** GetDefaultBranchResponse note */ + note?: (string|null); } - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { /** - * Constructs a new GetProductRequest. + * Constructs a new GetDefaultBranchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGetProductRequest); + constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse); - /** GetProductRequest name. */ - public name: string; + /** GetDefaultBranchResponse branch. */ + public branch: string; + + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** GetDefaultBranchResponse note. */ + public note: string; /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GetProductRequest instance + * @returns GetDefaultBranchResponse instance */ - public static create(properties?: google.cloud.retail.v2.IGetProductRequest): google.cloud.retail.v2.GetProductRequest; + public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetProductRequest + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetProductRequest + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Verifies a GetProductRequest message. + * Verifies a GetDefaultBranchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetProductRequest + * @returns GetDefaultBranchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetProductRequest to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { - - /** UpdateProductRequest product */ - product?: (google.cloud.retail.v2.IProduct|null); - - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { - - /** - * Constructs a new UpdateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IUpdateProductRequest); - - /** UpdateProductRequest product. */ - public product?: (google.cloud.retail.v2.IProduct|null); - - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductRequest instance + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static create(properties?: google.cloud.retail.v2.IUpdateProductRequest): google.cloud.retail.v2.UpdateProductRequest; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static encode(message: google.cloud.retail.v2.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse */ - public static encodeDelimited(message: google.cloud.retail.v2.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest, callback: google.cloud.retail.v2.CompletionService.CompleteQueryCallback): void; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateProductRequest; + public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest): Promise; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateProductRequest; + public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest, callback: google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback): void; /** - * Verifies an UpdateProductRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest): Promise; + } - /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateProductRequest; + namespace CompletionService { /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse */ - public static toObject(message: google.cloud.retail.v2.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompleteQueryResponse) => void; /** - * Converts this UpdateProductRequest to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { - /** DeleteProductRequest name */ - name?: (string|null); + /** CompleteQueryRequest catalog */ + catalog?: (string|null); + + /** CompleteQueryRequest query */ + query?: (string|null); + + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); } - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { /** - * Constructs a new DeleteProductRequest. + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IDeleteProductRequest); + constructor(properties?: google.cloud.retail.v2.ICompleteQueryRequest); - /** DeleteProductRequest name. */ - public name: string; + /** CompleteQueryRequest catalog. */ + public catalog: string; + + /** CompleteQueryRequest query. */ + public query: string; + + /** CompleteQueryRequest visitorId. */ + public visitorId: string; + + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; + + /** CompleteQueryRequest deviceType. */ + public deviceType: string; + + /** CompleteQueryRequest dataset. */ + public dataset: string; + + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProductRequest instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2.IDeleteProductRequest): google.cloud.retail.v2.DeleteProductRequest; + public static create(properties?: google.cloud.retail.v2.ICompleteQueryRequest): google.cloud.retail.v2.CompleteQueryRequest; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProductRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.DeleteProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryRequest; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.DeleteProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryRequest; /** - * Verifies a DeleteProductRequest message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProductRequest + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.DeleteProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryRequest; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { + + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]|null); + + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); + + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new PurgeMetadata. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); + constructor(properties?: google.cloud.retail.v2.ICompleteQueryResponse); + + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]; + + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; + + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeMetadata instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; + public static create(properties?: google.cloud.retail.v2.ICompleteQueryResponse): google.cloud.retail.v2.CompleteQueryResponse; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeMetadata + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeMetadata + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse; /** - * Verifies a PurgeMetadata message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeMetadata + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeMetadata to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { + namespace CompleteQueryResponse { - /** PurgeUserEventsRequest parent */ - parent?: (string|null); + /** Properties of a CompletionResult. */ + interface ICompletionResult { - /** PurgeUserEventsRequest filter */ - filter?: (string|null); + /** CompletionResult suggestion */ + suggestion?: (string|null); - /** PurgeUserEventsRequest force */ - force?: (boolean|null); - } + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + } - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { - /** - * Constructs a new PurgeUserEventsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult); - /** PurgeUserEventsRequest parent. */ - public parent: string; + /** CompletionResult suggestion. */ + public suggestion: string; - /** PurgeUserEventsRequest filter. */ - public filter: string; + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - /** PurgeUserEventsRequest force. */ - public force: boolean; + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance - */ - public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { + + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); + } + + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { + + /** + * Constructs a new RecentSearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult); + + /** RecentSearchResult recentSearch. */ + public recentSearch: string; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentSearchResult instance + */ + public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Verifies a RecentSearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentSearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentSearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Verifies a PurgeUserEventsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static verify(message: { [k: string]: any }): (string|null); + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeUserEventsRequest + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; + public predict(request: google.cloud.retail.v2.IPredictRequest, callback: google.cloud.retail.v2.PredictionService.PredictCallback): void; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest - * @param [options] Conversion options - * @returns Plain object + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise */ - public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public predict(request: google.cloud.retail.v2.IPredictRequest): Promise; + } + + namespace PredictionService { /** - * Converts this PurgeUserEventsRequest to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse */ - public toJSON(): { [k: string]: any }; + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2.PredictResponse) => void; } - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { + /** Properties of a PredictRequest. */ + interface IPredictRequest { - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); } - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new PredictRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); + constructor(properties?: google.cloud.retail.v2.IPredictRequest); - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new PredictRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance + * @returns PredictRequest instance */ - public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; + public static create(properties?: google.cloud.retail.v2.IPredictRequest): google.cloud.retail.v2.PredictRequest; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictRequest; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictRequest; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a PredictRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsResponse + * @returns PredictRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictRequest; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this PredictRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a UserEventService */ - class UserEventService extends $protobuf.rpc.Service { + /** Properties of a PredictResponse. */ + interface IPredictResponse { - /** - * Constructs a new UserEventService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new UserEventService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; - - /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and UserEvent - */ - public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest, callback: google.cloud.retail.v2.UserEventService.WriteUserEventCallback): void; - - /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @returns Promise - */ - public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest): Promise; - - /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and HttpBody - */ - public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest, callback: google.cloud.retail.v2.UserEventService.CollectUserEventCallback): void; - - /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @returns Promise - */ - public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest): Promise; - - /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback): void; - - /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @returns Promise - */ - public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest): Promise; - - /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.ImportUserEventsCallback): void; + /** PredictResponse results */ + results?: (google.cloud.retail.v2.PredictResponse.IPredictionResult[]|null); - /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @returns Promise - */ - public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest): Promise; + /** PredictResponse attributionToken */ + attributionToken?: (string|null); - /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback): void; + /** PredictResponse missingIds */ + missingIds?: (string[]|null); - /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @returns Promise - */ - public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest): Promise; + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); } - namespace UserEventService { - - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. - * @param error Error, if any - * @param [response] UserEvent - */ - type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2.UserEvent) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. - * @param error Error, if any - * @param [response] HttpBody - */ - type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. - * @param error Error, if any - * @param [response] Operation - */ - type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Constructs a new PredictResponse. + * @param [properties] Properties to set */ - type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a WriteUserEventRequest. */ - interface IWriteUserEventRequest { - - /** WriteUserEventRequest parent */ - parent?: (string|null); - - /** WriteUserEventRequest userEvent */ - userEvent?: (google.cloud.retail.v2.IUserEvent|null); - } + constructor(properties?: google.cloud.retail.v2.IPredictResponse); - /** Represents a WriteUserEventRequest. */ - class WriteUserEventRequest implements IWriteUserEventRequest { + /** PredictResponse results. */ + public results: google.cloud.retail.v2.PredictResponse.IPredictionResult[]; - /** - * Constructs a new WriteUserEventRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IWriteUserEventRequest); + /** PredictResponse attributionToken. */ + public attributionToken: string; - /** WriteUserEventRequest parent. */ - public parent: string; + /** PredictResponse missingIds. */ + public missingIds: string[]; - /** WriteUserEventRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + /** PredictResponse validateOnly. */ + public validateOnly: boolean; /** - * Creates a new WriteUserEventRequest instance using the specified properties. + * Creates a new PredictResponse instance using the specified properties. * @param [properties] Properties to set - * @returns WriteUserEventRequest instance + * @returns PredictResponse instance */ - public static create(properties?: google.cloud.retail.v2.IWriteUserEventRequest): google.cloud.retail.v2.WriteUserEventRequest; + public static create(properties?: google.cloud.retail.v2.IPredictResponse): google.cloud.retail.v2.PredictResponse; /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns WriteUserEventRequest + * @returns PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.WriteUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictResponse; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns WriteUserEventRequest + * @returns PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.WriteUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictResponse; /** - * Verifies a WriteUserEventRequest message. + * Verifies a PredictResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns WriteUserEventRequest + * @returns PredictResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.WriteUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictResponse; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. - * @param message WriteUserEventRequest + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this PredictResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CollectUserEventRequest. */ - interface ICollectUserEventRequest { - - /** CollectUserEventRequest parent */ - parent?: (string|null); - - /** CollectUserEventRequest userEvent */ - userEvent?: (string|null); + namespace PredictResponse { - /** CollectUserEventRequest uri */ - uri?: (string|null); + /** Properties of a PredictionResult. */ + interface IPredictionResult { - /** CollectUserEventRequest ets */ - ets?: (number|Long|string|null); - } + /** PredictionResult id */ + id?: (string|null); - /** Represents a CollectUserEventRequest. */ - class CollectUserEventRequest implements ICollectUserEventRequest { + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } - /** - * Constructs a new CollectUserEventRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.ICollectUserEventRequest); + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { - /** CollectUserEventRequest parent. */ - public parent: string; + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.PredictResponse.IPredictionResult); - /** CollectUserEventRequest userEvent. */ - public userEvent: string; + /** PredictionResult id. */ + public id: string; - /** CollectUserEventRequest uri. */ - public uri: string; + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; - /** CollectUserEventRequest ets. */ - public ets: (number|Long|string); + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2.PredictResponse.IPredictionResult): google.cloud.retail.v2.PredictResponse.PredictionResult; - /** - * Creates a new CollectUserEventRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CollectUserEventRequest instance - */ - public static create(properties?: google.cloud.retail.v2.ICollectUserEventRequest): google.cloud.retail.v2.CollectUserEventRequest; + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static encode(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static encodeDelimited(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CollectUserEventRequest; + public createProduct(request: google.cloud.retail.v2.ICreateProductRequest, callback: google.cloud.retail.v2.ProductService.CreateProductCallback): void; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CollectUserEventRequest; + public createProduct(request: google.cloud.retail.v2.ICreateProductRequest): Promise; /** - * Verifies a CollectUserEventRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - public static verify(message: { [k: string]: any }): (string|null); + public getProduct(request: google.cloud.retail.v2.IGetProductRequest, callback: google.cloud.retail.v2.ProductService.GetProductCallback): void; /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CollectUserEventRequest + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CollectUserEventRequest; + public getProduct(request: google.cloud.retail.v2.IGetProductRequest): Promise; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @param message CollectUserEventRequest - * @param [options] Conversion options - * @returns Plain object + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProductsResponse */ - public static toObject(message: google.cloud.retail.v2.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public listProducts(request: google.cloud.retail.v2.IListProductsRequest, callback: google.cloud.retail.v2.ProductService.ListProductsCallback): void; /** - * Converts this CollectUserEventRequest to JSON. - * @returns JSON object + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a RejoinUserEventsRequest. */ - interface IRejoinUserEventsRequest { - - /** RejoinUserEventsRequest parent */ - parent?: (string|null); - - /** RejoinUserEventsRequest userEventRejoinScope */ - userEventRejoinScope?: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null); - } - - /** Represents a RejoinUserEventsRequest. */ - class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + public listProducts(request: google.cloud.retail.v2.IListProductsRequest): Promise; /** - * Constructs a new RejoinUserEventsRequest. - * @param [properties] Properties to set + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest); + public updateProduct(request: google.cloud.retail.v2.IUpdateProductRequest, callback: google.cloud.retail.v2.ProductService.UpdateProductCallback): void; - /** RejoinUserEventsRequest parent. */ - public parent: string; + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2.IUpdateProductRequest): Promise; - /** RejoinUserEventsRequest userEventRejoinScope. */ - public userEventRejoinScope: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope); + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2.IDeleteProductRequest, callback: google.cloud.retail.v2.ProductService.DeleteProductCallback): void; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns RejoinUserEventsRequest instance + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise */ - public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest): google.cloud.retail.v2.RejoinUserEventsRequest; + public deleteProduct(request: google.cloud.retail.v2.IDeleteProductRequest): Promise; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static encode(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public importProducts(request: google.cloud.retail.v2.IImportProductsRequest, callback: google.cloud.retail.v2.ProductService.ImportProductsCallback): void; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public importProducts(request: google.cloud.retail.v2.IImportProductsRequest): Promise; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RejoinUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsRequest; + public setInventory(request: google.cloud.retail.v2.ISetInventoryRequest, callback: google.cloud.retail.v2.ProductService.SetInventoryCallback): void; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsRequest; + public setInventory(request: google.cloud.retail.v2.ISetInventoryRequest): Promise; /** - * Verifies a RejoinUserEventsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static verify(message: { [k: string]: any }): (string|null); + public addFulfillmentPlaces(request: google.cloud.retail.v2.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2.ProductService.AddFulfillmentPlacesCallback): void; /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RejoinUserEventsRequest + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsRequest; + public addFulfillmentPlaces(request: google.cloud.retail.v2.IAddFulfillmentPlacesRequest): Promise; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. - * @param message RejoinUserEventsRequest - * @param [options] Conversion options - * @returns Plain object + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static toObject(message: google.cloud.retail.v2.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public removeFulfillmentPlaces(request: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2.ProductService.RemoveFulfillmentPlacesCallback): void; /** - * Converts this RejoinUserEventsRequest to JSON. - * @returns JSON object + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; + public removeFulfillmentPlaces(request: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest): Promise; } - namespace RejoinUserEventsRequest { - - /** UserEventRejoinScope enum. */ - enum UserEventRejoinScope { - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, - JOINED_EVENTS = 1, - UNJOINED_EVENTS = 2 - } - } + namespace ProductService { - /** Properties of a RejoinUserEventsResponse. */ - interface IRejoinUserEventsResponse { + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; - /** RejoinUserEventsResponse rejoinedUserEventsCount */ - rejoinedUserEventsCount?: (number|Long|string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#listProducts}. + * @param error Error, if any + * @param [response] ListProductsResponse + */ + type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListProductsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#setInventory}. + * @param error Error, if any + * @param [response] Operation + */ + type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#addFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#removeFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Represents a RejoinUserEventsResponse. */ - class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { /** - * Constructs a new RejoinUserEventsResponse. + * Constructs a new CreateProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse); + constructor(properties?: google.cloud.retail.v2.ICreateProductRequest); - /** RejoinUserEventsResponse rejoinedUserEventsCount. */ - public rejoinedUserEventsCount: (number|Long|string); + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. + * Creates a new CreateProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsResponse instance + * @returns CreateProductRequest instance */ - public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse): google.cloud.retail.v2.RejoinUserEventsResponse; + public static create(properties?: google.cloud.retail.v2.ICreateProductRequest): google.cloud.retail.v2.CreateProductRequest; /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsResponse + * @returns CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CreateProductRequest; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsResponse + * @returns CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CreateProductRequest; /** - * Verifies a RejoinUserEventsResponse message. + * Verifies a CreateProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsResponse + * @returns CreateProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CreateProductRequest; /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. - * @param message RejoinUserEventsResponse + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this CreateProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsMetadata. */ - interface IRejoinUserEventsMetadata { + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); } - /** Represents a RejoinUserEventsMetadata. */ - class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { /** - * Constructs a new RejoinUserEventsMetadata. + * Constructs a new GetProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata); + constructor(properties?: google.cloud.retail.v2.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * Creates a new GetProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsMetadata instance + * @returns GetProductRequest instance */ - public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static create(properties?: google.cloud.retail.v2.IGetProductRequest): google.cloud.retail.v2.GetProductRequest; /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * Decodes a GetProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsMetadata + * @returns GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetProductRequest; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsMetadata + * @returns GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetProductRequest; /** - * Verifies a RejoinUserEventsMetadata message. + * Verifies a GetProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsMetadata + * @returns GetProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetProductRequest; /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. - * @param message RejoinUserEventsMetadata + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsMetadata to JSON. + * Converts this GetProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - /** Namespace v2alpha. */ - namespace v2alpha { + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { - /** Properties of a ProductLevelConfig. */ - interface IProductLevelConfig { + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2.IProduct|null); - /** ProductLevelConfig ingestionProductType */ - ingestionProductType?: (string|null); + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); - /** ProductLevelConfig merchantCenterProductIdField */ - merchantCenterProductIdField?: (string|null); + /** UpdateProductRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a ProductLevelConfig. */ - class ProductLevelConfig implements IProductLevelConfig { + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { /** - * Constructs a new ProductLevelConfig. + * Constructs a new UpdateProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProductLevelConfig); + constructor(properties?: google.cloud.retail.v2.IUpdateProductRequest); - /** ProductLevelConfig ingestionProductType. */ - public ingestionProductType: string; + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2.IProduct|null); - /** ProductLevelConfig merchantCenterProductIdField. */ - public merchantCenterProductIdField: string; + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new ProductLevelConfig instance using the specified properties. + * Creates a new UpdateProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductLevelConfig instance + * @returns UpdateProductRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProductLevelConfig): google.cloud.retail.v2alpha.ProductLevelConfig; + public static create(properties?: google.cloud.retail.v2.IUpdateProductRequest): google.cloud.retail.v2.UpdateProductRequest; /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. + * Decodes an UpdateProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductLevelConfig + * @returns UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductLevelConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateProductRequest; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductLevelConfig + * @returns UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductLevelConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateProductRequest; /** - * Verifies a ProductLevelConfig message. + * Verifies an UpdateProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductLevelConfig + * @returns UpdateProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductLevelConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateProductRequest; /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. - * @param message ProductLevelConfig + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductLevelConfig to JSON. + * Converts this UpdateProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Catalog. */ - interface ICatalog { + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { - /** Catalog name */ + /** DeleteProductRequest name */ name?: (string|null); - - /** Catalog displayName */ - displayName?: (string|null); - - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); } - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { /** - * Constructs a new Catalog. + * Constructs a new DeleteProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICatalog); + constructor(properties?: google.cloud.retail.v2.IDeleteProductRequest); - /** Catalog name. */ + /** DeleteProductRequest name. */ public name: string; - /** Catalog displayName. */ - public displayName: string; - - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); - /** - * Creates a new Catalog instance using the specified properties. + * Creates a new DeleteProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Catalog instance + * @returns DeleteProductRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + public static create(properties?: google.cloud.retail.v2.IDeleteProductRequest): google.cloud.retail.v2.DeleteProductRequest; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Catalog + * @returns DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.DeleteProductRequest; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Catalog + * @returns DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.DeleteProductRequest; /** - * Verifies a Catalog message. + * Verifies a DeleteProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Catalog + * @returns DeleteProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.DeleteProductRequest; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Catalog to JSON. + * Converts this DeleteProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { - - /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; - - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse - */ - public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest, callback: google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback): void; - - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise - */ - public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest): Promise; - - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog - */ - public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback): void; - - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise - */ - public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest): Promise; - } - - namespace CatalogService { - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse - */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog - */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; - } - - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { + /** Properties of a ListProductsRequest. */ + interface IListProductsRequest { - /** ListCatalogsRequest parent */ + /** ListProductsRequest parent */ parent?: (string|null); - /** ListCatalogsRequest pageSize */ + /** ListProductsRequest pageSize */ pageSize?: (number|null); - /** ListCatalogsRequest pageToken */ + /** ListProductsRequest pageToken */ pageToken?: (string|null); + + /** ListProductsRequest filter */ + filter?: (string|null); + + /** ListProductsRequest readMask */ + readMask?: (google.protobuf.IFieldMask|null); } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents a ListProductsRequest. */ + class ListProductsRequest implements IListProductsRequest { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new ListProductsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); + constructor(properties?: google.cloud.retail.v2.IListProductsRequest); - /** ListCatalogsRequest parent. */ + /** ListProductsRequest parent. */ public parent: string; - /** ListCatalogsRequest pageSize. */ + /** ListProductsRequest pageSize. */ public pageSize: number; - /** ListCatalogsRequest pageToken. */ + /** ListProductsRequest pageToken. */ public pageToken: string; + /** ListProductsRequest filter. */ + public filter: string; + + /** ListProductsRequest readMask. */ + public readMask?: (google.protobuf.IFieldMask|null); + /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new ListProductsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns ListProductsRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2.IListProductsRequest): google.cloud.retail.v2.ListProductsRequest; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a ListProductsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListProductsRequest; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListProductsRequest; /** - * Verifies a ListCatalogsRequest message. + * Verifies a ListProductsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns ListProductsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListProductsRequest; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @param message ListProductsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ListProductsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { + /** Properties of a ListProductsResponse. */ + interface IListProductsResponse { - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2alpha.ICatalog[]|null); + /** ListProductsResponse products */ + products?: (google.cloud.retail.v2.IProduct[]|null); - /** ListCatalogsResponse nextPageToken */ + /** ListProductsResponse nextPageToken */ nextPageToken?: (string|null); } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { + /** Represents a ListProductsResponse. */ + class ListProductsResponse implements IListProductsResponse { /** - * Constructs a new ListCatalogsResponse. + * Constructs a new ListProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse); + constructor(properties?: google.cloud.retail.v2.IListProductsResponse); - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2alpha.ICatalog[]; + /** ListProductsResponse products. */ + public products: google.cloud.retail.v2.IProduct[]; - /** ListCatalogsResponse nextPageToken. */ + /** ListProductsResponse nextPageToken. */ public nextPageToken: string; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new ListProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance + * @returns ListProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static create(properties?: google.cloud.retail.v2.IListProductsResponse): google.cloud.retail.v2.ListProductsResponse; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a ListProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListProductsResponse; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListProductsResponse; /** - * Verifies a ListCatalogsResponse message. + * Verifies a ListProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns ListProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListProductsResponse; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @param message ListProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ListProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { + /** Properties of a SetInventoryRequest. */ + interface ISetInventoryRequest { - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2alpha.ICatalog|null); + /** SetInventoryRequest inventory */ + inventory?: (google.cloud.retail.v2.IProduct|null); - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** SetInventoryRequest setMask */ + setMask?: (google.protobuf.IFieldMask|null); + + /** SetInventoryRequest setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Represents a SetInventoryRequest. */ + class SetInventoryRequest implements ISetInventoryRequest { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new SetInventoryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest); + constructor(properties?: google.cloud.retail.v2.ISetInventoryRequest); - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2alpha.ICatalog|null); + /** SetInventoryRequest inventory. */ + public inventory?: (google.cloud.retail.v2.IProduct|null); - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** SetInventoryRequest setMask. */ + public setMask?: (google.protobuf.IFieldMask|null); + + /** SetInventoryRequest setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new SetInventoryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns SetInventoryRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2.ISetInventoryRequest): google.cloud.retail.v2.SetInventoryRequest; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetInventoryRequest; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetInventoryRequest; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a SetInventoryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns SetInventoryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetInventoryRequest; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @param message SetInventoryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this SetInventoryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { - - /** CustomAttribute text */ - text?: (string[]|null); - - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** Properties of a SetInventoryMetadata. */ + interface ISetInventoryMetadata { } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents a SetInventoryMetadata. */ + class SetInventoryMetadata implements ISetInventoryMetadata { /** - * Constructs a new CustomAttribute. + * Constructs a new SetInventoryMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICustomAttribute); - - /** CustomAttribute text. */ - public text: string[]; - - /** CustomAttribute numbers. */ - public numbers: number[]; + constructor(properties?: google.cloud.retail.v2.ISetInventoryMetadata); /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns SetInventoryMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICustomAttribute): google.cloud.retail.v2alpha.CustomAttribute; + public static create(properties?: google.cloud.retail.v2.ISetInventoryMetadata): google.cloud.retail.v2.SetInventoryMetadata; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetInventoryMetadata; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetInventoryMetadata; /** - * Verifies a CustomAttribute message. + * Verifies a SetInventoryMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns SetInventoryMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetInventoryMetadata; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @param message SetInventoryMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this SetInventoryMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Image. */ - interface IImage { - - /** Image uri */ - uri?: (string|null); - - /** Image height */ - height?: (number|null); - - /** Image width */ - width?: (number|null); + /** Properties of a SetInventoryResponse. */ + interface ISetInventoryResponse { } - /** Represents an Image. */ - class Image implements IImage { + /** Represents a SetInventoryResponse. */ + class SetInventoryResponse implements ISetInventoryResponse { /** - * Constructs a new Image. + * Constructs a new SetInventoryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImage); - - /** Image uri. */ - public uri: string; - - /** Image height. */ - public height: number; - - /** Image width. */ - public width: number; + constructor(properties?: google.cloud.retail.v2.ISetInventoryResponse); /** - * Creates a new Image instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns SetInventoryResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImage): google.cloud.retail.v2alpha.Image; + public static create(properties?: google.cloud.retail.v2.ISetInventoryResponse): google.cloud.retail.v2.SetInventoryResponse; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetInventoryResponse; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetInventoryResponse; /** - * Verifies an Image message. + * Verifies a SetInventoryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns SetInventoryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetInventoryResponse; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @param message SetInventoryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this SetInventoryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PriceInfo. */ - interface IPriceInfo { + /** Properties of an AddFulfillmentPlacesRequest. */ + interface IAddFulfillmentPlacesRequest { - /** PriceInfo currencyCode */ - currencyCode?: (string|null); + /** AddFulfillmentPlacesRequest product */ + product?: (string|null); - /** PriceInfo price */ - price?: (number|null); + /** AddFulfillmentPlacesRequest type */ + type?: (string|null); - /** PriceInfo originalPrice */ - originalPrice?: (number|null); + /** AddFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); - /** PriceInfo cost */ - cost?: (number|null); + /** AddFulfillmentPlacesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a PriceInfo. */ - class PriceInfo implements IPriceInfo { + /** Represents an AddFulfillmentPlacesRequest. */ + class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { /** - * Constructs a new PriceInfo. + * Constructs a new AddFulfillmentPlacesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPriceInfo); + constructor(properties?: google.cloud.retail.v2.IAddFulfillmentPlacesRequest); - /** PriceInfo currencyCode. */ - public currencyCode: string; + /** AddFulfillmentPlacesRequest product. */ + public product: string; - /** PriceInfo price. */ - public price: number; + /** AddFulfillmentPlacesRequest type. */ + public type: string; - /** PriceInfo originalPrice. */ - public originalPrice: number; + /** AddFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; - /** PriceInfo cost. */ - public cost: number; + /** AddFulfillmentPlacesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PriceInfo instance + * @returns AddFulfillmentPlacesRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPriceInfo): google.cloud.retail.v2alpha.PriceInfo; + public static create(properties?: google.cloud.retail.v2.IAddFulfillmentPlacesRequest): google.cloud.retail.v2.AddFulfillmentPlacesRequest; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceInfo + * @returns AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddFulfillmentPlacesRequest; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceInfo + * @returns AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddFulfillmentPlacesRequest; /** - * Verifies a PriceInfo message. + * Verifies an AddFulfillmentPlacesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceInfo + * @returns AddFulfillmentPlacesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddFulfillmentPlacesRequest; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @param message PriceInfo + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceInfo to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserInfo. */ - interface IUserInfo { - - /** UserInfo userId */ - userId?: (string|null); - - /** UserInfo ipAddress */ - ipAddress?: (string|null); - - /** UserInfo userAgent */ - userAgent?: (string|null); - - /** UserInfo directUserRequest */ - directUserRequest?: (boolean|null); + /** Properties of an AddFulfillmentPlacesMetadata. */ + interface IAddFulfillmentPlacesMetadata { } - /** Represents a UserInfo. */ - class UserInfo implements IUserInfo { + /** Represents an AddFulfillmentPlacesMetadata. */ + class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { /** - * Constructs a new UserInfo. + * Constructs a new AddFulfillmentPlacesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserInfo); - - /** UserInfo userId. */ - public userId: string; - - /** UserInfo ipAddress. */ - public ipAddress: string; - - /** UserInfo userAgent. */ - public userAgent: string; - - /** UserInfo directUserRequest. */ - public directUserRequest: boolean; + constructor(properties?: google.cloud.retail.v2.IAddFulfillmentPlacesMetadata); /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns UserInfo instance + * @returns AddFulfillmentPlacesMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserInfo): google.cloud.retail.v2alpha.UserInfo; + public static create(properties?: google.cloud.retail.v2.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2.AddFulfillmentPlacesMetadata; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserInfo + * @returns AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddFulfillmentPlacesMetadata; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserInfo + * @returns AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddFulfillmentPlacesMetadata; /** - * Verifies a UserInfo message. + * Verifies an AddFulfillmentPlacesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserInfo + * @returns AddFulfillmentPlacesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddFulfillmentPlacesMetadata; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. - * @param message UserInfo + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserInfo to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource inputUris */ - inputUris?: (string[]|null); - - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** Properties of an AddFulfillmentPlacesResponse. */ + interface IAddFulfillmentPlacesResponse { } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents an AddFulfillmentPlacesResponse. */ + class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { /** - * Constructs a new GcsSource. + * Constructs a new AddFulfillmentPlacesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IGcsSource); - - /** GcsSource inputUris. */ - public inputUris: string[]; - - /** GcsSource dataSchema. */ - public dataSchema: string; + constructor(properties?: google.cloud.retail.v2.IAddFulfillmentPlacesResponse); /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns AddFulfillmentPlacesResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGcsSource): google.cloud.retail.v2alpha.GcsSource; + public static create(properties?: google.cloud.retail.v2.IAddFulfillmentPlacesResponse): google.cloud.retail.v2.AddFulfillmentPlacesResponse; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddFulfillmentPlacesResponse; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddFulfillmentPlacesResponse; /** - * Verifies a GcsSource message. + * Verifies an AddFulfillmentPlacesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns AddFulfillmentPlacesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddFulfillmentPlacesResponse; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this AddFulfillmentPlacesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { + /** Properties of a RemoveFulfillmentPlacesRequest. */ + interface IRemoveFulfillmentPlacesRequest { - /** BigQuerySource projectId */ - projectId?: (string|null); + /** RemoveFulfillmentPlacesRequest product */ + product?: (string|null); - /** BigQuerySource datasetId */ - datasetId?: (string|null); + /** RemoveFulfillmentPlacesRequest type */ + type?: (string|null); - /** BigQuerySource tableId */ - tableId?: (string|null); + /** RemoveFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); - /** BigQuerySource gcsStagingDir */ - gcsStagingDir?: (string|null); + /** RemoveFulfillmentPlacesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); - /** BigQuerySource dataSchema */ - dataSchema?: (string|null); + /** RemoveFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a BigQuerySource. */ - class BigQuerySource implements IBigQuerySource { + /** Represents a RemoveFulfillmentPlacesRequest. */ + class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { /** - * Constructs a new BigQuerySource. + * Constructs a new RemoveFulfillmentPlacesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IBigQuerySource); + constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest); - /** BigQuerySource projectId. */ - public projectId: string; + /** RemoveFulfillmentPlacesRequest product. */ + public product: string; - /** BigQuerySource datasetId. */ - public datasetId: string; + /** RemoveFulfillmentPlacesRequest type. */ + public type: string; - /** BigQuerySource tableId. */ - public tableId: string; + /** RemoveFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; - /** BigQuerySource gcsStagingDir. */ - public gcsStagingDir: string; + /** RemoveFulfillmentPlacesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); - /** BigQuerySource dataSchema. */ - public dataSchema: string; + /** RemoveFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns BigQuerySource instance + * @returns RemoveFulfillmentPlacesRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IBigQuerySource): google.cloud.retail.v2alpha.BigQuerySource; + public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BigQuerySource + * @returns RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.BigQuerySource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BigQuerySource + * @returns RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.BigQuerySource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Verifies a BigQuerySource message. + * Verifies a RemoveFulfillmentPlacesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BigQuerySource + * @returns RemoveFulfillmentPlacesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.BigQuerySource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. - * @param message BigQuerySource + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BigQuerySource to JSON. + * Converts this RemoveFulfillmentPlacesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInlineSource. */ - interface IProductInlineSource { - - /** ProductInlineSource products */ - products?: (google.cloud.retail.v2alpha.IProduct[]|null); + /** Properties of a RemoveFulfillmentPlacesMetadata. */ + interface IRemoveFulfillmentPlacesMetadata { } - /** Represents a ProductInlineSource. */ - class ProductInlineSource implements IProductInlineSource { + /** Represents a RemoveFulfillmentPlacesMetadata. */ + class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { /** - * Constructs a new ProductInlineSource. + * Constructs a new RemoveFulfillmentPlacesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProductInlineSource); - - /** ProductInlineSource products. */ - public products: google.cloud.retail.v2alpha.IProduct[]; + constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata); /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInlineSource instance + * @returns RemoveFulfillmentPlacesMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProductInlineSource): google.cloud.retail.v2alpha.ProductInlineSource; + public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInlineSource + * @returns RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInlineSource + * @returns RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; /** - * Verifies a ProductInlineSource message. + * Verifies a RemoveFulfillmentPlacesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInlineSource + * @returns RemoveFulfillmentPlacesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @param message ProductInlineSource + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInlineSource to JSON. + * Converts this RemoveFulfillmentPlacesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInlineSource. */ - interface IUserEventInlineSource { - - /** UserEventInlineSource userEvents */ - userEvents?: (google.cloud.retail.v2alpha.IUserEvent[]|null); + /** Properties of a RemoveFulfillmentPlacesResponse. */ + interface IRemoveFulfillmentPlacesResponse { } - /** Represents a UserEventInlineSource. */ - class UserEventInlineSource implements IUserEventInlineSource { + /** Represents a RemoveFulfillmentPlacesResponse. */ + class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { /** - * Constructs a new UserEventInlineSource. + * Constructs a new RemoveFulfillmentPlacesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource); - - /** UserEventInlineSource userEvents. */ - public userEvents: google.cloud.retail.v2alpha.IUserEvent[]; + constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse); /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInlineSource instance + * @returns RemoveFulfillmentPlacesResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource): google.cloud.retail.v2alpha.UserEventInlineSource; + public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInlineSource + * @returns RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInlineSource + * @returns RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; /** - * Verifies a UserEventInlineSource message. + * Verifies a RemoveFulfillmentPlacesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInlineSource + * @returns RemoveFulfillmentPlacesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @param message UserEventInlineSource + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this RemoveFulfillmentPlacesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportErrorsConfig. */ - interface IImportErrorsConfig { - - /** ImportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { } - /** Represents an ImportErrorsConfig. */ - class ImportErrorsConfig implements IImportErrorsConfig { + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { /** - * Constructs a new ImportErrorsConfig. + * Constructs a new PurgeMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig); - - /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); - - /** ImportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new PurgeMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ImportErrorsConfig instance + * @returns PurgeMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig): google.cloud.retail.v2alpha.ImportErrorsConfig; + public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a PurgeMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportErrorsConfig + * @returns PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportErrorsConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportErrorsConfig + * @returns PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportErrorsConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; /** - * Verifies an ImportErrorsConfig message. + * Verifies a PurgeMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportErrorsConfig + * @returns PurgeMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportErrorsConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @param message ImportErrorsConfig + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this PurgeMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportProductsRequest. */ - interface IImportProductsRequest { + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { - /** ImportProductsRequest parent */ + /** PurgeUserEventsRequest parent */ parent?: (string|null); - /** ImportProductsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** PurgeUserEventsRequest filter */ + filter?: (string|null); - /** ImportProductsRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** PurgeUserEventsRequest force */ + force?: (boolean|null); } - /** Represents an ImportProductsRequest. */ - class ImportProductsRequest implements IImportProductsRequest { + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { /** - * Constructs a new ImportProductsRequest. + * Constructs a new PurgeUserEventsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportProductsRequest); + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); - /** ImportProductsRequest parent. */ + /** PurgeUserEventsRequest parent. */ public parent: string; - /** ImportProductsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** PurgeUserEventsRequest filter. */ + public filter: string; - /** ImportProductsRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** PurgeUserEventsRequest force. */ + public force: boolean; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new PurgeUserEventsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsRequest instance + * @returns PurgeUserEventsRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportProductsRequest): google.cloud.retail.v2alpha.ImportProductsRequest; + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsRequest + * @returns PurgeUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsRequest + * @returns PurgeUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; /** - * Verifies an ImportProductsRequest message. + * Verifies a PurgeUserEventsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsRequest + * @returns PurgeUserEventsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @param message ImportProductsRequest + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this PurgeUserEventsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportUserEventsRequest. */ - interface IImportUserEventsRequest { - - /** ImportUserEventsRequest parent */ - parent?: (string|null); - - /** ImportUserEventsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { - /** ImportUserEventsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); } - /** Represents an ImportUserEventsRequest. */ - class ImportUserEventsRequest implements IImportUserEventsRequest { + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new PurgeUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest); - - /** ImportUserEventsRequest parent. */ - public parent: string; - - /** ImportUserEventsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); - /** ImportUserEventsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new PurgeUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsRequest instance + * @returns PurgeUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a PurgeUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsRequest + * @returns PurgeUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @param message ImportUserEventsRequest + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this PurgeUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInputConfig. */ - interface IProductInputConfig { + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { - /** ProductInputConfig productInlineSource */ - productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** ProductInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; - /** ProductInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2.ISearchRequest, callback: google.cloud.retail.v2.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2.ISearchRequest): Promise; } - /** Represents a ProductInputConfig. */ - class ProductInputConfig implements IProductInputConfig { + namespace SearchService { /** - * Constructs a new ProductInputConfig. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse */ - constructor(properties?: google.cloud.retail.v2alpha.IProductInputConfig); + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2.SearchResponse) => void; + } - /** ProductInputConfig productInlineSource. */ - public productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); + /** Properties of a SearchRequest. */ + interface ISearchRequest { - /** ProductInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** SearchRequest placement */ + placement?: (string|null); - /** ProductInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** SearchRequest branch */ + branch?: (string|null); - /** ProductInputConfig source. */ - public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + /** SearchRequest query */ + query?: (string|null); - /** - * Creates a new ProductInputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductInputConfig instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IProductInputConfig): google.cloud.retail.v2alpha.ProductInputConfig; + /** SearchRequest visitorId */ + visitorId?: (string|null); - /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2.IUserInfo|null); - /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchRequest pageSize */ + pageSize?: (number|null); - /** - * Decodes a ProductInputConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInputConfig; + /** SearchRequest pageToken */ + pageToken?: (string|null); - /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInputConfig; + /** SearchRequest offset */ + offset?: (number|null); - /** - * Verifies a ProductInputConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** SearchRequest filter */ + filter?: (string|null); - /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductInputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInputConfig; + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); - /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @param message ProductInputConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** SearchRequest orderBy */ + orderBy?: (string|null); - /** - * Converts this ProductInputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2.SearchRequest.IFacetSpec[]|null); - /** Properties of a UserEventInputConfig. */ - interface IUserEventInputConfig { + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); - /** UserEventInputConfig userEventInlineSource */ - userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); - /** UserEventInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); - /** UserEventInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); } - /** Represents a UserEventInputConfig. */ - class UserEventInputConfig implements IUserEventInputConfig { + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { /** - * Constructs a new UserEventInputConfig. + * Constructs a new SearchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig); + constructor(properties?: google.cloud.retail.v2.ISearchRequest); - /** UserEventInputConfig userEventInlineSource. */ - public userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + /** SearchRequest placement. */ + public placement: string; - /** UserEventInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** SearchRequest branch. */ + public branch: string; - /** UserEventInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** SearchRequest query. */ + public query: string; - /** UserEventInputConfig source. */ - public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; + + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; + + /** SearchRequest orderBy. */ + public orderBy: string; + + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2.SearchRequest.IFacetSpec[]; + + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInputConfig instance + * @returns SearchRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig): google.cloud.retail.v2alpha.UserEventInputConfig; + public static create(properties?: google.cloud.retail.v2.ISearchRequest): google.cloud.retail.v2.SearchRequest; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInputConfig + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInputConfig + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest; /** - * Verifies a UserEventInputConfig message. + * Verifies a SearchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInputConfig + * @returns SearchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @param message UserEventInputConfig + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this SearchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportMetadata. */ - interface IImportMetadata { + namespace SearchRequest { - /** ImportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** Properties of a FacetSpec. */ + interface IFacetSpec { - /** ImportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); - /** ImportMetadata successCount */ - successCount?: (number|Long|string|null); + /** FacetSpec limit */ + limit?: (number|null); - /** ImportMetadata failureCount */ - failureCount?: (number|Long|string|null); - } + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); - /** Represents an ImportMetadata. */ - class ImportMetadata implements IImportMetadata { + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } - /** - * Constructs a new ImportMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IImportMetadata); + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { - /** ImportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec); - /** ImportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); - /** ImportMetadata successCount. */ - public successCount: (number|Long|string); + /** FacetSpec limit. */ + public limit: number; - /** ImportMetadata failureCount. */ - public failureCount: (number|Long|string); + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; - /** - * Creates a new ImportMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportMetadata instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IImportMetadata): google.cloud.retail.v2alpha.ImportMetadata; + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; - /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes an ImportMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportMetadata; + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportMetadata; + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Verifies an ImportMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportMetadata; + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. - * @param message ImportMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Converts this ImportMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Properties of an ImportProductsResponse. */ - interface IImportProductsResponse { + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ImportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + namespace FacetSpec { + + /** Properties of a FacetKey. */ + interface IFacetKey { + + /** FacetKey key */ + key?: (string|null); + + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2.IInterval[]|null); + + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2.IInterval[]; + + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; + + /** FacetKey prefixes. */ + public prefixes: string[]; + + /** FacetKey contains. */ + public contains: string[]; + + /** FacetKey orderBy. */ + public orderBy: string; + + /** FacetKey query. */ + public query: string; + + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** ImportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - } + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { - /** Represents an ImportProductsResponse. */ - class ImportProductsResponse implements IImportProductsResponse { + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null); + } - /** - * Constructs a new ImportProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IImportProductsResponse); + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { - /** ImportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec); - /** ImportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode); - /** - * Creates a new ImportProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductsResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IImportProductsResponse): google.cloud.retail.v2alpha.ImportProductsResponse; + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; - /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsResponse; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; - /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsResponse; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; - /** - * Verifies an ImportProductsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsResponse; + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; - /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @param message ImportProductsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this ImportProductsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of an ImportUserEventsResponse. */ - interface IImportUserEventsResponse { + namespace DynamicFacetSpec { - /** ImportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } - /** ImportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** Properties of a BoostSpec. */ + interface IBoostSpec { - /** ImportUserEventsResponse importSummary */ - importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); - } + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } - /** Represents an ImportUserEventsResponse. */ - class ImportUserEventsResponse implements IImportUserEventsResponse { + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { - /** - * Constructs a new ImportUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse); + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec); - /** ImportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; - /** ImportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** ImportUserEventsResponse importSummary. */ - public importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new ImportUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportUserEventsResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse): google.cloud.retail.v2alpha.ImportUserEventsResponse; + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsResponse; + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsResponse; + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** - * Verifies an ImportUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportUserEventsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsResponse; + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. - * @param message ImportUserEventsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + namespace BoostSpec { + + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { + + /** ConditionBoostSpec condition */ + condition?: (string|null); + + /** ConditionBoostSpec boost */ + boost?: (number|null); + } + + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { + + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec); + + /** ConditionBoostSpec condition. */ + public condition: string; + + /** ConditionBoostSpec boost. */ + public boost: number; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** - * Converts this ImportUserEventsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { + + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null); + } + + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { + + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec); + + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition); + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace QueryExpansionSpec { + + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } } - /** Properties of a UserEventImportSummary. */ - interface IUserEventImportSummary { + /** Properties of a SearchResponse. */ + interface ISearchResponse { - /** UserEventImportSummary joinedEventsCount */ - joinedEventsCount?: (number|Long|string|null); + /** SearchResponse results */ + results?: (google.cloud.retail.v2.SearchResponse.ISearchResult[]|null); - /** UserEventImportSummary unjoinedEventsCount */ - unjoinedEventsCount?: (number|Long|string|null); + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2.SearchResponse.IFacet[]|null); + + /** SearchResponse totalSize */ + totalSize?: (number|null); + + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); + + /** SearchResponse attributionToken */ + attributionToken?: (string|null); + + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); + + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri */ + redirectUri?: (string|null); } - /** Represents a UserEventImportSummary. */ - class UserEventImportSummary implements IUserEventImportSummary { + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { /** - * Constructs a new UserEventImportSummary. + * Constructs a new SearchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary); + constructor(properties?: google.cloud.retail.v2.ISearchResponse); - /** UserEventImportSummary joinedEventsCount. */ - public joinedEventsCount: (number|Long|string); + /** SearchResponse results. */ + public results: google.cloud.retail.v2.SearchResponse.ISearchResult[]; - /** UserEventImportSummary unjoinedEventsCount. */ - public unjoinedEventsCount: (number|Long|string); + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2.SearchResponse.IFacet[]; + + /** SearchResponse totalSize. */ + public totalSize: number; + + /** SearchResponse correctedQuery. */ + public correctedQuery: string; + + /** SearchResponse attributionToken. */ + public attributionToken: string; + + /** SearchResponse nextPageToken. */ + public nextPageToken: string; + + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri. */ + public redirectUri: string; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventImportSummary instance + * @returns SearchResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary): google.cloud.retail.v2alpha.UserEventImportSummary; + public static create(properties?: google.cloud.retail.v2.ISearchResponse): google.cloud.retail.v2.SearchResponse; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventImportSummary + * @returns SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventImportSummary; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventImportSummary + * @returns SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventImportSummary; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse; /** - * Verifies a UserEventImportSummary message. + * Verifies a SearchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventImportSummary + * @returns SearchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventImportSummary; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @param message UserEventImportSummary + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this SearchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Product. */ - interface IProduct { - - /** Product name */ - name?: (string|null); + namespace SearchResponse { - /** Product id */ - id?: (string|null); + /** Properties of a SearchResult. */ + interface ISearchResult { - /** Product type */ - type?: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type|null); + /** SearchResult id */ + id?: (string|null); - /** Product primaryProductId */ - primaryProductId?: (string|null); + /** SearchResult product */ + product?: (google.cloud.retail.v2.IProduct|null); - /** Product categories */ - categories?: (string[]|null); + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); - /** Product title */ - title?: (string|null); + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); - /** Product description */ - description?: (string|null); + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } - /** Product attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { - /** Product tags */ - tags?: (string[]|null); - - /** Product priceInfo */ - priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - - /** Product availableTime */ - availableTime?: (google.protobuf.ITimestamp|null); + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult); - /** Product availability */ - availability?: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability|null); + /** SearchResult id. */ + public id: string; - /** Product availableQuantity */ - availableQuantity?: (google.protobuf.IInt32Value|null); + /** SearchResult product. */ + public product?: (google.cloud.retail.v2.IProduct|null); - /** Product uri */ - uri?: (string|null); + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; - /** Product images */ - images?: (google.cloud.retail.v2alpha.IImage[]|null); - } + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; - /** Represents a Product. */ - class Product implements IProduct { + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; - /** - * Constructs a new Product. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IProduct); + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult): google.cloud.retail.v2.SearchResponse.SearchResult; - /** Product name. */ - public name: string; + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product id. */ - public id: string; + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product type. */ - public type: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type); + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.SearchResult; - /** Product primaryProductId. */ - public primaryProductId: string; + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.SearchResult; - /** Product categories. */ - public categories: string[]; + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Product title. */ - public title: string; + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.SearchResult; - /** Product description. */ - public description: string; + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Product attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Product tags. */ - public tags: string[]; + /** Properties of a Facet. */ + interface IFacet { - /** Product priceInfo. */ - public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + /** Facet key */ + key?: (string|null); - /** Product availableTime. */ - public availableTime?: (google.protobuf.ITimestamp|null); + /** Facet values */ + values?: (google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]|null); - /** Product availability. */ - public availability: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability); + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } - /** Product availableQuantity. */ - public availableQuantity?: (google.protobuf.IInt32Value|null); + /** Represents a Facet. */ + class Facet implements IFacet { - /** Product uri. */ - public uri: string; + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.IFacet); - /** Product images. */ - public images: google.cloud.retail.v2alpha.IImage[]; + /** Facet key. */ + public key: string; - /** - * Creates a new Product instance using the specified properties. - * @param [properties] Properties to set - * @returns Product instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IProduct): google.cloud.retail.v2alpha.Product; + /** Facet values. */ + public values: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]; - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.IFacet): google.cloud.retail.v2.SearchResponse.Facet; - /** - * Decodes a Product message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Product; + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Product; + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a Product message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet; - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Product - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Product; + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet; - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this Product to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet; - namespace Product { + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - VARIANT = 2, - COLLECTION = 3 + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Availability enum. */ - enum Availability { - AVAILABILITY_UNSPECIFIED = 0, - IN_STOCK = 1, - OUT_OF_STOCK = 2, - PREORDER = 3, - BACKORDER = 4 + namespace Facet { + + /** Properties of a FacetValue. */ + interface IFacetValue { + + /** FacetValue value */ + value?: (string|null); + + /** FacetValue interval */ + interval?: (google.cloud.retail.v2.IInterval|null); + + /** FacetValue count */ + count?: (number|Long|string|null); + } + + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { + + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue); + + /** FacetValue value. */ + public value?: (string|null); + + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2.IInterval|null); + + /** FacetValue count. */ + public count: (number|Long|string); + + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); + + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } - } - /** Properties of a UserEvent. */ - interface IUserEvent { + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { - /** UserEvent eventType */ - eventType?: (string|null); + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); + } - /** UserEvent visitorId */ - visitorId?: (string|null); + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { - /** UserEvent eventTime */ - eventTime?: (google.protobuf.ITimestamp|null); + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo); - /** UserEvent experimentIds */ - experimentIds?: (string[]|null); + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; - /** UserEvent attributionToken */ - attributionToken?: (string|null); + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; - /** UserEvent productDetails */ - productDetails?: (google.cloud.retail.v2alpha.IProductDetail[]|null); + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent cartId */ - cartId?: (string|null); + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; - /** UserEvent purchaseTransaction */ - purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; - /** UserEvent searchQuery */ - searchQuery?: (string|null); + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEvent pageCategories */ - pageCategories?: (string[]|null); + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; - /** UserEvent userInfo */ - userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** UserEvent uri */ - uri?: (string|null); + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** UserEvent referrerUri */ - referrerUri?: (string|null); + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { - /** UserEvent pageViewId */ - pageViewId?: (string|null); - } + /** + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** Represents a UserEvent. */ - class UserEvent implements IUserEvent { + /** + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; /** - * Constructs a new UserEvent. - * @param [properties] Properties to set + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEvent); + public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest, callback: google.cloud.retail.v2.UserEventService.WriteUserEventCallback): void; - /** UserEvent eventType. */ - public eventType: string; + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise + */ + public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest): Promise; - /** UserEvent visitorId. */ - public visitorId: string; + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody + */ + public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest, callback: google.cloud.retail.v2.UserEventService.CollectUserEventCallback): void; - /** UserEvent eventTime. */ - public eventTime?: (google.protobuf.ITimestamp|null); + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise + */ + public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest): Promise; - /** UserEvent experimentIds. */ - public experimentIds: string[]; + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback): void; - /** UserEvent attributionToken. */ - public attributionToken: string; + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise + */ + public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest): Promise; - /** UserEvent productDetails. */ - public productDetails: google.cloud.retail.v2alpha.IProductDetail[]; + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.ImportUserEventsCallback): void; - /** UserEvent attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise + */ + public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest): Promise; - /** UserEvent cartId. */ - public cartId: string; + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback): void; - /** UserEvent purchaseTransaction. */ - public purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise + */ + public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest): Promise; + } - /** UserEvent searchQuery. */ - public searchQuery: string; + namespace UserEventService { - /** UserEvent pageCategories. */ - public pageCategories: string[]; + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent + */ + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2.UserEvent) => void; - /** UserEvent userInfo. */ - public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody + */ + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; - /** UserEvent uri. */ - public uri: string; + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - /** UserEvent referrerUri. */ - public referrerUri: string; + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - /** UserEvent pageViewId. */ - public pageViewId: string; + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { + + /** WriteUserEventRequest parent */ + parent?: (string|null); + + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2.IUserEvent|null); + } + + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { /** - * Creates a new UserEvent instance using the specified properties. + * Constructs a new WriteUserEventRequest. * @param [properties] Properties to set - * @returns UserEvent instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEvent): google.cloud.retail.v2alpha.UserEvent; + constructor(properties?: google.cloud.retail.v2.IWriteUserEventRequest); + + /** WriteUserEventRequest parent. */ + public parent: string; + + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2.IUserEvent|null); /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IWriteUserEventRequest): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a WriteUserEventRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEvent + * @returns WriteUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEvent; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.WriteUserEventRequest; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEvent + * @returns WriteUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEvent; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.WriteUserEventRequest; /** - * Verifies a UserEvent message. + * Verifies a WriteUserEventRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEvent + * @returns WriteUserEventRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEvent; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.WriteUserEventRequest; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @param message UserEvent + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEvent to JSON. + * Converts this WriteUserEventRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductDetail. */ - interface IProductDetail { + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { - /** ProductDetail product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** CollectUserEventRequest parent */ + parent?: (string|null); - /** ProductDetail quantity */ - quantity?: (google.protobuf.IInt32Value|null); + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); } - /** Represents a ProductDetail. */ - class ProductDetail implements IProductDetail { + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { /** - * Constructs a new ProductDetail. + * Constructs a new CollectUserEventRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProductDetail); + constructor(properties?: google.cloud.retail.v2.ICollectUserEventRequest); - /** ProductDetail product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** CollectUserEventRequest parent. */ + public parent: string; - /** ProductDetail quantity. */ - public quantity?: (google.protobuf.IInt32Value|null); + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new CollectUserEventRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductDetail instance + * @returns CollectUserEventRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProductDetail): google.cloud.retail.v2alpha.ProductDetail; + public static create(properties?: google.cloud.retail.v2.ICollectUserEventRequest): google.cloud.retail.v2.CollectUserEventRequest; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a CollectUserEventRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductDetail + * @returns CollectUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CollectUserEventRequest; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductDetail + * @returns CollectUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CollectUserEventRequest; /** - * Verifies a ProductDetail message. + * Verifies a CollectUserEventRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductDetail + * @returns CollectUserEventRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CollectUserEventRequest; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @param message ProductDetail + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductDetail to JSON. + * Converts this CollectUserEventRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurchaseTransaction. */ - interface IPurchaseTransaction { - - /** PurchaseTransaction id */ - id?: (string|null); - - /** PurchaseTransaction revenue */ - revenue?: (number|null); - - /** PurchaseTransaction tax */ - tax?: (number|null); + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { - /** PurchaseTransaction cost */ - cost?: (number|null); + /** RejoinUserEventsRequest parent */ + parent?: (string|null); - /** PurchaseTransaction currencyCode */ - currencyCode?: (string|null); + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null); } - /** Represents a PurchaseTransaction. */ - class PurchaseTransaction implements IPurchaseTransaction { + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { /** - * Constructs a new PurchaseTransaction. + * Constructs a new RejoinUserEventsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction); - - /** PurchaseTransaction id. */ - public id: string; - - /** PurchaseTransaction revenue. */ - public revenue: number; - - /** PurchaseTransaction tax. */ - public tax: number; + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest); - /** PurchaseTransaction cost. */ - public cost: number; + /** RejoinUserEventsRequest parent. */ + public parent: string; - /** PurchaseTransaction currencyCode. */ - public currencyCode: string; + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope); /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new RejoinUserEventsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PurchaseTransaction instance + * @returns RejoinUserEventsRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction): google.cloud.retail.v2alpha.PurchaseTransaction; + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest): google.cloud.retail.v2.RejoinUserEventsRequest; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurchaseTransaction + * @returns RejoinUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurchaseTransaction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsRequest; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurchaseTransaction + * @returns RejoinUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurchaseTransaction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsRequest; /** - * Verifies a PurchaseTransaction message. + * Verifies a RejoinUserEventsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurchaseTransaction + * @returns RejoinUserEventsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurchaseTransaction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsRequest; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @param message PurchaseTransaction + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this RejoinUserEventsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { + namespace RejoinUserEventsRequest { + + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { /** - * Constructs a new PredictionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); /** - * Creates new PredictionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse): google.cloud.retail.v2.RejoinUserEventsResponse; /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @returns Promise + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; - } + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - namespace PredictionService { + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsResponse; /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. - * @param error Error, if any - * @param [response] PredictResponse + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; - } + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsResponse; - /** Properties of a PredictRequest. */ - interface IPredictRequest { + /** + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** PredictRequest placement */ - placement?: (string|null); + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsResponse; - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** PredictRequest pageSize */ - pageSize?: (number|null); + /** + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** PredictRequest pageToken */ - pageToken?: (string|null); + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { + } - /** PredictRequest filter */ - filter?: (string|null); + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); + /** + * Constructs a new RejoinUserEventsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata); - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata): google.cloud.retail.v2.RejoinUserEventsMetadata; - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); - } + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Constructs a new PredictRequest. - * @param [properties] Properties to set + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsMetadata; - /** PredictRequest placement. */ - public placement: string; + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsMetadata; - /** PredictRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** + * Verifies a RejoinUserEventsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** PredictRequest pageSize. */ - public pageSize: number; + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsMetadata; - /** PredictRequest pageToken. */ - public pageToken: string; + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** PredictRequest filter. */ - public filter: string; + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** PredictRequest validateOnly. */ - public validateOnly: boolean; + /** Namespace v2alpha. */ + namespace v2alpha { - /** PredictRequest params. */ - public params: { [k: string]: google.protobuf.IValue }; + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { - /** PredictRequest labels. */ - public labels: { [k: string]: string }; + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); + } + + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { /** - * Creates a new PredictRequest instance using the specified properties. + * Constructs a new ProductLevelConfig. * @param [properties] Properties to set - * @returns PredictRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; + constructor(properties?: google.cloud.retail.v2alpha.IProductLevelConfig); + + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Creates a new ProductLevelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductLevelConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductLevelConfig): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a ProductLevelConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictRequest + * @returns ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductLevelConfig; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictRequest + * @returns ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductLevelConfig; /** - * Verifies a PredictRequest message. + * Verifies a ProductLevelConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictRequest + * @returns ProductLevelConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductLevelConfig; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @param message PredictRequest + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictRequest to JSON. + * Converts this ProductLevelConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PredictResponse. */ - interface IPredictResponse { - - /** PredictResponse results */ - results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); + /** Properties of a MerchantCenterLink. */ + interface IMerchantCenterLink { - /** PredictResponse attributionToken */ - attributionToken?: (string|null); + /** MerchantCenterLink merchantCenterAccountId */ + merchantCenterAccountId?: (number|Long|string|null); - /** PredictResponse missingIds */ - missingIds?: (string[]|null); + /** MerchantCenterLink branchId */ + branchId?: (string|null); - /** PredictResponse validateOnly */ - validateOnly?: (boolean|null); + /** MerchantCenterLink destinations */ + destinations?: (string[]|null); } - /** Represents a PredictResponse. */ - class PredictResponse implements IPredictResponse { + /** Represents a MerchantCenterLink. */ + class MerchantCenterLink implements IMerchantCenterLink { /** - * Constructs a new PredictResponse. + * Constructs a new MerchantCenterLink. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); - - /** PredictResponse results. */ - public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink); - /** PredictResponse attributionToken. */ - public attributionToken: string; + /** MerchantCenterLink merchantCenterAccountId. */ + public merchantCenterAccountId: (number|Long|string); - /** PredictResponse missingIds. */ - public missingIds: string[]; + /** MerchantCenterLink branchId. */ + public branchId: string; - /** PredictResponse validateOnly. */ - public validateOnly: boolean; + /** MerchantCenterLink destinations. */ + public destinations: string[]; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new MerchantCenterLink instance using the specified properties. * @param [properties] Properties to set - * @returns PredictResponse instance + * @returns MerchantCenterLink instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a MerchantCenterLink message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictResponse + * @returns MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictResponse + * @returns MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Verifies a PredictResponse message. + * Verifies a MerchantCenterLink message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictResponse + * @returns MerchantCenterLink */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. - * @param message PredictResponse + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. + * @param message MerchantCenterLink * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictResponse to JSON. + * Converts this MerchantCenterLink to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PredictResponse { + /** Properties of a MerchantCenterLinkingConfig. */ + interface IMerchantCenterLinkingConfig { - /** Properties of a PredictionResult. */ - interface IPredictionResult { - - /** PredictionResult id */ - id?: (string|null); - - /** PredictionResult metadata */ - metadata?: ({ [k: string]: google.protobuf.IValue }|null); - } - - /** Represents a PredictionResult. */ - class PredictionResult implements IPredictionResult { - - /** - * Constructs a new PredictionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); - - /** PredictionResult id. */ - public id: string; - - /** PredictionResult metadata. */ - public metadata: { [k: string]: google.protobuf.IValue }; - - /** - * Creates a new PredictionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictionResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - - /** - * Verifies a PredictionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @param message PredictionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PredictionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** MerchantCenterLinkingConfig links */ + links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); } - /** Represents a ProductService */ - class ProductService extends $protobuf.rpc.Service { - - /** - * Constructs a new ProductService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** Represents a MerchantCenterLinkingConfig. */ + class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { /** - * Creates new ProductService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Constructs a new MerchantCenterLinkingConfig. + * @param [properties] Properties to set */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; + /** MerchantCenterLinkingConfig links. */ + public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MerchantCenterLinkingConfig instance */ - public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Verifies a MerchantCenterLinkingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MerchantCenterLinkingConfig */ - public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @param message MerchantCenterLinkingConfig + * @param [options] Conversion options + * @returns Plain object */ - public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @returns Promise + * Converts this MerchantCenterLinkingConfig to JSON. + * @returns JSON object */ - public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; + public toJSON(): { [k: string]: any }; } - namespace ProductService { - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. - * @param error Error, if any - * @param [response] Product - */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. - * @param error Error, if any - * @param [response] Product - */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. - * @param error Error, if any - * @param [response] Product - */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } + /** Properties of a Catalog. */ + interface ICatalog { - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { + /** Catalog name */ + name?: (string|null); - /** CreateProductRequest parent */ - parent?: (string|null); + /** Catalog displayName */ + displayName?: (string|null); - /** CreateProductRequest product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); - /** CreateProductRequest productId */ - productId?: (string|null); + /** Catalog merchantCenterLinkingConfig */ + merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); } - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { + /** Represents a Catalog. */ + class Catalog implements ICatalog { /** - * Constructs a new CreateProductRequest. + * Constructs a new Catalog. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.ICatalog); - /** CreateProductRequest parent. */ - public parent: string; + /** Catalog name. */ + public name: string; - /** CreateProductRequest product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** Catalog displayName. */ + public displayName: string; - /** CreateProductRequest productId. */ - public productId: string; + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig. */ + public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new Catalog instance using the specified properties. * @param [properties] Properties to set - * @returns CreateProductRequest instance + * @returns Catalog instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateProductRequest + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateProductRequest + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; /** - * Verifies a CreateProductRequest message. + * Verifies a Catalog message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateProductRequest + * @returns Catalog */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateProductRequest to JSON. + * Converts this Catalog to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { + /** Properties of an Audience. */ + interface IAudience { - /** GetProductRequest name */ - name?: (string|null); + /** Audience genders */ + genders?: (string[]|null); + + /** Audience ageGroups */ + ageGroups?: (string[]|null); } - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { + /** Represents an Audience. */ + class Audience implements IAudience { /** - * Constructs a new GetProductRequest. + * Constructs a new Audience. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.IAudience); - /** GetProductRequest name. */ - public name: string; + /** Audience genders. */ + public genders: string[]; + + /** Audience ageGroups. */ + public ageGroups: string[]; /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @param [properties] Properties to set - * @returns GetProductRequest instance + * @returns Audience instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IAudience): google.cloud.retail.v2alpha.Audience; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetProductRequest + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Audience; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetProductRequest + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Audience; /** - * Verifies a GetProductRequest message. + * Verifies an Audience message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetProductRequest + * @returns Audience */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Audience; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetProductRequest to JSON. + * Converts this Audience to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { + /** Properties of a ColorInfo. */ + interface IColorInfo { - /** UpdateProductRequest product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** ColorInfo colors */ + colors?: (string[]|null); } - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { /** - * Constructs a new UpdateProductRequest. + * Constructs a new ColorInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.IColorInfo); - /** UpdateProductRequest product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** ColorInfo colors. */ + public colors: string[]; /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateProductRequest instance + * @returns ColorInfo instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IColorInfo): google.cloud.retail.v2alpha.ColorInfo; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateProductRequest + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ColorInfo; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ColorInfo; /** - * Verifies an UpdateProductRequest message. + * Verifies a ColorInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateProductRequest + * @returns ColorInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ColorInfo; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this ColorInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { - /** DeleteProductRequest name */ - name?: (string|null); + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + + /** CustomAttribute searchable */ + searchable?: (boolean|null); + + /** CustomAttribute indexable */ + indexable?: (boolean|null); } - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { /** - * Constructs a new DeleteProductRequest. + * Constructs a new CustomAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.ICustomAttribute); - /** DeleteProductRequest name. */ - public name: string; + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); + + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * Creates a new CustomAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProductRequest instance + * @returns CustomAttribute instance */ - public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.ICustomAttribute): google.cloud.retail.v2alpha.CustomAttribute; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProductRequest + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CustomAttribute; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CustomAttribute; /** - * Verifies a DeleteProductRequest message. + * Verifies a CustomAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProductRequest + * @returns CustomAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CustomAttribute; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this CustomAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { + + /** FulfillmentInfo type */ + type?: (string|null); + + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); } - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { /** - * Constructs a new PurgeMetadata. + * Constructs a new FulfillmentInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeMetadata); + constructor(properties?: google.cloud.retail.v2alpha.IFulfillmentInfo); + + /** FulfillmentInfo type. */ + public type: string; + + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeMetadata instance + * @returns FulfillmentInfo instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeMetadata): google.cloud.retail.v2alpha.PurgeMetadata; + public static create(properties?: google.cloud.retail.v2alpha.IFulfillmentInfo): google.cloud.retail.v2alpha.FulfillmentInfo; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeMetadata + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.FulfillmentInfo; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeMetadata + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.FulfillmentInfo; /** - * Verifies a PurgeMetadata message. + * Verifies a FulfillmentInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeMetadata + * @returns FulfillmentInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.FulfillmentInfo; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeMetadata to JSON. + * Converts this FulfillmentInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { + /** Properties of an Image. */ + interface IImage { - /** PurgeUserEventsRequest parent */ - parent?: (string|null); + /** Image uri */ + uri?: (string|null); - /** PurgeUserEventsRequest filter */ - filter?: (string|null); + /** Image height */ + height?: (number|null); - /** PurgeUserEventsRequest force */ - force?: (boolean|null); + /** Image width */ + width?: (number|null); } - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + /** Represents an Image. */ + class Image implements IImage { /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new Image. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest); + constructor(properties?: google.cloud.retail.v2alpha.IImage); - /** PurgeUserEventsRequest parent. */ - public parent: string; + /** Image uri. */ + public uri: string; - /** PurgeUserEventsRequest filter. */ - public filter: string; + /** Image height. */ + public height: number; - /** PurgeUserEventsRequest force. */ - public force: boolean; + /** Image width. */ + public width: number; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new Image instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance + * @returns Image instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IImage): google.cloud.retail.v2alpha.Image; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest + * @returns Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Image; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest + * @returns Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Image; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies an Image message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsRequest + * @returns Image */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Image; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this Image to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { + /** Properties of an Interval. */ + interface IInterval { - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); + /** Interval minimum */ + minimum?: (number|null); + + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); + + /** Interval maximum */ + maximum?: (number|null); + + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); } - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** Represents an Interval. */ + class Interval implements IInterval { /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new Interval. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); + constructor(properties?: google.cloud.retail.v2alpha.IInterval); - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + /** Interval minimum. */ + public minimum?: (number|null); + + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); + + /** Interval maximum. */ + public maximum?: (number|null); + + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); + + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); + + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new Interval instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance + * @returns Interval instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static create(properties?: google.cloud.retail.v2alpha.IInterval): google.cloud.retail.v2alpha.Interval; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse + * @returns Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Interval; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse + * @returns Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Interval; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies an Interval message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsResponse + * @returns Interval */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Interval; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this Interval to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a UserEventService */ - class UserEventService extends $protobuf.rpc.Service { + /** Properties of a PriceInfo. */ + interface IPriceInfo { - /** - * Constructs a new UserEventService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** PriceInfo currencyCode */ + currencyCode?: (string|null); - /** - * Creates new UserEventService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + /** PriceInfo price */ + price?: (number|null); - /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and UserEvent - */ - public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback): void; + /** PriceInfo originalPrice */ + originalPrice?: (number|null); - /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @returns Promise - */ - public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest): Promise; + /** PriceInfo cost */ + cost?: (number|null); - /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and HttpBody - */ - public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback): void; + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); - /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @returns Promise - */ - public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest): Promise; + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); - /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback): void; + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @returns Promise + * Constructs a new PriceInfo. + * @param [properties] Properties to set */ - public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): Promise; + constructor(properties?: google.cloud.retail.v2alpha.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null); /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance */ - public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback): void; + public static create(properties?: google.cloud.retail.v2alpha.IPriceInfo): google.cloud.retail.v2alpha.PriceInfo; /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @returns Promise + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest): Promise; + public static encode(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback): void; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @returns Promise + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): Promise; - } - - namespace UserEventService { + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. - * @param error Error, if any - * @param [response] UserEvent + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.UserEvent) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. - * @param error Error, if any - * @param [response] HttpBody + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo */ - type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object */ - type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.retail.v2alpha.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Converts this PriceInfo to JSON. + * @returns JSON object */ - type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a WriteUserEventRequest. */ - interface IWriteUserEventRequest { + namespace PriceInfo { - /** WriteUserEventRequest parent */ - parent?: (string|null); + /** Properties of a PriceRange. */ + interface IPriceRange { - /** WriteUserEventRequest userEvent */ - userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** PriceRange price */ + price?: (google.cloud.retail.v2alpha.IInterval|null); + + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2alpha.IInterval|null); + } + + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { + + /** + * Constructs a new PriceRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.PriceInfo.IPriceRange); + + /** PriceRange price. */ + public price?: (google.cloud.retail.v2alpha.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2alpha.IInterval|null); + + /** + * Creates a new PriceRange instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceRange instance + */ + public static create(properties?: google.cloud.retail.v2alpha.PriceInfo.IPriceRange): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + + /** + * Verifies a PriceRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } - /** Represents a WriteUserEventRequest. */ - class WriteUserEventRequest implements IWriteUserEventRequest { + /** Properties of a Rating. */ + interface IRating { + + /** Rating ratingCount */ + ratingCount?: (number|null); + + /** Rating averageRating */ + averageRating?: (number|null); + + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } + + /** Represents a Rating. */ + class Rating implements IRating { /** - * Constructs a new WriteUserEventRequest. + * Constructs a new Rating. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest); + constructor(properties?: google.cloud.retail.v2alpha.IRating); - /** WriteUserEventRequest parent. */ - public parent: string; + /** Rating ratingCount. */ + public ratingCount: number; - /** WriteUserEventRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** Rating averageRating. */ + public averageRating: number; + + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; /** - * Creates a new WriteUserEventRequest instance using the specified properties. + * Creates a new Rating instance using the specified properties. * @param [properties] Properties to set - * @returns WriteUserEventRequest instance + * @returns Rating instance */ - public static create(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static create(properties?: google.cloud.retail.v2alpha.IRating): google.cloud.retail.v2alpha.Rating; /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRating, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRating, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes a Rating message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns WriteUserEventRequest + * @returns Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rating; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a Rating message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns WriteUserEventRequest + * @returns Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rating; /** - * Verifies a WriteUserEventRequest message. + * Verifies a Rating message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Rating message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns WriteUserEventRequest + * @returns Rating */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rating; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. - * @param message WriteUserEventRequest + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this Rating to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CollectUserEventRequest. */ - interface ICollectUserEventRequest { + /** Properties of a UserInfo. */ + interface IUserInfo { - /** CollectUserEventRequest parent */ - parent?: (string|null); + /** UserInfo userId */ + userId?: (string|null); - /** CollectUserEventRequest userEvent */ - userEvent?: (string|null); + /** UserInfo ipAddress */ + ipAddress?: (string|null); - /** CollectUserEventRequest uri */ - uri?: (string|null); + /** UserInfo userAgent */ + userAgent?: (string|null); - /** CollectUserEventRequest ets */ - ets?: (number|Long|string|null); + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); } - /** Represents a CollectUserEventRequest. */ - class CollectUserEventRequest implements ICollectUserEventRequest { + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { /** - * Constructs a new CollectUserEventRequest. + * Constructs a new UserInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest); + constructor(properties?: google.cloud.retail.v2alpha.IUserInfo); - /** CollectUserEventRequest parent. */ - public parent: string; + /** UserInfo userId. */ + public userId: string; - /** CollectUserEventRequest userEvent. */ - public userEvent: string; + /** UserInfo ipAddress. */ + public ipAddress: string; - /** CollectUserEventRequest uri. */ - public uri: string; + /** UserInfo userAgent. */ + public userAgent: string; - /** CollectUserEventRequest ets. */ - public ets: (number|Long|string); + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; /** - * Creates a new CollectUserEventRequest instance using the specified properties. + * Creates a new UserInfo instance using the specified properties. * @param [properties] Properties to set - * @returns CollectUserEventRequest instance + * @returns UserInfo instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static create(properties?: google.cloud.retail.v2alpha.IUserInfo): google.cloud.retail.v2alpha.UserInfo; /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * Decodes a UserInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CollectUserEventRequest + * @returns UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserInfo; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a UserInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CollectUserEventRequest + * @returns UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserInfo; /** - * Verifies a CollectUserEventRequest message. + * Verifies a UserInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CollectUserEventRequest + * @returns UserInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserInfo; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @param message CollectUserEventRequest + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CollectUserEventRequest to JSON. + * Converts this UserInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsRequest. */ - interface IRejoinUserEventsRequest { - - /** RejoinUserEventsRequest parent */ - parent?: (string|null); + /** Properties of a Promotion. */ + interface IPromotion { - /** RejoinUserEventsRequest userEventRejoinScope */ - userEventRejoinScope?: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null); + /** Promotion promotionId */ + promotionId?: (string|null); } - /** Represents a RejoinUserEventsRequest. */ - class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + /** Represents a Promotion. */ + class Promotion implements IPromotion { /** - * Constructs a new RejoinUserEventsRequest. + * Constructs a new Promotion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest); + constructor(properties?: google.cloud.retail.v2alpha.IPromotion); - /** RejoinUserEventsRequest parent. */ - public parent: string; - - /** RejoinUserEventsRequest userEventRejoinScope. */ - public userEventRejoinScope: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope); + /** Promotion promotionId. */ + public promotionId: string; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsRequest instance + * @returns Promotion instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IPromotion): google.cloud.retail.v2alpha.Promotion; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsRequest + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Promotion; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsRequest + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Promotion; /** - * Verifies a RejoinUserEventsRequest message. + * Verifies a Promotion message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsRequest + * @returns Promotion */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Promotion; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. - * @param message RejoinUserEventsRequest + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsRequest to JSON. + * Converts this Promotion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace RejoinUserEventsRequest { - - /** UserEventRejoinScope enum. */ - enum UserEventRejoinScope { - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, - JOINED_EVENTS = 1, - UNJOINED_EVENTS = 2 - } - } + /** Properties of a GcsSource. */ + interface IGcsSource { - /** Properties of a RejoinUserEventsResponse. */ - interface IRejoinUserEventsResponse { + /** GcsSource inputUris */ + inputUris?: (string[]|null); - /** RejoinUserEventsResponse rejoinedUserEventsCount */ - rejoinedUserEventsCount?: (number|Long|string|null); + /** GcsSource dataSchema */ + dataSchema?: (string|null); } - /** Represents a RejoinUserEventsResponse. */ - class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { /** - * Constructs a new RejoinUserEventsResponse. + * Constructs a new GcsSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse); + constructor(properties?: google.cloud.retail.v2alpha.IGcsSource); - /** RejoinUserEventsResponse rejoinedUserEventsCount. */ - public rejoinedUserEventsCount: (number|Long|string); + /** GcsSource inputUris. */ + public inputUris: string[]; - /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsResponse instance + * @returns GcsSource instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static create(properties?: google.cloud.retail.v2alpha.IGcsSource): google.cloud.retail.v2alpha.GcsSource; /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsResponse + * @returns GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GcsSource; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsResponse + * @returns GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GcsSource; /** - * Verifies a RejoinUserEventsResponse message. + * Verifies a GcsSource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsResponse + * @returns GcsSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GcsSource; /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. - * @param message RejoinUserEventsResponse + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this GcsSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsMetadata. */ - interface IRejoinUserEventsMetadata { + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); } - /** Represents a RejoinUserEventsMetadata. */ - class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { /** - * Constructs a new RejoinUserEventsMetadata. + * Constructs a new BigQuerySource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata); + constructor(properties?: google.cloud.retail.v2alpha.IBigQuerySource); + + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** BigQuerySource partition. */ + public partition?: "partitionDate"; /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * Creates a new BigQuerySource instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsMetadata instance + * @returns BigQuerySource instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static create(properties?: google.cloud.retail.v2alpha.IBigQuerySource): google.cloud.retail.v2alpha.BigQuerySource; /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsMetadata + * @returns BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.BigQuerySource; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsMetadata + * @returns BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.BigQuerySource; /** - * Verifies a RejoinUserEventsMetadata message. + * Verifies a BigQuerySource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsMetadata + * @returns BigQuerySource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.BigQuerySource; /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. - * @param message RejoinUserEventsMetadata + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsMetadata to JSON. + * Converts this BigQuerySource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - - /** Namespace v2beta. */ - namespace v2beta { - - /** Properties of a ProductLevelConfig. */ - interface IProductLevelConfig { - /** ProductLevelConfig ingestionProductType */ - ingestionProductType?: (string|null); + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { - /** ProductLevelConfig merchantCenterProductIdField */ - merchantCenterProductIdField?: (string|null); + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2alpha.IProduct[]|null); } - /** Represents a ProductLevelConfig. */ - class ProductLevelConfig implements IProductLevelConfig { + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { /** - * Constructs a new ProductLevelConfig. + * Constructs a new ProductInlineSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductLevelConfig); - - /** ProductLevelConfig ingestionProductType. */ - public ingestionProductType: string; + constructor(properties?: google.cloud.retail.v2alpha.IProductInlineSource); - /** ProductLevelConfig merchantCenterProductIdField. */ - public merchantCenterProductIdField: string; + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2alpha.IProduct[]; /** - * Creates a new ProductLevelConfig instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @param [properties] Properties to set - * @returns ProductLevelConfig instance + * @returns ProductInlineSource instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductLevelConfig): google.cloud.retail.v2beta.ProductLevelConfig; + public static create(properties?: google.cloud.retail.v2alpha.IProductInlineSource): google.cloud.retail.v2alpha.ProductInlineSource; /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductLevelConfig + * @returns ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductLevelConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInlineSource; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductLevelConfig + * @returns ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductLevelConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInlineSource; /** - * Verifies a ProductLevelConfig message. + * Verifies a ProductInlineSource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductLevelConfig + * @returns ProductInlineSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductLevelConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInlineSource; /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. - * @param message ProductLevelConfig + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductLevelConfig to JSON. + * Converts this ProductInlineSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Catalog. */ - interface ICatalog { - - /** Catalog name */ - name?: (string|null); - - /** Catalog displayName */ - displayName?: (string|null); + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2alpha.IUserEvent[]|null); } - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { /** - * Constructs a new Catalog. + * Constructs a new UserEventInlineSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICatalog); - - /** Catalog name. */ - public name: string; - - /** Catalog displayName. */ - public displayName: string; + constructor(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource); - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2alpha.IUserEvent[]; /** - * Creates a new Catalog instance using the specified properties. + * Creates a new UserEventInlineSource instance using the specified properties. * @param [properties] Properties to set - * @returns Catalog instance + * @returns UserEventInlineSource instance */ - public static create(properties?: google.cloud.retail.v2beta.ICatalog): google.cloud.retail.v2beta.Catalog; + public static create(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource): google.cloud.retail.v2alpha.UserEventInlineSource; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Catalog + * @returns UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Catalog; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInlineSource; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Catalog + * @returns UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Catalog; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInlineSource; /** - * Verifies a Catalog message. + * Verifies a UserEventInlineSource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Catalog + * @returns UserEventInlineSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Catalog; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInlineSource; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Catalog to JSON. + * Converts this UserEventInlineSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + public static create(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest, callback: google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback): void; + public static encode(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest): Promise; - } + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportErrorsConfig; - namespace CatalogService { + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListCatalogsResponse) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Catalog) => void; + public static toObject(message: google.cloud.retail.v2alpha.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { - /** ListCatalogsRequest parent */ + /** ImportProductsRequest parent */ parent?: (string|null); - /** ListCatalogsRequest pageSize */ - pageSize?: (number|null); + /** ImportProductsRequest requestId */ + requestId?: (string|null); - /** ListCatalogsRequest pageToken */ - pageToken?: (string|null); + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null); + + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new ImportProductsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IListCatalogsRequest); + constructor(properties?: google.cloud.retail.v2alpha.IImportProductsRequest); - /** ListCatalogsRequest parent. */ + /** ImportProductsRequest parent. */ public parent: string; - /** ListCatalogsRequest pageSize. */ - public pageSize: number; + /** ImportProductsRequest requestId. */ + public requestId: string; - /** ListCatalogsRequest pageToken. */ - public pageToken: string; + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode); + + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new ImportProductsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns ImportProductsRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IListCatalogsRequest): google.cloud.retail.v2beta.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IImportProductsRequest): google.cloud.retail.v2alpha.ImportProductsRequest; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsRequest; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsRequest; /** - * Verifies a ListCatalogsRequest message. + * Verifies an ImportProductsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns ImportProductsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsRequest; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ImportProductsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { - - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2beta.ICatalog[]|null); + namespace ImportProductsRequest { - /** ListCatalogsResponse nextPageToken */ - nextPageToken?: (string|null); + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { - - /** - * Constructs a new ListCatalogsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IListCatalogsResponse); + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2beta.ICatalog[]; + /** ImportUserEventsRequest parent */ + parent?: (string|null); - /** ListCatalogsResponse nextPageToken. */ - public nextPageToken: string; + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Constructs a new ImportUserEventsRequest. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IListCatalogsResponse): google.cloud.retail.v2beta.ListCatalogsResponse; + constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest); + + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest): google.cloud.retail.v2alpha.ImportUserEventsRequest; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Verifies a ListCatalogsResponse message. + * Verifies an ImportUserEventsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns ImportUserEventsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ImportUserEventsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2beta.ICatalog|null); + /** ImportCompletionDataRequest parent */ + parent?: (string|null); - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new ImportCompletionDataRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest); + constructor(properties?: google.cloud.retail.v2alpha.IImportCompletionDataRequest); - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2beta.ICatalog|null); + /** ImportCompletionDataRequest parent. */ + public parent: string; - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new ImportCompletionDataRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns ImportCompletionDataRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2alpha.IImportCompletionDataRequest): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Verifies an UpdateCatalogRequest message. + * Verifies an ImportCompletionDataRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns ImportCompletionDataRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this ImportCompletionDataRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { - /** CustomAttribute text */ - text?: (string[]|null); + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { /** - * Constructs a new CustomAttribute. + * Constructs a new ProductInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICustomAttribute); + constructor(properties?: google.cloud.retail.v2alpha.IProductInputConfig); - /** CustomAttribute text. */ - public text: string[]; + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); - /** CustomAttribute numbers. */ - public numbers: number[]; + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new ProductInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns ProductInputConfig instance */ - public static create(properties?: google.cloud.retail.v2beta.ICustomAttribute): google.cloud.retail.v2beta.CustomAttribute; + public static create(properties?: google.cloud.retail.v2alpha.IProductInputConfig): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Verifies a CustomAttribute message. + * Verifies a ProductInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns ProductInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this ProductInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Image. */ - interface IImage { + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { - /** Image uri */ - uri?: (string|null); + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); - /** Image height */ - height?: (number|null); + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); - /** Image width */ - width?: (number|null); + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); } - /** Represents an Image. */ - class Image implements IImage { + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { /** - * Constructs a new Image. + * Constructs a new UserEventInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImage); + constructor(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig); - /** Image uri. */ - public uri: string; + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); - /** Image height. */ - public height: number; + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); - /** Image width. */ - public width: number; + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new Image instance using the specified properties. + * Creates a new UserEventInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns UserEventInputConfig instance */ - public static create(properties?: google.cloud.retail.v2beta.IImage): google.cloud.retail.v2beta.Image; + public static create(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Verifies an Image message. + * Verifies a UserEventInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns UserEventInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this UserEventInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PriceInfo. */ - interface IPriceInfo { - - /** PriceInfo currencyCode */ - currencyCode?: (string|null); - - /** PriceInfo price */ - price?: (number|null); - - /** PriceInfo originalPrice */ - originalPrice?: (number|null); + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { - /** PriceInfo cost */ - cost?: (number|null); + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); } - /** Represents a PriceInfo. */ - class PriceInfo implements IPriceInfo { + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { /** - * Constructs a new PriceInfo. + * Constructs a new CompletionDataInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPriceInfo); - - /** PriceInfo currencyCode. */ - public currencyCode: string; - - /** PriceInfo price. */ - public price: number; + constructor(properties?: google.cloud.retail.v2alpha.ICompletionDataInputConfig); - /** PriceInfo originalPrice. */ - public originalPrice: number; + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); - /** PriceInfo cost. */ - public cost: number; + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns PriceInfo instance + * @returns CompletionDataInputConfig instance */ - public static create(properties?: google.cloud.retail.v2beta.IPriceInfo): google.cloud.retail.v2beta.PriceInfo; + public static create(properties?: google.cloud.retail.v2alpha.ICompletionDataInputConfig): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceInfo + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceInfo + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Verifies a PriceInfo message. + * Verifies a CompletionDataInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceInfo + * @returns CompletionDataInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @param message PriceInfo + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceInfo to JSON. + * Converts this CompletionDataInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserInfo. */ - interface IUserInfo { + /** Properties of an ImportMetadata. */ + interface IImportMetadata { - /** UserInfo userId */ - userId?: (string|null); + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** UserInfo ipAddress */ - ipAddress?: (string|null); + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); - /** UserInfo userAgent */ - userAgent?: (string|null); + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); - /** UserInfo directUserRequest */ - directUserRequest?: (boolean|null); + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a UserInfo. */ - class UserInfo implements IUserInfo { + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { /** - * Constructs a new UserInfo. + * Constructs a new ImportMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserInfo); + constructor(properties?: google.cloud.retail.v2alpha.IImportMetadata); - /** UserInfo userId. */ - public userId: string; + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** UserInfo ipAddress. */ - public ipAddress: string; + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); - /** UserInfo userAgent. */ - public userAgent: string; + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); - /** UserInfo directUserRequest. */ - public directUserRequest: boolean; + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** ImportMetadata requestId. */ + public requestId: string; + + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new ImportMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns UserInfo instance + * @returns ImportMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserInfo): google.cloud.retail.v2beta.UserInfo; + public static create(properties?: google.cloud.retail.v2alpha.IImportMetadata): google.cloud.retail.v2alpha.ImportMetadata; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserInfo + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportMetadata; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserInfo + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportMetadata; /** - * Verifies a UserInfo message. + * Verifies an ImportMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserInfo + * @returns ImportMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportMetadata; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. - * @param message UserInfo + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserInfo to JSON. + * Converts this ImportMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { - /** GcsSource inputUris */ - inputUris?: (string[]|null); + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { /** - * Constructs a new GcsSource. + * Constructs a new ImportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IGcsSource); + constructor(properties?: google.cloud.retail.v2alpha.IImportProductsResponse); - /** GcsSource inputUris. */ - public inputUris: string[]; + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** GcsSource dataSchema. */ - public dataSchema: string; + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns ImportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IGcsSource): google.cloud.retail.v2beta.GcsSource; + public static create(properties?: google.cloud.retail.v2alpha.IImportProductsResponse): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Verifies a GcsSource message. + * Verifies an ImportProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns ImportProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this ImportProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { - - /** BigQuerySource projectId */ - projectId?: (string|null); + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { - /** BigQuerySource datasetId */ - datasetId?: (string|null); + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** BigQuerySource tableId */ - tableId?: (string|null); - - /** BigQuerySource gcsStagingDir */ - gcsStagingDir?: (string|null); + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - /** BigQuerySource dataSchema */ - dataSchema?: (string|null); + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); } - /** Represents a BigQuerySource. */ - class BigQuerySource implements IBigQuerySource { + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { /** - * Constructs a new BigQuerySource. + * Constructs a new ImportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IBigQuerySource); - - /** BigQuerySource projectId. */ - public projectId: string; - - /** BigQuerySource datasetId. */ - public datasetId: string; + constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse); - /** BigQuerySource tableId. */ - public tableId: string; + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** BigQuerySource gcsStagingDir. */ - public gcsStagingDir: string; + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - /** BigQuerySource dataSchema. */ - public dataSchema: string; + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns BigQuerySource instance + * @returns ImportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IBigQuerySource): google.cloud.retail.v2beta.BigQuerySource; + public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BigQuerySource + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BigQuerySource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BigQuerySource + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BigQuerySource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Verifies a BigQuerySource message. + * Verifies an ImportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BigQuerySource + * @returns ImportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BigQuerySource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. - * @param message BigQuerySource + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BigQuerySource to JSON. + * Converts this ImportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInlineSource. */ - interface IProductInlineSource { + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { - /** ProductInlineSource products */ - products?: (google.cloud.retail.v2beta.IProduct[]|null); + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); + + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); } - /** Represents a ProductInlineSource. */ - class ProductInlineSource implements IProductInlineSource { + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { /** - * Constructs a new ProductInlineSource. + * Constructs a new UserEventImportSummary. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductInlineSource); + constructor(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary); - /** ProductInlineSource products. */ - public products: google.cloud.retail.v2beta.IProduct[]; + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); + + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInlineSource instance + * @returns UserEventImportSummary instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductInlineSource): google.cloud.retail.v2beta.ProductInlineSource; + public static create(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInlineSource + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInlineSource + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Verifies a ProductInlineSource message. + * Verifies a UserEventImportSummary message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInlineSource + * @returns UserEventImportSummary */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @param message ProductInlineSource + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInlineSource to JSON. + * Converts this UserEventImportSummary to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInlineSource. */ - interface IUserEventInlineSource { + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { - /** UserEventInlineSource userEvents */ - userEvents?: (google.cloud.retail.v2beta.IUserEvent[]|null); + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); } - /** Represents a UserEventInlineSource. */ - class UserEventInlineSource implements IUserEventInlineSource { + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { /** - * Constructs a new UserEventInlineSource. + * Constructs a new ImportCompletionDataResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserEventInlineSource); + constructor(properties?: google.cloud.retail.v2alpha.IImportCompletionDataResponse); - /** UserEventInlineSource userEvents. */ - public userEvents: google.cloud.retail.v2beta.IUserEvent[]; + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInlineSource instance + * @returns ImportCompletionDataResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserEventInlineSource): google.cloud.retail.v2beta.UserEventInlineSource; + public static create(properties?: google.cloud.retail.v2alpha.IImportCompletionDataResponse): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInlineSource + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInlineSource + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Verifies a UserEventInlineSource message. + * Verifies an ImportCompletionDataResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInlineSource + * @returns ImportCompletionDataResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @param message UserEventInlineSource + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportErrorsConfig. */ - interface IImportErrorsConfig { - - /** ImportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); - } + /** Properties of a Product. */ + interface IProduct { - /** Represents an ImportErrorsConfig. */ - class ImportErrorsConfig implements IImportErrorsConfig { + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); - /** - * Constructs a new ImportErrorsConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IImportErrorsConfig); + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); - /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + /** Product name */ + name?: (string|null); - /** ImportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** Product id */ + id?: (string|null); - /** - * Creates a new ImportErrorsConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportErrorsConfig instance - */ - public static create(properties?: google.cloud.retail.v2beta.IImportErrorsConfig): google.cloud.retail.v2beta.ImportErrorsConfig; + /** Product type */ + type?: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type|null); - /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product primaryProductId */ + primaryProductId?: (string|null); - /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); - /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportErrorsConfig; + /** Product gtin */ + gtin?: (string|null); - /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportErrorsConfig; + /** Product categories */ + categories?: (string[]|null); - /** - * Verifies an ImportErrorsConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Product title */ + title?: (string|null); - /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportErrorsConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportErrorsConfig; + /** Product brands */ + brands?: (string[]|null); - /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @param message ImportErrorsConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Product description */ + description?: (string|null); - /** - * Converts this ImportErrorsConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Product languageCode */ + languageCode?: (string|null); - /** Properties of an ImportProductsRequest. */ - interface IImportProductsRequest { + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); - /** ImportProductsRequest parent */ - parent?: (string|null); + /** Product tags */ + tags?: (string[]|null); - /** ImportProductsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - /** ImportProductsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** Product rating */ + rating?: (google.cloud.retail.v2alpha.IRating|null); - /** ImportProductsRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2alpha.IFulfillmentInfo[]|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2alpha.IImage[]|null); + + /** Product audience */ + audience?: (google.cloud.retail.v2alpha.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2alpha.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); + + /** Product promotions */ + promotions?: (google.cloud.retail.v2alpha.IPromotion[]|null); + + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants */ + variants?: (google.cloud.retail.v2alpha.IProduct[]|null); } - /** Represents an ImportProductsRequest. */ - class ImportProductsRequest implements IImportProductsRequest { + /** Represents a Product. */ + class Product implements IProduct { /** - * Constructs a new ImportProductsRequest. + * Constructs a new Product. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportProductsRequest); + constructor(properties?: google.cloud.retail.v2alpha.IProduct); - /** ImportProductsRequest parent. */ - public parent: string; + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); - /** ImportProductsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); - /** ImportProductsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** Product name. */ + public name: string; - /** ImportProductsRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** Product id. */ + public id: string; - /** - * Creates a new ImportProductsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductsRequest instance - */ - public static create(properties?: google.cloud.retail.v2beta.IImportProductsRequest): google.cloud.retail.v2beta.ImportProductsRequest; + /** Product type. */ + public type: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type); - /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product primaryProductId. */ + public primaryProductId: string; - /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; - /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsRequest; + /** Product gtin. */ + public gtin: string; - /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsRequest; + /** Product categories. */ + public categories: string[]; - /** - * Verifies an ImportProductsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Product title. */ + public title: string; - /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsRequest; + /** Product brands. */ + public brands: string[]; - /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @param message ImportProductsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Product description. */ + public description: string; - /** - * Converts this ImportProductsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Product languageCode. */ + public languageCode: string; - /** Properties of an ImportUserEventsRequest. */ - interface IImportUserEventsRequest { + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; - /** ImportUserEventsRequest parent */ - parent?: (string|null); + /** Product tags. */ + public tags: string[]; - /** ImportUserEventsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - /** ImportUserEventsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - } + /** Product rating. */ + public rating?: (google.cloud.retail.v2alpha.IRating|null); - /** Represents an ImportUserEventsRequest. */ - class ImportUserEventsRequest implements IImportUserEventsRequest { + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); - /** - * Constructs a new ImportUserEventsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest); + /** Product availability. */ + public availability: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability); - /** ImportUserEventsRequest parent. */ - public parent: string; + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); - /** ImportUserEventsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2alpha.IFulfillmentInfo[]; - /** ImportUserEventsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** Product uri. */ + public uri: string; + + /** Product images. */ + public images: google.cloud.retail.v2alpha.IImage[]; + + /** Product audience. */ + public audience?: (google.cloud.retail.v2alpha.IAudience|null); + + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2alpha.IColorInfo|null); + + /** Product sizes. */ + public sizes: string[]; + + /** Product materials. */ + public materials: string[]; + + /** Product patterns. */ + public patterns: string[]; + + /** Product conditions. */ + public conditions: string[]; + + /** Product promotions. */ + public promotions: google.cloud.retail.v2alpha.IPromotion[]; + + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants. */ + public variants: google.cloud.retail.v2alpha.IProduct[]; + + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new Product instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsRequest instance + * @returns Product instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IProduct): google.cloud.retail.v2alpha.Product; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsRequest + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Product; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsRequest + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Product; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a Product message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsRequest + * @returns Product */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Product; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @param message ImportUserEventsRequest + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this Product to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInputConfig. */ - interface IProductInputConfig { + namespace Product { - /** ProductInputConfig productInlineSource */ - productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } - /** ProductInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } + } - /** ProductInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** Properties of a UserEvent. */ + interface IUserEvent { + + /** UserEvent eventType */ + eventType?: (string|null); + + /** UserEvent visitorId */ + visitorId?: (string|null); + + /** UserEvent sessionId */ + sessionId?: (string|null); + + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); + + /** UserEvent attributionToken */ + attributionToken?: (string|null); + + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2alpha.IProductDetail[]|null); + + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2alpha.ICompletionDetail|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent filter */ + filter?: (string|null); + + /** UserEvent orderBy */ + orderBy?: (string|null); + + /** UserEvent offset */ + offset?: (number|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); } - /** Represents a ProductInputConfig. */ - class ProductInputConfig implements IProductInputConfig { + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { /** - * Constructs a new ProductInputConfig. + * Constructs a new UserEvent. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductInputConfig); + constructor(properties?: google.cloud.retail.v2alpha.IUserEvent); - /** ProductInputConfig productInlineSource. */ - public productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + /** UserEvent eventType. */ + public eventType: string; - /** ProductInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** UserEvent visitorId. */ + public visitorId: string; - /** ProductInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** UserEvent sessionId. */ + public sessionId: string; - /** ProductInputConfig source. */ - public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2alpha.IProductDetail[]; + + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2alpha.ICompletionDetail|null); + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent filter. */ + public filter: string; + + /** UserEvent orderBy. */ + public orderBy: string; + + /** UserEvent offset. */ + public offset: number; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new UserEvent instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInputConfig instance + * @returns UserEvent instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductInputConfig): google.cloud.retail.v2beta.ProductInputConfig; + public static create(properties?: google.cloud.retail.v2alpha.IUserEvent): google.cloud.retail.v2alpha.UserEvent; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a UserEvent message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInputConfig + * @returns UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEvent; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a UserEvent message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInputConfig + * @returns UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEvent; /** - * Verifies a ProductInputConfig message. + * Verifies a UserEvent message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInputConfig + * @returns UserEvent */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEvent; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @param message ProductInputConfig + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInputConfig to JSON. + * Converts this UserEvent to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInputConfig. */ - interface IUserEventInputConfig { - - /** UserEventInputConfig userEventInlineSource */ - userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + /** Properties of a ProductDetail. */ + interface IProductDetail { - /** UserEventInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** ProductDetail product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); - /** UserEventInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); } - /** Represents a UserEventInputConfig. */ - class UserEventInputConfig implements IUserEventInputConfig { + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { /** - * Constructs a new UserEventInputConfig. + * Constructs a new ProductDetail. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserEventInputConfig); - - /** UserEventInputConfig userEventInlineSource. */ - public userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); - - /** UserEventInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + constructor(properties?: google.cloud.retail.v2alpha.IProductDetail); - /** UserEventInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); - /** UserEventInputConfig source. */ - public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ProductDetail instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInputConfig instance + * @returns ProductDetail instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserEventInputConfig): google.cloud.retail.v2beta.UserEventInputConfig; + public static create(properties?: google.cloud.retail.v2alpha.IProductDetail): google.cloud.retail.v2alpha.ProductDetail; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a ProductDetail message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInputConfig + * @returns ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductDetail; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInputConfig + * @returns ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductDetail; /** - * Verifies a UserEventInputConfig message. + * Verifies a ProductDetail message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInputConfig + * @returns ProductDetail */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductDetail; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @param message UserEventInputConfig + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this ProductDetail to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportMetadata. */ - interface IImportMetadata { - - /** ImportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { - /** ImportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); - /** ImportMetadata successCount */ - successCount?: (number|Long|string|null); + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); - /** ImportMetadata failureCount */ - failureCount?: (number|Long|string|null); + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); } - /** Represents an ImportMetadata. */ - class ImportMetadata implements IImportMetadata { + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { /** - * Constructs a new ImportMetadata. + * Constructs a new CompletionDetail. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportMetadata); - - /** ImportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + constructor(properties?: google.cloud.retail.v2alpha.ICompletionDetail); - /** ImportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; - /** ImportMetadata successCount. */ - public successCount: (number|Long|string); + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; - /** ImportMetadata failureCount. */ - public failureCount: (number|Long|string); + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new CompletionDetail instance using the specified properties. * @param [properties] Properties to set - * @returns ImportMetadata instance + * @returns CompletionDetail instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportMetadata): google.cloud.retail.v2beta.ImportMetadata; + public static create(properties?: google.cloud.retail.v2alpha.ICompletionDetail): google.cloud.retail.v2alpha.CompletionDetail; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a CompletionDetail message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportMetadata + * @returns CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionDetail; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportMetadata + * @returns CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionDetail; /** - * Verifies an ImportMetadata message. + * Verifies a CompletionDetail message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportMetadata + * @returns CompletionDetail */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionDetail; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. - * @param message ImportMetadata + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportMetadata to JSON. + * Converts this CompletionDetail to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportProductsResponse. */ - interface IImportProductsResponse { + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { - /** ImportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** PurchaseTransaction id */ + id?: (string|null); - /** ImportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** PurchaseTransaction revenue */ + revenue?: (number|null); + + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); } - /** Represents an ImportProductsResponse. */ - class ImportProductsResponse implements IImportProductsResponse { + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { /** - * Constructs a new ImportProductsResponse. + * Constructs a new PurchaseTransaction. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportProductsResponse); + constructor(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction); - /** ImportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** PurchaseTransaction id. */ + public id: string; - /** ImportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** PurchaseTransaction revenue. */ + public revenue: number; + + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Creates a new PurchaseTransaction instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsResponse instance + * @returns PurchaseTransaction instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportProductsResponse): google.cloud.retail.v2beta.ImportProductsResponse; + public static create(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction): google.cloud.retail.v2alpha.PurchaseTransaction; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a PurchaseTransaction message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsResponse + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurchaseTransaction; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsResponse + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurchaseTransaction; /** - * Verifies an ImportProductsResponse message. + * Verifies a PurchaseTransaction message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsResponse + * @returns PurchaseTransaction */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurchaseTransaction; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @param message ImportProductsResponse + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this PurchaseTransaction to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportUserEventsResponse. */ - interface IImportUserEventsResponse { - - /** ImportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - - /** ImportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - - /** ImportUserEventsResponse importSummary */ - importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); - } - - /** Represents an ImportUserEventsResponse. */ - class ImportUserEventsResponse implements IImportUserEventsResponse { + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { /** - * Constructs a new ImportUserEventsResponse. - * @param [properties] Properties to set + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse); - - /** ImportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; - - /** ImportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - - /** ImportUserEventsResponse importSummary. */ - public importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates a new ImportUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportUserEventsResponse instance + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse): google.cloud.retail.v2beta.ImportUserEventsResponse; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse */ - public static encode(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest, callback: google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback): void; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest): Promise; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsResponse; + public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback): void; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsResponse; + public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest): Promise; /** - * Verifies an ImportUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty */ - public static verify(message: { [k: string]: any }): (string|null); + public setDefaultBranch(request: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, callback: google.cloud.retail.v2alpha.CatalogService.SetDefaultBranchCallback): void; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportUserEventsResponse + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsResponse; + public setDefaultBranch(request: google.cloud.retail.v2alpha.ISetDefaultBranchRequest): Promise; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. - * @param message ImportUserEventsResponse - * @param [options] Conversion options - * @returns Plain object + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse */ - public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, callback: google.cloud.retail.v2alpha.CatalogService.GetDefaultBranchCallback): void; /** - * Converts this ImportUserEventsResponse to JSON. - * @returns JSON object + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; + public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): Promise; } - /** Properties of a UserEventImportSummary. */ - interface IUserEventImportSummary { + namespace CatalogService { - /** UserEventImportSummary joinedEventsCount */ - joinedEventsCount?: (number|Long|string|null); + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; - /** UserEventImportSummary unjoinedEventsCount */ - unjoinedEventsCount?: (number|Long|string|null); + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.GetDefaultBranchResponse) => void; } - /** Represents a UserEventImportSummary. */ - class UserEventImportSummary implements IUserEventImportSummary { + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { /** - * Constructs a new UserEventImportSummary. + * Constructs a new ListCatalogsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserEventImportSummary); + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); - /** UserEventImportSummary joinedEventsCount. */ - public joinedEventsCount: (number|Long|string); + /** ListCatalogsRequest parent. */ + public parent: string; - /** UserEventImportSummary unjoinedEventsCount. */ - public unjoinedEventsCount: (number|Long|string); + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * Creates a new ListCatalogsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventImportSummary instance + * @returns ListCatalogsRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserEventImportSummary): google.cloud.retail.v2beta.UserEventImportSummary; + public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest): google.cloud.retail.v2alpha.ListCatalogsRequest; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventImportSummary + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventImportSummary; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsRequest; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventImportSummary + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventImportSummary; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsRequest; /** - * Verifies a UserEventImportSummary message. + * Verifies a ListCatalogsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventImportSummary + * @returns ListCatalogsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventImportSummary; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsRequest; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @param message UserEventImportSummary + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this ListCatalogsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Product. */ - interface IProduct { - - /** Product name */ - name?: (string|null); - - /** Product id */ - id?: (string|null); - - /** Product type */ - type?: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type|null); - - /** Product primaryProductId */ - primaryProductId?: (string|null); - - /** Product categories */ - categories?: (string[]|null); - - /** Product title */ - title?: (string|null); - - /** Product description */ - description?: (string|null); - - /** Product attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); - - /** Product tags */ - tags?: (string[]|null); - - /** Product priceInfo */ - priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); - - /** Product availableTime */ - availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability */ - availability?: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability|null); - - /** Product availableQuantity */ - availableQuantity?: (google.protobuf.IInt32Value|null); + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { - /** Product uri */ - uri?: (string|null); + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2alpha.ICatalog[]|null); - /** Product images */ - images?: (google.cloud.retail.v2beta.IImage[]|null); + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a Product. */ - class Product implements IProduct { + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { /** - * Constructs a new Product. + * Constructs a new ListCatalogsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProduct); - - /** Product name. */ - public name: string; - - /** Product id. */ - public id: string; - - /** Product type. */ - public type: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type); - - /** Product primaryProductId. */ - public primaryProductId: string; - - /** Product categories. */ - public categories: string[]; - - /** Product title. */ - public title: string; - - /** Product description. */ - public description: string; - - /** Product attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; - - /** Product tags. */ - public tags: string[]; - - /** Product priceInfo. */ - public priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); - - /** Product availableTime. */ - public availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability. */ - public availability: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability); - - /** Product availableQuantity. */ - public availableQuantity?: (google.protobuf.IInt32Value|null); + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse); - /** Product uri. */ - public uri: string; + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2alpha.ICatalog[]; - /** Product images. */ - public images: google.cloud.retail.v2beta.IImage[]; + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new Product instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Product instance + * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IProduct): google.cloud.retail.v2beta.Product; + public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. - * @param message Product message or plain object to encode + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. - * @param message Product message or plain object to encode + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Product + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Product; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Product + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Product; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Verifies a Product message. + * Verifies a ListCatalogsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Product + * @returns ListCatalogsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Product; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Product to JSON. + * Converts this ListCatalogsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Product { + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - VARIANT = 2, - COLLECTION = 3 - } + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2alpha.ICatalog|null); - /** Availability enum. */ - enum Availability { - AVAILABILITY_UNSPECIFIED = 0, - IN_STOCK = 1, - OUT_OF_STOCK = 2, - PREORDER = 3, - BACKORDER = 4 - } + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Properties of a UserEvent. */ - interface IUserEvent { + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { - /** UserEvent eventType */ - eventType?: (string|null); + /** + * Constructs a new UpdateCatalogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest); - /** UserEvent visitorId */ - visitorId?: (string|null); + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2alpha.ICatalog|null); - /** UserEvent eventTime */ - eventTime?: (google.protobuf.ITimestamp|null); + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** UserEvent experimentIds */ - experimentIds?: (string[]|null); + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCatalogRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest): google.cloud.retail.v2alpha.UpdateCatalogRequest; - /** UserEvent attributionToken */ - attributionToken?: (string|null); + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent productDetails */ - productDetails?: (google.cloud.retail.v2beta.IProductDetail[]|null); + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateCatalogRequest; - /** UserEvent cartId */ - cartId?: (string|null); + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateCatalogRequest; - /** UserEvent purchaseTransaction */ - purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + /** + * Verifies an UpdateCatalogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEvent searchQuery */ - searchQuery?: (string|null); + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCatalogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateCatalogRequest; - /** UserEvent pageCategories */ - pageCategories?: (string[]|null); + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** UserEvent userInfo */ - userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + /** + * Converts this UpdateCatalogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** UserEvent uri */ - uri?: (string|null); + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { - /** UserEvent referrerUri */ - referrerUri?: (string|null); + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); - /** UserEvent pageViewId */ - pageViewId?: (string|null); + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); + + /** SetDefaultBranchRequest note */ + note?: (string|null); } - /** Represents a UserEvent. */ - class UserEvent implements IUserEvent { + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { /** - * Constructs a new UserEvent. + * Constructs a new SetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserEvent); - - /** UserEvent eventType. */ - public eventType: string; - - /** UserEvent visitorId. */ - public visitorId: string; - - /** UserEvent eventTime. */ - public eventTime?: (google.protobuf.ITimestamp|null); - - /** UserEvent experimentIds. */ - public experimentIds: string[]; - - /** UserEvent attributionToken. */ - public attributionToken: string; - - /** UserEvent productDetails. */ - public productDetails: google.cloud.retail.v2beta.IProductDetail[]; - - /** UserEvent attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; - - /** UserEvent cartId. */ - public cartId: string; - - /** UserEvent purchaseTransaction. */ - public purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); - - /** UserEvent searchQuery. */ - public searchQuery: string; - - /** UserEvent pageCategories. */ - public pageCategories: string[]; + constructor(properties?: google.cloud.retail.v2alpha.ISetDefaultBranchRequest); - /** UserEvent userInfo. */ - public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); - - /** UserEvent uri. */ - public uri: string; + /** SetDefaultBranchRequest catalog. */ + public catalog: string; - /** UserEvent referrerUri. */ - public referrerUri: string; + /** SetDefaultBranchRequest branchId. */ + public branchId: string; - /** UserEvent pageViewId. */ - public pageViewId: string; + /** SetDefaultBranchRequest note. */ + public note: string; /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEvent instance + * @returns SetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserEvent): google.cloud.retail.v2beta.UserEvent; + public static create(properties?: google.cloud.retail.v2alpha.ISetDefaultBranchRequest): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEvent + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEvent; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEvent + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEvent; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Verifies a UserEvent message. + * Verifies a SetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEvent + * @returns SetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEvent; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @param message UserEvent + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEvent to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductDetail. */ - interface IProductDetail { - - /** ProductDetail product */ - product?: (google.cloud.retail.v2beta.IProduct|null); + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { - /** ProductDetail quantity */ - quantity?: (google.protobuf.IInt32Value|null); + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); } - /** Represents a ProductDetail. */ - class ProductDetail implements IProductDetail { + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { /** - * Constructs a new ProductDetail. + * Constructs a new GetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductDetail); - - /** ProductDetail product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); + constructor(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchRequest); - /** ProductDetail quantity. */ - public quantity?: (google.protobuf.IInt32Value|null); + /** GetDefaultBranchRequest catalog. */ + public catalog: string; /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductDetail instance + * @returns GetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductDetail): google.cloud.retail.v2beta.ProductDetail; + public static create(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductDetail + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductDetail + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Verifies a ProductDetail message. + * Verifies a GetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductDetail + * @returns GetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @param message ProductDetail + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductDetail to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurchaseTransaction. */ - interface IPurchaseTransaction { - - /** PurchaseTransaction id */ - id?: (string|null); - - /** PurchaseTransaction revenue */ - revenue?: (number|null); + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { - /** PurchaseTransaction tax */ - tax?: (number|null); + /** GetDefaultBranchResponse branch */ + branch?: (string|null); - /** PurchaseTransaction cost */ - cost?: (number|null); + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); - /** PurchaseTransaction currencyCode */ - currencyCode?: (string|null); + /** GetDefaultBranchResponse note */ + note?: (string|null); } - /** Represents a PurchaseTransaction. */ - class PurchaseTransaction implements IPurchaseTransaction { + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { /** - * Constructs a new PurchaseTransaction. + * Constructs a new GetDefaultBranchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPurchaseTransaction); - - /** PurchaseTransaction id. */ - public id: string; + constructor(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchResponse); - /** PurchaseTransaction revenue. */ - public revenue: number; - - /** PurchaseTransaction tax. */ - public tax: number; + /** GetDefaultBranchResponse branch. */ + public branch: string; - /** PurchaseTransaction cost. */ - public cost: number; + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); - /** PurchaseTransaction currencyCode. */ - public currencyCode: string; + /** GetDefaultBranchResponse note. */ + public note: string; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurchaseTransaction instance + * @returns GetDefaultBranchResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IPurchaseTransaction): google.cloud.retail.v2beta.PurchaseTransaction; + public static create(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchResponse): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurchaseTransaction + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurchaseTransaction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurchaseTransaction + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurchaseTransaction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Verifies a PurchaseTransaction message. + * Verifies a GetDefaultBranchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurchaseTransaction + * @returns GetDefaultBranchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurchaseTransaction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @param message PurchaseTransaction + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { /** - * Constructs a new PredictionService service. + * Constructs a new CompletionService service. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited @@ -12171,1159 +14046,14293 @@ export namespace google { constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates new PredictionService service using the specified rpc implementation. + * Creates new CompletionService service using the specified rpc implementation. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse */ - public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; + public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest, callback: google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback): void; /** - * Calls Predict. - * @param request PredictRequest message or plain object + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object * @returns Promise */ - public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; + public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest): Promise; + + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest, callback: google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback): void; + + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise + */ + public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest): Promise; } - namespace PredictionService { + namespace CompletionService { /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. * @param error Error, if any - * @param [response] PredictResponse + * @param [response] CompleteQueryResponse */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; - } + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompleteQueryResponse) => void; - /** Properties of a PredictRequest. */ - interface IPredictRequest { + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } - /** PredictRequest placement */ - placement?: (string|null); + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + /** CompleteQueryRequest catalog */ + catalog?: (string|null); - /** PredictRequest pageSize */ - pageSize?: (number|null); + /** CompleteQueryRequest query */ + query?: (string|null); - /** PredictRequest pageToken */ - pageToken?: (string|null); + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); - /** PredictRequest filter */ - filter?: (string|null); + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** CompleteQueryRequest dataset */ + dataset?: (string|null); - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); } - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { /** - * Constructs a new PredictRequest. + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); - - /** PredictRequest placement. */ - public placement: string; + constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest); - /** PredictRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + /** CompleteQueryRequest catalog. */ + public catalog: string; - /** PredictRequest pageSize. */ - public pageSize: number; + /** CompleteQueryRequest query. */ + public query: string; - /** PredictRequest pageToken. */ - public pageToken: string; + /** CompleteQueryRequest visitorId. */ + public visitorId: string; - /** PredictRequest filter. */ - public filter: string; + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; - /** PredictRequest validateOnly. */ - public validateOnly: boolean; + /** CompleteQueryRequest deviceType. */ + public deviceType: string; - /** PredictRequest params. */ - public params: { [k: string]: google.protobuf.IValue }; + /** CompleteQueryRequest dataset. */ + public dataset: string; - /** PredictRequest labels. */ - public labels: { [k: string]: string }; + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PredictRequest instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IPredictRequest): google.cloud.retail.v2beta.PredictRequest; + public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Verifies a PredictRequest message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictRequest + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @param message PredictRequest + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PredictResponse. */ - interface IPredictResponse { + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { - /** PredictResponse results */ - results?: (google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]|null); + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]|null); - /** PredictResponse attributionToken */ + /** CompleteQueryResponse attributionToken */ attributionToken?: (string|null); - /** PredictResponse missingIds */ - missingIds?: (string[]|null); - - /** PredictResponse validateOnly */ - validateOnly?: (boolean|null); + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents a PredictResponse. */ - class PredictResponse implements IPredictResponse { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new PredictResponse. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPredictResponse); + constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse); - /** PredictResponse results. */ - public results: google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]; + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]; - /** PredictResponse attributionToken. */ + /** CompleteQueryResponse attributionToken. */ public attributionToken: string; - /** PredictResponse missingIds. */ - public missingIds: string[]; - - /** PredictResponse validateOnly. */ - public validateOnly: boolean; + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PredictResponse instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IPredictResponse): google.cloud.retail.v2beta.PredictResponse; + public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictResponse + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictResponse + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Verifies a PredictResponse message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictResponse + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. - * @param message PredictResponse + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictResponse to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PredictResponse { + namespace CompleteQueryResponse { - /** Properties of a PredictionResult. */ - interface IPredictionResult { + /** Properties of a CompletionResult. */ + interface ICompletionResult { - /** PredictionResult id */ - id?: (string|null); + /** CompletionResult suggestion */ + suggestion?: (string|null); - /** PredictionResult metadata */ - metadata?: ({ [k: string]: google.protobuf.IValue }|null); + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); } - /** Represents a PredictionResult. */ - class PredictionResult implements IPredictionResult { + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { /** - * Constructs a new PredictionResult. + * Constructs a new CompletionResult. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult); + constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult); - /** PredictionResult id. */ - public id: string; + /** CompletionResult suggestion. */ + public suggestion: string; - /** PredictionResult metadata. */ - public metadata: { [k: string]: google.protobuf.IValue }; + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; /** - * Creates a new PredictionResult instance using the specified properties. + * Creates a new CompletionResult instance using the specified properties. * @param [properties] Properties to set - * @returns PredictionResult instance + * @returns CompletionResult instance */ - public static create(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictionResult message from the specified reader or buffer. + * Decodes a CompletionResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictionResult + * @returns CompletionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictionResult + * @returns CompletionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; /** - * Verifies a PredictionResult message. + * Verifies a CompletionResult message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictionResult + * @returns CompletionResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @param message PredictionResult + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictionResult to JSON. + * Converts this CompletionResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - /** Represents a ProductService */ - class ProductService extends $protobuf.rpc.Service { + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { - /** - * Constructs a new ProductService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); + } - /** - * Creates new ProductService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest, callback: google.cloud.retail.v2beta.ProductService.CreateProductCallback): void; + /** + * Constructs a new RecentSearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult); - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise - */ - public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest): Promise; + /** RecentSearchResult recentSearch. */ + public recentSearch: string; - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest, callback: google.cloud.retail.v2beta.ProductService.GetProductCallback): void; + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentSearchResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise - */ - public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest): Promise; + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest, callback: google.cloud.retail.v2beta.ProductService.UpdateProductCallback): void; + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + + /** + * Verifies a RecentSearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentSearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentSearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an ExportErrorsConfig. */ + interface IExportErrorsConfig { + + /** ExportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ExportErrorsConfig. */ + class ExportErrorsConfig implements IExportErrorsConfig { /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise + * Constructs a new ExportErrorsConfig. + * @param [properties] Properties to set */ - public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest): Promise; + constructor(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig); + + /** ExportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ExportErrorsConfig destination. */ + public destination?: "gcsPrefix"; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Creates a new ExportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportErrorsConfig instance */ - public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest, callback: google.cloud.retail.v2beta.ProductService.DeleteProductCallback): void; + public static create(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest): Promise; + public static encode(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ImportProductsCallback): void; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @returns Promise + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest): Promise; - } - - namespace ProductService { + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. - * @param error Error, if any - * @param [response] Product + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. - * @param error Error, if any - * @param [response] Product + * Verifies an ExportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. - * @param error Error, if any - * @param [response] Product + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportErrorsConfig */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. - * @param error Error, if any - * @param [response] Empty + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @param message ExportErrorsConfig + * @param [options] Conversion options + * @returns Plain object */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static toObject(message: google.cloud.retail.v2alpha.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. - * @param error Error, if any - * @param [response] Operation + * Converts this ExportErrorsConfig to JSON. + * @returns JSON object */ - type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { - - /** CreateProductRequest parent */ - parent?: (string|null); + /** Properties of an ExportMetadata. */ + interface IExportMetadata { - /** CreateProductRequest product */ - product?: (google.cloud.retail.v2beta.IProduct|null); + /** ExportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** CreateProductRequest productId */ - productId?: (string|null); + /** ExportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); } - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { + /** Represents an ExportMetadata. */ + class ExportMetadata implements IExportMetadata { /** - * Constructs a new CreateProductRequest. + * Constructs a new ExportMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICreateProductRequest); - - /** CreateProductRequest parent. */ - public parent: string; + constructor(properties?: google.cloud.retail.v2alpha.IExportMetadata); - /** CreateProductRequest product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); + /** ExportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** CreateProductRequest productId. */ - public productId: string; + /** ExportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new ExportMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns CreateProductRequest instance + * @returns ExportMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.ICreateProductRequest): google.cloud.retail.v2beta.CreateProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IExportMetadata): google.cloud.retail.v2alpha.ExportMetadata; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes an ExportMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateProductRequest + * @returns ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportMetadata; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateProductRequest + * @returns ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportMetadata; /** - * Verifies a CreateProductRequest message. + * Verifies an ExportMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateProductRequest + * @returns ExportMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportMetadata; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @param message ExportMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateProductRequest to JSON. + * Converts this ExportMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { + /** Properties of an ExportProductsResponse. */ + interface IExportProductsResponse { - /** GetProductRequest name */ - name?: (string|null); + /** ExportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); } - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { + /** Represents an ExportProductsResponse. */ + class ExportProductsResponse implements IExportProductsResponse { /** - * Constructs a new GetProductRequest. + * Constructs a new ExportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IGetProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.IExportProductsResponse); - /** GetProductRequest name. */ - public name: string; + /** ExportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates a new ExportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GetProductRequest instance + * @returns ExportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IGetProductRequest): google.cloud.retail.v2beta.GetProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IExportProductsResponse): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes an ExportProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetProductRequest + * @returns ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetProductRequest + * @returns ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Verifies a GetProductRequest message. + * Verifies an ExportProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetProductRequest + * @returns ExportProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @param message ExportProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetProductRequest to JSON. + * Converts this ExportProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { + /** Properties of an ExportUserEventsResponse. */ + interface IExportUserEventsResponse { - /** UpdateProductRequest product */ - product?: (google.cloud.retail.v2beta.IProduct|null); + /** ExportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** ExportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); } - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { + /** Represents an ExportUserEventsResponse. */ + class ExportUserEventsResponse implements IExportUserEventsResponse { /** - * Constructs a new UpdateProductRequest. + * Constructs a new ExportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUpdateProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse); - /** UpdateProductRequest product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); + /** ExportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** ExportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new ExportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateProductRequest instance + * @returns ExportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IUpdateProductRequest): google.cloud.retail.v2beta.UpdateProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateProductRequest + * @returns ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest + * @returns ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Verifies an UpdateProductRequest message. + * Verifies an ExportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateProductRequest + * @returns ExportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @param message ExportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this ExportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { - /** DeleteProductRequest name */ - name?: (string|null); + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; } - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { + namespace PredictionService { /** - * Constructs a new DeleteProductRequest. + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IDeleteProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); - /** DeleteProductRequest name. */ - public name: string; + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * Creates a new PredictRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProductRequest instance + * @returns PredictRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IDeleteProductRequest): google.cloud.retail.v2beta.DeleteProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProductRequest + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; /** - * Verifies a DeleteProductRequest message. + * Verifies a PredictRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProductRequest + * @returns PredictRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this PredictRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { + /** Properties of a PredictResponse. */ + interface IPredictResponse { + + /** PredictResponse results */ + results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); + + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); } - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { /** - * Constructs a new PurgeMetadata. + * Constructs a new PredictResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPurgeMetadata); + constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); + + /** PredictResponse results. */ + public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; + + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new PredictResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeMetadata instance + * @returns PredictResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IPurgeMetadata): google.cloud.retail.v2beta.PurgeMetadata; + public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Verifies a PredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PredictResponse { + + /** Properties of a PredictionResult. */ + interface IPredictionResult { + + /** PredictionResult id */ + id?: (string|null); + + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { + + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); + + /** PredictionResult id. */ + public id: string; + + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise + */ + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; + + /** + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProductsResponse + */ + public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ListProductsCallback): void; + + /** + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @returns Promise + */ + public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest): Promise; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise + */ + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise + */ + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; + + /** + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest, callback: google.cloud.retail.v2alpha.ProductService.SetInventoryCallback): void; + + /** + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @returns Promise + */ + public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest): Promise; + + /** + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback): void; + + /** + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @returns Promise + */ + public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): Promise; + + /** + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback): void; + + /** + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @returns Promise + */ + public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; + } + + namespace ProductService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * @param error Error, if any + * @param [response] ListProductsResponse + */ + type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListProductsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * @param error Error, if any + * @param [response] Operation + */ + type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { + + /** + * Constructs a new CreateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); + + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Verifies a CreateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); + } + + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { + + /** + * Constructs a new GetProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Verifies a GetProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { + + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { + + /** + * Constructs a new UpdateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); + + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Verifies an UpdateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { + + /** DeleteProductRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { + + /** + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProductsRequest. */ + interface IListProductsRequest { + + /** ListProductsRequest parent */ + parent?: (string|null); + + /** ListProductsRequest pageSize */ + pageSize?: (number|null); + + /** ListProductsRequest pageToken */ + pageToken?: (string|null); + + /** ListProductsRequest filter */ + filter?: (string|null); + + /** ListProductsRequest readMask */ + readMask?: (google.protobuf.IFieldMask|null); + + /** ListProductsRequest requireTotalSize */ + requireTotalSize?: (boolean|null); + } + + /** Represents a ListProductsRequest. */ + class ListProductsRequest implements IListProductsRequest { + + /** + * Constructs a new ListProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListProductsRequest); + + /** ListProductsRequest parent. */ + public parent: string; + + /** ListProductsRequest pageSize. */ + public pageSize: number; + + /** ListProductsRequest pageToken. */ + public pageToken: string; + + /** ListProductsRequest filter. */ + public filter: string; + + /** ListProductsRequest readMask. */ + public readMask?: (google.protobuf.IFieldMask|null); + + /** ListProductsRequest requireTotalSize. */ + public requireTotalSize: boolean; + + /** + * Creates a new ListProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListProductsRequest): google.cloud.retail.v2alpha.ListProductsRequest; + + /** + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListProductsRequest; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListProductsRequest; + + /** + * Verifies a ListProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListProductsRequest; + + /** + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @param message ListProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProductsResponse. */ + interface IListProductsResponse { + + /** ListProductsResponse products */ + products?: (google.cloud.retail.v2alpha.IProduct[]|null); + + /** ListProductsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListProductsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListProductsResponse. */ + class ListProductsResponse implements IListProductsResponse { + + /** + * Constructs a new ListProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListProductsResponse); + + /** ListProductsResponse products. */ + public products: google.cloud.retail.v2alpha.IProduct[]; + + /** ListProductsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListProductsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListProductsResponse): google.cloud.retail.v2alpha.ListProductsResponse; + + /** + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListProductsResponse; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListProductsResponse; + + /** + * Verifies a ListProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListProductsResponse; + + /** + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @param message ListProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetInventoryRequest. */ + interface ISetInventoryRequest { + + /** SetInventoryRequest inventory */ + inventory?: (google.cloud.retail.v2alpha.IProduct|null); + + /** SetInventoryRequest setMask */ + setMask?: (google.protobuf.IFieldMask|null); + + /** SetInventoryRequest setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a SetInventoryRequest. */ + class SetInventoryRequest implements ISetInventoryRequest { + + /** + * Constructs a new SetInventoryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryRequest); + + /** SetInventoryRequest inventory. */ + public inventory?: (google.cloud.retail.v2alpha.IProduct|null); + + /** SetInventoryRequest setMask. */ + public setMask?: (google.protobuf.IFieldMask|null); + + /** SetInventoryRequest setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetInventoryRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryRequest): google.cloud.retail.v2alpha.SetInventoryRequest; + + /** + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryRequest; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryRequest; + + /** + * Verifies a SetInventoryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetInventoryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryRequest; + + /** + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @param message SetInventoryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetInventoryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetInventoryMetadata. */ + interface ISetInventoryMetadata { + } + + /** Represents a SetInventoryMetadata. */ + class SetInventoryMetadata implements ISetInventoryMetadata { + + /** + * Constructs a new SetInventoryMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryMetadata); + + /** + * Creates a new SetInventoryMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetInventoryMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryMetadata): google.cloud.retail.v2alpha.SetInventoryMetadata; + + /** + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryMetadata; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryMetadata; + + /** + * Verifies a SetInventoryMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetInventoryMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryMetadata; + + /** + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @param message SetInventoryMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetInventoryMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetInventoryResponse. */ + interface ISetInventoryResponse { + } + + /** Represents a SetInventoryResponse. */ + class SetInventoryResponse implements ISetInventoryResponse { + + /** + * Constructs a new SetInventoryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryResponse); + + /** + * Creates a new SetInventoryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SetInventoryResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryResponse): google.cloud.retail.v2alpha.SetInventoryResponse; + + /** + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryResponse; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryResponse; + + /** + * Verifies a SetInventoryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetInventoryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryResponse; + + /** + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @param message SetInventoryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetInventoryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddFulfillmentPlacesRequest. */ + interface IAddFulfillmentPlacesRequest { + + /** AddFulfillmentPlacesRequest product */ + product?: (string|null); + + /** AddFulfillmentPlacesRequest type */ + type?: (string|null); + + /** AddFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); + + /** AddFulfillmentPlacesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an AddFulfillmentPlacesRequest. */ + class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { + + /** + * Constructs a new AddFulfillmentPlacesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest); + + /** AddFulfillmentPlacesRequest product. */ + public product: string; + + /** AddFulfillmentPlacesRequest type. */ + public type: string; + + /** AddFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** AddFulfillmentPlacesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddFulfillmentPlacesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + + /** + * Verifies an AddFulfillmentPlacesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddFulfillmentPlacesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + + /** + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddFulfillmentPlacesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddFulfillmentPlacesMetadata. */ + interface IAddFulfillmentPlacesMetadata { + } + + /** Represents an AddFulfillmentPlacesMetadata. */ + class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { + + /** + * Constructs a new AddFulfillmentPlacesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata); + + /** + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns AddFulfillmentPlacesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + + /** + * Verifies an AddFulfillmentPlacesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddFulfillmentPlacesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + + /** + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddFulfillmentPlacesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddFulfillmentPlacesResponse. */ + interface IAddFulfillmentPlacesResponse { + } + + /** Represents an AddFulfillmentPlacesResponse. */ + class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { + + /** + * Constructs a new AddFulfillmentPlacesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse); + + /** + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AddFulfillmentPlacesResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + + /** + * Verifies an AddFulfillmentPlacesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddFulfillmentPlacesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + + /** + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddFulfillmentPlacesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveFulfillmentPlacesRequest. */ + interface IRemoveFulfillmentPlacesRequest { + + /** RemoveFulfillmentPlacesRequest product */ + product?: (string|null); + + /** RemoveFulfillmentPlacesRequest type */ + type?: (string|null); + + /** RemoveFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); + + /** RemoveFulfillmentPlacesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a RemoveFulfillmentPlacesRequest. */ + class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { + + /** + * Constructs a new RemoveFulfillmentPlacesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest); + + /** RemoveFulfillmentPlacesRequest product. */ + public product: string; + + /** RemoveFulfillmentPlacesRequest type. */ + public type: string; + + /** RemoveFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveFulfillmentPlacesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + + /** + * Verifies a RemoveFulfillmentPlacesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveFulfillmentPlacesMetadata. */ + interface IRemoveFulfillmentPlacesMetadata { + } + + /** Represents a RemoveFulfillmentPlacesMetadata. */ + class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { + + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata); + + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveFulfillmentPlacesResponse. */ + interface IRemoveFulfillmentPlacesResponse { + } + + /** Represents a RemoveFulfillmentPlacesResponse. */ + class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { + + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse); + + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } + + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { + + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeMetadata); + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeMetadata): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { + + /** PurgeUserEventsRequest parent */ + parent?: (string|null); + + /** PurgeUserEventsRequest filter */ + filter?: (string|null); + + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest); + + /** PurgeUserEventsRequest parent. */ + public parent: string; + + /** PurgeUserEventsRequest filter. */ + public filter: string; + + /** PurgeUserEventsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { + + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2alpha.ISearchRequest, callback: google.cloud.retail.v2alpha.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2alpha.ISearchRequest): Promise; + } + + namespace SearchService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse + */ + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.SearchResponse) => void; + } + + /** Properties of a SearchRequest. */ + interface ISearchRequest { + + /** SearchRequest placement */ + placement?: (string|null); + + /** SearchRequest branch */ + branch?: (string|null); + + /** SearchRequest query */ + query?: (string|null); + + /** SearchRequest visitorId */ + visitorId?: (string|null); + + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** SearchRequest pageSize */ + pageSize?: (number|null); + + /** SearchRequest pageToken */ + pageToken?: (string|null); + + /** SearchRequest offset */ + offset?: (number|null); + + /** SearchRequest filter */ + filter?: (string|null); + + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); + + /** SearchRequest orderBy */ + orderBy?: (string|null); + + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]|null); + + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest relevanceThreshold */ + relevanceThreshold?: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null); + + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); + } + + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { + + /** + * Constructs a new SearchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISearchRequest); + + /** SearchRequest placement. */ + public placement: string; + + /** SearchRequest branch. */ + public branch: string; + + /** SearchRequest query. */ + public query: string; + + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; + + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; + + /** SearchRequest orderBy. */ + public orderBy: string; + + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]; + + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest relevanceThreshold. */ + public relevanceThreshold: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold); + + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; + + /** + * Creates a new SearchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ISearchRequest): google.cloud.retail.v2alpha.SearchRequest; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest; + + /** + * Verifies a SearchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SearchRequest { + + /** Properties of a FacetSpec. */ + interface IFacetSpec { + + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit */ + limit?: (number|null); + + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); + + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } + + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { + + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec); + + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit. */ + public limit: number; + + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; + + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FacetSpec { + + /** Properties of a FacetKey. */ + interface IFacetKey { + + /** FacetKey key */ + key?: (string|null); + + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2alpha.IInterval[]|null); + + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2alpha.IInterval[]; + + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; + + /** FacetKey prefixes. */ + public prefixes: string[]; + + /** FacetKey contains. */ + public contains: string[]; + + /** FacetKey orderBy. */ + public orderBy: string; + + /** FacetKey query. */ + public query: string; + + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { + + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null); + } + + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { + + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec); + + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode); + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DynamicFacetSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } + + /** Properties of a BoostSpec. */ + interface IBoostSpec { + + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } + + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { + + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec); + + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BoostSpec { + + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { + + /** ConditionBoostSpec condition */ + condition?: (string|null); + + /** ConditionBoostSpec boost */ + boost?: (number|null); + } + + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { + + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec); + + /** ConditionBoostSpec condition. */ + public condition: string; + + /** ConditionBoostSpec boost. */ + public boost: number; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { + + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null); + } + + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { + + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec); + + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition); + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace QueryExpansionSpec { + + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } + + /** RelevanceThreshold enum. */ + enum RelevanceThreshold { + RELEVANCE_THRESHOLD_UNSPECIFIED = 0, + HIGH = 1, + MEDIUM = 2, + LOW = 3, + LOWEST = 4 + } + } + + /** Properties of a SearchResponse. */ + interface ISearchResponse { + + /** SearchResponse results */ + results?: (google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null); + + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2alpha.SearchResponse.IFacet[]|null); + + /** SearchResponse totalSize */ + totalSize?: (number|null); + + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); + + /** SearchResponse attributionToken */ + attributionToken?: (string|null); + + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); + + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri */ + redirectUri?: (string|null); + } + + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { + + /** + * Constructs a new SearchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISearchResponse); + + /** SearchResponse results. */ + public results: google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]; + + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2alpha.SearchResponse.IFacet[]; + + /** SearchResponse totalSize. */ + public totalSize: number; + + /** SearchResponse correctedQuery. */ + public correctedQuery: string; + + /** SearchResponse attributionToken. */ + public attributionToken: string; + + /** SearchResponse nextPageToken. */ + public nextPageToken: string; + + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri. */ + public redirectUri: string; + + /** + * Creates a new SearchResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ISearchResponse): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Verifies a SearchResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SearchResponse { + + /** Properties of a SearchResult. */ + interface ISearchResult { + + /** SearchResult id */ + id?: (string|null); + + /** SearchResult product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); + + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { + + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult); + + /** SearchResult id. */ + public id: string; + + /** SearchResult product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; + + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Facet. */ + interface IFacet { + + /** Facet key */ + key?: (string|null); + + /** Facet values */ + values?: (google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]|null); + + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } + + /** Represents a Facet. */ + class Facet implements IFacet { + + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet); + + /** Facet key. */ + public key: string; + + /** Facet values. */ + public values: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]; + + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; + + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Facet { + + /** Properties of a FacetValue. */ + interface IFacetValue { + + /** FacetValue value */ + value?: (string|null); + + /** FacetValue interval */ + interval?: (google.cloud.retail.v2alpha.IInterval|null); + + /** FacetValue count */ + count?: (number|Long|string|null); + } + + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { + + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue); + + /** FacetValue value. */ + public value?: (string|null); + + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2alpha.IInterval|null); + + /** FacetValue count. */ + public count: (number|Long|string); + + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); + + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { + + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); + } + + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { + + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo); + + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { + + /** + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent + */ + public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback): void; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise + */ + public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest): Promise; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody + */ + public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback): void; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise + */ + public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest): Promise; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback): void; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise + */ + public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): Promise; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback): void; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise + */ + public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest): Promise; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback): void; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise + */ + public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): Promise; + } + + namespace UserEventService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent + */ + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.UserEvent) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody + */ + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { + + /** WriteUserEventRequest parent */ + parent?: (string|null); + + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + } + + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { + + /** + * Constructs a new WriteUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest); + + /** WriteUserEventRequest parent. */ + public parent: string; + + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Verifies a WriteUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.WriteUserEventRequest; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { + + /** CollectUserEventRequest parent */ + parent?: (string|null); + + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); + } + + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { + + /** + * Constructs a new CollectUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest); + + /** CollectUserEventRequest parent. */ + public parent: string; + + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Verifies a CollectUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CollectUserEventRequest; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { + + /** RejoinUserEventsRequest parent */ + parent?: (string|null); + + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null); + } + + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + + /** + * Constructs a new RejoinUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest); + + /** RejoinUserEventsRequest parent. */ + public parent: string; + + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope); + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Verifies a RejoinUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace RejoinUserEventsRequest { + + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + + /** + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { + } + + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + + /** + * Constructs a new RejoinUserEventsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata); + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace v2beta. */ + namespace v2beta { + + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { + + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); + } + + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { + + /** + * Constructs a new ProductLevelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductLevelConfig); + + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductLevelConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductLevelConfig): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Verifies a ProductLevelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductLevelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductLevelConfig; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductLevelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + } + + /** Represents a Catalog. */ + class Catalog implements ICatalog { + + /** + * Constructs a new Catalog. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + + /** + * Creates a new Catalog instance using the specified properties. + * @param [properties] Properties to set + * @returns Catalog instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICatalog): google.cloud.retail.v2beta.Catalog; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Catalog; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Catalog; + + /** + * Verifies a Catalog message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Catalog + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Catalog; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Catalog to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Audience. */ + interface IAudience { + + /** Audience genders */ + genders?: (string[]|null); + + /** Audience ageGroups */ + ageGroups?: (string[]|null); + } + + /** Represents an Audience. */ + class Audience implements IAudience { + + /** + * Constructs a new Audience. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IAudience); + + /** Audience genders. */ + public genders: string[]; + + /** Audience ageGroups. */ + public ageGroups: string[]; + + /** + * Creates a new Audience instance using the specified properties. + * @param [properties] Properties to set + * @returns Audience instance + */ + public static create(properties?: google.cloud.retail.v2beta.IAudience): google.cloud.retail.v2beta.Audience; + + /** + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Audience message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Audience; + + /** + * Decodes an Audience message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Audience; + + /** + * Verifies an Audience message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Audience + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Audience; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Audience to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ColorInfo. */ + interface IColorInfo { + + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); + + /** ColorInfo colors */ + colors?: (string[]|null); + } + + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { + + /** + * Constructs a new ColorInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IColorInfo); + + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; + + /** ColorInfo colors. */ + public colors: string[]; + + /** + * Creates a new ColorInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ColorInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IColorInfo): google.cloud.retail.v2beta.ColorInfo; + + /** + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ColorInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ColorInfo; + + /** + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ColorInfo; + + /** + * Verifies a ColorInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ColorInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ColorInfo; + + /** + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ColorInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + + /** CustomAttribute searchable */ + searchable?: (boolean|null); + + /** CustomAttribute indexable */ + indexable?: (boolean|null); + } + + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { + + /** + * Constructs a new CustomAttribute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); + + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomAttribute instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICustomAttribute): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Verifies a CustomAttribute message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomAttribute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CustomAttribute; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomAttribute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { + + /** FulfillmentInfo type */ + type?: (string|null); + + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); + } + + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { + + /** + * Constructs a new FulfillmentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IFulfillmentInfo); + + /** FulfillmentInfo type. */ + public type: string; + + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillmentInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IFulfillmentInfo): google.cloud.retail.v2beta.FulfillmentInfo; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.FulfillmentInfo; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.FulfillmentInfo; + + /** + * Verifies a FulfillmentInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillmentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.FulfillmentInfo; + + /** + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillmentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image uri */ + uri?: (string|null); + + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImage); + + /** Image uri. */ + public uri: string; + + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImage): google.cloud.retail.v2beta.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Image message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Image; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Image; + + /** + * Verifies an Image message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Image + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Image; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Interval. */ + interface IInterval { + + /** Interval minimum */ + minimum?: (number|null); + + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); + + /** Interval maximum */ + maximum?: (number|null); + + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); + } + + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IInterval); + + /** Interval minimum. */ + public minimum?: (number|null); + + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); + + /** Interval maximum. */ + public maximum?: (number|null); + + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); + + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); + + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); + + /** + * Creates a new Interval instance using the specified properties. + * @param [properties] Properties to set + * @returns Interval instance + */ + public static create(properties?: google.cloud.retail.v2beta.IInterval): google.cloud.retail.v2beta.Interval; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Interval; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Interval; + + /** + * Verifies an Interval message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Interval + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Interval; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Interval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PriceInfo. */ + interface IPriceInfo { + + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2beta.PriceInfo.IPriceRange|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { + + /** + * Constructs a new PriceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2beta.PriceInfo.IPriceRange|null); + + /** + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPriceInfo): google.cloud.retail.v2beta.PriceInfo; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo; + + /** + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PriceInfo { + + /** Properties of a PriceRange. */ + interface IPriceRange { + + /** PriceRange price */ + price?: (google.cloud.retail.v2beta.IInterval|null); + + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2beta.IInterval|null); + } + + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { + + /** + * Constructs a new PriceRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.PriceInfo.IPriceRange); + + /** PriceRange price. */ + public price?: (google.cloud.retail.v2beta.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2beta.IInterval|null); + + /** + * Creates a new PriceRange instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceRange instance + */ + public static create(properties?: google.cloud.retail.v2beta.PriceInfo.IPriceRange): google.cloud.retail.v2beta.PriceInfo.PriceRange; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo.PriceRange; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo.PriceRange; + + /** + * Verifies a PriceRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo.PriceRange; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Rating. */ + interface IRating { + + /** Rating ratingCount */ + ratingCount?: (number|null); + + /** Rating averageRating */ + averageRating?: (number|null); + + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } + + /** Represents a Rating. */ + class Rating implements IRating { + + /** + * Constructs a new Rating. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRating); + + /** Rating ratingCount. */ + public ratingCount: number; + + /** Rating averageRating. */ + public averageRating: number; + + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; + + /** + * Creates a new Rating instance using the specified properties. + * @param [properties] Properties to set + * @returns Rating instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRating): google.cloud.retail.v2beta.Rating; + + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rating; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rating; + + /** + * Verifies a Rating message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rating + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rating; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rating to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); + + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { + + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserInfo); + + /** UserInfo userId. */ + public userId: string; + + /** UserInfo ipAddress. */ + public ipAddress: string; + + /** UserInfo userAgent. */ + public userAgent: string; + + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; + + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserInfo): google.cloud.retail.v2beta.UserInfo; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserInfo; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserInfo; + + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserInfo; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Promotion. */ + interface IPromotion { + + /** Promotion promotionId */ + promotionId?: (string|null); + } + + /** Represents a Promotion. */ + class Promotion implements IPromotion { + + /** + * Constructs a new Promotion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPromotion); + + /** Promotion promotionId. */ + public promotionId: string; + + /** + * Creates a new Promotion instance using the specified properties. + * @param [properties] Properties to set + * @returns Promotion instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPromotion): google.cloud.retail.v2beta.Promotion; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Promotion; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Promotion; + + /** + * Verifies a Promotion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Promotion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Promotion; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Promotion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource inputUris */ + inputUris?: (string[]|null); + + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGcsSource); + + /** GcsSource inputUris. */ + public inputUris: string[]; + + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGcsSource): google.cloud.retail.v2beta.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GcsSource; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GcsSource; + + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GcsSource; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { + + /** + * Constructs a new BigQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IBigQuerySource); + + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** BigQuerySource partition. */ + public partition?: "partitionDate"; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQuerySource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IBigQuerySource): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Verifies a BigQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BigQuerySource; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { + + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2beta.IProduct[]|null); + } + + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { + + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductInlineSource); + + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2beta.IProduct[]; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductInlineSource): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInlineSource; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { + + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2beta.IUserEvent[]|null); + } + + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { + + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventInlineSource); + + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2beta.IUserEvent[]; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventInlineSource): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { + + /** + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportErrorsConfig): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportErrorsConfig; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { + + /** ImportProductsRequest parent */ + parent?: (string|null); + + /** ImportProductsRequest requestId */ + requestId?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|null); + + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { + + /** + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportProductsRequest); + + /** ImportProductsRequest parent. */ + public parent: string; + + /** ImportProductsRequest requestId. */ + public requestId: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode); + + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportProductsRequest): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsRequest; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ImportProductsRequest { + + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } + } + + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ + parent?: (string|null); + + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { + + /** + * Constructs a new ImportUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest); + + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Verifies an ImportUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsRequest; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { + + /** ImportCompletionDataRequest parent */ + parent?: (string|null); + + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { + + /** + * Constructs a new ImportCompletionDataRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportCompletionDataRequest); + + /** ImportCompletionDataRequest parent. */ + public parent: string; + + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportCompletionDataRequest): google.cloud.retail.v2beta.ImportCompletionDataRequest; + + /** + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportCompletionDataRequest; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportCompletionDataRequest; + + /** + * Verifies an ImportCompletionDataRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportCompletionDataRequest; + + /** + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCompletionDataRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { + + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + } + + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { + + /** + * Constructs a new ProductInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductInputConfig); + + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductInputConfig): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Verifies a ProductInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInputConfig; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { + + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + } + + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { + + /** + * Constructs a new UserEventInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventInputConfig); + + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventInputConfig): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Verifies a UserEventInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInputConfig; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { + + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + } + + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { + + /** + * Constructs a new CompletionDataInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICompletionDataInputConfig); + + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; + + /** + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDataInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICompletionDataInputConfig): google.cloud.retail.v2beta.CompletionDataInputConfig; + + /** + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionDataInputConfig; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionDataInputConfig; + + /** + * Verifies a CompletionDataInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDataInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionDataInputConfig; + + /** + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionDataInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportMetadata. */ + interface IImportMetadata { + + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { + + /** + * Constructs a new ImportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportMetadata); + + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** ImportMetadata requestId. */ + public requestId: string; + + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportMetadata): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Verifies an ImportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportMetadata; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { + + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + } + + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { + + /** + * Constructs a new ImportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportProductsResponse); + + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportProductsResponse): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Verifies an ImportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsResponse; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { + + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); + } + + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { + + /** + * Constructs a new ImportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse); + + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Verifies an ImportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsResponse; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { + + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); + + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); + } + + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { + + /** + * Constructs a new UserEventImportSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventImportSummary); + + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); + + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventImportSummary instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventImportSummary): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Verifies a UserEventImportSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventImportSummary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventImportSummary; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventImportSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { + + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + } + + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { + + /** + * Constructs a new ImportCompletionDataResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportCompletionDataResponse); + + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** + * Creates a new ImportCompletionDataResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportCompletionDataResponse): google.cloud.retail.v2beta.ImportCompletionDataResponse; + + /** + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportCompletionDataResponse; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportCompletionDataResponse; + + /** + * Verifies an ImportCompletionDataResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportCompletionDataResponse; + + /** + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCompletionDataResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Product. */ + interface IProduct { + + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); + + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); + + /** Product gtin */ + gtin?: (string|null); + + /** Product categories */ + categories?: (string[]|null); + + /** Product title */ + title?: (string|null); + + /** Product brands */ + brands?: (string[]|null); + + /** Product description */ + description?: (string|null); + + /** Product languageCode */ + languageCode?: (string|null); + + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + + /** Product rating */ + rating?: (google.cloud.retail.v2beta.IRating|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2beta.IFulfillmentInfo[]|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2beta.IImage[]|null); + + /** Product audience */ + audience?: (google.cloud.retail.v2beta.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2beta.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); + + /** Product promotions */ + promotions?: (google.cloud.retail.v2beta.IPromotion[]|null); + + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants */ + variants?: (google.cloud.retail.v2beta.IProduct[]|null); + } + + /** Represents a Product. */ + class Product implements IProduct { + + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProduct); + + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); + + /** Product name. */ + public name: string; + + /** Product id. */ + public id: string; + + /** Product type. */ + public type: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type); + + /** Product primaryProductId. */ + public primaryProductId: string; + + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; + + /** Product gtin. */ + public gtin: string; + + /** Product categories. */ + public categories: string[]; + + /** Product title. */ + public title: string; + + /** Product brands. */ + public brands: string[]; + + /** Product description. */ + public description: string; + + /** Product languageCode. */ + public languageCode: string; + + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + + /** Product tags. */ + public tags: string[]; + + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + + /** Product rating. */ + public rating?: (google.cloud.retail.v2beta.IRating|null); + + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability. */ + public availability: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability); + + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2beta.IFulfillmentInfo[]; + + /** Product uri. */ + public uri: string; + + /** Product images. */ + public images: google.cloud.retail.v2beta.IImage[]; + + /** Product audience. */ + public audience?: (google.cloud.retail.v2beta.IAudience|null); + + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2beta.IColorInfo|null); + + /** Product sizes. */ + public sizes: string[]; + + /** Product materials. */ + public materials: string[]; + + /** Product patterns. */ + public patterns: string[]; + + /** Product conditions. */ + public conditions: string[]; + + /** Product promotions. */ + public promotions: google.cloud.retail.v2beta.IPromotion[]; + + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants. */ + public variants: google.cloud.retail.v2beta.IProduct[]; + + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); + + /** + * Creates a new Product instance using the specified properties. + * @param [properties] Properties to set + * @returns Product instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProduct): google.cloud.retail.v2beta.Product; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Product message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Product; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Product; + + /** + * Verifies a Product message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Product + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Product; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Product to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Product { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } + + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } + } + + /** Properties of a UserEvent. */ + interface IUserEvent { + + /** UserEvent eventType */ + eventType?: (string|null); + + /** UserEvent visitorId */ + visitorId?: (string|null); + + /** UserEvent sessionId */ + sessionId?: (string|null); + + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); + + /** UserEvent attributionToken */ + attributionToken?: (string|null); + + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2beta.IProductDetail[]|null); + + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2beta.ICompletionDetail|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent filter */ + filter?: (string|null); + + /** UserEvent orderBy */ + orderBy?: (string|null); + + /** UserEvent offset */ + offset?: (number|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } + + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { + + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEvent); + + /** UserEvent eventType. */ + public eventType: string; + + /** UserEvent visitorId. */ + public visitorId: string; + + /** UserEvent sessionId. */ + public sessionId: string; + + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2beta.IProductDetail[]; + + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2beta.ICompletionDetail|null); + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent filter. */ + public filter: string; + + /** UserEvent orderBy. */ + public orderBy: string; + + /** UserEvent offset. */ + public offset: number; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; + + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEvent): google.cloud.retail.v2beta.UserEvent; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEvent; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEvent; + + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEvent; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductDetail. */ + interface IProductDetail { + + /** ProductDetail product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); + } + + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { + + /** + * Constructs a new ProductDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductDetail); + + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new ProductDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductDetail instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductDetail): google.cloud.retail.v2beta.ProductDetail; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductDetail; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductDetail; + + /** + * Verifies a ProductDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductDetail; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { + + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); + + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); + + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); + } + + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { + + /** + * Constructs a new CompletionDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICompletionDetail); + + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; + + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; + + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; + + /** + * Creates a new CompletionDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDetail instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICompletionDetail): google.cloud.retail.v2beta.CompletionDetail; + + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionDetail; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionDetail; + + /** + * Verifies a CompletionDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionDetail; + + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { + + /** PurchaseTransaction id */ + id?: (string|null); + + /** PurchaseTransaction revenue */ + revenue?: (number|null); + + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); + } + + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { + + /** + * Constructs a new PurchaseTransaction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurchaseTransaction); + + /** PurchaseTransaction id. */ + public id: string; + + /** PurchaseTransaction revenue. */ + public revenue: number; + + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @param [properties] Properties to set + * @returns PurchaseTransaction instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurchaseTransaction): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Verifies a PurchaseTransaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurchaseTransaction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurchaseTransaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { + + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest, callback: google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback): void; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest): Promise; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback): void; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest): Promise; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public setDefaultBranch(request: google.cloud.retail.v2beta.ISetDefaultBranchRequest, callback: google.cloud.retail.v2beta.CatalogService.SetDefaultBranchCallback): void; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise + */ + public setDefaultBranch(request: google.cloud.retail.v2beta.ISetDefaultBranchRequest): Promise; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + */ + public getDefaultBranch(request: google.cloud.retail.v2beta.IGetDefaultBranchRequest, callback: google.cloud.retail.v2beta.CatalogService.GetDefaultBranchCallback): void; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise + */ + public getDefaultBranch(request: google.cloud.retail.v2beta.IGetDefaultBranchRequest): Promise; + } + + namespace CatalogService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListCatalogsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Catalog) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.GetDefaultBranchResponse) => void; + } + + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { + + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListCatalogsRequest); + + /** ListCatalogsRequest parent. */ + public parent: string; + + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListCatalogsRequest): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Verifies a ListCatalogsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsRequest; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { + + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2beta.ICatalog[]|null); + + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { + + /** + * Constructs a new ListCatalogsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListCatalogsResponse); + + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2beta.ICatalog[]; + + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListCatalogsResponse): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Verifies a ListCatalogsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsResponse; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { + + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2beta.ICatalog|null); + + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { + + /** + * Constructs a new UpdateCatalogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest); + + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2beta.ICatalog|null); + + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCatalogRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Verifies an UpdateCatalogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCatalogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateCatalogRequest; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { + + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); + + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); + + /** SetDefaultBranchRequest note */ + note?: (string|null); + } + + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { + + /** + * Constructs a new SetDefaultBranchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ISetDefaultBranchRequest); + + /** SetDefaultBranchRequest catalog. */ + public catalog: string; + + /** SetDefaultBranchRequest branchId. */ + public branchId: string; + + /** SetDefaultBranchRequest note. */ + public note: string; + + /** + * Creates a new SetDefaultBranchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultBranchRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ISetDefaultBranchRequest): google.cloud.retail.v2beta.SetDefaultBranchRequest; + + /** + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetDefaultBranchRequest; + + /** + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetDefaultBranchRequest; + + /** + * Verifies a SetDefaultBranchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultBranchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetDefaultBranchRequest; + + /** + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultBranchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { + + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); + } + + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { + + /** + * Constructs a new GetDefaultBranchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGetDefaultBranchRequest); + + /** GetDefaultBranchRequest catalog. */ + public catalog: string; + + /** + * Creates a new GetDefaultBranchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDefaultBranchRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGetDefaultBranchRequest): google.cloud.retail.v2beta.GetDefaultBranchRequest; + + /** + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetDefaultBranchRequest; + + /** + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetDefaultBranchRequest; + + /** + * Verifies a GetDefaultBranchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDefaultBranchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetDefaultBranchRequest; + + /** + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDefaultBranchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { + + /** GetDefaultBranchResponse branch */ + branch?: (string|null); + + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** GetDefaultBranchResponse note */ + note?: (string|null); + } + + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { + + /** + * Constructs a new GetDefaultBranchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGetDefaultBranchResponse); + + /** GetDefaultBranchResponse branch. */ + public branch: string; + + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** GetDefaultBranchResponse note. */ + public note: string; + + /** + * Creates a new GetDefaultBranchResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDefaultBranchResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGetDefaultBranchResponse): google.cloud.retail.v2beta.GetDefaultBranchResponse; + + /** + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDefaultBranchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetDefaultBranchResponse; + + /** + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDefaultBranchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetDefaultBranchResponse; + + /** + * Verifies a GetDefaultBranchResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDefaultBranchResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetDefaultBranchResponse; + + /** + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDefaultBranchResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { + + /** + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; + + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse + */ + public completeQuery(request: google.cloud.retail.v2beta.ICompleteQueryRequest, callback: google.cloud.retail.v2beta.CompletionService.CompleteQueryCallback): void; + + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise + */ + public completeQuery(request: google.cloud.retail.v2beta.ICompleteQueryRequest): Promise; + + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importCompletionData(request: google.cloud.retail.v2beta.IImportCompletionDataRequest, callback: google.cloud.retail.v2beta.CompletionService.ImportCompletionDataCallback): void; + + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise + */ + public importCompletionData(request: google.cloud.retail.v2beta.IImportCompletionDataRequest): Promise; + } + + namespace CompletionService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse + */ + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompleteQueryResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { + + /** CompleteQueryRequest catalog */ + catalog?: (string|null); + + /** CompleteQueryRequest query */ + query?: (string|null); + + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); + } + + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { + + /** + * Constructs a new CompleteQueryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICompleteQueryRequest); + + /** CompleteQueryRequest catalog. */ + public catalog: string; + + /** CompleteQueryRequest query. */ + public query: string; + + /** CompleteQueryRequest visitorId. */ + public visitorId: string; + + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; + + /** CompleteQueryRequest deviceType. */ + public deviceType: string; + + /** CompleteQueryRequest dataset. */ + public dataset: string; + + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CompleteQueryRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICompleteQueryRequest): google.cloud.retail.v2beta.CompleteQueryRequest; + + /** + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompleteQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryRequest; + + /** + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompleteQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryRequest; + + /** + * Verifies a CompleteQueryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompleteQueryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryRequest; + + /** + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompleteQueryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { + + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult[]|null); + + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); + + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult[]|null); + } + + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { + + /** + * Constructs a new CompleteQueryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICompleteQueryResponse); + + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult[]; + + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; + + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult[]; + + /** + * Creates a new CompleteQueryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns CompleteQueryResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICompleteQueryResponse): google.cloud.retail.v2beta.CompleteQueryResponse; + + /** + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompleteQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse; + + /** + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompleteQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse; + + /** + * Verifies a CompleteQueryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompleteQueryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse; + + /** + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompleteQueryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace CompleteQueryResponse { + + /** Properties of a CompletionResult. */ + interface ICompletionResult { + + /** CompletionResult suggestion */ + suggestion?: (string|null); + + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + } + + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { + + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult); + + /** CompletionResult suggestion. */ + public suggestion: string; + + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { + + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); + } + + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { + + /** + * Constructs a new RecentSearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult); + + /** RecentSearchResult recentSearch. */ + public recentSearch: string; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentSearchResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Verifies a RecentSearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentSearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentSearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an ExportErrorsConfig. */ + interface IExportErrorsConfig { + + /** ExportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ExportErrorsConfig. */ + class ExportErrorsConfig implements IExportErrorsConfig { + + /** + * Constructs a new ExportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IExportErrorsConfig); + + /** ExportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ExportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IExportErrorsConfig): google.cloud.retail.v2beta.ExportErrorsConfig; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportErrorsConfig; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportErrorsConfig; + + /** + * Verifies an ExportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportErrorsConfig; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @param message ExportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportMetadata. */ + interface IExportMetadata { + + /** ExportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an ExportMetadata. */ + class ExportMetadata implements IExportMetadata { + + /** + * Constructs a new ExportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IExportMetadata); + + /** ExportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IExportMetadata): google.cloud.retail.v2beta.ExportMetadata; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportMetadata; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportMetadata; + + /** + * Verifies an ExportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportMetadata; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @param message ExportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportProductsResponse. */ + interface IExportProductsResponse { + + /** ExportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + } + + /** Represents an ExportProductsResponse. */ + class ExportProductsResponse implements IExportProductsResponse { + + /** + * Constructs a new ExportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IExportProductsResponse); + + /** ExportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + + /** + * Creates a new ExportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IExportProductsResponse): google.cloud.retail.v2beta.ExportProductsResponse; + + /** + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportProductsResponse; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportProductsResponse; + + /** + * Verifies an ExportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportProductsResponse; + + /** + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @param message ExportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportUserEventsResponse. */ + interface IExportUserEventsResponse { + + /** ExportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + } + + /** Represents an ExportUserEventsResponse. */ + class ExportUserEventsResponse implements IExportUserEventsResponse { + + /** + * Constructs a new ExportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IExportUserEventsResponse); + + /** ExportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IExportUserEventsResponse): google.cloud.retail.v2beta.ExportUserEventsResponse; + + /** + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportUserEventsResponse; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportUserEventsResponse; + + /** + * Verifies an ExportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportUserEventsResponse; + + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @param message ExportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { + + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; + } + + namespace PredictionService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); + + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPredictRequest): google.cloud.retail.v2beta.PredictRequest; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictRequest; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictRequest; + + /** + * Verifies a PredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictRequest; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PredictResponse. */ + interface IPredictResponse { + + /** PredictResponse results */ + results?: (google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]|null); + + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { + + /** + * Constructs a new PredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPredictResponse); + + /** PredictResponse results. */ + public results: google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]; + + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPredictResponse): google.cloud.retail.v2beta.PredictResponse; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse; + + /** + * Verifies a PredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PredictResponse { + + /** Properties of a PredictionResult. */ + interface IPredictionResult { + + /** PredictionResult id */ + id?: (string|null); + + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { + + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult); + + /** PredictionResult id. */ + public id: string; + + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest, callback: google.cloud.retail.v2beta.ProductService.CreateProductCallback): void; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest): Promise; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest, callback: google.cloud.retail.v2beta.ProductService.GetProductCallback): void; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise + */ + public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest): Promise; + + /** + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProductsResponse + */ + public listProducts(request: google.cloud.retail.v2beta.IListProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ListProductsCallback): void; + + /** + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @returns Promise + */ + public listProducts(request: google.cloud.retail.v2beta.IListProductsRequest): Promise; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest, callback: google.cloud.retail.v2beta.ProductService.UpdateProductCallback): void; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest): Promise; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest, callback: google.cloud.retail.v2beta.ProductService.DeleteProductCallback): void; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise + */ + public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest): Promise; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ImportProductsCallback): void; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise + */ + public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest): Promise; + + /** + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setInventory(request: google.cloud.retail.v2beta.ISetInventoryRequest, callback: google.cloud.retail.v2beta.ProductService.SetInventoryCallback): void; + + /** + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @returns Promise + */ + public setInventory(request: google.cloud.retail.v2beta.ISetInventoryRequest): Promise; + + /** + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addFulfillmentPlaces(request: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2beta.ProductService.AddFulfillmentPlacesCallback): void; + + /** + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @returns Promise + */ + public addFulfillmentPlaces(request: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest): Promise; + + /** + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeFulfillmentPlaces(request: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlacesCallback): void; + + /** + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @returns Promise + */ + public removeFulfillmentPlaces(request: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest): Promise; + } + + namespace ProductService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. + * @param error Error, if any + * @param [response] ListProductsResponse + */ + type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListProductsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. + * @param error Error, if any + * @param [response] Operation + */ + type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { + + /** + * Constructs a new CreateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICreateProductRequest); + + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICreateProductRequest): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Verifies a CreateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateProductRequest; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); + } + + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { + + /** + * Constructs a new GetProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGetProductRequest): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Verifies a GetProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetProductRequest; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { + + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { + + /** + * Constructs a new UpdateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUpdateProductRequest); + + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUpdateProductRequest): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Verifies an UpdateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateProductRequest; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { + + /** DeleteProductRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { + + /** + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IDeleteProductRequest): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteProductRequest; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProductsRequest. */ + interface IListProductsRequest { + + /** ListProductsRequest parent */ + parent?: (string|null); + + /** ListProductsRequest pageSize */ + pageSize?: (number|null); + + /** ListProductsRequest pageToken */ + pageToken?: (string|null); + + /** ListProductsRequest filter */ + filter?: (string|null); + + /** ListProductsRequest readMask */ + readMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a ListProductsRequest. */ + class ListProductsRequest implements IListProductsRequest { + + /** + * Constructs a new ListProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListProductsRequest); + + /** ListProductsRequest parent. */ + public parent: string; + + /** ListProductsRequest pageSize. */ + public pageSize: number; + + /** ListProductsRequest pageToken. */ + public pageToken: string; + + /** ListProductsRequest filter. */ + public filter: string; + + /** ListProductsRequest readMask. */ + public readMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new ListProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListProductsRequest): google.cloud.retail.v2beta.ListProductsRequest; + + /** + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListProductsRequest; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListProductsRequest; + + /** + * Verifies a ListProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListProductsRequest; + + /** + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @param message ListProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProductsResponse. */ + interface IListProductsResponse { + + /** ListProductsResponse products */ + products?: (google.cloud.retail.v2beta.IProduct[]|null); + + /** ListProductsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProductsResponse. */ + class ListProductsResponse implements IListProductsResponse { + + /** + * Constructs a new ListProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListProductsResponse); + + /** ListProductsResponse products. */ + public products: google.cloud.retail.v2beta.IProduct[]; + + /** ListProductsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListProductsResponse): google.cloud.retail.v2beta.ListProductsResponse; + + /** + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListProductsResponse; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListProductsResponse; + + /** + * Verifies a ListProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListProductsResponse; + + /** + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @param message ListProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetInventoryRequest. */ + interface ISetInventoryRequest { + + /** SetInventoryRequest inventory */ + inventory?: (google.cloud.retail.v2beta.IProduct|null); + + /** SetInventoryRequest setMask */ + setMask?: (google.protobuf.IFieldMask|null); + + /** SetInventoryRequest setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a SetInventoryRequest. */ + class SetInventoryRequest implements ISetInventoryRequest { + + /** + * Constructs a new SetInventoryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ISetInventoryRequest); + + /** SetInventoryRequest inventory. */ + public inventory?: (google.cloud.retail.v2beta.IProduct|null); + + /** SetInventoryRequest setMask. */ + public setMask?: (google.protobuf.IFieldMask|null); + + /** SetInventoryRequest setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetInventoryRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ISetInventoryRequest): google.cloud.retail.v2beta.SetInventoryRequest; + + /** + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryRequest; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryRequest; + + /** + * Verifies a SetInventoryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetInventoryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryRequest; + + /** + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @param message SetInventoryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetInventoryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetInventoryMetadata. */ + interface ISetInventoryMetadata { + } + + /** Represents a SetInventoryMetadata. */ + class SetInventoryMetadata implements ISetInventoryMetadata { + + /** + * Constructs a new SetInventoryMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ISetInventoryMetadata); + + /** + * Creates a new SetInventoryMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetInventoryMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.ISetInventoryMetadata): google.cloud.retail.v2beta.SetInventoryMetadata; + + /** + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryMetadata; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryMetadata; + + /** + * Verifies a SetInventoryMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetInventoryMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryMetadata; + + /** + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @param message SetInventoryMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetInventoryMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetInventoryResponse. */ + interface ISetInventoryResponse { + } + + /** Represents a SetInventoryResponse. */ + class SetInventoryResponse implements ISetInventoryResponse { + + /** + * Constructs a new SetInventoryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ISetInventoryResponse); + + /** + * Creates a new SetInventoryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SetInventoryResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.ISetInventoryResponse): google.cloud.retail.v2beta.SetInventoryResponse; + + /** + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryResponse; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryResponse; + + /** + * Verifies a SetInventoryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetInventoryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryResponse; + + /** + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @param message SetInventoryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetInventoryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddFulfillmentPlacesRequest. */ + interface IAddFulfillmentPlacesRequest { + + /** AddFulfillmentPlacesRequest product */ + product?: (string|null); + + /** AddFulfillmentPlacesRequest type */ + type?: (string|null); + + /** AddFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); + + /** AddFulfillmentPlacesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an AddFulfillmentPlacesRequest. */ + class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { + + /** + * Constructs a new AddFulfillmentPlacesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest); + + /** AddFulfillmentPlacesRequest product. */ + public product: string; + + /** AddFulfillmentPlacesRequest type. */ + public type: string; + + /** AddFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** AddFulfillmentPlacesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddFulfillmentPlacesRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + + /** + * Verifies an AddFulfillmentPlacesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddFulfillmentPlacesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + + /** + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddFulfillmentPlacesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddFulfillmentPlacesMetadata. */ + interface IAddFulfillmentPlacesMetadata { + } + + /** Represents an AddFulfillmentPlacesMetadata. */ + class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { + + /** + * Constructs a new AddFulfillmentPlacesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata); + + /** + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns AddFulfillmentPlacesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + + /** + * Verifies an AddFulfillmentPlacesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddFulfillmentPlacesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + + /** + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddFulfillmentPlacesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddFulfillmentPlacesResponse. */ + interface IAddFulfillmentPlacesResponse { + } + + /** Represents an AddFulfillmentPlacesResponse. */ + class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { + + /** + * Constructs a new AddFulfillmentPlacesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse); + + /** + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AddFulfillmentPlacesResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + + /** + * Verifies an AddFulfillmentPlacesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddFulfillmentPlacesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + + /** + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddFulfillmentPlacesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveFulfillmentPlacesRequest. */ + interface IRemoveFulfillmentPlacesRequest { + + /** RemoveFulfillmentPlacesRequest product */ + product?: (string|null); + + /** RemoveFulfillmentPlacesRequest type */ + type?: (string|null); + + /** RemoveFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); + + /** RemoveFulfillmentPlacesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a RemoveFulfillmentPlacesRequest. */ + class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { + + /** + * Constructs a new RemoveFulfillmentPlacesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest); + + /** RemoveFulfillmentPlacesRequest product. */ + public product: string; + + /** RemoveFulfillmentPlacesRequest type. */ + public type: string; + + /** RemoveFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveFulfillmentPlacesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest; + + /** + * Verifies a RemoveFulfillmentPlacesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveFulfillmentPlacesMetadata. */ + interface IRemoveFulfillmentPlacesMetadata { + } + + /** Represents a RemoveFulfillmentPlacesMetadata. */ + class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { + + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata); + + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata; + + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveFulfillmentPlacesResponse. */ + interface IRemoveFulfillmentPlacesResponse { + } + + /** Represents a RemoveFulfillmentPlacesResponse. */ + class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { + + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse); + + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; + + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } + + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { + + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeMetadata); + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurgeMetadata): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { + + /** PurgeUserEventsRequest parent */ + parent?: (string|null); + + /** PurgeUserEventsRequest filter */ + filter?: (string|null); + + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest); + + /** PurgeUserEventsRequest parent. */ + public parent: string; + + /** PurgeUserEventsRequest filter. */ + public filter: string; + + /** PurgeUserEventsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { + + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2beta.ISearchRequest, callback: google.cloud.retail.v2beta.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2beta.ISearchRequest): Promise; + } + + namespace SearchService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse + */ + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.SearchResponse) => void; + } + + /** Properties of a SearchRequest. */ + interface ISearchRequest { + + /** SearchRequest placement */ + placement?: (string|null); + + /** SearchRequest branch */ + branch?: (string|null); + + /** SearchRequest query */ + query?: (string|null); + + /** SearchRequest visitorId */ + visitorId?: (string|null); + + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** SearchRequest pageSize */ + pageSize?: (number|null); + + /** SearchRequest pageToken */ + pageToken?: (string|null); + + /** SearchRequest offset */ + offset?: (number|null); + + /** SearchRequest filter */ + filter?: (string|null); + + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); + + /** SearchRequest orderBy */ + orderBy?: (string|null); + + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2beta.SearchRequest.IFacetSpec[]|null); + + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); + } + + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { + + /** + * Constructs a new SearchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ISearchRequest); + + /** SearchRequest placement. */ + public placement: string; + + /** SearchRequest branch. */ + public branch: string; + + /** SearchRequest query. */ + public query: string; + + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; + + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; + + /** SearchRequest orderBy. */ + public orderBy: string; + + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2beta.SearchRequest.IFacetSpec[]; + + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; + + /** + * Creates a new SearchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ISearchRequest): google.cloud.retail.v2beta.SearchRequest; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest; + + /** + * Verifies a SearchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SearchRequest { + + /** Properties of a FacetSpec. */ + interface IFacetSpec { + + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit */ + limit?: (number|null); + + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); + + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } + + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { + + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IFacetSpec); + + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit. */ + public limit: number; + + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; + + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IFacetSpec): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FacetSpec { + + /** Properties of a FacetKey. */ + interface IFacetKey { + + /** FacetKey key */ + key?: (string|null); + + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2beta.IInterval[]|null); + + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2beta.IInterval[]; + + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; + + /** FacetKey prefixes. */ + public prefixes: string[]; + + /** FacetKey contains. */ + public contains: string[]; + + /** FacetKey orderBy. */ + public orderBy: string; + + /** FacetKey query. */ + public query: string; + + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { + + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|null); + } + + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { + + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec); + + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode); + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DynamicFacetSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } + + /** Properties of a BoostSpec. */ + interface IBoostSpec { + + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } + + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { + + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IBoostSpec); + + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IBoostSpec): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BoostSpec { + + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { + + /** ConditionBoostSpec condition */ + condition?: (string|null); + + /** ConditionBoostSpec boost */ + boost?: (number|null); + } + + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { + + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec); + + /** ConditionBoostSpec condition. */ + public condition: string; + + /** ConditionBoostSpec boost. */ + public boost: number; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { + + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null); + } + + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { + + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec); + + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition); + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace QueryExpansionSpec { - /** - * Decodes a PurgeMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeMetadata; + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } + } - /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeMetadata; + /** Properties of a SearchResponse. */ + interface ISearchResponse { - /** - * Verifies a PurgeMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** SearchResponse results */ + results?: (google.cloud.retail.v2beta.SearchResponse.ISearchResult[]|null); - /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeMetadata; + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2beta.SearchResponse.IFacet[]|null); - /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** SearchResponse totalSize */ + totalSize?: (number|null); - /** - * Converts this PurgeMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { + /** SearchResponse attributionToken */ + attributionToken?: (string|null); - /** PurgeUserEventsRequest parent */ - parent?: (string|null); + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); - /** PurgeUserEventsRequest filter */ - filter?: (string|null); + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null); - /** PurgeUserEventsRequest force */ - force?: (boolean|null); + /** SearchResponse redirectUri */ + redirectUri?: (string|null); } - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new SearchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest); + constructor(properties?: google.cloud.retail.v2beta.ISearchResponse); - /** PurgeUserEventsRequest parent. */ - public parent: string; + /** SearchResponse results. */ + public results: google.cloud.retail.v2beta.SearchResponse.ISearchResult[]; - /** PurgeUserEventsRequest filter. */ - public filter: string; + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2beta.SearchResponse.IFacet[]; - /** PurgeUserEventsRequest force. */ - public force: boolean; + /** SearchResponse totalSize. */ + public totalSize: number; + + /** SearchResponse correctedQuery. */ + public correctedQuery: string; + + /** SearchResponse attributionToken. */ + public attributionToken: string; + + /** SearchResponse nextPageToken. */ + public nextPageToken: string; + + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri. */ + public redirectUri: string; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance + * @returns SearchResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static create(properties?: google.cloud.retail.v2beta.ISearchResponse): google.cloud.retail.v2beta.SearchResponse; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest + * @returns SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest + * @returns SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a SearchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsRequest + * @returns SearchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this SearchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { + namespace SearchResponse { - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); - } + /** Properties of a SearchResult. */ + interface ISearchResult { - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** SearchResult id */ + id?: (string|null); - /** - * Constructs a new PurgeUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse); + /** SearchResult product */ + product?: (google.cloud.retail.v2beta.IProduct|null); - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance - */ - public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse): google.cloud.retail.v2beta.PurgeUserEventsResponse; + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); - /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { + + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.ISearchResult); + + /** SearchResult id. */ + public id: string; + + /** SearchResult product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; + + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.ISearchResult): google.cloud.retail.v2beta.SearchResponse.SearchResult; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.SearchResult; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.SearchResult; + + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.SearchResult; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Facet. */ + interface IFacet { + + /** Facet key */ + key?: (string|null); + + /** Facet values */ + values?: (google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue[]|null); + + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } + + /** Represents a Facet. */ + class Facet implements IFacet { + + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.IFacet); + + /** Facet key. */ + public key: string; + + /** Facet values. */ + public values: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue[]; + + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; + + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.IFacet): google.cloud.retail.v2beta.SearchResponse.Facet; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.Facet; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.Facet; + + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.Facet; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Facet { + + /** Properties of a FacetValue. */ + interface IFacetValue { + + /** FacetValue value */ + value?: (string|null); + + /** FacetValue interval */ + interval?: (google.cloud.retail.v2beta.IInterval|null); + + /** FacetValue count */ + count?: (number|Long|string|null); + } + + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { + + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue); + + /** FacetValue value. */ + public value?: (string|null); + + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2beta.IInterval|null); + + /** FacetValue count. */ + public count: (number|Long|string); + + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); + + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { + + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); + } + + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { + + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo); + + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsResponse; + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsResponse; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** - * Verifies a PurgeUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeUserEventsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsResponse; + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** - * Converts this PurgeUserEventsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Represents a UserEventService */ @@ -17768,271 +32777,283 @@ export namespace google { } } - /** Properties of an Empty. */ - interface IEmpty { + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); } - /** Represents an Empty. */ - class Empty implements IEmpty { + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { /** - * Constructs a new Empty. + * Constructs a new Timestamp. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IEmpty); + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; /** - * Creates a new Empty instance using the specified properties. + * Creates a new Timestamp instance using the specified properties. * @param [properties] Properties to set - * @returns Empty instance + * @returns Timestamp instance */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Empty + * @returns Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; /** - * Decodes an Empty message from the specified reader or buffer, length delimited. + * Decodes a Timestamp message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Empty + * @returns Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; /** - * Verifies an Empty message. + * Verifies a Timestamp message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Empty + * @returns Timestamp */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @param message Empty + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Empty to JSON. + * Converts this Timestamp to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FieldMask. */ - interface IFieldMask { + /** Properties of a Duration. */ + interface IDuration { - /** FieldMask paths */ - paths?: (string[]|null); + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); } - /** Represents a FieldMask. */ - class FieldMask implements IFieldMask { + /** Represents a Duration. */ + class Duration implements IDuration { /** - * Constructs a new FieldMask. + * Constructs a new Duration. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IFieldMask); + constructor(properties?: google.protobuf.IDuration); - /** FieldMask paths. */ - public paths: string[]; + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; /** - * Creates a new FieldMask instance using the specified properties. + * Creates a new Duration instance using the specified properties. * @param [properties] Properties to set - * @returns FieldMask instance + * @returns Duration instance */ - public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FieldMask message from the specified reader or buffer. + * Decodes a Duration message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FieldMask + * @returns Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * Decodes a Duration message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FieldMask + * @returns Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; /** - * Verifies a FieldMask message. + * Verifies a Duration message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * Creates a Duration message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FieldMask + * @returns Duration */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @param message FieldMask + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FieldMask to JSON. + * Converts this Duration to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Timestamp. */ - interface ITimestamp { - - /** Timestamp seconds */ - seconds?: (number|Long|string|null); + /** Properties of a FieldMask. */ + interface IFieldMask { - /** Timestamp nanos */ - nanos?: (number|null); + /** FieldMask paths */ + paths?: (string[]|null); } - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { /** - * Constructs a new Timestamp. + * Constructs a new FieldMask. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.ITimestamp); - - /** Timestamp seconds. */ - public seconds: (number|Long|string); + constructor(properties?: google.protobuf.IFieldMask); - /** Timestamp nanos. */ - public nanos: number; + /** FieldMask paths. */ + public paths: string[]; /** - * Creates a new Timestamp instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @param [properties] Properties to set - * @returns Timestamp instance + * @returns FieldMask instance */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a FieldMask message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Timestamp + * @returns FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a FieldMask message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Timestamp + * @returns FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; /** - * Verifies a Timestamp message. + * Verifies a FieldMask message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Timestamp + * @returns FieldMask */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @param message Timestamp + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Timestamp to JSON. + * Converts this FieldMask to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -18944,6 +33965,90 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Struct. */ interface IStruct { @@ -19251,204 +34356,214 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + } - /** Properties of a Duration. */ - interface IDuration { + /** Namespace rpc. */ + namespace rpc { - /** Duration seconds */ - seconds?: (number|Long|string|null); + /** Properties of a Status. */ + interface IStatus { - /** Duration nanos */ - nanos?: (number|null); + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); } - /** Represents a Duration. */ - class Duration implements IDuration { + /** Represents a Status. */ + class Status implements IStatus { /** - * Constructs a new Duration. + * Constructs a new Status. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IDuration); + constructor(properties?: google.rpc.IStatus); - /** Duration seconds. */ - public seconds: (number|Long|string); + /** Status code. */ + public code: number; - /** Duration nanos. */ - public nanos: number; + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; /** - * Creates a new Duration instance using the specified properties. + * Creates a new Status instance using the specified properties. * @param [properties] Properties to set - * @returns Duration instance + * @returns Status instance */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + public static create(properties?: google.rpc.IStatus): google.rpc.Status; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes a Status message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Duration + * @returns Status * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes a Status message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Duration + * @returns Status * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; /** - * Verifies a Duration message. + * Verifies a Status message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates a Status message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Duration + * @returns Status */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + public static fromObject(object: { [k: string]: any }): google.rpc.Status; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @param message Duration + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Duration to JSON. + * Converts this Status to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } } - /** Namespace rpc. */ - namespace rpc { + /** Namespace type. */ + namespace type { - /** Properties of a Status. */ - interface IStatus { + /** Properties of a Date. */ + interface IDate { - /** Status code */ - code?: (number|null); + /** Date year */ + year?: (number|null); - /** Status message */ - message?: (string|null); + /** Date month */ + month?: (number|null); - /** Status details */ - details?: (google.protobuf.IAny[]|null); + /** Date day */ + day?: (number|null); } - /** Represents a Status. */ - class Status implements IStatus { + /** Represents a Date. */ + class Date implements IDate { /** - * Constructs a new Status. + * Constructs a new Date. * @param [properties] Properties to set */ - constructor(properties?: google.rpc.IStatus); + constructor(properties?: google.type.IDate); - /** Status code. */ - public code: number; + /** Date year. */ + public year: number; - /** Status message. */ - public message: string; + /** Date month. */ + public month: number; - /** Status details. */ - public details: google.protobuf.IAny[]; + /** Date day. */ + public day: number; /** - * Creates a new Status instance using the specified properties. + * Creates a new Date instance using the specified properties. * @param [properties] Properties to set - * @returns Status instance + * @returns Date instance */ - public static create(properties?: google.rpc.IStatus): google.rpc.Status; + public static create(properties?: google.type.IDate): google.type.Date; /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @param message Status message or plain object to encode + * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @param message Date message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @param message Status message or plain object to encode + * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @param message Date message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Status message from the specified reader or buffer. + * Decodes a Date message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Status + * @returns Date * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Date; /** - * Decodes a Status message from the specified reader or buffer, length delimited. + * Decodes a Date message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Status + * @returns Date * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Date; /** - * Verifies a Status message. + * Verifies a Date message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. + * Creates a Date message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Status + * @returns Date */ - public static fromObject(object: { [k: string]: any }): google.rpc.Status; + public static fromObject(object: { [k: string]: any }): google.type.Date; /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @param message Status + * Creates a plain object from a Date message. Also converts values to other types if specified. + * @param message Date * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.type.Date, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Status to JSON. + * Converts this Date to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 1bbefd56c22..c5ae26d1cb0 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -513,127 +513,27 @@ return Catalog; })(); - v2.CatalogService = (function() { - - /** - * Constructs a new CatalogService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CatalogService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.CatalogService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. - */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef ListCatalogsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse - */ - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + v2.Audience = (function() { /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef UpdateCatalogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Catalog} [response] Catalog - */ - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return CatalogService; - })(); - - v2.ListCatalogsRequest = (function() { - - /** - * Properties of a ListCatalogsRequest. + * Properties of an Audience. * @memberof google.cloud.retail.v2 - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups */ /** - * Constructs a new ListCatalogsRequest. + * Constructs a new Audience. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * @classdesc Represents an Audience. + * @implements IAudience * @constructor - * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function Audience(properties) { + this.genders = []; + this.ageGroups = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -641,101 +541,94 @@ } /** - * ListCatalogsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ListCatalogsRequest - * @instance - */ - ListCatalogsRequest.prototype.parent = ""; - - /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2.Audience * @instance */ - ListCatalogsRequest.prototype.pageSize = 0; + Audience.prototype.genders = $util.emptyArray; /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2.Audience * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + Audience.prototype.ageGroups = $util.emptyArray; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Audience} Audience instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + Audience.create = function create(properties) { + return new Audience(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + Audience.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + Audience.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + Audience.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Audience(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); break; case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -746,126 +639,143 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + Audience.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies an Audience message. * @function verify - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + Audience.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; + } return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.Audience} Audience */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Audience) return object; - var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + var message = new $root.google.cloud.retail.v2.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); + } return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from an Audience message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @static - * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2.Audience} message Audience * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + Audience.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; return object; }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this Audience to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.Audience * @instance * @returns {Object.} JSON object */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { + Audience.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsRequest; + return Audience; })(); - v2.ListCatalogsResponse = (function() { + v2.ColorInfo = (function() { /** - * Properties of a ListCatalogsResponse. + * Properties of a ColorInfo. * @memberof google.cloud.retail.v2 - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors */ /** - * Constructs a new ListCatalogsResponse. + * Constructs a new ColorInfo. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set */ - function ListCatalogsResponse(properties) { - this.catalogs = []; + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -873,91 +783,94 @@ } /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2.ColorInfo * @instance */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + ColorInfo.prototype.colorFamilies = $util.emptyArray; /** - * ListCatalogsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2.ColorInfo * @instance */ - ListCatalogsResponse.prototype.nextPageToken = ""; + ColorInfo.prototype.colors = $util.emptyArray; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance + * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo instance */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); return writer; }; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decode = function decode(reader, length) { + ColorInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); break; case 2: - message.nextPageToken = reader.string(); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -968,134 +881,145 @@ }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsResponse message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsResponse.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); - if (error) - return "catalogs." + error; - } + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; + } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; return null; }; /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ColorInfo) return object; - var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); - } + var message = new $root.google.cloud.retail.v2.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); + } + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse + * @param {google.cloud.retail.v2.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsResponse.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.catalogs = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; + } + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; + } + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ColorInfo * @instance * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsResponse; + return ColorInfo; })(); - v2.UpdateCatalogRequest = (function() { + v2.CustomAttribute = (function() { /** - * Properties of an UpdateCatalogRequest. + * Properties of a CustomAttribute. * @memberof google.cloud.retail.v2 - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable */ /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new CustomAttribute. * @memberof google.cloud.retail.v2 - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute * @constructor - * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set */ - function UpdateCatalogRequest(properties) { + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1103,88 +1027,153 @@ } /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2.CustomAttribute * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + CustomAttribute.prototype.text = $util.emptyArray; /** - * UpdateCatalogRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2.CustomAttribute * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + CustomAttribute.prototype.numbers = $util.emptyArray; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.searchable = null; + + /** + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.indexable = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); }; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encode = function encode(message, writer) { + CustomAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decode = function decode(reader, length) { + CustomAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + case 3: + message.searchable = reader.bool(); + break; + case 4: + message.indexable = reader.bool(); break; default: reader.skipType(tag & 7); @@ -1195,129 +1184,167 @@ }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a CustomAttribute message. * @function verify - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateCatalogRequest.verify = function verify(message) { + CustomAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); - if (error) - return "catalog." + error; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; } return null; }; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) return object; - var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + var message = new $root.google.cloud.retail.v2.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); } - return message; - }; - + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); + return message; + }; + /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateCatalogRequest.toObject = function toObject(message, options) { + CustomAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.catalog = null; - object.updateMask = null; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; + if (options.oneofs) + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this CustomAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.CustomAttribute * @instance * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { + CustomAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateCatalogRequest; + return CustomAttribute; })(); - v2.CustomAttribute = (function() { + v2.FulfillmentInfo = (function() { /** - * Properties of a CustomAttribute. + * Properties of a FulfillmentInfo. * @memberof google.cloud.retail.v2 - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds */ /** - * Constructs a new CustomAttribute. + * Constructs a new FulfillmentInfo. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo * @constructor - * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; + function FulfillmentInfo(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1325,102 +1352,91 @@ } /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2.CustomAttribute + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2.FulfillmentInfo * @instance */ - CustomAttribute.prototype.text = $util.emptyArray; + FulfillmentInfo.prototype.type = ""; /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2.CustomAttribute + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.FulfillmentInfo * @instance */ - CustomAttribute.prototype.numbers = $util.emptyArray; + FulfillmentInfo.prototype.placeIds = $util.emptyArray; /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance + * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo instance */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); }; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encode = function encode(message, writer) { + FulfillmentInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); return writer; }; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decode = function decode(reader, length) { + FulfillmentInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.FulfillmentInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); + message.type = reader.string(); break; case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -1431,120 +1447,108 @@ }; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomAttribute message. + * Verifies a FulfillmentInfo message. * @function verify - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomAttribute.verify = function verify(message) { + FulfillmentInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; } return null; }; /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.FulfillmentInfo) return object; - var message = new $root.google.cloud.retail.v2.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); - } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); + var message = new $root.google.cloud.retail.v2.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); } return message; }; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute + * @param {google.cloud.retail.v2.FulfillmentInfo} message FulfillmentInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomAttribute.toObject = function toObject(message, options) { + FulfillmentInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; } return object; }; /** - * Converts this CustomAttribute to JSON. + * Converts this FulfillmentInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.FulfillmentInfo * @instance * @returns {Object.} JSON object */ - CustomAttribute.prototype.toJSON = function toJSON() { + FulfillmentInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomAttribute; + return FulfillmentInfo; })(); v2.Image = (function() { @@ -1779,6 +1783,304 @@ return Image; })(); + v2.Interval = (function() { + + /** + * Properties of an Interval. + * @memberof google.cloud.retail.v2 + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum + */ + + /** + * Constructs a new Interval. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an Interval. + * @implements IInterval + * @constructor + * @param {google.cloud.retail.v2.IInterval=} [properties] Properties to set + */ + function Interval(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Interval.prototype.minimum = null; + + /** + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Interval.prototype.exclusiveMinimum = null; + + /** + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Interval.prototype.maximum = null; + + /** + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Interval instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {google.cloud.retail.v2.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Interval} Interval instance + */ + Interval.create = function create(properties) { + return new Interval(properties); + }; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {google.cloud.retail.v2.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); + return writer; + }; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {google.cloud.retail.v2.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Interval(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minimum = reader.double(); + break; + case 2: + message.exclusiveMinimum = reader.double(); + break; + case 3: + message.maximum = reader.double(); + break; + case 4: + message.exclusiveMaximum = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Interval message. + * @function verify + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Interval.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; + } + return null; + }; + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Interval} Interval + */ + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Interval) + return object; + var message = new $root.google.cloud.retail.v2.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); + return message; + }; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {google.cloud.retail.v2.Interval} message Interval + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Interval.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; + } + return object; + }; + + /** + * Converts this Interval to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Interval + * @instance + * @returns {Object.} JSON object + */ + Interval.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Interval; + })(); + v2.PriceInfo = (function() { /** @@ -1789,6 +2091,9 @@ * @property {number|null} [price] PriceInfo price * @property {number|null} [originalPrice] PriceInfo originalPrice * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange */ /** @@ -1838,6 +2143,30 @@ */ PriceInfo.prototype.cost = 0; + /** + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.priceEffectiveTime = null; + + /** + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.priceExpireTime = null; + + /** + * PriceInfo priceRange. + * @member {google.cloud.retail.v2.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2.PriceInfo + * @instance + */ + PriceInfo.prototype.priceRange = null; + /** * Creates a new PriceInfo instance using the specified properties. * @function create @@ -1870,6 +2199,12 @@ writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; @@ -1916,6 +2251,15 @@ case 4: message.cost = reader.float(); break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1963,6 +2307,21 @@ if (message.cost != null && message.hasOwnProperty("cost")) if (typeof message.cost !== "number") return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; + } return null; }; @@ -1986,6 +2345,21 @@ message.originalPrice = Number(object.originalPrice); if (object.cost != null) message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.fromObject(object.priceRange); + } return message; }; @@ -2007,6 +2381,9 @@ object.price = 0; object.originalPrice = 0; object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; } if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) object.currencyCode = message.currencyCode; @@ -2016,6 +2393,12 @@ object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; if (message.cost != null && message.hasOwnProperty("cost")) object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; @@ -2030,9 +2413,486 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + PriceInfo.PriceRange = (function() { + + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2.IInterval|null} [originalPrice] PriceRange originalPrice + */ + + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceRange price. + * @member {google.cloud.retail.v2.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; + + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; + + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + return PriceInfo; })(); + v2.Rating = (function() { + + /** + * Properties of a Rating. + * @memberof google.cloud.retail.v2 + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram + */ + + /** + * Constructs a new Rating. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a Rating. + * @implements IRating + * @constructor + * @param {google.cloud.retail.v2.IRating=} [properties] Properties to set + */ + function Rating(properties) { + this.ratingHistogram = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2.Rating + * @instance + */ + Rating.prototype.ratingCount = 0; + + /** + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2.Rating + * @instance + */ + Rating.prototype.averageRating = 0; + + /** + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2.Rating + * @instance + */ + Rating.prototype.ratingHistogram = $util.emptyArray; + + /** + * Creates a new Rating instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {google.cloud.retail.v2.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rating} Rating instance + */ + Rating.create = function create(properties) { + return new Rating(properties); + }; + + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {google.cloud.retail.v2.IRating} message Rating message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rating.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {google.cloud.retail.v2.IRating} message Rating message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rating.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rating} Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rating.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rating(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ratingCount = reader.int32(); + break; + case 2: + message.averageRating = reader.float(); + break; + case 3: + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rating} Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rating.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Rating message. + * @function verify + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Rating.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; + } + return null; + }; + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rating} Rating + */ + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rating) + return object; + var message = new $root.google.cloud.retail.v2.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; + } + return message; + }; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {google.cloud.retail.v2.Rating} message Rating + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Rating.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ratingHistogram = []; + if (options.defaults) { + object.ratingCount = 0; + object.averageRating = 0; + } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; + } + return object; + }; + + /** + * Converts this Rating to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rating + * @instance + * @returns {Object.} JSON object + */ + Rating.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Rating; + })(); + v2.UserInfo = (function() { /** @@ -2287,6 +3147,193 @@ return UserInfo; })(); + v2.Promotion = (function() { + + /** + * Properties of a Promotion. + * @memberof google.cloud.retail.v2 + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId + */ + + /** + * Constructs a new Promotion. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a Promotion. + * @implements IPromotion + * @constructor + * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + */ + function Promotion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2.Promotion + * @instance + */ + Promotion.prototype.promotionId = ""; + + /** + * Creates a new Promotion instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Promotion} Promotion instance + */ + Promotion.create = function create(properties) { + return new Promotion(properties); + }; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + return writer; + }; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Promotion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.promotionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Promotion message. + * @function verify + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Promotion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; + return null; + }; + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Promotion} Promotion + */ + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Promotion) + return object; + var message = new $root.google.cloud.retail.v2.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); + return message; + }; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.Promotion} message Promotion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Promotion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; + return object; + }; + + /** + * Converts this Promotion to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Promotion + * @instance + * @returns {Object.} JSON object + */ + Promotion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Promotion; + })(); + v2.GcsSource = (function() { /** @@ -2519,6 +3566,7 @@ * Properties of a BigQuerySource. * @memberof google.cloud.retail.v2 * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate * @property {string|null} [projectId] BigQuerySource projectId * @property {string|null} [datasetId] BigQuerySource datasetId * @property {string|null} [tableId] BigQuerySource tableId @@ -2541,6 +3589,14 @@ this[keys[i]] = properties[keys[i]]; } + /** + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.partitionDate = null; + /** * BigQuerySource projectId. * @member {string} projectId @@ -2581,6 +3637,20 @@ */ BigQuerySource.prototype.dataSchema = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new BigQuerySource instance using the specified properties. * @function create @@ -2615,6 +3685,8 @@ writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -2649,6 +3721,9 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; case 5: message.projectId = reader.string(); break; @@ -2699,6 +3774,15 @@ BigQuerySource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; + { + var error = $root.google.type.Date.verify(message.partitionDate); + if (error) + return "partitionDate." + error; + } + } if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; @@ -2729,6 +3813,11 @@ if (object instanceof $root.google.cloud.retail.v2.BigQuerySource) return object; var message = new $root.google.cloud.retail.v2.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); + } if (object.projectId != null) message.projectId = String(object.projectId); if (object.datasetId != null) @@ -2772,6 +3861,11 @@ object.dataSchema = message.dataSchema; if (message.projectId != null && message.hasOwnProperty("projectId")) object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (options.oneofs) + object.partition = "partitionDate"; + } return object; }; @@ -3417,9 +4511,12 @@ * @memberof google.cloud.retail.v2 * @interface IImportProductsRequest * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId * @property {google.cloud.retail.v2.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic */ /** @@ -3445,6 +4542,14 @@ */ ImportProductsRequest.prototype.parent = ""; + /** + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.requestId = ""; + /** * ImportProductsRequest inputConfig. * @member {google.cloud.retail.v2.IProductInputConfig|null|undefined} inputConfig @@ -3469,6 +4574,22 @@ */ ImportProductsRequest.prototype.updateMask = null; + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + /** * Creates a new ImportProductsRequest instance using the specified properties. * @function create @@ -3501,6 +4622,12 @@ $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); return writer; }; @@ -3538,6 +4665,9 @@ case 1: message.parent = reader.string(); break; + case 6: + message.requestId = reader.string(); + break; case 2: message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); break; @@ -3547,6 +4677,12 @@ case 4: message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: + message.notificationPubsubTopic = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -3585,6 +4721,9 @@ if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { var error = $root.google.cloud.retail.v2.ProductInputConfig.verify(message.inputConfig); if (error) @@ -3600,6 +4739,18 @@ if (error) return "updateMask." + error; } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; @@ -3617,6 +4768,8 @@ var message = new $root.google.cloud.retail.v2.ImportProductsRequest(); if (object.parent != null) message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); if (object.inputConfig != null) { if (typeof object.inputConfig !== "object") throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.inputConfig: object expected"); @@ -3632,6 +4785,22 @@ throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; @@ -3653,6 +4822,9 @@ object.inputConfig = null; object.errorsConfig = null; object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -3662,6 +4834,12 @@ object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; @@ -3676,6 +4854,22 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * ReconciliationMode enum. + * @name google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value + */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); + return ImportProductsRequest; })(); @@ -3921,26 +5115,26 @@ return ImportUserEventsRequest; })(); - v2.ProductInputConfig = (function() { + v2.ImportCompletionDataRequest = (function() { /** - * Properties of a ProductInputConfig. + * Properties of an ImportCompletionDataRequest. * @memberof google.cloud.retail.v2 - * @interface IProductInputConfig - * @property {google.cloud.retail.v2.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic */ /** - * Constructs a new ProductInputConfig. + * Constructs a new ImportCompletionDataRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest * @constructor - * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportCompletionDataRequest=} [properties] Properties to set */ - function ProductInputConfig(properties) { + function ImportCompletionDataRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3948,115 +5142,101 @@ } /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2.ProductInputConfig - * @instance - */ - ProductInputConfig.prototype.productInlineSource = null; - - /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2.ProductInputConfig + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance */ - ProductInputConfig.prototype.gcsSource = null; + ImportCompletionDataRequest.prototype.parent = ""; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2.ProductInputConfig + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance */ - ProductInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ImportCompletionDataRequest.prototype.inputConfig = null; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2.ProductInputConfig + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new ImportCompletionDataRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + ImportCompletionDataRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + ImportCompletionDataRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportCompletionDataRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); + message.parent = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -4067,159 +5247,131 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies an ImportCompletionDataRequest message. * @function verify - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + ImportCompletionDataRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ProductInputConfig) + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportCompletionDataRequest) return object; - var message = new $root.google.cloud.retail.v2.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.fromObject(object.productInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); - } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.fromObject(object.inputConfig); } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.ProductInputConfig} message ProductInputConfig + * @param {google.cloud.retail.v2.ImportCompletionDataRequest} message ImportCompletionDataRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInputConfig.toObject = function toObject(message, options) { + ImportCompletionDataRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this ImportCompletionDataRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; + return ImportCompletionDataRequest; })(); - v2.UserEventInputConfig = (function() { + v2.ProductInputConfig = (function() { /** - * Properties of a UserEventInputConfig. + * Properties of a ProductInputConfig. * @memberof google.cloud.retail.v2 - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + * @interface IProductInputConfig + * @property {google.cloud.retail.v2.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource */ /** - * Constructs a new UserEventInputConfig. + * Constructs a new ProductInputConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig * @constructor - * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set */ - function UserEventInputConfig(properties) { + function ProductInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4227,69 +5379,69 @@ } /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2.UserEventInputConfig + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2.ProductInputConfig * @instance */ - UserEventInputConfig.prototype.userEventInlineSource = null; + ProductInputConfig.prototype.productInlineSource = null; /** - * UserEventInputConfig gcsSource. + * ProductInputConfig gcsSource. * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @instance */ - UserEventInputConfig.prototype.gcsSource = null; + ProductInputConfig.prototype.gcsSource = null; /** - * UserEventInputConfig bigQuerySource. + * ProductInputConfig bigQuerySource. * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @instance */ - UserEventInputConfig.prototype.bigQuerySource = null; + ProductInputConfig.prototype.bigQuerySource = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2.UserEventInputConfig + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.ProductInputConfig * @instance */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ProductInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @static - * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig instance + * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig instance */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); }; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @static - * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encode = function encode(message, writer) { + ProductInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) @@ -4298,38 +5450,38 @@ }; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @static - * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decode = function decode(reader, length) { + ProductInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); break; case 2: message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); @@ -4346,39 +5498,318 @@ }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInputConfig message. + * Verifies a ProductInputConfig message. * @function verify - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInputConfig.verify = function verify(message) { + ProductInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { properties.source = 1; { - var error = $root.google.cloud.retail.v2.UserEventInlineSource.verify(message.userEventInlineSource); + var error = $root.google.cloud.retail.v2.ProductInlineSource.verify(message.productInlineSource); if (error) - return "userEventInlineSource." + error; + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {google.cloud.retail.v2.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + * @returns {Object.} JSON object + */ + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2.UserEventInputConfig = (function() { + + /** + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2 + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + */ + + /** + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.userEventInlineSource = null; + + /** + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.gcsSource = null; + + /** + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig instance + */ + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; } } if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { @@ -4479,6 +5910,217 @@ return UserEventInputConfig; })(); + v2.CompletionDataInputConfig = (function() { + + /** + * Properties of a CompletionDataInputConfig. + * @memberof google.cloud.retail.v2 + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + */ + + /** + * Constructs a new CompletionDataInputConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig + * @constructor + * @param {google.cloud.retail.v2.ICompletionDataInputConfig=} [properties] Properties to set + */ + function CompletionDataInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @instance + */ + CompletionDataInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @instance + */ + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig instance + */ + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); + }; + + /** + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDataInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDataInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionDataInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionDataInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDataInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig + */ + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompletionDataInputConfig) + return object; + var message = new $root.google.cloud.retail.v2.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionDataInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this CompletionDataInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @instance + * @returns {Object.} JSON object + */ + CompletionDataInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDataInputConfig; + })(); + v2.ImportMetadata = (function() { /** @@ -4489,6 +6131,8 @@ * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime * @property {number|Long|null} [successCount] ImportMetadata successCount * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic */ /** @@ -4538,6 +6182,22 @@ */ ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.requestId = ""; + + /** + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.notificationPubsubTopic = ""; + /** * Creates a new ImportMetadata instance using the specified properties. * @function create @@ -4570,6 +6230,10 @@ writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); return writer; }; @@ -4616,6 +6280,12 @@ case 4: message.failureCount = reader.int64(); break; + case 5: + message.requestId = reader.string(); + break; + case 6: + message.notificationPubsubTopic = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -4667,6 +6337,12 @@ if (message.failureCount != null && message.hasOwnProperty("failureCount")) if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; @@ -4710,6 +6386,10 @@ message.failureCount = object.failureCount; else if (typeof object.failureCount === "object") message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; @@ -4739,6 +6419,8 @@ object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); @@ -4754,6 +6436,10 @@ object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; else object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; @@ -5509,27 +7195,253 @@ return UserEventImportSummary; })(); + v2.ImportCompletionDataResponse = (function() { + + /** + * Properties of an ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2 + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples + */ + + /** + * Constructs a new ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse + * @constructor + * @param {google.cloud.retail.v2.IImportCompletionDataResponse=} [properties] Properties to set + */ + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @instance + */ + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + + /** + * Creates a new ImportCompletionDataResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse instance + */ + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); + }; + + /** + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportCompletionDataResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportCompletionDataResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportCompletionDataResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + return null; + }; + + /** + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse + */ + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportCompletionDataResponse) + return object; + var message = new $root.google.cloud.retail.v2.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCompletionDataResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + return object; + }; + + /** + * Converts this ImportCompletionDataResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @instance + * @returns {Object.} JSON object + */ + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportCompletionDataResponse; + })(); + v2.Product = (function() { /** * Properties of a Product. * @memberof google.cloud.retail.v2 * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl * @property {string|null} [name] Product name * @property {string|null} [id] Product id * @property {google.cloud.retail.v2.Product.Type|null} [type] Product type * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin * @property {Array.|null} [categories] Product categories * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode * @property {Object.|null} [attributes] Product attributes * @property {Array.|null} [tags] Product tags * @property {google.cloud.retail.v2.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2.IRating|null} [rating] Product rating * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime * @property {google.cloud.retail.v2.Product.Availability|null} [availability] Product availability * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo * @property {string|null} [uri] Product uri * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants */ /** @@ -5541,16 +7453,41 @@ * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set */ function Product(properties) { + this.collectionMemberIds = []; this.categories = []; + this.brands = []; this.attributes = {}; this.tags = []; + this.fulfillmentInfo = []; this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } + /** + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.expireTime = null; + + /** + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.ttl = null; + /** * Product name. * @member {string} name @@ -5583,6 +7520,22 @@ */ Product.prototype.primaryProductId = ""; + /** + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.collectionMemberIds = $util.emptyArray; + + /** + * Product gtin. + * @member {string} gtin + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.gtin = ""; + /** * Product categories. * @member {Array.} categories @@ -5599,6 +7552,14 @@ */ Product.prototype.title = ""; + /** + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.brands = $util.emptyArray; + /** * Product description. * @member {string} description @@ -5607,6 +7568,14 @@ */ Product.prototype.description = ""; + /** + * Product languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.languageCode = ""; + /** * Product attributes. * @member {Object.} attributes @@ -5631,6 +7600,14 @@ */ Product.prototype.priceInfo = null; + /** + * Product rating. + * @member {google.cloud.retail.v2.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.rating = null; + /** * Product availableTime. * @member {google.protobuf.ITimestamp|null|undefined} availableTime @@ -5655,6 +7632,14 @@ */ Product.prototype.availableQuantity = null; + /** + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.fulfillmentInfo = $util.emptyArray; + /** * Product uri. * @member {string} uri @@ -5671,6 +7656,100 @@ */ Product.prototype.images = $util.emptyArray; + /** + * Product audience. + * @member {google.cloud.retail.v2.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.audience = null; + + /** + * Product colorInfo. + * @member {google.cloud.retail.v2.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.colorInfo = null; + + /** + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.sizes = $util.emptyArray; + + /** + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.materials = $util.emptyArray; + + /** + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.patterns = $util.emptyArray; + + /** + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.conditions = $util.emptyArray; + + /** + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.promotions = $util.emptyArray; + + /** + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.publishTime = null; + + /** + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.retrievableFields = null; + + /** + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.variants = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new Product instance using the specified properties. * @function create @@ -5703,13 +7782,23 @@ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); if (message.categories != null && message.categories.length) for (var i = 0; i < message.categories.length; ++i) writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); if (message.title != null && Object.hasOwnProperty.call(message, "title")) writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); if (message.description != null && Object.hasOwnProperty.call(message, "description")) writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); @@ -5720,17 +7809,52 @@ writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) $root.google.cloud.retail.v2.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) + $root.google.cloud.retail.v2.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); if (message.images != null && message.images.length) for (var i = 0; i < message.images.length; ++i) $root.google.cloud.retail.v2.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + $root.google.cloud.retail.v2.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) + $root.google.cloud.retail.v2.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.sizes != null && message.sizes.length) + for (var i = 0; i < message.sizes.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); + if (message.materials != null && message.materials.length) + for (var i = 0; i < message.materials.length; ++i) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); + if (message.patterns != null && message.patterns.length) + for (var i = 0; i < message.patterns.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); + if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) + $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.variants != null && message.variants.length) + for (var i = 0; i < message.variants.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.promotions != null && message.promotions.length) + for (var i = 0; i < message.promotions.length; ++i) + $root.google.cloud.retail.v2.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); return writer; }; @@ -5765,6 +7889,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 16: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; case 1: message.name = reader.string(); break; @@ -5777,6 +7907,14 @@ case 4: message.primaryProductId = reader.string(); break; + case 5: + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + case 6: + message.gtin = reader.string(); + break; case 7: if (!(message.categories && message.categories.length)) message.categories = []; @@ -5785,9 +7923,17 @@ case 8: message.title = reader.string(); break; + case 9: + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; case 10: message.description = reader.string(); break; + case 11: + message.languageCode = reader.string(); + break; case 12: if (message.attributes === $util.emptyObject) message.attributes = {}; @@ -5818,6 +7964,9 @@ case 14: message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); break; + case 15: + message.rating = $root.google.cloud.retail.v2.Rating.decode(reader, reader.uint32()); + break; case 18: message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; @@ -5827,6 +7976,11 @@ case 20: message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); break; + case 21: + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2.FulfillmentInfo.decode(reader, reader.uint32())); + break; case 22: message.uri = reader.string(); break; @@ -5835,6 +7989,48 @@ message.images = []; message.images.push($root.google.cloud.retail.v2.Image.decode(reader, reader.uint32())); break; + case 24: + message.audience = $root.google.cloud.retail.v2.Audience.decode(reader, reader.uint32()); + break; + case 25: + message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.decode(reader, reader.uint32()); + break; + case 26: + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + case 27: + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + case 28: + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + case 29: + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + case 34: + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2.Promotion.decode(reader, reader.uint32())); + break; + case 33: + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 30: + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 31: + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -5870,6 +8066,25 @@ Product.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.ttl); + if (error) + return "ttl." + error; + } + } if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -5889,6 +8104,16 @@ if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) if (!$util.isString(message.primaryProductId)) return "primaryProductId: string expected"; + if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { + if (!Array.isArray(message.collectionMemberIds)) + return "collectionMemberIds: array expected"; + for (var i = 0; i < message.collectionMemberIds.length; ++i) + if (!$util.isString(message.collectionMemberIds[i])) + return "collectionMemberIds: string[] expected"; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + if (!$util.isString(message.gtin)) + return "gtin: string expected"; if (message.categories != null && message.hasOwnProperty("categories")) { if (!Array.isArray(message.categories)) return "categories: array expected"; @@ -5899,9 +8124,19 @@ if (message.title != null && message.hasOwnProperty("title")) if (!$util.isString(message.title)) return "title: string expected"; + if (message.brands != null && message.hasOwnProperty("brands")) { + if (!Array.isArray(message.brands)) + return "brands: array expected"; + for (var i = 0; i < message.brands.length; ++i) + if (!$util.isString(message.brands[i])) + return "brands: string[] expected"; + } if (message.description != null && message.hasOwnProperty("description")) if (!$util.isString(message.description)) return "description: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; if (message.attributes != null && message.hasOwnProperty("attributes")) { if (!$util.isObject(message.attributes)) return "attributes: object expected"; @@ -5924,6 +8159,11 @@ if (error) return "priceInfo." + error; } + if (message.rating != null && message.hasOwnProperty("rating")) { + var error = $root.google.cloud.retail.v2.Rating.verify(message.rating); + if (error) + return "rating." + error; + } if (message.availableTime != null && message.hasOwnProperty("availableTime")) { var error = $root.google.protobuf.Timestamp.verify(message.availableTime); if (error) @@ -5945,6 +8185,15 @@ if (error) return "availableQuantity." + error; } + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + if (!Array.isArray(message.fulfillmentInfo)) + return "fulfillmentInfo: array expected"; + for (var i = 0; i < message.fulfillmentInfo.length; ++i) { + var error = $root.google.cloud.retail.v2.FulfillmentInfo.verify(message.fulfillmentInfo[i]); + if (error) + return "fulfillmentInfo." + error; + } + } if (message.uri != null && message.hasOwnProperty("uri")) if (!$util.isString(message.uri)) return "uri: string expected"; @@ -5957,6 +8206,72 @@ return "images." + error; } } + if (message.audience != null && message.hasOwnProperty("audience")) { + var error = $root.google.cloud.retail.v2.Audience.verify(message.audience); + if (error) + return "audience." + error; + } + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { + var error = $root.google.cloud.retail.v2.ColorInfo.verify(message.colorInfo); + if (error) + return "colorInfo." + error; + } + if (message.sizes != null && message.hasOwnProperty("sizes")) { + if (!Array.isArray(message.sizes)) + return "sizes: array expected"; + for (var i = 0; i < message.sizes.length; ++i) + if (!$util.isString(message.sizes[i])) + return "sizes: string[] expected"; + } + if (message.materials != null && message.hasOwnProperty("materials")) { + if (!Array.isArray(message.materials)) + return "materials: array expected"; + for (var i = 0; i < message.materials.length; ++i) + if (!$util.isString(message.materials[i])) + return "materials: string[] expected"; + } + if (message.patterns != null && message.hasOwnProperty("patterns")) { + if (!Array.isArray(message.patterns)) + return "patterns: array expected"; + for (var i = 0; i < message.patterns.length; ++i) + if (!$util.isString(message.patterns[i])) + return "patterns: string[] expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) + if (!$util.isString(message.conditions[i])) + return "conditions: string[] expected"; + } + if (message.promotions != null && message.hasOwnProperty("promotions")) { + if (!Array.isArray(message.promotions)) + return "promotions: array expected"; + for (var i = 0; i < message.promotions.length; ++i) { + var error = $root.google.cloud.retail.v2.Promotion.verify(message.promotions[i]); + if (error) + return "promotions." + error; + } + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.publishTime); + if (error) + return "publishTime." + error; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { + var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); + if (error) + return "retrievableFields." + error; + } + if (message.variants != null && message.hasOwnProperty("variants")) { + if (!Array.isArray(message.variants)) + return "variants: array expected"; + for (var i = 0; i < message.variants.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.variants[i]); + if (error) + return "variants." + error; + } + } return null; }; @@ -5972,6 +8287,16 @@ if (object instanceof $root.google.cloud.retail.v2.Product) return object; var message = new $root.google.cloud.retail.v2.Product(); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.retail.v2.Product.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + if (object.ttl != null) { + if (typeof object.ttl !== "object") + throw TypeError(".google.cloud.retail.v2.Product.ttl: object expected"); + message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); + } if (object.name != null) message.name = String(object.name); if (object.id != null) @@ -5996,6 +8321,15 @@ } if (object.primaryProductId != null) message.primaryProductId = String(object.primaryProductId); + if (object.collectionMemberIds) { + if (!Array.isArray(object.collectionMemberIds)) + throw TypeError(".google.cloud.retail.v2.Product.collectionMemberIds: array expected"); + message.collectionMemberIds = []; + for (var i = 0; i < object.collectionMemberIds.length; ++i) + message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); + } + if (object.gtin != null) + message.gtin = String(object.gtin); if (object.categories) { if (!Array.isArray(object.categories)) throw TypeError(".google.cloud.retail.v2.Product.categories: array expected"); @@ -6005,8 +8339,17 @@ } if (object.title != null) message.title = String(object.title); + if (object.brands) { + if (!Array.isArray(object.brands)) + throw TypeError(".google.cloud.retail.v2.Product.brands: array expected"); + message.brands = []; + for (var i = 0; i < object.brands.length; ++i) + message.brands[i] = String(object.brands[i]); + } if (object.description != null) message.description = String(object.description); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); if (object.attributes) { if (typeof object.attributes !== "object") throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); @@ -6029,6 +8372,11 @@ throw TypeError(".google.cloud.retail.v2.Product.priceInfo: object expected"); message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.fromObject(object.priceInfo); } + if (object.rating != null) { + if (typeof object.rating !== "object") + throw TypeError(".google.cloud.retail.v2.Product.rating: object expected"); + message.rating = $root.google.cloud.retail.v2.Rating.fromObject(object.rating); + } if (object.availableTime != null) { if (typeof object.availableTime !== "object") throw TypeError(".google.cloud.retail.v2.Product.availableTime: object expected"); @@ -6061,6 +8409,16 @@ throw TypeError(".google.cloud.retail.v2.Product.availableQuantity: object expected"); message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); } + if (object.fulfillmentInfo) { + if (!Array.isArray(object.fulfillmentInfo)) + throw TypeError(".google.cloud.retail.v2.Product.fulfillmentInfo: array expected"); + message.fulfillmentInfo = []; + for (var i = 0; i < object.fulfillmentInfo.length; ++i) { + if (typeof object.fulfillmentInfo[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.fulfillmentInfo: object expected"); + message.fulfillmentInfo[i] = $root.google.cloud.retail.v2.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); + } + } if (object.uri != null) message.uri = String(object.uri); if (object.images) { @@ -6073,6 +8431,74 @@ message.images[i] = $root.google.cloud.retail.v2.Image.fromObject(object.images[i]); } } + if (object.audience != null) { + if (typeof object.audience !== "object") + throw TypeError(".google.cloud.retail.v2.Product.audience: object expected"); + message.audience = $root.google.cloud.retail.v2.Audience.fromObject(object.audience); + } + if (object.colorInfo != null) { + if (typeof object.colorInfo !== "object") + throw TypeError(".google.cloud.retail.v2.Product.colorInfo: object expected"); + message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.fromObject(object.colorInfo); + } + if (object.sizes) { + if (!Array.isArray(object.sizes)) + throw TypeError(".google.cloud.retail.v2.Product.sizes: array expected"); + message.sizes = []; + for (var i = 0; i < object.sizes.length; ++i) + message.sizes[i] = String(object.sizes[i]); + } + if (object.materials) { + if (!Array.isArray(object.materials)) + throw TypeError(".google.cloud.retail.v2.Product.materials: array expected"); + message.materials = []; + for (var i = 0; i < object.materials.length; ++i) + message.materials[i] = String(object.materials[i]); + } + if (object.patterns) { + if (!Array.isArray(object.patterns)) + throw TypeError(".google.cloud.retail.v2.Product.patterns: array expected"); + message.patterns = []; + for (var i = 0; i < object.patterns.length; ++i) + message.patterns[i] = String(object.patterns[i]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.cloud.retail.v2.Product.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) + message.conditions[i] = String(object.conditions[i]); + } + if (object.promotions) { + if (!Array.isArray(object.promotions)) + throw TypeError(".google.cloud.retail.v2.Product.promotions: array expected"); + message.promotions = []; + for (var i = 0; i < object.promotions.length; ++i) { + if (typeof object.promotions[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.promotions: object expected"); + message.promotions[i] = $root.google.cloud.retail.v2.Promotion.fromObject(object.promotions[i]); + } + } + if (object.publishTime != null) { + if (typeof object.publishTime !== "object") + throw TypeError(".google.cloud.retail.v2.Product.publishTime: object expected"); + message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + } + if (object.retrievableFields != null) { + if (typeof object.retrievableFields !== "object") + throw TypeError(".google.cloud.retail.v2.Product.retrievableFields: object expected"); + message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + } + if (object.variants) { + if (!Array.isArray(object.variants)) + throw TypeError(".google.cloud.retail.v2.Product.variants: array expected"); + message.variants = []; + for (var i = 0; i < object.variants.length; ++i) { + if (typeof object.variants[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.variants: object expected"); + message.variants[i] = $root.google.cloud.retail.v2.Product.fromObject(object.variants[i]); + } + } return message; }; @@ -6090,9 +8516,18 @@ options = {}; var object = {}; if (options.arrays || options.defaults) { + object.collectionMemberIds = []; object.categories = []; + object.brands = []; object.tags = []; + object.fulfillmentInfo = []; object.images = []; + object.sizes = []; + object.materials = []; + object.patterns = []; + object.conditions = []; + object.variants = []; + object.promotions = []; } if (options.objects || options.defaults) object.attributes = {}; @@ -6101,13 +8536,20 @@ object.id = ""; object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; object.primaryProductId = ""; + object.gtin = ""; object.title = ""; object.description = ""; + object.languageCode = ""; object.priceInfo = null; + object.rating = null; object.availableTime = null; object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; object.availableQuantity = null; object.uri = ""; + object.audience = null; + object.colorInfo = null; + object.retrievableFields = null; + object.publishTime = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -6117,6 +8559,13 @@ object.type = options.enums === String ? $root.google.cloud.retail.v2.Product.Type[message.type] : message.type; if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) object.primaryProductId = message.primaryProductId; + if (message.collectionMemberIds && message.collectionMemberIds.length) { + object.collectionMemberIds = []; + for (var j = 0; j < message.collectionMemberIds.length; ++j) + object.collectionMemberIds[j] = message.collectionMemberIds[j]; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + object.gtin = message.gtin; if (message.categories && message.categories.length) { object.categories = []; for (var j = 0; j < message.categories.length; ++j) @@ -6124,8 +8573,15 @@ } if (message.title != null && message.hasOwnProperty("title")) object.title = message.title; + if (message.brands && message.brands.length) { + object.brands = []; + for (var j = 0; j < message.brands.length; ++j) + object.brands[j] = message.brands[j]; + } if (message.description != null && message.hasOwnProperty("description")) object.description = message.description; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; var keys2; if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { object.attributes = {}; @@ -6139,12 +8595,29 @@ } if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) object.priceInfo = $root.google.cloud.retail.v2.PriceInfo.toObject(message.priceInfo, options); + if (message.rating != null && message.hasOwnProperty("rating")) + object.rating = $root.google.cloud.retail.v2.Rating.toObject(message.rating, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (options.oneofs) + object.expiration = "expireTime"; + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (options.oneofs) + object.expiration = "ttl"; + } if (message.availableTime != null && message.hasOwnProperty("availableTime")) object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); if (message.availability != null && message.hasOwnProperty("availability")) object.availability = options.enums === String ? $root.google.cloud.retail.v2.Product.Availability[message.availability] : message.availability; if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.fulfillmentInfo && message.fulfillmentInfo.length) { + object.fulfillmentInfo = []; + for (var j = 0; j < message.fulfillmentInfo.length; ++j) + object.fulfillmentInfo[j] = $root.google.cloud.retail.v2.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + } if (message.uri != null && message.hasOwnProperty("uri")) object.uri = message.uri; if (message.images && message.images.length) { @@ -6152,6 +8625,44 @@ for (var j = 0; j < message.images.length; ++j) object.images[j] = $root.google.cloud.retail.v2.Image.toObject(message.images[j], options); } + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = $root.google.cloud.retail.v2.Audience.toObject(message.audience, options); + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) + object.colorInfo = $root.google.cloud.retail.v2.ColorInfo.toObject(message.colorInfo, options); + if (message.sizes && message.sizes.length) { + object.sizes = []; + for (var j = 0; j < message.sizes.length; ++j) + object.sizes[j] = message.sizes[j]; + } + if (message.materials && message.materials.length) { + object.materials = []; + for (var j = 0; j < message.materials.length; ++j) + object.materials[j] = message.materials[j]; + } + if (message.patterns && message.patterns.length) { + object.patterns = []; + for (var j = 0; j < message.patterns.length; ++j) + object.patterns[j] = message.patterns[j]; + } + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = message.conditions[j]; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) + object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); + if (message.variants && message.variants.length) { + object.variants = []; + for (var j = 0; j < message.variants.length; ++j) + object.variants[j] = $root.google.cloud.retail.v2.Product.toObject(message.variants[j], options); + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); + if (message.promotions && message.promotions.length) { + object.promotions = []; + for (var j = 0; j < message.promotions.length; ++j) + object.promotions[j] = $root.google.cloud.retail.v2.Promotion.toObject(message.promotions[j], options); + } return object; }; @@ -6215,14 +8726,19 @@ * @interface IUserEvent * @property {string|null} [eventType] UserEvent eventType * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime * @property {Array.|null} [experimentIds] UserEvent experimentIds * @property {string|null} [attributionToken] UserEvent attributionToken * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2.ICompletionDetail|null} [completionDetail] UserEvent completionDetail * @property {Object.|null} [attributes] UserEvent attributes * @property {string|null} [cartId] UserEvent cartId * @property {google.cloud.retail.v2.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {string|null} [filter] UserEvent filter + * @property {string|null} [orderBy] UserEvent orderBy + * @property {number|null} [offset] UserEvent offset * @property {Array.|null} [pageCategories] UserEvent pageCategories * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] UserEvent userInfo * @property {string|null} [uri] UserEvent uri @@ -6265,6 +8781,14 @@ */ UserEvent.prototype.visitorId = ""; + /** + * UserEvent sessionId. + * @member {string} sessionId + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.sessionId = ""; + /** * UserEvent eventTime. * @member {google.protobuf.ITimestamp|null|undefined} eventTime @@ -6297,6 +8821,14 @@ */ UserEvent.prototype.productDetails = $util.emptyArray; + /** + * UserEvent completionDetail. + * @member {google.cloud.retail.v2.ICompletionDetail|null|undefined} completionDetail + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.completionDetail = null; + /** * UserEvent attributes. * @member {Object.} attributes @@ -6329,6 +8861,30 @@ */ UserEvent.prototype.searchQuery = ""; + /** + * UserEvent filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.filter = ""; + + /** + * UserEvent orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.orderBy = ""; + + /** + * UserEvent offset. + * @member {number} offset + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.offset = 0; + /** * UserEvent pageCategories. * @member {Array.} pageCategories @@ -6429,6 +8985,16 @@ writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); + if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) + $root.google.cloud.retail.v2.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; @@ -6469,6 +9035,9 @@ case 2: message.visitorId = reader.string(); break; + case 21: + message.sessionId = reader.string(); + break; case 3: message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; @@ -6485,6 +9054,9 @@ message.productDetails = []; message.productDetails.push($root.google.cloud.retail.v2.ProductDetail.decode(reader, reader.uint32())); break; + case 22: + message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.decode(reader, reader.uint32()); + break; case 7: if (message.attributes === $util.emptyObject) message.attributes = {}; @@ -6516,6 +9088,15 @@ case 10: message.searchQuery = reader.string(); break; + case 16: + message.filter = reader.string(); + break; + case 17: + message.orderBy = reader.string(); + break; + case 18: + message.offset = reader.int32(); + break; case 11: if (!(message.pageCategories && message.pageCategories.length)) message.pageCategories = []; @@ -6574,6 +9155,9 @@ if (message.visitorId != null && message.hasOwnProperty("visitorId")) if (!$util.isString(message.visitorId)) return "visitorId: string expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isString(message.sessionId)) + return "sessionId: string expected"; if (message.eventTime != null && message.hasOwnProperty("eventTime")) { var error = $root.google.protobuf.Timestamp.verify(message.eventTime); if (error) @@ -6598,6 +9182,11 @@ return "productDetails." + error; } } + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { + var error = $root.google.cloud.retail.v2.CompletionDetail.verify(message.completionDetail); + if (error) + return "completionDetail." + error; + } if (message.attributes != null && message.hasOwnProperty("attributes")) { if (!$util.isObject(message.attributes)) return "attributes: object expected"; @@ -6619,6 +9208,15 @@ if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) if (!$util.isString(message.searchQuery)) return "searchQuery: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { if (!Array.isArray(message.pageCategories)) return "pageCategories: array expected"; @@ -6659,6 +9257,8 @@ message.eventType = String(object.eventType); if (object.visitorId != null) message.visitorId = String(object.visitorId); + if (object.sessionId != null) + message.sessionId = String(object.sessionId); if (object.eventTime != null) { if (typeof object.eventTime !== "object") throw TypeError(".google.cloud.retail.v2.UserEvent.eventTime: object expected"); @@ -6683,6 +9283,11 @@ message.productDetails[i] = $root.google.cloud.retail.v2.ProductDetail.fromObject(object.productDetails[i]); } } + if (object.completionDetail != null) { + if (typeof object.completionDetail !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.completionDetail: object expected"); + message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.fromObject(object.completionDetail); + } if (object.attributes) { if (typeof object.attributes !== "object") throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); @@ -6702,6 +9307,12 @@ } if (object.searchQuery != null) message.searchQuery = String(object.searchQuery); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.offset != null) + message.offset = object.offset | 0; if (object.pageCategories) { if (!Array.isArray(object.pageCategories)) throw TypeError(".google.cloud.retail.v2.UserEvent.pageCategories: array expected"); @@ -6755,6 +9366,11 @@ object.uri = ""; object.referrerUri = ""; object.pageViewId = ""; + object.filter = ""; + object.orderBy = ""; + object.offset = 0; + object.sessionId = ""; + object.completionDetail = null; } if (message.eventType != null && message.hasOwnProperty("eventType")) object.eventType = message.eventType; @@ -6799,6 +9415,16 @@ object.referrerUri = message.referrerUri; if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) object.pageViewId = message.pageViewId; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) + object.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.toObject(message.completionDetail, options); return object; }; @@ -7036,6 +9662,238 @@ return ProductDetail; })(); + v2.CompletionDetail = (function() { + + /** + * Properties of a CompletionDetail. + * @memberof google.cloud.retail.v2 + * @interface ICompletionDetail + * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken + * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion + * @property {number|null} [selectedPosition] CompletionDetail selectedPosition + */ + + /** + * Constructs a new CompletionDetail. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CompletionDetail. + * @implements ICompletionDetail + * @constructor + * @param {google.cloud.retail.v2.ICompletionDetail=} [properties] Properties to set + */ + function CompletionDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionDetail completionAttributionToken. + * @member {string} completionAttributionToken + * @memberof google.cloud.retail.v2.CompletionDetail + * @instance + */ + CompletionDetail.prototype.completionAttributionToken = ""; + + /** + * CompletionDetail selectedSuggestion. + * @member {string} selectedSuggestion + * @memberof google.cloud.retail.v2.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedSuggestion = ""; + + /** + * CompletionDetail selectedPosition. + * @member {number} selectedPosition + * @memberof google.cloud.retail.v2.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedPosition = 0; + + /** + * Creates a new CompletionDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {google.cloud.retail.v2.ICompletionDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail instance + */ + CompletionDetail.create = function create(properties) { + return new CompletionDetail(properties); + }; + + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {google.cloud.retail.v2.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); + if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); + if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); + return writer; + }; + + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {google.cloud.retail.v2.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionAttributionToken = reader.string(); + break; + case 2: + message.selectedSuggestion = reader.string(); + break; + case 3: + message.selectedPosition = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionDetail message. + * @function verify + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + if (!$util.isString(message.completionAttributionToken)) + return "completionAttributionToken: string expected"; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + if (!$util.isString(message.selectedSuggestion)) + return "selectedSuggestion: string expected"; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + if (!$util.isInteger(message.selectedPosition)) + return "selectedPosition: integer expected"; + return null; + }; + + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail + */ + CompletionDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompletionDetail) + return object; + var message = new $root.google.cloud.retail.v2.CompletionDetail(); + if (object.completionAttributionToken != null) + message.completionAttributionToken = String(object.completionAttributionToken); + if (object.selectedSuggestion != null) + message.selectedSuggestion = String(object.selectedSuggestion); + if (object.selectedPosition != null) + message.selectedPosition = object.selectedPosition | 0; + return message; + }; + + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {google.cloud.retail.v2.CompletionDetail} message CompletionDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.completionAttributionToken = ""; + object.selectedSuggestion = ""; + object.selectedPosition = 0; + } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + object.completionAttributionToken = message.completionAttributionToken; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + object.selectedSuggestion = message.selectedSuggestion; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + object.selectedPosition = message.selectedPosition; + return object; + }; + + /** + * Converts this CompletionDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompletionDetail + * @instance + * @returns {Object.} JSON object + */ + CompletionDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDetail; + })(); + v2.PurchaseTransaction = (function() { /** @@ -7312,311 +10170,296 @@ return PurchaseTransaction; })(); - v2.PredictionService = (function() { + v2.CatalogService = (function() { /** - * Constructs a new PredictionService service. + * Constructs a new CatalogService service. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PredictionService + * @classdesc Represents a CatalogService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; /** - * Creates new PredictionService service using the specified rpc implementation. + * Creates new CatalogService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2.PredictionService + * @memberof google.cloud.retail.v2.CatalogService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. - * @memberof google.cloud.retail.v2.PredictionService - * @typedef PredictCallback + * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef ListCatalogsCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.PredictResponse} [response] PredictResponse + * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse */ /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2.PredictionService + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService * @instance - * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2.PredictRequest, $root.google.cloud.retail.v2.PredictResponse, request, callback); - }, "name", { value: "Predict" }); + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2.PredictionService + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService * @instance - * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return PredictionService; - })(); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Catalog} [response] Catalog + */ - v2.PredictRequest = (function() { + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); /** - * Properties of a PredictRequest. - * @memberof google.cloud.retail.v2 - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ /** - * Constructs a new PredictRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest - * @constructor - * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2.PredictRequest + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.placement = ""; + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2.PredictRequest + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.userEvent = null; /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.PredictRequest - * @instance + * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.GetDefaultBranchResponse} [response] GetDefaultBranchResponse */ - PredictRequest.prototype.pageSize = 0; /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.PredictRequest + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.pageToken = ""; + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2.GetDefaultBranchRequest, $root.google.cloud.retail.v2.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.PredictRequest + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.filter = ""; + + return CatalogService; + })(); + + v2.ListCatalogsRequest = (function() { /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2.PredictRequest + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance */ - PredictRequest.prototype.validateOnly = false; + ListCatalogsRequest.prototype.parent = ""; /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2.PredictRequest + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance */ - PredictRequest.prototype.params = $util.emptyObject; + ListCatalogsRequest.prototype.pageSize = 0; /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2.PredictRequest + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance */ - PredictRequest.prototype.labels = $util.emptyObject; + ListCatalogsRequest.prototype.pageToken = ""; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new ListCatalogsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + ListCatalogsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + ListCatalogsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); + message.parent = reader.string(); break; case 2: - message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); - break; - case 3: message.pageSize = reader.int32(); break; - case 4: + case 3: message.pageToken = reader.string(); break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -7626,208 +10469,126 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies a ListCatalogsRequest message. * @function verify - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + ListCatalogsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; if (message.pageSize != null && message.hasOwnProperty("pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; if (message.pageToken != null && message.hasOwnProperty("pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; - } return null; }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PredictRequest) + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) return object; - var message = new $root.google.cloud.retail.v2.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); - } + var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); if (object.pageSize != null) message.pageSize = object.pageSize | 0; if (object.pageToken != null) message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); - } return message; }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.PredictRequest} message PredictRequest + * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictRequest.toObject = function toObject(message, options) { + ListCatalogsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } if (options.defaults) { - object.placement = ""; - object.userEvent = null; + object.parent = ""; object.pageSize = 0; object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; if (message.pageSize != null && message.hasOwnProperty("pageSize")) object.pageSize = message.pageSize; if (message.pageToken != null && message.hasOwnProperty("pageToken")) object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); - } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; - } return object; }; /** - * Converts this PredictRequest to JSON. + * Converts this ListCatalogsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance * @returns {Object.} JSON object */ - PredictRequest.prototype.toJSON = function toJSON() { + ListCatalogsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PredictRequest; + return ListCatalogsRequest; })(); - v2.PredictResponse = (function() { + v2.ListCatalogsResponse = (function() { /** - * Properties of a PredictResponse. + * Properties of a ListCatalogsResponse. * @memberof google.cloud.retail.v2 - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken */ /** - * Constructs a new PredictResponse. + * Constructs a new ListCatalogsResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse * @constructor - * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function ListCatalogsResponse(properties) { + this.catalogs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7835,120 +10596,91 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2.PredictResponse - * @instance - */ - PredictResponse.prototype.results = $util.emptyArray; - - /** - * PredictResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.PredictResponse - * @instance - */ - PredictResponse.prototype.attributionToken = ""; - - /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2.PredictResponse + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance */ - PredictResponse.prototype.missingIds = $util.emptyArray; + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2.PredictResponse + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance */ - PredictResponse.prototype.validateOnly = false; + ListCatalogsResponse.prototype.nextPageToken = ""; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + ListCatalogsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + ListCatalogsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); break; case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -7959,719 +10691,223 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies a ListCatalogsResponse message. * @function verify - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + ListCatalogsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.verify(message.results[i]); + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); if (error) - return "results." + error; + return "catalogs." + error; } } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; - } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PredictResponse) + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) return object; - var message = new $root.google.cloud.retail.v2.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.fromObject(object.results[i]); + var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); } } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); - } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + ListCatalogsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; - } - if (options.defaults) { - object.attributionToken = ""; - object.validateOnly = false; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.toObject(message.results[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this ListCatalogsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + ListCatalogsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PredictResponse.PredictionResult = (function() { - - /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata - */ + return ListCatalogsResponse; + })(); - /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2.UpdateCatalogRequest = (function() { - /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.id = ""; + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ - /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.metadata = $util.emptyObject; + /** + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest + * @constructor + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + */ + function UpdateCatalogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new PredictionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult instance - */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); - }; + /** + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.catalog = null; - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.updateMask = null; - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PredictionResult message. - * @function verify - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PredictionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); - if (error) - return "metadata." + error; - } - } - return null; - }; - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult - */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PredictResponse.PredictionResult) - return object; - var message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.PredictionResult} message PredictionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PredictionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.metadata = {}; - if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); - } - return object; - }; - - /** - * Converts this PredictionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @instance - * @returns {Object.} JSON object - */ - PredictionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PredictionResult; - })(); - - return PredictResponse; - })(); - - v2.ProductService = (function() { - - /** - * Constructs a new ProductService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; - - /** - * Creates new ProductService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.ProductService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. - */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2.CreateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); - }, "name", { value: "CreateProduct" }); - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Product} [response] Product - */ - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2.GetProductRequest, $root.google.cloud.retail.v2.Product, request, callback); - }, "name", { value: "GetProduct" }); - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Product} [response] Product - */ - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2.UpdateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductService; - })(); - - v2.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.retail.v2 - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ - - /** - * Constructs a new CreateProductRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest - * @constructor - * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set - */ - function CreateProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.product = null; - - /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.productId = ""; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CreateProductRequest - * @static - * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest instance - */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); - }; + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance + */ + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encode = function encode(message, writer) { + UpdateCatalogRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decode = function decode(reader, length) { + UpdateCatalogRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); break; case 2: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 3: - message.productId = reader.string(); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -8682,129 +10918,128 @@ }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProductRequest message. + * Verifies an UpdateCatalogRequest message. * @function verify - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProductRequest.verify = function verify(message) { + UpdateCatalogRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); if (error) - return "product." + error; + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; return null; }; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CreateProductRequest) + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) return object; - var message = new $root.google.cloud.retail.v2.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } - if (object.productId != null) - message.productId = String(object.productId); return message; }; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.CreateProductRequest} message CreateProductRequest + * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProductRequest.toObject = function toObject(message, options) { + UpdateCatalogRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; + object.catalog = null; + object.updateMask = null; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this CreateProductRequest to JSON. + * Converts this UpdateCatalogRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { + UpdateCatalogRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateProductRequest; + return UpdateCatalogRequest; })(); - v2.GetProductRequest = (function() { + v2.SetDefaultBranchRequest = (function() { /** - * Properties of a GetProductRequest. + * Properties of a SetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note */ /** - * Constructs a new GetProductRequest. + * Constructs a new SetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set */ - function GetProductRequest(properties) { + function SetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -8812,75 +11047,101 @@ } /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2.GetProductRequest + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance */ - GetProductRequest.prototype.name = ""; + SetDefaultBranchRequest.prototype.catalog = ""; /** - * Creates a new GetProductRequest instance using the specified properties. + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.branchId = ""; + + /** + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.note = ""; + + /** + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest instance */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encode = function encode(message, writer) { + SetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + SetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.catalog = reader.string(); + break; + case 2: + message.branchId = reader.string(); + break; + case 3: + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -8891,108 +11152,124 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a SetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + SetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GetProductRequest) + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.GetProductRequest} message GetProductRequest + * @param {google.cloud.retail.v2.SetDefaultBranchRequest} message SetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProductRequest.toObject = function toObject(message, options) { + SetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.catalog = ""; + object.branchId = ""; + object.note = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this GetProductRequest to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - GetProductRequest.prototype.toJSON = function toJSON() { + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProductRequest; + return SetDefaultBranchRequest; })(); - v2.UpdateProductRequest = (function() { + v2.GetDefaultBranchRequest = (function() { /** - * Properties of an UpdateProductRequest. + * Properties of a GetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog */ /** - * Constructs a new UpdateProductRequest. + * Constructs a new GetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set */ - function UpdateProductRequest(properties) { + function GetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9000,88 +11277,75 @@ } /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.UpdateProductRequest + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @instance */ - UpdateProductRequest.prototype.updateMask = null; + GetDefaultBranchRequest.prototype.catalog = ""; /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest instance */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); }; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encode = function encode(message, writer) { + GetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); return writer; }; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decode = function decode(reader, length) { + GetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.catalog = reader.string(); break; default: reader.skipType(tag & 7); @@ -9092,126 +11356,109 @@ }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateProductRequest message. + * Verifies a GetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateProductRequest.verify = function verify(message) { + GetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; return null; }; /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UpdateProductRequest) + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } + var message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); return message; }; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.UpdateProductRequest} message UpdateProductRequest + * @param {google.cloud.retail.v2.GetDefaultBranchRequest} message GetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateProductRequest.toObject = function toObject(message, options) { + GetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; return object; }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - UpdateProductRequest.prototype.toJSON = function toJSON() { + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateProductRequest; + return GetDefaultBranchRequest; })(); - v2.DeleteProductRequest = (function() { + v2.GetDefaultBranchResponse = (function() { /** - * Properties of a DeleteProductRequest. + * Properties of a GetDefaultBranchResponse. * @memberof google.cloud.retail.v2 - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note */ /** - * Constructs a new DeleteProductRequest. + * Constructs a new GetDefaultBranchResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse * @constructor - * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set */ - function DeleteProductRequest(properties) { + function GetDefaultBranchResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9219,75 +11466,101 @@ } /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2.DeleteProductRequest + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance */ - DeleteProductRequest.prototype.name = ""; + GetDefaultBranchResponse.prototype.branch = ""; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.setTime = null; + + /** + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.note = ""; + + /** + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest instance + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse instance */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); }; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encode = function encode(message, writer) { + GetDefaultBranchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decode = function decode(reader, length) { + GetDefaultBranchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.branch = reader.string(); + break; + case 2: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -9298,106 +11571,237 @@ }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProductRequest message. + * Verifies a GetDefaultBranchResponse message. * @function verify - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProductRequest.verify = function verify(message) { + GetDefaultBranchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.DeleteProductRequest) + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchResponse) return object; - var message = new $root.google.cloud.retail.v2.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.DeleteProductRequest} message DeleteProductRequest + * @param {google.cloud.retail.v2.GetDefaultBranchResponse} message GetDefaultBranchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProductRequest.toObject = function toObject(message, options) { + GetDefaultBranchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.branch = ""; + object.setTime = null; + object.note = ""; + } + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance * @returns {Object.} JSON object */ - DeleteProductRequest.prototype.toJSON = function toJSON() { + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteProductRequest; + return GetDefaultBranchResponse; })(); - v2.PurgeMetadata = (function() { + v2.CompletionService = (function() { /** - * Properties of a PurgeMetadata. + * Constructs a new CompletionService service. * @memberof google.cloud.retail.v2 - * @interface IPurgeMetadata + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + + /** + * Creates new CompletionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.CompletionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. */ + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * Constructs a new PurgeMetadata. + * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.CompleteQueryResponse} [response] CompleteQueryResponse + */ + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2.CompleteQueryRequest, $root.google.cloud.retail.v2.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; + })(); + + v2.CompleteQueryRequest = (function() { + + /** + * Properties of a CompleteQueryRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + */ + + /** + * Constructs a new CompleteQueryRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest * @constructor - * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function CompleteQueryRequest(properties) { + this.languageCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9405,63 +11809,157 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.catalog = ""; + + /** + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.query = ""; + + /** + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.visitorId = ""; + + /** + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + + /** + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.deviceType = ""; + + /** + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.dataset = ""; + + /** + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.maxSuggestions = 0; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest instance */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); }; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encode = function encode(message, writer) { + CompleteQueryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); return writer; }; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decode = function decode(reader, length) { + CompleteQueryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + case 2: + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); + break; + case 3: + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + case 4: + message.deviceType = reader.string(); + break; + case 6: + message.dataset = reader.string(); + break; + case 5: + message.maxSuggestions = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -9471,96 +11969,173 @@ }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeMetadata message. + * Verifies a CompleteQueryRequest message. * @function verify - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeMetadata.verify = function verify(message) { + CompleteQueryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; return null; }; /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryRequest) return object; - return new $root.google.cloud.retail.v2.PurgeMetadata(); + var message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; + return message; }; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata + * @param {google.cloud.retail.v2.CompleteQueryRequest} message CompleteQueryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeMetadata.toObject = function toObject() { - return {}; + CompleteQueryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (options.defaults) { + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + return object; }; /** - * Converts this PurgeMetadata to JSON. + * Converts this CompleteQueryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance * @returns {Object.} JSON object */ - PurgeMetadata.prototype.toJSON = function toJSON() { + CompleteQueryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeMetadata; + return CompleteQueryRequest; })(); - v2.PurgeUserEventsRequest = (function() { + v2.CompleteQueryResponse = (function() { /** - * Properties of a PurgeUserEventsRequest. + * Properties of a CompleteQueryResponse. * @memberof google.cloud.retail.v2 - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults */ /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new CompleteQueryResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse * @constructor - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set */ - function PurgeUserEventsRequest(properties) { + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9568,101 +12143,107 @@ } /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance */ - PurgeUserEventsRequest.prototype.parent = ""; + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance */ - PurgeUserEventsRequest.prototype.filter = ""; + CompleteQueryResponse.prototype.attributionToken = ""; /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance */ - PurgeUserEventsRequest.prototype.force = false; + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + CompleteQueryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + CompleteQueryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); break; case 2: - message.filter = reader.string(); + message.attributionToken = reader.string(); break; case 3: - message.force = reader.bool(); + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -9673,124 +12254,675 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a CompleteQueryResponse message. * @function verify - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + CompleteQueryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } + } return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse) return object; - var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } + } return message; }; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {google.cloud.retail.v2.CompleteQueryResponse} message CompleteQueryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { + CompleteQueryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; return object; }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this CompleteQueryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + CompleteQueryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + CompleteQueryResponse.CompletionResult = (function() { + + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ + + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; + + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.suggestion = reader.string(); + break; + case 2: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionResult; + })(); + + CompleteQueryResponse.RecentSearchResult = (function() { + + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ + + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; })(); - v2.PurgeUserEventsResponse = (function() { + v2.PredictionService = (function() { /** - * Properties of a PurgeUserEventsResponse. + * Constructs a new PredictionService service. * @memberof google.cloud.retail.v2 - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. + * @memberof google.cloud.retail.v2.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.PredictResponse} [response] PredictResponse */ /** - * Constructs a new PurgeUserEventsResponse. + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2.PredictionService + * @instance + * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2.PredictRequest, $root.google.cloud.retail.v2.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2.PredictionService + * @instance + * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest * @constructor - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9798,75 +12930,208 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2.PredictRequest * @instance */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + PredictRequest.prototype.placement = ""; /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * PredictRequest userEvent. + * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2.PredictRequest + * @instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); - }; + PredictRequest.prototype.userEvent = null; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.PredictRequest + * @instance */ - PurgeUserEventsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); - return writer; - }; + PredictRequest.prototype.pageSize = 0; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.PredictRequest + * @instance */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + PredictRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.purgedEventsCount = reader.int64(); + message.placement = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; break; default: reader.skipType(tag & 7); @@ -9877,411 +13142,329 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + PredictRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a PredictRequest message. * @function verify - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.PredictRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsResponse.verify = function verify(message) { + PredictRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } return null; }; /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.PredictRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictRequest) return object; - var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } return message; }; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.PredictRequest * @static - * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {google.cloud.retail.v2.PredictRequest} message PredictRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { + PredictRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } return object; }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this PredictRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.PredictRequest * @instance * @returns {Object.} JSON object */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + PredictRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsResponse; + return PredictRequest; })(); - v2.UserEventService = (function() { + v2.PredictResponse = (function() { /** - * Constructs a new UserEventService service. + * Properties of a PredictResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function UserEventService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; - - /** - * Creates new UserEventService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.UserEventService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly */ - UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef WriteUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.UserEvent} [response] UserEvent + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2.UserEventService + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2.PredictResponse * @instance - * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { - return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2.WriteUserEventRequest, $root.google.cloud.retail.v2.UserEvent, request, callback); - }, "name", { value: "WriteUserEvent" }); + PredictResponse.prototype.results = $util.emptyArray; /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2.UserEventService + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.PredictResponse * @instance - * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + PredictResponse.prototype.attributionToken = ""; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef CollectUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.api.HttpBody} [response] HttpBody + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2.PredictResponse + * @instance */ + PredictResponse.prototype.missingIds = $util.emptyArray; /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2.UserEventService + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2.PredictResponse * @instance - * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { - return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); - }, "name", { value: "CollectUserEvent" }); + PredictResponse.prototype.validateOnly = false; /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse instance */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef PurgeUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { - return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "PurgeUserEvents" }); + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef ImportUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { - return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportUserEvents" }); - - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef RejoinUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { - return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RejoinUserEvents" }); - - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return UserEventService; - })(); - - v2.WriteUserEventRequest = (function() { - - /** - * Properties of a WriteUserEventRequest. - * @memberof google.cloud.retail.v2 - * @interface IWriteUserEventRequest - * @property {string|null} [parent] WriteUserEventRequest parent - * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent - */ - - /** - * Constructs a new WriteUserEventRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a WriteUserEventRequest. - * @implements IWriteUserEventRequest - * @constructor - * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set - */ - function WriteUserEventRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * WriteUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.parent = ""; - - /** - * WriteUserEventRequest userEvent. - * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.userEvent = null; - - /** - * Creates a new WriteUserEventRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest instance - */ - WriteUserEventRequest.create = function create(properties) { - return new WriteUserEventRequest(properties); - }; - - /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteUserEventRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @memberof google.cloud.retail.v2.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WriteUserEventRequest.decode = function decode(reader, length) { + PredictResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); break; case 2: - message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); break; default: reader.skipType(tag & 7); @@ -10292,633 +13475,749 @@ }; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @memberof google.cloud.retail.v2.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + PredictResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WriteUserEventRequest message. + * Verifies a PredictResponse message. * @function verify - * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @memberof google.cloud.retail.v2.PredictResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WriteUserEventRequest.verify = function verify(message) { + PredictResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; return null; }; /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @memberof google.cloud.retail.v2.PredictResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse */ - WriteUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.WriteUserEventRequest) + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictResponse) return object; - var message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2.WriteUserEventRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); + var message = new $root.google.cloud.retail.v2.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @memberof google.cloud.retail.v2.PredictResponse * @static - * @param {google.cloud.retail.v2.WriteUserEventRequest} message WriteUserEventRequest + * @param {google.cloud.retail.v2.PredictResponse} message PredictResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WriteUserEventRequest.toObject = function toObject(message, options) { + PredictResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } if (options.defaults) { - object.parent = ""; - object.userEvent = null; + object.attributionToken = ""; + object.validateOnly = false; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; return object; }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this PredictResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @memberof google.cloud.retail.v2.PredictResponse * @instance * @returns {Object.} JSON object */ - WriteUserEventRequest.prototype.toJSON = function toJSON() { + PredictResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WriteUserEventRequest; - })(); + PredictResponse.PredictionResult = (function() { - v2.CollectUserEventRequest = (function() { + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ - /** - * Properties of a CollectUserEventRequest. - * @memberof google.cloud.retail.v2 - * @interface ICollectUserEventRequest - * @property {string|null} [parent] CollectUserEventRequest parent - * @property {string|null} [userEvent] CollectUserEventRequest userEvent - * @property {string|null} [uri] CollectUserEventRequest uri - * @property {number|Long|null} [ets] CollectUserEventRequest ets - */ + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new CollectUserEventRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CollectUserEventRequest. - * @implements ICollectUserEventRequest - * @constructor - * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set - */ - function CollectUserEventRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; - /** - * CollectUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @instance - */ - CollectUserEventRequest.prototype.parent = ""; + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; - /** - * CollectUserEventRequest userEvent. - * @member {string} userEvent - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @instance - */ - CollectUserEventRequest.prototype.userEvent = ""; + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; - /** - * CollectUserEventRequest uri. - * @member {string} uri - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @instance - */ - CollectUserEventRequest.prototype.uri = ""; + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; - /** - * CollectUserEventRequest ets. - * @member {number|Long} ets - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @instance - */ - CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new CollectUserEventRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest instance - */ - CollectUserEventRequest.create = function create(properties) { - return new CollectUserEventRequest(properties); - }; + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CollectUserEventRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); - if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); - return writer; - }; + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2.ProductService = (function() { /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.ProductService * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. */ - CollectUserEventRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product */ - CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; /** - * Verifies a CollectUserEventRequest message. - * @function verify - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - CollectUserEventRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - if (!$util.isString(message.userEvent)) - return "userEvent: string expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.ets != null && message.hasOwnProperty("ets")) - if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) - return "ets: integer|Long expected"; - return null; - }; + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2.CreateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "CreateProduct" }); /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - CollectUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CollectUserEventRequest) - return object; - var message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) - message.userEvent = String(object.userEvent); - if (object.uri != null) - message.uri = String(object.uri); - if (object.ets != null) - if ($util.Long) - (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; - else if (typeof object.ets === "string") - message.ets = parseInt(object.ets, 10); - else if (typeof object.ets === "number") - message.ets = object.ets; - else if (typeof object.ets === "object") - message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); - return message; - }; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.CollectUserEventRequest} message CollectUserEventRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product */ - CollectUserEventRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = ""; - object.uri = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.ets = options.longs === String ? "0" : 0; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = message.userEvent; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.ets != null && message.hasOwnProperty("ets")) - if (typeof message.ets === "number") - object.ets = options.longs === String ? String(message.ets) : message.ets; - else - object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; - return object; - }; /** - * Converts this CollectUserEventRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2.ProductService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - CollectUserEventRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CollectUserEventRequest; - })(); - - v2.RejoinUserEventsRequest = (function() { + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2.GetProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "GetProduct" }); /** - * Properties of a RejoinUserEventsRequest. - * @memberof google.cloud.retail.v2 - * @interface IRejoinUserEventsRequest - * @property {string|null} [parent] RejoinUserEventsRequest parent - * @property {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ /** - * Constructs a new RejoinUserEventsRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a RejoinUserEventsRequest. - * @implements IRejoinUserEventsRequest - * @constructor - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2.ProductService#listProducts}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ListProductsResponse} [response] ListProductsResponse */ - function RejoinUserEventsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * RejoinUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2.ProductService * @instance + * @param {google.cloud.retail.v2.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 */ - RejoinUserEventsRequest.prototype.parent = ""; + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2.ListProductsRequest, $root.google.cloud.retail.v2.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); /** - * RejoinUserEventsRequest userEventRejoinScope. - * @member {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2.ProductService * @instance + * @param {google.cloud.retail.v2.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest instance + * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product */ - RejoinUserEventsRequest.create = function create(properties) { - return new RejoinUserEventsRequest(properties); - }; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - RejoinUserEventsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); - return writer; - }; + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2.UpdateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "UpdateProduct" }); /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty */ - RejoinUserEventsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEventRejoinScope = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 */ - RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); /** - * Verifies a RejoinUserEventsRequest message. - * @function verify - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - RejoinUserEventsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - switch (message.userEventRejoinScope) { - default: - return "userEventRejoinScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - RejoinUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsRequest) - return object; - var message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - switch (object.userEventRejoinScope) { - case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": - case 0: - message.userEventRejoinScope = 0; - break; - case "JOINED_EVENTS": - case 1: - message.userEventRejoinScope = 1; - break; - case "UNJOINED_EVENTS": - case 2: - message.userEventRejoinScope = 2; - break; - } - return message; - }; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @static - * @param {google.cloud.retail.v2.RejoinUserEventsRequest} message RejoinUserEventsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - RejoinUserEventsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; - return object; - }; + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); /** - * Converts this RejoinUserEventsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2.ProductService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - RejoinUserEventsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; /** - * UserEventRejoinScope enum. - * @name google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope - * @enum {number} - * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value - * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value - * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + * Callback as used by {@link google.cloud.retail.v2.ProductService#setInventory}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - RejoinUserEventsRequest.UserEventRejoinScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "JOINED_EVENTS"] = 1; - values[valuesById[2] = "UNJOINED_EVENTS"] = 2; - return values; - })(); - return RejoinUserEventsRequest; + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; })(); - v2.RejoinUserEventsResponse = (function() { + v2.CreateProductRequest = (function() { /** - * Properties of a RejoinUserEventsResponse. + * Properties of a CreateProductRequest. * @memberof google.cloud.retail.v2 - * @interface IRejoinUserEventsResponse - * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId */ /** - * Constructs a new RejoinUserEventsResponse. + * Constructs a new CreateProductRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RejoinUserEventsResponse. - * @implements IRejoinUserEventsResponse + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest * @constructor - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set */ - function RejoinUserEventsResponse(properties) { + function CreateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10926,75 +14225,101 @@ } /** - * RejoinUserEventsResponse rejoinedUserEventsCount. - * @member {number|Long} rejoinedUserEventsCount - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CreateProductRequest * @instance */ - RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + CreateProductRequest.prototype.parent = ""; /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. + * CreateProductRequest product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse instance + * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest instance */ - RejoinUserEventsResponse.create = function create(properties) { - return new RejoinUserEventsResponse(properties); + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); }; /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsResponse.encode = function encode(message, writer) { + CreateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); return writer; }; /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsResponse.decode = function decode(reader, length) { + CreateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.rejoinedUserEventsCount = reader.int64(); + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); break; default: reader.skipType(tag & 7); @@ -11005,120 +14330,129 @@ }; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsResponse message. + * Verifies a CreateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsResponse.verify = function verify(message) { + CreateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) - return "rejoinedUserEventsCount: integer|Long expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; return null; }; /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest */ - RejoinUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsResponse) + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CreateProductRequest) return object; - var message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); - if (object.rejoinedUserEventsCount != null) - if ($util.Long) - (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; - else if (typeof object.rejoinedUserEventsCount === "string") - message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); - else if (typeof object.rejoinedUserEventsCount === "number") - message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; - else if (typeof object.rejoinedUserEventsCount === "object") - message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); return message; }; /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @static - * @param {google.cloud.retail.v2.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {google.cloud.retail.v2.CreateProductRequest} message CreateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsResponse.toObject = function toObject(message, options) { + CreateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (typeof message.rejoinedUserEventsCount === "number") - object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; - else - object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; return object; }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this CreateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.CreateProductRequest * @instance * @returns {Object.} JSON object */ - RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + CreateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RejoinUserEventsResponse; + return CreateProductRequest; })(); - v2.RejoinUserEventsMetadata = (function() { + v2.GetProductRequest = (function() { /** - * Properties of a RejoinUserEventsMetadata. + * Properties of a GetProductRequest. * @memberof google.cloud.retail.v2 - * @interface IRejoinUserEventsMetadata + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name */ /** - * Constructs a new RejoinUserEventsMetadata. + * Constructs a new GetProductRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RejoinUserEventsMetadata. - * @implements IRejoinUserEventsMetadata + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest * @constructor - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set */ - function RejoinUserEventsMetadata(properties) { + function GetProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11126,63 +14460,76 @@ } /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance + * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest instance */ - RejoinUserEventsMetadata.create = function create(properties) { - return new RejoinUserEventsMetadata(properties); + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); }; /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsMetadata.encode = function encode(message, writer) { + GetProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * Decodes a GetProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsMetadata.decode = function decode(reader, length) { + GetProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -11192,107 +14539,109 @@ }; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsMetadata message. + * Verifies a GetProductRequest message. * @function verify - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsMetadata.verify = function verify(message) { + GetProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest */ - RejoinUserEventsMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsMetadata) + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetProductRequest) return object; - return new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); + var message = new $root.google.cloud.retail.v2.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; }; /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @static - * @param {google.cloud.retail.v2.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {google.cloud.retail.v2.GetProductRequest} message GetProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsMetadata.toObject = function toObject() { - return {}; + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; }; /** - * Converts this RejoinUserEventsMetadata to JSON. + * Converts this GetProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2.GetProductRequest * @instance * @returns {Object.} JSON object */ - RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + GetProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RejoinUserEventsMetadata; + return GetProductRequest; })(); - return v2; - })(); - - retail.v2alpha = (function() { - - /** - * Namespace v2alpha. - * @memberof google.cloud.retail - * @namespace - */ - var v2alpha = {}; - - v2alpha.ProductLevelConfig = (function() { + v2.UpdateProductRequest = (function() { /** - * Properties of a ProductLevelConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IProductLevelConfig - * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType - * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing */ /** - * Constructs a new ProductLevelConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductLevelConfig. - * @implements IProductLevelConfig + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set */ - function ProductLevelConfig(properties) { + function UpdateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11300,88 +14649,101 @@ } /** - * ProductLevelConfig ingestionProductType. - * @member {string} ingestionProductType - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * UpdateProductRequest product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.UpdateProductRequest * @instance */ - ProductLevelConfig.prototype.ingestionProductType = ""; + UpdateProductRequest.prototype.product = null; /** - * ProductLevelConfig merchantCenterProductIdField. - * @member {string} merchantCenterProductIdField - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateProductRequest * @instance */ - ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + UpdateProductRequest.prototype.updateMask = null; /** - * Creates a new ProductLevelConfig instance using the specified properties. + * UpdateProductRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.allowMissing = false; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig instance + * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest instance */ - ProductLevelConfig.create = function create(properties) { - return new ProductLevelConfig(properties); + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); }; /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductLevelConfig.encode = function encode(message, writer) { + UpdateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); - if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); return writer; }; /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. + * Decodes an UpdateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductLevelConfig.decode = function decode(reader, length) { + UpdateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.ingestionProductType = reader.string(); + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); break; case 2: - message.merchantCenterProductIdField = reader.string(); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -11392,118 +14754,134 @@ }; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductLevelConfig message. + * Verifies an UpdateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductLevelConfig.verify = function verify(message) { + UpdateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - if (!$util.isString(message.ingestionProductType)) - return "ingestionProductType: string expected"; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - if (!$util.isString(message.merchantCenterProductIdField)) - return "merchantCenterProductIdField: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest */ - ProductLevelConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductLevelConfig) + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateProductRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); - if (object.ingestionProductType != null) - message.ingestionProductType = String(object.ingestionProductType); - if (object.merchantCenterProductIdField != null) - message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + var message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.ProductLevelConfig} message ProductLevelConfig + * @param {google.cloud.retail.v2.UpdateProductRequest} message UpdateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductLevelConfig.toObject = function toObject(message, options) { + UpdateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.ingestionProductType = ""; - object.merchantCenterProductIdField = ""; + object.product = null; + object.updateMask = null; + object.allowMissing = false; } - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - object.ingestionProductType = message.ingestionProductType; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - object.merchantCenterProductIdField = message.merchantCenterProductIdField; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this ProductLevelConfig to JSON. + * Converts this UpdateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @memberof google.cloud.retail.v2.UpdateProductRequest * @instance * @returns {Object.} JSON object */ - ProductLevelConfig.prototype.toJSON = function toJSON() { + UpdateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductLevelConfig; + return UpdateProductRequest; })(); - v2alpha.Catalog = (function() { + v2.DeleteProductRequest = (function() { /** - * Properties of a Catalog. - * @memberof google.cloud.retail.v2alpha - * @interface ICatalog - * @property {string|null} [name] Catalog name - * @property {string|null} [displayName] Catalog displayName - * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name */ /** - * Constructs a new Catalog. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Catalog. - * @implements ICatalog + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set */ - function Catalog(properties) { + function DeleteProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11511,102 +14889,76 @@ } /** - * Catalog name. + * DeleteProductRequest name. * @member {string} name - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - */ - Catalog.prototype.name = ""; - - /** - * Catalog displayName. - * @member {string} displayName - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - */ - Catalog.prototype.displayName = ""; - - /** - * Catalog productLevelConfig. - * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @instance */ - Catalog.prototype.productLevelConfig = null; + DeleteProductRequest.prototype.name = ""; /** - * Creates a new Catalog instance using the specified properties. + * Creates a new DeleteProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance + * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest instance */ - Catalog.create = function create(properties) { - return new Catalog(properties); + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); }; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encode = function encode(message, writer) { + DeleteProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) - $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decode = function decode(reader, length) { + DeleteProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -11616,232 +14968,111 @@ }; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decodeDelimited = function decodeDelimited(reader) { + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Catalog message. + * Verifies a DeleteProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Catalog.verify = function verify(message) { + DeleteProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); - if (error) - return "productLevelConfig." + error; - } return null; }; /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.DeleteProductRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.Catalog(); + var message = new $root.google.cloud.retail.v2.DeleteProductRequest(); if (object.name != null) message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); - } return message; }; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {google.cloud.retail.v2.DeleteProductRequest} message DeleteProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Catalog.toObject = function toObject(message, options) { + DeleteProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; - } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); return object; }; /** - * Converts this Catalog to JSON. + * Converts this DeleteProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.DeleteProductRequest * @instance * @returns {Object.} JSON object */ - Catalog.prototype.toJSON = function toJSON() { + DeleteProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Catalog; - })(); - - v2alpha.CatalogService = (function() { - - /** - * Constructs a new CatalogService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CatalogService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.CatalogService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. - */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. - * @memberof google.cloud.retail.v2alpha.CatalogService - * @typedef ListCatalogsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} [response] ListCatalogsResponse - */ - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2alpha.ListCatalogsRequest, $root.google.cloud.retail.v2alpha.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. - * @memberof google.cloud.retail.v2alpha.CatalogService - * @typedef UpdateCatalogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Catalog} [response] Catalog - */ - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2alpha.UpdateCatalogRequest, $root.google.cloud.retail.v2alpha.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return CatalogService; + return DeleteProductRequest; })(); - v2alpha.ListCatalogsRequest = (function() { + v2.ListProductsRequest = (function() { /** - * Properties of a ListCatalogsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * Properties of a ListProductsRequest. + * @memberof google.cloud.retail.v2 + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask */ /** - * Constructs a new ListCatalogsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * Constructs a new ListProductsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListProductsRequest=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function ListProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11849,51 +15080,67 @@ } /** - * ListCatalogsRequest parent. + * ListProductsRequest parent. * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @instance */ - ListCatalogsRequest.prototype.parent = ""; + ListProductsRequest.prototype.parent = ""; /** - * ListCatalogsRequest pageSize. + * ListProductsRequest pageSize. * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @instance */ - ListCatalogsRequest.prototype.pageSize = 0; + ListProductsRequest.prototype.pageSize = 0; /** - * ListCatalogsRequest pageToken. + * ListProductsRequest pageToken. * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + ListProductsRequest.prototype.pageToken = ""; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.filter = ""; + + /** + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * Creates a new ListProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + ListProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) @@ -11902,37 +15149,41 @@ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a ListProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + ListProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -11945,6 +15196,12 @@ case 3: message.pageToken = reader.string(); break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -11954,30 +15211,30 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies a ListProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + ListProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) @@ -11989,40 +15246,55 @@ if (message.pageToken != null && message.hasOwnProperty("pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (error) + return "readMask." + error; + } return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsRequest) + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListProductsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + var message = new $root.google.cloud.retail.v2.ListProductsRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.pageSize != null) message.pageSize = object.pageSize | 0; if (object.pageToken != null) message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + } return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2.ListProductsRequest} message ListProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + ListProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -12030,6 +15302,8 @@ object.parent = ""; object.pageSize = 0; object.pageToken = ""; + object.filter = ""; + object.readMask = null; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -12037,43 +15311,47 @@ object.pageSize = message.pageSize; if (message.pageToken != null && message.hasOwnProperty("pageToken")) object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); return object; }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ListProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2.ListProductsRequest * @instance * @returns {Object.} JSON object */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { + ListProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsRequest; + return ListProductsRequest; })(); - v2alpha.ListCatalogsResponse = (function() { + v2.ListProductsResponse = (function() { /** - * Properties of a ListCatalogsResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + * Properties of a ListProductsResponse. + * @memberof google.cloud.retail.v2 + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken */ /** - * Constructs a new ListCatalogsResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse + * Constructs a new ListProductsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListProductsResponse=} [properties] Properties to set */ - function ListCatalogsResponse(properties) { - this.catalogs = []; + function ListProductsResponse(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12081,88 +15359,88 @@ } /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2.ListProductsResponse * @instance */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + ListProductsResponse.prototype.products = $util.emptyArray; /** - * ListCatalogsResponse nextPageToken. + * ListProductsResponse nextPageToken. * @member {string} nextPageToken - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @instance */ - ListCatalogsResponse.prototype.nextPageToken = ""; + ListProductsResponse.prototype.nextPageToken = ""; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new ListProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse instance + * @param {google.cloud.retail.v2.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse instance */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); }; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encode = function encode(message, writer) { + ListProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a ListProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decode = function decode(reader, length) { + ListProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); break; case 2: message.nextPageToken = reader.string(); @@ -12176,39 +15454,39 @@ }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsResponse message. + * Verifies a ListProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsResponse.verify = function verify(message) { + ListProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalogs[i]); + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); if (error) - return "catalogs." + error; + return "products." + error; } } if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) @@ -12218,25 +15496,25 @@ }; /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsResponse) + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListProductsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalogs[i]); + var message = new $root.google.cloud.retail.v2.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); } } if (object.nextPageToken != null) @@ -12245,26 +15523,26 @@ }; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} message ListCatalogsResponse + * @param {google.cloud.retail.v2.ListProductsResponse} message ListProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsResponse.toObject = function toObject(message, options) { + ListProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.catalogs = []; + object.products = []; if (options.defaults) object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalogs[j], options); + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); } if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) object.nextPageToken = message.nextPageToken; @@ -12272,38 +15550,40 @@ }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ListProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ListProductsResponse * @instance * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { + ListProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsResponse; + return ListProductsResponse; })(); - v2alpha.UpdateCatalogRequest = (function() { + v2.SetInventoryRequest = (function() { /** - * Properties of an UpdateCatalogRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2alpha.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * Properties of a SetInventoryRequest. + * @memberof google.cloud.retail.v2 + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing */ /** - * Constructs a new UpdateCatalogRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest + * Constructs a new SetInventoryRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest * @constructor - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISetInventoryRequest=} [properties] Properties to set */ - function UpdateCatalogRequest(properties) { + function SetInventoryRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12311,88 +15591,114 @@ } /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2alpha.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2.SetInventoryRequest * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + SetInventoryRequest.prototype.inventory = null; /** - * UpdateCatalogRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2.SetInventoryRequest * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + SetInventoryRequest.prototype.setMask = null; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest instance + * @param {google.cloud.retail.v2.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); }; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encode = function encode(message, writer) { + SetInventoryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); return writer; }; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decode = function decode(reader, length) { + SetInventoryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); + message.inventory = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -12403,129 +15709,146 @@ }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a SetInventoryRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateCatalogRequest.verify = function verify(message) { + SetInventoryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalog); + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.inventory); if (error) - return "catalog." + error; + return "inventory." + error; } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); if (error) - return "updateMask." + error; + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UpdateCatalogRequest) + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetInventoryRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalog); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } + var message = new $root.google.cloud.retail.v2.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {google.cloud.retail.v2.SetInventoryRequest} message SetInventoryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateCatalogRequest.toObject = function toObject(message, options) { + SetInventoryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.catalog = null; - object.updateMask = null; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalog, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this SetInventoryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.SetInventoryRequest * @instance * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { + SetInventoryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateCatalogRequest; + return SetInventoryRequest; })(); - v2alpha.CustomAttribute = (function() { + v2.SetInventoryMetadata = (function() { /** - * Properties of a CustomAttribute. - * @memberof google.cloud.retail.v2alpha - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers + * Properties of a SetInventoryMetadata. + * @memberof google.cloud.retail.v2 + * @interface ISetInventoryMetadata */ /** - * Constructs a new CustomAttribute. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute + * Constructs a new SetInventoryMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata * @constructor - * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISetInventoryMetadata=} [properties] Properties to set */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; + function SetInventoryMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12533,103 +15856,63 @@ } /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.text = $util.emptyArray; - - /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.numbers = $util.emptyArray; - - /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance + * @param {google.cloud.retail.v2.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata instance */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); }; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encode = function encode(message, writer) { + SetInventoryMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } return writer; }; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decode = function decode(reader, length) { + SetInventoryMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; default: reader.skipType(tag & 7); break; @@ -12639,142 +15922,93 @@ }; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomAttribute message. + * Verifies a SetInventoryMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomAttribute.verify = function verify(message) { + SetInventoryMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; - } return null; }; /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetInventoryMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); - } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); - } - return message; + return new $root.google.cloud.retail.v2.SetInventoryMetadata(); }; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute + * @param {google.cloud.retail.v2.SetInventoryMetadata} message SetInventoryMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomAttribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; - } - return object; + SetInventoryMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this CustomAttribute to JSON. + * Converts this SetInventoryMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @memberof google.cloud.retail.v2.SetInventoryMetadata * @instance * @returns {Object.} JSON object */ - CustomAttribute.prototype.toJSON = function toJSON() { + SetInventoryMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomAttribute; + return SetInventoryMetadata; })(); - v2alpha.Image = (function() { + v2.SetInventoryResponse = (function() { /** - * Properties of an Image. - * @memberof google.cloud.retail.v2alpha - * @interface IImage - * @property {string|null} [uri] Image uri - * @property {number|null} [height] Image height - * @property {number|null} [width] Image width + * Properties of a SetInventoryResponse. + * @memberof google.cloud.retail.v2 + * @interface ISetInventoryResponse */ /** - * Constructs a new Image. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Image. - * @implements IImage + * Constructs a new SetInventoryResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse * @constructor - * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISetInventoryResponse=} [properties] Properties to set */ - function Image(properties) { + function SetInventoryResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12782,102 +16016,63 @@ } /** - * Image uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.uri = ""; - - /** - * Image height. - * @member {number} height - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.height = 0; - - /** - * Image width. - * @member {number} width - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.width = 0; - - /** - * Creates a new Image instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Image} Image instance + * @param {google.cloud.retail.v2.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse instance */ - Image.create = function create(properties) { - return new Image(properties); + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + SetInventoryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Image} Image + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + SetInventoryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -12887,127 +16082,99 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Image} Image + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a SetInventoryResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + SetInventoryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Image} Image + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Image) + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetInventoryResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.Image(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.height != null) - message.height = object.height | 0; - if (object.width != null) - message.width = object.width | 0; - return message; + return new $root.google.cloud.retail.v2.SetInventoryResponse(); }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.Image} message Image + * @param {google.cloud.retail.v2.SetInventoryResponse} message SetInventoryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.uri = ""; - object.height = 0; - object.width = 0; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; - return object; + SetInventoryResponse.toObject = function toObject() { + return {}; }; /** - * Converts this Image to JSON. + * Converts this SetInventoryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2.SetInventoryResponse * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + SetInventoryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return SetInventoryResponse; })(); - v2alpha.PriceInfo = (function() { + v2.AddFulfillmentPlacesRequest = (function() { /** - * Properties of a PriceInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IPriceInfo - * @property {string|null} [currencyCode] PriceInfo currencyCode - * @property {number|null} [price] PriceInfo price - * @property {number|null} [originalPrice] PriceInfo originalPrice - * @property {number|null} [cost] PriceInfo cost + * Properties of an AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new PriceInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PriceInfo. - * @implements IPriceInfo + * Constructs a new AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest=} [properties] Properties to set */ - function PriceInfo(properties) { + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13015,114 +16182,130 @@ } /** - * PriceInfo currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2alpha.PriceInfo + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @instance */ - PriceInfo.prototype.currencyCode = ""; + AddFulfillmentPlacesRequest.prototype.product = ""; /** - * PriceInfo price. - * @member {number} price - * @memberof google.cloud.retail.v2alpha.PriceInfo + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @instance */ - PriceInfo.prototype.price = 0; + AddFulfillmentPlacesRequest.prototype.type = ""; /** - * PriceInfo originalPrice. - * @member {number} originalPrice - * @memberof google.cloud.retail.v2alpha.PriceInfo + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @instance */ - PriceInfo.prototype.originalPrice = 0; + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * PriceInfo cost. - * @member {number} cost - * @memberof google.cloud.retail.v2alpha.PriceInfo + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @instance */ - PriceInfo.prototype.cost = 0; + AddFulfillmentPlacesRequest.prototype.addTime = null; /** - * Creates a new PriceInfo instance using the specified properties. + * AddFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance */ - PriceInfo.create = function create(properties) { - return new PriceInfo(properties); + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encode = function encode(message, writer) { + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decode = function decode(reader, length) { + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.currencyCode = reader.string(); + message.product = reader.string(); break; case 2: - message.price = reader.float(); + message.type = reader.string(); break; case 3: - message.originalPrice = reader.float(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; case 4: - message.cost = reader.float(); + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -13133,135 +16316,157 @@ }; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PriceInfo message. + * Verifies an AddFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PriceInfo.verify = function verify(message) { + AddFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - if (message.price != null && message.hasOwnProperty("price")) - if (typeof message.price !== "number") - return "price: number expected"; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - if (typeof message.originalPrice !== "number") - return "originalPrice: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest */ - PriceInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - if (object.price != null) - message.price = Number(object.price); - if (object.originalPrice != null) - message.originalPrice = Number(object.originalPrice); - if (object.cost != null) - message.cost = Number(object.cost); + var message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo + * @param {google.cloud.retail.v2.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PriceInfo.toObject = function toObject(message, options) { + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) { - object.currencyCode = ""; - object.price = 0; - object.originalPrice = 0; - object.cost = 0; + object.product = ""; + object.type = ""; + object.addTime = null; + object.allowMissing = false; } - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - if (message.price != null && message.hasOwnProperty("price")) - object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this PriceInfo to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - PriceInfo.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PriceInfo; + return AddFulfillmentPlacesRequest; })(); - v2alpha.UserInfo = (function() { + v2.AddFulfillmentPlacesMetadata = (function() { /** - * Properties of a UserInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IUserInfo - * @property {string|null} [userId] UserInfo userId - * @property {string|null} [ipAddress] UserInfo ipAddress - * @property {string|null} [userAgent] UserInfo userAgent - * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + * Properties of an AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IAddFulfillmentPlacesMetadata */ /** - * Constructs a new UserInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserInfo. - * @implements IUserInfo + * Constructs a new AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata=} [properties] Properties to set */ - function UserInfo(properties) { + function AddFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13269,115 +16474,63 @@ } /** - * UserInfo userId. - * @member {string} userId - * @memberof google.cloud.retail.v2alpha.UserInfo - * @instance - */ - UserInfo.prototype.userId = ""; - - /** - * UserInfo ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.retail.v2alpha.UserInfo - * @instance - */ - UserInfo.prototype.ipAddress = ""; - - /** - * UserInfo userAgent. - * @member {string} userAgent - * @memberof google.cloud.retail.v2alpha.UserInfo - * @instance - */ - UserInfo.prototype.userAgent = ""; - - /** - * UserInfo directUserRequest. - * @member {boolean} directUserRequest - * @memberof google.cloud.retail.v2alpha.UserInfo - * @instance - */ - UserInfo.prototype.directUserRequest = false; - - /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance */ - UserInfo.create = function create(properties) { - return new UserInfo(properties); + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encode = function encode(message, writer) { + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); return writer; }; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decode = function decode(reader, length) { + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userId = reader.string(); - break; - case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -13387,134 +16540,93 @@ }; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserInfo message. + * Verifies an AddFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserInfo.verify = function verify(message) { + AddFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userId != null && message.hasOwnProperty("userId")) - if (!$util.isString(message.userId)) - return "userId: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - if (typeof message.directUserRequest !== "boolean") - return "directUserRequest: boolean expected"; return null; }; /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata */ - UserInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.UserInfo(); - if (object.userId != null) - message.userId = String(object.userId); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.directUserRequest != null) - message.directUserRequest = Boolean(object.directUserRequest); - return message; + return new $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo + * @param {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.userId = ""; - object.ipAddress = ""; - object.userAgent = ""; - object.directUserRequest = false; - } - if (message.userId != null && message.hasOwnProperty("userId")) - object.userId = message.userId; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - object.directUserRequest = message.directUserRequest; - return object; + AddFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this UserInfo to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - UserInfo.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserInfo; + return AddFulfillmentPlacesMetadata; })(); - v2alpha.GcsSource = (function() { + v2.AddFulfillmentPlacesResponse = (function() { /** - * Properties of a GcsSource. - * @memberof google.cloud.retail.v2alpha - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema + * Properties of an AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @interface IAddFulfillmentPlacesResponse */ /** - * Constructs a new GcsSource. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * Constructs a new AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse * @constructor - * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse=} [properties] Properties to set */ - function GcsSource(properties) { - this.inputUris = []; + function AddFulfillmentPlacesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13522,92 +16634,63 @@ } /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2alpha.GcsSource - * @instance - */ - GcsSource.prototype.inputUris = $util.emptyArray; - - /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2alpha.GcsSource - * @instance - */ - GcsSource.prototype.dataSchema = ""; - - /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); - break; - case 2: - message.dataSchema = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -13617,132 +16700,99 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies an AddFulfillmentPlacesResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + AddFulfillmentPlacesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; - } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); - } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); - return message; + return new $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse(); }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource + * @param {google.cloud.retail.v2.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.inputUris = []; - if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; - } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - return object; + AddFulfillmentPlacesResponse.toObject = function toObject() { + return {}; }; /** - * Converts this GcsSource to JSON. + * Converts this AddFulfillmentPlacesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return AddFulfillmentPlacesResponse; })(); - v2alpha.BigQuerySource = (function() { + v2.RemoveFulfillmentPlacesRequest = (function() { /** - * Properties of a BigQuerySource. - * @memberof google.cloud.retail.v2alpha - * @interface IBigQuerySource - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema + * Properties of a RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new BigQuerySource. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource + * Constructs a new RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set */ - function BigQuerySource(properties) { + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13750,127 +16800,130 @@ } /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - BigQuerySource.prototype.projectId = ""; + RemoveFulfillmentPlacesRequest.prototype.product = ""; /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - BigQuerySource.prototype.datasetId = ""; + RemoveFulfillmentPlacesRequest.prototype.type = ""; /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - BigQuerySource.prototype.tableId = ""; + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - BigQuerySource.prototype.gcsStagingDir = ""; + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - BigQuerySource.prototype.dataSchema = ""; + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encode = function encode(message, writer) { + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.projectId = reader.string(); - break; case 1: - message.datasetId = reader.string(); + message.product = reader.string(); break; case 2: - message.tableId = reader.string(); + message.type = reader.string(); break; case 3: - message.gcsStagingDir = reader.string(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; case 4: - message.dataSchema = reader.string(); + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -13881,141 +16934,157 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies a RemoveFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + RemoveFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); + var message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this RemoveFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BigQuerySource; + return RemoveFulfillmentPlacesRequest; })(); - v2alpha.ProductInlineSource = (function() { + v2.RemoveFulfillmentPlacesMetadata = (function() { /** - * Properties of a ProductInlineSource. - * @memberof google.cloud.retail.v2alpha - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products + * Properties of a RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesMetadata */ /** - * Constructs a new ProductInlineSource. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set */ - function ProductInlineSource(properties) { - this.products = []; + function RemoveFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14023,79 +17092,63 @@ } /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @instance - */ - ProductInlineSource.prototype.products = $util.emptyArray; - - /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encode = function encode(message, writer) { + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decode = function decode(reader, length) { + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -14105,125 +17158,93 @@ }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInlineSource message. + * Verifies a RemoveFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInlineSource.verify = function verify(message) { + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } return null; }; /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); - } - } - return message; + return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); - } - return object; + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this ProductInlineSource to JSON. + * Converts this RemoveFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - ProductInlineSource.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInlineSource; + return RemoveFulfillmentPlacesMetadata; })(); - v2alpha.UserEventInlineSource = (function() { + v2.RemoveFulfillmentPlacesResponse = (function() { /** - * Properties of a UserEventInlineSource. - * @memberof google.cloud.retail.v2alpha - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesResponse */ /** - * Constructs a new UserEventInlineSource. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set */ - function UserEventInlineSource(properties) { - this.userEvents = []; + function RemoveFulfillmentPlacesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14231,79 +17252,63 @@ } /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource - * @instance - */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; - - /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); }; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encode = function encode(message, writer) { + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decode = function decode(reader, length) { + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -14313,124 +17318,93 @@ }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInlineSource message. + * Verifies a RemoveFulfillmentPlacesResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInlineSource.verify = function verify(message) { + RemoveFulfillmentPlacesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); - if (error) - return "userEvents." + error; - } - } return null; }; /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); - } - } - return message; + return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); }; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); - } - return object; + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this RemoveFulfillmentPlacesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse * @instance * @returns {Object.} JSON object */ - UserEventInlineSource.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInlineSource; + return RemoveFulfillmentPlacesResponse; })(); - v2alpha.ImportErrorsConfig = (function() { + v2.PurgeMetadata = (function() { /** - * Properties of an ImportErrorsConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @interface IPurgeMetadata */ /** - * Constructs a new ImportErrorsConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set */ - function ImportErrorsConfig(properties) { + function PurgeMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14438,90 +17412,63 @@ } /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig - * @instance - */ - ImportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig - * @instance - */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new PurgeMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); }; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encode = function encode(message, writer) { + PurgeMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a PurgeMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decode = function decode(reader, length) { + PurgeMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -14531,114 +17478,96 @@ }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportErrorsConfig message. + * Verifies a PurgeMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportErrorsConfig.verify = function verify(message) { + PurgeMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } return null; }; /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); - return message; + return new $root.google.cloud.retail.v2.PurgeMetadata(); }; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig + * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportErrorsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; - } - return object; + PurgeMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this PurgeMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2.PurgeMetadata * @instance * @returns {Object.} JSON object */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { + PurgeMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportErrorsConfig; + return PurgeMetadata; })(); - v2alpha.ImportProductsRequest = (function() { + v2.PurgeUserEventsRequest = (function() { /** - * Properties of an ImportProductsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force */ /** - * Constructs a new ImportProductsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set */ - function ImportProductsRequest(properties) { + function PurgeUserEventsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14646,100 +17575,90 @@ } /** - * ImportProductsRequest parent. + * PurgeUserEventsRequest parent. * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.parent = ""; - - /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @instance */ - ImportProductsRequest.prototype.inputConfig = null; + PurgeUserEventsRequest.prototype.parent = ""; /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @instance */ - ImportProductsRequest.prototype.errorsConfig = null; + PurgeUserEventsRequest.prototype.filter = ""; /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @instance */ - ImportProductsRequest.prototype.updateMask = null; + PurgeUserEventsRequest.prototype.force = false; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new PurgeUserEventsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); }; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encode = function encode(message, writer) { + PurgeUserEventsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); return writer; }; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decode = function decode(reader, length) { + PurgeUserEventsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -14747,13 +17666,10 @@ message.parent = reader.string(); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); + message.filter = reader.string(); break; case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.force = reader.bool(); break; default: reader.skipType(tag & 7); @@ -14764,149 +17680,124 @@ }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsRequest message. + * Verifies a PurgeUserEventsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsRequest.verify = function verify(message) { + PurgeUserEventsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest */ - ImportProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); if (object.parent != null) message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); return message; }; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest + * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsRequest.toObject = function toObject(message, options) { + PurgeUserEventsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - object.updateMask = null; + object.filter = ""; + object.force = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this PurgeUserEventsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest * @instance * @returns {Object.} JSON object */ - ImportProductsRequest.prototype.toJSON = function toJSON() { + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsRequest; + return PurgeUserEventsRequest; })(); - v2alpha.ImportUserEventsRequest = (function() { + v2.PurgeUserEventsResponse = (function() { /** - * Properties of an ImportUserEventsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IImportUserEventsRequest - * @property {string|null} [parent] ImportUserEventsRequest parent - * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount */ /** - * Constructs a new ImportUserEventsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportUserEventsRequest. - * @implements IImportUserEventsRequest + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set */ - function ImportUserEventsRequest(properties) { + function PurgeUserEventsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14914,101 +17805,75 @@ } /** - * ImportUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest - * @instance - */ - ImportUserEventsRequest.prototype.parent = ""; - - /** - * ImportUserEventsRequest inputConfig. - * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest - * @instance - */ - ImportUserEventsRequest.prototype.inputConfig = null; - - /** - * ImportUserEventsRequest errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @instance */ - ImportUserEventsRequest.prototype.errorsConfig = null; + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new PurgeUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance */ - ImportUserEventsRequest.create = function create(properties) { - return new ImportUserEventsRequest(properties); + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); }; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encode = function encode(message, writer) { + PurgeUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); return writer; }; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decode = function decode(reader, length) { + PurgeUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + message.purgedEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -15019,136 +17884,208 @@ }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a PurgeUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsRequest.verify = function verify(message) { + PurgeUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; return null; }; /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse */ - ImportUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsRequest.toObject = function toObject(message, options) { + PurgeUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; return object; }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this PurgeUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse * @instance * @returns {Object.} JSON object */ - ImportUserEventsRequest.prototype.toJSON = function toJSON() { + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsRequest; + return PurgeUserEventsResponse; })(); - v2alpha.ProductInputConfig = (function() { + v2.SearchService = (function() { /** - * Properties of a ProductInputConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IProductInputConfig - * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; /** - * Constructs a new ProductInputConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. + * @memberof google.cloud.retail.v2.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.SearchResponse} [response] SearchResponse + */ + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2.SearchService + * @instance + * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2.SearchRequest, $root.google.cloud.retail.v2.SearchResponse, request, callback); + }, "name", { value: "Search" }); + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2.SearchService + * @instance + * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SearchService; + })(); + + v2.SearchRequest = (function() { + + /** + * Properties of a SearchRequest. + * @memberof google.cloud.retail.v2 + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + */ + + /** + * Constructs a new SearchRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest * @constructor - * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set */ - function ProductInputConfig(properties) { + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15156,115 +18093,292 @@ } /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - ProductInputConfig.prototype.productInlineSource = null; + SearchRequest.prototype.placement = ""; /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - ProductInputConfig.prototype.gcsSource = null; + SearchRequest.prototype.branch = ""; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - ProductInputConfig.prototype.bigQuerySource = null; + SearchRequest.prototype.query = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.visitorId = ""; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * SearchRequest userInfo. + * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + SearchRequest.prototype.userInfo = null; /** - * Creates a new ProductInputConfig instance using the specified properties. + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageSize = 0; + + /** + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageToken = ""; + + /** + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.offset = 0; + + /** + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.filter = ""; + + /** + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.canonicalFilter = ""; + + /** + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.orderBy = ""; + + /** + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.facetSpecs = $util.emptyArray; + + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; + + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; + + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; + + /** + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + + /** + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * Creates a new SearchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + SearchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + message.placement = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + message.branch = reader.string(); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + message.query = reader.string(); + break; + case 4: + message.visitorId = reader.string(); + break; + case 5: + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); + break; + case 10: + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -15275,554 +18389,2008 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + SearchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies a SearchRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); if (error) - return "gcsSource." + error; + return "facetSpecs." + error; } } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; } return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); + var message = new $root.google.cloud.retail.v2.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); } return message; }; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig + * @param {google.cloud.retail.v2.SearchRequest} message SearchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInputConfig.toObject = function toObject(message, options) { + SearchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (options.defaults) { + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this SearchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2.SearchRequest * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + SearchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; - })(); - - v2alpha.UserEventInputConfig = (function() { - - /** - * Properties of a UserEventInputConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource - */ + SearchRequest.FacetSpec = (function() { - /** - * Constructs a new UserEventInputConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig - * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set - */ - function UserEventInputConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ - /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.userEventInlineSource = null; + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * UserEventInputConfig gcsSource. - * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.gcsSource = null; + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; - /** - * UserEventInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.bigQuerySource = null; + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; - /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; - /** - * Creates a new UserEventInputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance - */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); - }; + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; - /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventInputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; - /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventInputConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + case 2: + message.limit = reader.int32(); + break; + case 3: + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + case 4: + message.enableDynamicPosition = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a UserEventInputConfig message. - * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UserEventInputConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); if (error) - return "userEventInlineSource." + error; + return "facetKey." + error; } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; } - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); } - } - return null; - }; + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; - /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig - */ - UserEventInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; + } + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); - if (object.userEventInlineSource != null) { - if (typeof object.userEventInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); - } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); - } - return message; - }; - - /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @static - * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserEventInputConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); - if (options.oneofs) - object.source = "userEventInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; - } - return object; - }; - - /** - * Converts this UserEventInputConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - * @returns {Object.} JSON object - */ - UserEventInputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UserEventInputConfig; - })(); - - v2alpha.ImportMetadata = (function() { + }; - /** - * Properties of an ImportMetadata. - * @memberof google.cloud.retail.v2alpha - * @interface IImportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime - * @property {number|Long|null} [successCount] ImportMetadata successCount - * @property {number|Long|null} [failureCount] ImportMetadata failureCount - */ + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Constructs a new ImportMetadata. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportMetadata. - * @implements IImportMetadata - * @constructor - * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set - */ - function ImportMetadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + FacetSpec.FacetKey = (function() { + + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ + + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; + + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; + + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; + + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; + + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; + + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; + + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; + + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + return writer; + }; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + return null; + }; + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + return message; + }; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + return object; + }; + + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetKey; + })(); + + return FacetSpec; + })(); + + SearchRequest.DynamicFacetSpec = (function() { + + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ + + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); + + return DynamicFacetSpec; + })(); + + SearchRequest.BoostSpec = (function() { + + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + */ + + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + return null; + }; + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + return object; + }; + + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BoostSpec.ConditionBoostSpec = (function() { + + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ + + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; + + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConditionBoostSpec; + })(); + + return BoostSpec; + })(); + + SearchRequest.QueryExpansionSpec = (function() { + + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + */ + + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + return writer; + }; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + return object; + }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Condition enum. + * @name google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; + })(); + + return SearchRequest; + })(); + + v2.SearchResponse = (function() { /** - * ImportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * Properties of a SearchResponse. + * @memberof google.cloud.retail.v2 + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + */ + + /** + * Constructs a new SearchResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse + * @constructor + * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set + */ + function SearchResponse(properties) { + this.results = []; + this.facets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - ImportMetadata.prototype.createTime = null; + SearchResponse.prototype.results = $util.emptyArray; /** - * ImportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - ImportMetadata.prototype.updateTime = null; + SearchResponse.prototype.facets = $util.emptyArray; /** - * ImportMetadata successCount. - * @member {number|Long} successCount - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + SearchResponse.prototype.totalSize = 0; /** - * ImportMetadata failureCount. - * @member {number|Long} failureCount - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + SearchResponse.prototype.correctedQuery = ""; /** - * Creates a new ImportMetadata instance using the specified properties. + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.SearchResponse + * @instance + */ + SearchResponse.prototype.attributionToken = ""; + + /** + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.SearchResponse + * @instance + */ + SearchResponse.prototype.nextPageToken = ""; + + /** + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2.SearchResponse + * @instance + */ + SearchResponse.prototype.queryExpansionInfo = null; + + /** + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2.SearchResponse + * @instance + */ + SearchResponse.prototype.redirectUri = ""; + + /** + * Creates a new SearchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance + * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse instance */ - ImportMetadata.create = function create(properties) { - return new ImportMetadata(properties); + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); }; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encode = function encode(message, writer) { + SearchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); - if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); - return writer; - }; - + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + return writer; + }; + /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decode = function decode(reader, length) { + SearchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); break; case 3: - message.successCount = reader.int64(); + message.totalSize = reader.int32(); break; case 4: - message.failureCount = reader.int64(); + message.correctedQuery = reader.string(); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + message.nextPageToken = reader.string(); + break; + case 7: + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + case 10: + message.redirectUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -15833,514 +20401,1578 @@ }; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + SearchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportMetadata message. + * Verifies a SearchResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportMetadata.verify = function verify(message) { + SearchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.SearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.Facet.verify(message.facets[i]); + if (error) + return "facets." + error; + } + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); if (error) - return "updateTime." + error; + return "queryExpansionInfo." + error; } - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) - return "successCount: integer|Long expected"; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) - return "failureCount: integer|Long expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; return null; }; /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse */ - ImportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + var message = new $root.google.cloud.retail.v2.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.fromObject(object.results[i]); + } } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.fromObject(object.facets[i]); + } } - if (object.successCount != null) - if ($util.Long) - (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; - else if (typeof object.successCount === "string") - message.successCount = parseInt(object.successCount, 10); - else if (typeof object.successCount === "number") - message.successCount = object.successCount; - else if (typeof object.successCount === "object") - message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); - if (object.failureCount != null) - if ($util.Long) - (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; - else if (typeof object.failureCount === "string") - message.failureCount = parseInt(object.failureCount, 10); - else if (typeof object.failureCount === "number") - message.failureCount = object.failureCount; - else if (typeof object.failureCount === "object") - message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); return message; }; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata + * @param {google.cloud.retail.v2.SearchResponse} message SearchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportMetadata.toObject = function toObject(message, options) { + SearchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + } if (options.defaults) { - object.createTime = null; - object.updateTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.successCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failureCount = options.longs === String ? "0" : 0; + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (typeof message.successCount === "number") - object.successCount = options.longs === String ? String(message.successCount) : message.successCount; - else - object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (typeof message.failureCount === "number") - object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; - else - object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; return object; }; /** - * Converts this ImportMetadata to JSON. + * Converts this SearchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2.SearchResponse * @instance * @returns {Object.} JSON object */ - ImportMetadata.prototype.toJSON = function toJSON() { + SearchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportMetadata; - })(); + SearchResponse.SearchResult = (function() { - v2alpha.ImportProductsResponse = (function() { + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + */ - /** - * Properties of an ImportProductsResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IImportProductsResponse - * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig - */ + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ImportProductsResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportProductsResponse. - * @implements IImportProductsResponse - * @constructor - * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set - */ - function ImportProductsResponse(properties) { - this.errorSamples = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; - /** - * ImportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @instance - */ - ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + /** + * SearchResult product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; - /** - * ImportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @instance - */ - ImportProductsResponse.prototype.errorsConfig = null; + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; - /** - * Creates a new ImportProductsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance - */ - ImportProductsResponse.create = function create(properties) { - return new ImportProductsResponse(properties); - }; + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; - /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; - /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; - /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an ImportProductsResponse message. - * @function verify - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); if (error) - return "errorSamples." + error; + return "product." + error; } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - return null; - }; + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + return null; + }; - /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse - */ - ImportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) - return object; - var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } - return message; - }; + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } + return message; + }; - /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @static - * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; + } + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } + return object; + }; + + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SearchResult; + })(); + + SearchResponse.Facet = (function() { + + /** + * Properties of a Facet. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet + */ + + /** + * Constructs a new Facet. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set + */ + function Facet(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - return object; - }; - /** - * Converts this ImportProductsResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @instance - * @returns {Object.} JSON object - */ - ImportProductsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + */ + Facet.prototype.key = ""; - return ImportProductsResponse; + /** + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; + + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; + + /** + * Creates a new Facet instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet instance + */ + Facet.create = function create(properties) { + return new Facet(properties); + }; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); + return writer; + }; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Facet message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Facet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; + return null; + }; + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet + */ + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); + return message; + }; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet} message Facet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Facet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; + return object; + }; + + /** + * Converts this Facet to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + * @returns {Object.} JSON object + */ + Facet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Facet.FacetValue = (function() { + + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ + + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; + + /** + * FacetValue interval. + * @member {google.cloud.retail.v2.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; + + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; + + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetValue; + })(); + + return Facet; + })(); + + SearchResponse.QueryExpansionInfo = (function() { + + /** + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + */ + + /** + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + */ + function QueryExpansionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.expandedQuery = false; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + */ + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); + }; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + return writer; + }; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expandedQuery = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionInfo message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + */ + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.expandedQuery = false; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + return object; + }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryExpansionInfo; + })(); + + return SearchResponse; })(); - v2alpha.ImportUserEventsResponse = (function() { + v2.UserEventService = (function() { /** - * Properties of an ImportUserEventsResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IImportUserEventsResponse - * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig - * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; /** - * Constructs a new ImportUserEventsResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportUserEventsResponse. - * @implements IImportUserEventsResponse - * @constructor - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.UserEventService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. */ - function ImportUserEventsResponse(properties) { - this.errorSamples = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * ImportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.UserEvent} [response] UserEvent + */ + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2.UserEventService * @instance + * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 */ - ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2.WriteUserEventRequest, $root.google.cloud.retail.v2.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); /** - * ImportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2.UserEventService * @instance + * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - ImportUserEventsResponse.prototype.errorsConfig = null; /** - * ImportUserEventsResponse importSummary. - * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2.UserEventService * @instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 */ - ImportUserEventsResponse.prototype.importSummary = null; + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); /** - * Creates a new ImportUserEventsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - ImportUserEventsResponse.create = function create(properties) { - return new ImportUserEventsResponse(properties); - }; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - ImportUserEventsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) - $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - ImportUserEventsResponse.decode = function decode(reader, length) { + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UserEventService; + })(); + + v2.WriteUserEventRequest = (function() { + + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2 + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ + + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; + + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -16351,153 +21983,124 @@ }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsResponse message. + * Verifies a WriteUserEventRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsResponse.verify = function verify(message) { + WriteUserEventRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.importSummary != null && message.hasOwnProperty("importSummary")) { - var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); if (error) - return "importSummary." + error; + return "userEvent." + error; } return null; }; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest */ - ImportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.WriteUserEventRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.importSummary != null) { - if (typeof object.importSummary !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); + var message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); } return message; }; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {google.cloud.retail.v2.WriteUserEventRequest} message WriteUserEventRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsResponse.toObject = function toObject(message, options) { + WriteUserEventRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; if (options.defaults) { - object.errorsConfig = null; - object.importSummary = null; - } - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + object.parent = ""; + object.userEvent = null; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.importSummary != null && message.hasOwnProperty("importSummary")) - object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); return object; }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this WriteUserEventRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @instance * @returns {Object.} JSON object */ - ImportUserEventsResponse.prototype.toJSON = function toJSON() { + WriteUserEventRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsResponse; + return WriteUserEventRequest; })(); - v2alpha.UserEventImportSummary = (function() { + v2.CollectUserEventRequest = (function() { /** - * Properties of a UserEventImportSummary. - * @memberof google.cloud.retail.v2alpha - * @interface IUserEventImportSummary - * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount - * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2 + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets */ /** - * Constructs a new UserEventImportSummary. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventImportSummary. - * @implements IUserEventImportSummary + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set */ - function UserEventImportSummary(properties) { + function CollectUserEventRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16505,88 +22108,114 @@ } /** - * UserEventImportSummary joinedEventsCount. - * @member {number|Long} joinedEventsCount - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @instance */ - UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + CollectUserEventRequest.prototype.parent = ""; /** - * UserEventImportSummary unjoinedEventsCount. - * @member {number|Long} unjoinedEventsCount - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @instance */ - UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + CollectUserEventRequest.prototype.userEvent = ""; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; + + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest instance */ - UserEventImportSummary.create = function create(properties) { - return new UserEventImportSummary(properties); + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); }; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encode = function encode(message, writer) { + CollectUserEventRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); - if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); return writer; }; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes a CollectUserEventRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decode = function decode(reader, length) { + CollectUserEventRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.joinedEventsCount = reader.int64(); + message.parent = reader.string(); break; case 2: - message.unjoinedEventsCount = reader.int64(); + message.userEvent = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); break; default: reader.skipType(tag & 7); @@ -16597,162 +22226,147 @@ }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventImportSummary message. + * Verifies a CollectUserEventRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventImportSummary.verify = function verify(message) { + CollectUserEventRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) - return "joinedEventsCount: integer|Long expected"; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) - return "unjoinedEventsCount: integer|Long expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; return null; }; /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest */ - UserEventImportSummary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CollectUserEventRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); - if (object.joinedEventsCount != null) - if ($util.Long) - (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; - else if (typeof object.joinedEventsCount === "string") - message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); - else if (typeof object.joinedEventsCount === "number") - message.joinedEventsCount = object.joinedEventsCount; - else if (typeof object.joinedEventsCount === "object") - message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); - if (object.unjoinedEventsCount != null) + var message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) if ($util.Long) - (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; - else if (typeof object.unjoinedEventsCount === "string") - message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); - else if (typeof object.unjoinedEventsCount === "number") - message.unjoinedEventsCount = object.unjoinedEventsCount; - else if (typeof object.unjoinedEventsCount === "object") - message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary + * @param {google.cloud.retail.v2.CollectUserEventRequest} message CollectUserEventRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventImportSummary.toObject = function toObject(message, options) { + CollectUserEventRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.joinedEventsCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else - object.unjoinedEventsCount = options.longs === String ? "0" : 0; + object.ets = options.longs === String ? "0" : 0; } - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (typeof message.joinedEventsCount === "number") - object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; else - object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (typeof message.unjoinedEventsCount === "number") - object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; - else - object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; return object; }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this CollectUserEventRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @instance * @returns {Object.} JSON object */ - UserEventImportSummary.prototype.toJSON = function toJSON() { + CollectUserEventRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventImportSummary; + return CollectUserEventRequest; })(); - v2alpha.Product = (function() { + v2.RejoinUserEventsRequest = (function() { /** - * Properties of a Product. - * @memberof google.cloud.retail.v2alpha - * @interface IProduct - * @property {string|null} [name] Product name - * @property {string|null} [id] Product id - * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type - * @property {string|null} [primaryProductId] Product primaryProductId - * @property {Array.|null} [categories] Product categories - * @property {string|null} [title] Product title - * @property {string|null} [description] Product description - * @property {Object.|null} [attributes] Product attributes - * @property {Array.|null} [tags] Product tags - * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo - * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime - * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability - * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity - * @property {string|null} [uri] Product uri - * @property {Array.|null} [images] Product images + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope */ /** - * Constructs a new Product. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Product. - * @implements IProduct + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set */ - function Product(properties) { - this.categories = []; - this.attributes = {}; - this.tags = []; - this.images = []; + function RejoinUserEventsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16760,288 +22374,318 @@ } /** - * Product name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.Product + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest * @instance */ - Product.prototype.name = ""; + RejoinUserEventsRequest.prototype.parent = ""; /** - * Product id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.Product + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest * @instance */ - Product.prototype.id = ""; + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; /** - * Product type. - * @member {google.cloud.retail.v2alpha.Product.Type} type - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest instance */ - Product.prototype.type = 0; + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); + }; /** - * Product primaryProductId. - * @member {string} primaryProductId - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.primaryProductId = ""; + RejoinUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + return writer; + }; /** - * Product categories. - * @member {Array.} categories - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.categories = $util.emptyArray; + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product title. - * @member {string} title - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.title = ""; + RejoinUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEventRejoinScope = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product description. - * @member {string} description - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.description = ""; + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Verifies a RejoinUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.attributes = $util.emptyObject; + RejoinUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; /** - * Product tags. - * @member {Array.} tags - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest */ - Product.prototype.tags = $util.emptyArray; + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; /** - * Product priceInfo. - * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.priceInfo = null; + RejoinUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + return object; + }; /** - * Product availableTime. - * @member {google.protobuf.ITimestamp|null|undefined} availableTime - * @memberof google.cloud.retail.v2alpha.Product + * Converts this RejoinUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest * @instance + * @returns {Object.} JSON object */ - Product.prototype.availableTime = null; + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * Product availability. - * @member {google.cloud.retail.v2alpha.Product.Availability} availability - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value */ - Product.prototype.availability = 0; + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; + })(); + + return RejoinUserEventsRequest; + })(); + + v2.RejoinUserEventsResponse = (function() { /** - * Product availableQuantity. - * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount */ - Product.prototype.availableQuantity = null; /** - * Product uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set */ - Product.prototype.uri = ""; + function RejoinUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Product images. - * @member {Array.} images - * @memberof google.cloud.retail.v2alpha.Product + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @instance */ - Product.prototype.images = $util.emptyArray; + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new Product instance using the specified properties. + * Creates a new RejoinUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Product} Product instance + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse instance */ - Product.create = function create(properties) { - return new Product(properties); + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); }; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encode = function encode(message, writer) { + RejoinUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) - $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); - if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) - $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); - if (message.images != null && message.images.length) - for (var i = 0; i < message.images.length; ++i) - $root.google.cloud.retail.v2alpha.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); return writer; }; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encodeDelimited = function encodeDelimited(message, writer) { + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Product} Product + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decode = function decode(reader, length) { + RejoinUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Product(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); - break; - case 2: - message.id = reader.string(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 10: - message.description = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); + message.rejoinedUserEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -17052,405 +22696,120 @@ }; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Product} Product + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decodeDelimited = function decodeDelimited(reader) { + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Product message. + * Verifies a RejoinUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.verify = function verify(message) { + RejoinUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - if (!$util.isString(message.primaryProductId)) - return "primaryProductId: string expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) - if (!$util.isString(message.categories[i])) - return "categories: string[] expected"; - } - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; - } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.availableTime); - if (error) - return "availableTime." + error; - } - if (message.availability != null && message.hasOwnProperty("availability")) - switch (message.availability) { - default: - return "availability: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); - if (error) - return "availableQuantity." + error; - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.images != null && message.hasOwnProperty("images")) { - if (!Array.isArray(message.images)) - return "images: array expected"; - for (var i = 0; i < message.images.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Image.verify(message.images[i]); - if (error) - return "images." + error; - } - } + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; return null; }; /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Product} Product + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Product) + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.Product(); - if (object.name != null) - message.name = String(object.name); - if (object.id != null) - message.id = String(object.id); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "VARIANT": - case 2: - message.type = 2; - break; - case "COLLECTION": - case 3: - message.type = 3; - break; - } - if (object.primaryProductId != null) - message.primaryProductId = String(object.primaryProductId); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.retail.v2alpha.Product.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) - message.categories[i] = String(object.categories[i]); - } - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.retail.v2alpha.Product.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); - } - if (object.availableTime != null) { - if (typeof object.availableTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.availableTime: object expected"); - message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); - } - switch (object.availability) { - case "AVAILABILITY_UNSPECIFIED": - case 0: - message.availability = 0; - break; - case "IN_STOCK": - case 1: - message.availability = 1; - break; - case "OUT_OF_STOCK": - case 2: - message.availability = 2; - break; - case "PREORDER": - case 3: - message.availability = 3; - break; - case "BACKORDER": - case 4: - message.availability = 4; - break; - } - if (object.availableQuantity != null) { - if (typeof object.availableQuantity !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.availableQuantity: object expected"); - message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.images) { - if (!Array.isArray(object.images)) - throw TypeError(".google.cloud.retail.v2alpha.Product.images: array expected"); - message.images = []; - for (var i = 0; i < object.images.length; ++i) { - if (typeof object.images[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.images: object expected"); - message.images[i] = $root.google.cloud.retail.v2alpha.Image.fromObject(object.images[i]); - } - } + var message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.Product} message Product + * @param {google.cloud.retail.v2.RejoinUserEventsResponse} message RejoinUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Product.toObject = function toObject(message, options) { + RejoinUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.categories = []; - object.tags = []; - object.images = []; - } - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) { - object.name = ""; - object.id = ""; - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.primaryProductId = ""; - object.title = ""; - object.description = ""; - object.priceInfo = null; - object.availableTime = null; - object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; - object.availableQuantity = null; - object.uri = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - object.primaryProductId = message.primaryProductId; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = message.categories[j]; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); - if (message.availableTime != null && message.hasOwnProperty("availableTime")) - object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); - if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) - object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.images && message.images.length) { - object.images = []; - for (var j = 0; j < message.images.length; ++j) - object.images[j] = $root.google.cloud.retail.v2alpha.Image.toObject(message.images[j], options); - } + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; return object; }; /** - * Converts this Product to JSON. + * Converts this RejoinUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @instance * @returns {Object.} JSON object */ - Product.prototype.toJSON = function toJSON() { + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.retail.v2alpha.Product.Type - * @enum {number} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} VARIANT=2 VARIANT value - * @property {number} COLLECTION=3 COLLECTION value - */ - Product.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "VARIANT"] = 2; - values[valuesById[3] = "COLLECTION"] = 3; - return values; - })(); - - /** - * Availability enum. - * @name google.cloud.retail.v2alpha.Product.Availability - * @enum {number} - * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value - * @property {number} IN_STOCK=1 IN_STOCK value - * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value - * @property {number} PREORDER=3 PREORDER value - * @property {number} BACKORDER=4 BACKORDER value - */ - Product.Availability = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "IN_STOCK"] = 1; - values[valuesById[2] = "OUT_OF_STOCK"] = 2; - values[valuesById[3] = "PREORDER"] = 3; - values[valuesById[4] = "BACKORDER"] = 4; - return values; - })(); - - return Product; + return RejoinUserEventsResponse; })(); - v2alpha.UserEvent = (function() { + v2.RejoinUserEventsMetadata = (function() { /** - * Properties of a UserEvent. - * @memberof google.cloud.retail.v2alpha - * @interface IUserEvent - * @property {string|null} [eventType] UserEvent eventType - * @property {string|null} [visitorId] UserEvent visitorId - * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime - * @property {Array.|null} [experimentIds] UserEvent experimentIds - * @property {string|null} [attributionToken] UserEvent attributionToken - * @property {Array.|null} [productDetails] UserEvent productDetails - * @property {Object.|null} [attributes] UserEvent attributes - * @property {string|null} [cartId] UserEvent cartId - * @property {google.cloud.retail.v2alpha.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction - * @property {string|null} [searchQuery] UserEvent searchQuery - * @property {Array.|null} [pageCategories] UserEvent pageCategories - * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] UserEvent userInfo - * @property {string|null} [uri] UserEvent uri - * @property {string|null} [referrerUri] UserEvent referrerUri - * @property {string|null} [pageViewId] UserEvent pageViewId + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsMetadata */ /** - * Constructs a new UserEvent. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEvent. - * @implements IUserEvent + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set */ - function UserEvent(properties) { - this.experimentIds = []; - this.productDetails = []; - this.attributes = {}; - this.pageCategories = []; + function RejoinUserEventsMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17458,288 +22817,262 @@ } /** - * UserEvent eventType. - * @member {string} eventType - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance */ - UserEvent.prototype.eventType = ""; + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); + }; /** - * UserEvent visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.visitorId = ""; + RejoinUserEventsMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; /** - * UserEvent eventTime. - * @member {google.protobuf.ITimestamp|null|undefined} eventTime - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.eventTime = null; + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * UserEvent experimentIds. - * @member {Array.} experimentIds - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.experimentIds = $util.emptyArray; + RejoinUserEventsMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * UserEvent attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.attributionToken = ""; + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * UserEvent productDetails. - * @member {Array.} productDetails - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Verifies a RejoinUserEventsMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.prototype.productDetails = $util.emptyArray; + RejoinUserEventsMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; /** - * UserEvent attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata */ - UserEvent.prototype.attributes = $util.emptyObject; + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsMetadata) + return object; + return new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); + }; /** - * UserEvent cartId. - * @member {string} cartId - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - UserEvent.prototype.cartId = ""; + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; + }; /** - * UserEvent purchaseTransaction. - * @member {google.cloud.retail.v2alpha.IPurchaseTransaction|null|undefined} purchaseTransaction - * @memberof google.cloud.retail.v2alpha.UserEvent + * Converts this RejoinUserEventsMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @instance + * @returns {Object.} JSON object */ - UserEvent.prototype.purchaseTransaction = null; + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * UserEvent searchQuery. - * @member {string} searchQuery - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance - */ - UserEvent.prototype.searchQuery = ""; + return RejoinUserEventsMetadata; + })(); - /** - * UserEvent pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance - */ - UserEvent.prototype.pageCategories = $util.emptyArray; + return v2; + })(); + + retail.v2alpha = (function() { + + /** + * Namespace v2alpha. + * @memberof google.cloud.retail + * @namespace + */ + var v2alpha = {}; + + v2alpha.ProductLevelConfig = (function() { /** - * UserEvent userInfo. - * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Properties of a ProductLevelConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField */ - UserEvent.prototype.userInfo = null; /** - * UserEvent uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Constructs a new ProductLevelConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set */ - UserEvent.prototype.uri = ""; + function ProductLevelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * UserEvent referrerUri. - * @member {string} referrerUri - * @memberof google.cloud.retail.v2alpha.UserEvent + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @instance */ - UserEvent.prototype.referrerUri = ""; + ProductLevelConfig.prototype.ingestionProductType = ""; /** - * UserEvent pageViewId. - * @member {string} pageViewId - * @memberof google.cloud.retail.v2alpha.UserEvent + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @instance */ - UserEvent.prototype.pageViewId = ""; + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new ProductLevelConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static - * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent instance + * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig instance */ - UserEvent.create = function create(properties) { - return new UserEvent(properties); + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); }; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static - * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encode = function encode(message, writer) { + ProductLevelConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); - if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) - $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.experimentIds != null && message.experimentIds.length) - for (var i = 0; i < message.experimentIds.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.productDetails != null && message.productDetails.length) - for (var i = 0; i < message.productDetails.length; ++i) - $root.google.cloud.retail.v2alpha.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); - if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) - $root.google.cloud.retail.v2alpha.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); - if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); - if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); return writer; }; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static - * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a ProductLevelConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decode = function decode(reader, length) { + ProductLevelConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEvent(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.eventType = reader.string(); + message.ingestionProductType = reader.string(); break; case 2: - message.visitorId = reader.string(); - break; - case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); + message.merchantCenterProductIdField = reader.string(); break; default: reader.skipType(tag & 7); @@ -17750,299 +23083,119 @@ }; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decodeDelimited = function decodeDelimited(reader) { + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEvent message. + * Verifies a ProductLevelConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.verify = function verify(message) { + ProductLevelConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.eventType != null && message.hasOwnProperty("eventType")) - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.eventTime); - if (error) - return "eventTime." + error; - } - if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { - if (!Array.isArray(message.experimentIds)) - return "experimentIds: array expected"; - for (var i = 0; i < message.experimentIds.length; ++i) - if (!$util.isString(message.experimentIds[i])) - return "experimentIds: string[] expected"; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.productDetails != null && message.hasOwnProperty("productDetails")) { - if (!Array.isArray(message.productDetails)) - return "productDetails: array expected"; - for (var i = 0; i < message.productDetails.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.ProductDetail.verify(message.productDetails[i]); - if (error) - return "productDetails." + error; - } - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - if (!$util.isString(message.cartId)) - return "cartId: string expected"; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { - var error = $root.google.cloud.retail.v2alpha.PurchaseTransaction.verify(message.purchaseTransaction); - if (error) - return "purchaseTransaction." + error; - } - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - if (!$util.isString(message.searchQuery)) - return "searchQuery: string expected"; - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; - } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - if (!$util.isString(message.referrerUri)) - return "referrerUri: string expected"; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - if (!$util.isString(message.pageViewId)) - return "pageViewId: string expected"; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; return null; }; /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig */ - UserEvent.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEvent) + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductLevelConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEvent(); - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.eventTime != null) { - if (typeof object.eventTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.eventTime: object expected"); - message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); - } - if (object.experimentIds) { - if (!Array.isArray(object.experimentIds)) - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.experimentIds: array expected"); - message.experimentIds = []; - for (var i = 0; i < object.experimentIds.length; ++i) - message.experimentIds[i] = String(object.experimentIds[i]); - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.productDetails) { - if (!Array.isArray(object.productDetails)) - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: array expected"); - message.productDetails = []; - for (var i = 0; i < object.productDetails.length; ++i) { - if (typeof object.productDetails[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: object expected"); - message.productDetails[i] = $root.google.cloud.retail.v2alpha.ProductDetail.fromObject(object.productDetails[i]); - } - } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.cartId != null) - message.cartId = String(object.cartId); - if (object.purchaseTransaction != null) { - if (typeof object.purchaseTransaction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.purchaseTransaction: object expected"); - message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.fromObject(object.purchaseTransaction); - } - if (object.searchQuery != null) - message.searchQuery = String(object.searchQuery); - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.referrerUri != null) - message.referrerUri = String(object.referrerUri); - if (object.pageViewId != null) - message.pageViewId = String(object.pageViewId); + var message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); return message; }; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @static - * @param {google.cloud.retail.v2alpha.UserEvent} message UserEvent + * @param {google.cloud.retail.v2alpha.ProductLevelConfig} message ProductLevelConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEvent.toObject = function toObject(message, options) { + ProductLevelConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.experimentIds = []; - object.productDetails = []; - object.pageCategories = []; - } - if (options.objects || options.defaults) - object.attributes = {}; if (options.defaults) { - object.eventType = ""; - object.visitorId = ""; - object.eventTime = null; - object.attributionToken = ""; - object.cartId = ""; - object.purchaseTransaction = null; - object.searchQuery = ""; - object.userInfo = null; - object.uri = ""; - object.referrerUri = ""; - object.pageViewId = ""; - } - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) - object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); - if (message.experimentIds && message.experimentIds.length) { - object.experimentIds = []; - for (var j = 0; j < message.experimentIds.length; ++j) - object.experimentIds[j] = message.experimentIds[j]; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.productDetails && message.productDetails.length) { - object.productDetails = []; - for (var j = 0; j < message.productDetails.length; ++j) - object.productDetails[j] = $root.google.cloud.retail.v2alpha.ProductDetail.toObject(message.productDetails[j], options); - } - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - object.cartId = message.cartId; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) - object.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.toObject(message.purchaseTransaction, options); - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - object.searchQuery = message.searchQuery; - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - object.referrerUri = message.referrerUri; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - object.pageViewId = message.pageViewId; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; return object; }; /** - * Converts this UserEvent to JSON. + * Converts this ProductLevelConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig * @instance * @returns {Object.} JSON object */ - UserEvent.prototype.toJSON = function toJSON() { + ProductLevelConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEvent; + return ProductLevelConfig; })(); - v2alpha.ProductDetail = (function() { + v2alpha.MerchantCenterLink = (function() { /** - * Properties of a ProductDetail. + * Properties of a MerchantCenterLink. * @memberof google.cloud.retail.v2alpha - * @interface IProductDetail - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] ProductDetail product - * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + * @interface IMerchantCenterLink + * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId + * @property {string|null} [branchId] MerchantCenterLink branchId + * @property {Array.|null} [destinations] MerchantCenterLink destinations */ /** - * Constructs a new ProductDetail. + * Constructs a new MerchantCenterLink. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductDetail. - * @implements IProductDetail + * @classdesc Represents a MerchantCenterLink. + * @implements IMerchantCenterLink * @constructor - * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set */ - function ProductDetail(properties) { + function MerchantCenterLink(properties) { + this.destinations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18050,88 +23203,104 @@ } /** - * ProductDetail product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.ProductDetail + * MerchantCenterLink merchantCenterAccountId. + * @member {number|Long} merchantCenterAccountId + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @instance */ - ProductDetail.prototype.product = null; + MerchantCenterLink.prototype.merchantCenterAccountId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * ProductDetail quantity. - * @member {google.protobuf.IInt32Value|null|undefined} quantity - * @memberof google.cloud.retail.v2alpha.ProductDetail + * MerchantCenterLink branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @instance */ - ProductDetail.prototype.quantity = null; + MerchantCenterLink.prototype.branchId = ""; /** - * Creates a new ProductDetail instance using the specified properties. + * MerchantCenterLink destinations. + * @member {Array.} destinations + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.destinations = $util.emptyArray; + + /** + * Creates a new MerchantCenterLink instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail instance + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink instance */ - ProductDetail.create = function create(properties) { - return new ProductDetail(properties); + MerchantCenterLink.create = function create(properties) { + return new MerchantCenterLink(properties); }; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encode = function encode(message, writer) { + MerchantCenterLink.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) - $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.merchantCenterAccountId != null && Object.hasOwnProperty.call(message, "merchantCenterAccountId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.merchantCenterAccountId); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.destinations != null && message.destinations.length) + for (var i = 0; i < message.destinations.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); return writer; }; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + MerchantCenterLink.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a MerchantCenterLink message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decode = function decode(reader, length) { + MerchantCenterLink.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductDetail(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + message.merchantCenterAccountId = reader.int64(); break; case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + message.branchId = reader.string(); + break; + case 3: + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + message.destinations.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -18142,130 +23311,152 @@ }; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decodeDelimited = function decodeDelimited(reader) { + MerchantCenterLink.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductDetail message. + * Verifies a MerchantCenterLink message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductDetail.verify = function verify(message) { + MerchantCenterLink.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.quantity != null && message.hasOwnProperty("quantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.quantity); - if (error) - return "quantity." + error; + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (!$util.isInteger(message.merchantCenterAccountId) && !(message.merchantCenterAccountId && $util.isInteger(message.merchantCenterAccountId.low) && $util.isInteger(message.merchantCenterAccountId.high))) + return "merchantCenterAccountId: integer|Long expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + if (!$util.isString(message.destinations[i])) + return "destinations: string[] expected"; } return null; }; /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink */ - ProductDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductDetail) + MerchantCenterLink.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLink) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductDetail(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); - } - if (object.quantity != null) { - if (typeof object.quantity !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.quantity: object expected"); - message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); + if (object.merchantCenterAccountId != null) + if ($util.Long) + (message.merchantCenterAccountId = $util.Long.fromValue(object.merchantCenterAccountId)).unsigned = false; + else if (typeof object.merchantCenterAccountId === "string") + message.merchantCenterAccountId = parseInt(object.merchantCenterAccountId, 10); + else if (typeof object.merchantCenterAccountId === "number") + message.merchantCenterAccountId = object.merchantCenterAccountId; + else if (typeof object.merchantCenterAccountId === "object") + message.merchantCenterAccountId = new $util.LongBits(object.merchantCenterAccountId.low >>> 0, object.merchantCenterAccountId.high >>> 0).toNumber(); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLink.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + message.destinations[i] = String(object.destinations[i]); } return message; }; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.ProductDetail} message ProductDetail + * @param {google.cloud.retail.v2alpha.MerchantCenterLink} message MerchantCenterLink * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductDetail.toObject = function toObject(message, options) { + MerchantCenterLink.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.destinations = []; if (options.defaults) { - object.product = null; - object.quantity = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.merchantCenterAccountId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.merchantCenterAccountId = options.longs === String ? "0" : 0; + object.branchId = ""; + } + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (typeof message.merchantCenterAccountId === "number") + object.merchantCenterAccountId = options.longs === String ? String(message.merchantCenterAccountId) : message.merchantCenterAccountId; + else + object.merchantCenterAccountId = options.longs === String ? $util.Long.prototype.toString.call(message.merchantCenterAccountId) : options.longs === Number ? new $util.LongBits(message.merchantCenterAccountId.low >>> 0, message.merchantCenterAccountId.high >>> 0).toNumber() : message.merchantCenterAccountId; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = message.destinations[j]; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.quantity != null && message.hasOwnProperty("quantity")) - object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); return object; }; /** - * Converts this ProductDetail to JSON. + * Converts this MerchantCenterLink to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @instance * @returns {Object.} JSON object */ - ProductDetail.prototype.toJSON = function toJSON() { + MerchantCenterLink.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductDetail; + return MerchantCenterLink; })(); - v2alpha.PurchaseTransaction = (function() { + v2alpha.MerchantCenterLinkingConfig = (function() { /** - * Properties of a PurchaseTransaction. + * Properties of a MerchantCenterLinkingConfig. * @memberof google.cloud.retail.v2alpha - * @interface IPurchaseTransaction - * @property {string|null} [id] PurchaseTransaction id - * @property {number|null} [revenue] PurchaseTransaction revenue - * @property {number|null} [tax] PurchaseTransaction tax - * @property {number|null} [cost] PurchaseTransaction cost - * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + * @interface IMerchantCenterLinkingConfig + * @property {Array.|null} [links] MerchantCenterLinkingConfig links */ /** - * Constructs a new PurchaseTransaction. + * Constructs a new MerchantCenterLinkingConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurchaseTransaction. - * @implements IPurchaseTransaction + * @classdesc Represents a MerchantCenterLinkingConfig. + * @implements IMerchantCenterLinkingConfig * @constructor - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set */ - function PurchaseTransaction(properties) { + function MerchantCenterLinkingConfig(properties) { + this.links = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18273,127 +23464,78 @@ } /** - * PurchaseTransaction id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.id = ""; - - /** - * PurchaseTransaction revenue. - * @member {number} revenue - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.revenue = 0; - - /** - * PurchaseTransaction tax. - * @member {number} tax - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.tax = 0; - - /** - * PurchaseTransaction cost. - * @member {number} cost - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.cost = 0; - - /** - * PurchaseTransaction currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * MerchantCenterLinkingConfig links. + * @member {Array.} links + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @instance */ - PurchaseTransaction.prototype.currencyCode = ""; + MerchantCenterLinkingConfig.prototype.links = $util.emptyArray; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction instance + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig instance */ - PurchaseTransaction.create = function create(properties) { - return new PurchaseTransaction(properties); + MerchantCenterLinkingConfig.create = function create(properties) { + return new MerchantCenterLinkingConfig(properties); }; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encode = function encode(message, writer) { + MerchantCenterLinkingConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); - if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + if (message.links != null && message.links.length) + for (var i = 0; i < message.links.length; ++i) + $root.google.cloud.retail.v2alpha.MerchantCenterLink.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + MerchantCenterLinkingConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decode = function decode(reader, length) { + MerchantCenterLinkingConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.string(); - break; - case 2: - message.revenue = reader.float(); - break; - case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -18404,217 +23546,127 @@ }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + MerchantCenterLinkingConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurchaseTransaction message. + * Verifies a MerchantCenterLinkingConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurchaseTransaction.verify = function verify(message) { + MerchantCenterLinkingConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.revenue != null && message.hasOwnProperty("revenue")) - if (typeof message.revenue !== "number") - return "revenue: number expected"; - if (message.tax != null && message.hasOwnProperty("tax")) - if (typeof message.tax !== "number") - return "tax: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; + if (message.links != null && message.hasOwnProperty("links")) { + if (!Array.isArray(message.links)) + return "links: array expected"; + for (var i = 0; i < message.links.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLink.verify(message.links[i]); + if (error) + return "links." + error; + } + } return null; }; /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig */ - PurchaseTransaction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurchaseTransaction) + MerchantCenterLinkingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); - if (object.id != null) - message.id = String(object.id); - if (object.revenue != null) - message.revenue = Number(object.revenue); - if (object.tax != null) - message.tax = Number(object.tax); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); + var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); + if (object.links) { + if (!Array.isArray(object.links)) + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: array expected"); + message.links = []; + for (var i = 0; i < object.links.length; ++i) { + if (typeof object.links[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: object expected"); + message.links[i] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.fromObject(object.links[i]); + } + } return message; }; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2alpha.PurchaseTransaction} message PurchaseTransaction + * @param {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} message MerchantCenterLinkingConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurchaseTransaction.toObject = function toObject(message, options) { + MerchantCenterLinkingConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.id = ""; - object.revenue = 0; - object.tax = 0; - object.cost = 0; - object.currencyCode = ""; + if (options.arrays || options.defaults) + object.links = []; + if (message.links && message.links.length) { + object.links = []; + for (var j = 0; j < message.links.length; ++j) + object.links[j] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.toObject(message.links[j], options); } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.revenue != null && message.hasOwnProperty("revenue")) - object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; - if (message.tax != null && message.hasOwnProperty("tax")) - object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; return object; }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this MerchantCenterLinkingConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig * @instance * @returns {Object.} JSON object */ - PurchaseTransaction.prototype.toJSON = function toJSON() { + MerchantCenterLinkingConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurchaseTransaction; - })(); - - v2alpha.PredictionService = (function() { - - /** - * Constructs a new PredictionService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictionService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; - - /** - * Creates new PredictionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.PredictionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. - */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. - * @memberof google.cloud.retail.v2alpha.PredictionService - * @typedef PredictCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse - */ - - /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2alpha.PredictionService - * @instance - * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); - }, "name", { value: "Predict" }); - - /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2alpha.PredictionService - * @instance - * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return PredictionService; + return MerchantCenterLinkingConfig; })(); - v2alpha.PredictRequest = (function() { + v2alpha.Catalog = (function() { /** - * Properties of a PredictRequest. + * Properties of a Catalog. * @memberof google.cloud.retail.v2alpha - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * @property {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null} [merchantCenterLinkingConfig] Catalog merchantCenterLinkingConfig */ /** - * Constructs a new PredictRequest. + * Constructs a new Catalog. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest + * @classdesc Represents a Catalog. + * @implements ICatalog * @constructor - * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; + function Catalog(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18622,208 +23674,114 @@ } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.placement = ""; - - /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.userEvent = null; - - /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.pageSize = 0; - - /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.pageToken = ""; - - /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.PredictRequest + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Catalog * @instance */ - PredictRequest.prototype.filter = ""; + Catalog.prototype.name = ""; /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2alpha.PredictRequest + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Catalog * @instance */ - PredictRequest.prototype.validateOnly = false; + Catalog.prototype.displayName = ""; /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2alpha.PredictRequest + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2alpha.Catalog * @instance */ - PredictRequest.prototype.params = $util.emptyObject; + Catalog.prototype.productLevelConfig = null; /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2alpha.PredictRequest + * Catalog merchantCenterLinkingConfig. + * @member {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null|undefined} merchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.Catalog * @instance */ - PredictRequest.prototype.labels = $util.emptyObject; + Catalog.prototype.merchantCenterLinkingConfig = null; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new Catalog instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + Catalog.create = function create(properties) { + return new Catalog(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + Catalog.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.merchantCenterLinkingConfig != null && Object.hasOwnProperty.call(message, "merchantCenterLinkingConfig")) + $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.encode(message.merchantCenterLinkingConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + Catalog.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + Catalog.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); + message.name = reader.string(); break; case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); + message.displayName = reader.string(); break; case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); break; case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -18834,208 +23792,145 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + Catalog.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies a Catalog message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + Catalog.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); if (error) - return "userEvent." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } + return "productLevelConfig." + error; } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (error) + return "merchantCenterLinkingConfig." + error; } return null; }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } + var message = new $root.google.cloud.retail.v2alpha.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); + if (object.merchantCenterLinkingConfig != null) { + if (typeof object.merchantCenterLinkingConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); } return message; }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * Creates a plain object from a Catalog message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @static - * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest + * @param {google.cloud.retail.v2alpha.Catalog} message Catalog * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictRequest.toObject = function toObject(message, options) { + Catalog.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } if (options.defaults) { - object.placement = ""; - object.userEvent = null; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); - } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + object.merchantCenterLinkingConfig = null; } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) + object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); return object; }; /** - * Converts this PredictRequest to JSON. + * Converts this Catalog to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.Catalog * @instance * @returns {Object.} JSON object */ - PredictRequest.prototype.toJSON = function toJSON() { + Catalog.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PredictRequest; + return Catalog; })(); - v2alpha.PredictResponse = (function() { + v2alpha.Audience = (function() { /** - * Properties of a PredictResponse. + * Properties of an Audience. * @memberof google.cloud.retail.v2alpha - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups */ /** - * Constructs a new PredictResponse. + * Constructs a new Audience. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * @classdesc Represents an Audience. + * @implements IAudience * @constructor - * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function Audience(properties) { + this.genders = []; + this.ageGroups = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19043,120 +23938,336 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2alpha.PredictResponse + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2alpha.Audience * @instance */ - PredictResponse.prototype.results = $util.emptyArray; + Audience.prototype.genders = $util.emptyArray; /** - * PredictResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.PredictResponse + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2alpha.Audience * @instance */ - PredictResponse.prototype.attributionToken = ""; + Audience.prototype.ageGroups = $util.emptyArray; /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2alpha.PredictResponse + * Creates a new Audience instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Audience} Audience instance + */ + Audience.create = function create(properties) { + return new Audience(properties); + }; + + /** + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Audience.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); + return writer; + }; + + /** + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Audience.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Audience message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Audience} Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Audience.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Audience(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); + break; + case 2: + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Audience message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Audience} Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Audience.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Audience message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Audience.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; + } + return null; + }; + + /** + * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Audience} Audience + */ + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Audience) + return object; + var message = new $root.google.cloud.retail.v2alpha.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2alpha.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2alpha.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); + } + return message; + }; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {google.cloud.retail.v2alpha.Audience} message Audience + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Audience.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; + } + return object; + }; + + /** + * Converts this Audience to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Audience * @instance + * @returns {Object.} JSON object */ - PredictResponse.prototype.missingIds = $util.emptyArray; + Audience.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Audience; + })(); + + v2alpha.ColorInfo = (function() { /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2alpha.PredictResponse + * Properties of a ColorInfo. + * @memberof google.cloud.retail.v2alpha + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors + */ + + /** + * Constructs a new ColorInfo. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ColorInfo. + * @implements IColorInfo + * @constructor + * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set + */ + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance */ - PredictResponse.prototype.validateOnly = false; + ColorInfo.prototype.colorFamilies = $util.emptyArray; /** - * Creates a new PredictResponse instance using the specified properties. + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2alpha.ColorInfo + * @instance + */ + ColorInfo.prototype.colors = $util.emptyArray; + + /** + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + ColorInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); break; case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -19167,721 +24278,301 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; + } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ColorInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); - } - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); + var message = new $root.google.cloud.retail.v2alpha.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); + } + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2alpha.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; - } - if (options.defaults) { - object.attributionToken = ""; - object.validateOnly = false; + object.colorFamilies = []; + object.colors = []; } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PredictResponse.PredictionResult = (function() { + return ColorInfo; + })(); - /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata - */ + v2alpha.CustomAttribute = (function() { - /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a CustomAttribute. + * @memberof google.cloud.retail.v2alpha + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable + */ - /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.id = ""; + /** + * Constructs a new CustomAttribute. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute + * @constructor + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + */ + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.metadata = $util.emptyObject; + /** + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + CustomAttribute.prototype.text = $util.emptyArray; - /** - * Creates a new PredictionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance - */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); - }; - - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PredictionResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PredictionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); - if (error) - return "metadata." + error; - } - } - return null; - }; - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult - */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PredictionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.metadata = {}; - if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); - } - return object; - }; - - /** - * Converts this PredictionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @instance - * @returns {Object.} JSON object - */ - PredictionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PredictionResult; - })(); - - return PredictResponse; - })(); - - v2alpha.ProductService = (function() { - - /** - * Constructs a new ProductService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; - - /** - * Creates new ProductService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.ProductService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. - */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "CreateProduct" }); + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product - */ - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "GetProduct" }); - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product - */ - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2alpha.ProductService + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); + CustomAttribute.prototype.searchable = null; /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2alpha.ProductService + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductService; - })(); - - v2alpha.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ - - /** - * Constructs a new CreateProductRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest - * @constructor - * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set */ - function CreateProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + CustomAttribute.prototype.indexable = null; - /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - CreateProductRequest.prototype.product = null; + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - CreateProductRequest.prototype.productId = ""; + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new CustomAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); }; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encode = function encode(message, writer) { + CustomAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decode = function decode(reader, length) { + CustomAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); break; case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); break; case 3: - message.productId = reader.string(); + message.searchable = reader.bool(); break; - default: + case 4: + message.indexable = reader.bool(); + break; + default: reader.skipType(tag & 7); break; } @@ -19890,129 +24581,167 @@ }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProductRequest message. + * Verifies a CustomAttribute message. * @function verify - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProductRequest.verify = function verify(message) { + CustomAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; return null; }; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) return object; - var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); } - if (object.productId != null) - message.productId = String(object.productId); + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); return message; }; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest + * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProductRequest.toObject = function toObject(message, options) { + CustomAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; + if (options.oneofs) + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; return object; }; /** - * Converts this CreateProductRequest to JSON. + * Converts this CustomAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { + CustomAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateProductRequest; + return CustomAttribute; })(); - v2alpha.GetProductRequest = (function() { + v2alpha.FulfillmentInfo = (function() { /** - * Properties of a GetProductRequest. + * Properties of a FulfillmentInfo. * @memberof google.cloud.retail.v2alpha - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds */ /** - * Constructs a new GetProductRequest. + * Constructs a new FulfillmentInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo * @constructor - * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set */ - function GetProductRequest(properties) { + function FulfillmentInfo(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20020,75 +24749,91 @@ } /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance */ - GetProductRequest.prototype.name = ""; + FulfillmentInfo.prototype.type = ""; /** - * Creates a new GetProductRequest instance using the specified properties. + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @instance + */ + FulfillmentInfo.prototype.placeIds = $util.emptyArray; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo instance */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encode = function encode(message, writer) { + FulfillmentInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + FulfillmentInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.type = reader.string(); + break; + case 2: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -20099,108 +24844,130 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a FulfillmentInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + FulfillmentInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } return null; }; /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.FulfillmentInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } return message; }; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest + * @param {google.cloud.retail.v2alpha.FulfillmentInfo} message FulfillmentInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProductRequest.toObject = function toObject(message, options) { + FulfillmentInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } return object; }; /** - * Converts this GetProductRequest to JSON. + * Converts this FulfillmentInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance * @returns {Object.} JSON object */ - GetProductRequest.prototype.toJSON = function toJSON() { + FulfillmentInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProductRequest; + return FulfillmentInfo; })(); - v2alpha.UpdateProductRequest = (function() { + v2alpha.Image = (function() { /** - * Properties of an UpdateProductRequest. + * Properties of an Image. * @memberof google.cloud.retail.v2alpha - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width */ /** - * Constructs a new UpdateProductRequest. + * Constructs a new Image. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set */ - function UpdateProductRequest(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20208,88 +24975,101 @@ } /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - UpdateProductRequest.prototype.product = null; + Image.prototype.uri = ""; /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - UpdateProductRequest.prototype.updateMask = null; + Image.prototype.height = 0; /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2alpha.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Image} Image instance */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); return writer; }; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2alpha.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decode = function decode(reader, length) { + Image.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + message.uri = reader.string(); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); break; default: reader.skipType(tag & 7); @@ -20300,126 +25080,127 @@ }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2alpha.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateProductRequest message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateProductRequest.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; return null; }; /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2alpha.Image} Image */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Image) return object; - var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } + var message = new $root.google.cloud.retail.v2alpha.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; return message; }; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest + * @param {google.cloud.retail.v2alpha.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateProductRequest.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.product = null; - object.updateMask = null; + object.uri = ""; + object.height = 0; + object.width = 0; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; return object; }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.Image * @instance * @returns {Object.} JSON object */ - UpdateProductRequest.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateProductRequest; + return Image; })(); - v2alpha.DeleteProductRequest = (function() { + v2alpha.Interval = (function() { /** - * Properties of a DeleteProductRequest. + * Properties of an Interval. * @memberof google.cloud.retail.v2alpha - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum */ /** - * Constructs a new DeleteProductRequest. + * Constructs a new Interval. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest + * @classdesc Represents an Interval. + * @implements IInterval * @constructor - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set */ - function DeleteProductRequest(properties) { + function Interval(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20427,75 +25208,139 @@ } /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - DeleteProductRequest.prototype.name = ""; + Interval.prototype.minimum = null; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Interval.prototype.exclusiveMinimum = null; + + /** + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Interval.prototype.maximum = null; + + /** + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Interval instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance + * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Interval} Interval instance */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); + Interval.create = function create(properties) { + return new Interval(properties); }; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encode = function encode(message, writer) { + Interval.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); return writer; }; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + Interval.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2alpha.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decode = function decode(reader, length) { + Interval.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Interval(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.minimum = reader.double(); + break; + case 2: + message.exclusiveMinimum = reader.double(); + break; + case 3: + message.maximum = reader.double(); + break; + case 4: + message.exclusiveMaximum = reader.double(); break; default: reader.skipType(tag & 7); @@ -20506,106 +25351,157 @@ }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2alpha.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + Interval.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProductRequest message. + * Verifies an Interval message. * @function verify - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProductRequest.verify = function verify(message) { + Interval.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; + } return null; }; /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2alpha.Interval} Interval */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Interval) return object; - var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2alpha.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); return message; }; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * Creates a plain object from an Interval message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest + * @param {google.cloud.retail.v2alpha.Interval} message Interval * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProductRequest.toObject = function toObject(message, options) { + Interval.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; + } return object; }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this Interval to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.Interval * @instance * @returns {Object.} JSON object */ - DeleteProductRequest.prototype.toJSON = function toJSON() { + Interval.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteProductRequest; + return Interval; })(); - v2alpha.PurgeMetadata = (function() { + v2alpha.PriceInfo = (function() { /** - * Properties of a PurgeMetadata. + * Properties of a PriceInfo. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeMetadata + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange */ /** - * Constructs a new PurgeMetadata. + * Constructs a new PriceInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function PriceInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20613,63 +25509,154 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.currencyCode = ""; + + /** + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; + + /** + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.originalPrice = 0; + + /** + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceEffectiveTime = null; + + /** + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceExpireTime = null; + + /** + * PriceInfo priceRange. + * @member {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceRange = null; + + /** + * Creates a new PriceInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); }; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encode = function encode(message, writer) { + PriceInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decode = function decode(reader, length) { + PriceInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -20679,96 +25666,394 @@ }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + PriceInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeMetadata message. + * Verifies a PriceInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeMetadata.verify = function verify(message) { + PriceInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; + } return null; }; /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) return object; - return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.fromObject(object.priceRange); + } + return message; }; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata + * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeMetadata.toObject = function toObject() { - return {}; + PriceInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.toObject(message.priceRange, options); + return object; }; /** - * Converts this PurgeMetadata to JSON. + * Converts this PriceInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.PriceInfo * @instance * @returns {Object.} JSON object */ - PurgeMetadata.prototype.toJSON = function toJSON() { + PriceInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeMetadata; + PriceInfo.PriceRange = (function() { + + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2alpha.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2alpha.IInterval|null} [originalPrice] PriceRange originalPrice + */ + + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceRange price. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; + + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; + + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2alpha.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2alpha.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + + return PriceInfo; })(); - v2alpha.PurgeUserEventsRequest = (function() { + v2alpha.Rating = (function() { /** - * Properties of a PurgeUserEventsRequest. + * Properties of a Rating. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram */ /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new Rating. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest + * @classdesc Represents a Rating. + * @implements IRating * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set */ - function PurgeUserEventsRequest(properties) { + function Rating(properties) { + this.ratingHistogram = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20776,101 +26061,112 @@ } /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - PurgeUserEventsRequest.prototype.parent = ""; + Rating.prototype.ratingCount = 0; /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - PurgeUserEventsRequest.prototype.filter = ""; + Rating.prototype.averageRating = 0; /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - PurgeUserEventsRequest.prototype.force = false; + Rating.prototype.ratingHistogram = $util.emptyArray; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new Rating instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rating} Rating instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + Rating.create = function create(properties) { + return new Rating(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + Rating.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + Rating.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a Rating message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + Rating.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rating(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.ratingCount = reader.int32(); break; case 2: - message.filter = reader.string(); + message.averageRating = reader.float(); break; case 3: - message.force = reader.bool(); + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -20881,124 +26177,140 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a Rating message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + Rating.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a Rating message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + Rating.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; + } return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Rating message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.Rating} Rating */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rating) return object; - var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); + var message = new $root.google.cloud.retail.v2alpha.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2alpha.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; + } return message; }; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a Rating message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {google.cloud.retail.v2alpha.Rating} message Rating * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { + Rating.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.ratingHistogram = []; if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; + object.ratingCount = 0; + object.averageRating = 0; + } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; return object; }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this Rating to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + Rating.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + return Rating; })(); - v2alpha.PurgeUserEventsResponse = (function() { + v2alpha.UserInfo = (function() { /** - * Properties of a PurgeUserEventsResponse. + * Properties of a UserInfo. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest */ /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new UserInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * @classdesc Represents a UserInfo. + * @implements IUserInfo * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function UserInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21006,75 +26318,114 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + UserInfo.prototype.userId = ""; /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.ipAddress = ""; + + /** + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); + UserInfo.create = function create(properties) { + return new UserInfo(properties); }; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encode = function encode(message, writer) { + UserInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); return writer; }; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a UserInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + UserInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.purgedEventsCount = reader.int64(); + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); break; default: reader.skipType(tag & 7); @@ -21085,322 +26436,132 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a UserInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + UserInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a UserInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsResponse.verify = function verify(message) { + UserInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; return null; }; /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); return message; }; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { + UserInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; + } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this UserInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance * @returns {Object.} JSON object */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + UserInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsResponse; - })(); - - v2alpha.UserEventService = (function() { - - /** - * Constructs a new UserEventService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function UserEventService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; - - /** - * Creates new UserEventService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.UserEventService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. - */ - UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef WriteUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.UserEvent} [response] UserEvent - */ - - /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { - return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2alpha.WriteUserEventRequest, $root.google.cloud.retail.v2alpha.UserEvent, request, callback); - }, "name", { value: "WriteUserEvent" }); - - /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef CollectUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.api.HttpBody} [response] HttpBody - */ - - /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { - return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2alpha.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); - }, "name", { value: "CollectUserEvent" }); - - /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef PurgeUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { - return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "PurgeUserEvents" }); - - /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef ImportUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { - return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2alpha.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportUserEvents" }); - - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef RejoinUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { - return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RejoinUserEvents" }); - - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return UserEventService; + return UserInfo; })(); - v2alpha.WriteUserEventRequest = (function() { + v2alpha.Promotion = (function() { /** - * Properties of a WriteUserEventRequest. + * Properties of a Promotion. * @memberof google.cloud.retail.v2alpha - * @interface IWriteUserEventRequest - * @property {string|null} [parent] WriteUserEventRequest parent - * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId */ /** - * Constructs a new WriteUserEventRequest. + * Constructs a new Promotion. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a WriteUserEventRequest. - * @implements IWriteUserEventRequest + * @classdesc Represents a Promotion. + * @implements IPromotion * @constructor - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set */ - function WriteUserEventRequest(properties) { + function Promotion(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21408,88 +26569,75 @@ } /** - * WriteUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.parent = ""; - - /** - * WriteUserEventRequest userEvent. - * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2alpha.Promotion * @instance */ - WriteUserEventRequest.prototype.userEvent = null; + Promotion.prototype.promotionId = ""; /** - * Creates a new WriteUserEventRequest instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest instance + * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion instance */ - WriteUserEventRequest.create = function create(properties) { - return new WriteUserEventRequest(properties); + Promotion.create = function create(properties) { + return new Promotion(properties); }; /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WriteUserEventRequest.encode = function encode(message, writer) { + Promotion.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); return writer; }; /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + Promotion.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WriteUserEventRequest.decode = function decode(reader, length) { + Promotion.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Promotion(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + message.promotionId = reader.string(); break; default: reader.skipType(tag & 7); @@ -21500,124 +26648,109 @@ }; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + Promotion.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WriteUserEventRequest message. + * Verifies a Promotion message. * @function verify - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WriteUserEventRequest.verify = function verify(message) { + Promotion.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; return null; }; /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion */ - WriteUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.WriteUserEventRequest) + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Promotion) return object; - var message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2alpha.WriteUserEventRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); - } + var message = new $root.google.cloud.retail.v2alpha.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); return message; }; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * Creates a plain object from a Promotion message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.WriteUserEventRequest} message WriteUserEventRequest + * @param {google.cloud.retail.v2alpha.Promotion} message Promotion * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WriteUserEventRequest.toObject = function toObject(message, options) { + Promotion.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; return object; }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this Promotion to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @instance * @returns {Object.} JSON object */ - WriteUserEventRequest.prototype.toJSON = function toJSON() { + Promotion.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WriteUserEventRequest; + return Promotion; })(); - v2alpha.CollectUserEventRequest = (function() { + v2alpha.GcsSource = (function() { /** - * Properties of a CollectUserEventRequest. + * Properties of a GcsSource. * @memberof google.cloud.retail.v2alpha - * @interface ICollectUserEventRequest - * @property {string|null} [parent] CollectUserEventRequest parent - * @property {string|null} [userEvent] CollectUserEventRequest userEvent - * @property {string|null} [uri] CollectUserEventRequest uri - * @property {number|Long|null} [ets] CollectUserEventRequest ets + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema */ /** - * Constructs a new CollectUserEventRequest. + * Constructs a new GcsSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CollectUserEventRequest. - * @implements ICollectUserEventRequest + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set */ - function CollectUserEventRequest(properties) { + function GcsSource(properties) { + this.inputUris = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21625,114 +26758,91 @@ } /** - * CollectUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @instance - */ - CollectUserEventRequest.prototype.parent = ""; - - /** - * CollectUserEventRequest userEvent. - * @member {string} userEvent - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @instance - */ - CollectUserEventRequest.prototype.userEvent = ""; - - /** - * CollectUserEventRequest uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance */ - CollectUserEventRequest.prototype.uri = ""; + GcsSource.prototype.inputUris = $util.emptyArray; /** - * CollectUserEventRequest ets. - * @member {number|Long} ets - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance */ - CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + GcsSource.prototype.dataSchema = ""; /** - * Creates a new CollectUserEventRequest instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest instance + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance */ - CollectUserEventRequest.create = function create(properties) { - return new CollectUserEventRequest(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CollectUserEventRequest.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); - if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); return writer; }; /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CollectUserEventRequest.decode = function decode(reader, length) { + GcsSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); break; case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -21743,147 +26853,133 @@ }; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CollectUserEventRequest message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CollectUserEventRequest.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - if (!$util.isString(message.userEvent)) - return "userEvent: string expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.ets != null && message.hasOwnProperty("ets")) - if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) - return "ets: integer|Long expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource */ - CollectUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CollectUserEventRequest) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) return object; - var message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) - message.userEvent = String(object.userEvent); - if (object.uri != null) - message.uri = String(object.uri); - if (object.ets != null) - if ($util.Long) - (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; - else if (typeof object.ets === "string") - message.ets = parseInt(object.ets, 10); - else if (typeof object.ets === "number") - message.ets = object.ets; - else if (typeof object.ets === "object") - message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); + } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.CollectUserEventRequest} message CollectUserEventRequest + * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CollectUserEventRequest.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = ""; - object.uri = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.ets = options.longs === String ? "0" : 0; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = message.userEvent; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.ets != null && message.hasOwnProperty("ets")) - if (typeof message.ets === "number") - object.ets = options.longs === String ? String(message.ets) : message.ets; - else - object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; return object; }; /** - * Converts this CollectUserEventRequest to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance * @returns {Object.} JSON object */ - CollectUserEventRequest.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CollectUserEventRequest; + return GcsSource; })(); - v2alpha.RejoinUserEventsRequest = (function() { + v2alpha.BigQuerySource = (function() { /** - * Properties of a RejoinUserEventsRequest. + * Properties of a BigQuerySource. * @memberof google.cloud.retail.v2alpha - * @interface IRejoinUserEventsRequest - * @property {string|null} [parent] RejoinUserEventsRequest parent - * @property {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema */ /** - * Constructs a new RejoinUserEventsRequest. + * Constructs a new BigQuerySource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RejoinUserEventsRequest. - * @implements IRejoinUserEventsRequest + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource * @constructor - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set */ - function RejoinUserEventsRequest(properties) { + function BigQuerySource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21891,88 +26987,154 @@ } /** - * RejoinUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance */ - RejoinUserEventsRequest.prototype.parent = ""; + BigQuerySource.prototype.partitionDate = null; /** - * RejoinUserEventsRequest userEventRejoinScope. - * @member {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance */ - RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + BigQuerySource.prototype.projectId = ""; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BigQuerySource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance */ - RejoinUserEventsRequest.create = function create(properties) { - return new RejoinUserEventsRequest(properties); + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); }; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsRequest.encode = function encode(message, writer) { + BigQuerySource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsRequest.decode = function decode(reader, length) { + BigQuerySource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 5: + message.projectId = reader.string(); + break; case 1: - message.parent = reader.string(); + message.datasetId = reader.string(); break; case 2: - message.userEventRejoinScope = reader.int32(); + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -21983,150 +27145,160 @@ }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsRequest message. + * Verifies a BigQuerySource message. * @function verify - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsRequest.verify = function verify(message) { + BigQuerySource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - switch (message.userEventRejoinScope) { - default: - return "userEventRejoinScope: enum value expected"; - case 0: - case 1: - case 2: - break; + var properties = {}; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; + { + var error = $root.google.type.Date.verify(message.partitionDate); + if (error) + return "partitionDate." + error; } + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource */ - RejoinUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest) + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) return object; - var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - switch (object.userEventRejoinScope) { - case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": - case 0: - message.userEventRejoinScope = 0; - break; - case "JOINED_EVENTS": - case 1: - message.userEventRejoinScope = 1; - break; - case "UNJOINED_EVENTS": - case 2: - message.userEventRejoinScope = 2; - break; + var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2alpha.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); } + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsRequest.toObject = function toObject(message, options) { + BigQuerySource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (options.oneofs) + object.partition = "partitionDate"; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; return object; }; /** - * Converts this RejoinUserEventsRequest to JSON. + * Converts this BigQuerySource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance * @returns {Object.} JSON object */ - RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + BigQuerySource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * UserEventRejoinScope enum. - * @name google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope - * @enum {number} - * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value - * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value - * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value - */ - RejoinUserEventsRequest.UserEventRejoinScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "JOINED_EVENTS"] = 1; - values[valuesById[2] = "UNJOINED_EVENTS"] = 2; - return values; - })(); - - return RejoinUserEventsRequest; + return BigQuerySource; })(); - v2alpha.RejoinUserEventsResponse = (function() { + v2alpha.ProductInlineSource = (function() { /** - * Properties of a RejoinUserEventsResponse. + * Properties of a ProductInlineSource. * @memberof google.cloud.retail.v2alpha - * @interface IRejoinUserEventsResponse - * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products */ /** - * Constructs a new RejoinUserEventsResponse. + * Constructs a new ProductInlineSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RejoinUserEventsResponse. - * @implements IRejoinUserEventsResponse + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource * @constructor - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set */ - function RejoinUserEventsResponse(properties) { + function ProductInlineSource(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22134,75 +27306,78 @@ } /** - * RejoinUserEventsResponse rejoinedUserEventsCount. - * @member {number|Long} rejoinedUserEventsCount - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @instance */ - RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ProductInlineSource.prototype.products = $util.emptyArray; /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance */ - RejoinUserEventsResponse.create = function create(properties) { - return new RejoinUserEventsResponse(properties); + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); }; /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsResponse.encode = function encode(message, writer) { + ProductInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsResponse.decode = function decode(reader, length) { + ProductInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.rejoinedUserEventsCount = reader.int64(); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -22213,120 +27388,125 @@ }; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsResponse message. + * Verifies a ProductInlineSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsResponse.verify = function verify(message) { + ProductInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) - return "rejoinedUserEventsCount: integer|Long expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } return null; }; /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource */ - RejoinUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse) + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) return object; - var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); - if (object.rejoinedUserEventsCount != null) - if ($util.Long) - (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; - else if (typeof object.rejoinedUserEventsCount === "string") - message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); - else if (typeof object.rejoinedUserEventsCount === "number") - message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; - else if (typeof object.rejoinedUserEventsCount === "object") - message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } + } return message; }; /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsResponse.toObject = function toObject(message, options) { + ProductInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (typeof message.rejoinedUserEventsCount === "number") - object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; - else - object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); + } return object; }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this ProductInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @instance * @returns {Object.} JSON object */ - RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + ProductInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RejoinUserEventsResponse; + return ProductInlineSource; })(); - v2alpha.RejoinUserEventsMetadata = (function() { + v2alpha.UserEventInlineSource = (function() { /** - * Properties of a RejoinUserEventsMetadata. + * Properties of a UserEventInlineSource. * @memberof google.cloud.retail.v2alpha - * @interface IRejoinUserEventsMetadata + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents */ /** - * Constructs a new RejoinUserEventsMetadata. + * Constructs a new UserEventInlineSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RejoinUserEventsMetadata. - * @implements IRejoinUserEventsMetadata + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource * @constructor - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set */ - function RejoinUserEventsMetadata(properties) { + function UserEventInlineSource(properties) { + this.userEvents = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22334,63 +27514,79 @@ } /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance */ - RejoinUserEventsMetadata.create = function create(properties) { - return new RejoinUserEventsMetadata(properties); + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); }; /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsMetadata.encode = function encode(message, writer) { + UserEventInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsMetadata.decode = function decode(reader, length) { + UserEventInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -22400,107 +27596,124 @@ }; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsMetadata message. + * Verifies a UserEventInlineSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsMetadata.verify = function verify(message) { + UserEventInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } + } return null; }; /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource */ - RejoinUserEventsMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata) + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) return object; - return new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); + var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); + } + } + return message; }; /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsMetadata.toObject = function toObject() { - return {}; + UserEventInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); + } + return object; }; /** - * Converts this RejoinUserEventsMetadata to JSON. + * Converts this UserEventInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @instance * @returns {Object.} JSON object */ - RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + UserEventInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RejoinUserEventsMetadata; + return UserEventInlineSource; })(); - return v2alpha; - })(); - - retail.v2beta = (function() { - - /** - * Namespace v2beta. - * @memberof google.cloud.retail - * @namespace - */ - var v2beta = {}; - - v2beta.ProductLevelConfig = (function() { + v2alpha.ImportErrorsConfig = (function() { /** - * Properties of a ProductLevelConfig. - * @memberof google.cloud.retail.v2beta - * @interface IProductLevelConfig - * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType - * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + * Properties of an ImportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix */ /** - * Constructs a new ProductLevelConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductLevelConfig. - * @implements IProductLevelConfig + * Constructs a new ImportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig * @constructor - * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set */ - function ProductLevelConfig(properties) { + function ImportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22508,88 +27721,89 @@ } /** - * ProductLevelConfig ingestionProductType. - * @member {string} ingestionProductType - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ProductLevelConfig.prototype.ingestionProductType = ""; + ImportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ProductLevelConfig merchantCenterProductIdField. - * @member {string} merchantCenterProductIdField - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ProductLevelConfig instance using the specified properties. + * Creates a new ImportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig instance + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance */ - ProductLevelConfig.create = function create(properties) { - return new ProductLevelConfig(properties); + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); }; /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductLevelConfig.encode = function encode(message, writer) { + ImportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); - if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. + * Decodes an ImportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductLevelConfig.decode = function decode(reader, length) { + ImportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.ingestionProductType = reader.string(); - break; - case 2: - message.merchantCenterProductIdField = reader.string(); + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -22600,118 +27814,117 @@ }; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductLevelConfig message. + * Verifies an ImportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductLevelConfig.verify = function verify(message) { + ImportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - if (!$util.isString(message.ingestionProductType)) - return "ingestionProductType: string expected"; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - if (!$util.isString(message.merchantCenterProductIdField)) - return "merchantCenterProductIdField: string expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } return null; }; /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig */ - ProductLevelConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductLevelConfig) + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); - if (object.ingestionProductType != null) - message.ingestionProductType = String(object.ingestionProductType); - if (object.merchantCenterProductIdField != null) - message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.ProductLevelConfig} message ProductLevelConfig + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductLevelConfig.toObject = function toObject(message, options) { + ImportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.ingestionProductType = ""; - object.merchantCenterProductIdField = ""; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - object.ingestionProductType = message.ingestionProductType; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - object.merchantCenterProductIdField = message.merchantCenterProductIdField; return object; }; /** - * Converts this ProductLevelConfig to JSON. + * Converts this ImportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance * @returns {Object.} JSON object */ - ProductLevelConfig.prototype.toJSON = function toJSON() { + ImportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductLevelConfig; + return ImportErrorsConfig; })(); - v2beta.Catalog = (function() { + v2alpha.ImportProductsRequest = (function() { /** - * Properties of a Catalog. - * @memberof google.cloud.retail.v2beta - * @interface ICatalog - * @property {string|null} [name] Catalog name - * @property {string|null} [displayName] Catalog displayName - * @property {google.cloud.retail.v2beta.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * Properties of an ImportProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic */ /** - * Constructs a new Catalog. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Catalog. - * @implements ICatalog + * Constructs a new ImportProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest * @constructor - * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set */ - function Catalog(properties) { + function ImportProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22719,101 +27932,153 @@ } /** - * Catalog name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.Catalog + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - Catalog.prototype.name = ""; + ImportProductsRequest.prototype.parent = ""; /** - * Catalog displayName. - * @member {string} displayName - * @memberof google.cloud.retail.v2beta.Catalog + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - Catalog.prototype.displayName = ""; + ImportProductsRequest.prototype.requestId = ""; /** - * Catalog productLevelConfig. - * @member {google.cloud.retail.v2beta.IProductLevelConfig|null|undefined} productLevelConfig - * @memberof google.cloud.retail.v2beta.Catalog + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - Catalog.prototype.productLevelConfig = null; + ImportProductsRequest.prototype.inputConfig = null; /** - * Creates a new Catalog instance using the specified properties. + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Catalog} Catalog instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance */ - Catalog.create = function create(properties) { - return new Catalog(properties); + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); }; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encode = function encode(message, writer) { + ImportProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) - $root.google.cloud.retail.v2beta.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decode = function decode(reader, length) { + ImportProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Catalog(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.parent = reader.string(); + break; + case 6: + message.requestId = reader.string(); break; case 2: - message.displayName = reader.string(); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; case 4: - message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -22824,232 +28089,207 @@ }; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decodeDelimited = function decodeDelimited(reader) { + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Catalog message. + * Verifies an ImportProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Catalog.verify = function verify(message) { + ImportProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2beta.ProductLevelConfig.verify(message.productLevelConfig); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); if (error) - return "productLevelConfig." + error; + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Catalog) + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) return object; - var message = new $root.google.cloud.retail.v2beta.Catalog(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.fromObject(object.productLevelConfig); + var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2beta.Catalog} message Catalog + * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Catalog.toObject = function toObject(message, options) { + ImportProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this Catalog to JSON. + * Converts this ImportProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Catalog + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance * @returns {Object.} JSON object */ - Catalog.prototype.toJSON = function toJSON() { + ImportProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Catalog; - })(); - - v2beta.CatalogService = (function() { - - /** - * Constructs a new CatalogService service. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CatalogService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2beta.CatalogService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. - */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. - * @memberof google.cloud.retail.v2beta.CatalogService - * @typedef ListCatalogsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.ListCatalogsResponse} [response] ListCatalogsResponse - */ - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2beta.CatalogService - * @instance - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2beta.ListCatalogsRequest, $root.google.cloud.retail.v2beta.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2beta.CatalogService - * @instance - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. - * @memberof google.cloud.retail.v2beta.CatalogService - * @typedef UpdateCatalogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Catalog} [response] Catalog - */ - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2beta.CatalogService - * @instance - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2beta.UpdateCatalogRequest, $root.google.cloud.retail.v2beta.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2beta.CatalogService - * @instance - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * ReconciliationMode enum. + * @name google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); - return CatalogService; + return ImportProductsRequest; })(); - v2beta.ListCatalogsRequest = (function() { + v2alpha.ImportUserEventsRequest = (function() { /** - * Properties of a ListCatalogsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * Properties of an ImportUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig */ /** - * Constructs a new ListCatalogsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * Constructs a new ImportUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest * @constructor - * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function ImportUserEventsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23057,90 +28297,90 @@ } /** - * ListCatalogsRequest parent. + * ImportUserEventsRequest parent. * @member {string} parent - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - ListCatalogsRequest.prototype.parent = ""; + ImportUserEventsRequest.prototype.parent = ""; /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - ListCatalogsRequest.prototype.pageSize = 0; + ImportUserEventsRequest.prototype.inputConfig = null; /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + ImportUserEventsRequest.prototype.errorsConfig = null; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new ImportUserEventsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + ImportUserEventsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + ImportUserEventsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -23148,10 +28388,10 @@ message.parent = reader.string(); break; case 2: - message.pageSize = reader.int32(); + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); break; case 3: - message.pageToken = reader.string(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23162,126 +28402,136 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies an ImportUserEventsRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + ImportUserEventsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsRequest) + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) return object; - var message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); if (object.parent != null) message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + ImportUserEventsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; + object.inputConfig = null; + object.errorsConfig = null; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ImportUserEventsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance * @returns {Object.} JSON object */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { + ImportUserEventsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsRequest; + return ImportUserEventsRequest; })(); - v2beta.ListCatalogsResponse = (function() { + v2alpha.ImportCompletionDataRequest = (function() { /** - * Properties of a ListCatalogsResponse. - * @memberof google.cloud.retail.v2beta - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + * Properties of an ImportCompletionDataRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic */ /** - * Constructs a new ListCatalogsResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse + * Constructs a new ImportCompletionDataRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest * @constructor - * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set */ - function ListCatalogsResponse(properties) { - this.catalogs = []; + function ImportCompletionDataRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23289,91 +28539,101 @@ } /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + ImportCompletionDataRequest.prototype.parent = ""; /** - * ListCatalogsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - ListCatalogsResponse.prototype.nextPageToken = ""; + ImportCompletionDataRequest.prototype.inputConfig = null; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest instance */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); }; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encode = function encode(message, writer) { + ImportCompletionDataRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2beta.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decode = function decode(reader, length) { + ImportCompletionDataRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.nextPageToken = reader.string(); + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -23384,134 +28644,131 @@ }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsResponse message. + * Verifies an ImportCompletionDataRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsResponse.verify = function verify(message) { + ImportCompletionDataRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalogs[i]); - if (error) - return "catalogs." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsResponse) + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest) return object; - var message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalogs[i]); - } + var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.inputConfig); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2beta.ListCatalogsResponse} message ListCatalogsResponse + * @param {google.cloud.retail.v2alpha.ImportCompletionDataRequest} message ImportCompletionDataRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsResponse.toObject = function toObject(message, options) { + ImportCompletionDataRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.catalogs = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalogs[j], options); + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ImportCompletionDataRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsResponse; + return ImportCompletionDataRequest; })(); - v2beta.UpdateCatalogRequest = (function() { + v2alpha.ProductInputConfig = (function() { /** - * Properties of an UpdateCatalogRequest. - * @memberof google.cloud.retail.v2beta - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2beta.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IProductInputConfig + * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource */ /** - * Constructs a new UpdateCatalogRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig * @constructor - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set */ - function UpdateCatalogRequest(properties) { + function ProductInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23519,88 +28776,115 @@ } /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2beta.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + ProductInputConfig.prototype.productInlineSource = null; /** - * UpdateCatalogRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + ProductInputConfig.prototype.gcsSource = null; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest instance + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); }; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encode = function encode(message, writer) { + ProductInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2beta.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decode = function decode(reader, length) { + ProductInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23611,129 +28895,159 @@ }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a ProductInputConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateCatalogRequest.verify = function verify(message) { + ProductInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalog); - if (error) - return "catalog." + error; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } } return null; }; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UpdateCatalogRequest) + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) return object; - var message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalog); + var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); } return message; }; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2beta.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateCatalogRequest.toObject = function toObject(message, options) { + ProductInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.catalog = null; - object.updateMask = null; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalog, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this ProductInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { + ProductInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateCatalogRequest; + return ProductInputConfig; })(); - v2beta.CustomAttribute = (function() { + v2alpha.UserEventInputConfig = (function() { /** - * Properties of a CustomAttribute. - * @memberof google.cloud.retail.v2beta - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource */ /** - * Constructs a new CustomAttribute. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig * @constructor - * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; + function UserEventInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23741,102 +29055,115 @@ } /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2beta.CustomAttribute + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - CustomAttribute.prototype.text = $util.emptyArray; + UserEventInputConfig.prototype.userEventInlineSource = null; /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2beta.CustomAttribute + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - CustomAttribute.prototype.numbers = $util.emptyArray; + UserEventInputConfig.prototype.gcsSource = null; /** - * Creates a new CustomAttribute instance using the specified properties. + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute instance + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); }; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encode = function encode(message, writer) { + UserEventInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decode = function decode(reader, length) { + UserEventInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); break; case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23847,142 +29174,157 @@ }; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomAttribute message. + * Verifies a UserEventInputConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomAttribute.verify = function verify(message) { + UserEventInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } } return null; }; /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CustomAttribute) + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) return object; - var message = new $root.google.cloud.retail.v2beta.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); + var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); } return message; }; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2beta.CustomAttribute} message CustomAttribute + * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomAttribute.toObject = function toObject(message, options) { + UserEventInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } return object; }; /** - * Converts this CustomAttribute to JSON. + * Converts this UserEventInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance * @returns {Object.} JSON object */ - CustomAttribute.prototype.toJSON = function toJSON() { + UserEventInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomAttribute; + return UserEventInputConfig; })(); - v2beta.Image = (function() { + v2alpha.CompletionDataInputConfig = (function() { /** - * Properties of an Image. - * @memberof google.cloud.retail.v2beta - * @interface IImage - * @property {string|null} [uri] Image uri - * @property {number|null} [height] Image height - * @property {number|null} [width] Image width + * Properties of a CompletionDataInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource */ /** - * Constructs a new Image. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an Image. - * @implements IImage + * Constructs a new CompletionDataInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig * @constructor - * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set */ - function Image(properties) { + function CompletionDataInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23990,101 +29332,89 @@ } /** - * Image uri. - * @member {string} uri - * @memberof google.cloud.retail.v2beta.Image + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance */ - Image.prototype.uri = ""; + CompletionDataInputConfig.prototype.bigQuerySource = null; - /** - * Image height. - * @member {number} height - * @memberof google.cloud.retail.v2beta.Image - * @instance - */ - Image.prototype.height = 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Image width. - * @member {number} width - * @memberof google.cloud.retail.v2beta.Image + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance */ - Image.prototype.width = 0; + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new Image instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Image} Image instance + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig instance */ - Image.create = function create(properties) { - return new Image(properties); + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + CompletionDataInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Image} Image + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + CompletionDataInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -24095,127 +29425,122 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Image} Image + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a CompletionDataInputConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + CompletionDataInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Image} Image + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Image) + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDataInputConfig) return object; - var message = new $root.google.cloud.retail.v2beta.Image(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.height != null) - message.height = object.height | 0; - if (object.width != null) - message.width = object.width | 0; + var message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + } return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2beta.Image} message Image + * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} message CompletionDataInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + CompletionDataInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.uri = ""; - object.height = 0; - object.width = 0; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; return object; }; /** - * Converts this Image to JSON. + * Converts this CompletionDataInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + CompletionDataInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return CompletionDataInputConfig; })(); - v2beta.PriceInfo = (function() { + v2alpha.ImportMetadata = (function() { /** - * Properties of a PriceInfo. - * @memberof google.cloud.retail.v2beta - * @interface IPriceInfo - * @property {string|null} [currencyCode] PriceInfo currencyCode - * @property {number|null} [price] PriceInfo price - * @property {number|null} [originalPrice] PriceInfo originalPrice - * @property {number|null} [cost] PriceInfo cost + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic */ /** - * Constructs a new PriceInfo. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PriceInfo. - * @implements IPriceInfo + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata * @constructor - * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set */ - function PriceInfo(properties) { + function ImportMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24223,114 +29548,140 @@ } /** - * PriceInfo currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2beta.PriceInfo + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - PriceInfo.prototype.currencyCode = ""; + ImportMetadata.prototype.createTime = null; /** - * PriceInfo price. - * @member {number} price - * @memberof google.cloud.retail.v2beta.PriceInfo + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - PriceInfo.prototype.price = 0; + ImportMetadata.prototype.updateTime = null; /** - * PriceInfo originalPrice. - * @member {number} originalPrice - * @memberof google.cloud.retail.v2beta.PriceInfo + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - PriceInfo.prototype.originalPrice = 0; + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * PriceInfo cost. - * @member {number} cost - * @memberof google.cloud.retail.v2beta.PriceInfo + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - PriceInfo.prototype.cost = 0; + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new PriceInfo instance using the specified properties. + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.requestId = ""; + + /** + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo instance + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance */ - PriceInfo.create = function create(properties) { - return new PriceInfo(properties); + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); }; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encode = function encode(message, writer) { + ImportMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decode = function decode(reader, length) { + ImportMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.currencyCode = reader.string(); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 2: - message.price = reader.float(); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.originalPrice = reader.float(); + message.successCount = reader.int64(); break; case 4: - message.cost = reader.float(); + message.failureCount = reader.int64(); + break; + case 5: + message.requestId = reader.string(); + break; + case 6: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -24341,135 +29692,188 @@ }; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decodeDelimited = function decodeDelimited(reader) { + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PriceInfo message. + * Verifies an ImportMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PriceInfo.verify = function verify(message) { + ImportMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - if (message.price != null && message.hasOwnProperty("price")) - if (typeof message.price !== "number") - return "price: number expected"; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - if (typeof message.originalPrice !== "number") - return "originalPrice: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata */ - PriceInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo) + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) return object; - var message = new $root.google.cloud.retail.v2beta.PriceInfo(); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - if (object.price != null) - message.price = Number(object.price); - if (object.originalPrice != null) - message.originalPrice = Number(object.originalPrice); - if (object.cost != null) - message.cost = Number(object.cost); + var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2beta.PriceInfo} message PriceInfo + * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PriceInfo.toObject = function toObject(message, options) { + ImportMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.currencyCode = ""; - object.price = 0; - object.originalPrice = 0; - object.cost = 0; + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - if (message.price != null && message.hasOwnProperty("price")) - object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this PriceInfo to JSON. + * Converts this ImportMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance * @returns {Object.} JSON object */ - PriceInfo.prototype.toJSON = function toJSON() { + ImportMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PriceInfo; + return ImportMetadata; })(); - v2beta.UserInfo = (function() { + v2alpha.ImportProductsResponse = (function() { /** - * Properties of a UserInfo. - * @memberof google.cloud.retail.v2beta - * @interface IUserInfo - * @property {string|null} [userId] UserInfo userId - * @property {string|null} [ipAddress] UserInfo ipAddress - * @property {string|null} [userAgent] UserInfo userAgent - * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + * Properties of an ImportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig */ /** - * Constructs a new UserInfo. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserInfo. - * @implements IUserInfo + * Constructs a new ImportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse * @constructor - * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set */ - function UserInfo(properties) { + function ImportProductsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24477,114 +29881,91 @@ } /** - * UserInfo userId. - * @member {string} userId - * @memberof google.cloud.retail.v2beta.UserInfo + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance */ - UserInfo.prototype.userId = ""; + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * UserInfo ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.retail.v2beta.UserInfo - * @instance - */ - UserInfo.prototype.ipAddress = ""; - - /** - * UserInfo userAgent. - * @member {string} userAgent - * @memberof google.cloud.retail.v2beta.UserInfo - * @instance - */ - UserInfo.prototype.userAgent = ""; - - /** - * UserInfo directUserRequest. - * @member {boolean} directUserRequest - * @memberof google.cloud.retail.v2beta.UserInfo + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance */ - UserInfo.prototype.directUserRequest = false; + ImportProductsResponse.prototype.errorsConfig = null; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo instance + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance */ - UserInfo.create = function create(properties) { - return new UserInfo(properties); + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); }; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encode = function encode(message, writer) { + ImportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decode = function decode(reader, length) { + ImportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userId = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -24595,134 +29976,141 @@ }; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decodeDelimited = function decodeDelimited(reader) { + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserInfo message. + * Verifies an ImportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserInfo.verify = function verify(message) { + ImportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userId != null && message.hasOwnProperty("userId")) - if (!$util.isString(message.userId)) - return "userId: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - if (typeof message.directUserRequest !== "boolean") - return "directUserRequest: boolean expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } return null; }; /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse */ - UserInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserInfo) + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.UserInfo(); - if (object.userId != null) - message.userId = String(object.userId); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.directUserRequest != null) - message.directUserRequest = Boolean(object.directUserRequest); + var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } return message; }; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2beta.UserInfo} message UserInfo + * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserInfo.toObject = function toObject(message, options) { + ImportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.userId = ""; - object.ipAddress = ""; - object.userAgent = ""; - object.directUserRequest = false; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.userId != null && message.hasOwnProperty("userId")) - object.userId = message.userId; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - object.directUserRequest = message.directUserRequest; + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this UserInfo to JSON. + * Converts this ImportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance * @returns {Object.} JSON object */ - UserInfo.prototype.toJSON = function toJSON() { + ImportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserInfo; + return ImportProductsResponse; })(); - v2beta.GcsSource = (function() { + v2alpha.ImportUserEventsResponse = (function() { /** - * Properties of a GcsSource. - * @memberof google.cloud.retail.v2beta - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema + * Properties of an ImportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary */ /** - * Constructs a new GcsSource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * Constructs a new ImportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse * @constructor - * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set */ - function GcsSource(properties) { - this.inputUris = []; + function ImportUserEventsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24730,91 +30118,104 @@ } /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2beta.GcsSource + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance */ - GcsSource.prototype.inputUris = $util.emptyArray; + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2beta.GcsSource + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance */ - GcsSource.prototype.dataSchema = ""; + ImportUserEventsResponse.prototype.errorsConfig = null; /** - * Creates a new GcsSource instance using the specified properties. + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + ImportUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + ImportUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.dataSchema = reader.string(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -24825,132 +30226,153 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies an ImportUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + ImportUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.GcsSource) + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2beta.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.GcsSource} message GcsSource + * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + ImportUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.inputUris = []; - if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this GcsSource to JSON. + * Converts this ImportUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + ImportUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return ImportUserEventsResponse; })(); - v2beta.BigQuerySource = (function() { + v2alpha.UserEventImportSummary = (function() { /** - * Properties of a BigQuerySource. - * @memberof google.cloud.retail.v2beta - * @interface IBigQuerySource - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema + * Properties of a UserEventImportSummary. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount */ /** - * Constructs a new BigQuerySource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource + * Constructs a new UserEventImportSummary. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary * @constructor - * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set */ - function BigQuerySource(properties) { + function UserEventImportSummary(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24958,127 +30380,88 @@ } /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2beta.BigQuerySource - * @instance - */ - BigQuerySource.prototype.projectId = ""; - - /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2beta.BigQuerySource - * @instance - */ - BigQuerySource.prototype.datasetId = ""; - - /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2beta.BigQuerySource - * @instance - */ - BigQuerySource.prototype.tableId = ""; - - /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2beta.BigQuerySource + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance */ - BigQuerySource.prototype.gcsStagingDir = ""; + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2beta.BigQuerySource + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance */ - BigQuerySource.prototype.dataSchema = ""; + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource instance + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); }; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encode = function encode(message, writer) { + UserEventImportSummary.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + UserEventImportSummary.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.projectId = reader.string(); - break; case 1: - message.datasetId = reader.string(); + message.joinedEventsCount = reader.int64(); break; case 2: - message.tableId = reader.string(); - break; - case 3: - message.gcsStagingDir = reader.string(); - break; - case 4: - message.dataSchema = reader.string(); + message.unjoinedEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -25089,141 +30472,145 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies a UserEventImportSummary message. * @function verify - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + UserEventImportSummary.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.BigQuerySource) + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) return object; - var message = new $root.google.cloud.retail.v2beta.BigQuerySource(); - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); + var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2beta.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + UserEventImportSummary.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this UserEventImportSummary to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + UserEventImportSummary.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BigQuerySource; + return UserEventImportSummary; })(); - v2beta.ProductInlineSource = (function() { + v2alpha.ImportCompletionDataResponse = (function() { /** - * Properties of a ProductInlineSource. - * @memberof google.cloud.retail.v2beta - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products + * Properties of an ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples */ /** - * Constructs a new ProductInlineSource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource + * Constructs a new ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse * @constructor - * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set */ - function ProductInlineSource(properties) { - this.products = []; + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25231,78 +30618,78 @@ } /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @instance */ - ProductInlineSource.prototype.products = $util.emptyArray; + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse instance */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); }; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encode = function encode(message, writer) { + ImportCompletionDataResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decode = function decode(reader, length) { + ImportCompletionDataResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -25313,125 +30700,169 @@ }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInlineSource message. + * Verifies an ImportCompletionDataResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInlineSource.verify = function verify(message) { + ImportCompletionDataResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); if (error) - return "products." + error; + return "errorSamples." + error; } } return null; }; /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductInlineSource) + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse) return object; - var message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); + var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); } } return message; }; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2beta.ProductInlineSource} message ProductInlineSource + * @param {google.cloud.retail.v2alpha.ImportCompletionDataResponse} message ImportCompletionDataResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInlineSource.toObject = function toObject(message, options) { + ImportCompletionDataResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } return object; }; /** - * Converts this ProductInlineSource to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @instance * @returns {Object.} JSON object */ - ProductInlineSource.prototype.toJSON = function toJSON() { + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInlineSource; + return ImportCompletionDataResponse; })(); - v2beta.UserEventInlineSource = (function() { + v2alpha.Product = (function() { /** - * Properties of a UserEventInlineSource. - * @memberof google.cloud.retail.v2beta - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + * Properties of a Product. + * @memberof google.cloud.retail.v2alpha + * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands + * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2alpha.IRating|null} [rating] Product rating + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2alpha.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2alpha.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants */ /** - * Constructs a new UserEventInlineSource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource + * Constructs a new Product. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Product. + * @implements IProduct * @constructor - * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set */ - function UserEventInlineSource(properties) { - this.userEvents = []; + function Product(properties) { + this.collectionMemberIds = []; + this.categories = []; + this.brands = []; + this.attributes = {}; + this.tags = []; + this.fulfillmentInfo = []; + this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25439,529 +30870,563 @@ } /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; + Product.prototype.expireTime = null; /** - * Creates a new UserEventInlineSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource instance + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); - }; + Product.prototype.ttl = null; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + Product.prototype.name = ""; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Product.prototype.id = ""; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product type. + * @member {google.cloud.retail.v2alpha.Product.Type} type + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + Product.prototype.type = 0; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Product.prototype.primaryProductId = ""; /** - * Verifies a UserEventInlineSource message. - * @function verify - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvents[i]); - if (error) - return "userEvents." + error; - } - } - return null; - }; + Product.prototype.collectionMemberIds = $util.emptyArray; /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * Product gtin. + * @member {string} gtin + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEventInlineSource) - return object; - var message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvents[i]); - } - } - return message; - }; + Product.prototype.gtin = ""; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.UserEventInlineSource} message UserEventInlineSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UserEventInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvents[j], options); - } - return object; - }; + Product.prototype.categories = $util.emptyArray; /** - * Converts this UserEventInlineSource to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2alpha.Product * @instance - * @returns {Object.} JSON object */ - UserEventInlineSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UserEventInlineSource; - })(); + Product.prototype.title = ""; - v2beta.ImportErrorsConfig = (function() { + /** + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.brands = $util.emptyArray; /** - * Properties of an ImportErrorsConfig. - * @memberof google.cloud.retail.v2beta - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ + Product.prototype.description = ""; /** - * Constructs a new ImportErrorsConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig - * @constructor - * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + * Product languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - function ImportErrorsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Product.prototype.languageCode = ""; /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ImportErrorsConfig.prototype.gcsPrefix = null; + Product.prototype.attributes = $util.emptyObject; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * Product priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + Product.prototype.priceInfo = null; /** - * Creates a new ImportErrorsConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig instance + * Product rating. + * @member {google.cloud.retail.v2alpha.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); - }; + Product.prototype.rating = null; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); - return writer; - }; + Product.prototype.availableTime = null; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product availability. + * @member {google.cloud.retail.v2alpha.Product.Availability} availability + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Product.prototype.availability = 0; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + Product.prototype.availableQuantity = null; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Product.prototype.fulfillmentInfo = $util.emptyArray; /** - * Verifies an ImportErrorsConfig message. - * @function verify - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } - return null; - }; + Product.prototype.uri = ""; /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportErrorsConfig) - return object; - var message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); - return message; - }; + Product.prototype.images = $util.emptyArray; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.ImportErrorsConfig} message ImportErrorsConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Product audience. + * @member {google.cloud.retail.v2alpha.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ImportErrorsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; - } - return object; - }; + Product.prototype.audience = null; /** - * Converts this ImportErrorsConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * Product colorInfo. + * @member {google.cloud.retail.v2alpha.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2alpha.Product * @instance - * @returns {Object.} JSON object */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + Product.prototype.colorInfo = null; - return ImportErrorsConfig; - })(); + /** + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.sizes = $util.emptyArray; - v2beta.ImportProductsRequest = (function() { + /** + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.materials = $util.emptyArray; /** - * Properties of an ImportProductsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {google.cloud.retail.v2beta.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ + Product.prototype.patterns = $util.emptyArray; /** - * Constructs a new ImportProductsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest - * @constructor - * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - function ImportProductsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Product.prototype.conditions = $util.emptyArray; /** - * ImportProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ImportProductsRequest.prototype.parent = ""; + Product.prototype.promotions = $util.emptyArray; /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2beta.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ImportProductsRequest.prototype.inputConfig = null; + Product.prototype.publishTime = null; /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ImportProductsRequest.prototype.errorsConfig = null; + Product.prototype.retrievableFields = null; /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ImportProductsRequest.prototype.updateMask = null; + Product.prototype.variants = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Product instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest instance + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Product} Product instance */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); + Product.create = function create(properties) { + return new Product(properties); }; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encode = function encode(message, writer) { + Product.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2beta.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2alpha.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) + $root.google.cloud.retail.v2alpha.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2alpha.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + $root.google.cloud.retail.v2alpha.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) + $root.google.cloud.retail.v2alpha.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.sizes != null && message.sizes.length) + for (var i = 0; i < message.sizes.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); + if (message.materials != null && message.materials.length) + for (var i = 0; i < message.materials.length; ++i) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); + if (message.patterns != null && message.patterns.length) + for (var i = 0; i < message.patterns.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); + if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) + $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.variants != null && message.variants.length) + for (var i = 0; i < message.variants.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.promotions != null && message.promotions.length) + for (var i = 0; i < message.promotions.length; ++i) + $root.google.cloud.retail.v2alpha.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + Product.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.Product} Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decode = function decode(reader, length) { + Product.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Product(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 16: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; case 1: - message.parent = reader.string(); + message.name = reader.string(); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); + message.id = reader.string(); break; case 3: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + message.type = reader.int32(); break; case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.primaryProductId = reader.string(); + break; + case 5: + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + case 6: + message.gtin = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 9: + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + case 10: + message.description = reader.string(); + break; + case 11: + message.languageCode = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + case 15: + message.rating = $root.google.cloud.retail.v2alpha.Rating.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 21: + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2alpha.FulfillmentInfo.decode(reader, reader.uint32())); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); + break; + case 24: + message.audience = $root.google.cloud.retail.v2alpha.Audience.decode(reader, reader.uint32()); + break; + case 25: + message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.decode(reader, reader.uint32()); + break; + case 26: + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + case 27: + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + case 28: + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + case 29: + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + case 34: + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2alpha.Promotion.decode(reader, reader.uint32())); + break; + case 33: + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 30: + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 31: + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -25972,149 +31437,725 @@ }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.Product} Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + Product.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsRequest message. + * Verifies a Product message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsRequest.verify = function verify(message) { + Product.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2beta.ProductInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; + var properties = {}; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; + if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.ttl); + if (error) + return "ttl." + error; + } } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { + if (!Array.isArray(message.collectionMemberIds)) + return "collectionMemberIds: array expected"; + for (var i = 0; i < message.collectionMemberIds.length; ++i) + if (!$util.isString(message.collectionMemberIds[i])) + return "collectionMemberIds: string[] expected"; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + if (!$util.isString(message.gtin)) + return "gtin: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; } - return null; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.brands != null && message.hasOwnProperty("brands")) { + if (!Array.isArray(message.brands)) + return "brands: array expected"; + for (var i = 0; i < message.brands.length; ++i) + if (!$util.isString(message.brands[i])) + return "brands: string[] expected"; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.rating != null && message.hasOwnProperty("rating")) { + var error = $root.google.cloud.retail.v2alpha.Rating.verify(message.rating); + if (error) + return "rating." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + if (!Array.isArray(message.fulfillmentInfo)) + return "fulfillmentInfo: array expected"; + for (var i = 0; i < message.fulfillmentInfo.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.FulfillmentInfo.verify(message.fulfillmentInfo[i]); + if (error) + return "fulfillmentInfo." + error; + } + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + if (message.audience != null && message.hasOwnProperty("audience")) { + var error = $root.google.cloud.retail.v2alpha.Audience.verify(message.audience); + if (error) + return "audience." + error; + } + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { + var error = $root.google.cloud.retail.v2alpha.ColorInfo.verify(message.colorInfo); + if (error) + return "colorInfo." + error; + } + if (message.sizes != null && message.hasOwnProperty("sizes")) { + if (!Array.isArray(message.sizes)) + return "sizes: array expected"; + for (var i = 0; i < message.sizes.length; ++i) + if (!$util.isString(message.sizes[i])) + return "sizes: string[] expected"; + } + if (message.materials != null && message.hasOwnProperty("materials")) { + if (!Array.isArray(message.materials)) + return "materials: array expected"; + for (var i = 0; i < message.materials.length; ++i) + if (!$util.isString(message.materials[i])) + return "materials: string[] expected"; + } + if (message.patterns != null && message.hasOwnProperty("patterns")) { + if (!Array.isArray(message.patterns)) + return "patterns: array expected"; + for (var i = 0; i < message.patterns.length; ++i) + if (!$util.isString(message.patterns[i])) + return "patterns: string[] expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) + if (!$util.isString(message.conditions[i])) + return "conditions: string[] expected"; + } + if (message.promotions != null && message.hasOwnProperty("promotions")) { + if (!Array.isArray(message.promotions)) + return "promotions: array expected"; + for (var i = 0; i < message.promotions.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Promotion.verify(message.promotions[i]); + if (error) + return "promotions." + error; + } + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.publishTime); + if (error) + return "publishTime." + error; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { + var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); + if (error) + return "retrievableFields." + error; + } + if (message.variants != null && message.hasOwnProperty("variants")) { + if (!Array.isArray(message.variants)) + return "variants: array expected"; + for (var i = 0; i < message.variants.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.variants[i]); + if (error) + return "variants." + error; + } + } + return null; }; /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.Product} Product */ - ImportProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsRequest) + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Product) return object; - var message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.retail.v2alpha.Product(); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + if (object.ttl != null) { + if (typeof object.ttl !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.ttl: object expected"); + message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.collectionMemberIds) { + if (!Array.isArray(object.collectionMemberIds)) + throw TypeError(".google.cloud.retail.v2alpha.Product.collectionMemberIds: array expected"); + message.collectionMemberIds = []; + for (var i = 0; i < object.collectionMemberIds.length; ++i) + message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); + } + if (object.gtin != null) + message.gtin = String(object.gtin); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2alpha.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.brands) { + if (!Array.isArray(object.brands)) + throw TypeError(".google.cloud.retail.v2alpha.Product.brands: array expected"); + message.brands = []; + for (var i = 0; i < object.brands.length; ++i) + message.brands[i] = String(object.brands[i]); + } + if (object.description != null) + message.description = String(object.description); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2alpha.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + } + if (object.rating != null) { + if (typeof object.rating !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.rating: object expected"); + message.rating = $root.google.cloud.retail.v2alpha.Rating.fromObject(object.rating); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.fulfillmentInfo) { + if (!Array.isArray(object.fulfillmentInfo)) + throw TypeError(".google.cloud.retail.v2alpha.Product.fulfillmentInfo: array expected"); + message.fulfillmentInfo = []; + for (var i = 0; i < object.fulfillmentInfo.length; ++i) { + if (typeof object.fulfillmentInfo[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.fulfillmentInfo: object expected"); + message.fulfillmentInfo[i] = $root.google.cloud.retail.v2alpha.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); + } + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2alpha.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2alpha.Image.fromObject(object.images[i]); + } + } + if (object.audience != null) { + if (typeof object.audience !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.audience: object expected"); + message.audience = $root.google.cloud.retail.v2alpha.Audience.fromObject(object.audience); + } + if (object.colorInfo != null) { + if (typeof object.colorInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.colorInfo: object expected"); + message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.fromObject(object.colorInfo); + } + if (object.sizes) { + if (!Array.isArray(object.sizes)) + throw TypeError(".google.cloud.retail.v2alpha.Product.sizes: array expected"); + message.sizes = []; + for (var i = 0; i < object.sizes.length; ++i) + message.sizes[i] = String(object.sizes[i]); + } + if (object.materials) { + if (!Array.isArray(object.materials)) + throw TypeError(".google.cloud.retail.v2alpha.Product.materials: array expected"); + message.materials = []; + for (var i = 0; i < object.materials.length; ++i) + message.materials[i] = String(object.materials[i]); + } + if (object.patterns) { + if (!Array.isArray(object.patterns)) + throw TypeError(".google.cloud.retail.v2alpha.Product.patterns: array expected"); + message.patterns = []; + for (var i = 0; i < object.patterns.length; ++i) + message.patterns[i] = String(object.patterns[i]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.cloud.retail.v2alpha.Product.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) + message.conditions[i] = String(object.conditions[i]); + } + if (object.promotions) { + if (!Array.isArray(object.promotions)) + throw TypeError(".google.cloud.retail.v2alpha.Product.promotions: array expected"); + message.promotions = []; + for (var i = 0; i < object.promotions.length; ++i) { + if (typeof object.promotions[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.promotions: object expected"); + message.promotions[i] = $root.google.cloud.retail.v2alpha.Promotion.fromObject(object.promotions[i]); + } + } + if (object.publishTime != null) { + if (typeof object.publishTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.publishTime: object expected"); + message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + } + if (object.retrievableFields != null) { + if (typeof object.retrievableFields !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.retrievableFields: object expected"); + message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + } + if (object.variants) { + if (!Array.isArray(object.variants)) + throw TypeError(".google.cloud.retail.v2alpha.Product.variants: array expected"); + message.variants = []; + for (var i = 0; i < object.variants.length; ++i) { + if (typeof object.variants[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.variants: object expected"); + message.variants[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.variants[i]); + } } return message; }; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a Product message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2beta.ImportProductsRequest} message ImportProductsRequest + * @param {google.cloud.retail.v2alpha.Product} message Product * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsRequest.toObject = function toObject(message, options) { + Product.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.collectionMemberIds = []; + object.categories = []; + object.brands = []; + object.tags = []; + object.fulfillmentInfo = []; + object.images = []; + object.sizes = []; + object.materials = []; + object.patterns = []; + object.conditions = []; + object.variants = []; + object.promotions = []; + } + if (options.objects || options.defaults) + object.attributes = {}; if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - object.updateMask = null; + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.gtin = ""; + object.title = ""; + object.description = ""; + object.languageCode = ""; + object.priceInfo = null; + object.rating = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + object.audience = null; + object.colorInfo = null; + object.retrievableFields = null; + object.publishTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.collectionMemberIds && message.collectionMemberIds.length) { + object.collectionMemberIds = []; + for (var j = 0; j < message.collectionMemberIds.length; ++j) + object.collectionMemberIds[j] = message.collectionMemberIds[j]; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + object.gtin = message.gtin; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.brands && message.brands.length) { + object.brands = []; + for (var j = 0; j < message.brands.length; ++j) + object.brands[j] = message.brands[j]; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + if (message.rating != null && message.hasOwnProperty("rating")) + object.rating = $root.google.cloud.retail.v2alpha.Rating.toObject(message.rating, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (options.oneofs) + object.expiration = "expireTime"; + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (options.oneofs) + object.expiration = "ttl"; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.fulfillmentInfo && message.fulfillmentInfo.length) { + object.fulfillmentInfo = []; + for (var j = 0; j < message.fulfillmentInfo.length; ++j) + object.fulfillmentInfo[j] = $root.google.cloud.retail.v2alpha.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2alpha.Image.toObject(message.images[j], options); + } + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = $root.google.cloud.retail.v2alpha.Audience.toObject(message.audience, options); + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) + object.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.toObject(message.colorInfo, options); + if (message.sizes && message.sizes.length) { + object.sizes = []; + for (var j = 0; j < message.sizes.length; ++j) + object.sizes[j] = message.sizes[j]; + } + if (message.materials && message.materials.length) { + object.materials = []; + for (var j = 0; j < message.materials.length; ++j) + object.materials[j] = message.materials[j]; + } + if (message.patterns && message.patterns.length) { + object.patterns = []; + for (var j = 0; j < message.patterns.length; ++j) + object.patterns[j] = message.patterns[j]; + } + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = message.conditions[j]; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) + object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); + if (message.variants && message.variants.length) { + object.variants = []; + for (var j = 0; j < message.variants.length; ++j) + object.variants[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.variants[j], options); + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); + if (message.promotions && message.promotions.length) { + object.promotions = []; + for (var j = 0; j < message.promotions.length; ++j) + object.promotions[j] = $root.google.cloud.retail.v2alpha.Promotion.toObject(message.promotions[j], options); } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this Product to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Product * @instance * @returns {Object.} JSON object */ - ImportProductsRequest.prototype.toJSON = function toJSON() { + Product.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsRequest; + /** + * Type enum. + * @name google.cloud.retail.v2alpha.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2alpha.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; })(); - v2beta.ImportUserEventsRequest = (function() { + v2alpha.UserEvent = (function() { /** - * Properties of an ImportUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IImportUserEventsRequest - * @property {string|null} [parent] ImportUserEventsRequest parent - * @property {google.cloud.retail.v2beta.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2alpha.ICompletionDetail|null} [completionDetail] UserEvent completionDetail + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2alpha.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {string|null} [filter] UserEvent filter + * @property {string|null} [orderBy] UserEvent orderBy + * @property {number|null} [offset] UserEvent offset + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId */ /** - * Constructs a new ImportUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportUserEventsRequest. - * @implements IImportUserEventsRequest + * Constructs a new UserEvent. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEvent. + * @implements IUserEvent * @constructor - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set */ - function ImportUserEventsRequest(properties) { + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -26122,357 +32163,353 @@ } /** - * ImportUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - ImportUserEventsRequest.prototype.parent = ""; + UserEvent.prototype.eventType = ""; /** - * ImportUserEventsRequest inputConfig. - * @member {google.cloud.retail.v2beta.IUserEventInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - ImportUserEventsRequest.prototype.inputConfig = null; + UserEvent.prototype.visitorId = ""; /** - * ImportUserEventsRequest errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * UserEvent sessionId. + * @member {string} sessionId + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - ImportUserEventsRequest.prototype.errorsConfig = null; + UserEvent.prototype.sessionId = ""; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest instance + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.create = function create(properties) { - return new ImportUserEventsRequest(properties); - }; + UserEvent.prototype.eventTime = null; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2beta.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + UserEvent.prototype.experimentIds = $util.emptyArray; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + UserEvent.prototype.attributionToken = ""; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + UserEvent.prototype.productDetails = $util.emptyArray; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * UserEvent completionDetail. + * @member {google.cloud.retail.v2alpha.ICompletionDetail|null|undefined} completionDetail + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + UserEvent.prototype.completionDetail = null; /** - * Verifies an ImportUserEventsRequest message. - * @function verify - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2beta.UserEventInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - return null; - }; + UserEvent.prototype.attributes = $util.emptyObject; /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsRequest) - return object; - var message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } - return message; - }; + UserEvent.prototype.cartId = ""; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.ImportUserEventsRequest} message ImportUserEventsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2alpha.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - ImportUserEventsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); - return object; - }; + UserEvent.prototype.purchaseTransaction = null; /** - * Converts this ImportUserEventsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance - * @returns {Object.} JSON object */ - ImportUserEventsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ImportUserEventsRequest; - })(); + UserEvent.prototype.searchQuery = ""; - v2beta.ProductInputConfig = (function() { + /** + * UserEvent filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.filter = ""; /** - * Properties of a ProductInputConfig. - * @memberof google.cloud.retail.v2beta - * @interface IProductInputConfig - * @property {google.cloud.retail.v2beta.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + * UserEvent orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ + UserEvent.prototype.orderBy = ""; /** - * Constructs a new ProductInputConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig - * @constructor - * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + * UserEvent offset. + * @member {number} offset + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance */ - function ProductInputConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + UserEvent.prototype.offset = 0; /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2beta.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - ProductInputConfig.prototype.productInlineSource = null; + UserEvent.prototype.pageCategories = $util.emptyArray; /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * UserEvent userInfo. + * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - ProductInputConfig.prototype.gcsSource = null; + UserEvent.prototype.userInfo = null; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - ProductInputConfig.prototype.bigQuerySource = null; + UserEvent.prototype.uri = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + UserEvent.prototype.pageViewId = ""; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new UserEvent instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static - * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + UserEvent.create = function create(properties) { + return new UserEvent(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static - * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + UserEvent.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2beta.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2alpha.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2alpha.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); + if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) + $root.google.cloud.retail.v2alpha.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static - * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a UserEvent message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + UserEvent.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEvent(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); + message.eventType = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + message.visitorId = reader.string(); + break; + case 21: + message.sessionId = reader.string(); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); + break; + case 22: + message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.decode(reader, reader.uint32()); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 16: + message.filter = reader.string(); + break; + case 17: + message.orderBy = reader.string(); + break; + case 18: + message.offset = reader.int32(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); break; default: reader.skipType(tag & 7); @@ -26483,159 +32520,344 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a UserEvent message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + UserEvent.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies a UserEvent message. * @function verify - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + UserEvent.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isString(message.sessionId)) + return "sessionId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.ProductDetail.verify(message.productDetails[i]); if (error) - return "gcsSource." + error; + return "productDetails." + error; } } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDetail.verify(message.completionDetail); + if (error) + return "completionDetail." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); if (error) - return "bigQuerySource." + error; + return "attributes." + error; } } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2alpha.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductInputConfig) + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEvent) return object; - var message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.fromObject(object.productInlineSource); + var message = new $root.google.cloud.retail.v2alpha.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.sessionId != null) + message.sessionId = String(object.sessionId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2alpha.ProductDetail.fromObject(object.productDetails[i]); + } } - return message; - }; - - /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ProductInputConfig - * @static - * @param {google.cloud.retail.v2beta.ProductInputConfig} message ProductInputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductInputConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; + if (object.completionDetail != null) { + if (typeof object.completionDetail !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.completionDetail: object expected"); + message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.fromObject(object.completionDetail); } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {google.cloud.retail.v2alpha.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + object.filter = ""; + object.orderBy = ""; + object.offset = 0; + object.sessionId = ""; + object.completionDetail = null; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2alpha.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) + object.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.toObject(message.completionDetail, options); return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this UserEvent to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + UserEvent.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; + return UserEvent; })(); - v2beta.UserEventInputConfig = (function() { + v2alpha.ProductDetail = (function() { /** - * Properties of a UserEventInputConfig. - * @memberof google.cloud.retail.v2beta - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2beta.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + * Properties of a ProductDetail. + * @memberof google.cloud.retail.v2alpha + * @interface IProductDetail + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity */ /** - * Constructs a new UserEventInputConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig + * Constructs a new ProductDetail. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductDetail. + * @implements IProductDetail * @constructor - * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set */ - function UserEventInputConfig(properties) { + function ProductDetail(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -26643,115 +32865,88 @@ } /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2beta.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2beta.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.userEventInlineSource = null; - - /** - * UserEventInputConfig gcsSource. - * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2beta.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.gcsSource = null; - - /** - * UserEventInputConfig bigQuerySource. - * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * ProductDetail product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.ProductDetail * @instance */ - UserEventInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ProductDetail.prototype.product = null; /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2alpha.ProductDetail * @instance */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + ProductDetail.prototype.quantity = null; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ProductDetail instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig instance + * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail instance */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); }; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encode = function encode(message, writer) { + ProductDetail.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2beta.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a ProductDetail message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decode = function decode(reader, length) { + ProductDetail.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductDetail(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -26762,160 +32957,128 @@ }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + ProductDetail.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInputConfig message. + * Verifies a ProductDetail message. * @function verify - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInputConfig.verify = function verify(message) { + ProductDetail.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.UserEventInlineSource.verify(message.userEventInlineSource); - if (error) - return "userEventInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; } return null; }; /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail */ - UserEventInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEventInputConfig) + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductDetail) return object; - var message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); - if (object.userEventInlineSource != null) { - if (typeof object.userEventInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.userEventInlineSource: object expected"); - message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.fromObject(object.userEventInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.retail.v2alpha.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); } return message; }; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2beta.UserEventInputConfig} message UserEventInputConfig + * @param {google.cloud.retail.v2alpha.ProductDetail} message ProductDetail * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInputConfig.toObject = function toObject(message, options) { + ProductDetail.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - object.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.toObject(message.userEventInlineSource, options); - if (options.oneofs) - object.source = "userEventInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.defaults) { + object.product = null; + object.quantity = null; } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); return object; }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this ProductDetail to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ProductDetail * @instance * @returns {Object.} JSON object */ - UserEventInputConfig.prototype.toJSON = function toJSON() { + ProductDetail.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInputConfig; + return ProductDetail; })(); - v2beta.ImportMetadata = (function() { + v2alpha.CompletionDetail = (function() { /** - * Properties of an ImportMetadata. - * @memberof google.cloud.retail.v2beta - * @interface IImportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime - * @property {number|Long|null} [successCount] ImportMetadata successCount - * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * Properties of a CompletionDetail. + * @memberof google.cloud.retail.v2alpha + * @interface ICompletionDetail + * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken + * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion + * @property {number|null} [selectedPosition] CompletionDetail selectedPosition */ /** - * Constructs a new ImportMetadata. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportMetadata. - * @implements IImportMetadata + * Constructs a new CompletionDetail. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompletionDetail. + * @implements ICompletionDetail * @constructor - * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompletionDetail=} [properties] Properties to set */ - function ImportMetadata(properties) { + function CompletionDetail(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -26923,114 +33086,101 @@ } /** - * ImportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2beta.ImportMetadata - * @instance - */ - ImportMetadata.prototype.createTime = null; - - /** - * ImportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2beta.ImportMetadata + * CompletionDetail completionAttributionToken. + * @member {string} completionAttributionToken + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @instance */ - ImportMetadata.prototype.updateTime = null; + CompletionDetail.prototype.completionAttributionToken = ""; /** - * ImportMetadata successCount. - * @member {number|Long} successCount - * @memberof google.cloud.retail.v2beta.ImportMetadata + * CompletionDetail selectedSuggestion. + * @member {string} selectedSuggestion + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @instance */ - ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + CompletionDetail.prototype.selectedSuggestion = ""; /** - * ImportMetadata failureCount. - * @member {number|Long} failureCount - * @memberof google.cloud.retail.v2beta.ImportMetadata + * CompletionDetail selectedPosition. + * @member {number} selectedPosition + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @instance */ - ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + CompletionDetail.prototype.selectedPosition = 0; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new CompletionDetail instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata instance + * @param {google.cloud.retail.v2alpha.ICompletionDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail instance */ - ImportMetadata.create = function create(properties) { - return new ImportMetadata(properties); + CompletionDetail.create = function create(properties) { + return new CompletionDetail(properties); }; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDetail} message CompletionDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encode = function encode(message, writer) { + CompletionDetail.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); - if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); + if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); + if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); return writer; }; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDetail} message CompletionDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a CompletionDetail message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decode = function decode(reader, length) { + CompletionDetail.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDetail(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.completionAttributionToken = reader.string(); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.selectedSuggestion = reader.string(); break; case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); + message.selectedPosition = reader.int32(); break; default: reader.skipType(tag & 7); @@ -27041,172 +33191,128 @@ }; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + CompletionDetail.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportMetadata message. + * Verifies a CompletionDetail message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportMetadata.verify = function verify(message) { + CompletionDetail.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; - } - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) - return "successCount: integer|Long expected"; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) - return "failureCount: integer|Long expected"; + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + if (!$util.isString(message.completionAttributionToken)) + return "completionAttributionToken: string expected"; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + if (!$util.isString(message.selectedSuggestion)) + return "selectedSuggestion: string expected"; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + if (!$util.isInteger(message.selectedPosition)) + return "selectedPosition: integer expected"; return null; }; /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail */ - ImportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportMetadata) + CompletionDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDetail) return object; - var message = new $root.google.cloud.retail.v2beta.ImportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } - if (object.successCount != null) - if ($util.Long) - (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; - else if (typeof object.successCount === "string") - message.successCount = parseInt(object.successCount, 10); - else if (typeof object.successCount === "number") - message.successCount = object.successCount; - else if (typeof object.successCount === "object") - message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); - if (object.failureCount != null) - if ($util.Long) - (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; - else if (typeof object.failureCount === "string") - message.failureCount = parseInt(object.failureCount, 10); - else if (typeof object.failureCount === "number") - message.failureCount = object.failureCount; - else if (typeof object.failureCount === "object") - message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.CompletionDetail(); + if (object.completionAttributionToken != null) + message.completionAttributionToken = String(object.completionAttributionToken); + if (object.selectedSuggestion != null) + message.selectedSuggestion = String(object.selectedSuggestion); + if (object.selectedPosition != null) + message.selectedPosition = object.selectedPosition | 0; return message; }; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2beta.ImportMetadata} message ImportMetadata + * @param {google.cloud.retail.v2alpha.CompletionDetail} message CompletionDetail * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportMetadata.toObject = function toObject(message, options) { + CompletionDetail.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.createTime = null; - object.updateTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.successCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failureCount = options.longs === String ? "0" : 0; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (typeof message.successCount === "number") - object.successCount = options.longs === String ? String(message.successCount) : message.successCount; - else - object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (typeof message.failureCount === "number") - object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; - else - object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + object.completionAttributionToken = ""; + object.selectedSuggestion = ""; + object.selectedPosition = 0; + } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + object.completionAttributionToken = message.completionAttributionToken; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + object.selectedSuggestion = message.selectedSuggestion; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + object.selectedPosition = message.selectedPosition; return object; }; /** - * Converts this ImportMetadata to JSON. + * Converts this CompletionDetail to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @instance * @returns {Object.} JSON object */ - ImportMetadata.prototype.toJSON = function toJSON() { + CompletionDetail.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportMetadata; + return CompletionDetail; })(); - v2beta.ImportProductsResponse = (function() { + v2alpha.PurchaseTransaction = (function() { /** - * Properties of an ImportProductsResponse. - * @memberof google.cloud.retail.v2beta - * @interface IImportProductsResponse - * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2alpha + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode */ /** - * Constructs a new ImportProductsResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportProductsResponse. - * @implements IImportProductsResponse + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction * @constructor - * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set */ - function ImportProductsResponse(properties) { - this.errorSamples = []; + function PurchaseTransaction(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27214,91 +33320,127 @@ } /** - * ImportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @instance */ - ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + PurchaseTransaction.prototype.id = ""; /** - * ImportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @instance */ - ImportProductsResponse.prototype.errorsConfig = null; + PurchaseTransaction.prototype.revenue = 0; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse instance + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction instance */ - ImportProductsResponse.create = function create(properties) { - return new ImportProductsResponse(properties); + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); }; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encode = function encode(message, writer) { + PurchaseTransaction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); return writer; }; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a PurchaseTransaction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decode = function decode(reader, length) { + PurchaseTransaction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.id = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); break; default: reader.skipType(tag & 7); @@ -27309,141 +33451,309 @@ }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsResponse message. + * Verifies a PurchaseTransaction message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsResponse.verify = function verify(message) { + PurchaseTransaction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; return null; }; /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction */ - ImportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsResponse) + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurchaseTransaction) return object; - var message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); return message; }; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2beta.ImportProductsResponse} message ImportProductsResponse + * @param {google.cloud.retail.v2alpha.PurchaseTransaction} message PurchaseTransaction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsResponse.toObject = function toObject(message, options) { + PurchaseTransaction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; return object; }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this PurchaseTransaction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @instance * @returns {Object.} JSON object */ - ImportProductsResponse.prototype.toJSON = function toJSON() { + PurchaseTransaction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsResponse; + return PurchaseTransaction; })(); - v2beta.ImportUserEventsResponse = (function() { + v2alpha.CatalogService = (function() { /** - * Properties of an ImportUserEventsResponse. - * @memberof google.cloud.retail.v2beta - * @interface IImportUserEventsResponse - * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig - * @property {google.cloud.retail.v2beta.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + * Constructs a new CatalogService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; /** - * Constructs a new ImportUserEventsResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportUserEventsResponse. - * @implements IImportUserEventsResponse + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2alpha.ListCatalogsRequest, $root.google.cloud.retail.v2alpha.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2alpha.UpdateCatalogRequest, $root.google.cloud.retail.v2alpha.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + */ + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest, $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2alpha.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest * @constructor - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set */ - function ImportUserEventsResponse(properties) { - this.errorSamples = []; + function ListCatalogsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27451,104 +33761,101 @@ } /** - * ImportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance */ - ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + ListCatalogsRequest.prototype.parent = ""; /** - * ImportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance */ - ImportUserEventsResponse.prototype.errorsConfig = null; + ListCatalogsRequest.prototype.pageSize = 0; /** - * ImportUserEventsResponse importSummary. - * @member {google.cloud.retail.v2beta.IUserEventImportSummary|null|undefined} importSummary - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance */ - ImportUserEventsResponse.prototype.importSummary = null; + ListCatalogsRequest.prototype.pageToken = ""; /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Creates a new ListCatalogsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest instance */ - ImportUserEventsResponse.create = function create(properties) { - return new ImportUserEventsResponse(properties); + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); }; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encode = function encode(message, writer) { + ListCatalogsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) - $root.google.cloud.retail.v2beta.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decode = function decode(reader, length) { + ListCatalogsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); break; case 3: - message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -27559,153 +33866,126 @@ }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsResponse message. + * Verifies a ListCatalogsRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsResponse.verify = function verify(message) { + ListCatalogsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.importSummary != null && message.hasOwnProperty("importSummary")) { - var error = $root.google.cloud.retail.v2beta.UserEventImportSummary.verify(message.importSummary); - if (error) - return "importSummary." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest */ - ImportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsResponse) + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsRequest) return object; - var message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.importSummary != null) { - if (typeof object.importSummary !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.importSummary: object expected"); - message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.fromObject(object.importSummary); - } + var message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2beta.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {google.cloud.retail.v2alpha.ListCatalogsRequest} message ListCatalogsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsResponse.toObject = function toObject(message, options) { + ListCatalogsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; if (options.defaults) { - object.errorsConfig = null; - object.importSummary = null; - } - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.importSummary != null && message.hasOwnProperty("importSummary")) - object.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.toObject(message.importSummary, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; return object; }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this ListCatalogsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance * @returns {Object.} JSON object */ - ImportUserEventsResponse.prototype.toJSON = function toJSON() { + ListCatalogsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsResponse; + return ListCatalogsRequest; })(); - v2beta.UserEventImportSummary = (function() { + v2alpha.ListCatalogsResponse = (function() { /** - * Properties of a UserEventImportSummary. - * @memberof google.cloud.retail.v2beta - * @interface IUserEventImportSummary - * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount - * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + * Properties of a ListCatalogsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken */ /** - * Constructs a new UserEventImportSummary. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEventImportSummary. - * @implements IUserEventImportSummary + * Constructs a new ListCatalogsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse * @constructor - * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set */ - function UserEventImportSummary(properties) { + function ListCatalogsResponse(properties) { + this.catalogs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27713,88 +33993,91 @@ } /** - * UserEventImportSummary joinedEventsCount. - * @member {number|Long} joinedEventsCount - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @instance */ - UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; /** - * UserEventImportSummary unjoinedEventsCount. - * @member {number|Long} unjoinedEventsCount - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @instance */ - UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ListCatalogsResponse.prototype.nextPageToken = ""; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary instance + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse instance */ - UserEventImportSummary.create = function create(properties) { - return new UserEventImportSummary(properties); + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); }; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encode = function encode(message, writer) { + ListCatalogsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); - if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decode = function decode(reader, length) { + ListCatalogsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.joinedEventsCount = reader.int64(); + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); break; case 2: - message.unjoinedEventsCount = reader.int64(); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -27805,162 +34088,134 @@ }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventImportSummary message. + * Verifies a ListCatalogsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventImportSummary.verify = function verify(message) { + ListCatalogsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) - return "joinedEventsCount: integer|Long expected"; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) - return "unjoinedEventsCount: integer|Long expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse */ - UserEventImportSummary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEventImportSummary) + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); - if (object.joinedEventsCount != null) - if ($util.Long) - (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; - else if (typeof object.joinedEventsCount === "string") - message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); - else if (typeof object.joinedEventsCount === "number") - message.joinedEventsCount = object.joinedEventsCount; - else if (typeof object.joinedEventsCount === "object") - message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); - if (object.unjoinedEventsCount != null) - if ($util.Long) - (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; - else if (typeof object.unjoinedEventsCount === "string") - message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); - else if (typeof object.unjoinedEventsCount === "number") - message.unjoinedEventsCount = object.unjoinedEventsCount; - else if (typeof object.unjoinedEventsCount === "object") - message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalogs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2beta.UserEventImportSummary} message UserEventImportSummary + * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} message ListCatalogsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventImportSummary.toObject = function toObject(message, options) { + ListCatalogsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.joinedEventsCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.unjoinedEventsCount = options.longs === String ? "0" : 0; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalogs[j], options); } - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (typeof message.joinedEventsCount === "number") - object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; - else - object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (typeof message.unjoinedEventsCount === "number") - object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; - else - object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this ListCatalogsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @instance * @returns {Object.} JSON object */ - UserEventImportSummary.prototype.toJSON = function toJSON() { + ListCatalogsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventImportSummary; + return ListCatalogsResponse; })(); - v2beta.Product = (function() { + v2alpha.UpdateCatalogRequest = (function() { /** - * Properties of a Product. - * @memberof google.cloud.retail.v2beta - * @interface IProduct - * @property {string|null} [name] Product name - * @property {string|null} [id] Product id - * @property {google.cloud.retail.v2beta.Product.Type|null} [type] Product type - * @property {string|null} [primaryProductId] Product primaryProductId - * @property {Array.|null} [categories] Product categories - * @property {string|null} [title] Product title - * @property {string|null} [description] Product description - * @property {Object.|null} [attributes] Product attributes - * @property {Array.|null} [tags] Product tags - * @property {google.cloud.retail.v2beta.IPriceInfo|null} [priceInfo] Product priceInfo - * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime - * @property {google.cloud.retail.v2beta.Product.Availability|null} [availability] Product availability - * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity - * @property {string|null} [uri] Product uri - * @property {Array.|null} [images] Product images + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2alpha.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask */ /** - * Constructs a new Product. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Product. - * @implements IProduct + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest * @constructor - * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set */ - function Product(properties) { - this.categories = []; - this.attributes = {}; - this.tags = []; - this.images = []; + function UpdateCatalogRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27968,288 +34223,322 @@ } /** - * Product name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.Product + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2alpha.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @instance */ - Product.prototype.name = ""; + UpdateCatalogRequest.prototype.catalog = null; /** - * Product id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.Product + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @instance */ - Product.prototype.id = ""; + UpdateCatalogRequest.prototype.updateMask = null; /** - * Product type. - * @member {google.cloud.retail.v2beta.Product.Type} type - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest instance */ - Product.prototype.type = 0; + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; /** - * Product primaryProductId. - * @member {string} primaryProductId - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.primaryProductId = ""; + UpdateCatalogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; /** - * Product categories. - * @member {Array.} categories - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.categories = $util.emptyArray; + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product title. - * @member {string} title - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.title = ""; + UpdateCatalogRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product description. - * @member {string} description - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.description = ""; + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2beta.Product - * @instance - */ - Product.prototype.attributes = $util.emptyObject; + * Verifies an UpdateCatalogRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCatalogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; /** - * Product tags. - * @member {Array.} tags - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest */ - Product.prototype.tags = $util.emptyArray; + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateCatalogRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; /** - * Product priceInfo. - * @member {google.cloud.retail.v2beta.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2alpha.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.priceInfo = null; + UpdateCatalogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; /** - * Product availableTime. - * @member {google.protobuf.ITimestamp|null|undefined} availableTime - * @memberof google.cloud.retail.v2beta.Product + * Converts this UpdateCatalogRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @instance + * @returns {Object.} JSON object */ - Product.prototype.availableTime = null; + UpdateCatalogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCatalogRequest; + })(); + + v2alpha.SetDefaultBranchRequest = (function() { /** - * Product availability. - * @member {google.cloud.retail.v2beta.Product.Availability} availability - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Properties of a SetDefaultBranchRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note */ - Product.prototype.availability = 0; /** - * Product availableQuantity. - * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity - * @memberof google.cloud.retail.v2beta.Product + * Constructs a new SetDefaultBranchRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest=} [properties] Properties to set + */ + function SetDefaultBranchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance */ - Product.prototype.availableQuantity = null; + SetDefaultBranchRequest.prototype.catalog = ""; /** - * Product uri. - * @member {string} uri - * @memberof google.cloud.retail.v2beta.Product + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance */ - Product.prototype.uri = ""; + SetDefaultBranchRequest.prototype.branchId = ""; /** - * Product images. - * @member {Array.} images - * @memberof google.cloud.retail.v2beta.Product + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance */ - Product.prototype.images = $util.emptyArray; + SetDefaultBranchRequest.prototype.note = ""; /** - * Creates a new Product instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Product} Product instance + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest instance */ - Product.create = function create(properties) { - return new Product(properties); + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); }; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encode = function encode(message, writer) { + SetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2beta.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) - $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); - if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) - $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); - if (message.images != null && message.images.length) - for (var i = 0; i < message.images.length; ++i) - $root.google.cloud.retail.v2beta.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encodeDelimited = function encodeDelimited(message, writer) { + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Product} Product + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decode = function decode(reader, length) { + SetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Product(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.catalog = reader.string(); break; case 2: - message.id = reader.string(); + message.branchId = reader.string(); break; case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 10: - message.description = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -28260,405 +34549,124 @@ }; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Product} Product + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decodeDelimited = function decodeDelimited(reader) { + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Product message. + * Verifies a SetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.verify = function verify(message) { + SetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - if (!$util.isString(message.primaryProductId)) - return "primaryProductId: string expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) - if (!$util.isString(message.categories[i])) - return "categories: string[] expected"; - } - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2beta.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; - } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.availableTime); - if (error) - return "availableTime." + error; - } - if (message.availability != null && message.hasOwnProperty("availability")) - switch (message.availability) { - default: - return "availability: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); - if (error) - return "availableQuantity." + error; - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.images != null && message.hasOwnProperty("images")) { - if (!Array.isArray(message.images)) - return "images: array expected"; - for (var i = 0; i < message.images.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Image.verify(message.images[i]); - if (error) - return "images." + error; - } - } + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Product} Product + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Product) + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2beta.Product(); - if (object.name != null) - message.name = String(object.name); - if (object.id != null) - message.id = String(object.id); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "VARIANT": - case 2: - message.type = 2; - break; - case "COLLECTION": - case 3: - message.type = 3; - break; - } - if (object.primaryProductId != null) - message.primaryProductId = String(object.primaryProductId); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.retail.v2beta.Product.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) - message.categories[i] = String(object.categories[i]); - } - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.retail.v2beta.Product.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.fromObject(object.priceInfo); - } - if (object.availableTime != null) { - if (typeof object.availableTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.availableTime: object expected"); - message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); - } - switch (object.availability) { - case "AVAILABILITY_UNSPECIFIED": - case 0: - message.availability = 0; - break; - case "IN_STOCK": - case 1: - message.availability = 1; - break; - case "OUT_OF_STOCK": - case 2: - message.availability = 2; - break; - case "PREORDER": - case 3: - message.availability = 3; - break; - case "BACKORDER": - case 4: - message.availability = 4; - break; - } - if (object.availableQuantity != null) { - if (typeof object.availableQuantity !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.availableQuantity: object expected"); - message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.images) { - if (!Array.isArray(object.images)) - throw TypeError(".google.cloud.retail.v2beta.Product.images: array expected"); - message.images = []; - for (var i = 0; i < object.images.length; ++i) { - if (typeof object.images[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.images: object expected"); - message.images[i] = $root.google.cloud.retail.v2beta.Image.fromObject(object.images[i]); - } - } + var message = new $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2beta.Product} message Product + * @param {google.cloud.retail.v2alpha.SetDefaultBranchRequest} message SetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Product.toObject = function toObject(message, options) { + SetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.categories = []; - object.tags = []; - object.images = []; - } - if (options.objects || options.defaults) - object.attributes = {}; if (options.defaults) { - object.name = ""; - object.id = ""; - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.primaryProductId = ""; - object.title = ""; - object.description = ""; - object.priceInfo = null; - object.availableTime = null; - object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; - object.availableQuantity = null; - object.uri = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - object.primaryProductId = message.primaryProductId; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = message.categories[j]; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.toObject(message.priceInfo, options); - if (message.availableTime != null && message.hasOwnProperty("availableTime")) - object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); - if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) - object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.images && message.images.length) { - object.images = []; - for (var j = 0; j < message.images.length; ++j) - object.images[j] = $root.google.cloud.retail.v2beta.Image.toObject(message.images[j], options); + object.catalog = ""; + object.branchId = ""; + object.note = ""; } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this Product to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - Product.prototype.toJSON = function toJSON() { + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.retail.v2beta.Product.Type - * @enum {number} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} VARIANT=2 VARIANT value - * @property {number} COLLECTION=3 COLLECTION value - */ - Product.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "VARIANT"] = 2; - values[valuesById[3] = "COLLECTION"] = 3; - return values; - })(); - - /** - * Availability enum. - * @name google.cloud.retail.v2beta.Product.Availability - * @enum {number} - * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value - * @property {number} IN_STOCK=1 IN_STOCK value - * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value - * @property {number} PREORDER=3 PREORDER value - * @property {number} BACKORDER=4 BACKORDER value - */ - Product.Availability = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "IN_STOCK"] = 1; - values[valuesById[2] = "OUT_OF_STOCK"] = 2; - values[valuesById[3] = "PREORDER"] = 3; - values[valuesById[4] = "BACKORDER"] = 4; - return values; - })(); - - return Product; + return SetDefaultBranchRequest; })(); - v2beta.UserEvent = (function() { + v2alpha.GetDefaultBranchRequest = (function() { /** - * Properties of a UserEvent. - * @memberof google.cloud.retail.v2beta - * @interface IUserEvent - * @property {string|null} [eventType] UserEvent eventType - * @property {string|null} [visitorId] UserEvent visitorId - * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime - * @property {Array.|null} [experimentIds] UserEvent experimentIds - * @property {string|null} [attributionToken] UserEvent attributionToken - * @property {Array.|null} [productDetails] UserEvent productDetails - * @property {Object.|null} [attributes] UserEvent attributes - * @property {string|null} [cartId] UserEvent cartId - * @property {google.cloud.retail.v2beta.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction - * @property {string|null} [searchQuery] UserEvent searchQuery - * @property {Array.|null} [pageCategories] UserEvent pageCategories - * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] UserEvent userInfo - * @property {string|null} [uri] UserEvent uri - * @property {string|null} [referrerUri] UserEvent referrerUri - * @property {string|null} [pageViewId] UserEvent pageViewId + * Properties of a GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog */ /** - * Constructs a new UserEvent. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEvent. - * @implements IUserEvent + * Constructs a new GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest=} [properties] Properties to set */ - function UserEvent(properties) { - this.experimentIds = []; - this.productDetails = []; - this.attributes = {}; - this.pageCategories = []; + function GetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28666,288 +34674,290 @@ } /** - * UserEvent eventType. - * @member {string} eventType - * @memberof google.cloud.retail.v2beta.UserEvent + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest * @instance */ - UserEvent.prototype.eventType = ""; + GetDefaultBranchRequest.prototype.catalog = ""; /** - * UserEvent visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Creates a new GetDefaultBranchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest instance */ - UserEvent.prototype.visitorId = ""; + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); + }; /** - * UserEvent eventTime. - * @member {google.protobuf.ITimestamp|null|undefined} eventTime - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.eventTime = null; + GetDefaultBranchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + return writer; + }; /** - * UserEvent experimentIds. - * @member {Array.} experimentIds - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.experimentIds = $util.emptyArray; + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * UserEvent attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.attributionToken = ""; + GetDefaultBranchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * UserEvent productDetails. - * @member {Array.} productDetails - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.productDetails = $util.emptyArray; + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * UserEvent attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Verifies a GetDefaultBranchRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.prototype.attributes = $util.emptyObject; + GetDefaultBranchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + return null; + }; /** - * UserEvent cartId. - * @member {string} cartId - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest */ - UserEvent.prototype.cartId = ""; + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + return message; + }; /** - * UserEvent purchaseTransaction. - * @member {google.cloud.retail.v2beta.IPurchaseTransaction|null|undefined} purchaseTransaction - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.GetDefaultBranchRequest} message GetDefaultBranchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - UserEvent.prototype.purchaseTransaction = null; + GetDefaultBranchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + return object; + }; /** - * UserEvent searchQuery. - * @member {string} searchQuery - * @memberof google.cloud.retail.v2beta.UserEvent + * Converts this GetDefaultBranchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest * @instance + * @returns {Object.} JSON object */ - UserEvent.prototype.searchQuery = ""; + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDefaultBranchRequest; + })(); + + v2alpha.GetDefaultBranchResponse = (function() { /** - * UserEvent pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Properties of a GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note */ - UserEvent.prototype.pageCategories = $util.emptyArray; /** - * UserEvent userInfo. - * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance + * Constructs a new GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse=} [properties] Properties to set */ - UserEvent.prototype.userInfo = null; + function GetDefaultBranchResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * UserEvent uri. - * @member {string} uri - * @memberof google.cloud.retail.v2beta.UserEvent + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance */ - UserEvent.prototype.uri = ""; + GetDefaultBranchResponse.prototype.branch = ""; /** - * UserEvent referrerUri. - * @member {string} referrerUri - * @memberof google.cloud.retail.v2beta.UserEvent + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance */ - UserEvent.prototype.referrerUri = ""; + GetDefaultBranchResponse.prototype.setTime = null; /** - * UserEvent pageViewId. - * @member {string} pageViewId - * @memberof google.cloud.retail.v2beta.UserEvent + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance */ - UserEvent.prototype.pageViewId = ""; + GetDefaultBranchResponse.prototype.note = ""; /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent instance + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse instance */ - UserEvent.create = function create(properties) { - return new UserEvent(properties); + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); }; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encode = function encode(message, writer) { + GetDefaultBranchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); - if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) - $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.experimentIds != null && message.experimentIds.length) - for (var i = 0; i < message.experimentIds.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.productDetails != null && message.productDetails.length) - for (var i = 0; i < message.productDetails.length; ++i) - $root.google.cloud.retail.v2beta.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); - if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) - $root.google.cloud.retail.v2beta.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); - if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); - if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decode = function decode(reader, length) { + GetDefaultBranchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEvent(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.eventType = reader.string(); + message.branch = reader.string(); break; case 2: - message.visitorId = reader.string(); + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -28958,299 +34968,237 @@ }; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEvent message. + * Verifies a GetDefaultBranchResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.verify = function verify(message) { + GetDefaultBranchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.eventType != null && message.hasOwnProperty("eventType")) - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.eventTime); - if (error) - return "eventTime." + error; - } - if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { - if (!Array.isArray(message.experimentIds)) - return "experimentIds: array expected"; - for (var i = 0; i < message.experimentIds.length; ++i) - if (!$util.isString(message.experimentIds[i])) - return "experimentIds: string[] expected"; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.productDetails != null && message.hasOwnProperty("productDetails")) { - if (!Array.isArray(message.productDetails)) - return "productDetails: array expected"; - for (var i = 0; i < message.productDetails.length; ++i) { - var error = $root.google.cloud.retail.v2beta.ProductDetail.verify(message.productDetails[i]); - if (error) - return "productDetails." + error; - } - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - if (!$util.isString(message.cartId)) - return "cartId: string expected"; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { - var error = $root.google.cloud.retail.v2beta.PurchaseTransaction.verify(message.purchaseTransaction); - if (error) - return "purchaseTransaction." + error; - } - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - if (!$util.isString(message.searchQuery)) - return "searchQuery: string expected"; - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; - } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); if (error) - return "userInfo." + error; + return "setTime." + error; } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - if (!$util.isString(message.referrerUri)) - return "referrerUri: string expected"; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - if (!$util.isString(message.pageViewId)) - return "pageViewId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse */ - UserEvent.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEvent) + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse) return object; - var message = new $root.google.cloud.retail.v2beta.UserEvent(); - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.eventTime != null) { - if (typeof object.eventTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.eventTime: object expected"); - message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); - } - if (object.experimentIds) { - if (!Array.isArray(object.experimentIds)) - throw TypeError(".google.cloud.retail.v2beta.UserEvent.experimentIds: array expected"); - message.experimentIds = []; - for (var i = 0; i < object.experimentIds.length; ++i) - message.experimentIds[i] = String(object.experimentIds[i]); - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.productDetails) { - if (!Array.isArray(object.productDetails)) - throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: array expected"); - message.productDetails = []; - for (var i = 0; i < object.productDetails.length; ++i) { - if (typeof object.productDetails[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: object expected"); - message.productDetails[i] = $root.google.cloud.retail.v2beta.ProductDetail.fromObject(object.productDetails[i]); - } - } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.cartId != null) - message.cartId = String(object.cartId); - if (object.purchaseTransaction != null) { - if (typeof object.purchaseTransaction !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.purchaseTransaction: object expected"); - message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.fromObject(object.purchaseTransaction); - } - if (object.searchQuery != null) - message.searchQuery = String(object.searchQuery); - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2beta.UserEvent.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.referrerUri != null) - message.referrerUri = String(object.referrerUri); - if (object.pageViewId != null) - message.pageViewId = String(object.pageViewId); + var message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2beta.UserEvent} message UserEvent + * @param {google.cloud.retail.v2alpha.GetDefaultBranchResponse} message GetDefaultBranchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEvent.toObject = function toObject(message, options) { + GetDefaultBranchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.experimentIds = []; - object.productDetails = []; - object.pageCategories = []; - } - if (options.objects || options.defaults) - object.attributes = {}; if (options.defaults) { - object.eventType = ""; - object.visitorId = ""; - object.eventTime = null; - object.attributionToken = ""; - object.cartId = ""; - object.purchaseTransaction = null; - object.searchQuery = ""; - object.userInfo = null; - object.uri = ""; - object.referrerUri = ""; - object.pageViewId = ""; - } - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) - object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); - if (message.experimentIds && message.experimentIds.length) { - object.experimentIds = []; - for (var j = 0; j < message.experimentIds.length; ++j) - object.experimentIds[j] = message.experimentIds[j]; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.productDetails && message.productDetails.length) { - object.productDetails = []; - for (var j = 0; j < message.productDetails.length; ++j) - object.productDetails[j] = $root.google.cloud.retail.v2beta.ProductDetail.toObject(message.productDetails[j], options); - } - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - object.cartId = message.cartId; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) - object.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.toObject(message.purchaseTransaction, options); - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - object.searchQuery = message.searchQuery; - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; - } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - object.referrerUri = message.referrerUri; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - object.pageViewId = message.pageViewId; + object.branch = ""; + object.setTime = null; + object.note = ""; + } + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this UserEvent to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance * @returns {Object.} JSON object */ - UserEvent.prototype.toJSON = function toJSON() { + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEvent; + return GetDefaultBranchResponse; })(); - v2beta.ProductDetail = (function() { + v2alpha.CompletionService = (function() { /** - * Properties of a ProductDetail. - * @memberof google.cloud.retail.v2beta - * @interface IProductDetail - * @property {google.cloud.retail.v2beta.IProduct|null} [product] ProductDetail product - * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + * Constructs a new CompletionService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + + /** + * Creates new CompletionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.CompletionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. */ + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * Constructs a new ProductDetail. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductDetail. - * @implements IProductDetail + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2alpha.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} [response] CompleteQueryResponse + */ + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2alpha.CompleteQueryRequest, $root.google.cloud.retail.v2alpha.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2alpha.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; + })(); + + v2alpha.CompleteQueryRequest = (function() { + + /** + * Properties of a CompleteQueryRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + */ + + /** + * Constructs a new CompleteQueryRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest * @constructor - * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set */ - function ProductDetail(properties) { + function CompleteQueryRequest(properties) { + this.languageCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29258,88 +35206,156 @@ } /** - * ProductDetail product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.ProductDetail + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - ProductDetail.prototype.product = null; + CompleteQueryRequest.prototype.catalog = ""; /** - * ProductDetail quantity. - * @member {google.protobuf.IInt32Value|null|undefined} quantity - * @memberof google.cloud.retail.v2beta.ProductDetail + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - ProductDetail.prototype.quantity = null; + CompleteQueryRequest.prototype.query = ""; /** - * Creates a new ProductDetail instance using the specified properties. + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.visitorId = ""; + + /** + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + + /** + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.deviceType = ""; + + /** + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.dataset = ""; + + /** + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.maxSuggestions = 0; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest instance */ - ProductDetail.create = function create(properties) { - return new ProductDetail(properties); + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); }; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encode = function encode(message, writer) { + CompleteQueryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) - $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); return writer; }; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decode = function decode(reader, length) { + CompleteQueryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductDetail(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + message.catalog = reader.string(); break; case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); + break; + case 3: + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + case 4: + message.deviceType = reader.string(); + break; + case 6: + message.dataset = reader.string(); + break; + case 5: + message.maxSuggestions = reader.int32(); break; default: reader.skipType(tag & 7); @@ -29350,130 +35366,173 @@ }; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductDetail message. + * Verifies a CompleteQueryRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductDetail.verify = function verify(message) { + CompleteQueryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.quantity != null && message.hasOwnProperty("quantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.quantity); - if (error) - return "quantity." + error; - } + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; return null; }; /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest */ - ProductDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductDetail) + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryRequest) return object; - var message = new $root.google.cloud.retail.v2beta.ProductDetail(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductDetail.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); - } - if (object.quantity != null) { - if (typeof object.quantity !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductDetail.quantity: object expected"); - message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); - } + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; return message; }; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2beta.ProductDetail} message ProductDetail + * @param {google.cloud.retail.v2alpha.CompleteQueryRequest} message CompleteQueryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductDetail.toObject = function toObject(message, options) { + CompleteQueryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; if (options.defaults) { - object.product = null; - object.quantity = null; + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.quantity != null && message.hasOwnProperty("quantity")) - object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; return object; }; /** - * Converts this ProductDetail to JSON. + * Converts this CompleteQueryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductDetail + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance * @returns {Object.} JSON object */ - ProductDetail.prototype.toJSON = function toJSON() { + CompleteQueryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductDetail; + return CompleteQueryRequest; })(); - v2beta.PurchaseTransaction = (function() { + v2alpha.CompleteQueryResponse = (function() { /** - * Properties of a PurchaseTransaction. - * @memberof google.cloud.retail.v2beta - * @interface IPurchaseTransaction - * @property {string|null} [id] PurchaseTransaction id - * @property {number|null} [revenue] PurchaseTransaction revenue - * @property {number|null} [tax] PurchaseTransaction tax - * @property {number|null} [cost] PurchaseTransaction cost - * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + * Properties of a CompleteQueryResponse. + * @memberof google.cloud.retail.v2alpha + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults */ /** - * Constructs a new PurchaseTransaction. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurchaseTransaction. - * @implements IPurchaseTransaction + * Constructs a new CompleteQueryResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse * @constructor - * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set */ - function PurchaseTransaction(properties) { + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29481,127 +35540,107 @@ } /** - * PurchaseTransaction id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.id = ""; - - /** - * PurchaseTransaction revenue. - * @member {number} revenue - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.revenue = 0; - - /** - * PurchaseTransaction tax. - * @member {number} tax - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - PurchaseTransaction.prototype.tax = 0; + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; /** - * PurchaseTransaction cost. - * @member {number} cost - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - PurchaseTransaction.prototype.cost = 0; + CompleteQueryResponse.prototype.attributionToken = ""; /** - * PurchaseTransaction currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - PurchaseTransaction.prototype.currencyCode = ""; + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse instance */ - PurchaseTransaction.create = function create(properties) { - return new PurchaseTransaction(properties); + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); }; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encode = function encode(message, writer) { + CompleteQueryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); - if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decode = function decode(reader, length) { + CompleteQueryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.string(); + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); break; case 2: - message.revenue = reader.float(); + message.attributionToken = reader.string(); break; case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -29612,217 +35651,598 @@ }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurchaseTransaction message. + * Verifies a CompleteQueryResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurchaseTransaction.verify = function verify(message) { + CompleteQueryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.revenue != null && message.hasOwnProperty("revenue")) - if (typeof message.revenue !== "number") - return "revenue: number expected"; - if (message.tax != null && message.hasOwnProperty("tax")) - if (typeof message.tax !== "number") - return "tax: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } + } return null; }; /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse */ - PurchaseTransaction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurchaseTransaction) + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse) return object; - var message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); - if (object.id != null) - message.id = String(object.id); - if (object.revenue != null) - message.revenue = Number(object.revenue); - if (object.tax != null) - message.tax = Number(object.tax); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } + } return message; }; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2beta.PurchaseTransaction} message PurchaseTransaction + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} message CompleteQueryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurchaseTransaction.toObject = function toObject(message, options) { + CompleteQueryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.id = ""; - object.revenue = 0; - object.tax = 0; - object.cost = 0; - object.currencyCode = ""; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.revenue != null && message.hasOwnProperty("revenue")) - object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; - if (message.tax != null && message.hasOwnProperty("tax")) - object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; return object; }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this CompleteQueryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance * @returns {Object.} JSON object */ - PurchaseTransaction.prototype.toJSON = function toJSON() { + CompleteQueryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurchaseTransaction; - })(); + CompleteQueryResponse.CompletionResult = (function() { - v2beta.PredictionService = (function() { + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ - /** - * Constructs a new PredictionService service. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictionService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; - /** - * Creates new PredictionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2beta.PredictionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. - */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; - /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. - * @memberof google.cloud.retail.v2beta.PredictionService - * @typedef PredictCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse - */ + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; - /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2beta.PredictionService - * @instance - * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); - }, "name", { value: "Predict" }); + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; - /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2beta.PredictionService - * @instance - * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - return PredictionService; + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.suggestion = reader.string(); + break; + case 2: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionResult; + })(); + + CompleteQueryResponse.RecentSearchResult = (function() { + + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ + + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; })(); - v2beta.PredictRequest = (function() { + v2alpha.ExportErrorsConfig = (function() { /** - * Properties of a PredictRequest. - * @memberof google.cloud.retail.v2beta - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * Properties of an ExportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IExportErrorsConfig + * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix */ /** - * Constructs a new PredictRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest + * Constructs a new ExportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportErrorsConfig. + * @implements IExportErrorsConfig * @constructor - * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; + function ExportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29830,208 +36250,89 @@ } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance - */ - PredictRequest.prototype.placement = ""; - - /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance - */ - PredictRequest.prototype.userEvent = null; - - /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance - */ - PredictRequest.prototype.pageSize = 0; - - /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance - */ - PredictRequest.prototype.pageToken = ""; - - /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance - */ - PredictRequest.prototype.filter = ""; - - /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2beta.PredictRequest + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @instance */ - PredictRequest.prototype.validateOnly = false; + ExportErrorsConfig.prototype.gcsPrefix = null; - /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance - */ - PredictRequest.prototype.params = $util.emptyObject; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2beta.PredictRequest + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @instance */ - PredictRequest.prototype.labels = $util.emptyObject; + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new ExportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + ExportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes an ExportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + ExportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); - break; - case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -30042,208 +36343,112 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies an ExportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + ExportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } return null; }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PredictRequest) + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2beta.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvent); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); - } + var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.PredictRequest} message PredictRequest + * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictRequest.toObject = function toObject(message, options) { + ExportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } - if (options.defaults) { - object.placement = ""; - object.userEvent = null; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvent, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); - } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } return object; }; /** - * Converts this PredictRequest to JSON. + * Converts this ExportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @instance * @returns {Object.} JSON object */ - PredictRequest.prototype.toJSON = function toJSON() { + ExportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PredictRequest; + return ExportErrorsConfig; })(); - v2beta.PredictResponse = (function() { + v2alpha.ExportMetadata = (function() { /** - * Properties of a PredictResponse. - * @memberof google.cloud.retail.v2beta - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * Properties of an ExportMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime */ /** - * Constructs a new PredictResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * Constructs a new ExportMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata * @constructor - * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function ExportMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30251,120 +36456,312 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2beta.PredictResponse + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @instance */ - PredictResponse.prototype.results = $util.emptyArray; + ExportMetadata.prototype.createTime = null; /** - * PredictResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2beta.PredictResponse + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @instance */ - PredictResponse.prototype.attributionToken = ""; + ExportMetadata.prototype.updateTime = null; /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2beta.PredictResponse + * Creates a new ExportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance + */ + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); + }; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + */ + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this ExportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @instance + * @returns {Object.} JSON object */ - PredictResponse.prototype.missingIds = $util.emptyArray; + ExportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportMetadata; + })(); + + v2alpha.ExportProductsResponse = (function() { /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2beta.PredictResponse + * Properties of an ExportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IExportProductsResponse + * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + */ + + /** + * Constructs a new ExportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportProductsResponse. + * @implements IExportProductsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + */ + function ExportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @instance */ - PredictResponse.prototype.validateOnly = false; + ExportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * Creates a new PredictResponse instance using the specified properties. + * ExportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ExportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + ExportProductsResponse.create = function create(properties) { + return new ExportProductsResponse(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + ExportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes an ExportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + ExportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -30375,719 +36772,660 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies an ExportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + ExportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify(message.results[i]); + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); if (error) - return "results." + error; + return "errorSamples." + error; } } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse) + ExportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.fromObject(object.results[i]); + var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); } } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + ExportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; - } - if (options.defaults) { - object.attributionToken = ""; - object.validateOnly = false; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.toObject(message.results[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this ExportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + ExportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PredictResponse.PredictionResult = (function() { + return ExportProductsResponse; + })(); - /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2beta.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata - */ + v2alpha.ExportUserEventsResponse = (function() { - /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2beta.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of an ExportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IExportUserEventsResponse + * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + */ - /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.id = ""; + /** + * Constructs a new ExportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportUserEventsResponse. + * @implements IExportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + */ + function ExportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.metadata = $util.emptyObject; + /** + * ExportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; - /** - * Creates a new PredictionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult instance - */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); - }; + /** + * ExportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorsConfig = null; - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance + */ + ExportUserEventsResponse.create = function create(properties) { + return new ExportUserEventsResponse(properties); + }; - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a PredictionResult message. - * @function verify - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PredictionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); - if (error) - return "metadata." + error; - } + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; } - return null; - }; + } + return message; + }; - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult - */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult) - return object; - var message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); - } - } - return message; - }; + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.PredictionResult} message PredictionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PredictionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.metadata = {}; - if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + /** + * Verifies an ExportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + */ + ExportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) return object; - }; + var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; - /** - * Converts this PredictionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @instance - * @returns {Object.} JSON object - */ - PredictionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; - return PredictionResult; - })(); + /** + * Converts this ExportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return PredictResponse; + return ExportUserEventsResponse; })(); - v2beta.ProductService = (function() { + v2alpha.PredictionService = (function() { /** - * Constructs a new ProductService service. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductService + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictionService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; /** - * Creates new ProductService service using the specified rpc implementation. + * Creates new PredictionService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2beta.ProductService + * @memberof google.cloud.retail.v2alpha.PredictionService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef CreateProductCallback + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @memberof google.cloud.retail.v2alpha.PredictionService + * @typedef PredictCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Product} [response] Product + * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse */ /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2beta.ProductService + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService * @instance - * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2beta.CreateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); - }, "name", { value: "CreateProduct" }); + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); + }, "name", { value: "Predict" }); /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2beta.ProductService + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService * @instance - * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Product} [response] Product - */ + return PredictionService; + })(); - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2beta.GetProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); - }, "name", { value: "GetProduct" }); + v2alpha.PredictRequest = (function() { /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Product} [response] Product + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2beta.ProductService + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2beta.UpdateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); - }, "name", { value: "UpdateProduct" }); + PredictRequest.prototype.placement = ""; /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2beta.ProductService + * PredictRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + PredictRequest.prototype.userEvent = null; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance */ + PredictRequest.prototype.pageSize = 0; /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2beta.ProductService + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2beta.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); + PredictRequest.prototype.pageToken = ""; /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2beta.ProductService + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + PredictRequest.prototype.filter = ""; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance */ + PredictRequest.prototype.validateOnly = false; /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2beta.ProductService + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance - * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2beta.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); + PredictRequest.prototype.params = $util.emptyObject; /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2beta.ProductService + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance - * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ - - return ProductService; - })(); - - v2beta.CreateProductRequest = (function() { + PredictRequest.prototype.labels = $util.emptyObject; /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.retail.v2beta - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2beta.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; /** - * Constructs a new CreateProductRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest - * @constructor - * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - function CreateProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.product = null; - - /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.productId = ""; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @static - * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest instance - */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); - }; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @static - * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encode = function encode(message, writer) { + PredictRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); return writer; }; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static - * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decode = function decode(reader, length) { + PredictRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.placement = reader.string(); break; case 2: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); break; case 3: - message.productId = reader.string(); + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; break; default: reader.skipType(tag & 7); @@ -31098,129 +37436,208 @@ }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + PredictRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProductRequest message. + * Verifies a PredictRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProductRequest.verify = function verify(message) { + PredictRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); if (error) - return "product." + error; + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; return null; }; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CreateProductRequest) + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) return object; - var message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); } - if (object.productId != null) - message.productId = String(object.productId); return message; }; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static - * @param {google.cloud.retail.v2beta.CreateProductRequest} message CreateProductRequest + * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProductRequest.toObject = function toObject(message, options) { + PredictRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; return object; }; /** - * Converts this CreateProductRequest to JSON. + * Converts this PredictRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { + PredictRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateProductRequest; + return PredictRequest; })(); - v2beta.GetProductRequest = (function() { + v2alpha.PredictResponse = (function() { /** - * Properties of a GetProductRequest. - * @memberof google.cloud.retail.v2beta - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly */ /** - * Constructs a new GetProductRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse * @constructor - * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set */ - function GetProductRequest(properties) { + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31228,75 +37645,120 @@ } /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.GetProductRequest + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.PredictResponse * @instance */ - GetProductRequest.prototype.name = ""; + PredictResponse.prototype.results = $util.emptyArray; /** - * Creates a new GetProductRequest instance using the specified properties. + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest instance + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encode = function encode(message, writer) { + PredictResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + PredictResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); break; default: reader.skipType(tag & 7); @@ -31307,327 +37769,749 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + PredictResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a PredictResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + PredictResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; return null; }; /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.GetProductRequest) + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) return object; - var message = new $root.google.cloud.retail.v2beta.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.GetProductRequest - * @static - * @param {google.cloud.retail.v2beta.GetProductRequest} message GetProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; return object; }; /** - * Converts this GetProductRequest to JSON. + * Converts this PredictResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2alpha.PredictResponse * @instance * @returns {Object.} JSON object */ - GetProductRequest.prototype.toJSON = function toJSON() { + PredictResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProductRequest; + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; })(); - v2beta.UpdateProductRequest = (function() { + v2alpha.ProductService = (function() { /** - * Properties of an UpdateProductRequest. - * @memberof google.cloud.retail.v2beta - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2beta.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; /** - * Constructs a new UpdateProductRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest - * @constructor - * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. */ - function UpdateProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - UpdateProductRequest.prototype.product = null; + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "CreateProduct" }); /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - UpdateProductRequest.prototype.updateMask = null; /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest instance + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); - }; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - UpdateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "GetProduct" }); /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListProductsResponse} [response] ListProductsResponse */ - UpdateProductRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2alpha.ListProductsRequest, $root.google.cloud.retail.v2alpha.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); /** - * Verifies an UpdateProductRequest message. - * @function verify - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - UpdateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UpdateProductRequest) - return object; - var message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2beta.UpdateProductRequest} message UpdateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - UpdateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "UpdateProduct" }); /** - * Converts this UpdateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - UpdateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - return UpdateProductRequest; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2alpha.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; })(); - v2beta.DeleteProductRequest = (function() { + v2alpha.CreateProductRequest = (function() { /** - * Properties of a DeleteProductRequest. - * @memberof google.cloud.retail.v2beta - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId */ /** - * Constructs a new DeleteProductRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest * @constructor - * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set */ - function DeleteProductRequest(properties) { + function CreateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31635,75 +38519,101 @@ } /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @instance */ - DeleteProductRequest.prototype.name = ""; + CreateProductRequest.prototype.parent = ""; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * CreateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); }; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encode = function encode(message, writer) { + CreateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); return writer; }; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decode = function decode(reader, length) { + CreateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); break; default: reader.skipType(tag & 7); @@ -31714,106 +38624,129 @@ }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProductRequest message. + * Verifies a CreateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProductRequest.verify = function verify(message) { + CreateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; return null; }; /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.DeleteProductRequest) + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) return object; - var message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); return message; }; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.DeleteProductRequest} message DeleteProductRequest + * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProductRequest.toObject = function toObject(message, options) { + CreateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; return object; }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this CreateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @instance * @returns {Object.} JSON object */ - DeleteProductRequest.prototype.toJSON = function toJSON() { + CreateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteProductRequest; + return CreateProductRequest; })(); - v2beta.PurgeMetadata = (function() { + v2alpha.GetProductRequest = (function() { /** - * Properties of a PurgeMetadata. - * @memberof google.cloud.retail.v2beta - * @interface IPurgeMetadata + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name */ /** - * Constructs a new PurgeMetadata. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest * @constructor - * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function GetProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31821,63 +38754,76 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); }; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encode = function encode(message, writer) { + GetProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a GetProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decode = function decode(reader, length) { + GetProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -31887,96 +38833,109 @@ }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeMetadata message. + * Verifies a GetProductRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeMetadata.verify = function verify(message) { + GetProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurgeMetadata) + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) return object; - return new $root.google.cloud.retail.v2beta.PurgeMetadata(); + var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; }; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2beta.PurgeMetadata} message PurgeMetadata + * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeMetadata.toObject = function toObject() { - return {}; + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; }; /** - * Converts this PurgeMetadata to JSON. + * Converts this GetProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @instance * @returns {Object.} JSON object */ - PurgeMetadata.prototype.toJSON = function toJSON() { + GetProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeMetadata; + return GetProductRequest; })(); - v2beta.PurgeUserEventsRequest = (function() { + v2alpha.UpdateProductRequest = (function() { /** - * Properties of a PurgeUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing */ /** - * Constructs a new PurgeUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest * @constructor - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set */ - function PurgeUserEventsRequest(properties) { + function UpdateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31984,101 +38943,101 @@ } /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * UpdateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance */ - PurgeUserEventsRequest.prototype.parent = ""; + UpdateProductRequest.prototype.product = null; /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance */ - PurgeUserEventsRequest.prototype.filter = ""; + UpdateProductRequest.prototype.updateMask = null; /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * UpdateProductRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance */ - PurgeUserEventsRequest.prototype.force = false; + UpdateProductRequest.prototype.allowMissing = false; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new UpdateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + UpdateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes an UpdateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + UpdateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); break; case 2: - message.filter = reader.string(); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; case 3: - message.force = reader.bool(); + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -32089,124 +39048,134 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies an UpdateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + UpdateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsRequest) + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) return object; - var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); + var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2beta.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { + UpdateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; + object.product = null; + object.updateMask = null; + object.allowMissing = false; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this UpdateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + UpdateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + return UpdateProductRequest; })(); - v2beta.PurgeUserEventsResponse = (function() { + v2alpha.DeleteProductRequest = (function() { /** - * Properties of a PurgeUserEventsResponse. - * @memberof google.cloud.retail.v2beta - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name */ /** - * Constructs a new PurgeUserEventsResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest * @constructor - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function DeleteProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32214,75 +39183,75 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @instance */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DeleteProductRequest.prototype.name = ""; /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new DeleteProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); }; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encode = function encode(message, writer) { + DeleteProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + DeleteProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.purgedEventsCount = reader.int64(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -32293,101 +39262,30612 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a DeleteProductRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsResponse.verify = function verify(message) { + DeleteProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsResponse) + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) return object; - var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { + DeleteProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this DeleteProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @instance * @returns {Object.} JSON object */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + DeleteProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsResponse; + return DeleteProductRequest; + })(); + + v2alpha.ListProductsRequest = (function() { + + /** + * Properties of a ListProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + * @property {boolean|null} [requireTotalSize] ListProductsRequest requireTotalSize + */ + + /** + * Constructs a new ListProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set + */ + function ListProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.parent = ""; + + /** + * ListProductsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageSize = 0; + + /** + * ListProductsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageToken = ""; + + /** + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.filter = ""; + + /** + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * ListProductsRequest requireTotalSize. + * @member {boolean} requireTotalSize + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.requireTotalSize = false; + + /** + * Creates a new ListProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest instance + */ + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); + }; + + /** + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.requireTotalSize != null && Object.hasOwnProperty.call(message, "requireTotalSize")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requireTotalSize); + return writer; + }; + + /** + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 6: + message.requireTotalSize = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (error) + return "readMask." + error; + } + if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) + if (typeof message.requireTotalSize !== "boolean") + return "requireTotalSize: boolean expected"; + return null; + }; + + /** + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + */ + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + } + if (object.requireTotalSize != null) + message.requireTotalSize = Boolean(object.requireTotalSize); + return message; + }; + + /** + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {google.cloud.retail.v2alpha.ListProductsRequest} message ListProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.readMask = null; + object.requireTotalSize = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); + if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) + object.requireTotalSize = message.requireTotalSize; + return object; + }; + + /** + * Converts this ListProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProductsRequest; + })(); + + v2alpha.ListProductsResponse = (function() { + + /** + * Properties of a ListProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + * @property {number|null} [totalSize] ListProductsResponse totalSize + */ + + /** + * Constructs a new ListProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set + */ + function ListProductsResponse(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.products = $util.emptyArray; + + /** + * ListProductsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.nextPageToken = ""; + + /** + * ListProductsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse instance + */ + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); + }; + + /** + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + message.totalSize = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + */ + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.ListProductsResponse} message ListProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this ListProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProductsResponse; + })(); + + v2alpha.SetInventoryRequest = (function() { + + /** + * Properties of a SetInventoryRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + */ + + /** + * Constructs a new SetInventoryRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set + */ + function SetInventoryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.inventory = null; + + /** + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setMask = null; + + /** + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest instance + */ + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); + }; + + /** + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2alpha.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 2: + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.inventory); + if (error) + return "inventory." + error; + } + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); + if (error) + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + */ + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2alpha.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2alpha.SetInventoryRequest} message SetInventoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2alpha.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this SetInventoryRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + * @returns {Object.} JSON object + */ + SetInventoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetInventoryRequest; + })(); + + v2alpha.SetInventoryMetadata = (function() { + + /** + * Properties of a SetInventoryMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface ISetInventoryMetadata + */ + + /** + * Constructs a new SetInventoryMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set + */ + function SetInventoryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SetInventoryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata instance + */ + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); + }; + + /** + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + */ + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); + }; + + /** + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2alpha.SetInventoryMetadata} message SetInventoryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetInventoryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @instance + * @returns {Object.} JSON object + */ + SetInventoryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetInventoryMetadata; + })(); + + v2alpha.SetInventoryResponse = (function() { + + /** + * Properties of a SetInventoryResponse. + * @memberof google.cloud.retail.v2alpha + * @interface ISetInventoryResponse + */ + + /** + * Constructs a new SetInventoryResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse + * @constructor + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set + */ + function SetInventoryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SetInventoryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse instance + */ + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); + }; + + /** + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + */ + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryResponse) + return object; + return new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); + }; + + /** + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2alpha.SetInventoryResponse} message SetInventoryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetInventoryResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @instance + * @returns {Object.} JSON object + */ + SetInventoryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetInventoryResponse; + })(); + + v2alpha.AddFulfillmentPlacesRequest = (function() { + + /** + * Properties of an AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + */ + + /** + * Constructs a new AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set + */ + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.product = ""; + + /** + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.type = ""; + + /** + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.addTime = null; + + /** + * AddFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + */ + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + */ + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this AddFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddFulfillmentPlacesRequest; + })(); + + v2alpha.AddFulfillmentPlacesMetadata = (function() { + + /** + * Properties of an AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IAddFulfillmentPlacesMetadata + */ + + /** + * Constructs a new AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function AddFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance + */ + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + */ + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddFulfillmentPlacesMetadata; + })(); + + v2alpha.AddFulfillmentPlacesResponse = (function() { + + /** + * Properties of an AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IAddFulfillmentPlacesResponse + */ + + /** + * Constructs a new AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set + */ + function AddFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance + */ + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + */ + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddFulfillmentPlacesResponse; + })(); + + v2alpha.RemoveFulfillmentPlacesRequest = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + */ + + /** + * Constructs a new RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.product = ""; + + /** + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.type = ""; + + /** + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + + /** + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + */ + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + */ + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesRequest; + })(); + + v2alpha.RemoveFulfillmentPlacesMetadata = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveFulfillmentPlacesMetadata + */ + + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + */ + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + */ + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesMetadata; + })(); + + v2alpha.RemoveFulfillmentPlacesResponse = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveFulfillmentPlacesResponse + */ + + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + */ + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + */ + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesResponse; + })(); + + v2alpha.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeMetadata; + })(); + + v2alpha.PurgeUserEventsRequest = (function() { + + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ + + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; + + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; + + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsRequest; + })(); + + v2alpha.PurgeUserEventsResponse = (function() { + + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ + + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsResponse; + })(); + + v2alpha.SearchService = (function() { + + /** + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; + + /** + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * @memberof google.cloud.retail.v2alpha.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.SearchResponse} [response] SearchResponse + */ + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2alpha.SearchService + * @instance + * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2alpha.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2alpha.SearchRequest, $root.google.cloud.retail.v2alpha.SearchResponse, request, callback); + }, "name", { value: "Search" }); + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2alpha.SearchService + * @instance + * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SearchService; + })(); + + v2alpha.SearchRequest = (function() { + + /** + * Properties of a SearchRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null} [relevanceThreshold] SearchRequest relevanceThreshold + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + */ + + /** + * Constructs a new SearchRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set + */ + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.placement = ""; + + /** + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.branch = ""; + + /** + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.query = ""; + + /** + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.visitorId = ""; + + /** + * SearchRequest userInfo. + * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.userInfo = null; + + /** + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.pageSize = 0; + + /** + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.pageToken = ""; + + /** + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.offset = 0; + + /** + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.filter = ""; + + /** + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.canonicalFilter = ""; + + /** + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.orderBy = ""; + + /** + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.facetSpecs = $util.emptyArray; + + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; + + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; + + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; + + /** + * SearchRequest relevanceThreshold. + * @member {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} relevanceThreshold + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.relevanceThreshold = 0; + + /** + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + + /** + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * Creates a new SearchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest instance + */ + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); + }; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.relevanceThreshold != null && Object.hasOwnProperty.call(message, "relevanceThreshold")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.relevanceThreshold); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + return writer; + }; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.branch = reader.string(); + break; + case 3: + message.query = reader.string(); + break; + case 4: + message.visitorId = reader.string(); + break; + case 5: + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); + break; + case 10: + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 15: + message.relevanceThreshold = reader.int32(); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (error) + return "facetSpecs." + error; + } + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) + switch (message.relevanceThreshold) { + default: + return "relevanceThreshold: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + return null; + }; + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + */ + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + switch (object.relevanceThreshold) { + case "RELEVANCE_THRESHOLD_UNSPECIFIED": + case 0: + message.relevanceThreshold = 0; + break; + case "HIGH": + case 1: + message.relevanceThreshold = 1; + break; + case "MEDIUM": + case 2: + message.relevanceThreshold = 2; + break; + case "LOW": + case 3: + message.relevanceThreshold = 3; + break; + case "LOWEST": + case 4: + message.relevanceThreshold = 4; + break; + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + return message; + }; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest} message SearchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; + } + if (options.defaults) { + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.relevanceThreshold = options.enums === String ? "RELEVANCE_THRESHOLD_UNSPECIFIED" : 0; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) + object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + return object; + }; + + /** + * Converts this SearchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + * @returns {Object.} JSON object + */ + SearchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchRequest.FacetSpec = (function() { + + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ + + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; + + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; + + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + case 2: + message.limit = reader.int32(); + break; + case 3: + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + case 4: + message.enableDynamicPosition = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); + if (error) + return "facetKey." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); + } + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; + } + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; + return object; + }; + + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + FacetSpec.FacetKey = (function() { + + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ + + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; + + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; + + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; + + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; + + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; + + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; + + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; + + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2alpha.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + return writer; + }; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + return null; + }; + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + return message; + }; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2alpha.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + return object; + }; + + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetKey; + })(); + + return FacetSpec; + })(); + + SearchRequest.DynamicFacetSpec = (function() { + + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ + + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); + + return DynamicFacetSpec; + })(); + + SearchRequest.BoostSpec = (function() { + + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + */ + + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + return null; + }; + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + return object; + }; + + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BoostSpec.ConditionBoostSpec = (function() { + + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ + + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; + + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConditionBoostSpec; + })(); + + return BoostSpec; + })(); + + SearchRequest.QueryExpansionSpec = (function() { + + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + */ + + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + return writer; + }; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + return object; + }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Condition enum. + * @name google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; + })(); + + /** + * RelevanceThreshold enum. + * @name google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold + * @enum {number} + * @property {number} RELEVANCE_THRESHOLD_UNSPECIFIED=0 RELEVANCE_THRESHOLD_UNSPECIFIED value + * @property {number} HIGH=1 HIGH value + * @property {number} MEDIUM=2 MEDIUM value + * @property {number} LOW=3 LOW value + * @property {number} LOWEST=4 LOWEST value + */ + SearchRequest.RelevanceThreshold = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RELEVANCE_THRESHOLD_UNSPECIFIED"] = 0; + values[valuesById[1] = "HIGH"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + values[valuesById[3] = "LOW"] = 3; + values[valuesById[4] = "LOWEST"] = 4; + return values; + })(); + + return SearchRequest; + })(); + + v2alpha.SearchResponse = (function() { + + /** + * Properties of a SearchResponse. + * @memberof google.cloud.retail.v2alpha + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + */ + + /** + * Constructs a new SearchResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse + * @constructor + * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + */ + function SearchResponse(properties) { + this.results = []; + this.facets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.results = $util.emptyArray; + + /** + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.facets = $util.emptyArray; + + /** + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.totalSize = 0; + + /** + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.correctedQuery = ""; + + /** + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.attributionToken = ""; + + /** + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.nextPageToken = ""; + + /** + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.queryExpansionInfo = null; + + /** + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.redirectUri = ""; + + /** + * Creates a new SearchResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse instance + */ + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); + }; + + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + return writer; + }; + + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + case 3: + message.totalSize = reader.int32(); + break; + case 4: + message.correctedQuery = reader.string(); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + message.nextPageToken = reader.string(); + break; + case 7: + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + case 10: + message.redirectUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.verify(message.facets[i]); + if (error) + return "facets." + error; + } + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (error) + return "queryExpansionInfo." + error; + } + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + */ + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.fromObject(object.results[i]); + } + } + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.fromObject(object.facets[i]); + } + } + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse} message SearchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + } + if (options.defaults) { + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + return object; + }; + + /** + * Converts this SearchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + * @returns {Object.} JSON object + */ + SearchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchResponse.SearchResult = (function() { + + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + */ + + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; + + /** + * SearchResult product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; + + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; + + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; + + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; + + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + return null; + }; + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; + } + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } + return object; + }; + + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SearchResult; + })(); + + SearchResponse.Facet = (function() { + + /** + * Properties of a Facet. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet + */ + + /** + * Constructs a new Facet. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set + */ + function Facet(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.key = ""; + + /** + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; + + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; + + /** + * Creates a new Facet instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet instance + */ + Facet.create = function create(properties) { + return new Facet(properties); + }; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); + return writer; + }; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Facet message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Facet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; + return null; + }; + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet + */ + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); + return message; + }; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet} message Facet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Facet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; + return object; + }; + + /** + * Converts this Facet to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + * @returns {Object.} JSON object + */ + Facet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Facet.FacetValue = (function() { + + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2alpha.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ + + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; + + /** + * FacetValue interval. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; + + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2alpha.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; + + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetValue; + })(); + + return Facet; + })(); + + SearchResponse.QueryExpansionInfo = (function() { + + /** + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + */ + + /** + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + */ + function QueryExpansionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.expandedQuery = false; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + */ + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); + }; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + return writer; + }; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expandedQuery = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionInfo message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + */ + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.expandedQuery = false; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + return object; + }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryExpansionInfo; + })(); + + return SearchResponse; + })(); + + v2alpha.UserEventService = (function() { + + /** + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + */ + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.UserEvent} [response] UserEvent + */ + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2alpha.WriteUserEventRequest, $root.google.cloud.retail.v2alpha.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2alpha.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2alpha.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UserEventService; + })(); + + v2alpha.WriteUserEventRequest = (function() { + + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ + + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; + + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + return null; + }; + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + */ + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.WriteUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); + } + return message; + }; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.WriteUserEventRequest} message WriteUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + return object; + }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + WriteUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WriteUserEventRequest; + })(); + + v2alpha.CollectUserEventRequest = (function() { + + /** + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets + */ + + /** + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + */ + function CollectUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.parent = ""; + + /** + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.userEvent = ""; + + /** + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; + + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest instance + */ + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); + }; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); + return writer; + }; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; + return null; + }; + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + */ + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CollectUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) + if ($util.Long) + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.CollectUserEventRequest} message CollectUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ets = options.longs === String ? "0" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; + else + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; + return object; + }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + CollectUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CollectUserEventRequest; + })(); + + v2alpha.RejoinUserEventsRequest = (function() { + + /** + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + */ + + /** + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + */ + function RejoinUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.parent = ""; + + /** + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest instance + */ + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); + }; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEventRejoinScope = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + */ + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + return object; + }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + */ + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; + })(); + + return RejoinUserEventsRequest; + })(); + + v2alpha.RejoinUserEventsResponse = (function() { + + /** + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount + */ + + /** + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set + */ + function RejoinUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @instance + */ + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse instance + */ + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); + }; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rejoinedUserEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse + */ + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + return object; + }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsResponse; + })(); + + v2alpha.RejoinUserEventsMetadata = (function() { + + /** + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsMetadata + */ + + /** + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set + */ + function RejoinUserEventsMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance + */ + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata + */ + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); + }; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} message RejoinUserEventsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsMetadata; + })(); + + return v2alpha; + })(); + + retail.v2beta = (function() { + + /** + * Namespace v2beta. + * @memberof google.cloud.retail + * @namespace + */ + var v2beta = {}; + + v2beta.ProductLevelConfig = (function() { + + /** + * Properties of a ProductLevelConfig. + * @memberof google.cloud.retail.v2beta + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + */ + + /** + * Constructs a new ProductLevelConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig + * @constructor + * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set + */ + function ProductLevelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.ingestionProductType = ""; + + /** + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig instance + */ + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); + }; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + return writer; + }; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ingestionProductType = reader.string(); + break; + case 2: + message.merchantCenterProductIdField = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductLevelConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductLevelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; + return null; + }; + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig + */ + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductLevelConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + return message; + }; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2beta.ProductLevelConfig} message ProductLevelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductLevelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; + } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; + return object; + }; + + /** + * Converts this ProductLevelConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @instance + * @returns {Object.} JSON object + */ + ProductLevelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductLevelConfig; + })(); + + v2beta.Catalog = (function() { + + /** + * Properties of a Catalog. + * @memberof google.cloud.retail.v2beta + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2beta.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + */ + + /** + * Constructs a new Catalog. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Catalog. + * @implements ICatalog + * @constructor + * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set + */ + function Catalog(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.name = ""; + + /** + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; + + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2beta.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; + + /** + * Creates a new Catalog instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Catalog} Catalog instance + */ + Catalog.create = function create(properties) { + return new Catalog(properties); + }; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2beta.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2beta.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + return null; + }; + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Catalog} Catalog + */ + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Catalog) + return object; + var message = new $root.google.cloud.retail.v2beta.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.fromObject(object.productLevelConfig); + } + return message; + }; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {google.cloud.retail.v2beta.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.toObject(message.productLevelConfig, options); + return object; + }; + + /** + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + * @returns {Object.} JSON object + */ + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Catalog; + })(); + + v2beta.Audience = (function() { + + /** + * Properties of an Audience. + * @memberof google.cloud.retail.v2beta + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups + */ + + /** + * Constructs a new Audience. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an Audience. + * @implements IAudience + * @constructor + * @param {google.cloud.retail.v2beta.IAudience=} [properties] Properties to set + */ + function Audience(properties) { + this.genders = []; + this.ageGroups = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2beta.Audience + * @instance + */ + Audience.prototype.genders = $util.emptyArray; + + /** + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2beta.Audience + * @instance + */ + Audience.prototype.ageGroups = $util.emptyArray; + + /** + * Creates a new Audience instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {google.cloud.retail.v2beta.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Audience} Audience instance + */ + Audience.create = function create(properties) { + return new Audience(properties); + }; + + /** + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {google.cloud.retail.v2beta.IAudience} message Audience message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Audience.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); + return writer; + }; + + /** + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {google.cloud.retail.v2beta.IAudience} message Audience message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Audience.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Audience message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Audience} Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Audience.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Audience(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); + break; + case 2: + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Audience message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Audience} Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Audience.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Audience message. + * @function verify + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Audience.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; + } + return null; + }; + + /** + * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Audience} Audience + */ + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Audience) + return object; + var message = new $root.google.cloud.retail.v2beta.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2beta.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2beta.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); + } + return message; + }; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {google.cloud.retail.v2beta.Audience} message Audience + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Audience.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; + } + return object; + }; + + /** + * Converts this Audience to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Audience + * @instance + * @returns {Object.} JSON object + */ + Audience.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Audience; + })(); + + v2beta.ColorInfo = (function() { + + /** + * Properties of a ColorInfo. + * @memberof google.cloud.retail.v2beta + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors + */ + + /** + * Constructs a new ColorInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ColorInfo. + * @implements IColorInfo + * @constructor + * @param {google.cloud.retail.v2beta.IColorInfo=} [properties] Properties to set + */ + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2beta.ColorInfo + * @instance + */ + ColorInfo.prototype.colorFamilies = $util.emptyArray; + + /** + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2beta.ColorInfo + * @instance + */ + ColorInfo.prototype.colors = $util.emptyArray; + + /** + * Creates a new ColorInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {google.cloud.retail.v2beta.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo instance + */ + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); + }; + + /** + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {google.cloud.retail.v2beta.IColorInfo} message ColorInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColorInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); + return writer; + }; + + /** + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {google.cloud.retail.v2beta.IColorInfo} message ColorInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ColorInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColorInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ColorInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); + break; + case 2: + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColorInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ColorInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ColorInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; + } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; + } + return null; + }; + + /** + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo + */ + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ColorInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2beta.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); + } + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2beta.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); + } + return message; + }; + + /** + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {google.cloud.retail.v2beta.ColorInfo} message ColorInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ColorInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; + } + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; + } + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; + } + return object; + }; + + /** + * Converts this ColorInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ColorInfo + * @instance + * @returns {Object.} JSON object + */ + ColorInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ColorInfo; + })(); + + v2beta.CustomAttribute = (function() { + + /** + * Properties of a CustomAttribute. + * @memberof google.cloud.retail.v2beta + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable + */ + + /** + * Constructs a new CustomAttribute. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute + * @constructor + * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + */ + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.text = $util.emptyArray; + + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; + + /** + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.searchable = null; + + /** + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.indexable = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute instance + */ + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); + }; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); + return writer; + }; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + case 2: + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + case 3: + message.searchable = reader.bool(); + break; + case 4: + message.indexable = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomAttribute message. + * @function verify + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomAttribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; + } + return null; + }; + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + */ + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CustomAttribute) + return object; + var message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); + return message; + }; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {google.cloud.retail.v2beta.CustomAttribute} message CustomAttribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomAttribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; + if (options.oneofs) + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; + } + return object; + }; + + /** + * Converts this CustomAttribute to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + * @returns {Object.} JSON object + */ + CustomAttribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomAttribute; + })(); + + v2beta.FulfillmentInfo = (function() { + + /** + * Properties of a FulfillmentInfo. + * @memberof google.cloud.retail.v2beta + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds + */ + + /** + * Constructs a new FulfillmentInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo + * @constructor + * @param {google.cloud.retail.v2beta.IFulfillmentInfo=} [properties] Properties to set + */ + function FulfillmentInfo(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @instance + */ + FulfillmentInfo.prototype.type = ""; + + /** + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @instance + */ + FulfillmentInfo.prototype.placeIds = $util.emptyArray; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2beta.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo instance + */ + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); + }; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2beta.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + return writer; + }; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2beta.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.FulfillmentInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FulfillmentInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FulfillmentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + return null; + }; + + /** + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo + */ + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.FulfillmentInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2beta.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2beta.FulfillmentInfo} message FulfillmentInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FulfillmentInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + return object; + }; + + /** + * Converts this FulfillmentInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @instance + * @returns {Object.} JSON object + */ + FulfillmentInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FulfillmentInfo; + })(); + + v2beta.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.retail.v2beta + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + */ + function Image(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.uri = ""; + + /** + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Image.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Image message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Image} Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Image.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Image message. + * @function verify + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Image.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + return null; + }; + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Image) + return object; + var message = new $root.google.cloud.retail.v2beta.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {google.cloud.retail.v2beta.Image} message Image + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Image.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.height = 0; + object.width = 0; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Image + * @instance + * @returns {Object.} JSON object + */ + Image.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Image; + })(); + + v2beta.Interval = (function() { + + /** + * Properties of an Interval. + * @memberof google.cloud.retail.v2beta + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum + */ + + /** + * Constructs a new Interval. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an Interval. + * @implements IInterval + * @constructor + * @param {google.cloud.retail.v2beta.IInterval=} [properties] Properties to set + */ + function Interval(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Interval.prototype.minimum = null; + + /** + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Interval.prototype.exclusiveMinimum = null; + + /** + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Interval.prototype.maximum = null; + + /** + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Interval instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {google.cloud.retail.v2beta.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Interval} Interval instance + */ + Interval.create = function create(properties) { + return new Interval(properties); + }; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {google.cloud.retail.v2beta.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); + return writer; + }; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {google.cloud.retail.v2beta.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Interval(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minimum = reader.double(); + break; + case 2: + message.exclusiveMinimum = reader.double(); + break; + case 3: + message.maximum = reader.double(); + break; + case 4: + message.exclusiveMaximum = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Interval message. + * @function verify + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Interval.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; + } + return null; + }; + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Interval} Interval + */ + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Interval) + return object; + var message = new $root.google.cloud.retail.v2beta.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); + return message; + }; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {google.cloud.retail.v2beta.Interval} message Interval + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Interval.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; + } + return object; + }; + + /** + * Converts this Interval to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Interval + * @instance + * @returns {Object.} JSON object + */ + Interval.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Interval; + })(); + + v2beta.PriceInfo = (function() { + + /** + * Properties of a PriceInfo. + * @memberof google.cloud.retail.v2beta + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2beta.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange + */ + + /** + * Constructs a new PriceInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo + * @constructor + * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + */ + function PriceInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.currencyCode = ""; + + /** + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; + + /** + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.originalPrice = 0; + + /** + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.priceEffectiveTime = null; + + /** + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.priceExpireTime = null; + + /** + * PriceInfo priceRange. + * @member {google.cloud.retail.v2beta.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + */ + PriceInfo.prototype.priceRange = null; + + /** + * Creates a new PriceInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo instance + */ + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); + }; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; + } + return null; + }; + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + */ + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.fromObject(object.priceRange); + } + return message; + }; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {google.cloud.retail.v2beta.PriceInfo} message PriceInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.toObject(message.priceRange, options); + return object; + }; + + /** + * Converts this PriceInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance + * @returns {Object.} JSON object + */ + PriceInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PriceInfo.PriceRange = (function() { + + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2beta.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2beta.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2beta.IInterval|null} [originalPrice] PriceRange originalPrice + */ + + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2beta.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceRange price. + * @member {google.cloud.retail.v2beta.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; + + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2beta.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; + + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2beta.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2beta.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2beta.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2beta.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2beta.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2beta.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2beta.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + + return PriceInfo; + })(); + + v2beta.Rating = (function() { + + /** + * Properties of a Rating. + * @memberof google.cloud.retail.v2beta + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram + */ + + /** + * Constructs a new Rating. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Rating. + * @implements IRating + * @constructor + * @param {google.cloud.retail.v2beta.IRating=} [properties] Properties to set + */ + function Rating(properties) { + this.ratingHistogram = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2beta.Rating + * @instance + */ + Rating.prototype.ratingCount = 0; + + /** + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2beta.Rating + * @instance + */ + Rating.prototype.averageRating = 0; + + /** + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2beta.Rating + * @instance + */ + Rating.prototype.ratingHistogram = $util.emptyArray; + + /** + * Creates a new Rating instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rating} Rating instance + */ + Rating.create = function create(properties) { + return new Rating(properties); + }; + + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.IRating} message Rating message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rating.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.IRating} message Rating message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rating.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rating} Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rating.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rating(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ratingCount = reader.int32(); + break; + case 2: + message.averageRating = reader.float(); + break; + case 3: + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rating} Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rating.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Rating message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Rating.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; + } + return null; + }; + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rating} Rating + */ + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rating) + return object; + var message = new $root.google.cloud.retail.v2beta.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2beta.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; + } + return message; + }; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.Rating} message Rating + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Rating.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ratingHistogram = []; + if (options.defaults) { + object.ratingCount = 0; + object.averageRating = 0; + } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; + } + return object; + }; + + /** + * Converts this Rating to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rating + * @instance + * @returns {Object.} JSON object + */ + Rating.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Rating; + })(); + + v2beta.UserInfo = (function() { + + /** + * Properties of a UserInfo. + * @memberof google.cloud.retail.v2beta + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + */ + + /** + * Constructs a new UserInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserInfo. + * @implements IUserInfo + * @constructor + * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + */ + function UserInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.userId = ""; + + /** + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.ipAddress = ""; + + /** + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo instance + */ + UserInfo.create = function create(properties) { + return new UserInfo(properties); + }; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + return writer; + }; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; + return null; + }; + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + */ + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); + return message; + }; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.UserInfo} message UserInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; + } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; + return object; + }; + + /** + * Converts this UserInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserInfo + * @instance + * @returns {Object.} JSON object + */ + UserInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserInfo; + })(); + + v2beta.Promotion = (function() { + + /** + * Properties of a Promotion. + * @memberof google.cloud.retail.v2beta + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId + */ + + /** + * Constructs a new Promotion. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Promotion. + * @implements IPromotion + * @constructor + * @param {google.cloud.retail.v2beta.IPromotion=} [properties] Properties to set + */ + function Promotion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2beta.Promotion + * @instance + */ + Promotion.prototype.promotionId = ""; + + /** + * Creates a new Promotion instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Promotion} Promotion instance + */ + Promotion.create = function create(properties) { + return new Promotion(properties); + }; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + return writer; + }; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Promotion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.promotionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Promotion message. + * @function verify + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Promotion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; + return null; + }; + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Promotion} Promotion + */ + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Promotion) + return object; + var message = new $root.google.cloud.retail.v2beta.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); + return message; + }; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.Promotion} message Promotion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Promotion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; + return object; + }; + + /** + * Converts this Promotion to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Promotion + * @instance + * @returns {Object.} JSON object + */ + Promotion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Promotion; + })(); + + v2beta.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.retail.v2beta + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + this.inputUris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + */ + GcsSource.prototype.inputUris = $util.emptyArray; + + /** + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + case 2: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GcsSource) + return object; + var message = new $root.google.cloud.retail.v2beta.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2beta.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); + } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.GcsSource} message GcsSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v2beta.BigQuerySource = (function() { + + /** + * Properties of a BigQuerySource. + * @memberof google.cloud.retail.v2beta + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema + */ + + /** + * Constructs a new BigQuerySource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource + * @constructor + * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + */ + function BigQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.partitionDate = null; + + /** + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.projectId = ""; + + /** + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource instance + */ + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); + }; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 5: + message.projectId = reader.string(); + break; + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQuerySource message. + * @function verify + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; + { + var error = $root.google.type.Date.verify(message.partitionDate); + if (error) + return "partitionDate." + error; + } + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + */ + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.BigQuerySource) + return object; + var message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2beta.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); + } + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.BigQuerySource} message BigQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (options.oneofs) + object.partition = "partitionDate"; + } + return object; + }; + + /** + * Converts this BigQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + * @returns {Object.} JSON object + */ + BigQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQuerySource; + })(); + + v2beta.ProductInlineSource = (function() { + + /** + * Properties of a ProductInlineSource. + * @memberof google.cloud.retail.v2beta + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products + */ + + /** + * Constructs a new ProductInlineSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource + * @constructor + * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + */ + function ProductInlineSource(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @instance + */ + ProductInlineSource.prototype.products = $util.emptyArray; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource instance + */ + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); + }; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + return null; + }; + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + */ + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductInlineSource) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.ProductInlineSource} message ProductInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); + } + return object; + }; + + /** + * Converts this ProductInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @instance + * @returns {Object.} JSON object + */ + ProductInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInlineSource; + })(); + + v2beta.UserEventInlineSource = (function() { + + /** + * Properties of a UserEventInlineSource. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + */ + + /** + * Constructs a new UserEventInlineSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + */ + function UserEventInlineSource(properties) { + this.userEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource instance + */ + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); + }; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + */ + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventInlineSource) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.UserEventInlineSource} message UserEventInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvents[j], options); + } + return object; + }; + + /** + * Converts this UserEventInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @instance + * @returns {Object.} JSON object + */ + UserEventInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInlineSource; + })(); + + v2beta.ImportErrorsConfig = (function() { + + /** + * Properties of an ImportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ImportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + */ + function ImportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + */ + ImportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + */ + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig instance + */ + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); + }; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + */ + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.ImportErrorsConfig} message ImportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ImportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportErrorsConfig; + })(); + + v2beta.ImportProductsRequest = (function() { + + /** + * Properties of an ImportProductsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2beta.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + */ + + /** + * Constructs a new ImportProductsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + */ + function ImportProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.parent = ""; + + /** + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.requestId = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2beta.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest instance + */ + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); + }; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); + return writer; + }; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 6: + message.requestId = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + */ + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.ImportProductsRequest} message ImportProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; + + /** + * Converts this ImportProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ReconciliationMode enum. + * @name google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value + */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); + + return ImportProductsRequest; + })(); + + v2beta.ImportUserEventsRequest = (function() { + + /** + * Properties of an ImportUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2beta.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + */ + + /** + * Constructs a new ImportUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + */ + function ImportUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.parent = ""; + + /** + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2beta.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.inputConfig = null; + + /** + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.errorsConfig = null; + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest instance + */ + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); + }; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + */ + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsRequest; + })(); + + v2beta.ImportCompletionDataRequest = (function() { + + /** + * Properties of an ImportCompletionDataRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2beta.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic + */ + + /** + * Constructs a new ImportCompletionDataRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest=} [properties] Properties to set + */ + function ImportCompletionDataRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.parent = ""; + + /** + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2beta.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.inputConfig = null; + + /** + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest instance + */ + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); + }; + + /** + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); + return writer; + }; + + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportCompletionDataRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportCompletionDataRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportCompletionDataRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; + + /** + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest + */ + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportCompletionDataRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.fromObject(object.inputConfig); + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; + + /** + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.ImportCompletionDataRequest} message ImportCompletionDataRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCompletionDataRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; + + /** + * Converts this ImportCompletionDataRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + * @returns {Object.} JSON object + */ + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportCompletionDataRequest; + })(); + + v2beta.ProductInputConfig = (function() { + + /** + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface IProductInputConfig + * @property {google.cloud.retail.v2beta.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + */ + + /** + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + */ + function ProductInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2beta.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.productInlineSource = null; + + /** + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig instance + */ + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); + }; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2beta.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + * @returns {Object.} JSON object + */ + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2beta.UserEventInputConfig = (function() { + + /** + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2beta.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + */ + + /** + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2beta.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.userEventInlineSource = null; + + /** + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.gcsSource = null; + + /** + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig instance + */ + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2beta.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + */ + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.fromObject(object.userEventInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.UserEventInputConfig} message UserEventInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this UserEventInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + * @returns {Object.} JSON object + */ + UserEventInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInputConfig; + })(); + + v2beta.CompletionDataInputConfig = (function() { + + /** + * Properties of a CompletionDataInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + */ + + /** + * Constructs a new CompletionDataInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig=} [properties] Properties to set + */ + function CompletionDataInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @instance + */ + CompletionDataInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @instance + */ + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig instance + */ + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); + }; + + /** + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDataInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDataInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionDataInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionDataInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDataInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + */ + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompletionDataInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionDataInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this CompletionDataInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @instance + * @returns {Object.} JSON object + */ + CompletionDataInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDataInputConfig; + })(); + + v2beta.ImportMetadata = (function() { + + /** + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic + */ + + /** + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + */ + function ImportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.createTime = null; + + /** + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.updateTime = null; + + /** + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.requestId = ""; + + /** + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata instance + */ + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); + }; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); + return writer; + }; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + case 5: + message.requestId = reader.string(); + break; + case 6: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + */ + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportMetadata) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.ImportMetadata} message ImportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; + + /** + * Converts this ImportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportMetadata; + })(); + + v2beta.ImportProductsResponse = (function() { + + /** + * Properties of an ImportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + */ + + /** + * Constructs a new ImportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + */ + function ImportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse instance + */ + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); + }; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + */ + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.ImportProductsResponse} message ImportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsResponse; + })(); + + v2beta.ImportUserEventsResponse = (function() { + + /** + * Properties of an ImportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2beta.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + */ + + /** + * Constructs a new ImportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + */ + function ImportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2beta.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse instance + */ + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2beta.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2beta.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + */ + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.fromObject(object.importSummary); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.toObject(message.importSummary, options); + return object; + }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsResponse; + })(); + + v2beta.UserEventImportSummary = (function() { + + /** + * Properties of a UserEventImportSummary. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + */ + + /** + * Constructs a new UserEventImportSummary. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + */ + function UserEventImportSummary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary instance + */ + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); + }; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + return writer; + }; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.joinedEventsCount = reader.int64(); + break; + case 2: + message.unjoinedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventImportSummary message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventImportSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + */ + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventImportSummary) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.UserEventImportSummary} message UserEventImportSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventImportSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; + } + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + return object; + }; + + /** + * Converts this UserEventImportSummary to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + * @returns {Object.} JSON object + */ + UserEventImportSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventImportSummary; + })(); + + v2beta.ImportCompletionDataResponse = (function() { + + /** + * Properties of an ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples + */ + + /** + * Constructs a new ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse=} [properties] Properties to set + */ + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @instance + */ + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + + /** + * Creates a new ImportCompletionDataResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse instance + */ + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); + }; + + /** + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportCompletionDataResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportCompletionDataResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportCompletionDataResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + return null; + }; + + /** + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + */ + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportCompletionDataResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCompletionDataResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + return object; + }; + + /** + * Converts this ImportCompletionDataResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @instance + * @returns {Object.} JSON object + */ + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportCompletionDataResponse; + })(); + + v2beta.Product = (function() { + + /** + * Properties of a Product. + * @memberof google.cloud.retail.v2beta + * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2beta.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands + * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2beta.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2beta.IRating|null} [rating] Product rating + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2beta.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2beta.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2beta.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants + */ + + /** + * Constructs a new Product. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + */ + function Product(properties) { + this.collectionMemberIds = []; + this.categories = []; + this.brands = []; + this.attributes = {}; + this.tags = []; + this.fulfillmentInfo = []; + this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.expireTime = null; + + /** + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.ttl = null; + + /** + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.name = ""; + + /** + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.id = ""; + + /** + * Product type. + * @member {google.cloud.retail.v2beta.Product.Type} type + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.type = 0; + + /** + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.primaryProductId = ""; + + /** + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.collectionMemberIds = $util.emptyArray; + + /** + * Product gtin. + * @member {string} gtin + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.gtin = ""; + + /** + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.categories = $util.emptyArray; + + /** + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.title = ""; + + /** + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.brands = $util.emptyArray; + + /** + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.description = ""; + + /** + * Product languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.languageCode = ""; + + /** + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2beta.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product rating. + * @member {google.cloud.retail.v2beta.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.rating = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availableTime = null; + + /** + * Product availability. + * @member {google.cloud.retail.v2beta.Product.Availability} availability + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availability = 0; + + /** + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availableQuantity = null; + + /** + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.fulfillmentInfo = $util.emptyArray; + + /** + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.uri = ""; + + /** + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.images = $util.emptyArray; + + /** + * Product audience. + * @member {google.cloud.retail.v2beta.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.audience = null; + + /** + * Product colorInfo. + * @member {google.cloud.retail.v2beta.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.colorInfo = null; + + /** + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.sizes = $util.emptyArray; + + /** + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.materials = $util.emptyArray; + + /** + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.patterns = $util.emptyArray; + + /** + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.conditions = $util.emptyArray; + + /** + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.promotions = $util.emptyArray; + + /** + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.publishTime = null; + + /** + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.retrievableFields = null; + + /** + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.variants = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2beta.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2beta.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) + $root.google.cloud.retail.v2beta.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2beta.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + $root.google.cloud.retail.v2beta.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) + $root.google.cloud.retail.v2beta.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.sizes != null && message.sizes.length) + for (var i = 0; i < message.sizes.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); + if (message.materials != null && message.materials.length) + for (var i = 0; i < message.materials.length; ++i) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); + if (message.patterns != null && message.patterns.length) + for (var i = 0; i < message.patterns.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); + if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) + $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.variants != null && message.variants.length) + for (var i = 0; i < message.variants.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.promotions != null && message.promotions.length) + for (var i = 0; i < message.promotions.length; ++i) + $root.google.cloud.retail.v2beta.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Product message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Product(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 16: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 5: + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + case 6: + message.gtin = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 9: + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + case 10: + message.description = reader.string(); + break; + case 11: + message.languageCode = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); + break; + case 15: + message.rating = $root.google.cloud.retail.v2beta.Rating.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 21: + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2beta.FulfillmentInfo.decode(reader, reader.uint32())); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); + break; + case 24: + message.audience = $root.google.cloud.retail.v2beta.Audience.decode(reader, reader.uint32()); + break; + case 25: + message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.decode(reader, reader.uint32()); + break; + case 26: + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + case 27: + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + case 28: + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + case 29: + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + case 34: + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2beta.Promotion.decode(reader, reader.uint32())); + break; + case 33: + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 30: + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 31: + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Product message. + * @function verify + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Product.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.ttl); + if (error) + return "ttl." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { + if (!Array.isArray(message.collectionMemberIds)) + return "collectionMemberIds: array expected"; + for (var i = 0; i < message.collectionMemberIds.length; ++i) + if (!$util.isString(message.collectionMemberIds[i])) + return "collectionMemberIds: string[] expected"; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + if (!$util.isString(message.gtin)) + return "gtin: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.brands != null && message.hasOwnProperty("brands")) { + if (!Array.isArray(message.brands)) + return "brands: array expected"; + for (var i = 0; i < message.brands.length; ++i) + if (!$util.isString(message.brands[i])) + return "brands: string[] expected"; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2beta.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.rating != null && message.hasOwnProperty("rating")) { + var error = $root.google.cloud.retail.v2beta.Rating.verify(message.rating); + if (error) + return "rating." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + if (!Array.isArray(message.fulfillmentInfo)) + return "fulfillmentInfo: array expected"; + for (var i = 0; i < message.fulfillmentInfo.length; ++i) { + var error = $root.google.cloud.retail.v2beta.FulfillmentInfo.verify(message.fulfillmentInfo[i]); + if (error) + return "fulfillmentInfo." + error; + } + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + if (message.audience != null && message.hasOwnProperty("audience")) { + var error = $root.google.cloud.retail.v2beta.Audience.verify(message.audience); + if (error) + return "audience." + error; + } + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { + var error = $root.google.cloud.retail.v2beta.ColorInfo.verify(message.colorInfo); + if (error) + return "colorInfo." + error; + } + if (message.sizes != null && message.hasOwnProperty("sizes")) { + if (!Array.isArray(message.sizes)) + return "sizes: array expected"; + for (var i = 0; i < message.sizes.length; ++i) + if (!$util.isString(message.sizes[i])) + return "sizes: string[] expected"; + } + if (message.materials != null && message.hasOwnProperty("materials")) { + if (!Array.isArray(message.materials)) + return "materials: array expected"; + for (var i = 0; i < message.materials.length; ++i) + if (!$util.isString(message.materials[i])) + return "materials: string[] expected"; + } + if (message.patterns != null && message.hasOwnProperty("patterns")) { + if (!Array.isArray(message.patterns)) + return "patterns: array expected"; + for (var i = 0; i < message.patterns.length; ++i) + if (!$util.isString(message.patterns[i])) + return "patterns: string[] expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) + if (!$util.isString(message.conditions[i])) + return "conditions: string[] expected"; + } + if (message.promotions != null && message.hasOwnProperty("promotions")) { + if (!Array.isArray(message.promotions)) + return "promotions: array expected"; + for (var i = 0; i < message.promotions.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Promotion.verify(message.promotions[i]); + if (error) + return "promotions." + error; + } + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.publishTime); + if (error) + return "publishTime." + error; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { + var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); + if (error) + return "retrievableFields." + error; + } + if (message.variants != null && message.hasOwnProperty("variants")) { + if (!Array.isArray(message.variants)) + return "variants: array expected"; + for (var i = 0; i < message.variants.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.variants[i]); + if (error) + return "variants." + error; + } + } + return null; + }; + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Product} Product + */ + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Product) + return object; + var message = new $root.google.cloud.retail.v2beta.Product(); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + if (object.ttl != null) { + if (typeof object.ttl !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.ttl: object expected"); + message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); + } + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.collectionMemberIds) { + if (!Array.isArray(object.collectionMemberIds)) + throw TypeError(".google.cloud.retail.v2beta.Product.collectionMemberIds: array expected"); + message.collectionMemberIds = []; + for (var i = 0; i < object.collectionMemberIds.length; ++i) + message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); + } + if (object.gtin != null) + message.gtin = String(object.gtin); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2beta.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.brands) { + if (!Array.isArray(object.brands)) + throw TypeError(".google.cloud.retail.v2beta.Product.brands: array expected"); + message.brands = []; + for (var i = 0; i < object.brands.length; ++i) + message.brands[i] = String(object.brands[i]); + } + if (object.description != null) + message.description = String(object.description); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2beta.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.fromObject(object.priceInfo); + } + if (object.rating != null) { + if (typeof object.rating !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.rating: object expected"); + message.rating = $root.google.cloud.retail.v2beta.Rating.fromObject(object.rating); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.fulfillmentInfo) { + if (!Array.isArray(object.fulfillmentInfo)) + throw TypeError(".google.cloud.retail.v2beta.Product.fulfillmentInfo: array expected"); + message.fulfillmentInfo = []; + for (var i = 0; i < object.fulfillmentInfo.length; ++i) { + if (typeof object.fulfillmentInfo[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.fulfillmentInfo: object expected"); + message.fulfillmentInfo[i] = $root.google.cloud.retail.v2beta.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); + } + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2beta.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2beta.Image.fromObject(object.images[i]); + } + } + if (object.audience != null) { + if (typeof object.audience !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.audience: object expected"); + message.audience = $root.google.cloud.retail.v2beta.Audience.fromObject(object.audience); + } + if (object.colorInfo != null) { + if (typeof object.colorInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.colorInfo: object expected"); + message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.fromObject(object.colorInfo); + } + if (object.sizes) { + if (!Array.isArray(object.sizes)) + throw TypeError(".google.cloud.retail.v2beta.Product.sizes: array expected"); + message.sizes = []; + for (var i = 0; i < object.sizes.length; ++i) + message.sizes[i] = String(object.sizes[i]); + } + if (object.materials) { + if (!Array.isArray(object.materials)) + throw TypeError(".google.cloud.retail.v2beta.Product.materials: array expected"); + message.materials = []; + for (var i = 0; i < object.materials.length; ++i) + message.materials[i] = String(object.materials[i]); + } + if (object.patterns) { + if (!Array.isArray(object.patterns)) + throw TypeError(".google.cloud.retail.v2beta.Product.patterns: array expected"); + message.patterns = []; + for (var i = 0; i < object.patterns.length; ++i) + message.patterns[i] = String(object.patterns[i]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.cloud.retail.v2beta.Product.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) + message.conditions[i] = String(object.conditions[i]); + } + if (object.promotions) { + if (!Array.isArray(object.promotions)) + throw TypeError(".google.cloud.retail.v2beta.Product.promotions: array expected"); + message.promotions = []; + for (var i = 0; i < object.promotions.length; ++i) { + if (typeof object.promotions[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.promotions: object expected"); + message.promotions[i] = $root.google.cloud.retail.v2beta.Promotion.fromObject(object.promotions[i]); + } + } + if (object.publishTime != null) { + if (typeof object.publishTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.publishTime: object expected"); + message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + } + if (object.retrievableFields != null) { + if (typeof object.retrievableFields !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.retrievableFields: object expected"); + message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + } + if (object.variants) { + if (!Array.isArray(object.variants)) + throw TypeError(".google.cloud.retail.v2beta.Product.variants: array expected"); + message.variants = []; + for (var i = 0; i < object.variants.length; ++i) { + if (typeof object.variants[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.variants: object expected"); + message.variants[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.variants[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.collectionMemberIds = []; + object.categories = []; + object.brands = []; + object.tags = []; + object.fulfillmentInfo = []; + object.images = []; + object.sizes = []; + object.materials = []; + object.patterns = []; + object.conditions = []; + object.variants = []; + object.promotions = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.gtin = ""; + object.title = ""; + object.description = ""; + object.languageCode = ""; + object.priceInfo = null; + object.rating = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + object.audience = null; + object.colorInfo = null; + object.retrievableFields = null; + object.publishTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.collectionMemberIds && message.collectionMemberIds.length) { + object.collectionMemberIds = []; + for (var j = 0; j < message.collectionMemberIds.length; ++j) + object.collectionMemberIds[j] = message.collectionMemberIds[j]; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + object.gtin = message.gtin; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.brands && message.brands.length) { + object.brands = []; + for (var j = 0; j < message.brands.length; ++j) + object.brands[j] = message.brands[j]; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.toObject(message.priceInfo, options); + if (message.rating != null && message.hasOwnProperty("rating")) + object.rating = $root.google.cloud.retail.v2beta.Rating.toObject(message.rating, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (options.oneofs) + object.expiration = "expireTime"; + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (options.oneofs) + object.expiration = "ttl"; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.fulfillmentInfo && message.fulfillmentInfo.length) { + object.fulfillmentInfo = []; + for (var j = 0; j < message.fulfillmentInfo.length; ++j) + object.fulfillmentInfo[j] = $root.google.cloud.retail.v2beta.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2beta.Image.toObject(message.images[j], options); + } + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = $root.google.cloud.retail.v2beta.Audience.toObject(message.audience, options); + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) + object.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.toObject(message.colorInfo, options); + if (message.sizes && message.sizes.length) { + object.sizes = []; + for (var j = 0; j < message.sizes.length; ++j) + object.sizes[j] = message.sizes[j]; + } + if (message.materials && message.materials.length) { + object.materials = []; + for (var j = 0; j < message.materials.length; ++j) + object.materials[j] = message.materials[j]; + } + if (message.patterns && message.patterns.length) { + object.patterns = []; + for (var j = 0; j < message.patterns.length; ++j) + object.patterns[j] = message.patterns[j]; + } + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = message.conditions[j]; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) + object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); + if (message.variants && message.variants.length) { + object.variants = []; + for (var j = 0; j < message.variants.length; ++j) + object.variants[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.variants[j], options); + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); + if (message.promotions && message.promotions.length) { + object.promotions = []; + for (var j = 0; j < message.promotions.length; ++j) + object.promotions[j] = $root.google.cloud.retail.v2beta.Promotion.toObject(message.promotions[j], options); + } + return object; + }; + + /** + * Converts this Product to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Product + * @instance + * @returns {Object.} JSON object + */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.retail.v2beta.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2beta.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; + })(); + + v2beta.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2beta + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2beta.ICompletionDetail|null} [completionDetail] UserEvent completionDetail + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2beta.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {string|null} [filter] UserEvent filter + * @property {string|null} [orderBy] UserEvent orderBy + * @property {number|null} [offset] UserEvent offset + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId + */ + + /** + * Constructs a new UserEvent. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEvent. + * @implements IUserEvent + * @constructor + * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + */ + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.eventType = ""; + + /** + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.visitorId = ""; + + /** + * UserEvent sessionId. + * @member {string} sessionId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.sessionId = ""; + + /** + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.eventTime = null; + + /** + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.experimentIds = $util.emptyArray; + + /** + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.attributionToken = ""; + + /** + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.productDetails = $util.emptyArray; + + /** + * UserEvent completionDetail. + * @member {google.cloud.retail.v2beta.ICompletionDetail|null|undefined} completionDetail + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.completionDetail = null; + + /** + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.attributes = $util.emptyObject; + + /** + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.cartId = ""; + + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2beta.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; + + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; + + /** + * UserEvent filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.filter = ""; + + /** + * UserEvent orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.orderBy = ""; + + /** + * UserEvent offset. + * @member {number} offset + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.offset = 0; + + /** + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.pageCategories = $util.emptyArray; + + /** + * UserEvent userInfo. + * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.userInfo = null; + + /** + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent instance + */ + UserEvent.create = function create(properties) { + return new UserEvent(properties); + }; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2beta.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2beta.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); + if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) + $root.google.cloud.retail.v2beta.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEvent(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventType = reader.string(); + break; + case 2: + message.visitorId = reader.string(); + break; + case 21: + message.sessionId = reader.string(); + break; + case 3: + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); + break; + case 22: + message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.decode(reader, reader.uint32()); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 16: + message.filter = reader.string(); + break; + case 17: + message.orderBy = reader.string(); + break; + case 18: + message.offset = reader.int32(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEvent message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isString(message.sessionId)) + return "sessionId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; + } + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2beta.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { + var error = $root.google.cloud.retail.v2beta.CompletionDetail.verify(message.completionDetail); + if (error) + return "completionDetail." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2beta.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; + return null; + }; + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + */ + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEvent) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.sessionId != null) + message.sessionId = String(object.sessionId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); + } + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2beta.ProductDetail.fromObject(object.productDetails[i]); + } + } + if (object.completionDetail != null) { + if (typeof object.completionDetail !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.completionDetail: object expected"); + message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.fromObject(object.completionDetail); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + object.filter = ""; + object.orderBy = ""; + object.offset = 0; + object.sessionId = ""; + object.completionDetail = null; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2beta.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) + object.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.toObject(message.completionDetail, options); + return object; + }; + + /** + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + * @returns {Object.} JSON object + */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEvent; + })(); + + v2beta.ProductDetail = (function() { + + /** + * Properties of a ProductDetail. + * @memberof google.cloud.retail.v2beta + * @interface IProductDetail + * @property {google.cloud.retail.v2beta.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + */ + + /** + * Constructs a new ProductDetail. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductDetail. + * @implements IProductDetail + * @constructor + * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + */ + function ProductDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductDetail product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + */ + ProductDetail.prototype.product = null; + + /** + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + */ + ProductDetail.prototype.quantity = null; + + /** + * Creates a new ProductDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail instance + */ + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); + }; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductDetail message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; + } + return null; + }; + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + */ + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductDetail) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + } + return message; + }; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.ProductDetail} message ProductDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.quantity = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + return object; + }; + + /** + * Converts this ProductDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + * @returns {Object.} JSON object + */ + ProductDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductDetail; + })(); + + v2beta.CompletionDetail = (function() { + + /** + * Properties of a CompletionDetail. + * @memberof google.cloud.retail.v2beta + * @interface ICompletionDetail + * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken + * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion + * @property {number|null} [selectedPosition] CompletionDetail selectedPosition + */ + + /** + * Constructs a new CompletionDetail. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompletionDetail. + * @implements ICompletionDetail + * @constructor + * @param {google.cloud.retail.v2beta.ICompletionDetail=} [properties] Properties to set + */ + function CompletionDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionDetail completionAttributionToken. + * @member {string} completionAttributionToken + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + */ + CompletionDetail.prototype.completionAttributionToken = ""; + + /** + * CompletionDetail selectedSuggestion. + * @member {string} selectedSuggestion + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedSuggestion = ""; + + /** + * CompletionDetail selectedPosition. + * @member {number} selectedPosition + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedPosition = 0; + + /** + * Creates a new CompletionDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.ICompletionDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail instance + */ + CompletionDetail.create = function create(properties) { + return new CompletionDetail(properties); + }; + + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); + if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); + if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); + return writer; + }; + + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionAttributionToken = reader.string(); + break; + case 2: + message.selectedSuggestion = reader.string(); + break; + case 3: + message.selectedPosition = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionDetail message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + if (!$util.isString(message.completionAttributionToken)) + return "completionAttributionToken: string expected"; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + if (!$util.isString(message.selectedSuggestion)) + return "selectedSuggestion: string expected"; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + if (!$util.isInteger(message.selectedPosition)) + return "selectedPosition: integer expected"; + return null; + }; + + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail + */ + CompletionDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompletionDetail) + return object; + var message = new $root.google.cloud.retail.v2beta.CompletionDetail(); + if (object.completionAttributionToken != null) + message.completionAttributionToken = String(object.completionAttributionToken); + if (object.selectedSuggestion != null) + message.selectedSuggestion = String(object.selectedSuggestion); + if (object.selectedPosition != null) + message.selectedPosition = object.selectedPosition | 0; + return message; + }; + + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.CompletionDetail} message CompletionDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.completionAttributionToken = ""; + object.selectedSuggestion = ""; + object.selectedPosition = 0; + } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + object.completionAttributionToken = message.completionAttributionToken; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + object.selectedSuggestion = message.selectedSuggestion; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + object.selectedPosition = message.selectedPosition; + return object; + }; + + /** + * Converts this CompletionDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + * @returns {Object.} JSON object + */ + CompletionDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDetail; + })(); + + v2beta.PurchaseTransaction = (function() { + + /** + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2beta + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + */ + + /** + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction + * @constructor + * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + */ + function PurchaseTransaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.id = ""; + + /** + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.revenue = 0; + + /** + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction instance + */ + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); + }; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + return writer; + }; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurchaseTransaction message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurchaseTransaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + */ + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurchaseTransaction) + return object; + var message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.PurchaseTransaction} message PurchaseTransaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurchaseTransaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; + + /** + * Converts this PurchaseTransaction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + * @returns {Object.} JSON object + */ + PurchaseTransaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurchaseTransaction; + })(); + + v2beta.CatalogService = (function() { + + /** + * Constructs a new CatalogService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2beta.ListCatalogsRequest, $root.google.cloud.retail.v2beta.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2beta.UpdateCatalogRequest, $root.google.cloud.retail.v2beta.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2beta.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + */ + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2beta.GetDefaultBranchRequest, $root.google.cloud.retail.v2beta.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2beta.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest instance + */ + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); + }; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + */ + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.ListCatalogsRequest} message ListCatalogsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsRequest; + })(); + + v2beta.ListCatalogsResponse = (function() { + + /** + * Properties of a ListCatalogsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + */ + + /** + * Constructs a new ListCatalogsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + */ + function ListCatalogsResponse(properties) { + this.catalogs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + + /** + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse instance + */ + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); + }; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2beta.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + */ + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalogs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.ListCatalogsResponse} message ListCatalogsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalogs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsResponse; + })(); + + v2beta.UpdateCatalogRequest = (function() { + + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2beta.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ + + /** + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + */ + function UpdateCatalogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2beta.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.catalog = null; + + /** + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest instance + */ + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2beta.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCatalogRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCatalogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + */ + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateCatalogRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCatalogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCatalogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCatalogRequest; + })(); + + v2beta.SetDefaultBranchRequest = (function() { + + /** + * Properties of a SetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note + */ + + /** + * Constructs a new SetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest + * @constructor + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest=} [properties] Properties to set + */ + function SetDefaultBranchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.catalog = ""; + + /** + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.branchId = ""; + + /** + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.note = ""; + + /** + * Creates a new SetDefaultBranchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest instance + */ + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); + }; + + /** + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultBranchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + return writer; + }; + + /** + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultBranchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetDefaultBranchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + case 2: + message.branchId = reader.string(); + break; + case 3: + message.note = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultBranchRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultBranchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; + return null; + }; + + /** + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + */ + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetDefaultBranchRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); + return message; + }; + + /** + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.SetDefaultBranchRequest} message SetDefaultBranchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultBranchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = ""; + object.branchId = ""; + object.note = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; + return object; + }; + + /** + * Converts this SetDefaultBranchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + * @returns {Object.} JSON object + */ + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultBranchRequest; + })(); + + v2beta.GetDefaultBranchRequest = (function() { + + /** + * Properties of a GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog + */ + + /** + * Constructs a new GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest=} [properties] Properties to set + */ + function GetDefaultBranchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @instance + */ + GetDefaultBranchRequest.prototype.catalog = ""; + + /** + * Creates a new GetDefaultBranchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest instance + */ + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); + }; + + /** + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + return writer; + }; + + /** + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetDefaultBranchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDefaultBranchRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDefaultBranchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + return null; + }; + + /** + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + */ + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetDefaultBranchRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + return message; + }; + + /** + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.GetDefaultBranchRequest} message GetDefaultBranchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDefaultBranchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + return object; + }; + + /** + * Converts this GetDefaultBranchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @instance + * @returns {Object.} JSON object + */ + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDefaultBranchRequest; + })(); + + v2beta.GetDefaultBranchResponse = (function() { + + /** + * Properties of a GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2beta + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note + */ + + /** + * Constructs a new GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse + * @constructor + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse=} [properties] Properties to set + */ + function GetDefaultBranchResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.branch = ""; + + /** + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.setTime = null; + + /** + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.note = ""; + + /** + * Creates a new GetDefaultBranchResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse instance + */ + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); + }; + + /** + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + return writer; + }; + + /** + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetDefaultBranchResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.branch = reader.string(); + break; + case 2: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.note = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDefaultBranchResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDefaultBranchResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; + return null; + }; + + /** + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + */ + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetDefaultBranchResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.note != null) + message.note = String(object.note); + return message; + }; + + /** + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.GetDefaultBranchResponse} message GetDefaultBranchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDefaultBranchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.branch = ""; + object.setTime = null; + object.note = ""; + } + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; + return object; + }; + + /** + * Converts this GetDefaultBranchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + * @returns {Object.} JSON object + */ + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDefaultBranchResponse; + })(); + + v2beta.CompletionService = (function() { + + /** + * Constructs a new CompletionService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + + /** + * Creates new CompletionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.CompletionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. + */ + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2beta.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.CompleteQueryResponse} [response] CompleteQueryResponse + */ + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2beta.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2beta.CompleteQueryRequest, $root.google.cloud.retail.v2beta.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2beta.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2beta.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2beta.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; + })(); + + v2beta.CompleteQueryRequest = (function() { + + /** + * Properties of a CompleteQueryRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + */ + + /** + * Constructs a new CompleteQueryRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest=} [properties] Properties to set + */ + function CompleteQueryRequest(properties) { + this.languageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.catalog = ""; + + /** + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.query = ""; + + /** + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.visitorId = ""; + + /** + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + + /** + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.deviceType = ""; + + /** + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.dataset = ""; + + /** + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.maxSuggestions = 0; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest instance + */ + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); + }; + + /** + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + return writer; + }; + + /** + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + case 2: + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); + break; + case 3: + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + case 4: + message.deviceType = reader.string(); + break; + case 6: + message.dataset = reader.string(); + break; + case 5: + message.maxSuggestions = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompleteQueryRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompleteQueryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; + return null; + }; + + /** + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + */ + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; + return message; + }; + + /** + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryRequest} message CompleteQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompleteQueryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (options.defaults) { + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + return object; + }; + + /** + * Converts this CompleteQueryRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + * @returns {Object.} JSON object + */ + CompleteQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompleteQueryRequest; + })(); + + v2beta.CompleteQueryResponse = (function() { + + /** + * Properties of a CompleteQueryResponse. + * @memberof google.cloud.retail.v2beta + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + */ + + /** + * Constructs a new CompleteQueryResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse + * @constructor + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse=} [properties] Properties to set + */ + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; + + /** + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.attributionToken = ""; + + /** + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + + /** + * Creates a new CompleteQueryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse instance + */ + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); + }; + + /** + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompleteQueryResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompleteQueryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } + } + return null; + }; + + /** + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + */ + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse} message CompleteQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompleteQueryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + } + return object; + }; + + /** + * Converts this CompleteQueryResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + * @returns {Object.} JSON object + */ + CompleteQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + CompleteQueryResponse.CompletionResult = (function() { + + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ + + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; + + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.suggestion = reader.string(); + break; + case 2: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionResult; + })(); + + CompleteQueryResponse.RecentSearchResult = (function() { + + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ + + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; + })(); + + v2beta.ExportErrorsConfig = (function() { + + /** + * Properties of an ExportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @interface IExportErrorsConfig + * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ExportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ExportErrorsConfig. + * @implements IExportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2beta.IExportErrorsConfig=} [properties] Properties to set + */ + function ExportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @instance + */ + ExportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @instance + */ + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig instance + */ + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); + }; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig + */ + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.ExportErrorsConfig} message ExportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ExportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportErrorsConfig; + })(); + + v2beta.ExportMetadata = (function() { + + /** + * Properties of an ExportMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + */ + + /** + * Constructs a new ExportMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IExportMetadata=} [properties] Properties to set + */ + function ExportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @instance + */ + ExportMetadata.prototype.createTime = null; + + /** + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @instance + */ + ExportMetadata.prototype.updateTime = null; + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {google.cloud.retail.v2beta.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata instance + */ + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); + }; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {google.cloud.retail.v2beta.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {google.cloud.retail.v2beta.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata + */ + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportMetadata) + return object; + var message = new $root.google.cloud.retail.v2beta.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {google.cloud.retail.v2beta.ExportMetadata} message ExportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this ExportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportMetadata; + })(); + + v2beta.ExportProductsResponse = (function() { + + /** + * Properties of an ExportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IExportProductsResponse + * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples + * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + */ + + /** + * Constructs a new ExportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ExportProductsResponse. + * @implements IExportProductsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IExportProductsResponse=} [properties] Properties to set + */ + function ExportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ExportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IExportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse instance + */ + ExportProductsResponse.create = function create(properties) { + return new ExportProductsResponse(properties); + }; + + /** + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse + */ + ExportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ExportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.ExportProductsResponse} message ExportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ExportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportProductsResponse; + })(); + + v2beta.ExportUserEventsResponse = (function() { + + /** + * Properties of an ExportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IExportUserEventsResponse + * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + */ + + /** + * Constructs a new ExportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ExportUserEventsResponse. + * @implements IExportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse=} [properties] Properties to set + */ + function ExportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse instance + */ + ExportUserEventsResponse.create = function create(properties) { + return new ExportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse + */ + ExportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ExportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ExportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportUserEventsResponse; + })(); + + v2beta.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * @memberof google.cloud.retail.v2beta.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2beta.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + */ + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.PredictRequest} message PredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this PredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + * @returns {Object.} JSON object + */ + PredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictRequest; + })(); + + v2beta.PredictResponse = (function() { + + /** + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2beta + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly + */ + + /** + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.results = $util.emptyArray; + + /** + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse instance + */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + */ + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {google.cloud.retail.v2beta.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this PredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + * @returns {Object.} JSON object + */ + PredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2beta.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2beta.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2beta.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + + /** + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + */ + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2beta.CreateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "CreateProduct" }); + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2beta.GetProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "GetProduct" }); + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListProductsResponse} [response] ListProductsResponse + */ + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2beta.ListProductsRequest, $root.google.cloud.retail.v2beta.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2beta.UpdateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2beta.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2beta.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2beta.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; + })(); + + v2beta.CreateProductRequest = (function() { + + /** + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2beta.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId + */ + + /** + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + */ + function CreateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest instance + */ + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); + }; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + return writer; + }; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + */ + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {google.cloud.retail.v2beta.CreateProductRequest} message CreateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this CreateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProductRequest; + })(); + + v2beta.GetProductRequest = (function() { + + /** + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name + */ + + /** + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest instance + */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @instance + * @returns {Object.} JSON object + */ + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProductRequest; + })(); + + v2beta.UpdateProductRequest = (function() { + + /** + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2beta.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing + */ + + /** + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProductRequest product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.product = null; + + /** + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.updateMask = null; + + /** + * UpdateProductRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.allowMissing = false; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest instance + */ + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + */ + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateProductRequest} message UpdateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.updateMask = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this UpdateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateProductRequest; + })(); + + v2beta.DeleteProductRequest = (function() { + + /** + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name + */ + + /** + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + */ + function DeleteProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @instance + */ + DeleteProductRequest.prototype.name = ""; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest instance + */ + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); + }; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + */ + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.DeleteProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2beta.DeleteProductRequest} message DeleteProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProductRequest; + })(); + + v2beta.ListProductsRequest = (function() { + + /** + * Properties of a ListProductsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + */ + + /** + * Constructs a new ListProductsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IListProductsRequest=} [properties] Properties to set + */ + function ListProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.parent = ""; + + /** + * ListProductsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageSize = 0; + + /** + * ListProductsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageToken = ""; + + /** + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.filter = ""; + + /** + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * Creates a new ListProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest instance + */ + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); + }; + + /** + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (error) + return "readMask." + error; + } + return null; + }; + + /** + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest + */ + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ListProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + } + return message; + }; + + /** + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {google.cloud.retail.v2beta.ListProductsRequest} message ListProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.readMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); + return object; + }; + + /** + * Converts this ListProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProductsRequest; + })(); + + v2beta.ListProductsResponse = (function() { + + /** + * Properties of a ListProductsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + */ + + /** + * Constructs a new ListProductsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IListProductsResponse=} [properties] Properties to set + */ + function ListProductsResponse(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.products = $util.emptyArray; + + /** + * ListProductsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse instance + */ + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); + }; + + /** + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse + */ + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2beta.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {google.cloud.retail.v2beta.ListProductsResponse} message ListProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProductsResponse; + })(); + + v2beta.SetInventoryRequest = (function() { + + /** + * Properties of a SetInventoryRequest. + * @memberof google.cloud.retail.v2beta + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2beta.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + */ + + /** + * Constructs a new SetInventoryRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest + * @constructor + * @param {google.cloud.retail.v2beta.ISetInventoryRequest=} [properties] Properties to set + */ + function SetInventoryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.inventory = null; + + /** + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setMask = null; + + /** + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest instance + */ + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); + }; + + /** + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2beta.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inventory = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.inventory); + if (error) + return "inventory." + error; + } + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); + if (error) + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest + */ + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2beta.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2beta.SetInventoryRequest} message SetInventoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2beta.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this SetInventoryRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + * @returns {Object.} JSON object + */ + SetInventoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetInventoryRequest; + })(); + + v2beta.SetInventoryMetadata = (function() { + + /** + * Properties of a SetInventoryMetadata. + * @memberof google.cloud.retail.v2beta + * @interface ISetInventoryMetadata + */ + + /** + * Constructs a new SetInventoryMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata + * @constructor + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata=} [properties] Properties to set + */ + function SetInventoryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SetInventoryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata instance + */ + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); + }; + + /** + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + */ + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryMetadata) + return object; + return new $root.google.cloud.retail.v2beta.SetInventoryMetadata(); + }; + + /** + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2beta.SetInventoryMetadata} message SetInventoryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetInventoryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @instance + * @returns {Object.} JSON object + */ + SetInventoryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetInventoryMetadata; + })(); + + v2beta.SetInventoryResponse = (function() { + + /** + * Properties of a SetInventoryResponse. + * @memberof google.cloud.retail.v2beta + * @interface ISetInventoryResponse + */ + + /** + * Constructs a new SetInventoryResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse + * @constructor + * @param {google.cloud.retail.v2beta.ISetInventoryResponse=} [properties] Properties to set + */ + function SetInventoryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SetInventoryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse instance + */ + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); + }; + + /** + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2beta.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse + */ + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryResponse) + return object; + return new $root.google.cloud.retail.v2beta.SetInventoryResponse(); + }; + + /** + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2beta.SetInventoryResponse} message SetInventoryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetInventoryResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @instance + * @returns {Object.} JSON object + */ + SetInventoryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetInventoryResponse; + })(); + + v2beta.AddFulfillmentPlacesRequest = (function() { + + /** + * Properties of an AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2beta + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + */ + + /** + * Constructs a new AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest + * @constructor + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest=} [properties] Properties to set + */ + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.product = ""; + + /** + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.type = ""; + + /** + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.addTime = null; + + /** + * AddFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + */ + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + */ + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this AddFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddFulfillmentPlacesRequest; + })(); + + v2beta.AddFulfillmentPlacesMetadata = (function() { + + /** + * Properties of an AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IAddFulfillmentPlacesMetadata + */ + + /** + * Constructs a new AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function AddFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance + */ + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + */ + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata(); + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddFulfillmentPlacesMetadata; + })(); + + v2beta.AddFulfillmentPlacesResponse = (function() { + + /** + * Properties of an AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2beta + * @interface IAddFulfillmentPlacesResponse + */ + + /** + * Constructs a new AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse=} [properties] Properties to set + */ + function AddFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance + */ + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + */ + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddFulfillmentPlacesResponse; + })(); + + v2beta.RemoveFulfillmentPlacesRequest = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2beta + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + */ + + /** + * Constructs a new RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest + * @constructor + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.product = ""; + + /** + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.type = ""; + + /** + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + + /** + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + */ + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + */ + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesRequest; + })(); + + v2beta.RemoveFulfillmentPlacesMetadata = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IRemoveFulfillmentPlacesMetadata + */ + + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + */ + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + */ + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesMetadata; + })(); + + v2beta.RemoveFulfillmentPlacesResponse = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2beta + * @interface IRemoveFulfillmentPlacesResponse + */ + + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + */ + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + */ + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesResponse; + })(); + + v2beta.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2beta.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeMetadata; + })(); + + v2beta.PurgeUserEventsRequest = (function() { + + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ + + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; + + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; + + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsRequest; + })(); + + v2beta.PurgeUserEventsResponse = (function() { + + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ + + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsResponse; + })(); + + v2beta.SearchService = (function() { + + /** + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; + + /** + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. + * @memberof google.cloud.retail.v2beta.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.SearchResponse} [response] SearchResponse + */ + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2beta.SearchService + * @instance + * @param {google.cloud.retail.v2beta.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2beta.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2beta.SearchRequest, $root.google.cloud.retail.v2beta.SearchResponse, request, callback); + }, "name", { value: "Search" }); + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2beta.SearchService + * @instance + * @param {google.cloud.retail.v2beta.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SearchService; + })(); + + v2beta.SearchRequest = (function() { + + /** + * Properties of a SearchRequest. + * @memberof google.cloud.retail.v2beta + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + */ + + /** + * Constructs a new SearchRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest + * @constructor + * @param {google.cloud.retail.v2beta.ISearchRequest=} [properties] Properties to set + */ + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.placement = ""; + + /** + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.branch = ""; + + /** + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.query = ""; + + /** + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.visitorId = ""; + + /** + * SearchRequest userInfo. + * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.userInfo = null; + + /** + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.pageSize = 0; + + /** + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.pageToken = ""; + + /** + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.offset = 0; + + /** + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.filter = ""; + + /** + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.canonicalFilter = ""; + + /** + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.orderBy = ""; + + /** + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.facetSpecs = $util.emptyArray; + + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; + + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; + + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; + + /** + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + + /** + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * Creates a new SearchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest instance + */ + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); + }; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + return writer; + }; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.branch = reader.string(); + break; + case 3: + message.query = reader.string(); + break; + case 4: + message.visitorId = reader.string(); + break; + case 5: + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); + break; + case 10: + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (error) + return "facetSpecs." + error; + } + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + return null; + }; + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + */ + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + return message; + }; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.SearchRequest} message SearchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; + } + if (options.defaults) { + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + return object; + }; + + /** + * Converts this SearchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + * @returns {Object.} JSON object + */ + SearchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchRequest.FacetSpec = (function() { + + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ + + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; + + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; + + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + case 2: + message.limit = reader.int32(); + break; + case 3: + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + case 4: + message.enableDynamicPosition = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); + if (error) + return "facetKey." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); + } + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; + } + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; + return object; + }; + + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + FacetSpec.FacetKey = (function() { + + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ + + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; + + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; + + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; + + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; + + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; + + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; + + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; + + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2beta.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + return writer; + }; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + return null; + }; + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2beta.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + return message; + }; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2beta.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + return object; + }; + + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetKey; + })(); + + return FacetSpec; + })(); + + SearchRequest.DynamicFacetSpec = (function() { + + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ + + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); + + return DynamicFacetSpec; + })(); + + SearchRequest.BoostSpec = (function() { + + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + */ + + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + return null; + }; + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + return object; + }; + + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BoostSpec.ConditionBoostSpec = (function() { + + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ + + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; + + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConditionBoostSpec; + })(); + + return BoostSpec; + })(); + + SearchRequest.QueryExpansionSpec = (function() { + + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + */ + + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + return writer; + }; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + return object; + }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Condition enum. + * @name google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; + })(); + + return SearchRequest; + })(); + + v2beta.SearchResponse = (function() { + + /** + * Properties of a SearchResponse. + * @memberof google.cloud.retail.v2beta + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + */ + + /** + * Constructs a new SearchResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse + * @constructor + * @param {google.cloud.retail.v2beta.ISearchResponse=} [properties] Properties to set + */ + function SearchResponse(properties) { + this.results = []; + this.facets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.results = $util.emptyArray; + + /** + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.facets = $util.emptyArray; + + /** + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.totalSize = 0; + + /** + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.correctedQuery = ""; + + /** + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.attributionToken = ""; + + /** + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.nextPageToken = ""; + + /** + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.queryExpansionInfo = null; + + /** + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.redirectUri = ""; + + /** + * Creates a new SearchResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {google.cloud.retail.v2beta.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse instance + */ + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); + }; + + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {google.cloud.retail.v2beta.ISearchResponse} message SearchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2beta.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + return writer; + }; + + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {google.cloud.retail.v2beta.ISearchResponse} message SearchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + case 3: + message.totalSize = reader.int32(); + break; + case 4: + message.correctedQuery = reader.string(); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + message.nextPageToken = reader.string(); + break; + case 7: + message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + case 10: + message.redirectUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.Facet.verify(message.facets[i]); + if (error) + return "facets." + error; + } + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (error) + return "queryExpansionInfo." + error; + } + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse + */ + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.fromObject(object.results[i]); + } + } + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.fromObject(object.facets[i]); + } + } + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {google.cloud.retail.v2beta.SearchResponse} message SearchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + } + if (options.defaults) { + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + return object; + }; + + /** + * Converts this SearchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + * @returns {Object.} JSON object + */ + SearchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchResponse.SearchResult = (function() { + + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2beta.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + */ + + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; + + /** + * SearchResult product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; + + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; + + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; + + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; + + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + return null; + }; + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; + } + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } + return object; + }; + + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SearchResult; + })(); + + SearchResponse.Facet = (function() { + + /** + * Properties of a Facet. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet + */ + + /** + * Constructs a new Facet. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet=} [properties] Properties to set + */ + function Facet(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + */ + Facet.prototype.key = ""; + + /** + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; + + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; + + /** + * Creates a new Facet instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet instance + */ + Facet.create = function create(properties) { + return new Facet(properties); + }; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); + return writer; + }; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Facet message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Facet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; + return null; + }; + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet + */ + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.Facet) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); + return message; + }; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet} message Facet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Facet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; + return object; + }; + + /** + * Converts this Facet to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + * @returns {Object.} JSON object + */ + Facet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Facet.FacetValue = (function() { + + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2beta.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ + + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; + + /** + * FacetValue interval. + * @member {google.cloud.retail.v2beta.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; + + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2beta.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2beta.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2beta.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; + + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetValue; + })(); + + return Facet; + })(); + + SearchResponse.QueryExpansionInfo = (function() { + + /** + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + */ + + /** + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + */ + function QueryExpansionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.expandedQuery = false; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + */ + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); + }; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + return writer; + }; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expandedQuery = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + */ + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.expandedQuery = false; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + return object; + }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryExpansionInfo; + })(); + + return SearchResponse; })(); v2beta.UserEventService = (function() { @@ -44241,23 +81721,25 @@ return GeneratedCodeInfo; })(); - protobuf.Empty = (function() { + protobuf.Timestamp = (function() { /** - * Properties of an Empty. + * Properties of a Timestamp. * @memberof google.protobuf - * @interface IEmpty + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos */ /** - * Constructs a new Empty. + * Constructs a new Timestamp. * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty + * @classdesc Represents a Timestamp. + * @implements ITimestamp * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @param {google.protobuf.ITimestamp=} [properties] Properties to set */ - function Empty(properties) { + function Timestamp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44265,63 +81747,89 @@ } /** - * Creates a new Empty instance using the specified properties. + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. * @function create - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance */ - Empty.create = function create(properties) { - return new Empty(properties); + Timestamp.create = function create(properties) { + return new Timestamp(properties); }; /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encode - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Empty.encode = function encode(message, writer) { + Timestamp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Empty} Empty + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Empty.decode = function decode(reader, length) { + Timestamp.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -44331,74 +81839,334 @@ }; /** - * Decodes an Empty message from the specified reader or buffer, length delimited. + * Decodes a Timestamp message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Empty.decodeDelimited = function decodeDelimited(reader) { + Timestamp.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Empty message. + * Verifies a Timestamp message. * @function verify - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Empty.verify = function verify(message) { + Timestamp.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; return null; }; /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty + * @returns {google.protobuf.Timestamp} Timestamp */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) return object; - return new $root.google.protobuf.Empty(); + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; }; /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.Empty} message Empty + * @param {google.protobuf.Timestamp} message Timestamp * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Empty.toObject = function toObject() { - return {}; + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; }; /** - * Converts this Empty to JSON. + * Converts this Timestamp to JSON. * @function toJSON - * @memberof google.protobuf.Empty + * @memberof google.protobuf.Timestamp * @instance * @returns {Object.} JSON object */ - Empty.prototype.toJSON = function toJSON() { + Timestamp.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Empty; + return Timestamp; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Duration; })(); protobuf.FieldMask = (function() { @@ -44604,230 +82372,6 @@ return FieldMask; })(); - protobuf.Timestamp = (function() { - - /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos - */ - - /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp - * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - */ - function Timestamp(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.nanos = 0; - - /** - * Creates a new Timestamp instance using the specified properties. - * @function create - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance - */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); - }; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Timestamp message. - * @function verify - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Timestamp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp - */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) - return object; - var message = new $root.google.protobuf.Timestamp(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.Timestamp} message Timestamp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Timestamp.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Timestamp to JSON. - * @function toJSON - * @memberof google.protobuf.Timestamp - * @instance - * @returns {Object.} JSON object - */ - Timestamp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Timestamp; - })(); - protobuf.DoubleValue = (function() { /** @@ -46767,6 +84311,166 @@ return Any; })(); + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Empty; + })(); + protobuf.Struct = (function() { /** @@ -47581,25 +85285,39 @@ return ListValue; })(); - protobuf.Duration = (function() { + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { /** - * Properties of a Duration. - * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details */ /** - * Constructs a new Duration. - * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set + * @param {google.rpc.IStatus=} [properties] Properties to set */ - function Duration(properties) { + function Status(properties) { + this.details = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47607,88 +85325,104 @@ } /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration + * Status code. + * @member {number} code + * @memberof google.rpc.Status * @instance */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Status.prototype.code = 0; /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration + * Status message. + * @member {string} message + * @memberof google.rpc.Status * @instance */ - Duration.prototype.nanos = 0; + Status.prototype.message = ""; /** - * Creates a new Duration instance using the specified properties. + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. * @function create - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance */ - Duration.create = function create(properties) { - return new Duration(properties); + Status.create = function create(properties) { + return new Status(properties); }; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. * @function encode - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.rpc.IStatus} message Status message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encode = function encode(message, writer) { + Status.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.rpc.IStatus} message Status message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { + Status.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes a Status message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration + * @returns {google.rpc.Status} Status * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decode = function decode(reader, length) { + Status.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.seconds = reader.int64(); + message.code = reader.int32(); break; case 2: - message.nanos = reader.int32(); + message.message = reader.string(); + break; + case 3: + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -47699,145 +85433,156 @@ }; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes a Status message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration + * @returns {google.rpc.Status} Status * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decodeDelimited = function decodeDelimited(reader) { + Status.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Duration message. + * Verifies a Status message. * @function verify - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Duration.verify = function verify(message) { + Status.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } return null; }; /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates a Status message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration + * @returns {google.rpc.Status} Status */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) return object; - var message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } return message; }; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. + * Creates a plain object from a Status message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @static - * @param {google.protobuf.Duration} message Duration + * @param {google.rpc.Status} message Status * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + Status.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.details = []; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; return object; }; /** - * Converts this Duration to JSON. + * Converts this Status to JSON. * @function toJSON - * @memberof google.protobuf.Duration + * @memberof google.rpc.Status * @instance * @returns {Object.} JSON object */ - Duration.prototype.toJSON = function toJSON() { + Status.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Duration; + return Status; })(); - return protobuf; + return rpc; })(); - google.rpc = (function() { + google.type = (function() { /** - * Namespace rpc. + * Namespace type. * @memberof google * @namespace */ - var rpc = {}; + var type = {}; - rpc.Status = (function() { + type.Date = (function() { /** - * Properties of a Status. - * @memberof google.rpc - * @interface IStatus - * @property {number|null} [code] Status code - * @property {string|null} [message] Status message - * @property {Array.|null} [details] Status details + * Properties of a Date. + * @memberof google.type + * @interface IDate + * @property {number|null} [year] Date year + * @property {number|null} [month] Date month + * @property {number|null} [day] Date day */ /** - * Constructs a new Status. - * @memberof google.rpc - * @classdesc Represents a Status. - * @implements IStatus + * Constructs a new Date. + * @memberof google.type + * @classdesc Represents a Date. + * @implements IDate * @constructor - * @param {google.rpc.IStatus=} [properties] Properties to set + * @param {google.type.IDate=} [properties] Properties to set */ - function Status(properties) { - this.details = []; + function Date(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47845,104 +85590,101 @@ } /** - * Status code. - * @member {number} code - * @memberof google.rpc.Status + * Date year. + * @member {number} year + * @memberof google.type.Date * @instance */ - Status.prototype.code = 0; + Date.prototype.year = 0; /** - * Status message. - * @member {string} message - * @memberof google.rpc.Status + * Date month. + * @member {number} month + * @memberof google.type.Date * @instance */ - Status.prototype.message = ""; + Date.prototype.month = 0; /** - * Status details. - * @member {Array.} details - * @memberof google.rpc.Status + * Date day. + * @member {number} day + * @memberof google.type.Date * @instance */ - Status.prototype.details = $util.emptyArray; + Date.prototype.day = 0; /** - * Creates a new Status instance using the specified properties. + * Creates a new Date instance using the specified properties. * @function create - * @memberof google.rpc.Status + * @memberof google.type.Date * @static - * @param {google.rpc.IStatus=} [properties] Properties to set - * @returns {google.rpc.Status} Status instance + * @param {google.type.IDate=} [properties] Properties to set + * @returns {google.type.Date} Date instance */ - Status.create = function create(properties) { - return new Status(properties); + Date.create = function create(properties) { + return new Date(properties); }; /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. * @function encode - * @memberof google.rpc.Status + * @memberof google.type.Date * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {google.type.IDate} message Date message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Status.encode = function encode(message, writer) { + Date.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.details != null && message.details.length) - for (var i = 0; i < message.details.length; ++i) - $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.year != null && Object.hasOwnProperty.call(message, "year")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.year); + if (message.month != null && Object.hasOwnProperty.call(message, "month")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.month); + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.day); return writer; }; /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. * @function encodeDelimited - * @memberof google.rpc.Status + * @memberof google.type.Date * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {google.type.IDate} message Date message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Status.encodeDelimited = function encodeDelimited(message, writer) { + Date.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Status message from the specified reader or buffer. + * Decodes a Date message from the specified reader or buffer. * @function decode - * @memberof google.rpc.Status + * @memberof google.type.Date * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.rpc.Status} Status + * @returns {google.type.Date} Date * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Status.decode = function decode(reader, length) { + Date.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Date(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.code = reader.int32(); + message.year = reader.int32(); break; case 2: - message.message = reader.string(); + message.month = reader.int32(); break; case 3: - if (!(message.details && message.details.length)) - message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + message.day = reader.int32(); break; default: reader.skipType(tag & 7); @@ -47953,125 +85695,107 @@ }; /** - * Decodes a Status message from the specified reader or buffer, length delimited. + * Decodes a Date message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.rpc.Status + * @memberof google.type.Date * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.rpc.Status} Status + * @returns {google.type.Date} Date * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Status.decodeDelimited = function decodeDelimited(reader) { + Date.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Status message. + * Verifies a Date message. * @function verify - * @memberof google.rpc.Status + * @memberof google.type.Date * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Status.verify = function verify(message) { + Date.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.details != null && message.hasOwnProperty("details")) { - if (!Array.isArray(message.details)) - return "details: array expected"; - for (var i = 0; i < message.details.length; ++i) { - var error = $root.google.protobuf.Any.verify(message.details[i]); - if (error) - return "details." + error; - } - } + if (message.year != null && message.hasOwnProperty("year")) + if (!$util.isInteger(message.year)) + return "year: integer expected"; + if (message.month != null && message.hasOwnProperty("month")) + if (!$util.isInteger(message.month)) + return "month: integer expected"; + if (message.day != null && message.hasOwnProperty("day")) + if (!$util.isInteger(message.day)) + return "day: integer expected"; return null; }; /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. + * Creates a Date message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.rpc.Status + * @memberof google.type.Date * @static * @param {Object.} object Plain object - * @returns {google.rpc.Status} Status + * @returns {google.type.Date} Date */ - Status.fromObject = function fromObject(object) { - if (object instanceof $root.google.rpc.Status) + Date.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Date) return object; - var message = new $root.google.rpc.Status(); - if (object.code != null) - message.code = object.code | 0; - if (object.message != null) - message.message = String(object.message); - if (object.details) { - if (!Array.isArray(object.details)) - throw TypeError(".google.rpc.Status.details: array expected"); - message.details = []; - for (var i = 0; i < object.details.length; ++i) { - if (typeof object.details[i] !== "object") - throw TypeError(".google.rpc.Status.details: object expected"); - message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); - } - } + var message = new $root.google.type.Date(); + if (object.year != null) + message.year = object.year | 0; + if (object.month != null) + message.month = object.month | 0; + if (object.day != null) + message.day = object.day | 0; return message; }; /** - * Creates a plain object from a Status message. Also converts values to other types if specified. + * Creates a plain object from a Date message. Also converts values to other types if specified. * @function toObject - * @memberof google.rpc.Status + * @memberof google.type.Date * @static - * @param {google.rpc.Status} message Status + * @param {google.type.Date} message Date * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Status.toObject = function toObject(message, options) { + Date.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.details = []; if (options.defaults) { - object.code = 0; - object.message = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.details && message.details.length) { - object.details = []; - for (var j = 0; j < message.details.length; ++j) - object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + object.year = 0; + object.month = 0; + object.day = 0; } + if (message.year != null && message.hasOwnProperty("year")) + object.year = message.year; + if (message.month != null && message.hasOwnProperty("month")) + object.month = message.month; + if (message.day != null && message.hasOwnProperty("day")) + object.day = message.day; return object; }; /** - * Converts this Status to JSON. + * Converts this Date to JSON. * @function toJSON - * @memberof google.rpc.Status + * @memberof google.type.Date * @instance * @returns {Object.} JSON object */ - Status.prototype.toJSON = function toJSON() { + Date.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Status; + return Date; })(); - return rpc; + return type; })(); google.longrunning = (function() { diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 3b3156325c9..d777f391db2 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -61,110 +61,83 @@ } } }, - "CatalogService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "ListCatalogs": { - "requestType": "ListCatalogsRequest", - "responseType": "ListCatalogsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=projects/*/locations/*}/catalogs" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "UpdateCatalog": { - "requestType": "UpdateCatalogRequest", - "responseType": "Catalog", - "options": { - "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", - "(google.api.http).body": "catalog", - "(google.api.method_signature)": "catalog,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", - "body": "catalog" - } - }, - { - "(google.api.method_signature)": "catalog,update_mask" - } - ] - } - } - }, - "ListCatalogsRequest": { + "Audience": { "fields": { - "parent": { + "genders": { + "rule": "repeated", "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 + "id": 1 }, - "pageToken": { + "ageGroups": { + "rule": "repeated", "type": "string", - "id": 3 + "id": 2 } } }, - "ListCatalogsResponse": { + "ColorInfo": { "fields": { - "catalogs": { + "colorFamilies": { "rule": "repeated", - "type": "Catalog", + "type": "string", "id": 1 }, - "nextPageToken": { + "colors": { + "rule": "repeated", "type": "string", "id": 2 } } }, - "UpdateCatalogRequest": { + "CustomAttribute": { + "oneofs": { + "_searchable": { + "oneof": [ + "searchable" + ] + }, + "_indexable": { + "oneof": [ + "indexable" + ] + } + }, "fields": { - "catalog": { - "type": "Catalog", - "id": 1, + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "numbers": { + "rule": "repeated", + "type": "double", + "id": 2 + }, + "searchable": { + "type": "bool", + "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "proto3_optional": true } }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 + "indexable": { + "type": "bool", + "id": 4, + "options": { + "proto3_optional": true + } } } }, - "CustomAttribute": { + "FulfillmentInfo": { "fields": { - "text": { - "rule": "repeated", + "type": { "type": "string", "id": 1 }, - "numbers": { + "placeIds": { "rule": "repeated", - "type": "double", + "type": "string", "id": 2 } } @@ -188,6 +161,40 @@ } } }, + "Interval": { + "oneofs": { + "min": { + "oneof": [ + "minimum", + "exclusiveMinimum" + ] + }, + "max": { + "oneof": [ + "maximum", + "exclusiveMaximum" + ] + } + }, + "fields": { + "minimum": { + "type": "double", + "id": 1 + }, + "exclusiveMinimum": { + "type": "double", + "id": 2 + }, + "maximum": { + "type": "double", + "id": 3 + }, + "exclusiveMaximum": { + "type": "double", + "id": 4 + } + } + }, "PriceInfo": { "fields": { "currencyCode": { @@ -205,6 +212,52 @@ "cost": { "type": "float", "id": 4 + }, + "priceEffectiveTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "priceExpireTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "priceRange": { + "type": "PriceRange", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "PriceRange": { + "fields": { + "price": { + "type": "Interval", + "id": 1 + }, + "originalPrice": { + "type": "Interval", + "id": 2 + } + } + } + } + }, + "Rating": { + "fields": { + "ratingCount": { + "type": "int32", + "id": 1 + }, + "averageRating": { + "type": "float", + "id": 2 + }, + "ratingHistogram": { + "rule": "repeated", + "type": "int32", + "id": 3 } } }, @@ -228,6 +281,14 @@ } } }, + "Promotion": { + "fields": { + "promotionId": { + "type": "string", + "id": 1 + } + } + }, "GcsSource": { "fields": { "inputUris": { @@ -245,7 +306,18 @@ } }, "BigQuerySource": { + "oneofs": { + "partition": { + "oneof": [ + "partitionDate" + ] + } + }, "fields": { + "partitionDate": { + "type": "google.type.Date", + "id": 6 + }, "projectId": { "type": "string", "id": 5 @@ -319,9 +391,14 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, + "requestId": { + "type": "string", + "id": 6 + }, "inputConfig": { "type": "ProductInputConfig", "id": 2, @@ -336,6 +413,23 @@ "updateMask": { "type": "google.protobuf.FieldMask", "id": 4 + }, + "reconciliationMode": { + "type": "ReconciliationMode", + "id": 5 + }, + "notificationPubsubTopic": { + "type": "string", + "id": 7 + } + }, + "nested": { + "ReconciliationMode": { + "values": { + "RECONCILIATION_MODE_UNSPECIFIED": 0, + "INCREMENTAL": 1, + "FULL": 2 + } } } }, @@ -345,7 +439,8 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, "inputConfig": { @@ -361,6 +456,29 @@ } } }, + "ImportCompletionDataRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "inputConfig": { + "type": "CompletionDataInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "notificationPubsubTopic": { + "type": "string", + "id": 3 + } + } + }, "ProductInputConfig": { "oneofs": { "source": { @@ -420,6 +538,24 @@ } } }, + "CompletionDataInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "bigQuerySource" + ] + } + }, + "fields": { + "bigQuerySource": { + "type": "BigQuerySource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, "ImportMetadata": { "fields": { "createTime": { @@ -437,6 +573,14 @@ "failureCount": { "type": "int64", "id": 4 + }, + "requestId": { + "type": "string", + "id": 5 + }, + "notificationPubsubTopic": { + "type": "string", + "id": 6 } } }, @@ -482,12 +626,40 @@ } } }, + "ImportCompletionDataResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + } + } + }, "Product": { "options": { "(google.api.resource).type": "retail.googleapis.com/Product", "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" }, + "oneofs": { + "expiration": { + "oneof": [ + "expireTime", + "ttl" + ] + } + }, "fields": { + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 16 + }, + "ttl": { + "type": "google.protobuf.Duration", + "id": 17, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + }, "name": { "type": "string", "id": 1, @@ -513,10 +685,19 @@ "type": "string", "id": 4 }, - "categories": { + "collectionMemberIds": { "rule": "repeated", "type": "string", - "id": 7 + "id": 5 + }, + "gtin": { + "type": "string", + "id": 6 + }, + "categories": { + "rule": "repeated", + "type": "string", + "id": 7 }, "title": { "type": "string", @@ -525,10 +706,19 @@ "(google.api.field_behavior)": "REQUIRED" } }, + "brands": { + "rule": "repeated", + "type": "string", + "id": 9 + }, "description": { "type": "string", "id": 10 }, + "languageCode": { + "type": "string", + "id": 11 + }, "attributes": { "keyType": "string", "type": "CustomAttribute", @@ -543,6 +733,10 @@ "type": "PriceInfo", "id": 14 }, + "rating": { + "type": "Rating", + "id": 15 + }, "availableTime": { "type": "google.protobuf.Timestamp", "id": 18 @@ -555,6 +749,11 @@ "type": "google.protobuf.Int32Value", "id": 20 }, + "fulfillmentInfo": { + "rule": "repeated", + "type": "FulfillmentInfo", + "id": 21 + }, "uri": { "type": "string", "id": 22 @@ -563,6 +762,55 @@ "rule": "repeated", "type": "Image", "id": 23 + }, + "audience": { + "type": "Audience", + "id": 24 + }, + "colorInfo": { + "type": "ColorInfo", + "id": 25 + }, + "sizes": { + "rule": "repeated", + "type": "string", + "id": 26 + }, + "materials": { + "rule": "repeated", + "type": "string", + "id": 27 + }, + "patterns": { + "rule": "repeated", + "type": "string", + "id": 28 + }, + "conditions": { + "rule": "repeated", + "type": "string", + "id": 29 + }, + "promotions": { + "rule": "repeated", + "type": "Promotion", + "id": 34 + }, + "publishTime": { + "type": "google.protobuf.Timestamp", + "id": 33 + }, + "retrievableFields": { + "type": "google.protobuf.FieldMask", + "id": 30 + }, + "variants": { + "rule": "repeated", + "type": "Product", + "id": 31, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -601,6 +849,10 @@ "(google.api.field_behavior)": "REQUIRED" } }, + "sessionId": { + "type": "string", + "id": 21 + }, "eventTime": { "type": "google.protobuf.Timestamp", "id": 3 @@ -619,6 +871,10 @@ "type": "ProductDetail", "id": 6 }, + "completionDetail": { + "type": "CompletionDetail", + "id": 22 + }, "attributes": { "keyType": "string", "type": "CustomAttribute", @@ -636,6 +892,18 @@ "type": "string", "id": 10 }, + "filter": { + "type": "string", + "id": 16 + }, + "orderBy": { + "type": "string", + "id": 17 + }, + "offset": { + "type": "int32", + "id": 18 + }, "pageCategories": { "rule": "repeated", "type": "string", @@ -674,6 +942,22 @@ } } }, + "CompletionDetail": { + "fields": { + "completionAttributionToken": { + "type": "string", + "id": 1 + }, + "selectedSuggestion": { + "type": "string", + "id": 2 + }, + "selectedPosition": { + "type": "int32", + "id": 3 + } + } + }, "PurchaseTransaction": { "fields": { "id": { @@ -704,261 +988,127 @@ } } }, - "PredictionService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "Predict": { - "requestType": "PredictRequest", - "responseType": "PredictResponse", - "options": { - "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*" - } - } - ] - } - } - }, - "PredictRequest": { - "fields": { - "placement": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "userEvent": { - "type": "UserEvent", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "pageSize": { - "type": "int32", - "id": 3 - }, - "pageToken": { - "type": "string", - "id": 4 - }, - "filter": { - "type": "string", - "id": 5 - }, - "validateOnly": { - "type": "bool", - "id": 6 - }, - "params": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 7 - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 8 - } - } - }, - "PredictResponse": { - "fields": { - "results": { - "rule": "repeated", - "type": "PredictionResult", - "id": 1 - }, - "attributionToken": { - "type": "string", - "id": 2 - }, - "missingIds": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "validateOnly": { - "type": "bool", - "id": 4 - } - }, - "nested": { - "PredictionResult": { - "fields": { - "id": { - "type": "string", - "id": 1 - }, - "metadata": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 2 - } - } - } - } - }, - "ProductService": { + "CatalogService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "body": "product" - } - }, - { - "(google.api.method_signature)": "parent,product,product_id" - } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", "options": { - "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "get": "/v2/{parent=projects/*/locations/*}/catalogs" } }, { - "(google.api.method_signature)": "name" + "(google.api.method_signature)": "parent" } ] }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", "options": { - "(google.api.http).patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" + "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" }, "parsedOptions": [ { "(google.api.http)": { - "patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "body": "product" + "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" } }, { - "(google.api.method_signature)": "product,update_mask" + "(google.api.method_signature)": "catalog,update_mask" } ] }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", + "SetDefaultBranch": { + "requestType": "SetDefaultBranchRequest", "responseType": "google.protobuf.Empty", "options": { - "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" + "(google.api.http).post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "(google.api.http).body": "*", + "(google.api.method_signature)": "catalog" }, "parsedOptions": [ { "(google.api.http)": { - "delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "body": "*" } }, { - "(google.api.method_signature)": "name" + "(google.api.method_signature)": "catalog" } ] }, - "ImportProducts": { - "requestType": "ImportProductsRequest", - "responseType": "google.longrunning.Operation", + "GetDefaultBranch": { + "requestType": "GetDefaultBranchRequest", + "responseType": "GetDefaultBranchResponse", "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportProductsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", + "(google.api.method_signature)": "catalog" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", - "body": "*" + "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" } }, { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.ImportProductsResponse", - "metadata_type": "google.cloud.retail.v2.ImportMetadata" - } + "(google.api.method_signature)": "catalog" } ] } } }, - "CreateProductRequest": { + "ListCatalogsRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.resource_reference).type": "locations.googleapis.com/Location" } }, - "product": { - "type": "Product", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "pageSize": { + "type": "int32", + "id": 2 }, - "productId": { + "pageToken": { "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 3 } } }, - "GetProductRequest": { + "ListCatalogsResponse": { "fields": { - "name": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" - } + "id": 2 } } }, - "UpdateProductRequest": { + "UpdateCatalogRequest": { "fields": { - "product": { - "type": "Product", + "catalog": { + "type": "Catalog", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" @@ -970,2137 +1120,5146 @@ } } }, - "DeleteProductRequest": { + "SetDefaultBranchRequest": { "fields": { - "name": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "branchId": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } + }, + "note": { + "type": "string", + "id": 3 } } }, - "PurgeMetadata": { - "fields": {} - }, - "PurgeUserEventsRequest": { + "GetDefaultBranchRequest": { "fields": { - "parent": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } - }, - "filter": { + } + } + }, + "GetDefaultBranchResponse": { + "fields": { + "branch": { "type": "string", - "id": 2, + "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, - "force": { - "type": "bool", + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "note": { + "type": "string", "id": 3 } } }, - "PurgeUserEventsResponse": { - "fields": { - "purgedEventsCount": { - "type": "int64", - "id": 1 - } - } - }, - "UserEventService": { + "CompletionService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "WriteUserEvent": { - "requestType": "WriteUserEventRequest", - "responseType": "UserEvent", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", - "(google.api.http).body": "user_event" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", - "body": "user_event" - } - } - ] - }, - "CollectUserEvent": { - "requestType": "CollectUserEventRequest", - "responseType": "google.api.HttpBody", - "options": { - "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - } - } - ] - }, - "PurgeUserEvents": { - "requestType": "PurgeUserEventsRequest", - "responseType": "google.longrunning.Operation", + "CompleteQuery": { + "requestType": "CompleteQueryRequest", + "responseType": "CompleteQueryResponse", "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.PurgeUserEventsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.PurgeMetadata" + "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.PurgeUserEventsResponse", - "metadata_type": "google.cloud.retail.v2.PurgeMetadata" + "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" } } ] }, - "ImportUserEvents": { - "requestType": "ImportUserEventsRequest", + "ImportCompletionData": { + "requestType": "ImportCompletionDataRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportUserEventsResponse", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", "body": "*" } }, { "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.ImportUserEventsResponse", + "response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", "metadata_type": "google.cloud.retail.v2.ImportMetadata" } } ] - }, - "RejoinUserEvents": { - "requestType": "RejoinUserEventsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", - "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "RejoinUserEventsResponse", - "metadata_type": "RejoinUserEventsMetadata" - } - } - ] } } }, - "WriteUserEventRequest": { + "CompleteQueryRequest": { "fields": { - "parent": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "userEvent": { - "type": "UserEvent", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "CollectUserEventRequest": { - "fields": { - "parent": { + "query": { "type": "string", - "id": 1, + "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "userEvent": { + "visitorId": { "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 7 }, - "uri": { + "languageCodes": { + "rule": "repeated", "type": "string", "id": 3 }, - "ets": { - "type": "int64", + "deviceType": { + "type": "string", "id": 4 + }, + "dataset": { + "type": "string", + "id": 6 + }, + "maxSuggestions": { + "type": "int32", + "id": 5 } } }, - "RejoinUserEventsRequest": { + "CompleteQueryResponse": { "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "completionResults": { + "rule": "repeated", + "type": "CompletionResult", + "id": 1 }, - "userEventRejoinScope": { - "type": "UserEventRejoinScope", + "attributionToken": { + "type": "string", "id": 2 + }, + "recentSearchResults": { + "rule": "repeated", + "type": "RecentSearchResult", + "id": 3 } }, "nested": { - "UserEventRejoinScope": { - "values": { - "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, - "JOINED_EVENTS": 1, - "UNJOINED_EVENTS": 2 + "CompletionResult": { + "fields": { + "suggestion": { + "type": "string", + "id": 1 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 2 + } + } + }, + "RecentSearchResult": { + "fields": { + "recentSearch": { + "type": "string", + "id": 1 + } } } } }, - "RejoinUserEventsResponse": { - "fields": { - "rejoinedUserEventsCount": { - "type": "int64", - "id": 1 + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*" + } + } + ] } } }, - "RejoinUserEventsMetadata": { - "fields": {} - } - } - }, - "v2alpha": { - "options": { - "csharp_namespace": "Google.Cloud.Retail.V2Alpha", - "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail", - "java_multiple_files": true, - "java_outer_classname": "UserEventServiceProto", - "java_package": "com.google.cloud.retail.v2alpha", - "objc_class_prefix": "RETAIL", - "php_namespace": "Google\\Cloud\\Retail\\V2alpha", - "ruby_package": "Google::Cloud::Retail::V2alpha", - "(google.api.resource_definition).type": "retail.googleapis.com/Branch", - "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" - }, - "nested": { - "ProductLevelConfig": { + "PredictRequest": { "fields": { - "ingestionProductType": { + "placement": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "merchantCenterProductIdField": { + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { "type": "string", - "id": 2 + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 } } }, - "Catalog": { - "options": { - "(google.api.resource).type": "retail.googleapis.com/Catalog", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" - }, + "PredictResponse": { "fields": { - "name": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } + "id": 2 }, - "displayName": { + "missingIds": { + "rule": "repeated", "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } + "id": 3 }, - "productLevelConfig": { - "type": "ProductLevelConfig", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } } } } }, - "CatalogService": { + "ProductService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "ListCatalogs": { - "requestType": "ListCatalogsRequest", - "responseType": "ListCatalogsResponse", + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", "options": { - "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*}/catalogs", - "(google.api.method_signature)": "parent" + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v2alpha/{parent=projects/*/locations/*}/catalogs" + "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" } }, { - "(google.api.method_signature)": "parent" + "(google.api.method_signature)": "parent,product,product_id" } ] }, - "UpdateCatalog": { - "requestType": "UpdateCatalogRequest", - "responseType": "Catalog", + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", "options": { - "(google.api.http).patch": "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}", - "(google.api.http).body": "catalog", - "(google.api.method_signature)": "catalog,update_mask" + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "patch": "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}", - "body": "catalog" + "get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" } }, { - "(google.api.method_signature)": "catalog,update_mask" + "(google.api.method_signature)": "name" } ] - } - } - }, - "ListCatalogsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListCatalogsResponse": { - "fields": { - "catalogs": { - "rule": "repeated", - "type": "Catalog", - "id": 1 }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "UpdateCatalogRequest": { - "fields": { - "catalog": { - "type": "Catalog", - "id": 1, + "ListProducts": { + "requestType": "ListProductsRequest", + "responseType": "ListProductsResponse", "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "CustomAttribute": { - "fields": { - "text": { - "rule": "repeated", - "type": "string", - "id": 1 + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" + } + }, + { + "(google.api.method_signature)": "product,update_mask" + } + ] }, - "numbers": { - "rule": "repeated", - "type": "double", - "id": 2 - } - } - }, - "Image": { - "fields": { - "uri": { - "type": "string", - "id": 1, + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, - "height": { - "type": "int32", - "id": 2 + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } + } + ] }, - "width": { - "type": "int32", - "id": 3 + "SetInventory": { + "requestType": "SetInventoryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "(google.api.http).body": "*", + "(google.api.method_signature)": "inventory,set_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.SetInventoryResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.SetInventoryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "body": "*" + } + }, + { + "(google.api.method_signature)": "inventory,set_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.SetInventoryResponse", + "metadata_type": "google.cloud.retail.v2.SetInventoryMetadata" + } + } + ] + }, + "AddFulfillmentPlaces": { + "requestType": "AddFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.AddFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.AddFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" + } + } + ] + }, + "RemoveFulfillmentPlaces": { + "requestType": "RemoveFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" + } + } + ] } } }, - "PriceInfo": { + "CreateProductRequest": { "fields": { - "currencyCode": { + "parent": { "type": "string", - "id": 1 - }, - "price": { - "type": "float", - "id": 2 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } }, - "originalPrice": { - "type": "float", - "id": 3 + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "cost": { - "type": "float", - "id": 4 + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, - "UserInfo": { + "GetProductRequest": { "fields": { - "userId": { - "type": "string", - "id": 1 - }, - "ipAddress": { - "type": "string", - "id": 2 - }, - "userAgent": { + "name": { "type": "string", - "id": 3 - }, - "directUserRequest": { - "type": "bool", - "id": 4 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } } } }, - "GcsSource": { + "UpdateProductRequest": { "fields": { - "inputUris": { - "rule": "repeated", - "type": "string", + "product": { + "type": "Product", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "dataSchema": { - "type": "string", + "updateMask": { + "type": "google.protobuf.FieldMask", "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 } } }, - "BigQuerySource": { + "DeleteProductRequest": { "fields": { - "projectId": { - "type": "string", - "id": 5 - }, - "datasetId": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" } - }, - "tableId": { + } + } + }, + "ListProductsRequest": { + "fields": { + "parent": { "type": "string", - "id": 2, + "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, - "gcsStagingDir": { + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { "type": "string", "id": 3 }, - "dataSchema": { + "filter": { "type": "string", "id": 4 + }, + "readMask": { + "type": "google.protobuf.FieldMask", + "id": 5 } } }, - "ProductInlineSource": { + "ListProductsResponse": { "fields": { "products": { "rule": "repeated", "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 } } }, - "UserEventInlineSource": { + "SetInventoryRequest": { "fields": { - "userEvents": { - "rule": "repeated", - "type": "UserEvent", + "inventory": { + "type": "Product", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "setMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "allowMissing": { + "type": "bool", + "id": 4 } } }, - "ImportErrorsConfig": { - "oneofs": { - "destination": { - "oneof": [ - "gcsPrefix" - ] - } - }, - "fields": { - "gcsPrefix": { - "type": "string", - "id": 1 - } - } + "SetInventoryMetadata": { + "fields": {} }, - "ImportProductsRequest": { + "SetInventoryResponse": { + "fields": {} + }, + "AddFulfillmentPlacesRequest": { "fields": { - "parent": { + "product": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" } }, - "inputConfig": { - "type": "ProductInputConfig", + "type": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "errorsConfig": { - "type": "ImportErrorsConfig", - "id": 3 + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "updateMask": { - "type": "google.protobuf.FieldMask", + "addTime": { + "type": "google.protobuf.Timestamp", "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 } } }, - "ImportUserEventsRequest": { + "AddFulfillmentPlacesMetadata": { + "fields": {} + }, + "AddFulfillmentPlacesResponse": { + "fields": {} + }, + "RemoveFulfillmentPlacesRequest": { "fields": { - "parent": { + "product": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } }, - "inputConfig": { - "type": "UserEventInputConfig", + "type": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "errorsConfig": { - "type": "ImportErrorsConfig", - "id": 3 - } - } - }, - "ProductInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "productInlineSource", - "gcsSource", - "bigQuerySource" - ] - } - }, - "fields": { - "productInlineSource": { - "type": "ProductInlineSource", - "id": 1 + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "gcsSource": { - "type": "GcsSource", - "id": 2 + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 4 }, - "bigQuerySource": { - "type": "BigQuerySource", - "id": 3 + "allowMissing": { + "type": "bool", + "id": 5 } } }, - "UserEventInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "userEventInlineSource", - "gcsSource", - "bigQuerySource" - ] - } - }, + "RemoveFulfillmentPlacesMetadata": { + "fields": {} + }, + "RemoveFulfillmentPlacesResponse": { + "fields": {} + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { "fields": { - "userEventInlineSource": { - "type": "UserEventInlineSource", + "parent": { + "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "gcsSource": { - "type": "GcsSource", + "filter": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "bigQuerySource": { - "type": "BigQuerySource", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "ImportMetadata": { - "fields": { - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "successCount": { - "type": "int64", - "id": 3 - }, - "failureCount": { - "type": "int64", - "id": 4 - } - } - }, - "ImportProductsResponse": { - "fields": { - "errorSamples": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 - }, - "errorsConfig": { - "type": "ImportErrorsConfig", - "id": 2 - } - } - }, - "ImportUserEventsResponse": { - "fields": { - "errorSamples": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 - }, - "errorsConfig": { - "type": "ImportErrorsConfig", - "id": 2 - }, - "importSummary": { - "type": "UserEventImportSummary", + "force": { + "type": "bool", "id": 3 } } }, - "UserEventImportSummary": { + "PurgeUserEventsResponse": { "fields": { - "joinedEventsCount": { + "purgedEventsCount": { "type": "int64", "id": 1 - }, - "unjoinedEventsCount": { - "type": "int64", - "id": 2 } } }, - "Product": { + "SearchService": { "options": { - "(google.api.resource).type": "retail.googleapis.com/Product", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, + "methods": { + "Search": { + "requestType": "SearchRequest", + "responseType": "SearchResponse", + "options": { + "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "body": "*" + } + } + ] + } + } + }, + "SearchRequest": { "fields": { - "name": { + "placement": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "REQUIRED" } }, - "id": { + "branch": { "type": "string", "id": 2, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, - "type": { - "type": "Type", - "id": 3, + "query": { + "type": "string", + "id": 3 + }, + "visitorId": { + "type": "string", + "id": 4, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "REQUIRED" } }, - "primaryProductId": { - "type": "string", - "id": 4 + "userInfo": { + "type": "UserInfo", + "id": 5 }, - "categories": { - "rule": "repeated", - "type": "string", + "pageSize": { + "type": "int32", "id": 7 }, - "title": { + "pageToken": { "type": "string", - "id": 8, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 8 }, - "description": { + "offset": { + "type": "int32", + "id": 9 + }, + "filter": { "type": "string", "id": 10 }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", - "id": 12 + "canonicalFilter": { + "type": "string", + "id": 28 }, - "tags": { - "rule": "repeated", + "orderBy": { "type": "string", - "id": 13 + "id": 11 }, - "priceInfo": { - "type": "PriceInfo", - "id": 14 + "facetSpecs": { + "rule": "repeated", + "type": "FacetSpec", + "id": 12 }, - "availableTime": { - "type": "google.protobuf.Timestamp", - "id": 18 + "dynamicFacetSpec": { + "type": "DynamicFacetSpec", + "id": 21 }, - "availability": { - "type": "Availability", - "id": 19 + "boostSpec": { + "type": "BoostSpec", + "id": 13 }, - "availableQuantity": { - "type": "google.protobuf.Int32Value", - "id": 20 + "queryExpansionSpec": { + "type": "QueryExpansionSpec", + "id": 14 }, - "uri": { + "variantRollupKeys": { + "rule": "repeated", "type": "string", - "id": 22 + "id": 17 }, - "images": { + "pageCategories": { "rule": "repeated", - "type": "Image", + "type": "string", "id": 23 } }, "nested": { - "Type": { - "values": { - "TYPE_UNSPECIFIED": 0, - "PRIMARY": 1, - "VARIANT": 2, - "COLLECTION": 3 + "FacetSpec": { + "fields": { + "facetKey": { + "type": "FacetKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "limit": { + "type": "int32", + "id": 2 + }, + "excludedFilterKeys": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "enableDynamicPosition": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "FacetKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "intervals": { + "rule": "repeated", + "type": "Interval", + "id": 2 + }, + "restrictedValues": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "prefixes": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "contains": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "orderBy": { + "type": "string", + "id": 4 + }, + "query": { + "type": "string", + "id": 5 + } + } + } } }, - "Availability": { - "values": { - "AVAILABILITY_UNSPECIFIED": 0, - "IN_STOCK": 1, - "OUT_OF_STOCK": 2, - "PREORDER": 3, - "BACKORDER": 4 + "DynamicFacetSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "DISABLED": 1, + "ENABLED": 2 + } + } } - } - } - }, - "UserEvent": { - "fields": { - "eventType": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "visitorId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "eventTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - }, - "experimentIds": { - "rule": "repeated", - "type": "string", - "id": 4 - }, - "attributionToken": { - "type": "string", - "id": 5 - }, - "productDetails": { - "rule": "repeated", - "type": "ProductDetail", - "id": 6 - }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", - "id": 7 - }, - "cartId": { - "type": "string", - "id": 8 - }, - "purchaseTransaction": { - "type": "PurchaseTransaction", - "id": 9 - }, - "searchQuery": { - "type": "string", - "id": 10 - }, - "pageCategories": { - "rule": "repeated", - "type": "string", - "id": 11 - }, - "userInfo": { - "type": "UserInfo", - "id": 12 - }, - "uri": { - "type": "string", - "id": 13 - }, - "referrerUri": { - "type": "string", - "id": 14 - }, - "pageViewId": { - "type": "string", - "id": 15 - } - } - }, - "ProductDetail": { - "fields": { - "product": { - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "quantity": { - "type": "google.protobuf.Int32Value", - "id": 2 - } - } - }, - "PurchaseTransaction": { - "fields": { - "id": { - "type": "string", - "id": 1 }, - "revenue": { - "type": "float", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" + "BoostSpec": { + "fields": { + "conditionBoostSpecs": { + "rule": "repeated", + "type": "ConditionBoostSpec", + "id": 1 + } + }, + "nested": { + "ConditionBoostSpec": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } } }, - "tax": { - "type": "float", - "id": 3 - }, - "cost": { - "type": "float", - "id": 4 - }, - "currencyCode": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "PredictionService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "Predict": { - "requestType": "PredictRequest", - "responseType": "PredictResponse", - "options": { - "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*" + "QueryExpansionSpec": { + "fields": { + "condition": { + "type": "Condition", + "id": 1 + } }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*" + "nested": { + "Condition": { + "values": { + "CONDITION_UNSPECIFIED": 0, + "DISABLED": 1, + "AUTO": 3 } } - ] + } } } }, - "PredictRequest": { + "SearchResponse": { "fields": { - "placement": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "results": { + "rule": "repeated", + "type": "SearchResult", + "id": 1 }, - "userEvent": { - "type": "UserEvent", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "facets": { + "rule": "repeated", + "type": "Facet", + "id": 2 }, - "pageSize": { + "totalSize": { "type": "int32", "id": 3 }, - "pageToken": { + "correctedQuery": { "type": "string", "id": 4 }, - "filter": { + "attributionToken": { "type": "string", "id": 5 }, - "validateOnly": { - "type": "bool", + "nextPageToken": { + "type": "string", "id": 6 }, - "params": { - "keyType": "string", - "type": "google.protobuf.Value", + "queryExpansionInfo": { + "type": "QueryExpansionInfo", "id": 7 }, - "labels": { - "keyType": "string", - "type": "string", - "id": 8 - } - } - }, - "PredictResponse": { - "fields": { - "results": { - "rule": "repeated", - "type": "PredictionResult", - "id": 1 - }, - "attributionToken": { - "type": "string", - "id": 2 - }, - "missingIds": { - "rule": "repeated", + "redirectUri": { "type": "string", - "id": 3 - }, - "validateOnly": { - "type": "bool", - "id": 4 + "id": 10 } }, "nested": { - "PredictionResult": { + "SearchResult": { "fields": { "id": { "type": "string", "id": 1 }, - "metadata": { + "product": { + "type": "Product", + "id": 2 + }, + "matchingVariantCount": { + "type": "int32", + "id": 3 + }, + "matchingVariantFields": { + "keyType": "string", + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "variantRollupValues": { "keyType": "string", "type": "google.protobuf.Value", + "id": 5 + } + } + }, + "Facet": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "values": { + "rule": "repeated", + "type": "FacetValue", "id": 2 + }, + "dynamicFacet": { + "type": "bool", + "id": 3 + } + }, + "nested": { + "FacetValue": { + "oneofs": { + "facetValue": { + "oneof": [ + "value", + "interval" + ] + } + }, + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "interval": { + "type": "Interval", + "id": 2 + }, + "count": { + "type": "int64", + "id": 3 + } + } + } + } + }, + "QueryExpansionInfo": { + "fields": { + "expandedQuery": { + "type": "bool", + "id": 1 } } } } }, - "ProductService": { + "UserEventService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", + "WriteUserEvent": { + "requestType": "WriteUserEventRequest", + "responseType": "UserEvent", "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "(google.api.http).body": "user_event" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "body": "product" + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "body": "user_event" } - }, - { - "(google.api.method_signature)": "parent,product,product_id" } ] }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", + "CollectUserEvent": { + "requestType": "CollectUserEventRequest", + "responseType": "google.api.HttpBody", "options": { - "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" + "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "get": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" } - }, - { - "(google.api.method_signature)": "name" } ] }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", + "PurgeUserEvents": { + "requestType": "PurgeUserEventsRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).patch": "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.PurgeUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.PurgeMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "patch": "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "body": "product" + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "body": "*" } }, { - "(google.api.method_signature)": "product,update_mask" + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.PurgeUserEventsResponse", + "metadata_type": "google.cloud.retail.v2.PurgeMetadata" + } } ] }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", - "responseType": "google.protobuf.Empty", + "ImportUserEvents": { + "requestType": "ImportUserEventsRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "body": "*" } }, { - "(google.api.method_signature)": "name" + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportUserEventsResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } } ] }, - "ImportProducts": { - "requestType": "ImportProductsRequest", + "RejoinUserEvents": { + "requestType": "RejoinUserEventsRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportProductsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", "body": "*" } }, { "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2alpha.ImportProductsResponse", - "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + "response_type": "RejoinUserEventsResponse", + "metadata_type": "RejoinUserEventsMetadata" } } ] } } }, - "CreateProductRequest": { + "WriteUserEventRequest": { "fields": { "parent": { "type": "string", "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" - } - }, - "product": { - "type": "Product", - "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "productId": { - "type": "string", - "id": 3, + "userEvent": { + "type": "UserEvent", + "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } } } }, - "GetProductRequest": { + "CollectUserEventRequest": { "fields": { - "name": { + "parent": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" } + }, + "uri": { + "type": "string", + "id": 3 + }, + "ets": { + "type": "int64", + "id": 4 } } }, - "UpdateProductRequest": { + "RejoinUserEventsRequest": { "fields": { - "product": { - "type": "Product", + "parent": { + "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "updateMask": { - "type": "google.protobuf.FieldMask", + "userEventRejoinScope": { + "type": "UserEventRejoinScope", "id": 2 } + }, + "nested": { + "UserEventRejoinScope": { + "values": { + "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, + "JOINED_EVENTS": 1, + "UNJOINED_EVENTS": 2 + } + } } }, - "DeleteProductRequest": { + "RejoinUserEventsResponse": { "fields": { - "name": { + "rejoinedUserEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "RejoinUserEventsMetadata": { + "fields": {} + } + } + }, + "v2alpha": { + "options": { + "csharp_namespace": "Google.Cloud.Retail.V2Alpha", + "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail", + "java_multiple_files": true, + "java_outer_classname": "UserEventServiceProto", + "java_package": "com.google.cloud.retail.v2alpha", + "objc_class_prefix": "RETAIL", + "php_namespace": "Google\\Cloud\\Retail\\V2alpha", + "ruby_package": "Google::Cloud::Retail::V2alpha", + "(google.api.resource_definition).type": "retail.googleapis.com/Branch", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" + }, + "nested": { + "ProductLevelConfig": { + "fields": { + "ingestionProductType": { + "type": "string", + "id": 1 + }, + "merchantCenterProductIdField": { "type": "string", + "id": 2 + } + } + }, + "MerchantCenterLink": { + "fields": { + "merchantCenterAccountId": { + "type": "int64", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.field_behavior)": "REQUIRED" } + }, + "branchId": { + "type": "string", + "id": 2 + }, + "destinations": { + "rule": "repeated", + "type": "string", + "id": 3 } } }, - "PurgeMetadata": { - "fields": {} + "MerchantCenterLinkingConfig": { + "fields": { + "links": { + "rule": "repeated", + "type": "MerchantCenterLink", + "id": 1 + } + } }, - "PurgeUserEventsRequest": { + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" + }, "fields": { - "parent": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "filter": { + "displayName": { "type": "string", "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "productLevelConfig": { + "type": "ProductLevelConfig", + "id": 4, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "force": { - "type": "bool", - "id": 3 + "merchantCenterLinkingConfig": { + "type": "MerchantCenterLinkingConfig", + "id": 6 } } }, - "PurgeUserEventsResponse": { + "Audience": { "fields": { - "purgedEventsCount": { - "type": "int64", + "genders": { + "rule": "repeated", + "type": "string", "id": 1 + }, + "ageGroups": { + "rule": "repeated", + "type": "string", + "id": 2 } } }, - "UserEventService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "WriteUserEvent": { - "requestType": "WriteUserEventRequest", - "responseType": "UserEvent", - "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", - "(google.api.http).body": "user_event" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", - "body": "user_event" - } - } - ] + "ColorInfo": { + "fields": { + "colorFamilies": { + "rule": "repeated", + "type": "string", + "id": 1 }, - "CollectUserEvent": { - "requestType": "CollectUserEventRequest", - "responseType": "google.api.HttpBody", - "options": { - "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - } - } + "colors": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "CustomAttribute": { + "oneofs": { + "_searchable": { + "oneof": [ + "searchable" ] }, - "PurgeUserEvents": { - "requestType": "PurgeUserEventsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.PurgeUserEventsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.PurgeMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2alpha.PurgeUserEventsResponse", - "metadata_type": "google.cloud.retail.v2alpha.PurgeMetadata" - } - } + "_indexable": { + "oneof": [ + "indexable" ] + } + }, + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 }, - "ImportUserEvents": { - "requestType": "ImportUserEventsRequest", - "responseType": "google.longrunning.Operation", + "numbers": { + "rule": "repeated", + "type": "double", + "id": 2 + }, + "searchable": { + "type": "bool", + "id": 3, "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportUserEventsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2alpha.ImportUserEventsResponse", - "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" - } - } + "proto3_optional": true + } + }, + "indexable": { + "type": "bool", + "id": 4, + "options": { + "proto3_optional": true + } + } + } + }, + "FulfillmentInfo": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "Image": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "height": { + "type": "int32", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + } + } + }, + "Interval": { + "oneofs": { + "min": { + "oneof": [ + "minimum", + "exclusiveMinimum" ] }, - "RejoinUserEvents": { - "requestType": "RejoinUserEventsRequest", - "responseType": "google.longrunning.Operation", + "max": { + "oneof": [ + "maximum", + "exclusiveMaximum" + ] + } + }, + "fields": { + "minimum": { + "type": "double", + "id": 1 + }, + "exclusiveMinimum": { + "type": "double", + "id": 2 + }, + "maximum": { + "type": "double", + "id": 3 + }, + "exclusiveMaximum": { + "type": "double", + "id": 4 + } + } + }, + "PriceInfo": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "price": { + "type": "float", + "id": 2 + }, + "originalPrice": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "priceEffectiveTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "priceExpireTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "priceRange": { + "type": "PriceRange", + "id": 7, "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", - "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", - "body": "*" - } + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "PriceRange": { + "fields": { + "price": { + "type": "Interval", + "id": 1 }, - { - "(google.longrunning.operation_info)": { - "response_type": "RejoinUserEventsResponse", - "metadata_type": "RejoinUserEventsMetadata" - } + "originalPrice": { + "type": "Interval", + "id": 2 } - ] + } } } }, - "WriteUserEventRequest": { + "Rating": { "fields": { - "parent": { + "ratingCount": { + "type": "int32", + "id": 1 + }, + "averageRating": { + "type": "float", + "id": 2 + }, + "ratingHistogram": { + "rule": "repeated", + "type": "int32", + "id": 3 + } + } + }, + "UserInfo": { + "fields": { + "userId": { + "type": "string", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "userAgent": { + "type": "string", + "id": 3 + }, + "directUserRequest": { + "type": "bool", + "id": 4 + } + } + }, + "Promotion": { + "fields": { + "promotionId": { + "type": "string", + "id": 1 + } + } + }, + "GcsSource": { + "fields": { + "inputUris": { + "rule": "repeated", "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "userEvent": { - "type": "UserEvent", + "dataSchema": { + "type": "string", + "id": 2 + } + } + }, + "BigQuerySource": { + "oneofs": { + "partition": { + "oneof": [ + "partitionDate" + ] + } + }, + "fields": { + "partitionDate": { + "type": "google.type.Date", + "id": 6 + }, + "projectId": { + "type": "string", + "id": 5 + }, + "datasetId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tableId": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "gcsStagingDir": { + "type": "string", + "id": 3 + }, + "dataSchema": { + "type": "string", + "id": 4 + } + } + }, + "ProductInlineSource": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UserEventInlineSource": { + "fields": { + "userEvents": { + "rule": "repeated", + "type": "UserEvent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ImportProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "requestId": { + "type": "string", + "id": 6 + }, + "inputConfig": { + "type": "ProductInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "reconciliationMode": { + "type": "ReconciliationMode", + "id": 5 + }, + "notificationPubsubTopic": { + "type": "string", + "id": 7 + } + }, + "nested": { + "ReconciliationMode": { + "values": { + "RECONCILIATION_MODE_UNSPECIFIED": 0, + "INCREMENTAL": 1, + "FULL": 2 + } + } + } + }, + "ImportUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "inputConfig": { + "type": "UserEventInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + } + } + }, + "ImportCompletionDataRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "inputConfig": { + "type": "CompletionDataInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "notificationPubsubTopic": { + "type": "string", + "id": 3 + } + } + }, + "ProductInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "productInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "productInlineSource": { + "type": "ProductInlineSource", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3 + } + } + }, + "UserEventInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "userEventInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "userEventInlineSource": { + "type": "UserEventInlineSource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CompletionDataInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "bigQuerySource" + ] + } + }, + "fields": { + "bigQuerySource": { + "type": "BigQuerySource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "successCount": { + "type": "int64", + "id": 3 + }, + "failureCount": { + "type": "int64", + "id": 4 + }, + "requestId": { + "type": "string", + "id": 5 + }, + "notificationPubsubTopic": { + "type": "string", + "id": 6 + } + } + }, + "ImportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + } + } + }, + "ImportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 2 + }, + "importSummary": { + "type": "UserEventImportSummary", + "id": 3 + } + } + }, + "UserEventImportSummary": { + "fields": { + "joinedEventsCount": { + "type": "int64", + "id": 1 + }, + "unjoinedEventsCount": { + "type": "int64", + "id": 2 + } + } + }, + "ImportCompletionDataResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + } + } + }, + "Product": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Product", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + }, + "oneofs": { + "expiration": { + "oneof": [ + "expireTime", + "ttl" + ] + } + }, + "fields": { + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 16 + }, + "ttl": { + "type": "google.protobuf.Duration", + "id": 17, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + }, + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "id": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "type": { + "type": "Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "primaryProductId": { + "type": "string", + "id": 4 + }, + "collectionMemberIds": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "gtin": { + "type": "string", + "id": 6 + }, + "categories": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "title": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "brands": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "description": { + "type": "string", + "id": 10 + }, + "languageCode": { + "type": "string", + "id": 11 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 12 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 14 + }, + "rating": { + "type": "Rating", + "id": 15 + }, + "availableTime": { + "type": "google.protobuf.Timestamp", + "id": 18 + }, + "availability": { + "type": "Availability", + "id": 19 + }, + "availableQuantity": { + "type": "google.protobuf.Int32Value", + "id": 20 + }, + "fulfillmentInfo": { + "rule": "repeated", + "type": "FulfillmentInfo", + "id": 21 + }, + "uri": { + "type": "string", + "id": 22 + }, + "images": { + "rule": "repeated", + "type": "Image", + "id": 23 + }, + "audience": { + "type": "Audience", + "id": 24 + }, + "colorInfo": { + "type": "ColorInfo", + "id": 25 + }, + "sizes": { + "rule": "repeated", + "type": "string", + "id": 26 + }, + "materials": { + "rule": "repeated", + "type": "string", + "id": 27 + }, + "patterns": { + "rule": "repeated", + "type": "string", + "id": 28 + }, + "conditions": { + "rule": "repeated", + "type": "string", + "id": 29 + }, + "promotions": { + "rule": "repeated", + "type": "Promotion", + "id": 34 + }, + "publishTime": { + "type": "google.protobuf.Timestamp", + "id": 33 + }, + "retrievableFields": { + "type": "google.protobuf.FieldMask", + "id": 30 + }, + "variants": { + "rule": "repeated", + "type": "Product", + "id": 31, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "VARIANT": 2, + "COLLECTION": 3 + } + }, + "Availability": { + "values": { + "AVAILABILITY_UNSPECIFIED": 0, + "IN_STOCK": 1, + "OUT_OF_STOCK": 2, + "PREORDER": 3, + "BACKORDER": 4 + } + } + } + }, + "UserEvent": { + "fields": { + "eventType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "visitorId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sessionId": { + "type": "string", + "id": 21 + }, + "eventTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "experimentIds": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "productDetails": { + "rule": "repeated", + "type": "ProductDetail", + "id": 6 + }, + "completionDetail": { + "type": "CompletionDetail", + "id": 22 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 7 + }, + "cartId": { + "type": "string", + "id": 8 + }, + "purchaseTransaction": { + "type": "PurchaseTransaction", + "id": 9 + }, + "searchQuery": { + "type": "string", + "id": 10 + }, + "filter": { + "type": "string", + "id": 16 + }, + "orderBy": { + "type": "string", + "id": 17 + }, + "offset": { + "type": "int32", + "id": 18 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 11 + }, + "userInfo": { + "type": "UserInfo", + "id": 12 + }, + "uri": { + "type": "string", + "id": 13 + }, + "referrerUri": { + "type": "string", + "id": 14 + }, + "pageViewId": { + "type": "string", + "id": 15 + } + } + }, + "ProductDetail": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "quantity": { + "type": "google.protobuf.Int32Value", + "id": 2 + } + } + }, + "CompletionDetail": { + "fields": { + "completionAttributionToken": { + "type": "string", + "id": 1 + }, + "selectedSuggestion": { + "type": "string", + "id": 2 + }, + "selectedPosition": { + "type": "int32", + "id": 3 + } + } + }, + "PurchaseTransaction": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "revenue": { + "type": "float", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "tax": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "currencyCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CatalogService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*}/catalogs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", + "options": { + "(google.api.http).patch": "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] + }, + "SetDefaultBranch": { + "requestType": "SetDefaultBranchRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "(google.api.http).body": "*", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "body": "*" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] + }, + "GetDefaultBranch": { + "requestType": "GetDefaultBranchRequest", + "responseType": "GetDefaultBranchResponse", + "options": { + "(google.api.http).get": "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCatalogsResponse": { + "fields": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateCatalogRequest": { + "fields": { + "catalog": { + "type": "Catalog", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "SetDefaultBranchRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "branchId": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "note": { + "type": "string", + "id": 3 + } + } + }, + "GetDefaultBranchRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + } + } + }, + "GetDefaultBranchResponse": { + "fields": { + "branch": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "note": { + "type": "string", + "id": 3 + } + } + }, + "CompletionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CompleteQuery": { + "requestType": "CompleteQueryRequest", + "responseType": "CompleteQueryResponse", + "options": { + "(google.api.http).get": "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + } + } + ] + }, + "ImportCompletionData": { + "requestType": "ImportCompletionDataRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportCompletionDataResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.ImportCompletionDataResponse", + "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + } + } + ] + } + } + }, + "CompleteQueryRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "query": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "visitorId": { + "type": "string", + "id": 7 + }, + "languageCodes": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "deviceType": { + "type": "string", + "id": 4 + }, + "dataset": { + "type": "string", + "id": 6 + }, + "maxSuggestions": { + "type": "int32", + "id": 5 + } + } + }, + "CompleteQueryResponse": { + "fields": { + "completionResults": { + "rule": "repeated", + "type": "CompletionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "recentSearchResults": { + "rule": "repeated", + "type": "RecentSearchResult", + "id": 3 + } + }, + "nested": { + "CompletionResult": { + "fields": { + "suggestion": { + "type": "string", + "id": 1 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 2 + } + } + }, + "RecentSearchResult": { + "fields": { + "recentSearch": { + "type": "string", + "id": 1 + } + } + } + } + }, + "ExportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ExportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "ExportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + } + } + }, + "ExportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + } + } + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*" + } + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" + } + ] + }, + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListProducts": { + "requestType": "ListProductsRequest", + "responseType": "ListProductsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" + } + }, + { + "(google.api.method_signature)": "product,update_mask" + } + ] + }, + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + } + } + ] + }, + "SetInventory": { + "requestType": "SetInventoryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "(google.api.http).body": "*", + "(google.api.method_signature)": "inventory,set_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.SetInventoryResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.SetInventoryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "body": "*" + } + }, + { + "(google.api.method_signature)": "inventory,set_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.SetInventoryResponse", + "metadata_type": "google.cloud.retail.v2alpha.SetInventoryMetadata" + } + } + ] + }, + "AddFulfillmentPlaces": { + "requestType": "AddFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata" + } + } + ] + }, + "RemoveFulfillmentPlaces": { + "requestType": "RemoveFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" + } + } + ] + } + } + }, + "CreateProductRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "UpdateProductRequest": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "DeleteProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "ListProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "readMask": { + "type": "google.protobuf.FieldMask", + "id": 5 + }, + "requireTotalSize": { + "type": "bool", + "id": 6 + } + } + }, + "ListProductsResponse": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "SetInventoryRequest": { + "fields": { + "inventory": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "setMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "allowMissing": { + "type": "bool", + "id": 4 + } + } + }, + "SetInventoryMetadata": { + "fields": {} + }, + "SetInventoryResponse": { + "fields": {} + }, + "AddFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "AddFulfillmentPlacesMetadata": { + "fields": {} + }, + "AddFulfillmentPlacesResponse": { + "fields": {} + }, + "RemoveFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "RemoveFulfillmentPlacesMetadata": { + "fields": {} + }, + "RemoveFulfillmentPlacesResponse": { + "fields": {} + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeUserEventsResponse": { + "fields": { + "purgedEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "SearchService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Search": { + "requestType": "SearchRequest", + "responseType": "SearchResponse", + "options": { + "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "body": "*" + } + } + ] + } + } + }, + "SearchRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "branch": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "query": { + "type": "string", + "id": 3 + }, + "visitorId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userInfo": { + "type": "UserInfo", + "id": 5 + }, + "pageSize": { + "type": "int32", + "id": 7 + }, + "pageToken": { + "type": "string", + "id": 8 + }, + "offset": { + "type": "int32", + "id": 9 + }, + "filter": { + "type": "string", + "id": 10 + }, + "canonicalFilter": { + "type": "string", + "id": 28 + }, + "orderBy": { + "type": "string", + "id": 11 + }, + "facetSpecs": { + "rule": "repeated", + "type": "FacetSpec", + "id": 12 + }, + "dynamicFacetSpec": { + "type": "DynamicFacetSpec", + "id": 21 + }, + "boostSpec": { + "type": "BoostSpec", + "id": 13 + }, + "queryExpansionSpec": { + "type": "QueryExpansionSpec", + "id": 14 + }, + "relevanceThreshold": { + "type": "RelevanceThreshold", + "id": 15 + }, + "variantRollupKeys": { + "rule": "repeated", + "type": "string", + "id": 17 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 23 + } + }, + "nested": { + "FacetSpec": { + "fields": { + "facetKey": { + "type": "FacetKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "limit": { + "type": "int32", + "id": 2 + }, + "excludedFilterKeys": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "enableDynamicPosition": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "FacetKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "intervals": { + "rule": "repeated", + "type": "Interval", + "id": 2 + }, + "restrictedValues": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "prefixes": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "contains": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "orderBy": { + "type": "string", + "id": 4 + }, + "query": { + "type": "string", + "id": 5 + } + } + } + } + }, + "DynamicFacetSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "DISABLED": 1, + "ENABLED": 2 + } + } + } + }, + "BoostSpec": { + "fields": { + "conditionBoostSpecs": { + "rule": "repeated", + "type": "ConditionBoostSpec", + "id": 1 + } + }, + "nested": { + "ConditionBoostSpec": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } + } + }, + "QueryExpansionSpec": { + "fields": { + "condition": { + "type": "Condition", + "id": 1 + } + }, + "nested": { + "Condition": { + "values": { + "CONDITION_UNSPECIFIED": 0, + "DISABLED": 1, + "AUTO": 3 + } + } + } + }, + "RelevanceThreshold": { + "values": { + "RELEVANCE_THRESHOLD_UNSPECIFIED": 0, + "HIGH": 1, + "MEDIUM": 2, + "LOW": 3, + "LOWEST": 4 + } + } + } + }, + "SearchResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "SearchResult", + "id": 1 + }, + "facets": { + "rule": "repeated", + "type": "Facet", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + }, + "correctedQuery": { + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "nextPageToken": { + "type": "string", + "id": 6 + }, + "queryExpansionInfo": { + "type": "QueryExpansionInfo", + "id": 7 + }, + "redirectUri": { + "type": "string", + "id": 10 + } + }, + "nested": { + "SearchResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "product": { + "type": "Product", + "id": 2 + }, + "matchingVariantCount": { + "type": "int32", + "id": 3 + }, + "matchingVariantFields": { + "keyType": "string", + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "variantRollupValues": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 5 + } + } + }, + "Facet": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "values": { + "rule": "repeated", + "type": "FacetValue", + "id": 2 + }, + "dynamicFacet": { + "type": "bool", + "id": 3 + } + }, + "nested": { + "FacetValue": { + "oneofs": { + "facetValue": { + "oneof": [ + "value", + "interval" + ] + } + }, + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "interval": { + "type": "Interval", + "id": 2 + }, + "count": { + "type": "int64", + "id": 3 + } + } + } + } + }, + "QueryExpansionInfo": { + "fields": { + "expandedQuery": { + "type": "bool", + "id": 1 + } + } + } + } + }, + "UserEventService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "WriteUserEvent": { + "requestType": "WriteUserEventRequest", + "responseType": "UserEvent", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "(google.api.http).body": "user_event" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write", + "body": "user_event" + } + } + ] + }, + "CollectUserEvent": { + "requestType": "CollectUserEventRequest", + "responseType": "google.api.HttpBody", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" + } + } + ] + }, + "PurgeUserEvents": { + "requestType": "PurgeUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.PurgeUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.PurgeMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.PurgeUserEventsResponse", + "metadata_type": "google.cloud.retail.v2alpha.PurgeMetadata" + } + } + ] + }, + "ImportUserEvents": { + "requestType": "ImportUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.ImportUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.ImportUserEventsResponse", + "metadata_type": "google.cloud.retail.v2alpha.ImportMetadata" + } + } + ] + }, + "RejoinUserEvents": { + "requestType": "RejoinUserEventsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "RejoinUserEventsResponse", + "(google.longrunning.operation_info).metadata_type": "RejoinUserEventsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "RejoinUserEventsResponse", + "metadata_type": "RejoinUserEventsMetadata" + } + } + ] + } + } + }, + "WriteUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CollectUserEventRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uri": { + "type": "string", + "id": 3 + }, + "ets": { + "type": "int64", + "id": 4 + } + } + }, + "RejoinUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEventRejoinScope": { + "type": "UserEventRejoinScope", + "id": 2 + } + }, + "nested": { + "UserEventRejoinScope": { + "values": { + "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, + "JOINED_EVENTS": 1, + "UNJOINED_EVENTS": 2 + } + } + } + }, + "RejoinUserEventsResponse": { + "fields": { + "rejoinedUserEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "RejoinUserEventsMetadata": { + "fields": {} + } + } + }, + "v2beta": { + "options": { + "csharp_namespace": "Google.Cloud.Retail.V2Beta", + "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail", + "java_multiple_files": true, + "java_outer_classname": "UserEventServiceProto", + "java_package": "com.google.cloud.retail.v2beta", + "objc_class_prefix": "RETAIL", + "php_namespace": "Google\\Cloud\\Retail\\V2beta", + "ruby_package": "Google::Cloud::Retail::V2beta", + "(google.api.resource_definition).type": "retail.googleapis.com/Branch", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" + }, + "nested": { + "ProductLevelConfig": { + "fields": { + "ingestionProductType": { + "type": "string", + "id": 1 + }, + "merchantCenterProductIdField": { + "type": "string", + "id": 2 + } + } + }, + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "productLevelConfig": { + "type": "ProductLevelConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "Audience": { + "fields": { + "genders": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "ageGroups": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "ColorInfo": { + "fields": { + "colorFamilies": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "colors": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "CustomAttribute": { + "oneofs": { + "_searchable": { + "oneof": [ + "searchable" + ] + }, + "_indexable": { + "oneof": [ + "indexable" + ] + } + }, + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "numbers": { + "rule": "repeated", + "type": "double", + "id": 2 + }, + "searchable": { + "type": "bool", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "indexable": { + "type": "bool", + "id": 4, + "options": { + "proto3_optional": true + } + } + } + }, + "FulfillmentInfo": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "Image": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "height": { + "type": "int32", + "id": 2 + }, + "width": { + "type": "int32", + "id": 3 + } + } + }, + "Interval": { + "oneofs": { + "min": { + "oneof": [ + "minimum", + "exclusiveMinimum" + ] + }, + "max": { + "oneof": [ + "maximum", + "exclusiveMaximum" + ] + } + }, + "fields": { + "minimum": { + "type": "double", + "id": 1 + }, + "exclusiveMinimum": { + "type": "double", + "id": 2 + }, + "maximum": { + "type": "double", + "id": 3 + }, + "exclusiveMaximum": { + "type": "double", + "id": 4 + } + } + }, + "PriceInfo": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "price": { + "type": "float", + "id": 2 + }, + "originalPrice": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "priceEffectiveTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "priceExpireTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "priceRange": { + "type": "PriceRange", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "PriceRange": { + "fields": { + "price": { + "type": "Interval", + "id": 1 + }, + "originalPrice": { + "type": "Interval", + "id": 2 + } + } + } + } + }, + "Rating": { + "fields": { + "ratingCount": { + "type": "int32", + "id": 1 + }, + "averageRating": { + "type": "float", + "id": 2 + }, + "ratingHistogram": { + "rule": "repeated", + "type": "int32", + "id": 3 + } + } + }, + "UserInfo": { + "fields": { + "userId": { + "type": "string", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "userAgent": { + "type": "string", + "id": 3 + }, + "directUserRequest": { + "type": "bool", + "id": 4 + } + } + }, + "Promotion": { + "fields": { + "promotionId": { + "type": "string", + "id": 1 + } + } + }, + "GcsSource": { + "fields": { + "inputUris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataSchema": { + "type": "string", + "id": 2 + } + } + }, + "BigQuerySource": { + "oneofs": { + "partition": { + "oneof": [ + "partitionDate" + ] } - } - }, - "CollectUserEventRequest": { + }, "fields": { - "parent": { + "partitionDate": { + "type": "google.type.Date", + "id": 6 + }, + "projectId": { + "type": "string", + "id": 5 + }, + "datasetId": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "userEvent": { + "tableId": { "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "uri": { + "gcsStagingDir": { "type": "string", "id": 3 }, - "ets": { - "type": "int64", + "dataSchema": { + "type": "string", "id": 4 } } }, - "RejoinUserEventsRequest": { + "ProductInlineSource": { "fields": { - "parent": { - "type": "string", + "products": { + "rule": "repeated", + "type": "Product", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } - }, - "userEventRejoinScope": { - "type": "UserEventRejoinScope", - "id": 2 - } - }, - "nested": { - "UserEventRejoinScope": { - "values": { - "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": 0, - "JOINED_EVENTS": 1, - "UNJOINED_EVENTS": 2 - } } } }, - "RejoinUserEventsResponse": { + "UserEventInlineSource": { "fields": { - "rejoinedUserEventsCount": { - "type": "int64", - "id": 1 + "userEvents": { + "rule": "repeated", + "type": "UserEvent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, - "RejoinUserEventsMetadata": { - "fields": {} - } - } - }, - "v2beta": { - "options": { - "csharp_namespace": "Google.Cloud.Retail.V2Beta", - "go_package": "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail", - "java_multiple_files": true, - "java_outer_classname": "UserEventServiceProto", - "java_package": "com.google.cloud.retail.v2beta", - "objc_class_prefix": "RETAIL", - "php_namespace": "Google\\Cloud\\Retail\\V2beta", - "ruby_package": "Google::Cloud::Retail::V2beta", - "(google.api.resource_definition).type": "retail.googleapis.com/Branch", - "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" - }, - "nested": { - "ProductLevelConfig": { + "ImportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, "fields": { - "ingestionProductType": { + "gcsPrefix": { "type": "string", "id": 1 - }, - "merchantCenterProductIdField": { - "type": "string", - "id": 2 } } }, - "Catalog": { - "options": { - "(google.api.resource).type": "retail.googleapis.com/Catalog", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" - }, + "ImportProductsRequest": { "fields": { - "name": { + "parent": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, - "displayName": { + "requestId": { "type": "string", + "id": 6 + }, + "inputConfig": { + "type": "ProductInputConfig", "id": 2, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "REQUIRED" } }, - "productLevelConfig": { - "type": "ProductLevelConfig", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "reconciliationMode": { + "type": "ReconciliationMode", + "id": 5 + }, + "notificationPubsubTopic": { + "type": "string", + "id": 7 + } + }, + "nested": { + "ReconciliationMode": { + "values": { + "RECONCILIATION_MODE_UNSPECIFIED": 0, + "INCREMENTAL": 1, + "FULL": 2 } } } }, - "CatalogService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "ListCatalogs": { - "requestType": "ListCatalogsRequest", - "responseType": "ListCatalogsResponse", + "ImportUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, "options": { - "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*}/catalogs", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2beta/{parent=projects/*/locations/*}/catalogs" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } }, - "UpdateCatalog": { - "requestType": "UpdateCatalogRequest", - "responseType": "Catalog", + "inputConfig": { + "type": "UserEventInputConfig", + "id": 2, "options": { - "(google.api.http).patch": "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}", - "(google.api.http).body": "catalog", - "(google.api.method_signature)": "catalog,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}", - "body": "catalog" - } - }, - { - "(google.api.method_signature)": "catalog,update_mask" - } - ] + "(google.api.field_behavior)": "REQUIRED" + } + }, + "errorsConfig": { + "type": "ImportErrorsConfig", + "id": 3 } } }, - "ListCatalogsRequest": { + "ImportCompletionDataRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "pageSize": { - "type": "int32", - "id": 2 + "inputConfig": { + "type": "CompletionDataInputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "pageToken": { + "notificationPubsubTopic": { "type": "string", "id": 3 } } }, - "ListCatalogsResponse": { + "ProductInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "productInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, "fields": { - "catalogs": { - "rule": "repeated", - "type": "Catalog", + "productInlineSource": { + "type": "ProductInlineSource", "id": 1 }, - "nextPageToken": { - "type": "string", + "gcsSource": { + "type": "GcsSource", "id": 2 + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3 } } }, - "UpdateCatalogRequest": { + "UserEventInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "userEventInlineSource", + "gcsSource", + "bigQuerySource" + ] + } + }, + "fields": { + "userEventInlineSource": { + "type": "UserEventInlineSource", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "bigQuerySource": { + "type": "BigQuerySource", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CompletionDataInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "bigQuerySource" + ] + } + }, "fields": { - "catalog": { - "type": "Catalog", + "bigQuerySource": { + "type": "BigQuerySource", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 } } }, - "CustomAttribute": { + "ImportMetadata": { "fields": { - "text": { - "rule": "repeated", - "type": "string", + "createTime": { + "type": "google.protobuf.Timestamp", "id": 1 }, - "numbers": { - "rule": "repeated", - "type": "double", + "updateTime": { + "type": "google.protobuf.Timestamp", "id": 2 + }, + "successCount": { + "type": "int64", + "id": 3 + }, + "failureCount": { + "type": "int64", + "id": 4 + }, + "requestId": { + "type": "string", + "id": 5 + }, + "notificationPubsubTopic": { + "type": "string", + "id": 6 } } }, - "Image": { + "ImportProductsResponse": { "fields": { - "uri": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 }, - "height": { - "type": "int32", + "errorsConfig": { + "type": "ImportErrorsConfig", "id": 2 - }, - "width": { - "type": "int32", - "id": 3 } } }, - "PriceInfo": { + "ImportUserEventsResponse": { "fields": { - "currencyCode": { - "type": "string", + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", "id": 1 }, - "price": { - "type": "float", + "errorsConfig": { + "type": "ImportErrorsConfig", "id": 2 }, - "originalPrice": { - "type": "float", + "importSummary": { + "type": "UserEventImportSummary", "id": 3 - }, - "cost": { - "type": "float", - "id": 4 } } }, - "UserInfo": { + "UserEventImportSummary": { "fields": { - "userId": { - "type": "string", + "joinedEventsCount": { + "type": "int64", "id": 1 }, - "ipAddress": { - "type": "string", + "unjoinedEventsCount": { + "type": "int64", "id": 2 - }, - "userAgent": { - "type": "string", - "id": 3 - }, - "directUserRequest": { - "type": "bool", - "id": 4 } } }, - "GcsSource": { + "ImportCompletionDataResponse": { "fields": { - "inputUris": { + "errorSamples": { "rule": "repeated", - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "dataSchema": { - "type": "string", - "id": 2 + "type": "google.rpc.Status", + "id": 1 } } }, - "BigQuerySource": { + "Product": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Product", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" + }, + "oneofs": { + "expiration": { + "oneof": [ + "expireTime", + "ttl" + ] + } + }, "fields": { - "projectId": { - "type": "string", - "id": 5 + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 16 }, - "datasetId": { + "ttl": { + "type": "google.protobuf.Duration", + "id": 17, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + }, + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "tableId": { + "id": { "type": "string", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "gcsStagingDir": { - "type": "string", - "id": 3 + "type": { + "type": "Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } }, - "dataSchema": { + "primaryProductId": { "type": "string", "id": 4 - } - } - }, - "ProductInlineSource": { - "fields": { - "products": { + }, + "collectionMemberIds": { "rule": "repeated", - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "UserEventInlineSource": { - "fields": { - "userEvents": { + "type": "string", + "id": 5 + }, + "gtin": { + "type": "string", + "id": 6 + }, + "categories": { "rule": "repeated", - "type": "UserEvent", - "id": 1, + "type": "string", + "id": 7 + }, + "title": { + "type": "string", + "id": 8, "options": { "(google.api.field_behavior)": "REQUIRED" } - } - } - }, - "ImportErrorsConfig": { - "oneofs": { - "destination": { - "oneof": [ - "gcsPrefix" - ] + }, + "brands": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "description": { + "type": "string", + "id": 10 + }, + "languageCode": { + "type": "string", + "id": 11 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 12 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 14 + }, + "rating": { + "type": "Rating", + "id": 15 + }, + "availableTime": { + "type": "google.protobuf.Timestamp", + "id": 18 + }, + "availability": { + "type": "Availability", + "id": 19 + }, + "availableQuantity": { + "type": "google.protobuf.Int32Value", + "id": 20 + }, + "fulfillmentInfo": { + "rule": "repeated", + "type": "FulfillmentInfo", + "id": 21 + }, + "uri": { + "type": "string", + "id": 22 + }, + "images": { + "rule": "repeated", + "type": "Image", + "id": 23 + }, + "audience": { + "type": "Audience", + "id": 24 + }, + "colorInfo": { + "type": "ColorInfo", + "id": 25 + }, + "sizes": { + "rule": "repeated", + "type": "string", + "id": 26 + }, + "materials": { + "rule": "repeated", + "type": "string", + "id": 27 + }, + "patterns": { + "rule": "repeated", + "type": "string", + "id": 28 + }, + "conditions": { + "rule": "repeated", + "type": "string", + "id": 29 + }, + "promotions": { + "rule": "repeated", + "type": "Promotion", + "id": 34 + }, + "publishTime": { + "type": "google.protobuf.Timestamp", + "id": 33 + }, + "retrievableFields": { + "type": "google.protobuf.FieldMask", + "id": 30 + }, + "variants": { + "rule": "repeated", + "type": "Product", + "id": 31, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, - "fields": { - "gcsPrefix": { - "type": "string", - "id": 1 + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "VARIANT": 2, + "COLLECTION": 3 + } + }, + "Availability": { + "values": { + "AVAILABILITY_UNSPECIFIED": 0, + "IN_STOCK": 1, + "OUT_OF_STOCK": 2, + "PREORDER": 3, + "BACKORDER": 4 + } } } }, - "ImportProductsRequest": { + "UserEvent": { "fields": { - "parent": { + "eventType": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "inputConfig": { - "type": "ProductInputConfig", + "visitorId": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "errorsConfig": { - "type": "ImportErrorsConfig", + "sessionId": { + "type": "string", + "id": 21 + }, + "eventTime": { + "type": "google.protobuf.Timestamp", "id": 3 }, - "updateMask": { - "type": "google.protobuf.FieldMask", + "experimentIds": { + "rule": "repeated", + "type": "string", "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "productDetails": { + "rule": "repeated", + "type": "ProductDetail", + "id": 6 + }, + "completionDetail": { + "type": "CompletionDetail", + "id": 22 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 7 + }, + "cartId": { + "type": "string", + "id": 8 + }, + "purchaseTransaction": { + "type": "PurchaseTransaction", + "id": 9 + }, + "searchQuery": { + "type": "string", + "id": 10 + }, + "filter": { + "type": "string", + "id": 16 + }, + "orderBy": { + "type": "string", + "id": 17 + }, + "offset": { + "type": "int32", + "id": 18 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 11 + }, + "userInfo": { + "type": "UserInfo", + "id": 12 + }, + "uri": { + "type": "string", + "id": 13 + }, + "referrerUri": { + "type": "string", + "id": 14 + }, + "pageViewId": { + "type": "string", + "id": 15 } } }, - "ImportUserEventsRequest": { + "ProductDetail": { "fields": { - "parent": { - "type": "string", + "product": { + "type": "Product", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "inputConfig": { - "type": "UserEventInputConfig", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "errorsConfig": { - "type": "ImportErrorsConfig", - "id": 3 + "quantity": { + "type": "google.protobuf.Int32Value", + "id": 2 } } }, - "ProductInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "productInlineSource", - "gcsSource", - "bigQuerySource" - ] - } - }, + "CompletionDetail": { "fields": { - "productInlineSource": { - "type": "ProductInlineSource", + "completionAttributionToken": { + "type": "string", "id": 1 }, - "gcsSource": { - "type": "GcsSource", + "selectedSuggestion": { + "type": "string", "id": 2 }, - "bigQuerySource": { - "type": "BigQuerySource", + "selectedPosition": { + "type": "int32", "id": 3 } } }, - "UserEventInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "userEventInlineSource", - "gcsSource", - "bigQuerySource" - ] - } - }, + "PurchaseTransaction": { "fields": { - "userEventInlineSource": { - "type": "UserEventInlineSource", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": { + "type": "string", + "id": 1 }, - "gcsSource": { - "type": "GcsSource", + "revenue": { + "type": "float", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "bigQuerySource": { - "type": "BigQuerySource", - "id": 3, + "tax": { + "type": "float", + "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "currencyCode": { + "type": "string", + "id": 5, "options": { "(google.api.field_behavior)": "REQUIRED" } } } }, - "ImportMetadata": { - "fields": { - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 1 + "CatalogService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*}/catalogs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 2 + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", + "options": { + "(google.api.http).patch": "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] }, - "successCount": { - "type": "int64", - "id": 3 + "SetDefaultBranch": { + "requestType": "SetDefaultBranchRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "(google.api.http).body": "*", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "body": "*" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] }, - "failureCount": { - "type": "int64", - "id": 4 + "GetDefaultBranch": { + "requestType": "GetDefaultBranchRequest", + "responseType": "GetDefaultBranchResponse", + "options": { + "(google.api.http).get": "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] } } }, - "ImportProductsResponse": { + "ListCatalogsRequest": { "fields": { - "errorSamples": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } }, - "errorsConfig": { - "type": "ImportErrorsConfig", + "pageSize": { + "type": "int32", "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 } } }, - "ImportUserEventsResponse": { + "ListCatalogsResponse": { "fields": { - "errorSamples": { + "catalogs": { "rule": "repeated", - "type": "google.rpc.Status", + "type": "Catalog", "id": 1 }, - "errorsConfig": { - "type": "ImportErrorsConfig", + "nextPageToken": { + "type": "string", "id": 2 - }, - "importSummary": { - "type": "UserEventImportSummary", - "id": 3 } } }, - "UserEventImportSummary": { + "UpdateCatalogRequest": { "fields": { - "joinedEventsCount": { - "type": "int64", - "id": 1 + "catalog": { + "type": "Catalog", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "unjoinedEventsCount": { - "type": "int64", + "updateMask": { + "type": "google.protobuf.FieldMask", "id": 2 } } }, - "Product": { - "options": { - "(google.api.resource).type": "retail.googleapis.com/Product", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" - }, + "SetDefaultBranchRequest": { "fields": { - "name": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "id": { + "branchId": { "type": "string", "id": 2, "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } - }, - "type": { - "type": "Type", - "id": 3, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, - "primaryProductId": { - "type": "string", - "id": 4 - }, - "categories": { - "rule": "repeated", + "note": { "type": "string", - "id": 7 - }, - "title": { + "id": 3 + } + } + }, + "GetDefaultBranchRequest": { + "fields": { + "catalog": { "type": "string", - "id": 8, + "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } - }, - "description": { - "type": "string", - "id": 10 - }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", - "id": 12 - }, - "tags": { - "rule": "repeated", + } + } + }, + "GetDefaultBranchResponse": { + "fields": { + "branch": { "type": "string", - "id": 13 - }, - "priceInfo": { - "type": "PriceInfo", - "id": 14 + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } }, - "availableTime": { + "setTime": { "type": "google.protobuf.Timestamp", - "id": 18 - }, - "availability": { - "type": "Availability", - "id": 19 - }, - "availableQuantity": { - "type": "google.protobuf.Int32Value", - "id": 20 + "id": 2 }, - "uri": { + "note": { "type": "string", - "id": 22 - }, - "images": { - "rule": "repeated", - "type": "Image", - "id": 23 + "id": 3 } + } + }, + "CompletionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, - "nested": { - "Type": { - "values": { - "TYPE_UNSPECIFIED": 0, - "PRIMARY": 1, - "VARIANT": 2, - "COLLECTION": 3 - } + "methods": { + "CompleteQuery": { + "requestType": "CompleteQueryRequest", + "responseType": "CompleteQueryResponse", + "options": { + "(google.api.http).get": "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + } + } + ] }, - "Availability": { - "values": { - "AVAILABILITY_UNSPECIFIED": 0, - "IN_STOCK": 1, - "OUT_OF_STOCK": 2, - "PREORDER": 3, - "BACKORDER": 4 - } + "ImportCompletionData": { + "requestType": "ImportCompletionDataRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.ImportCompletionDataResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.ImportCompletionDataResponse", + "metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + } + } + ] } } }, - "UserEvent": { + "CompleteQueryRequest": { "fields": { - "eventType": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "visitorId": { + "query": { "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "eventTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - }, - "experimentIds": { - "rule": "repeated", - "type": "string", - "id": 4 - }, - "attributionToken": { + "visitorId": { "type": "string", - "id": 5 - }, - "productDetails": { - "rule": "repeated", - "type": "ProductDetail", - "id": 6 - }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", "id": 7 }, - "cartId": { + "languageCodes": { + "rule": "repeated", "type": "string", - "id": 8 - }, - "purchaseTransaction": { - "type": "PurchaseTransaction", - "id": 9 + "id": 3 }, - "searchQuery": { + "deviceType": { "type": "string", - "id": 10 + "id": 4 }, - "pageCategories": { - "rule": "repeated", + "dataset": { "type": "string", - "id": 11 + "id": 6 }, - "userInfo": { - "type": "UserInfo", - "id": 12 + "maxSuggestions": { + "type": "int32", + "id": 5 + } + } + }, + "CompleteQueryResponse": { + "fields": { + "completionResults": { + "rule": "repeated", + "type": "CompletionResult", + "id": 1 }, - "uri": { + "attributionToken": { "type": "string", - "id": 13 + "id": 2 }, - "referrerUri": { - "type": "string", - "id": 14 + "recentSearchResults": { + "rule": "repeated", + "type": "RecentSearchResult", + "id": 3 + } + }, + "nested": { + "CompletionResult": { + "fields": { + "suggestion": { + "type": "string", + "id": 1 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 2 + } + } }, - "pageViewId": { + "RecentSearchResult": { + "fields": { + "recentSearch": { + "type": "string", + "id": 1 + } + } + } + } + }, + "ExportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { "type": "string", - "id": 15 + "id": 1 } } }, - "ProductDetail": { + "ExportMetadata": { "fields": { - "product": { - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 }, - "quantity": { - "type": "google.protobuf.Int32Value", + "updateTime": { + "type": "google.protobuf.Timestamp", "id": 2 } } }, - "PurchaseTransaction": { + "ExportProductsResponse": { "fields": { - "id": { - "type": "string", + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", "id": 1 }, - "revenue": { - "type": "float", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "tax": { - "type": "float", - "id": 3 - }, - "cost": { - "type": "float", - "id": 4 + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + } + } + }, + "ExportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 }, - "currencyCode": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 } } }, @@ -3253,6 +6412,24 @@ } ] }, + "ListProducts": { + "requestType": "ListProductsRequest", + "responseType": "ListProductsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, "UpdateProduct": { "requestType": "UpdateProductRequest", "responseType": "Product", @@ -3314,6 +6491,90 @@ } } ] + }, + "SetInventory": { + "requestType": "SetInventoryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "(google.api.http).body": "*", + "(google.api.method_signature)": "inventory,set_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.SetInventoryResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.SetInventoryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "body": "*" + } + }, + { + "(google.api.method_signature)": "inventory,set_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.SetInventoryResponse", + "metadata_type": "google.cloud.retail.v2beta.SetInventoryMetadata" + } + } + ] + }, + "AddFulfillmentPlaces": { + "requestType": "AddFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" + } + } + ] + }, + "RemoveFulfillmentPlaces": { + "requestType": "RemoveFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" + } + } + ] } } }, @@ -3367,6 +6628,10 @@ "updateMask": { "type": "google.protobuf.FieldMask", "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 } } }, @@ -3382,6 +6647,158 @@ } } }, + "ListProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "readMask": { + "type": "google.protobuf.FieldMask", + "id": 5 + } + } + }, + "ListProductsResponse": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "SetInventoryRequest": { + "fields": { + "inventory": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "setMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "allowMissing": { + "type": "bool", + "id": 4 + } + } + }, + "SetInventoryMetadata": { + "fields": {} + }, + "SetInventoryResponse": { + "fields": {} + }, + "AddFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "AddFulfillmentPlacesMetadata": { + "fields": {} + }, + "AddFulfillmentPlacesResponse": { + "fields": {} + }, + "RemoveFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "RemoveFulfillmentPlacesMetadata": { + "fields": {} + }, + "RemoveFulfillmentPlacesResponse": { + "fields": {} + }, "PurgeMetadata": { "fields": {} }, @@ -3415,6 +6832,355 @@ } } }, + "SearchService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Search": { + "requestType": "SearchRequest", + "responseType": "SearchResponse", + "options": { + "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "body": "*" + } + } + ] + } + } + }, + "SearchRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "branch": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "query": { + "type": "string", + "id": 3 + }, + "visitorId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userInfo": { + "type": "UserInfo", + "id": 5 + }, + "pageSize": { + "type": "int32", + "id": 7 + }, + "pageToken": { + "type": "string", + "id": 8 + }, + "offset": { + "type": "int32", + "id": 9 + }, + "filter": { + "type": "string", + "id": 10 + }, + "canonicalFilter": { + "type": "string", + "id": 28 + }, + "orderBy": { + "type": "string", + "id": 11 + }, + "facetSpecs": { + "rule": "repeated", + "type": "FacetSpec", + "id": 12 + }, + "dynamicFacetSpec": { + "type": "DynamicFacetSpec", + "id": 21 + }, + "boostSpec": { + "type": "BoostSpec", + "id": 13 + }, + "queryExpansionSpec": { + "type": "QueryExpansionSpec", + "id": 14 + }, + "variantRollupKeys": { + "rule": "repeated", + "type": "string", + "id": 17 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 23 + } + }, + "nested": { + "FacetSpec": { + "fields": { + "facetKey": { + "type": "FacetKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "limit": { + "type": "int32", + "id": 2 + }, + "excludedFilterKeys": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "enableDynamicPosition": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "FacetKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "intervals": { + "rule": "repeated", + "type": "Interval", + "id": 2 + }, + "restrictedValues": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "prefixes": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "contains": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "orderBy": { + "type": "string", + "id": 4 + }, + "query": { + "type": "string", + "id": 5 + } + } + } + } + }, + "DynamicFacetSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "DISABLED": 1, + "ENABLED": 2 + } + } + } + }, + "BoostSpec": { + "fields": { + "conditionBoostSpecs": { + "rule": "repeated", + "type": "ConditionBoostSpec", + "id": 1 + } + }, + "nested": { + "ConditionBoostSpec": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } + } + }, + "QueryExpansionSpec": { + "fields": { + "condition": { + "type": "Condition", + "id": 1 + } + }, + "nested": { + "Condition": { + "values": { + "CONDITION_UNSPECIFIED": 0, + "DISABLED": 1, + "AUTO": 3 + } + } + } + } + } + }, + "SearchResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "SearchResult", + "id": 1 + }, + "facets": { + "rule": "repeated", + "type": "Facet", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + }, + "correctedQuery": { + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "nextPageToken": { + "type": "string", + "id": 6 + }, + "queryExpansionInfo": { + "type": "QueryExpansionInfo", + "id": 7 + }, + "redirectUri": { + "type": "string", + "id": 10 + } + }, + "nested": { + "SearchResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "product": { + "type": "Product", + "id": 2 + }, + "matchingVariantCount": { + "type": "int32", + "id": 3 + }, + "matchingVariantFields": { + "keyType": "string", + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "variantRollupValues": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 5 + } + } + }, + "Facet": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "values": { + "rule": "repeated", + "type": "FacetValue", + "id": 2 + }, + "dynamicFacet": { + "type": "bool", + "id": 3 + } + }, + "nested": { + "FacetValue": { + "oneofs": { + "facetValue": { + "oneof": [ + "value", + "interval" + ] + } + }, + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "interval": { + "type": "Interval", + "id": 2 + }, + "count": { + "type": "int64", + "id": 3 + } + } + } + } + }, + "QueryExpansionInfo": { + "fields": { + "expandedQuery": { + "type": "bool", + "id": 1 + } + } + } + } + }, "UserEventService": { "options": { "(google.api.default_host)": "retail.googleapis.com", @@ -4731,19 +8497,19 @@ } } }, - "Empty": { - "fields": {} - }, - "FieldMask": { + "Timestamp": { "fields": { - "paths": { - "rule": "repeated", - "type": "string", + "seconds": { + "type": "int64", "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 } } }, - "Timestamp": { + "Duration": { "fields": { "seconds": { "type": "int64", @@ -4755,6 +8521,15 @@ } } }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, "DoubleValue": { "fields": { "value": { @@ -4839,6 +8614,9 @@ } } }, + "Empty": { + "fields": {} + }, "Struct": { "fields": { "fields": { @@ -4901,18 +8679,6 @@ "id": 1 } } - }, - "Duration": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } } } }, @@ -4945,6 +8711,34 @@ } } }, + "type": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/type/date;date", + "java_multiple_files": true, + "java_outer_classname": "DateProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "Date": { + "fields": { + "year": { + "type": "int32", + "id": 1 + }, + "month": { + "type": "int32", + "id": 2 + }, + "day": { + "type": "int32", + "id": 3 + } + } + } + } + }, "longrunning": { "options": { "cc_enable_arenas": true, diff --git a/packages/google-cloud-retail/src/index.ts b/packages/google-cloud-retail/src/index.ts index b31a78058cd..de1b68b3218 100644 --- a/packages/google-cloud-retail/src/index.ts +++ b/packages/google-cloud-retail/src/index.ts @@ -22,10 +22,14 @@ import * as v2beta from './v2beta'; const CatalogServiceClient = v2beta.CatalogServiceClient; type CatalogServiceClient = v2beta.CatalogServiceClient; +const CompletionServiceClient = v2beta.CompletionServiceClient; +type CompletionServiceClient = v2beta.CompletionServiceClient; const PredictionServiceClient = v2beta.PredictionServiceClient; type PredictionServiceClient = v2beta.PredictionServiceClient; const ProductServiceClient = v2beta.ProductServiceClient; type ProductServiceClient = v2beta.ProductServiceClient; +const SearchServiceClient = v2beta.SearchServiceClient; +type SearchServiceClient = v2beta.SearchServiceClient; const UserEventServiceClient = v2beta.UserEventServiceClient; type UserEventServiceClient = v2beta.UserEventServiceClient; @@ -34,8 +38,10 @@ export { v2alpha, v2beta, CatalogServiceClient, + CompletionServiceClient, PredictionServiceClient, ProductServiceClient, + SearchServiceClient, UserEventServiceClient, }; export default { @@ -43,8 +49,10 @@ export default { v2alpha, v2beta, CatalogServiceClient, + CompletionServiceClient, PredictionServiceClient, ProductServiceClient, + SearchServiceClient, UserEventServiceClient, }; import * as protos from '../protos/protos'; diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index ed0aacbdeb7..e02e568c1a0 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -158,6 +158,9 @@ export class CatalogServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), @@ -229,7 +232,12 @@ export class CatalogServiceClient { // Iterate over each of the methods that the service provides // and create an API call method for each. - const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; + const catalogServiceStubMethods = [ + 'listCatalogs', + 'updateCatalog', + 'setDefaultBranch', + 'getDefaultBranch', + ]; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( stub => @@ -354,10 +362,7 @@ export class CatalogServiceClient { * a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided - * {@link google.cloud.retail.v2.Catalog|Catalog} to update. If not set, will only - * update the - * {@link google.cloud.retail.v2.Catalog.product_level_config|Catalog.product_level_config} - * field, which is also the only currently supported field to update. + * {@link google.cloud.retail.v2.Catalog|Catalog} to update. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. @@ -412,6 +417,232 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } + setDefaultBranch( + request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Set a specified branch id as default branch. API methods such as + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search}, + * {@link google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct}, + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * will treat requests using "default_branch" to the actual branch id set as + * default. + * + * For example, if `projects/* /locations/* /catalogs/* /branches/1` is set as + * default, setting + * {@link google.cloud.retail.v2.SearchRequest.branch|SearchRequest.branch} to + * `projects/* /locations/* /catalogs/* /branches/default_branch` is equivalent + * to setting + * {@link google.cloud.retail.v2.SearchRequest.branch|SearchRequest.branch} to + * `projects/* /locations/* /catalogs/* /branches/1`. + * + * Using multiple branches can be useful when developers would like + * to have a staging branch to test and verify for future usage. When it + * becomes ready, developers switch on the staging branch using this API while + * keeping using `projects/* /locations/* /catalogs/* /branches/default_branch` + * as {@link google.cloud.retail.v2.SearchRequest.branch|SearchRequest.branch} to + * route the traffic to this staging branch. + * + * CAUTION: If you have live predict/search traffic, switching the default + * branch could potentially cause outages if the ID space of the new branch is + * very different from the old one. + * + * More specifically: + * + * * PredictionService will only return product IDs from branch {newBranch}. + * * SearchService will only return product IDs from branch {newBranch} + * (if branch is not explicitly set). + * * UserEventService will only join events with products from branch + * {newBranch}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.branchId + * The final component of the resource name of a branch. + * + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + * @param {string} request.note + * Some note on this request, this can be retrieved by + * {@link google.cloud.retail.v2.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} + * before next valid default branch set occurs. + * + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setDefaultBranch(request); + */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultBranch(request, options, callback); + } + getDefaultBranch( + request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + getDefaultBranch( + request: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + callback: Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getDefaultBranch(request); + */ + getDefaultBranch( + request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.getDefaultBranch(request, options, callback); + } listCatalogs( request?: protos.google.cloud.retail.v2.IListCatalogsRequest, @@ -657,6 +888,73 @@ export class CatalogServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + /** * Return a fully-qualified catalog resource name string. * diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json index 15cd68637f2..685857e370e 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json @@ -29,6 +29,16 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "SetDefaultBranch": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetDefaultBranch": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json index 607b04beea5..4db248503a9 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json @@ -2,11 +2,13 @@ "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts new file mode 100644 index 00000000000..6277a2b00f2 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -0,0 +1,785 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/completion_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './completion_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Auto-completion service for retail. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * @class + * @memberof v2 + */ +export class CompletionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + completionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompletionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompletionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importCompletionDataResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ImportCompletionDataResponse' + ) as gax.protobuf.Type; + const importCompletionDataMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.ImportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + importCompletionData: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importCompletionDataResponse.decode.bind(importCompletionDataResponse), + importCompletionDataMetadata.decode.bind(importCompletionDataMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.CompletionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.completionServiceStub) { + return this.completionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.CompletionService. + this.completionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.CompletionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.CompletionService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const completionServiceStubMethods = [ + 'completeQuery', + 'importCompletionData', + ]; + for (const methodName of completionServiceStubMethods) { + const callPromise = this.completionServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.completionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + completeQuery( + request?: protos.google.cloud.retail.v2.ICompleteQueryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | undefined, + {} | undefined + ] + >; + completeQuery( + request: protos.google.cloud.retail.v2.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, + {} | null | undefined + > + ): void; + completeQuery( + request: protos.google.cloud.retail.v2.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Completes the specified prefix with keyword suggestions. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Required. Catalog for which the completion is performed. + * + * Full resource name of catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.query + * Required. The query used to generate suggestions. + * + * The maximum number of allowed characters is 255. + * @param {string} request.visitorId + * 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 logs in or 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. + * @param {string[]} request.languageCodes + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * + * The maximum number of allowed characters is 255. + * Only "en-US" is currently supported. + * @param {string} request.deviceType + * The device type context for completion suggestions. + * It is useful to apply different suggestions on different device types, e.g. + * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * types. + * + * Supported formats: + * + * * UNKNOWN_DEVICE_TYPE + * + * * DESKTOP + * + * * MOBILE + * + * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * @param {string} request.dataset + * Determines which dataset to use for fetching completion. "user-data" will + * use the imported dataset through + * {@link google.cloud.retail.v2.CompletionService.ImportCompletionData|CompletionService.ImportCompletionData}. + * "cloud-retail" will use the dataset generated by cloud retail based on user + * events. If leave empty, it will use the "user-data". + * + * Current supported values: + * + * * user-data + * + * * cloud-retail + * This option is not automatically enabled. Before using cloud-retail, + * contact retail-search-support@google.com first. + * @param {number} request.maxSuggestions + * Completion max suggestions. + * + * The maximum allowed max suggestions is 20. The default value is 20. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompleteQueryResponse]{@link google.cloud.retail.v2.CompleteQueryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeQuery(request); + */ + completeQuery( + request?: protos.google.cloud.retail.v2.ICompleteQueryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.ICompleteQueryResponse, + | protos.google.cloud.retail.v2.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.completeQuery(request, options, callback); + } + + importCompletionData( + request?: protos.google.cloud.retail.v2.IImportCompletionDataRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importCompletionData( + request: protos.google.cloud.retail.v2.IImportCompletionDataRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importCompletionData( + request: protos.google.cloud.retail.v2.IImportCompletionDataRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Bulk import of processed completion dataset. + * + * Request processing may be synchronous. Partial updating is not supported. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog which the suggestions dataset belongs to. + * + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2.CompletionDataInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importCompletionData(request); + * const [response] = await operation.promise(); + */ + importCompletionData( + request?: protos.google.cloud.retail.v2.IImportCompletionDataRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importCompletionData(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importCompletionData()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportCompletionDataProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportCompletionDataProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.ImportCompletionDataResponse, + protos.google.cloud.retail.v2.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importCompletionData, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.ImportCompletionDataResponse, + protos.google.cloud.retail.v2.ImportMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.completionServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/completion_service_client_config.json b/packages/google-cloud-retail/src/v2/completion_service_client_config.json new file mode 100644 index 00000000000..504bef8cd31 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/completion_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.retail.v2.CompletionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CompleteQuery": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportCompletionData": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json new file mode 100644 index 00000000000..4db248503a9 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/gapic_metadata.json b/packages/google-cloud-retail/src/v2/gapic_metadata.json index 14e6414a2a9..064eddd9b6d 100644 --- a/packages/google-cloud-retail/src/v2/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2/gapic_metadata.json @@ -15,6 +15,16 @@ "updateCatalog" ] }, + "SetDefaultBranch": { + "methods": [ + "setDefaultBranch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "getDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -32,6 +42,16 @@ "updateCatalog" ] }, + "SetDefaultBranch": { + "methods": [ + "setDefaultBranch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "getDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -43,6 +63,40 @@ } } }, + "CompletionService": { + "clients": { + "grpc": { + "libraryClient": "CompletionServiceClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "importCompletionData" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompletionServiceClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "importCompletionData" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -96,6 +150,28 @@ "methods": [ "importProducts" ] + }, + "SetInventory": { + "methods": [ + "setInventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "addFulfillmentPlaces" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "removeFulfillmentPlaces" + ] + }, + "ListProducts": { + "methods": [ + "listProducts", + "listProductsStream", + "listProductsAsync" + ] } } }, @@ -126,6 +202,56 @@ "methods": [ "importProducts" ] + }, + "SetInventory": { + "methods": [ + "setInventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "addFulfillmentPlaces" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "removeFulfillmentPlaces" + ] + }, + "ListProducts": { + "methods": [ + "listProducts", + "listProductsStream", + "listProductsAsync" + ] + } + } + } + } + }, + "SearchService": { + "clients": { + "grpc": { + "libraryClient": "SearchServiceClient", + "rpcs": { + "Search": { + "methods": [ + "search", + "searchStream", + "searchAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SearchServiceClient", + "rpcs": { + "Search": { + "methods": [ + "search", + "searchStream", + "searchAsync" + ] } } } diff --git a/packages/google-cloud-retail/src/v2/index.ts b/packages/google-cloud-retail/src/v2/index.ts index dbfefa59d67..c0d103f8c56 100644 --- a/packages/google-cloud-retail/src/v2/index.ts +++ b/packages/google-cloud-retail/src/v2/index.ts @@ -17,6 +17,8 @@ // ** All changes to this file may be overwritten. ** export {CatalogServiceClient} from './catalog_service_client'; +export {CompletionServiceClient} from './completion_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; +export {SearchServiceClient} from './search_service_client'; export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index a9167342eac..4efaee18391 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -323,30 +323,10 @@ export class PredictionServiceClient { * @param {string} request.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 ID of the Recommendations AI placement. Before you can request + * predictions from your model, you must create at least one placement for it. + * For more information, see [Managing + * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). * * The full list of available placements can be seen at * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements @@ -373,6 +353,9 @@ export class PredictionServiceClient { * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings * with a size limit of 1,000 characters. * + * Note: "Recently viewed" models don't support tag filtering at the + * moment. + * * * filterOutOfStockItems. Restricts predictions to products that do not * have a * stockState value of OUT_OF_STOCK. @@ -407,16 +390,34 @@ export class PredictionServiceClient { * * `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. + * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-price-reranking', 'low-price-reranking', + * 'medium-price-reranking', 'high-price-reranking'}. This gives + * request-level control and adjusts prediction results based on product + * price. + * * `diversityLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-diversity', 'low-diversity', + * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + * request-level control and adjusts prediction results based on product + * category. * @param {number[]} request.labels - * The labels for the predict request. + * The labels applied to a resource must meet the following requirements: * - * * 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. + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters, and cannot be empty. Values can be empty, and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. * - * See https://goo.gl/xmQnxf for more information on and examples of labels. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json index 607b04beea5..4db248503a9 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json @@ -2,11 +2,13 @@ "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index b3edece1403..1b8a7b6704c 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -24,8 +24,12 @@ import { Descriptors, ClientOptions, LROperation, + PaginationCallback, + GaxCall, } from 'google-gax'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -168,6 +172,17 @@ export class ProductServiceClient { ), }; + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listProducts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); // This API contains "long-running operations", which return a @@ -186,6 +201,24 @@ export class ProductServiceClient { const importProductsMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2.ImportMetadata' ) as gax.protobuf.Type; + const setInventoryResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.SetInventoryResponse' + ) as gax.protobuf.Type; + const setInventoryMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.SetInventoryMetadata' + ) as gax.protobuf.Type; + const addFulfillmentPlacesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.AddFulfillmentPlacesResponse' + ) as gax.protobuf.Type; + const addFulfillmentPlacesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.AddFulfillmentPlacesMetadata' + ) as gax.protobuf.Type; + const removeFulfillmentPlacesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse' + ) as gax.protobuf.Type; + const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -193,6 +226,25 @@ export class ProductServiceClient { importProductsResponse.decode.bind(importProductsResponse), importProductsMetadata.decode.bind(importProductsMetadata) ), + setInventory: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setInventoryResponse.decode.bind(setInventoryResponse), + setInventoryMetadata.decode.bind(setInventoryMetadata) + ), + addFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addFulfillmentPlacesResponse.decode.bind(addFulfillmentPlacesResponse), + addFulfillmentPlacesMetadata.decode.bind(addFulfillmentPlacesMetadata) + ), + removeFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeFulfillmentPlacesResponse.decode.bind( + removeFulfillmentPlacesResponse + ), + removeFulfillmentPlacesMetadata.decode.bind( + removeFulfillmentPlacesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -247,9 +299,13 @@ export class ProductServiceClient { const productServiceStubMethods = [ 'createProduct', 'getProduct', + 'listProducts', 'updateProduct', 'deleteProduct', 'importProducts', + 'setInventory', + 'addFulfillmentPlaces', + 'removeFulfillmentPlaces', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -266,7 +322,10 @@ export class ProductServiceClient { } ); - const descriptor = this.descriptors.longrunning[methodName] || undefined; + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -567,8 +626,10 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * - * If the {@link google.cloud.retail.v2.Product|Product} to update does not exist, - * a NOT_FOUND error is returned. + * If the {@link google.cloud.retail.v2.Product|Product} to update does not exist + * and + * {@link google.cloud.retail.v2.UpdateProductRequest.allow_missing|allow_missing} + * is not set, a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided * {@link google.cloud.retail.v2.Product|Product} to update. The immutable and @@ -577,6 +638,10 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not + * found, a new {@link google.cloud.retail.v2.Product|Product} will be created. In + * this situation, `update_mask` is ignored. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -671,6 +736,17 @@ export class ProductServiceClient { * * If the {@link google.cloud.retail.v2.Product|Product} to delete does not exist, * a NOT_FOUND error is returned. + * + * The {@link google.cloud.retail.v2.Product|Product} to delete can neither be a + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product} member nor a + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product} with more than one + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variants}. Otherwise, an + * INVALID_ARGUMENT error is returned. + * + * All inventory information for the named + * {@link google.cloud.retail.v2.Product|Product} will be deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -776,6 +852,16 @@ export class ProductServiceClient { * * If no updateMask is specified, requires products.create permission. * If updateMask is specified, requires products.update permission. + * @param {string} request.requestId + * Unique identifier provided by client, within the ancestor + * dataset scope. Ensures idempotency and used for request deduplication. + * Server-generated if unspecified. Up to 128 characters long and must match + * the pattern: "{@link |a-zA-Z0-9_]+". This is returned as [Operation.name} in + * {@link google.cloud.retail.v2.ImportMetadata|ImportMetadata}. + * + * Only supported when + * {@link google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. * @param {google.cloud.retail.v2.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig @@ -783,6 +869,20 @@ export class ProductServiceClient { * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided imported 'products' to update. If * not set, will by default update all fields. + * @param {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} request.reconciliationMode + * The mode of reconciliation between existing products and the products to be + * imported. Defaults to + * {@link google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Only supported when + * {@link google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -881,6 +981,1039 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.ImportMetadata >; } + setInventory( + request?: protos.google.cloud.retail.v2.ISetInventoryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setInventory( + request: protos.google.cloud.retail.v2.ISetInventoryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setInventory( + request: protos.google.cloud.retail.v2.ISetInventoryRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates inventory information for a + * {@link google.cloud.retail.v2.Product|Product} while respecting the last update + * timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, updates are not immediately manifested in the + * {@link google.cloud.retail.v2.Product|Product} queried by + * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * + * When inventory is updated with + * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} and + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct}, the + * specified inventory field value(s) will overwrite any existing value(s) + * while ignoring the last update time for this field. Furthermore, the last + * update time for the specified inventory fields will be overwritten to the + * time of the + * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} or + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct} + * request. + * + * If no inventory fields are set in + * {@link google.cloud.retail.v2.CreateProductRequest.product|CreateProductRequest.product}, + * then any pre-existing inventory information for this product will be used. + * + * If no inventory fields are set in {@link |UpdateProductRequest.set_mask}, + * then any existing inventory information will be preserved. + * + * Pre-existing inventory information can only be updated with + * {@link google.cloud.retail.v2.ProductService.SetInventory|SetInventory}, + * {@link google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * and + * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.Product} request.inventory + * Required. The inventory information to update. The allowable fields to + * update are: + * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2.Product.availability|Product.availability} + * * {@link google.cloud.retail.v2.Product.available_quantity|Product.available_quantity} + * * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info} + * The updated inventory fields must be specified in + * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. + * + * If {@link |SetInventoryRequest.inventory.name} is empty or invalid, an + * INVALID_ARGUMENT error is returned. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2.Product|Product} named in + * {@link google.cloud.retail.v2.Product.name|Product.name}, regardless of whether + * or not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2.Product|Product} to update does not have + * existing inventory information, the provided inventory information will be + * inserted. + * + * If the {@link google.cloud.retail.v2.Product|Product} to update has existing + * inventory information, the provided inventory information will be merged + * while respecting the last update time for each inventory field, using the + * provided or default value for + * {@link google.cloud.retail.v2.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. + * + * The last update time is recorded for the following inventory fields: + * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2.Product.availability|Product.availability} + * * {@link google.cloud.retail.v2.Product.available_quantity|Product.available_quantity} + * * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info} + * + * If a full overwrite of inventory information while ignoring timestamps is + * needed, {@link |UpdateProduct} should be invoked instead. + * @param {google.protobuf.FieldMask} request.setMask + * Indicates which inventory fields in the provided + * {@link google.cloud.retail.v2.Product|Product} to update. If not set or set with + * empty paths, all inventory fields will be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.setTime + * The time when the request is issued, used to prevent + * out-of-order updates on inventory fields with the last update time + * recorded. If not provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2.Product|Product} with name + * {@link google.cloud.retail.v2.Product.name|Product.name} is not found, the + * inventory update will still be processed and retained for at most 1 day + * until the {@link google.cloud.retail.v2.Product|Product} is created. If set to + * false, an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.setInventory(request); + * const [response] = await operation.promise(); + */ + setInventory( + request?: protos.google.cloud.retail.v2.ISetInventoryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'inventory.name': request.inventory!.name || '', + }); + this.initialize(); + return this.innerApiCalls.setInventory(request, options, callback); + } + /** + * Check the status of the long running operation returned by `setInventory()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkSetInventoryProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkSetInventoryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.SetInventoryResponse, + protos.google.cloud.retail.v2.SetInventoryMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.setInventory, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.SetInventoryResponse, + protos.google.cloud.retail.v2.SetInventoryMetadata + >; + } + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Incrementally adds place IDs to + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, the added place IDs are not immediately manifested in the + * {@link google.cloud.retail.v2.Product|Product} queried by + * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * @param {string} request.type + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * + * Supported values: + * + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * + * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * @param {string[]} request.placeIds + * Required. The IDs for this + * {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type}, such as + * the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery" to be added for this + * {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type}. Duplicate + * IDs will be automatically ignored. + * + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * + * If the total number of place IDs exceeds 2000 for this + * {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type} after + * adding, then the update will be rejected. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not + * found, the fulfillment information will still be processed and retained for + * at most 1 day and processed once the + * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, an + * INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.addFulfillmentPlaces(request); + * const [response] = await operation.promise(); + */ + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addFulfillmentPlaces(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addFulfillmentPlaces()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkAddFulfillmentPlacesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkAddFulfillmentPlacesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.AddFulfillmentPlacesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.AddFulfillmentPlacesMetadata + >; + } + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Incrementally removes place IDs from a + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, the removed place IDs are not immediately manifested in the + * {@link google.cloud.retail.v2.Product|Product} queried by + * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * @param {string} request.type + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * + * Supported values: + * + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * + * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * @param {string[]} request.placeIds + * Required. The IDs for this + * {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type|type}, such as + * the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery", to be removed for this + * {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type|type}. + * + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not + * found, the fulfillment information will still be processed and retained for + * at most 1 day and processed once the + * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, an + * INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.removeFulfillmentPlaces(request); + * const [response] = await operation.promise(); + */ + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeFulfillmentPlaces( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeFulfillmentPlaces()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRemoveFulfillmentPlacesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRemoveFulfillmentPlacesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + >; + } + listProducts( + request?: protos.google.cloud.retail.v2.IListProductsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct[], + protos.google.cloud.retail.v2.IListProductsRequest | null, + protos.google.cloud.retail.v2.IListProductsResponse + ] + >; + listProducts( + request: protos.google.cloud.retail.v2.IListProductsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListProductsRequest, + protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, + protos.google.cloud.retail.v2.IProduct + > + ): void; + listProducts( + request: protos.google.cloud.retail.v2.IListProductsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListProductsRequest, + protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, + protos.google.cloud.retail.v2.IProduct + > + ): void; + /** + * Gets a list of {@link google.cloud.retail.v2.Product|Product}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2.Product|Product}s under this branch, regardless of + * whether or not this branch exists, a PERMISSION_DENIED error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Product|Product}s to return. If + * unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2.ListProductsRequest.filter|filter} is unset. + * * List {@link google.cloud.retail.v2.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2.Product|Product}s sharing the same + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2.Product|Product}s bundled in a + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2.Product|Product}s with a partibular type. + * For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product} or + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product} does not exist, a NOT_FOUND error + * is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2.Product|Product} to return in the + * responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2.Product.name|Product.name} + * * {@link google.cloud.retail.v2.Product.id|Product.id} + * * {@link google.cloud.retail.v2.Product.title|Product.title} + * * {@link google.cloud.retail.v2.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2.Product.images|Product.images} + * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2.Product.name|Product.name} is always returned no + * matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.retail.v2.Product}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProductsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProducts( + request?: protos.google.cloud.retail.v2.IListProductsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2.IListProductsRequest, + | protos.google.cloud.retail.v2.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2.IProduct + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2.IListProductsRequest, + protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, + protos.google.cloud.retail.v2.IProduct + > + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct[], + protos.google.cloud.retail.v2.IListProductsRequest | null, + protos.google.cloud.retail.v2.IListProductsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProducts(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2.Product|Product}s under this branch, regardless of + * whether or not this branch exists, a PERMISSION_DENIED error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Product|Product}s to return. If + * unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2.ListProductsRequest.filter|filter} is unset. + * * List {@link google.cloud.retail.v2.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2.Product|Product}s sharing the same + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2.Product|Product}s bundled in a + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2.Product|Product}s with a partibular type. + * For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product} or + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product} does not exist, a NOT_FOUND error + * is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2.Product|Product} to return in the + * responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2.Product.name|Product.name} + * * {@link google.cloud.retail.v2.Product.id|Product.id} + * * {@link google.cloud.retail.v2.Product.title|Product.title} + * * {@link google.cloud.retail.v2.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2.Product.images|Product.images} + * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2.Product.name|Product.name} is always returned no + * matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.retail.v2.Product} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listProductsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProductsStream( + request?: protos.google.cloud.retail.v2.IListProductsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProducts.createStream( + this.innerApiCalls.listProducts as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProducts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2.Product|Product}s under this branch, regardless of + * whether or not this branch exists, a PERMISSION_DENIED error is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Product|Product}s to return. If + * unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2.ListProductsRequest.filter|filter} is unset. + * * List {@link google.cloud.retail.v2.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2.Product|Product}s sharing the same + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2.Product|Product}s bundled in a + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2.Product|Product}s with a partibular type. + * For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2.Product|Product} or + * {@link google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2.Product|Product} does not exist, a NOT_FOUND error + * is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2.Product|Product} to return in the + * responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2.Product.name|Product.name} + * * {@link google.cloud.retail.v2.Product.id|Product.id} + * * {@link google.cloud.retail.v2.Product.title|Product.title} + * * {@link google.cloud.retail.v2.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2.Product.images|Product.images} + * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2.Product.name|Product.name} is always returned no + * matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Product]{@link google.cloud.retail.v2.Product}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listProductsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listProductsAsync( + request?: protos.google.cloud.retail.v2.IListProductsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProducts.asyncIterate( + this.innerApiCalls['listProducts'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- diff --git a/packages/google-cloud-retail/src/v2/product_service_client_config.json b/packages/google-cloud-retail/src/v2/product_service_client_config.json index d4f7d741409..1c5fa2d534a 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/product_service_client_config.json @@ -30,6 +30,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "ListProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "UpdateProduct": { "timeout_millis": 60000, "retry_codes_name": "idempotent", @@ -44,6 +49,21 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "SetInventory": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AddFulfillmentPlaces": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RemoveFulfillmentPlaces": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-retail/src/v2/product_service_proto_list.json b/packages/google-cloud-retail/src/v2/product_service_proto_list.json index 607b04beea5..4db248503a9 100644 --- a/packages/google-cloud-retail/src/v2/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/product_service_proto_list.json @@ -2,11 +2,13 @@ "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts new file mode 100644 index 00000000000..f06600087ed --- /dev/null +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -0,0 +1,1167 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/search_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './search_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for search. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * @class + * @memberof v2 + */ +export class SearchServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + searchServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SearchServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SearchServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + search: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'results' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.SearchService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.searchServiceStub) { + return this.searchServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.SearchService. + this.searchServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.SearchService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.SearchService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const searchServiceStubMethods = ['search']; + for (const methodName of searchServiceStubMethods) { + const callPromise = this.searchServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.searchServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + search( + request?: protos.google.cloud.retail.v2.ISearchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2.ISearchRequest | null, + protos.google.cloud.retail.v2.ISearchResponse + ] + >; + search( + request: protos.google.cloud.retail.v2.ISearchRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.ISearchRequest, + protos.google.cloud.retail.v2.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2.SearchResponse.ISearchResult + > + ): void; + search( + request: protos.google.cloud.retail.v2.ISearchRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.ISearchRequest, + protos.google.cloud.retail.v2.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2.SearchResponse.ISearchResult + > + ): void; + /** + * Performs a search. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Product|Product}s to return. If + * unspecified, defaults to a reasonable value. The maximum allowed value is + * 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search} call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search} must + * match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + * error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the {@link google.cloud.retail.v2.Product|Product}s + * deemed by the API as relevant) in search results. This field is only + * considered if {@link google.cloud.retail.v2.SearchRequest.page_token|page_token} + * is unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See {@link google.cloud.retail.v2.SearchRequest.filter|SearchRequest.filter} for + * more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s attributes. The attributes from + * all the matching {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s are merged and de-duplicated. + * Notice that rollup {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra + * query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [SearchResult]{@link google.cloud.retail.v2.SearchResponse.SearchResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + search( + request?: protos.google.cloud.retail.v2.ISearchRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2.ISearchRequest, + protos.google.cloud.retail.v2.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2.SearchResponse.ISearchResult + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2.ISearchRequest, + protos.google.cloud.retail.v2.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2.SearchResponse.ISearchResult + > + ): Promise< + [ + protos.google.cloud.retail.v2.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2.ISearchRequest | null, + protos.google.cloud.retail.v2.ISearchResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + this.initialize(); + return this.innerApiCalls.search(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Product|Product}s to return. If + * unspecified, defaults to a reasonable value. The maximum allowed value is + * 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search} call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search} must + * match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + * error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the {@link google.cloud.retail.v2.Product|Product}s + * deemed by the API as relevant) in search results. This field is only + * considered if {@link google.cloud.retail.v2.SearchRequest.page_token|page_token} + * is unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See {@link google.cloud.retail.v2.SearchRequest.filter|SearchRequest.filter} for + * more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s attributes. The attributes from + * all the matching {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s are merged and de-duplicated. + * Notice that rollup {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra + * query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SearchResult]{@link google.cloud.retail.v2.SearchResponse.SearchResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchStream( + request?: protos.google.cloud.retail.v2.ISearchRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.search.createStream( + this.innerApiCalls.search as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `search`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2.Product|Product}s to return. If + * unspecified, defaults to a reasonable value. The maximum allowed value is + * 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search} call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search} must + * match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + * error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the {@link google.cloud.retail.v2.Product|Product}s + * deemed by the API as relevant) in search results. This field is only + * considered if {@link google.cloud.retail.v2.SearchRequest.page_token|page_token} + * is unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See {@link google.cloud.retail.v2.SearchRequest.filter|SearchRequest.filter} for + * more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s attributes. The attributes from + * all the matching {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s are merged and de-duplicated. + * Notice that rollup {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra + * query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SearchResult]{@link google.cloud.retail.v2.SearchResponse.SearchResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.searchAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + searchAsync( + request?: protos.google.cloud.retail.v2.ISearchRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.search.asyncIterate( + this.innerApiCalls['search'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.searchServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/search_service_client_config.json b/packages/google-cloud-retail/src/v2/search_service_client_config.json new file mode 100644 index 00000000000..6a194d85625 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/search_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2.SearchService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Search": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/search_service_proto_list.json b/packages/google-cloud-retail/src/v2/search_service_proto_list.json new file mode 100644 index 00000000000..4db248503a9 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/search_service_proto_list.json @@ -0,0 +1,14 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 276851eee9c..40cd7acffc3 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -588,7 +588,7 @@ export class UserEventServiceClient { * @param {string} request.parent * Required. The resource name of the catalog under which the events are * created. The format is - * "projects/${projectId}/locations/global/catalogs/${catalogId}" + * `projects/${projectId}/locations/global/catalogs/${catalogId}` * @param {string} request.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 diff --git a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json index 607b04beea5..4db248503a9 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json @@ -2,11 +2,13 @@ "../../protos/google/cloud/retail/v2/catalog.proto", "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 8d2d1f1252f..d1d2a08e52f 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -158,6 +158,9 @@ export class CatalogServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), @@ -229,7 +232,12 @@ export class CatalogServiceClient { // Iterate over each of the methods that the service provides // and create an API call method for each. - const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; + const catalogServiceStubMethods = [ + 'listCatalogs', + 'updateCatalog', + 'setDefaultBranch', + 'getDefaultBranch', + ]; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( stub => @@ -358,10 +366,7 @@ export class CatalogServiceClient { * exist, a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided - * {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. If not set, will - * only update the - * {@link google.cloud.retail.v2alpha.Catalog.product_level_config|Catalog.product_level_config} - * field, which is also the only currently supported field to update. + * {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. @@ -418,6 +423,244 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } + setDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Set a specified branch id as default branch. API methods such as + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search}, + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct}, + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * will treat requests using "default_branch" to the actual branch id set as + * default. + * + * For example, if `projects/* /locations/* /catalogs/* /branches/1` is set as + * default, setting + * {@link google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to + * `projects/* /locations/* /catalogs/* /branches/default_branch` is equivalent + * to setting + * {@link google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to + * `projects/* /locations/* /catalogs/* /branches/1`. + * + * Using multiple branches can be useful when developers would like + * to have a staging branch to test and verify for future usage. When it + * becomes ready, developers switch on the staging branch using this API while + * keeping using `projects/* /locations/* /catalogs/* /branches/default_branch` + * as {@link google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} + * to route the traffic to this staging branch. + * + * CAUTION: If you have live predict/search traffic, switching the default + * branch could potentially cause outages if the ID space of the new branch is + * very different from the old one. + * + * More specifically: + * + * * PredictionService will only return product IDs from branch {newBranch}. + * * SearchService will only return product IDs from branch {newBranch} + * (if branch is not explicitly set). + * * UserEventService will only join events with products from branch + * {newBranch}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.branchId + * The final component of the resource name of a branch. + * + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + * @param {string} request.note + * Some note on this request, this can be retrieved by + * {@link google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} + * before next valid default branch set occurs. + * + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setDefaultBranch(request); + */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultBranch(request, options, callback); + } + getDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + getDefaultBranch( + request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2alpha.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getDefaultBranch(request); + */ + getDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.getDefaultBranch(request, options, callback); + } listCatalogs( request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, @@ -669,6 +912,73 @@ export class CatalogServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + /** * Return a fully-qualified catalog resource name string. * diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json index 2ac65f6da85..b70d6d1a205 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json @@ -29,6 +29,16 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "SetDefaultBranch": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetDefaultBranch": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json index 241ed02fecb..89776f5d72d 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2alpha/catalog.proto", "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts new file mode 100644 index 00000000000..df972014c08 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -0,0 +1,790 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/completion_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './completion_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Auto-completion service for retail. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * @class + * @memberof v2alpha + */ +export class CompletionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + completionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompletionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompletionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importCompletionDataResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.ImportCompletionDataResponse' + ) as gax.protobuf.Type; + const importCompletionDataMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.ImportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + importCompletionData: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importCompletionDataResponse.decode.bind(importCompletionDataResponse), + importCompletionDataMetadata.decode.bind(importCompletionDataMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.CompletionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.completionServiceStub) { + return this.completionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.CompletionService. + this.completionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.CompletionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.CompletionService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const completionServiceStubMethods = [ + 'completeQuery', + 'importCompletionData', + ]; + for (const methodName of completionServiceStubMethods) { + const callPromise = this.completionServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.completionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + completeQuery( + request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + protos.google.cloud.retail.v2alpha.ICompleteQueryRequest | undefined, + {} | undefined + ] + >; + completeQuery( + request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeQuery( + request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Completes the specified prefix with keyword suggestions. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Required. Catalog for which the completion is performed. + * + * Full resource name of catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.query + * Required. The query used to generate suggestions. + * + * The maximum number of allowed characters is 255. + * @param {string} request.visitorId + * 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 logs in or 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. + * @param {string[]} request.languageCodes + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * + * The maximum number of allowed characters is 255. + * Only "en-US" is currently supported. + * @param {string} request.deviceType + * The device type context for completion suggestions. + * It is useful to apply different suggestions on different device types, e.g. + * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * types. + * + * Supported formats: + * + * * UNKNOWN_DEVICE_TYPE + * + * * DESKTOP + * + * * MOBILE + * + * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * @param {string} request.dataset + * Determines which dataset to use for fetching completion. "user-data" will + * use the imported dataset through {@link |ImportCompletionData}. "cloud-retail" + * will use the dataset generated by cloud retail based on user events. If + * leave empty, it will use the "user-data". + * + * Current supported values: + * + * * user-data + * + * * cloud-retail + * This option is not automatically enabled. Before using cloud-retail, + * contact retail-search-support@google.com first. + * @param {number} request.maxSuggestions + * Completion max suggestions. + * + * The maximum allowed max suggestions is 20. The default value is 20. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompleteQueryResponse]{@link google.cloud.retail.v2alpha.CompleteQueryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeQuery(request); + */ + completeQuery( + request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + protos.google.cloud.retail.v2alpha.ICompleteQueryRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.completeQuery(request, options, callback); + } + + importCompletionData( + request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importCompletionData( + request: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importCompletionData( + request: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Bulk import of processed completion dataset. + * + * Request processing may be synchronous. Partial updating is not supported. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog which the suggestions dataset belongs to. + * + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importCompletionData(request); + * const [response] = await operation.promise(); + */ + importCompletionData( + request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importCompletionData(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importCompletionData()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportCompletionDataProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportCompletionDataProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.ImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importCompletionData, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.ImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.ImportMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.completionServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json new file mode 100644 index 00000000000..01602c74772 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.CompletionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CompleteQuery": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportCompletionData": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json new file mode 100644 index 00000000000..89776f5d72d --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json index 2106f3f9952..5c5b0b48cd7 100644 --- a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json @@ -15,6 +15,16 @@ "updateCatalog" ] }, + "SetDefaultBranch": { + "methods": [ + "setDefaultBranch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "getDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -32,6 +42,16 @@ "updateCatalog" ] }, + "SetDefaultBranch": { + "methods": [ + "setDefaultBranch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "getDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -43,6 +63,40 @@ } } }, + "CompletionService": { + "clients": { + "grpc": { + "libraryClient": "CompletionServiceClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "importCompletionData" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompletionServiceClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "importCompletionData" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -96,6 +150,28 @@ "methods": [ "importProducts" ] + }, + "SetInventory": { + "methods": [ + "setInventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "addFulfillmentPlaces" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "removeFulfillmentPlaces" + ] + }, + "ListProducts": { + "methods": [ + "listProducts", + "listProductsStream", + "listProductsAsync" + ] } } }, @@ -126,6 +202,56 @@ "methods": [ "importProducts" ] + }, + "SetInventory": { + "methods": [ + "setInventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "addFulfillmentPlaces" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "removeFulfillmentPlaces" + ] + }, + "ListProducts": { + "methods": [ + "listProducts", + "listProductsStream", + "listProductsAsync" + ] + } + } + } + } + }, + "SearchService": { + "clients": { + "grpc": { + "libraryClient": "SearchServiceClient", + "rpcs": { + "Search": { + "methods": [ + "search", + "searchStream", + "searchAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SearchServiceClient", + "rpcs": { + "Search": { + "methods": [ + "search", + "searchStream", + "searchAsync" + ] } } } diff --git a/packages/google-cloud-retail/src/v2alpha/index.ts b/packages/google-cloud-retail/src/v2alpha/index.ts index dbfefa59d67..c0d103f8c56 100644 --- a/packages/google-cloud-retail/src/v2alpha/index.ts +++ b/packages/google-cloud-retail/src/v2alpha/index.ts @@ -17,6 +17,8 @@ // ** All changes to this file may be overwritten. ** export {CatalogServiceClient} from './catalog_service_client'; +export {CompletionServiceClient} from './completion_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; +export {SearchServiceClient} from './search_service_client'; export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index ae50925b4ac..ca4cc5edfb9 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -323,30 +323,10 @@ export class PredictionServiceClient { * @param {string} request.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 ID of the Recommendations AI placement. Before you can request + * predictions from your model, you must create at least one placement for it. + * For more information, see [Managing + * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). * * The full list of available placements can be seen at * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements @@ -373,6 +353,9 @@ export class PredictionServiceClient { * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings * with a size limit of 1,000 characters. * + * Note: "Recently viewed" models don't support tag filtering at the + * moment. + * * * filterOutOfStockItems. Restricts predictions to products that do not * have a * stockState value of OUT_OF_STOCK. @@ -407,16 +390,34 @@ export class PredictionServiceClient { * * `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. + * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-price-reranking', 'low-price-reranking', + * 'medium-price-reranking', 'high-price-reranking'}. This gives + * request-level control and adjusts prediction results based on product + * price. + * * `diversityLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-diversity', 'low-diversity', + * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + * request-level control and adjusts prediction results based on product + * category. * @param {number[]} request.labels - * The labels for the predict request. + * The labels applied to a resource must meet the following requirements: * - * * 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. + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters, and cannot be empty. Values can be empty, and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. * - * See https://goo.gl/xmQnxf for more information on and examples of labels. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json index 241ed02fecb..89776f5d72d 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2alpha/catalog.proto", "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index b886371b73a..08a3c9a3674 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -24,8 +24,12 @@ import { Descriptors, ClientOptions, LROperation, + PaginationCallback, + GaxCall, } from 'google-gax'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -168,6 +172,17 @@ export class ProductServiceClient { ), }; + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listProducts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); // This API contains "long-running operations", which return a @@ -186,6 +201,24 @@ export class ProductServiceClient { const importProductsMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.ImportMetadata' ) as gax.protobuf.Type; + const setInventoryResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.SetInventoryResponse' + ) as gax.protobuf.Type; + const setInventoryMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.SetInventoryMetadata' + ) as gax.protobuf.Type; + const addFulfillmentPlacesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse' + ) as gax.protobuf.Type; + const addFulfillmentPlacesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata' + ) as gax.protobuf.Type; + const removeFulfillmentPlacesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse' + ) as gax.protobuf.Type; + const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -193,6 +226,25 @@ export class ProductServiceClient { importProductsResponse.decode.bind(importProductsResponse), importProductsMetadata.decode.bind(importProductsMetadata) ), + setInventory: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setInventoryResponse.decode.bind(setInventoryResponse), + setInventoryMetadata.decode.bind(setInventoryMetadata) + ), + addFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addFulfillmentPlacesResponse.decode.bind(addFulfillmentPlacesResponse), + addFulfillmentPlacesMetadata.decode.bind(addFulfillmentPlacesMetadata) + ), + removeFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeFulfillmentPlacesResponse.decode.bind( + removeFulfillmentPlacesResponse + ), + removeFulfillmentPlacesMetadata.decode.bind( + removeFulfillmentPlacesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -247,9 +299,13 @@ export class ProductServiceClient { const productServiceStubMethods = [ 'createProduct', 'getProduct', + 'listProducts', 'updateProduct', 'deleteProduct', 'importProducts', + 'setInventory', + 'addFulfillmentPlaces', + 'removeFulfillmentPlaces', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -266,7 +322,10 @@ export class ProductServiceClient { } ); - const descriptor = this.descriptors.longrunning[methodName] || undefined; + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -370,7 +429,7 @@ export class ProductServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. * @param {google.cloud.retail.v2alpha.Product} request.product * Required. The {@link google.cloud.retail.v2alpha.Product|Product} to create. * @param {string} request.productId @@ -477,7 +536,7 @@ export class ProductServiceClient { * @param {string} request.name * Required. Full resource name of * {@link google.cloud.retail.v2alpha.Product|Product}, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to access the * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or @@ -580,7 +639,9 @@ export class ProductServiceClient { * not it exists, a PERMISSION_DENIED error is returned. * * If the {@link google.cloud.retail.v2alpha.Product|Product} to update does not - * exist, a NOT_FOUND error is returned. + * exist and + * {@link google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing|allow_missing} + * is not set, a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided * {@link google.cloud.retail.v2alpha.Product|Product} to update. The immutable and @@ -589,6 +650,10 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, a new {@link google.cloud.retail.v2alpha.Product|Product} will be + * created. In this situation, `update_mask` is ignored. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -681,7 +746,7 @@ export class ProductServiceClient { * @param {string} request.name * Required. Full resource name of * {@link google.cloud.retail.v2alpha.Product|Product}, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to delete the * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or @@ -689,6 +754,18 @@ export class ProductServiceClient { * * If the {@link google.cloud.retail.v2alpha.Product|Product} to delete does not * exist, a NOT_FOUND error is returned. + * + * The {@link google.cloud.retail.v2alpha.Product|Product} to delete can neither be + * a + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product} member nor a + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product} with more than one + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variants}. Otherwise, an + * INVALID_ARGUMENT error is returned. + * + * All inventory information for the named + * {@link google.cloud.retail.v2alpha.Product|Product} will be deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -792,10 +869,20 @@ export class ProductServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. - * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + * `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. + * @param {string} request.requestId + * Unique identifier provided by client, within the ancestor + * dataset scope. Ensures idempotency and used for request deduplication. + * Server-generated if unspecified. Up to 128 characters long and must match + * the pattern: "{@link |a-zA-Z0-9_]+". This is returned as [Operation.name} in + * {@link google.cloud.retail.v2alpha.ImportMetadata|ImportMetadata}. + * + * Only supported when + * {@link google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. * @param {google.cloud.retail.v2alpha.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig @@ -803,6 +890,20 @@ export class ProductServiceClient { * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided imported 'products' to update. If * not set, will by default update all fields. + * @param {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} request.reconciliationMode + * The mode of reconciliation between existing products and the products to be + * imported. Defaults to + * {@link google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Only supported when + * {@link google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -901,6 +1002,1077 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.ImportMetadata >; } + setInventory( + request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setInventory( + request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setInventory( + request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates inventory information for a + * {@link google.cloud.retail.v2alpha.Product|Product} while respecting the last + * update timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2alpha.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, updates are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * When inventory is updated with + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct}, + * the specified inventory field value(s) will overwrite any existing value(s) + * while ignoring the last update time for this field. Furthermore, the last + * update time for the specified inventory fields will be overwritten to the + * time of the + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * request. + * + * If no inventory fields are set in + * {@link google.cloud.retail.v2alpha.CreateProductRequest.product|CreateProductRequest.product}, + * then any pre-existing inventory information for this product will be used. + * + * If no inventory fields are set in {@link |UpdateProductRequest.set_mask}, + * then any existing inventory information will be preserved. + * + * Pre-existing inventory information can only be updated with + * {@link google.cloud.retail.v2alpha.ProductService.SetInventory|SetInventory}, + * {@link google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * and + * {@link google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.Product} request.inventory + * Required. The inventory information to update. The allowable fields to + * update are: + * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2alpha.Product.availability|Product.availability} + * * {@link google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} + * * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} + * The updated inventory fields must be specified in + * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. + * + * If {@link |SetInventoryRequest.inventory.name} is empty or invalid, an + * INVALID_ARGUMENT error is returned. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2alpha.Product|Product} named in + * {@link google.cloud.retail.v2alpha.Product.name|Product.name}, regardless of + * whether or not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2alpha.Product|Product} to update does not + * have existing inventory information, the provided inventory information + * will be inserted. + * + * If the {@link google.cloud.retail.v2alpha.Product|Product} to update has + * existing inventory information, the provided inventory information will be + * merged while respecting the last update time for each inventory field, + * using the provided or default value for + * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. + * + * The last update time is recorded for the following inventory fields: + * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2alpha.Product.availability|Product.availability} + * * {@link google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} + * * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} + * + * If a full overwrite of inventory information while ignoring timestamps is + * needed, {@link |UpdateProduct} should be invoked instead. + * @param {google.protobuf.FieldMask} request.setMask + * Indicates which inventory fields in the provided + * {@link google.cloud.retail.v2alpha.Product|Product} to update. If not set or set + * with empty paths, all inventory fields will be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.setTime + * The time when the request is issued, used to prevent + * out-of-order updates on inventory fields with the last update time + * recorded. If not provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} with + * name {@link google.cloud.retail.v2alpha.Product.name|Product.name} is not found, + * the inventory update will still be processed and retained for at most 1 day + * until the {@link google.cloud.retail.v2alpha.Product|Product} is created. If set + * to false, an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.setInventory(request); + * const [response] = await operation.promise(); + */ + setInventory( + request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'inventory.name': request.inventory!.name || '', + }); + this.initialize(); + return this.innerApiCalls.setInventory(request, options, callback); + } + /** + * Check the status of the long running operation returned by `setInventory()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkSetInventoryProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkSetInventoryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.SetInventoryResponse, + protos.google.cloud.retail.v2alpha.SetInventoryMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.setInventory, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.SetInventoryResponse, + protos.google.cloud.retail.v2alpha.SetInventoryMetadata + >; + } + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Incrementally adds place IDs to + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2alpha.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, the added place IDs are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * @param {string} request.type + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * + * Supported values: + * + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * + * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * @param {string[]} request.placeIds + * Required. The IDs for this + * {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}, such + * as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery" to be added for this + * {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}. + * Duplicate IDs will be automatically ignored. + * + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * + * If the total number of place IDs exceeds 2000 for this + * {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type} after + * adding, then the update will be rejected. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.addFulfillmentPlaces(request); + * const [response] = await operation.promise(); + */ + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addFulfillmentPlaces(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addFulfillmentPlaces()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkAddFulfillmentPlacesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkAddFulfillmentPlacesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + >; + } + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Incrementally removes place IDs from a + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2alpha.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, the removed place IDs are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * @param {string} request.type + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * + * Supported values: + * + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * + * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * @param {string[]} request.placeIds + * Required. The IDs for this + * {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}, + * such as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery", to be removed for this + * {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}. + * + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.removeFulfillmentPlaces(request); + * const [response] = await operation.promise(); + */ + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeFulfillmentPlaces( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeFulfillmentPlaces()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRemoveFulfillmentPlacesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRemoveFulfillmentPlacesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + >; + } + listProducts( + request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct[], + protos.google.cloud.retail.v2alpha.IListProductsRequest | null, + protos.google.cloud.retail.v2alpha.IListProductsResponse + ] + >; + listProducts( + request: protos.google.cloud.retail.v2alpha.IListProductsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListProductsRequest, + | protos.google.cloud.retail.v2alpha.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IProduct + > + ): void; + listProducts( + request: protos.google.cloud.retail.v2alpha.IListProductsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListProductsRequest, + | protos.google.cloud.retail.v2alpha.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IProduct + > + ): void; + /** + * Gets a list of {@link google.cloud.retail.v2alpha.Product|Product}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2alpha.Product|Product}s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Product|Product}s to + * return. If unspecified, defaults to 100. The maximum allowed value is 1000. + * Values above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. + * * List + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2alpha.Product|Product}s sharing the same + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2alpha.Product|Product}s bundled in a + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2alpha.Product|Product}s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product} or + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND + * error is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2alpha.Product|Product} to return in + * the responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2alpha.Product.name|Product.name} + * * {@link google.cloud.retail.v2alpha.Product.id|Product.id} + * * {@link google.cloud.retail.v2alpha.Product.title|Product.title} + * * {@link google.cloud.retail.v2alpha.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2alpha.Product.images|Product.images} + * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2alpha.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2alpha.Product.name|Product.name} is always returned + * no matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {boolean} request.requireTotalSize + * If true and + * {@link google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is + * empty, + * {@link google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} + * is set to the total count of matched items irrespective of pagination. + * + * Notice that setting this field to true affects the performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.retail.v2alpha.Product}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProductsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProducts( + request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2alpha.IListProductsRequest, + | protos.google.cloud.retail.v2alpha.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IProduct + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListProductsRequest, + | protos.google.cloud.retail.v2alpha.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IProduct + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct[], + protos.google.cloud.retail.v2alpha.IListProductsRequest | null, + protos.google.cloud.retail.v2alpha.IListProductsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProducts(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2alpha.Product|Product}s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Product|Product}s to + * return. If unspecified, defaults to 100. The maximum allowed value is 1000. + * Values above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. + * * List + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2alpha.Product|Product}s sharing the same + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2alpha.Product|Product}s bundled in a + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2alpha.Product|Product}s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product} or + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND + * error is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2alpha.Product|Product} to return in + * the responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2alpha.Product.name|Product.name} + * * {@link google.cloud.retail.v2alpha.Product.id|Product.id} + * * {@link google.cloud.retail.v2alpha.Product.title|Product.title} + * * {@link google.cloud.retail.v2alpha.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2alpha.Product.images|Product.images} + * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2alpha.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2alpha.Product.name|Product.name} is always returned + * no matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {boolean} request.requireTotalSize + * If true and + * {@link google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is + * empty, + * {@link google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} + * is set to the total count of matched items irrespective of pagination. + * + * Notice that setting this field to true affects the performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.retail.v2alpha.Product} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listProductsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProductsStream( + request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProducts.createStream( + this.innerApiCalls.listProducts as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProducts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2alpha.Product|Product}s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Product|Product}s to + * return. If unspecified, defaults to 100. The maximum allowed value is 1000. + * Values above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. + * * List + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2alpha.Product|Product}s sharing the same + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2alpha.Product|Product}s bundled in a + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2alpha.Product|Product}s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2alpha.Product|Product} or + * {@link google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND + * error is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2alpha.Product|Product} to return in + * the responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2alpha.Product.name|Product.name} + * * {@link google.cloud.retail.v2alpha.Product.id|Product.id} + * * {@link google.cloud.retail.v2alpha.Product.title|Product.title} + * * {@link google.cloud.retail.v2alpha.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2alpha.Product.images|Product.images} + * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2alpha.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2alpha.Product.name|Product.name} is always returned + * no matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {boolean} request.requireTotalSize + * If true and + * {@link google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is + * empty, + * {@link google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} + * is set to the total count of matched items irrespective of pagination. + * + * Notice that setting this field to true affects the performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Product]{@link google.cloud.retail.v2alpha.Product}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listProductsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listProductsAsync( + request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProducts.asyncIterate( + this.innerApiCalls['listProducts'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json index 0b6753696ce..97e4f50d366 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json @@ -30,6 +30,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "ListProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "UpdateProduct": { "timeout_millis": 60000, "retry_codes_name": "idempotent", @@ -44,6 +49,21 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "SetInventory": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AddFulfillmentPlaces": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RemoveFulfillmentPlaces": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json index 241ed02fecb..89776f5d72d 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2alpha/catalog.proto", "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts new file mode 100644 index 00000000000..b39709893ae --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -0,0 +1,1203 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/search_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './search_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for search. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * @class + * @memberof v2alpha + */ +export class SearchServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + searchServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SearchServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SearchServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + search: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'results' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.SearchService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.searchServiceStub) { + return this.searchServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.SearchService. + this.searchServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.SearchService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.SearchService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const searchServiceStubMethods = ['search']; + for (const methodName of searchServiceStubMethods) { + const callPromise = this.searchServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.searchServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + search( + request?: protos.google.cloud.retail.v2alpha.ISearchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2alpha.ISearchRequest | null, + protos.google.cloud.retail.v2alpha.ISearchResponse + ] + >; + search( + request: protos.google.cloud.retail.v2alpha.ISearchRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.ISearchRequest, + protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult + > + ): void; + search( + request: protos.google.cloud.retail.v2alpha.ISearchRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.ISearchRequest, + protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult + > + ): void; + /** + * Performs a search. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Product|Product}s to + * return. If unspecified, defaults to a reasonable value. The maximum allowed + * value is 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the + * {@link google.cloud.retail.v2alpha.Product|Product}s deemed by the API as + * relevant) in search results. This field is only considered if + * {@link google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is + * unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2alpha.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See + * {@link google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter} + * for more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold + * The relevance threshold of the search results. + * + * Defaults to + * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, + * which means only the most relevant results are shown, and the least number + * of results are returned. See more details at this [user + * guide](/retail/private/docs/result-size#relevance_thresholding). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes. The attributes + * from all the matching + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s are merged and + * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [SearchResult]{@link google.cloud.retail.v2alpha.SearchResponse.SearchResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + search( + request?: protos.google.cloud.retail.v2alpha.ISearchRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2alpha.ISearchRequest, + protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2alpha.ISearchRequest, + protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2alpha.ISearchRequest | null, + protos.google.cloud.retail.v2alpha.ISearchResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + this.initialize(); + return this.innerApiCalls.search(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Product|Product}s to + * return. If unspecified, defaults to a reasonable value. The maximum allowed + * value is 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the + * {@link google.cloud.retail.v2alpha.Product|Product}s deemed by the API as + * relevant) in search results. This field is only considered if + * {@link google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is + * unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2alpha.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See + * {@link google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter} + * for more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold + * The relevance threshold of the search results. + * + * Defaults to + * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, + * which means only the most relevant results are shown, and the least number + * of results are returned. See more details at this [user + * guide](/retail/private/docs/result-size#relevance_thresholding). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes. The attributes + * from all the matching + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s are merged and + * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SearchResult]{@link google.cloud.retail.v2alpha.SearchResponse.SearchResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchStream( + request?: protos.google.cloud.retail.v2alpha.ISearchRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.search.createStream( + this.innerApiCalls.search as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `search`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2alpha.Product|Product}s to + * return. If unspecified, defaults to a reasonable value. The maximum allowed + * value is 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the + * {@link google.cloud.retail.v2alpha.Product|Product}s deemed by the API as + * relevant) in search results. This field is only considered if + * {@link google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is + * unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2alpha.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See + * {@link google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter} + * for more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold + * The relevance threshold of the search results. + * + * Defaults to + * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, + * which means only the most relevant results are shown, and the least number + * of results are returned. See more details at this [user + * guide](/retail/private/docs/result-size#relevance_thresholding). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes. The attributes + * from all the matching + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s are merged and + * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SearchResult]{@link google.cloud.retail.v2alpha.SearchResponse.SearchResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.searchAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + searchAsync( + request?: protos.google.cloud.retail.v2alpha.ISearchRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.search.asyncIterate( + this.innerApiCalls['search'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.searchServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json new file mode 100644 index 00000000000..27bdbd246c7 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.SearchService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Search": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json new file mode 100644 index 00000000000..89776f5d72d --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index e75b9ef61f4..8e6618c30ff 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -388,7 +388,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent * Required. User event to write. * @param {object} [options] @@ -486,7 +486,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {string} request.userEvent * Required. URL encoded UserEvent proto with a length limit of 2,000,000 * characters. @@ -600,7 +600,7 @@ export class UserEventServiceClient { * @param {string} request.parent * Required. The resource name of the catalog under which the events are * created. The format is - * "projects/${projectId}/locations/global/catalogs/${catalogId}" + * `projects/${projectId}/locations/global/catalogs/${catalogId}` * @param {string} request.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 @@ -776,7 +776,7 @@ export class UserEventServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. "projects/1234/locations/global/catalogs/default_catalog" + * Required. `projects/1234/locations/global/catalogs/default_catalog` * @param {google.cloud.retail.v2alpha.UserEventInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig @@ -929,7 +929,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} request.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 diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json index 241ed02fecb..89776f5d72d 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2alpha/catalog.proto", "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index c5055458e2b..040f46358ee 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -158,6 +158,9 @@ export class CatalogServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), @@ -229,7 +232,12 @@ export class CatalogServiceClient { // Iterate over each of the methods that the service provides // and create an API call method for each. - const catalogServiceStubMethods = ['listCatalogs', 'updateCatalog']; + const catalogServiceStubMethods = [ + 'listCatalogs', + 'updateCatalog', + 'setDefaultBranch', + 'getDefaultBranch', + ]; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( stub => @@ -358,10 +366,7 @@ export class CatalogServiceClient { * exist, a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided - * {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. If not set, will - * only update the - * {@link google.cloud.retail.v2beta.Catalog.product_level_config|Catalog.product_level_config} - * field, which is also the only currently supported field to update. + * {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. @@ -418,6 +423,244 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } + setDefaultBranch( + request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Set a specified branch id as default branch. API methods such as + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search}, + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct}, + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * will treat requests using "default_branch" to the actual branch id set as + * default. + * + * For example, if `projects/* /locations/* /catalogs/* /branches/1` is set as + * default, setting + * {@link google.cloud.retail.v2beta.SearchRequest.branch|SearchRequest.branch} to + * `projects/* /locations/* /catalogs/* /branches/default_branch` is equivalent + * to setting + * {@link google.cloud.retail.v2beta.SearchRequest.branch|SearchRequest.branch} to + * `projects/* /locations/* /catalogs/* /branches/1`. + * + * Using multiple branches can be useful when developers would like + * to have a staging branch to test and verify for future usage. When it + * becomes ready, developers switch on the staging branch using this API while + * keeping using `projects/* /locations/* /catalogs/* /branches/default_branch` + * as {@link google.cloud.retail.v2beta.SearchRequest.branch|SearchRequest.branch} + * to route the traffic to this staging branch. + * + * CAUTION: If you have live predict/search traffic, switching the default + * branch could potentially cause outages if the ID space of the new branch is + * very different from the old one. + * + * More specifically: + * + * * PredictionService will only return product IDs from branch {newBranch}. + * * SearchService will only return product IDs from branch {newBranch} + * (if branch is not explicitly set). + * * UserEventService will only join events with products from branch + * {newBranch}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.branchId + * The final component of the resource name of a branch. + * + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + * @param {string} request.note + * Some note on this request, this can be retrieved by + * {@link google.cloud.retail.v2beta.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} + * before next valid default branch set occurs. + * + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setDefaultBranch(request); + */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultBranch(request, options, callback); + } + getDefaultBranch( + request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + getDefaultBranch( + request: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2beta.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2beta.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getDefaultBranch(request); + */ + getDefaultBranch( + request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.getDefaultBranch(request, options, callback); + } listCatalogs( request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, @@ -669,6 +912,73 @@ export class CatalogServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + /** * Return a fully-qualified catalog resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json index 53824c46752..d9d6301b0d5 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json @@ -29,6 +29,16 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "SetDefaultBranch": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetDefaultBranch": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json index d02281cd8fb..4ec26e01ef2 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2beta/catalog.proto", "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts new file mode 100644 index 00000000000..044499c25ea --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -0,0 +1,791 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/completion_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './completion_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Auto-completion service for retail. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * @class + * @memberof v2beta + */ +export class CompletionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + completionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CompletionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CompletionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importCompletionDataResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.ImportCompletionDataResponse' + ) as gax.protobuf.Type; + const importCompletionDataMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.ImportMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + importCompletionData: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importCompletionDataResponse.decode.bind(importCompletionDataResponse), + importCompletionDataMetadata.decode.bind(importCompletionDataMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.CompletionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.completionServiceStub) { + return this.completionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.CompletionService. + this.completionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.CompletionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.CompletionService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const completionServiceStubMethods = [ + 'completeQuery', + 'importCompletionData', + ]; + for (const methodName of completionServiceStubMethods) { + const callPromise = this.completionServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.longrunning[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.completionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + completeQuery( + request?: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + protos.google.cloud.retail.v2beta.ICompleteQueryRequest | undefined, + {} | undefined + ] + >; + completeQuery( + request: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + | protos.google.cloud.retail.v2beta.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeQuery( + request: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + | protos.google.cloud.retail.v2beta.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Completes the specified prefix with keyword suggestions. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Required. Catalog for which the completion is performed. + * + * Full resource name of catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.query + * Required. The query used to generate suggestions. + * + * The maximum number of allowed characters is 255. + * @param {string} request.visitorId + * 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 logs in or 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. + * @param {string[]} request.languageCodes + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * + * The maximum number of allowed characters is 255. + * Only "en-US" is currently supported. + * @param {string} request.deviceType + * The device type context for completion suggestions. + * It is useful to apply different suggestions on different device types, e.g. + * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * types. + * + * Supported formats: + * + * * UNKNOWN_DEVICE_TYPE + * + * * DESKTOP + * + * * MOBILE + * + * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * @param {string} request.dataset + * Determines which dataset to use for fetching completion. "user-data" will + * use the imported dataset through + * {@link google.cloud.retail.v2beta.CompletionService.ImportCompletionData|CompletionService.ImportCompletionData}. + * "cloud-retail" will use the dataset generated by cloud retail based on user + * events. If leave empty, it will use the "user-data". + * + * Current supported values: + * + * * user-data + * + * * cloud-retail + * This option is not automatically enabled. Before using cloud-retail, + * contact retail-search-support@google.com first. + * @param {number} request.maxSuggestions + * Completion max suggestions. + * + * The maximum allowed max suggestions is 20. The default value is 20. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompleteQueryResponse]{@link google.cloud.retail.v2beta.CompleteQueryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.completeQuery(request); + */ + completeQuery( + request?: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + | protos.google.cloud.retail.v2beta.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + | protos.google.cloud.retail.v2beta.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + protos.google.cloud.retail.v2beta.ICompleteQueryRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.completeQuery(request, options, callback); + } + + importCompletionData( + request?: protos.google.cloud.retail.v2beta.IImportCompletionDataRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importCompletionData( + request: protos.google.cloud.retail.v2beta.IImportCompletionDataRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importCompletionData( + request: protos.google.cloud.retail.v2beta.IImportCompletionDataRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Bulk import of processed completion dataset. + * + * Request processing may be synchronous. Partial updating is not supported. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog which the suggestions dataset belongs to. + * + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2beta.CompletionDataInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importCompletionData(request); + * const [response] = await operation.promise(); + */ + importCompletionData( + request?: protos.google.cloud.retail.v2beta.IImportCompletionDataRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importCompletionData(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importCompletionData()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportCompletionDataProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportCompletionDataProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.ImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importCompletionData, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.ImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + >; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.completionServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json b/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json new file mode 100644 index 00000000000..f7f540708ce --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.CompletionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CompleteQuery": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportCompletionData": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json new file mode 100644 index 00000000000..4ec26e01ef2 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json index a3b0a9c8a80..e48d92e5b5d 100644 --- a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json @@ -15,6 +15,16 @@ "updateCatalog" ] }, + "SetDefaultBranch": { + "methods": [ + "setDefaultBranch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "getDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -32,6 +42,16 @@ "updateCatalog" ] }, + "SetDefaultBranch": { + "methods": [ + "setDefaultBranch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "getDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -43,6 +63,40 @@ } } }, + "CompletionService": { + "clients": { + "grpc": { + "libraryClient": "CompletionServiceClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "importCompletionData" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CompletionServiceClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "completeQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "importCompletionData" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -96,6 +150,28 @@ "methods": [ "importProducts" ] + }, + "SetInventory": { + "methods": [ + "setInventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "addFulfillmentPlaces" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "removeFulfillmentPlaces" + ] + }, + "ListProducts": { + "methods": [ + "listProducts", + "listProductsStream", + "listProductsAsync" + ] } } }, @@ -126,6 +202,56 @@ "methods": [ "importProducts" ] + }, + "SetInventory": { + "methods": [ + "setInventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "addFulfillmentPlaces" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "removeFulfillmentPlaces" + ] + }, + "ListProducts": { + "methods": [ + "listProducts", + "listProductsStream", + "listProductsAsync" + ] + } + } + } + } + }, + "SearchService": { + "clients": { + "grpc": { + "libraryClient": "SearchServiceClient", + "rpcs": { + "Search": { + "methods": [ + "search", + "searchStream", + "searchAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SearchServiceClient", + "rpcs": { + "Search": { + "methods": [ + "search", + "searchStream", + "searchAsync" + ] } } } diff --git a/packages/google-cloud-retail/src/v2beta/index.ts b/packages/google-cloud-retail/src/v2beta/index.ts index dbfefa59d67..c0d103f8c56 100644 --- a/packages/google-cloud-retail/src/v2beta/index.ts +++ b/packages/google-cloud-retail/src/v2beta/index.ts @@ -17,6 +17,8 @@ // ** All changes to this file may be overwritten. ** export {CatalogServiceClient} from './catalog_service_client'; +export {CompletionServiceClient} from './completion_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; +export {SearchServiceClient} from './search_service_client'; export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 19c31eef639..709a2949b21 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -323,30 +323,10 @@ export class PredictionServiceClient { * @param {string} request.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 ID of the Recommendations AI placement. Before you can request + * predictions from your model, you must create at least one placement for it. + * For more information, see [Managing + * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). * * The full list of available placements can be seen at * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements @@ -373,6 +353,9 @@ export class PredictionServiceClient { * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings * with a size limit of 1,000 characters. * + * Note: "Recently viewed" models don't support tag filtering at the + * moment. + * * * filterOutOfStockItems. Restricts predictions to products that do not * have a * stockState value of OUT_OF_STOCK. @@ -407,16 +390,34 @@ export class PredictionServiceClient { * * `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. + * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-price-reranking', 'low-price-reranking', + * 'medium-price-reranking', 'high-price-reranking'}. This gives + * request-level control and adjusts prediction results based on product + * price. + * * `diversityLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-diversity', 'low-diversity', + * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + * request-level control and adjusts prediction results based on product + * category. * @param {number[]} request.labels - * The labels for the predict request. + * The labels applied to a resource must meet the following requirements: * - * * 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. + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters, and cannot be empty. Values can be empty, and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. * - * See https://goo.gl/xmQnxf for more information on and examples of labels. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json index d02281cd8fb..4ec26e01ef2 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2beta/catalog.proto", "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index f5a0487a068..97b4c27dc76 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -24,8 +24,12 @@ import { Descriptors, ClientOptions, LROperation, + PaginationCallback, + GaxCall, } from 'google-gax'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -168,6 +172,17 @@ export class ProductServiceClient { ), }; + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listProducts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); // This API contains "long-running operations", which return a @@ -186,6 +201,24 @@ export class ProductServiceClient { const importProductsMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2beta.ImportMetadata' ) as gax.protobuf.Type; + const setInventoryResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.SetInventoryResponse' + ) as gax.protobuf.Type; + const setInventoryMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.SetInventoryMetadata' + ) as gax.protobuf.Type; + const addFulfillmentPlacesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse' + ) as gax.protobuf.Type; + const addFulfillmentPlacesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata' + ) as gax.protobuf.Type; + const removeFulfillmentPlacesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse' + ) as gax.protobuf.Type; + const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -193,6 +226,25 @@ export class ProductServiceClient { importProductsResponse.decode.bind(importProductsResponse), importProductsMetadata.decode.bind(importProductsMetadata) ), + setInventory: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setInventoryResponse.decode.bind(setInventoryResponse), + setInventoryMetadata.decode.bind(setInventoryMetadata) + ), + addFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addFulfillmentPlacesResponse.decode.bind(addFulfillmentPlacesResponse), + addFulfillmentPlacesMetadata.decode.bind(addFulfillmentPlacesMetadata) + ), + removeFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeFulfillmentPlacesResponse.decode.bind( + removeFulfillmentPlacesResponse + ), + removeFulfillmentPlacesMetadata.decode.bind( + removeFulfillmentPlacesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -247,9 +299,13 @@ export class ProductServiceClient { const productServiceStubMethods = [ 'createProduct', 'getProduct', + 'listProducts', 'updateProduct', 'deleteProduct', 'importProducts', + 'setInventory', + 'addFulfillmentPlaces', + 'removeFulfillmentPlaces', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -266,7 +322,10 @@ export class ProductServiceClient { } ); - const descriptor = this.descriptors.longrunning[methodName] || undefined; + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -370,7 +429,7 @@ export class ProductServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. * @param {google.cloud.retail.v2beta.Product} request.product * Required. The {@link google.cloud.retail.v2beta.Product|Product} to create. * @param {string} request.productId @@ -477,7 +536,7 @@ export class ProductServiceClient { * @param {string} request.name * Required. Full resource name of * {@link google.cloud.retail.v2beta.Product|Product}, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to access the * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not @@ -580,7 +639,9 @@ export class ProductServiceClient { * it exists, a PERMISSION_DENIED error is returned. * * If the {@link google.cloud.retail.v2beta.Product|Product} to update does not - * exist, a NOT_FOUND error is returned. + * exist and + * {@link google.cloud.retail.v2beta.UpdateProductRequest.allow_missing|allow_missing} + * is not set, a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided * {@link google.cloud.retail.v2beta.Product|Product} to update. The immutable and @@ -589,6 +650,10 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} is + * not found, a new {@link google.cloud.retail.v2beta.Product|Product} will be + * created. In this situation, `update_mask` is ignored. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -681,7 +746,7 @@ export class ProductServiceClient { * @param {string} request.name * Required. Full resource name of * {@link google.cloud.retail.v2beta.Product|Product}, such as - * "projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id". + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to delete the * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not @@ -689,6 +754,18 @@ export class ProductServiceClient { * * If the {@link google.cloud.retail.v2beta.Product|Product} to delete does not * exist, a NOT_FOUND error is returned. + * + * The {@link google.cloud.retail.v2beta.Product|Product} to delete can neither be + * a + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product} member nor a + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product} with more than one + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variants}. Otherwise, an + * INVALID_ARGUMENT error is returned. + * + * All inventory information for the named + * {@link google.cloud.retail.v2beta.Product|Product} will be deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -792,10 +869,20 @@ export class ProductServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. - * "projects/1234/locations/global/catalogs/default_catalog/branches/default_branch" + * `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. + * @param {string} request.requestId + * Unique identifier provided by client, within the ancestor + * dataset scope. Ensures idempotency and used for request deduplication. + * Server-generated if unspecified. Up to 128 characters long and must match + * the pattern: "{@link |a-zA-Z0-9_]+". This is returned as [Operation.name} in + * {@link google.cloud.retail.v2beta.ImportMetadata|ImportMetadata}. + * + * Only supported when + * {@link google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. * @param {google.cloud.retail.v2beta.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig @@ -803,6 +890,20 @@ export class ProductServiceClient { * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided imported 'products' to update. If * not set, will by default update all fields. + * @param {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode} request.reconciliationMode + * The mode of reconciliation between existing products and the products to be + * imported. Defaults to + * {@link google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Only supported when + * {@link google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -901,6 +1002,1052 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.ImportMetadata >; } + setInventory( + request?: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setInventory( + request: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setInventory( + request: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates inventory information for a + * {@link google.cloud.retail.v2beta.Product|Product} while respecting the last + * update timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2beta.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, updates are not immediately manifested in the + * {@link google.cloud.retail.v2beta.Product|Product} queried by + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * + * When inventory is updated with + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct}, + * the specified inventory field value(s) will overwrite any existing value(s) + * while ignoring the last update time for this field. Furthermore, the last + * update time for the specified inventory fields will be overwritten to the + * time of the + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} or + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct} + * request. + * + * If no inventory fields are set in + * {@link google.cloud.retail.v2beta.CreateProductRequest.product|CreateProductRequest.product}, + * then any pre-existing inventory information for this product will be used. + * + * If no inventory fields are set in {@link |UpdateProductRequest.set_mask}, + * then any existing inventory information will be preserved. + * + * Pre-existing inventory information can only be updated with + * {@link google.cloud.retail.v2beta.ProductService.SetInventory|SetInventory}, + * {@link google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * and + * {@link google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.Product} request.inventory + * Required. The inventory information to update. The allowable fields to + * update are: + * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2beta.Product.availability|Product.availability} + * * {@link google.cloud.retail.v2beta.Product.available_quantity|Product.available_quantity} + * * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info} + * The updated inventory fields must be specified in + * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. + * + * If {@link |SetInventoryRequest.inventory.name} is empty or invalid, an + * INVALID_ARGUMENT error is returned. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2beta.Product|Product} named in + * {@link google.cloud.retail.v2beta.Product.name|Product.name}, regardless of + * whether or not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2beta.Product|Product} to update does not + * have existing inventory information, the provided inventory information + * will be inserted. + * + * If the {@link google.cloud.retail.v2beta.Product|Product} to update has existing + * inventory information, the provided inventory information will be merged + * while respecting the last update time for each inventory field, using the + * provided or default value for + * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. + * + * The last update time is recorded for the following inventory fields: + * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2beta.Product.availability|Product.availability} + * * {@link google.cloud.retail.v2beta.Product.available_quantity|Product.available_quantity} + * * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info} + * + * If a full overwrite of inventory information while ignoring timestamps is + * needed, {@link |UpdateProduct} should be invoked instead. + * @param {google.protobuf.FieldMask} request.setMask + * Indicates which inventory fields in the provided + * {@link google.cloud.retail.v2beta.Product|Product} to update. If not set or set + * with empty paths, all inventory fields will be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.setTime + * The time when the request is issued, used to prevent + * out-of-order updates on inventory fields with the last update time + * recorded. If not provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} with + * name {@link google.cloud.retail.v2beta.Product.name|Product.name} is not found, + * the inventory update will still be processed and retained for at most 1 day + * until the {@link google.cloud.retail.v2beta.Product|Product} is created. If set + * to false, an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2beta.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.setInventory(request); + * const [response] = await operation.promise(); + */ + setInventory( + request?: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'inventory.name': request.inventory!.name || '', + }); + this.initialize(); + return this.innerApiCalls.setInventory(request, options, callback); + } + /** + * Check the status of the long running operation returned by `setInventory()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkSetInventoryProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkSetInventoryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.SetInventoryResponse, + protos.google.cloud.retail.v2beta.SetInventoryMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.setInventory, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.SetInventoryResponse, + protos.google.cloud.retail.v2beta.SetInventoryMetadata + >; + } + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Incrementally adds place IDs to + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2beta.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, the added place IDs are not immediately manifested in the + * {@link google.cloud.retail.v2beta.Product|Product} queried by + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * @param {string} request.type + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * + * Supported values: + * + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * + * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * @param {string[]} request.placeIds + * Required. The IDs for this + * {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type|type}, such + * as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery" to be added for this + * {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type|type}. + * Duplicate IDs will be automatically ignored. + * + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * + * If the total number of place IDs exceeds 2000 for this + * {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type|type} after + * adding, then the update will be rejected. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * {@link google.cloud.retail.v2beta.Product|Product} is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2beta.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.addFulfillmentPlaces(request); + * const [response] = await operation.promise(); + */ + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addFulfillmentPlaces(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addFulfillmentPlaces()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkAddFulfillmentPlacesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkAddFulfillmentPlacesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + >; + } + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Incrementally removes place IDs from a + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2beta.Product|Product} to exist before updating + * fulfillment information. If the request is valid, the update will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, the removed place IDs are not immediately manifested in the + * {@link google.cloud.retail.v2beta.Product|Product} queried by + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * @param {string} request.type + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * + * Supported values: + * + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * + * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * @param {string[]} request.placeIds + * Required. The IDs for this + * {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type|type}, + * such as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery", to be removed for this + * {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type|type}. + * + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * {@link google.cloud.retail.v2beta.Product|Product} is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2beta.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.removeFulfillmentPlaces(request); + * const [response] = await operation.promise(); + */ + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeFulfillmentPlaces( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeFulfillmentPlaces()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRemoveFulfillmentPlacesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRemoveFulfillmentPlacesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + >; + } + listProducts( + request?: protos.google.cloud.retail.v2beta.IListProductsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct[], + protos.google.cloud.retail.v2beta.IListProductsRequest | null, + protos.google.cloud.retail.v2beta.IListProductsResponse + ] + >; + listProducts( + request: protos.google.cloud.retail.v2beta.IListProductsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListProductsRequest, + | protos.google.cloud.retail.v2beta.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IProduct + > + ): void; + listProducts( + request: protos.google.cloud.retail.v2beta.IListProductsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListProductsRequest, + | protos.google.cloud.retail.v2beta.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IProduct + > + ): void; + /** + * Gets a list of {@link google.cloud.retail.v2beta.Product|Product}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2beta.Product|Product}s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Product|Product}s to return. + * If unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2beta.ListProductsRequest.filter|filter} is unset. + * * List + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2beta.Product|Product}s sharing the same + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2beta.Product|Product}s bundled in a + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2beta.Product|Product}s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product} or + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product} does not exist, a NOT_FOUND + * error is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2beta.Product|Product} to return in + * the responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2beta.Product.name|Product.name} + * * {@link google.cloud.retail.v2beta.Product.id|Product.id} + * * {@link google.cloud.retail.v2beta.Product.title|Product.title} + * * {@link google.cloud.retail.v2beta.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2beta.Product.images|Product.images} + * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2beta.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2beta.Product.name|Product.name} is always returned + * no matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.retail.v2beta.Product}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProductsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProducts( + request?: protos.google.cloud.retail.v2beta.IListProductsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2beta.IListProductsRequest, + | protos.google.cloud.retail.v2beta.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IProduct + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2beta.IListProductsRequest, + | protos.google.cloud.retail.v2beta.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IProduct + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct[], + protos.google.cloud.retail.v2beta.IListProductsRequest | null, + protos.google.cloud.retail.v2beta.IListProductsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProducts(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2beta.Product|Product}s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Product|Product}s to return. + * If unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2beta.ListProductsRequest.filter|filter} is unset. + * * List + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2beta.Product|Product}s sharing the same + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2beta.Product|Product}s bundled in a + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2beta.Product|Product}s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product} or + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product} does not exist, a NOT_FOUND + * error is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2beta.Product|Product} to return in + * the responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2beta.Product.name|Product.name} + * * {@link google.cloud.retail.v2beta.Product.id|Product.id} + * * {@link google.cloud.retail.v2beta.Product.title|Product.title} + * * {@link google.cloud.retail.v2beta.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2beta.Product.images|Product.images} + * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2beta.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2beta.Product.name|Product.name} is always returned + * no matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.retail.v2beta.Product} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listProductsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProductsStream( + request?: protos.google.cloud.retail.v2beta.IListProductsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProducts.createStream( + this.innerApiCalls.listProducts as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProducts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * + * If the caller does not have permission to list + * {@link google.cloud.retail.v2beta.Product|Product}s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Product|Product}s to return. + * If unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * + * If this field is negative, an INVALID_ARGUMENT error is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {string} request.filter + * A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2beta.ListProductsRequest.filter|filter} is unset. + * * List + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|Product.Type.VARIANT} + * {@link google.cloud.retail.v2beta.Product|Product}s sharing the same + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product}. For example: + * `primary_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2beta.Product|Product}s bundled in a + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product}. + * For example: + * `collection_product_id = "some_product_id"` + * * List {@link google.cloud.retail.v2beta.Product|Product}s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * + * If the specified + * {@link google.cloud.retail.v2beta.Product.Type.PRIMARY|Product.Type.PRIMARY} + * {@link google.cloud.retail.v2beta.Product|Product} or + * {@link google.cloud.retail.v2beta.Product.Type.COLLECTION|Product.Type.COLLECTION} + * {@link google.cloud.retail.v2beta.Product|Product} does not exist, a NOT_FOUND + * error is returned. + * @param {google.protobuf.FieldMask} request.readMask + * The fields of {@link google.cloud.retail.v2beta.Product|Product} to return in + * the responses. If not set or empty, the following fields are returned: + * + * * {@link google.cloud.retail.v2beta.Product.name|Product.name} + * * {@link google.cloud.retail.v2beta.Product.id|Product.id} + * * {@link google.cloud.retail.v2beta.Product.title|Product.title} + * * {@link google.cloud.retail.v2beta.Product.uri|Product.uri} + * * {@link google.cloud.retail.v2beta.Product.images|Product.images} + * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} + * * {@link google.cloud.retail.v2beta.Product.brands|Product.brands} + * + * If "*" is provided, all fields are returned. + * {@link google.cloud.retail.v2beta.Product.name|Product.name} is always returned + * no matter what mask is set. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Product]{@link google.cloud.retail.v2beta.Product}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listProductsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listProductsAsync( + request?: protos.google.cloud.retail.v2beta.IListProductsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProducts.asyncIterate( + this.innerApiCalls['listProducts'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json index 50b700e6528..bc6eb0c920c 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json @@ -30,6 +30,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "ListProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "UpdateProduct": { "timeout_millis": 60000, "retry_codes_name": "idempotent", @@ -44,6 +49,21 @@ "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "SetInventory": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AddFulfillmentPlaces": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RemoveFulfillmentPlaces": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json index d02281cd8fb..4ec26e01ef2 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2beta/catalog.proto", "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts new file mode 100644 index 00000000000..c242dc0de44 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -0,0 +1,1173 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/search_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './search_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for search. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * @class + * @memberof v2beta + */ +export class SearchServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + searchServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SearchServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SearchServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + branchPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + search: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'results' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.SearchService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.searchServiceStub) { + return this.searchServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.SearchService. + this.searchServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.SearchService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.SearchService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const searchServiceStubMethods = ['search']; + for (const methodName of searchServiceStubMethods) { + const callPromise = this.searchServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.searchServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + search( + request?: protos.google.cloud.retail.v2beta.ISearchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2beta.ISearchRequest | null, + protos.google.cloud.retail.v2beta.ISearchResponse + ] + >; + search( + request: protos.google.cloud.retail.v2beta.ISearchRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.ISearchRequest, + protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult + > + ): void; + search( + request: protos.google.cloud.retail.v2beta.ISearchRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.ISearchRequest, + protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult + > + ): void; + /** + * Performs a search. + * + * This feature is only available for users who have Retail Search enabled. + * Contact Retail Support (retail-search-support@google.com) if you are + * interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2beta.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Product|Product}s to return. + * If unspecified, defaults to a reasonable value. The maximum allowed value + * is 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the {@link google.cloud.retail.v2beta.Product|Product}s + * deemed by the API as relevant) in search results. This field is only + * considered if + * {@link google.cloud.retail.v2beta.SearchRequest.page_token|page_token} is unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2beta.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See {@link google.cloud.retail.v2beta.SearchRequest.filter|SearchRequest.filter} + * for more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s attributes. The attributes + * from all the matching + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s are merged and + * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2beta.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [SearchResult]{@link google.cloud.retail.v2beta.SearchResponse.SearchResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + search( + request?: protos.google.cloud.retail.v2beta.ISearchRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2beta.ISearchRequest, + protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2beta.ISearchRequest, + protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2beta.ISearchRequest | null, + protos.google.cloud.retail.v2beta.ISearchResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + this.initialize(); + return this.innerApiCalls.search(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2beta.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Product|Product}s to return. + * If unspecified, defaults to a reasonable value. The maximum allowed value + * is 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the {@link google.cloud.retail.v2beta.Product|Product}s + * deemed by the API as relevant) in search results. This field is only + * considered if + * {@link google.cloud.retail.v2beta.SearchRequest.page_token|page_token} is unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2beta.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See {@link google.cloud.retail.v2beta.SearchRequest.filter|SearchRequest.filter} + * for more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s attributes. The attributes + * from all the matching + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s are merged and + * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2beta.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SearchResult]{@link google.cloud.retail.v2beta.SearchResponse.SearchResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchStream( + request?: protos.google.cloud.retail.v2beta.ISearchRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.search.createStream( + this.innerApiCalls.search as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `search`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.placement + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the set of models that will be used to make + * the search. + * + * We currently support one placement with the following ID: + * + * * `default_search`. + * @param {string} request.branch + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + * @param {string} request.query + * Raw search query. + * @param {string} request.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 logs in or 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. + * @param {google.cloud.retail.v2beta.UserInfo} request.userInfo + * User information. + * @param {number} request.pageSize + * Maximum number of {@link google.cloud.retail.v2beta.Product|Product}s to return. + * If unspecified, defaults to a reasonable value. The maximum allowed value + * is 120. Values above 120 will be coerced to 120. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.pageToken + * A page token + * {@link google.cloud.retail.v2beta.SearchResponse.next_page_token|SearchResponse.next_page_token}, + * received from a previous + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search} + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search} + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + * @param {number} request.offset + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the {@link google.cloud.retail.v2beta.Product|Product}s + * deemed by the API as relevant) in search results. This field is only + * considered if + * {@link google.cloud.retail.v2beta.SearchRequest.page_token|page_token} is unset. + * + * If this field is negative, an INVALID_ARGUMENT is returned. + * @param {string} request.filter + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](/retail/private/docs/filter-and-order#filter). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {string} request.canonicalFilter + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * {@link google.cloud.retail.v2beta.SearchRequest.canonical_filter|SearchRequest.canonical_filter} + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * + * See {@link google.cloud.retail.v2beta.SearchRequest.filter|SearchRequest.filter} + * for more details about filter syntax. + * @param {string} request.orderBy + * The order in which products are returned. Products can be ordered by + * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](/retail/private/docs/filter-and-order#order). + * + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + * @param {number[]} request.facetSpecs + * Facet specifications for faceted search. If empty, no facets are returned. + * + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * + * This feature requires additional allowlisting. Contact Retail Support + * (retail-search-support@google.com) if you are interested in using dynamic + * facet feature. + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec + * Boost specification to boost certain products. See more details at this + * [user guide](/retail/private/docs/boosting). + * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](/retail/private/docs/result-size#query_expansion). + * @param {string[]} request.variantRollupKeys + * The keys to fetch and rollup the matching + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s attributes. The attributes + * from all the matching + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s are merged and + * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * + * For + * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info}, + * a fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * + * Supported keys are: + * + * * colorFamilies + * * price + * * originalPrice + * * discount + * * attributes.key, where key is any key in the + * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. + * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. + * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. + * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. + * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. + * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. + * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. + * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. + * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. + * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type + * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * @param {string[]} request.pageCategories + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * {@link google.cloud.retail.v2beta.UserEvent.page_categories|UserEvent.page_categories}; + * + * 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"]. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SearchResult]{@link google.cloud.retail.v2beta.SearchResponse.SearchResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.searchAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + searchAsync( + request?: protos.google.cloud.retail.v2beta.ISearchRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + placement: request.placement || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.search.asyncIterate( + this.innerApiCalls['search'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified branch resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @returns {string} Resource name string. + */ + branchPath( + project: string, + location: string, + catalog: string, + branch: string + ) { + return this.pathTemplates.branchPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + }); + } + + /** + * Parse the project from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).project; + } + + /** + * Parse the location from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).location; + } + + /** + * Parse the catalog from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).catalog; + } + + /** + * Parse the branch from Branch resource. + * + * @param {string} branchName + * A fully-qualified path representing Branch resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromBranchName(branchName: string) { + return this.pathTemplates.branchPathTemplate.match(branchName).branch; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.searchServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client_config.json b/packages/google-cloud-retail/src/v2beta/search_service_client_config.json new file mode 100644 index 00000000000..15f027a24ba --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/search_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.SearchService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Search": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json new file mode 100644 index 00000000000..4ec26e01ef2 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 09bc567fce5..72340c9d9a4 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -388,7 +388,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {google.cloud.retail.v2beta.UserEvent} request.userEvent * Required. User event to write. * @param {object} [options] @@ -486,7 +486,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {string} request.userEvent * Required. URL encoded UserEvent proto with a length limit of 2,000,000 * characters. @@ -600,7 +600,7 @@ export class UserEventServiceClient { * @param {string} request.parent * Required. The resource name of the catalog under which the events are * created. The format is - * "projects/${projectId}/locations/global/catalogs/${catalogId}" + * `projects/${projectId}/locations/global/catalogs/${catalogId}` * @param {string} request.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 @@ -776,7 +776,7 @@ export class UserEventServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. "projects/1234/locations/global/catalogs/default_catalog" + * Required. `projects/1234/locations/global/catalogs/default_catalog` * @param {google.cloud.retail.v2beta.UserEventInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig @@ -929,7 +929,7 @@ export class UserEventServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as - * "projects/1234/locations/global/catalogs/default_catalog". + * `projects/1234/locations/global/catalogs/default_catalog`. * @param {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope} request.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 diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json index d02281cd8fb..4ec26e01ef2 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json @@ -2,11 +2,14 @@ "../../protos/google/cloud/retail/v2beta/catalog.proto", "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js index 78bdfc2bba8..4c65a68f89c 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js @@ -21,8 +21,10 @@ const retail = require('@google-cloud/retail'); function main() { const catalogServiceClient = new retail.CatalogServiceClient(); + const completionServiceClient = new retail.CompletionServiceClient(); const predictionServiceClient = new retail.PredictionServiceClient(); const productServiceClient = new retail.ProductServiceClient(); + const searchServiceClient = new retail.SearchServiceClient(); const userEventServiceClient = new retail.UserEventServiceClient(); } diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts index e0f415ea4df..6dbf8105ff8 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts @@ -18,8 +18,10 @@ import { CatalogServiceClient, + CompletionServiceClient, PredictionServiceClient, ProductServiceClient, + SearchServiceClient, UserEventServiceClient, } from '@google-cloud/retail'; @@ -27,12 +29,18 @@ import { function doStuffWithCatalogServiceClient(client: CatalogServiceClient) { client.close(); } +function doStuffWithCompletionServiceClient(client: CompletionServiceClient) { + client.close(); +} function doStuffWithPredictionServiceClient(client: PredictionServiceClient) { client.close(); } function doStuffWithProductServiceClient(client: ProductServiceClient) { client.close(); } +function doStuffWithSearchServiceClient(client: SearchServiceClient) { + client.close(); +} function doStuffWithUserEventServiceClient(client: UserEventServiceClient) { client.close(); } @@ -42,12 +50,18 @@ function main() { const catalogServiceClient = new CatalogServiceClient(); doStuffWithCatalogServiceClient(catalogServiceClient); // check that the client instance can be created + const completionServiceClient = new CompletionServiceClient(); + doStuffWithCompletionServiceClient(completionServiceClient); + // check that the client instance can be created const predictionServiceClient = new PredictionServiceClient(); doStuffWithPredictionServiceClient(predictionServiceClient); // check that the client instance can be created const productServiceClient = new ProductServiceClient(); doStuffWithProductServiceClient(productServiceClient); // check that the client instance can be created + const searchServiceClient = new SearchServiceClient(); + doStuffWithSearchServiceClient(searchServiceClient); + // check that the client instance can be created const userEventServiceClient = new UserEventServiceClient(); doStuffWithUserEventServiceClient(userEventServiceClient); } diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index 154e29b2e4a..6819dea39cf 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -309,6 +309,228 @@ describe('v2.CatalogServiceClient', () => { }); }); + describe('setDefaultBranch', () => { + it('invokes setDefaultBranch without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); + const [response] = await client.setDefaultBranch(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultBranch without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.setDefaultBranch = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setDefaultBranch( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setDefaultBranch with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultBranch = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.setDefaultBranch(request), expectedError); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getDefaultBranch', () => { + it('invokes getDefaultBranch without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.GetDefaultBranchResponse() + ); + client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); + const [response] = await client.getDefaultBranch(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getDefaultBranch without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.GetDefaultBranchResponse() + ); + client.innerApiCalls.getDefaultBranch = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDefaultBranch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IGetDefaultBranchResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getDefaultBranch with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDefaultBranch = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getDefaultBranch(request), expectedError); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listCatalogs', () => { it('invokes listCatalogs without error', async () => { const client = new catalogserviceModule.v2.CatalogServiceClient({ @@ -587,6 +809,82 @@ describe('v2.CatalogServiceClient', () => { }); describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 2c29e1bed77..ffb098d3ae0 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -309,6 +309,228 @@ describe('v2alpha.CatalogServiceClient', () => { }); }); + describe('setDefaultBranch', () => { + it('invokes setDefaultBranch without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); + const [response] = await client.setDefaultBranch(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultBranch without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.setDefaultBranch = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setDefaultBranch( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setDefaultBranch with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultBranch = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.setDefaultBranch(request), expectedError); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getDefaultBranch', () => { + it('invokes getDefaultBranch without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() + ); + client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); + const [response] = await client.getDefaultBranch(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getDefaultBranch without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() + ); + client.innerApiCalls.getDefaultBranch = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDefaultBranch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getDefaultBranch with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDefaultBranch = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getDefaultBranch(request), expectedError); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listCatalogs', () => { it('invokes listCatalogs without error', async () => { const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ @@ -593,6 +815,82 @@ describe('v2alpha.CatalogServiceClient', () => { }); describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 6433b142a5a..b572de9e6d6 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -309,6 +309,228 @@ describe('v2beta.CatalogServiceClient', () => { }); }); + describe('setDefaultBranch', () => { + it('invokes setDefaultBranch without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); + const [response] = await client.setDefaultBranch(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultBranch without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.setDefaultBranch = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setDefaultBranch( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setDefaultBranch with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultBranch = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.setDefaultBranch(request), expectedError); + assert( + (client.innerApiCalls.setDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getDefaultBranch', () => { + it('invokes getDefaultBranch without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetDefaultBranchResponse() + ); + client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); + const [response] = await client.getDefaultBranch(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getDefaultBranch without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetDefaultBranchResponse() + ); + client.innerApiCalls.getDefaultBranch = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDefaultBranch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getDefaultBranch with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getDefaultBranch = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getDefaultBranch(request), expectedError); + assert( + (client.innerApiCalls.getDefaultBranch as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listCatalogs', () => { it('invokes listCatalogs without error', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ @@ -593,6 +815,82 @@ describe('v2beta.CatalogServiceClient', () => { }); describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts new file mode 100644 index 00000000000..68dd6788fe6 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -0,0 +1,625 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as completionserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2.CompletionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + completionserviceModule.v2.CompletionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + completionserviceModule.v2.CompletionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = completionserviceModule.v2.CompletionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new completionserviceModule.v2.CompletionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + await client.initialize(); + assert(client.completionServiceStub); + }); + + it('has close method', () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('completeQuery', () => { + it('invokes completeQuery without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.CompleteQueryResponse() + ); + client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); + const [response] = await client.completeQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes completeQuery without error using callback', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.CompleteQueryResponse() + ); + client.innerApiCalls.completeQuery = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeQuery( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.ICompleteQueryResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes completeQuery with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeQuery = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.completeQuery(request), expectedError); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('importCompletionData', () => { + it('invokes importCompletionData without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importCompletionData = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importCompletionData(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importCompletionData without error using callback', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importCompletionData = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importCompletionData( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IImportCompletionDataResponse, + protos.google.cloud.retail.v2.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importCompletionData with call error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importCompletionData = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importCompletionData(request), expectedError); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importCompletionData with LRO error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importCompletionData = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importCompletionData(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportCompletionDataProgress without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportCompletionDataProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportCompletionDataProgress with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportCompletionDataProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts new file mode 100644 index 00000000000..7a9fa4c4fd1 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -0,0 +1,637 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as completionserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2alpha.CompletionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + completionserviceModule.v2alpha.CompletionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + completionserviceModule.v2alpha.CompletionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = completionserviceModule.v2alpha.CompletionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new completionserviceModule.v2alpha.CompletionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + await client.initialize(); + assert(client.completionServiceStub); + }); + + it('has close method', () => { + const client = new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('completeQuery', () => { + it('invokes completeQuery without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() + ); + client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); + const [response] = await client.completeQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes completeQuery without error using callback', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() + ); + client.innerApiCalls.completeQuery = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeQuery( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.ICompleteQueryResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes completeQuery with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeQuery = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.completeQuery(request), expectedError); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('importCompletionData', () => { + it('invokes importCompletionData without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importCompletionData = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importCompletionData(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importCompletionData without error using callback', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importCompletionData = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importCompletionData( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IImportCompletionDataResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importCompletionData with call error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importCompletionData = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importCompletionData(request), expectedError); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importCompletionData with LRO error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importCompletionData = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importCompletionData(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportCompletionDataProgress without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportCompletionDataProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportCompletionDataProgress with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportCompletionDataProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts new file mode 100644 index 00000000000..1ff395475cf --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -0,0 +1,647 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as completionserviceModule from '../src'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v2beta.CompletionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + completionserviceModule.v2beta.CompletionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + completionserviceModule.v2beta.CompletionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = completionserviceModule.v2beta.CompletionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + await client.initialize(); + assert(client.completionServiceStub); + }); + + it('has close method', () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2beta.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2beta.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('completeQuery', () => { + it('invokes completeQuery without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompleteQueryResponse() + ); + client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); + const [response] = await client.completeQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes completeQuery without error using callback', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompleteQueryResponse() + ); + client.innerApiCalls.completeQuery = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeQuery( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.ICompleteQueryResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes completeQuery with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.completeQuery = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.completeQuery(request), expectedError); + assert( + (client.innerApiCalls.completeQuery as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('importCompletionData', () => { + it('invokes importCompletionData without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importCompletionData = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importCompletionData(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importCompletionData without error using callback', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importCompletionData = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importCompletionData( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IImportCompletionDataResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importCompletionData with call error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importCompletionData = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importCompletionData(request), expectedError); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importCompletionData with LRO error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importCompletionData = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importCompletionData(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importCompletionData as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportCompletionDataProgress without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportCompletionDataProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportCompletionDataProgress with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkImportCompletionDataProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('Path templates', () => { + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 223212fbe59..4fb8c470959 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -23,6 +23,8 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as productserviceModule from '../src'; +import {PassThrough} from 'stream'; + import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { @@ -81,6 +83,67 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2.ProductServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -805,6 +868,869 @@ describe('v2.ProductServiceClient', () => { }); }); + describe('setInventory', () => { + it('invokes setInventory without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setInventory = stubLongRunningCall(expectedResponse); + const [operation] = await client.setInventory(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setInventory without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setInventory = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setInventory( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setInventory with call error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setInventory = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.setInventory(request), expectedError); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setInventory with LRO error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setInventory = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setInventory(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkSetInventoryProgress without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkSetInventoryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetInventoryProgress with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkSetInventoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addFulfillmentPlaces', () => { + it('invokes addFulfillmentPlaces without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addFulfillmentPlaces = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addFulfillmentPlaces(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addFulfillmentPlaces without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addFulfillmentPlaces = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addFulfillmentPlaces( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addFulfillmentPlaces with call error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addFulfillmentPlaces(request), expectedError); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addFulfillmentPlaces with LRO error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addFulfillmentPlaces(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddFulfillmentPlacesProgress without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddFulfillmentPlacesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddFulfillmentPlacesProgress with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddFulfillmentPlacesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeFulfillmentPlaces', () => { + it('invokes removeFulfillmentPlaces without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeFulfillmentPlaces = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeFulfillmentPlaces(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeFulfillmentPlaces without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeFulfillmentPlaces = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeFulfillmentPlaces( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeFulfillmentPlaces with call error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeFulfillmentPlaces(request), + expectedError + ); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeFulfillmentPlaces with LRO error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeFulfillmentPlaces(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkRemoveFulfillmentPlacesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveFulfillmentPlacesProgress with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveFulfillmentPlacesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProducts', () => { + it('invokes listProducts without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + ]; + client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); + const [response] = await client.listProducts(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProducts without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + ]; + client.innerApiCalls.listProducts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProducts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IProduct[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProducts with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProducts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProducts(request), expectedError); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProductsStream without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + ]; + client.descriptors.page.listProducts.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProductsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.Product[] = []; + stream.on('data', (response: protos.google.cloud.retail.v2.Product) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProducts, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProductsStream with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProducts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listProductsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.Product[] = []; + stream.on('data', (response: protos.google.cloud.retail.v2.Product) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProducts, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProducts without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2.Product()), + ]; + client.descriptors.page.listProducts.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2.IProduct[] = []; + const iterable = client.listProductsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProducts with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProducts.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProductsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2.IProduct[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('Path templates', () => { describe('branch', () => { const fakePath = '/rendered/path/branch'; diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index 98b5cbd6de0..ea5b795ed99 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -23,6 +23,8 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as productserviceModule from '../src'; +import {PassThrough} from 'stream'; + import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { @@ -81,6 +83,67 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2alpha.ProductServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -805,6 +868,875 @@ describe('v2alpha.ProductServiceClient', () => { }); }); + describe('setInventory', () => { + it('invokes setInventory without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setInventory = stubLongRunningCall(expectedResponse); + const [operation] = await client.setInventory(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setInventory without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setInventory = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setInventory( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setInventory with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setInventory = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.setInventory(request), expectedError); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setInventory with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setInventory = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setInventory(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkSetInventoryProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkSetInventoryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetInventoryProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkSetInventoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addFulfillmentPlaces', () => { + it('invokes addFulfillmentPlaces without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addFulfillmentPlaces = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addFulfillmentPlaces(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addFulfillmentPlaces without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addFulfillmentPlaces = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addFulfillmentPlaces( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addFulfillmentPlaces with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addFulfillmentPlaces(request), expectedError); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addFulfillmentPlaces with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addFulfillmentPlaces(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddFulfillmentPlacesProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddFulfillmentPlacesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddFulfillmentPlacesProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddFulfillmentPlacesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeFulfillmentPlaces', () => { + it('invokes removeFulfillmentPlaces without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeFulfillmentPlaces = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeFulfillmentPlaces(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeFulfillmentPlaces without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeFulfillmentPlaces = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeFulfillmentPlaces( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeFulfillmentPlaces with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeFulfillmentPlaces(request), + expectedError + ); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeFulfillmentPlaces with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeFulfillmentPlaces(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkRemoveFulfillmentPlacesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveFulfillmentPlacesProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveFulfillmentPlacesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProducts', () => { + it('invokes listProducts without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + ]; + client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); + const [response] = await client.listProducts(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProducts without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + ]; + client.innerApiCalls.listProducts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProducts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IProduct[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProducts with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProducts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProducts(request), expectedError); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProductsStream without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + ]; + client.descriptors.page.listProducts.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProductsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Product[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Product) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProducts, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProductsStream with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProducts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listProductsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Product[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Product) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProducts, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProducts without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), + ]; + client.descriptors.page.listProducts.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2alpha.IProduct[] = []; + const iterable = client.listProductsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProducts with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProducts.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProductsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2alpha.IProduct[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('Path templates', () => { describe('branch', () => { const fakePath = '/rendered/path/branch'; diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 0fb59443cd8..c7596bf30c8 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -23,6 +23,8 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as productserviceModule from '../src'; +import {PassThrough} from 'stream'; + import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { @@ -81,6 +83,67 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2beta.ProductServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -805,6 +868,875 @@ describe('v2beta.ProductServiceClient', () => { }); }); + describe('setInventory', () => { + it('invokes setInventory without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setInventory = stubLongRunningCall(expectedResponse); + const [operation] = await client.setInventory(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setInventory without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setInventory = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setInventory( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setInventory with call error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setInventory = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.setInventory(request), expectedError); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setInventory with LRO error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetInventoryRequest() + ); + request.inventory = {}; + request.inventory.name = ''; + const expectedHeaderRequestParams = 'inventory.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setInventory = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setInventory(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.setInventory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkSetInventoryProgress without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkSetInventoryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetInventoryProgress with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkSetInventoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addFulfillmentPlaces', () => { + it('invokes addFulfillmentPlaces without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addFulfillmentPlaces = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addFulfillmentPlaces(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addFulfillmentPlaces without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addFulfillmentPlaces = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addFulfillmentPlaces( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addFulfillmentPlaces with call error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addFulfillmentPlaces(request), expectedError); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addFulfillmentPlaces with LRO error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addFulfillmentPlaces(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddFulfillmentPlacesProgress without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddFulfillmentPlacesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddFulfillmentPlacesProgress with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddFulfillmentPlacesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeFulfillmentPlaces', () => { + it('invokes removeFulfillmentPlaces without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeFulfillmentPlaces = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeFulfillmentPlaces(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeFulfillmentPlaces without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeFulfillmentPlaces = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeFulfillmentPlaces( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeFulfillmentPlaces with call error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeFulfillmentPlaces(request), + expectedError + ); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeFulfillmentPlaces with LRO error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeFulfillmentPlaces(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkRemoveFulfillmentPlacesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveFulfillmentPlacesProgress with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveFulfillmentPlacesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProducts', () => { + it('invokes listProducts without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + ]; + client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); + const [response] = await client.listProducts(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProducts without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + ]; + client.innerApiCalls.listProducts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProducts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IProduct[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProducts with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProducts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProducts(request), expectedError); + assert( + (client.innerApiCalls.listProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProductsStream without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + ]; + client.descriptors.page.listProducts.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProductsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Product[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Product) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProducts, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProductsStream with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProducts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listProductsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Product[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Product) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProducts, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProducts without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), + ]; + client.descriptors.page.listProducts.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2beta.IProduct[] = []; + const iterable = client.listProductsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProducts with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProducts.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProductsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2beta.IProduct[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProducts.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('Path templates', () => { describe('branch', () => { const fakePath = '/rendered/path/branch'; diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts new file mode 100644 index 00000000000..9843b0bc519 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -0,0 +1,735 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as searchserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.SearchServiceClient', () => { + it('has servicePath', () => { + const servicePath = searchserviceModule.v2.SearchServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = searchserviceModule.v2.SearchServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = searchserviceModule.v2.SearchServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new searchserviceModule.v2.SearchServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + await client.initialize(); + assert(client.searchServiceStub); + }); + + it('has close method', () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('search', () => { + it('invokes search without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + ]; + client.innerApiCalls.search = stubSimpleCall(expectedResponse); + const [response] = await client.search(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes search without error using callback', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + ]; + client.innerApiCalls.search = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.search( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.retail.v2.SearchResponse.ISearchResult[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes search with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.search(request), expectedError); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchStream without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + ]; + client.descriptors.page.search.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.SearchResponse.SearchResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.retail.v2.SearchResponse.SearchResult + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.search, request) + ); + assert.strictEqual( + (client.descriptors.page.search.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes searchStream with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('expected'); + client.descriptors.page.search.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.SearchResponse.SearchResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.retail.v2.SearchResponse.SearchResult + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.search, request) + ); + assert.strictEqual( + (client.descriptors.page.search.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with search without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.SearchResponse.SearchResult() + ), + ]; + client.descriptors.page.search.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2.SearchResponse.ISearchResult[] = + []; + const iterable = client.searchAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with search with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('expected'); + client.descriptors.page.search.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.searchAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2.SearchResponse.ISearchResult[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts new file mode 100644 index 00000000000..a90d253718d --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -0,0 +1,737 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as searchserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.SearchServiceClient', () => { + it('has servicePath', () => { + const servicePath = + searchserviceModule.v2alpha.SearchServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + searchserviceModule.v2alpha.SearchServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = searchserviceModule.v2alpha.SearchServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + await client.initialize(); + assert(client.searchServiceStub); + }); + + it('has close method', () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('search', () => { + it('invokes search without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + ]; + client.innerApiCalls.search = stubSimpleCall(expectedResponse); + const [response] = await client.search(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes search without error using callback', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + ]; + client.innerApiCalls.search = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.search( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes search with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.search(request), expectedError); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchStream without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + ]; + client.descriptors.page.search.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.search, request) + ); + assert.strictEqual( + (client.descriptors.page.search.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes searchStream with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('expected'); + client.descriptors.page.search.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.search, request) + ); + assert.strictEqual( + (client.descriptors.page.search.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with search without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() + ), + ]; + client.descriptors.page.search.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] = + []; + const iterable = client.searchAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with search with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('expected'); + client.descriptors.page.search.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.searchAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts new file mode 100644 index 00000000000..ba2f81f1b48 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -0,0 +1,737 @@ +// Copyright 2021 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as searchserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.SearchServiceClient', () => { + it('has servicePath', () => { + const servicePath = + searchserviceModule.v2beta.SearchServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + searchserviceModule.v2beta.SearchServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = searchserviceModule.v2beta.SearchServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new searchserviceModule.v2beta.SearchServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + await client.initialize(); + assert(client.searchServiceStub); + }); + + it('has close method', () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('search', () => { + it('invokes search without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + ]; + client.innerApiCalls.search = stubSimpleCall(expectedResponse); + const [response] = await client.search(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes search without error using callback', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + ]; + client.innerApiCalls.search = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.search( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes search with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.search(request), expectedError); + assert( + (client.innerApiCalls.search as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchStream without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + ]; + client.descriptors.page.search.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.SearchResponse.SearchResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.retail.v2beta.SearchResponse.SearchResult + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.search, request) + ); + assert.strictEqual( + (client.descriptors.page.search.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes searchStream with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('expected'); + client.descriptors.page.search.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.SearchResponse.SearchResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.retail.v2beta.SearchResponse.SearchResult + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.search, request) + ); + assert.strictEqual( + (client.descriptors.page.search.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with search without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() + ), + ]; + client.descriptors.page.search.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[] = + []; + const iterable = client.searchAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with search with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SearchRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('expected'); + client.descriptors.page.search.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.searchAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('branch', () => { + const fakePath = '/rendered/path/branch'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.branchPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.branchPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('branchPath', () => { + const result = client.branchPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.branchPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBranchName', () => { + const result = client.matchProjectFromBranchName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBranchName', () => { + const result = client.matchLocationFromBranchName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromBranchName', () => { + const result = client.matchCatalogFromBranchName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromBranchName', () => { + const result = client.matchBranchFromBranchName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.branchPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); From f233c3d82dc17842d2eecda7df102900758150e5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 10:34:03 -0700 Subject: [PATCH 032/103] docs: remove remaining private links (#85) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: remove remaining private links PiperOrigin-RevId: 387857950 Source-Link: https://github.com/googleapis/googleapis/commit/dc9332352883cc59386cd080418e18a4010280f5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/072b1e8d5671872c8ebfd7726780bf6002090380 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud/retail/v2/search_service.proto | 13 ++--- .../cloud/retail/v2alpha/search_service.proto | 16 ++----- .../cloud/retail/v2beta/search_service.proto | 13 ++--- .../src/v2/search_service_client.ts | 39 +++++---------- .../src/v2alpha/search_service_client.ts | 48 ++++++------------- .../src/v2beta/search_service_client.ts | 39 +++++---------- 6 files changed, 52 insertions(+), 116 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 36b46041e43..402d91da204 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -545,8 +545,7 @@ message SearchRequest { // The filter syntax consists of an expression language for constructing a // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. See more details at this [user - // guide](/retail/private/docs/filter-and-order#filter). + // expression is case-sensitive. // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; @@ -564,9 +563,7 @@ message SearchRequest { // The order in which products are returned. Products can be ordered by // a field in an [Product][google.cloud.retail.v2.Product] object. Leave it - // unset if ordered by relevance. OrderBy expression is case-sensitive. See - // more details at this [user - // guide](/retail/private/docs/filter-and-order#order). + // unset if ordered by relevance. OrderBy expression is case-sensitive. // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string order_by = 11; @@ -585,13 +582,11 @@ message SearchRequest { // facet feature. DynamicFacetSpec dynamic_facet_spec = 21; - // Boost specification to boost certain products. See more details at this - // [user guide](/retail/private/docs/boosting). + // Boost specification to boost certain products. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur. See more details at this [user - // guide](/retail/private/docs/result-size#query_expansion). + // query expansion will occur. QueryExpansionSpec query_expansion_spec = 14; // The keys to fetch and rollup the matching diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index 49ea62704d9..4344eae4182 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -570,8 +570,7 @@ message SearchRequest { // The filter syntax consists of an expression language for constructing a // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. See more details at this [user - // guide](/retail/private/docs/filter-and-order#filter). + // expression is case-sensitive. // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; @@ -590,9 +589,7 @@ message SearchRequest { // The order in which products are returned. Products can be ordered by // a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave - // it unset if ordered by relevance. OrderBy expression is case-sensitive. See - // more details at this [user - // guide](/retail/private/docs/filter-and-order#order). + // it unset if ordered by relevance. OrderBy expression is case-sensitive. // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string order_by = 11; @@ -611,13 +608,11 @@ message SearchRequest { // facet feature. DynamicFacetSpec dynamic_facet_spec = 21; - // Boost specification to boost certain products. See more details at this - // [user guide](/retail/private/docs/boosting). + // Boost specification to boost certain products. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur. See more details at this [user - // guide](/retail/private/docs/result-size#query_expansion). + // query expansion will occur. QueryExpansionSpec query_expansion_spec = 14; // The relevance threshold of the search results. @@ -625,8 +620,7 @@ message SearchRequest { // Defaults to // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], // which means only the most relevant results are shown, and the least number - // of results are returned. See more details at this [user - // guide](/retail/private/docs/result-size#relevance_thresholding). + // of results are returned. RelevanceThreshold relevance_threshold = 15; // The keys to fetch and rollup the matching diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index 8b1489921fe..43cb86207fd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -548,8 +548,7 @@ message SearchRequest { // The filter syntax consists of an expression language for constructing a // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. See more details at this [user - // guide](/retail/private/docs/filter-and-order#filter). + // expression is case-sensitive. // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; @@ -567,9 +566,7 @@ message SearchRequest { // The order in which products are returned. Products can be ordered by // a field in an [Product][google.cloud.retail.v2beta.Product] object. Leave - // it unset if ordered by relevance. OrderBy expression is case-sensitive. See - // more details at this [user - // guide](/retail/private/docs/filter-and-order#order). + // it unset if ordered by relevance. OrderBy expression is case-sensitive. // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string order_by = 11; @@ -588,13 +585,11 @@ message SearchRequest { // facet feature. DynamicFacetSpec dynamic_facet_spec = 21; - // Boost specification to boost certain products. See more details at this - // [user guide](/retail/private/docs/boosting). + // Boost specification to boost certain products. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur. See more details at this [user - // guide](/retail/private/docs/result-size#query_expansion). + // query expansion will occur. QueryExpansionSpec query_expansion_spec = 14; // The keys to fetch and rollup the matching diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index f06600087ed..65e37da0e86 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -407,8 +407,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -424,9 +423,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it - * unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -442,12 +439,10 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} @@ -618,8 +613,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -635,9 +629,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it - * unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -653,12 +645,10 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} @@ -811,8 +801,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -828,9 +817,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it - * unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -846,12 +833,10 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index b39709893ae..5f11abec714 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -408,8 +408,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -426,9 +425,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * it unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -444,20 +441,17 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * * Defaults to * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, * which means only the most relevant results are shown, and the least number - * of results are returned. See more details at this [user - * guide](/retail/private/docs/result-size#relevance_thresholding). + * of results are returned. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} @@ -631,8 +625,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -649,9 +642,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * it unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -667,20 +658,17 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * * Defaults to * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, * which means only the most relevant results are shown, and the least number - * of results are returned. See more details at this [user - * guide](/retail/private/docs/result-size#relevance_thresholding). + * of results are returned. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} @@ -836,8 +824,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -854,9 +841,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * it unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -872,20 +857,17 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * * Defaults to * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, * which means only the most relevant results are shown, and the least number - * of results are returned. See more details at this [user - * guide](/retail/private/docs/result-size#relevance_thresholding). + * of results are returned. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index c242dc0de44..662953f8ef2 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -407,8 +407,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -424,9 +423,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * it unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -442,12 +439,10 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} @@ -620,8 +615,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -637,9 +631,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * it unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -655,12 +647,10 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} @@ -815,8 +805,7 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](/retail/private/docs/filter-and-order#filter). + * expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -832,9 +821,7 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](/retail/private/docs/filter-and-order#order). + * it unset if ordered by relevance. OrderBy expression is case-sensitive. * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -850,12 +837,10 @@ export class SearchServiceClient { * (retail-search-support@google.com) if you are interested in using dynamic * facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. See more details at this - * [user guide](/retail/private/docs/boosting). + * Boost specification to boost certain products. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](/retail/private/docs/result-size#query_expansion). + * query expansion will occur. * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} From fae3a66048b2f5c614de5124f7751c7d05dea0b1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 11:44:56 -0700 Subject: [PATCH 033/103] docs: Remove HTML tags from Cloud Retail API library docs (#86) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Remove HTML tags from Cloud Retail API library docs PiperOrigin-RevId: 387885619 Source-Link: https://github.com/googleapis/googleapis/commit/2f9af297c84c55c8b871ba4495e01ade42476c92 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2d0b4b4f00678680ce6502bdeed698fdeeb9cd0b * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- .../cloud/retail/v2/search_service.proto | 204 +++-------------- .../cloud/retail/v2alpha/search_service.proto | 205 +++--------------- .../cloud/retail/v2beta/search_service.proto | 205 +++--------------- 3 files changed, 102 insertions(+), 512 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 402d91da204..27cd38f9aa1 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -74,172 +74,35 @@ message SearchRequest { // [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query] // is not specified: // - // * textual_field =
- // - // *# The - // [Product.brands][google.cloud.retail.v2.Product.brands].
* - //
- // "brands"; - //
- // - // *# The - // [Product.categories][google.cloud.retail.v2.Product.categories].
* - //
- // "categories"; - //
- // - // *# The - // [Audience.genders][google.cloud.retail.v2.Audience.genders].
* - //
- // | "genders"; - //
- // - // *# The - // [Audience.age_groups][google.cloud.retail.v2.Audience.age_groups].
* - //
- // | "ageGroups"; - //
- // - // *# The - // [Product.availability][google.cloud.retail.v2.Product.availability]. - // Value is one of
* - // *# "IN_STOCK", "OUT_OF_STOCK", PREORDER", "BACKORDER".
* - //
- // | "availability"; - //
- // - // *# The - // [ColorInfo.color_families][google.cloud.retail.v2.ColorInfo.color_families].
* - //
- // | "colorFamilies"; - //
- // - // *# The - // [ColorInfo.colors][google.cloud.retail.v2.ColorInfo.colors].
* - //
- // | "colors"; - //
- // - // *# The [Product.sizes][google.cloud.retail.v2.Product.sizes].
* - //
- // | "sizes"; - //
- // - // *# The - // [Product.materials][google.cloud.retail.v2.Product.materials].
* - //
- // | "materials"; - //
- // - // *# The - // [Product.patterns][google.cloud.retail.v2.Product.patterns].
* - //
- // | "patterns"; - //
- // - // *# The - // [Product.conditions][google.cloud.retail.v2.Product.conditions].
* - //
- // | "conditions"; - //
- // - // *# The textual custom attribute in - // [Product][google.cloud.retail.v2.Product] object. Key can
* - // *# be any key in the - // [Product.attributes][google.cloud.retail.v2.Product.attributes] - // map
* - // *# if the attribute values are textual.
* - // *# map.
* - //
- // | "attributes.key"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.PICKUP_IN_STORE][].
* - //
- // | "pickupInStore"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.SHIP_TO_STORE][].
* - //
- // | "shipToStore"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
* - //
- // | "sameDayDelivery"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
* - //
- // | "nextDayDelivery"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
* - //
- // | "customFulfillment1"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
* - //
- // | "customFulfillment2"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
* - //
- // | "customFulfillment3"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
* - //
- // | "customFulfillment4"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
* - //
- // | "customFulfillment5"; + // Textual facet keys: + // * brands + // * categories + // * genders + // * ageGroups + // * availability + // * colorFamilies + // * colors + // * sizes + // * materials + // * patterns + // * conditions + // * attributes.key + // * pickupInStore + // * shipToStore + // * sameDayDelivery + // * nextDayDelivery + // * customFulfillment1 + // * customFulfillment2 + // * customFulfillment3 + // * customFulfillment4 + // * customFulfillment5 // - // * numerical_field =
- // - // *# The - // [PriceInfo.price][google.cloud.retail.v2.PriceInfo.price].
* - //
- // "price"; - //
- // - // *# The discount. Computed by (original_price-price)/price
* - //
- // "discount"; - //
- // - // *# The - // [Rating.average_rating][google.cloud.retail.v2.Rating.average_rating].
* - //
- // "rating"; - //
- // - // *# The - // [Rating.rating_count][google.cloud.retail.v2.Rating.rating_count].
* - //
- // "ratingCount"; - //
- // - // *# The numerical custom attribute in - // [Product][google.cloud.retail.v2.Product] object. Key can
* - // *# be any key in the - // [Product.attributes][google.cloud.retail.v2.Product.attributes] - // map
* - // *# if the attribute values are numerical.
* - //
- // | "attributes.key"; + // Numeric facet keys: + // * price + // * discount + // * rating + // * ratingCount + // * attributes.key string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -424,11 +287,12 @@ message SearchRequest { // Examples: // // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* + // color "Red" or "Blue": + // ``` + // (id: ANY("product_1", "product_2")) + // AND + // (colorFamilies: ANY("Red", "Blue")) + // ``` string condition = 1; // Strength of the condition boost, which should be in [-1, 1]. Negative diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index 4344eae4182..df0cd86a14a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -75,173 +75,35 @@ message SearchRequest { // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] // is not specified: // - // * textual_field =
- // - // *# The - // [Product.brands][google.cloud.retail.v2alpha.Product.brands].
* - //
- // "brands"; - //
- // - // *# The - // [Product.categories][google.cloud.retail.v2alpha.Product.categories].
* - //
- // "categories"; - //
- // - // *# The - // [Audience.genders][google.cloud.retail.v2alpha.Audience.genders].
* - //
- // | "genders"; - //
- // - // *# The - // [Audience.age_groups][google.cloud.retail.v2alpha.Audience.age_groups].
* - //
- // | "ageGroups"; - //
- // - // *# The - // [Product.availability][google.cloud.retail.v2alpha.Product.availability]. - // Value is one of
* - // *# "IN_STOCK", "OUT_OF_STOCK", PREORDER", "BACKORDER".
* - //
- // | "availability"; - //
- // - // *# The - // [ColorInfo.color_families][google.cloud.retail.v2alpha.ColorInfo.color_families].
* - //
- // | "colorFamilies"; - //
- // - // *# The - // [ColorInfo.colors][google.cloud.retail.v2alpha.ColorInfo.colors].
* - //
- // | "colors"; - //
- // - // *# The - // [Product.sizes][google.cloud.retail.v2alpha.Product.sizes].
* - //
- // | "sizes"; - //
- // - // *# The - // [Product.materials][google.cloud.retail.v2alpha.Product.materials].
* - //
- // | "materials"; - //
- // - // *# The - // [Product.patterns][google.cloud.retail.v2alpha.Product.patterns].
* - //
- // | "patterns"; - //
- // - // *# The - // [Product.conditions][google.cloud.retail.v2alpha.Product.conditions].
* - //
- // | "conditions"; - //
- // - // *# The textual custom attribute in - // [Product][google.cloud.retail.v2alpha.Product] object. Key can
* - // *# be any key in the - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] - // map
* - // *# if the attribute values are textual.
* - // *# map.
* - //
- // | "attributes.key"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.PICKUP_IN_STORE][].
* - //
- // | "pickupInStore"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.SHIP_TO_STORE][].
* - //
- // | "shipToStore"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
* - //
- // | "sameDayDelivery"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
* - //
- // | "nextDayDelivery"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
* - //
- // | "customFulfillment1"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
* - //
- // | "customFulfillment2"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
* - //
- // | "customFulfillment3"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
* - //
- // | "customFulfillment4"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
* - //
- // | "customFulfillment5"; + // Textual facet keys: + // * brands + // * categories + // * genders + // * ageGroups + // * availability + // * colorFamilies + // * colors + // * sizes + // * materials + // * patterns + // * conditions + // * attributes.key + // * pickupInStore + // * shipToStore + // * sameDayDelivery + // * nextDayDelivery + // * customFulfillment1 + // * customFulfillment2 + // * customFulfillment3 + // * customFulfillment4 + // * customFulfillment5 // - // * numerical_field =
- // - // *# The - // [PriceInfo.price][google.cloud.retail.v2alpha.PriceInfo.price].
* - //
- // "price"; - //
- // - // *# The discount. Computed by (original_price-price)/price
* - //
- // "discount"; - //
- // - // *# The - // [Rating.average_rating][google.cloud.retail.v2alpha.Rating.average_rating].
* - //
- // "rating"; - //
- // - // *# The - // [Rating.rating_count][google.cloud.retail.v2alpha.Rating.rating_count].
* - //
- // "ratingCount"; - //
- // - // *# The numerical custom attribute in - // [Product][google.cloud.retail.v2alpha.Product] object. Key can
* - // *# be any key in the - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] - // map
* - // *# if the attribute values are numerical.
* - //
- // | "attributes.key"; + // Numeric facet keys: + // * price + // * discount + // * rating + // * ratingCount + // * attributes.key string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -427,11 +289,12 @@ message SearchRequest { // Examples: // // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* + // color "Red" or "Blue": + // ``` + // (id: ANY("product_1", "product_2")) + // AND + // (colorFamilies: ANY("Red", "Blue")) + // ``` string condition = 1; // Strength of the condition boost, which should be in [-1, 1]. Negative diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index 43cb86207fd..2647c7e0b66 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -75,173 +75,35 @@ message SearchRequest { // [FacetKey.query][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.query] // is not specified: // - // * textual_field =
- // - // *# The - // [Product.brands][google.cloud.retail.v2beta.Product.brands].
* - //
- // "brands"; - //
- // - // *# The - // [Product.categories][google.cloud.retail.v2beta.Product.categories].
* - //
- // "categories"; - //
- // - // *# The - // [Audience.genders][google.cloud.retail.v2beta.Audience.genders].
* - //
- // | "genders"; - //
- // - // *# The - // [Audience.age_groups][google.cloud.retail.v2beta.Audience.age_groups].
* - //
- // | "ageGroups"; - //
- // - // *# The - // [Product.availability][google.cloud.retail.v2beta.Product.availability]. - // Value is one of
* - // *# "IN_STOCK", "OUT_OF_STOCK", PREORDER", "BACKORDER".
* - //
- // | "availability"; - //
- // - // *# The - // [ColorInfo.color_families][google.cloud.retail.v2beta.ColorInfo.color_families].
* - //
- // | "colorFamilies"; - //
- // - // *# The - // [ColorInfo.colors][google.cloud.retail.v2beta.ColorInfo.colors].
* - //
- // | "colors"; - //
- // - // *# The - // [Product.sizes][google.cloud.retail.v2beta.Product.sizes].
* - //
- // | "sizes"; - //
- // - // *# The - // [Product.materials][google.cloud.retail.v2beta.Product.materials].
* - //
- // | "materials"; - //
- // - // *# The - // [Product.patterns][google.cloud.retail.v2beta.Product.patterns].
* - //
- // | "patterns"; - //
- // - // *# The - // [Product.conditions][google.cloud.retail.v2beta.Product.conditions].
* - //
- // | "conditions"; - //
- // - // *# The textual custom attribute in - // [Product][google.cloud.retail.v2beta.Product] object. Key can
* - // *# be any key in the - // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] - // map
* - // *# if the attribute values are textual.
* - // *# map.
* - //
- // | "attributes.key"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.PICKUP_IN_STORE][].
* - //
- // | "pickupInStore"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.SHIP_TO_STORE][].
* - //
- // | "shipToStore"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
* - //
- // | "sameDayDelivery"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
* - //
- // | "nextDayDelivery"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
* - //
- // | "customFulfillment1"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
* - //
- // | "customFulfillment2"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
* - //
- // | "customFulfillment3"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
* - //
- // | "customFulfillment4"; - //
- // - // *# The [FulfillmentInfo.ids][] for type - // *# [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
* - //
- // | "customFulfillment5"; + // Textual facet keys: + // * brands + // * categories + // * genders + // * ageGroups + // * availability + // * colorFamilies + // * colors + // * sizes + // * materials + // * patterns + // * conditions + // * attributes.key + // * pickupInStore + // * shipToStore + // * sameDayDelivery + // * nextDayDelivery + // * customFulfillment1 + // * customFulfillment2 + // * customFulfillment3 + // * customFulfillment4 + // * customFulfillment5 // - // * numerical_field =
- // - // *# The - // [PriceInfo.price][google.cloud.retail.v2beta.PriceInfo.price].
* - //
- // "price"; - //
- // - // *# The discount. Computed by (original_price-price)/price
* - //
- // "discount"; - //
- // - // *# The - // [Rating.average_rating][google.cloud.retail.v2beta.Rating.average_rating].
* - //
- // "rating"; - //
- // - // *# The - // [Rating.rating_count][google.cloud.retail.v2beta.Rating.rating_count].
* - //
- // "ratingCount"; - //
- // - // *# The numerical custom attribute in - // [Product][google.cloud.retail.v2beta.Product] object. Key can
* - // *# be any key in the - // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] - // map
* - // *# if the attribute values are numerical.
* - //
- // | "attributes.key"; + // Numeric facet keys: + // * price + // * discount + // * rating + // * ratingCount + // * attributes.key string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -427,11 +289,12 @@ message SearchRequest { // Examples: // // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* + // color "Red" or "Blue": + // ``` + // (id: ANY("product_1", "product_2")) + // AND + // (colorFamilies: ANY("Red", "Blue")) + // ``` string condition = 1; // Strength of the condition boost, which should be in [-1, 1]. Negative From aa4c54f09e1951f64d527345a7c7f6dbdb7d1a1a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 20:34:26 +0000 Subject: [PATCH 034/103] chore: release 1.2.0 (#80) :robot: I have created a release \*beep\* \*boop\* --- ## [1.2.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.6...v1.2.0) (2021-08-02) ### Features * Add restricted Retail Search features for Retail API v2 ([b8279f4](https://www.github.com/googleapis/nodejs-retail/commit/b8279f4b3e90150d349ddd2071d8e25c51c07ec4)) * Add restricted Retail Search features for Retail API v2alpha ([b8279f4](https://www.github.com/googleapis/nodejs-retail/commit/b8279f4b3e90150d349ddd2071d8e25c51c07ec4)) * Add restricted Retail Search features for Retail API v2beta. ([#79](https://www.github.com/googleapis/nodejs-retail/issues/79)) ([b8279f4](https://www.github.com/googleapis/nodejs-retail/commit/b8279f4b3e90150d349ddd2071d8e25c51c07ec4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 9 +++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index bd43565a3b8..be399df5db0 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [1.2.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.6...v1.2.0) (2021-08-02) + + +### Features + +* Add restricted Retail Search features for Retail API v2 ([b8279f4](https://www.github.com/googleapis/nodejs-retail/commit/b8279f4b3e90150d349ddd2071d8e25c51c07ec4)) +* Add restricted Retail Search features for Retail API v2alpha ([b8279f4](https://www.github.com/googleapis/nodejs-retail/commit/b8279f4b3e90150d349ddd2071d8e25c51c07ec4)) +* Add restricted Retail Search features for Retail API v2beta. ([#79](https://www.github.com/googleapis/nodejs-retail/issues/79)) ([b8279f4](https://www.github.com/googleapis/nodejs-retail/commit/b8279f4b3e90150d349ddd2071d8e25c51c07ec4)) + ### [1.1.6](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.5...v1.1.6) (2021-07-16) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index b09e48caadf..4d9875e6fb3 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.1.6", + "version": "1.2.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 7ed2ee30fa2..da44249b2e6 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.1.6" + "@google-cloud/retail": "^1.2.0" }, "devDependencies": { "c8": "^7.1.0", From 400dd1b79dde3032097ac9d6596db7eef9e522e8 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 4 Aug 2021 16:06:57 -0400 Subject: [PATCH 035/103] chore(nodejs): update client ref docs link in metadata (#88) --- packages/google-cloud-retail/.repo-metadata.json | 2 +- packages/google-cloud-retail/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json index 380ed2c6f0a..a7488f782c6 100644 --- a/packages/google-cloud-retail/.repo-metadata.json +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -1,5 +1,5 @@ { - "client_documentation": "https://googleapis.dev/nodejs/retail/latest/", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/retail/latest", "api_id": "retail.googleapis.com", "distribution_name": "@google-cloud/retail", "release_level": "ga", diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index eb92625d433..5018956afaa 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -150,7 +150,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-retail/blob/master/LICENSE) -[client-docs]: https://googleapis.dev/nodejs/retail/latest/ +[client-docs]: https://cloud.google.com/nodejs/docs/reference/retail/latest [product-docs]: https://cloud.google.com/recommendations/ [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project From eb48db98d28a78762275d9f060ca67956dcaaed4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 Aug 2021 09:24:06 -0700 Subject: [PATCH 036/103] docs(retail): Quote several literal expressions for better rendering (#89) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(retail): Quote several literal expressions for better rendering PiperOrigin-RevId: 388769359 Source-Link: https://github.com/googleapis/googleapis/commit/a47f0a4aa9ef834edf40d5b8269e9b6c277bb699 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a25fc41966ff2ccf178e9002d9568680cb1efbc8 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud/retail/v2/search_service.proto | 24 ++++++++++--------- .../cloud/retail/v2alpha/search_service.proto | 24 ++++++++++--------- .../cloud/retail/v2beta/search_service.proto | 24 ++++++++++--------- 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 27cd38f9aa1..4522d546621 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -572,21 +572,23 @@ message SearchResponse { // string or double values with type // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if // there are two variants with colors "red" and "blue", the rollup values - // are { key: "colorFamilies" - // value { - // list_value { - // values { string_value: "red" } - // values { string_value: "blue" } - // } - // } - // } + // are + // + // { key: "colorFamilies" + // value { + // list_value { + // values { string_value: "red" } + // values { string_value: "blue" } + // } + // } + // } // // For // [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info], // the rollup values is a double value with type - // [google.protobuf.Value][google.protobuf.Value]. For example, {key: - // "pickupInStore.store1" value { number_value: 10 }} means a there are 10 - // variants in this product are available in the store "store1". + // [google.protobuf.Value][google.protobuf.Value]. For example: + // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there + // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index df0cd86a14a..109b9399233 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -609,21 +609,23 @@ message SearchResponse { // string or double values with type // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if // there are two variants with colors "red" and "blue", the rollup values - // are { key: "colorFamilies" - // value { - // list_value { - // values { string_value: "red" } - // values { string_value: "blue" } - // } - // } - // } + // are + // + // { key: "colorFamilies" + // value { + // list_value { + // values { string_value: "red" } + // values { string_value: "blue" } + // } + // } + // } // // For // [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info], // the rollup values is a double value with type - // [google.protobuf.Value][google.protobuf.Value]. For example, {key: - // "pickupInStore.store1" value { number_value: 10 }} means a there are 10 - // variants in this product are available in the store "store1". + // [google.protobuf.Value][google.protobuf.Value]. For example, + // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there + // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index 2647c7e0b66..41f5836057f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -578,21 +578,23 @@ message SearchResponse { // string or double values with type // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if // there are two variants with colors "red" and "blue", the rollup values - // are { key: "colorFamilies" - // value { - // list_value { - // values { string_value: "red" } - // values { string_value: "blue" } - // } - // } - // } + // are + // + // { key: "colorFamilies" + // value { + // list_value { + // values { string_value: "red" } + // values { string_value: "blue" } + // } + // } + // } // // For // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info], // the rollup values is a double value with type - // [google.protobuf.Value][google.protobuf.Value]. For example, {key: - // "pickupInStore.store1" value { number_value: 10 }} means a there are 10 - // variants in this product are available in the store "store1". + // [google.protobuf.Value][google.protobuf.Value]. For example, + // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there + // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; } From f4616ab06cd9a5abd312e5c9cd8146adcb7c9f95 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 16 Aug 2021 22:44:11 -0400 Subject: [PATCH 037/103] fix(deps): google-gax v2.24.1 (#91) --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 4d9875e6fb3..96c1ef76e2a 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,7 +42,7 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^2.17.1" + "google-gax": "^2.24.1" }, "devDependencies": { "@types/mocha": "^8.0.4", From 47d95e85766a3dfa1371317c5954bd73231f8e07 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 03:12:40 +0000 Subject: [PATCH 038/103] chore: release 1.2.1 (#92) :robot: I have created a release \*beep\* \*boop\* --- ### [1.2.1](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.0...v1.2.1) (2021-08-17) ### Bug Fixes * **deps:** google-gax v2.24.1 ([#91](https://www.github.com/googleapis/nodejs-retail/issues/91)) ([893845a](https://www.github.com/googleapis/nodejs-retail/commit/893845aae9f43a41ad21f97000bc73da3fb985c0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index be399df5db0..2697010549e 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.2.1](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.0...v1.2.1) (2021-08-17) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#91](https://www.github.com/googleapis/nodejs-retail/issues/91)) ([893845a](https://www.github.com/googleapis/nodejs-retail/commit/893845aae9f43a41ad21f97000bc73da3fb985c0)) + ## [1.2.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.1.6...v1.2.0) (2021-08-02) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 96c1ef76e2a..94b1b112305 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.2.0", + "version": "1.2.1", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index da44249b2e6..035c06dbeab 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.2.0" + "@google-cloud/retail": "^1.2.1" }, "devDependencies": { "c8": "^7.1.0", From fd4b8ed40bff0867b4f6069662ea275eef213d58 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 18:05:10 -0700 Subject: [PATCH 039/103] docs: Keep the API doc up-to-date feat: update grpc service config settings to reflect correct API deadlines chore: remove relative private links from search service comments to prevent crashing client lib generation tool (#95) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Keep the API doc up-to-date feat: update grpc service config settings to reflect correct API deadlines chore: remove relative private links from search service comments to prevent crashing client lib generation tool PiperOrigin-RevId: 392712211 Source-Link: https://github.com/googleapis/googleapis/commit/cb637a6db2a0e406d656055a286ad921134c7d57 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4c87ab9d52a5df08aa04dbfadaa01583fae5278b * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/retail/v2/catalog.proto | 2 +- .../cloud/retail/v2/catalog_service.proto | 10 +- .../google/cloud/retail/v2/common.proto | 2 +- .../cloud/retail/v2/completion_service.proto | 30 ++- .../cloud/retail/v2/import_config.proto | 10 +- .../cloud/retail/v2/prediction_service.proto | 2 +- .../google/cloud/retail/v2/product.proto | 21 +- .../cloud/retail/v2/product_service.proto | 14 +- .../google/cloud/retail/v2/purge_config.proto | 2 +- .../cloud/retail/v2/search_service.proto | 162 +++++++----- .../google/cloud/retail/v2/user_event.proto | 20 +- .../cloud/retail/v2/user_event_service.proto | 2 +- .../google/cloud/retail/v2alpha/catalog.proto | 2 +- .../retail/v2alpha/catalog_service.proto | 8 +- .../retail/v2alpha/completion_service.proto | 36 +-- .../cloud/retail/v2alpha/import_config.proto | 8 +- .../google/cloud/retail/v2alpha/product.proto | 19 +- .../retail/v2alpha/product_service.proto | 12 +- .../cloud/retail/v2alpha/search_service.proto | 169 +++++++----- .../cloud/retail/v2alpha/user_event.proto | 18 +- .../cloud/retail/v2beta/catalog_service.proto | 8 +- .../retail/v2beta/completion_service.proto | 28 +- .../cloud/retail/v2beta/import_config.proto | 8 +- .../google/cloud/retail/v2beta/product.proto | 19 +- .../cloud/retail/v2beta/product_service.proto | 12 +- .../cloud/retail/v2beta/search_service.proto | 158 ++++++----- .../cloud/retail/v2beta/user_event.proto | 18 +- .../google-cloud-retail/protos/protos.d.ts | 36 +++ packages/google-cloud-retail/protos/protos.js | 192 +++++++++++++- .../google-cloud-retail/protos/protos.json | 24 ++ .../src/v2/catalog_service_client.ts | 14 +- .../src/v2/catalog_service_client_config.json | 25 +- .../src/v2/completion_service_client.ts | 29 ++- .../v2/completion_service_client_config.json | 17 +- .../src/v2/prediction_service_client.ts | 6 + .../v2/prediction_service_client_config.json | 13 +- .../src/v2/product_service_client.ts | 19 +- .../src/v2/product_service_client_config.json | 54 ++-- .../src/v2/search_service_client.ts | 212 +++++++++------ .../src/v2/search_service_client_config.json | 13 +- .../src/v2/user_event_service_client.ts | 7 + .../v2/user_event_service_client_config.json | 47 +++- .../src/v2alpha/catalog_service_client.ts | 14 +- .../catalog_service_client_config.json | 25 +- .../src/v2alpha/completion_service_client.ts | 37 ++- .../completion_service_client_config.json | 17 +- .../src/v2alpha/prediction_service_client.ts | 6 + .../prediction_service_client_config.json | 13 +- .../src/v2alpha/product_service_client.ts | 19 +- .../product_service_client_config.json | 54 ++-- .../src/v2alpha/search_service_client.ts | 245 ++++++++++++------ .../v2alpha/search_service_client_config.json | 13 +- .../src/v2alpha/user_event_service_client.ts | 7 + .../user_event_service_client_config.json | 47 +++- .../src/v2beta/catalog_service_client.ts | 14 +- .../v2beta/catalog_service_client_config.json | 25 +- .../src/v2beta/completion_service_client.ts | 29 ++- .../completion_service_client_config.json | 17 +- .../src/v2beta/prediction_service_client.ts | 6 + .../prediction_service_client_config.json | 13 +- .../src/v2beta/product_service_client.ts | 19 +- .../v2beta/product_service_client_config.json | 54 ++-- .../src/v2beta/search_service_client.ts | 212 +++++++++------ .../v2beta/search_service_client_config.json | 13 +- .../src/v2beta/user_event_service_client.ts | 7 + .../user_event_service_client_config.json | 47 +++- 66 files changed, 1687 insertions(+), 774 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto index 20cd402c8c6..f449e9016c9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto index 30858061b72..41523ac809d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -93,8 +93,8 @@ service CatalogService { // {newBranch}. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -109,8 +109,8 @@ service CatalogService { // method under a specified parent catalog. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index e1e06f87c46..afbdcd053a2 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto index 478dac63e1c..c18d67d6845 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,8 +36,8 @@ option ruby_package = "Google::Cloud::Retail::V2"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Contact Retail Support (retail-search-support@google.com) if you are -// interested in using Retail Search. +// Please submit a form [here](https://cloud.google.com/contact) to contact +// cloud sales if you are interested in using Retail Search. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,8 +46,8 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -59,8 +59,8 @@ service CompletionService { // Request processing may be synchronous. Partial updating is not supported. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -135,13 +135,15 @@ message CompleteQueryRequest { // * user-data // // * cloud-retail - // This option is not automatically enabled. Before using cloud-retail, - // contact retail-search-support@google.com first. + // This option requires additional allowlisting. Before using cloud-retail, + // contact Cloud Retail support team first. string dataset = 6; - // Completion max suggestions. + // Completion max suggestions. If left unset or set to 0, then will fallback + // to the configured value [CompletionConfig.max_suggestions][]. // - // The maximum allowed max suggestions is 20. The default value is 20. + // The maximum allowed max suggestions is 20. If it is set higher, it will be + // capped by 20. int32 max_suggestions = 5; } @@ -172,9 +174,9 @@ message CompleteQueryResponse { // performance. string attribution_token = 2; - // Matched recent searches of this user. This field is a restricted feature. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in enabling it. + // Matched recent searches of this user. The maximum number of recent searches + // is 10. This field is a restricted feature. Contact Retail Search support + // team if you are interested in enabling it. // // This feature is only available when // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index 1fb849daf08..25170d4c28b 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -160,13 +160,13 @@ message ImportProductsRequest { // Can only be while using // [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. // - // Add the IAM permission “BigQuery Data Viewer” for + // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. FULL = 2; } @@ -303,7 +303,7 @@ message CompletionDataInputConfig { oneof source { // Required. BigQuery input source. // - // Add the IAM permission “BigQuery Data Viewer” for + // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. BigQuerySource big_query_source = 1 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto index 067f872bf9d..da588a03c2a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 746dc6259e2..2c411078581 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -200,6 +200,9 @@ message Product { // This field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // + // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is + // returned. + // // Google Merchant Center property // [gtin](https://support.google.com/merchants/answer/6324461). // Schema.org property @@ -310,13 +313,9 @@ message Product { // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT // error is returned: // - // * Max entries count: 200 by default; 100 for - // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. + // * Max entries count: 200. // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. - // * Max indexable entries count: 200 by default; 40 for - // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. - // * Max searchable entries count: 30. // * For indexable attribute, the key must match the pattern: // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; @@ -426,7 +425,7 @@ message Product { // The material of the product. For example, "leather", "wooden". // - // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded + // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // @@ -438,7 +437,7 @@ message Product { // The pattern or graphic print of the product. For example, "striped", "polka // dot", "paisley". // - // A maximum of 5 values are allowed per + // A maximum of 20 values are allowed per // [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8 // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. @@ -525,8 +524,12 @@ message Product { // * [name][google.cloud.retail.v2.Product.name] // * [color_info][google.cloud.retail.v2.Product.color_info] // - // Maximum number of paths is 20. Otherwise, an INVALID_ARGUMENT error is + // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. + // + // Note: Returning more fields in + // [SearchResponse][google.cloud.retail.v2.SearchResponse] may increase + // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; // Output only. Product variants grouped together on primary product which diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index dac78fbc5e7..3c381eb3e94 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -143,8 +143,8 @@ service ProductService { // [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -170,8 +170,8 @@ service ProductService { // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -198,8 +198,8 @@ service ProductService { // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto index 588bb39b76f..6c8ce100fcd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 4522d546621..38ccb464928 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,8 +39,8 @@ option ruby_package = "Google::Cloud::Retail::V2"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Contact Retail Support (retail-search-support@google.com) if you are -// interested in using Retail Search. +// Please submit a form [here](https://cloud.google.com/contact) to contact +// cloud sales if you are interested in using Retail Search. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -49,8 +49,8 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -74,35 +74,35 @@ message SearchRequest { // [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query] // is not specified: // - // Textual facet keys: - // * brands - // * categories - // * genders - // * ageGroups - // * availability - // * colorFamilies - // * colors - // * sizes - // * materials - // * patterns - // * conditions - // * attributes.key - // * pickupInStore - // * shipToStore - // * sameDayDelivery - // * nextDayDelivery - // * customFulfillment1 - // * customFulfillment2 - // * customFulfillment3 - // * customFulfillment4 - // * customFulfillment5 + // * textual_field = + // * "brands" + // * "categories" + // * "genders" + // * "ageGroups" + // * "availability" + // * "colorFamilies" + // * "colors" + // * "sizes" + // * "materials" + // * "patterns" + // * "conditions" + // * "attributes.key" + // * "pickupInStore" + // * "shipToStore" + // * "sameDayDelivery" + // * "nextDayDelivery" + // * "customFulfillment1" + // * "customFulfillment2" + // * "customFulfillment3" + // * "customFulfillment4" + // * "customFulfillment5" // - // Numeric facet keys: - // * price - // * discount - // * rating - // * ratingCount - // * attributes.key + // * numerical_field = + // * "price" + // * "discount" + // * "rating" + // * "ratingCount" + // * "attributes.key" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -166,7 +166,8 @@ message SearchRequest { // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical // intervals are sorted in the order given by // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]; - // [FulfillmentInfo.ids][] are sorted in the order given by + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // are sorted in the order given by // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]. string order_by = 4; @@ -287,12 +288,10 @@ message SearchRequest { // Examples: // // * To boost products with product ID "product_1" or "product_2", and - // color "Red" or "Blue": - // ``` - // (id: ANY("product_1", "product_2")) - // AND - // (colorFamilies: ANY("Red", "Blue")) - // ``` + // color + // "Red" or "Blue": + // * (id: ANY("product_1", "product_2")) AND (colorFamilies: + // ANY("Red","Blue")) string condition = 1; // Strength of the condition boost, which should be in [-1, 1]. Negative @@ -343,6 +342,11 @@ message SearchRequest { // The condition under which query expansion should occur. Default to // [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. Condition condition = 1; + + // Whether to pin unexpanded results. If this field is set to true, + // unexpanded products are always at the top of the search results, followed + // by the expanded results. + bool pin_unexpanded_results = 2; } // Required. The resource name of the search engine placement, such as @@ -441,9 +445,8 @@ message SearchRequest { // The specification for dynamically generated facets. Notice that only // textual facets can be dynamically generated. // - // This feature requires additional allowlisting. Contact Retail Support - // (retail-search-support@google.com) if you are interested in using dynamic - // facet feature. + // This feature requires additional allowlisting. Contact Retail Search + // support team if you are interested in using dynamic facet feature. DynamicFacetSpec dynamic_facet_spec = 21; // Boost specification to boost certain products. @@ -462,10 +465,9 @@ message SearchRequest { // [Product][google.cloud.retail.v2.Product]s attributes will lead to extra // query latency. Maximum number of keys is 10. // - // For - // [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info], - // a fulfillment type and a fulfillment ID must be provided in the format of - // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + // For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a + // fulfillment type and a fulfillment ID must be provided in the format of + // "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", // "pickupInStore" is fulfillment type and "store123" is the store ID. // // Supported keys are: @@ -476,24 +478,42 @@ message SearchRequest { // * discount // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2.Product.attributes] map. - // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.PICKUP_IN_STORE][]. - // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.SHIP_TO_STORE][]. - // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][]. - // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][]. - // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_1][]. - // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_2][]. - // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_3][]. - // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_4][]. - // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_5][]. + // * pickupInStore.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "pickup-in-store". + // * shipToStore.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "ship-to-store". + // * sameDayDelivery.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "same-day-delivery". + // * nextDayDelivery.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "next-day-delivery". + // * customFulfillment1.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "custom-type-1". + // * customFulfillment2.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "custom-type-2". + // * customFulfillment3.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "custom-type-3". + // * customFulfillment4.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "custom-type-4". + // * customFulfillment5.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + // "custom-type-5". // // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. @@ -583,10 +603,9 @@ message SearchResponse { // } // } // - // For - // [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info], - // the rollup values is a double value with type - // [google.protobuf.Value][google.protobuf.Value]. For example: + // For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup + // values is a double value with type + // [google.protobuf.Value][google.protobuf.Value]. For example, // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; @@ -625,6 +644,11 @@ message SearchResponse { message QueryExpansionInfo { // Bool describing whether query expansion has occurred. bool expanded_query = 1; + + // Number of pinned results. This field will only be set when expansion + // happens and [SearchRequest.query_expansion_spec.pin_unexpanded_results][] + // is set to true. + int64 pinned_result_count = 2; } // A list of matched items. The order represents the ranking. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto index 7534edf3de9..e4bb810b170 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -258,9 +258,21 @@ message UserEvent { 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. + // Required field(s): + // + // * [Product.id][google.cloud.retail.v2.Product.id] + // + // Optional override field(s): + // + // * [Product.price_info][google.cloud.retail.v2.Product.price_info] + // + // If any supported optional fields are provided, we will treat them as a full + // override when looking up product information from the catalog. Thus, it is + // important to ensure that the overriding fields are accurate and + // complete. + // + // All other product fields are ignored and instead populated via catalog + // lookup after event ingestion. Product product = 1 [(google.api.field_behavior) = REQUIRED]; // Quantity of the product associated with the user event. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto index 4dbd1dc7f11..2d48a511d8c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index 189232995c7..63c09331d19 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -104,7 +104,7 @@ message MerchantCenterLink { // String representing the destination to import for, all if left empty. // List of possible values can be found here. - // [https://support.google.com/merchants/answer/7501026?hl=en] + // [https://support.google.com/merchants/answer/7501026] // List of allowed string values: // "shopping-ads", "buy-on-google-listings", "display-ads", "local-inventory // -ads", "free-listings", "free-local-listings" diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto index 59f839523e5..ac77b924056 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto @@ -93,8 +93,8 @@ service CatalogService { // {newBranch}. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -109,8 +109,8 @@ service CatalogService { // method under a specified parent catalog. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto index 60179156bba..73476ff6c77 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto @@ -36,8 +36,8 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Contact Retail Support (retail-search-support@google.com) if you are -// interested in using Retail Search. +// Please submit a form [here](https://cloud.google.com/contact) to contact +// cloud sales if you are interested in using Retail Search. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,8 +46,8 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -59,8 +59,8 @@ service CompletionService { // Request processing may be synchronous. Partial updating is not supported. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -125,22 +125,26 @@ message CompleteQueryRequest { string device_type = 4; // Determines which dataset to use for fetching completion. "user-data" will - // use the imported dataset through [ImportCompletionData][]. "cloud-retail" - // will use the dataset generated by cloud retail based on user events. If - // leave empty, it will use the "user-data". + // use the imported dataset through + // [CompletionService.ImportCompletionData][google.cloud.retail.v2alpha.CompletionService.ImportCompletionData]. + // "cloud-retail" will use the dataset generated by cloud retail based on user + // events. If leave empty, it will use the "user-data". // // Current supported values: // // * user-data // // * cloud-retail - // This option is not automatically enabled. Before using cloud-retail, - // contact retail-search-support@google.com first. + // This option requires additional allowlisting. Before using cloud-retail, + // contact Cloud Retail support team first. string dataset = 6; - // Completion max suggestions. + // Completion max suggestions. If left unset or set to 0, then will fallback + // to the configured value + // [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions]. // - // The maximum allowed max suggestions is 20. The default value is 20. + // The maximum allowed max suggestions is 20. If it is set higher, it will be + // capped by 20. int32 max_suggestions = 5; } @@ -171,9 +175,9 @@ message CompleteQueryResponse { // performance. string attribution_token = 2; - // Matched recent searches of this user. This field is a restricted feature. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in enabling it. + // Matched recent searches of this user. The maximum number of recent searches + // is 10. This field is a restricted feature. Contact Retail Search support + // team if you are interested in enabling it. // // This feature is only available when // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2alpha.CompleteQueryRequest.visitor_id] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto index b120083ded9..448390a2383 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto @@ -160,13 +160,13 @@ message ImportProductsRequest { // Can only be while using // [BigQuerySource][google.cloud.retail.v2alpha.BigQuerySource]. // - // Add the IAM permission “BigQuery Data Viewer” for + // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. FULL = 2; } @@ -303,7 +303,7 @@ message CompletionDataInputConfig { oneof source { // Required. BigQuery input source. // - // Add the IAM permission “BigQuery Data Viewer” for + // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. BigQuerySource big_query_source = 1 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index d6c536bc963..0fb40bc9144 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -204,6 +204,9 @@ message Product { // This field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // + // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is + // returned. + // // Google Merchant Center property // [gtin](https://support.google.com/merchants/answer/6324461). // Schema.org property @@ -316,13 +319,9 @@ message Product { // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT // error is returned: // - // * Max entries count: 200 by default; 100 for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. + // * Max entries count: 200. // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. - // * Max indexable entries count: 200 by default; 40 for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. - // * Max searchable entries count: 30. // * For indexable attribute, the key must match the pattern: // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; @@ -432,7 +431,7 @@ message Product { // The material of the product. For example, "leather", "wooden". // - // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded + // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // @@ -444,7 +443,7 @@ message Product { // The pattern or graphic print of the product. For example, "striped", "polka // dot", "paisley". // - // A maximum of 5 values are allowed per + // A maximum of 20 values are allowed per // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. @@ -533,8 +532,12 @@ message Product { // * [name][google.cloud.retail.v2alpha.Product.name] // * [color_info][google.cloud.retail.v2alpha.Product.color_info] // - // Maximum number of paths is 20. Otherwise, an INVALID_ARGUMENT error is + // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. + // + // Note: Returning more fields in + // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] may increase + // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; // Output only. Product variants grouped together on primary product which diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index 89f59e4900d..4590a90b579 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -146,8 +146,8 @@ service ProductService { // [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -173,8 +173,8 @@ service ProductService { // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -201,8 +201,8 @@ service ProductService { // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index 109b9399233..f728a9eaeac 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -39,8 +39,8 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Contact Retail Support (retail-search-support@google.com) if you are -// interested in using Retail Search. +// Please submit a form [here](https://cloud.google.com/contact) to contact +// cloud sales if you are interested in using Retail Search. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -49,8 +49,8 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -75,35 +75,35 @@ message SearchRequest { // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] // is not specified: // - // Textual facet keys: - // * brands - // * categories - // * genders - // * ageGroups - // * availability - // * colorFamilies - // * colors - // * sizes - // * materials - // * patterns - // * conditions - // * attributes.key - // * pickupInStore - // * shipToStore - // * sameDayDelivery - // * nextDayDelivery - // * customFulfillment1 - // * customFulfillment2 - // * customFulfillment3 - // * customFulfillment4 - // * customFulfillment5 + // * textual_field = + // * "brands" + // * "categories" + // * "genders" + // * "ageGroups" + // * "availability" + // * "colorFamilies" + // * "colors" + // * "sizes" + // * "materials" + // * "patterns" + // * "conditions" + // * "attributes.key" + // * "pickupInStore" + // * "shipToStore" + // * "sameDayDelivery" + // * "nextDayDelivery" + // * "customFulfillment1" + // * "customFulfillment2" + // * "customFulfillment3" + // * "customFulfillment4" + // * "customFulfillment5" // - // Numeric facet keys: - // * price - // * discount - // * rating - // * ratingCount - // * attributes.key + // * numerical_field = + // * "price" + // * "discount" + // * "rating" + // * "ratingCount" + // * "attributes.key" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -167,7 +167,8 @@ message SearchRequest { // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical // intervals are sorted in the order given by // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals]; - // [FulfillmentInfo.ids][] are sorted in the order given by + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // are sorted in the order given by // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restricted_values]. string order_by = 4; @@ -289,12 +290,10 @@ message SearchRequest { // Examples: // // * To boost products with product ID "product_1" or "product_2", and - // color "Red" or "Blue": - // ``` - // (id: ANY("product_1", "product_2")) - // AND - // (colorFamilies: ANY("Red", "Blue")) - // ``` + // color + // "Red" or "Blue": + // * (id: ANY("product_1", "product_2")) AND (colorFamilies: + // ANY("Red","Blue")) string condition = 1; // Strength of the condition boost, which should be in [-1, 1]. Negative @@ -345,6 +344,11 @@ message SearchRequest { // The condition under which query expansion should occur. Default to // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. Condition condition = 1; + + // Whether to pin unexpanded results. If this field is set to true, + // unexpanded products are always at the top of the search results, followed + // by the expanded results. + bool pin_unexpanded_results = 2; } // The relevance threshold of the search results. The higher relevance @@ -466,16 +470,15 @@ message SearchRequest { // The specification for dynamically generated facets. Notice that only // textual facets can be dynamically generated. // - // This feature requires additional allowlisting. Contact Retail Support - // (retail-search-support@google.com) if you are interested in using dynamic - // facet feature. + // This feature requires additional allowlisting. Contact Retail Search + // support team if you are interested in using dynamic facet feature. DynamicFacetSpec dynamic_facet_spec = 21; // Boost specification to boost certain products. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur. + // query expansion will occur.. QueryExpansionSpec query_expansion_spec = 14; // The relevance threshold of the search results. @@ -497,10 +500,9 @@ message SearchRequest { // [Product][google.cloud.retail.v2alpha.Product]s attributes will lead to // extra query latency. Maximum number of keys is 10. // - // For - // [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info], - // a fulfillment type and a fulfillment ID must be provided in the format of - // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], a + // fulfillment type and a fulfillment ID must be provided in the format of + // "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", // "pickupInStore" is fulfillment type and "store123" is the store ID. // // Supported keys are: @@ -511,24 +513,51 @@ message SearchRequest { // * discount // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. - // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.PICKUP_IN_STORE][]. - // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.SHIP_TO_STORE][]. - // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][]. - // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][]. - // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_1][]. - // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_2][]. - // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_3][]. - // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_4][]. - // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_5][]. + // * pickupInStore.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "pickup-in-store". + // * shipToStore.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "ship-to-store". + // * sameDayDelivery.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "same-day-delivery". + // * nextDayDelivery.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "next-day-delivery". + // * customFulfillment1.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "custom-type-1". + // * customFulfillment2.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "custom-type-2". + // * customFulfillment3.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "custom-type-3". + // * customFulfillment4.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "custom-type-4". + // * customFulfillment5.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + // for + // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + // "custom-type-5". // // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. @@ -620,9 +649,8 @@ message SearchResponse { // } // } // - // For - // [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info], - // the rollup values is a double value with type + // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], the + // rollup values is a double value with type // [google.protobuf.Value][google.protobuf.Value]. For example, // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there // are 10 variants in this product are available in the store "store1". @@ -662,6 +690,11 @@ message SearchResponse { message QueryExpansionInfo { // Bool describing whether query expansion has occurred. bool expanded_query = 1; + + // Number of pinned results. This field will only be set when expansion + // happens and [SearchRequest.query_expansion_spec.pin_unexpanded_results][] + // is set to true. + int64 pinned_result_count = 2; } // A list of matched items. The order represents the ranking. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto index 99a2941e3eb..7ea735756ef 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -261,9 +261,21 @@ message UserEvent { message ProductDetail { // Required. [Product][google.cloud.retail.v2alpha.Product] information. // - // Only [Product.id][google.cloud.retail.v2alpha.Product.id] field is used - // when ingesting an event, all other product fields are ignored as we will - // look them up from the catalog. + // Required field(s): + // + // * [Product.id][google.cloud.retail.v2alpha.Product.id] + // + // Optional override field(s): + // + // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + // + // If any supported optional fields are provided, we will treat them as a full + // override when looking up product information from the catalog. Thus, it is + // important to ensure that the overriding fields are accurate and + // complete. + // + // All other product fields are ignored and instead populated via catalog + // lookup after event ingestion. Product product = 1 [(google.api.field_behavior) = REQUIRED]; // Quantity of the product associated with the user event. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto index 0d499d38327..c87e2ba968b 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto @@ -93,8 +93,8 @@ service CatalogService { // {newBranch}. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -109,8 +109,8 @@ service CatalogService { // method under a specified parent catalog. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto index bb574675be4..cd9de876bb6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto @@ -36,8 +36,8 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Contact Retail Support (retail-search-support@google.com) if you are -// interested in using Retail Search. +// Please submit a form [here](https://cloud.google.com/contact) to contact +// cloud sales if you are interested in using Retail Search. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,8 +46,8 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -59,8 +59,8 @@ service CompletionService { // Request processing may be synchronous. Partial updating is not supported. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -135,13 +135,15 @@ message CompleteQueryRequest { // * user-data // // * cloud-retail - // This option is not automatically enabled. Before using cloud-retail, - // contact retail-search-support@google.com first. + // This option requires additional allowlisting. Before using cloud-retail, + // contact Cloud Retail support team first. string dataset = 6; - // Completion max suggestions. + // Completion max suggestions. If left unset or set to 0, then will fallback + // to the configured value [CompletionConfig.max_suggestions][]. // - // The maximum allowed max suggestions is 20. The default value is 20. + // The maximum allowed max suggestions is 20. If it is set higher, it will be + // capped by 20. int32 max_suggestions = 5; } @@ -172,9 +174,9 @@ message CompleteQueryResponse { // performance. string attribution_token = 2; - // Matched recent searches of this user. This field is a restricted feature. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in enabling it. + // Matched recent searches of this user. The maximum number of recent searches + // is 10. This field is a restricted feature. Contact Retail Search support + // team if you are interested in enabling it. // // This feature is only available when // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2beta.CompleteQueryRequest.visitor_id] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index bd8db707e03..d9a2f2741ca 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -160,13 +160,13 @@ message ImportProductsRequest { // Can only be while using // [BigQuerySource][google.cloud.retail.v2beta.BigQuerySource]. // - // Add the IAM permission “BigQuery Data Viewer” for + // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. FULL = 2; } @@ -303,7 +303,7 @@ message CompletionDataInputConfig { oneof source { // Required. BigQuery input source. // - // Add the IAM permission “BigQuery Data Viewer” for + // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. BigQuerySource big_query_source = 1 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index d729036bf3c..64ccef1ca45 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -203,6 +203,9 @@ message Product { // This field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // + // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is + // returned. + // // Google Merchant Center property // [gtin](https://support.google.com/merchants/answer/6324461). // Schema.org property @@ -315,13 +318,9 @@ message Product { // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT // error is returned: // - // * Max entries count: 200 by default; 100 for - // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]. + // * Max entries count: 200. // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. - // * Max indexable entries count: 200 by default; 40 for - // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]. - // * Max searchable entries count: 30. // * For indexable attribute, the key must match the pattern: // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; @@ -431,7 +430,7 @@ message Product { // The material of the product. For example, "leather", "wooden". // - // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded + // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // @@ -443,7 +442,7 @@ message Product { // The pattern or graphic print of the product. For example, "striped", "polka // dot", "paisley". // - // A maximum of 5 values are allowed per + // A maximum of 20 values are allowed per // [Product][google.cloud.retail.v2beta.Product]. Each value must be a UTF-8 // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. @@ -532,8 +531,12 @@ message Product { // * [name][google.cloud.retail.v2beta.Product.name] // * [color_info][google.cloud.retail.v2beta.Product.color_info] // - // Maximum number of paths is 20. Otherwise, an INVALID_ARGUMENT error is + // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. + // + // Note: Returning more fields in + // [SearchResponse][google.cloud.retail.v2beta.SearchResponse] may increase + // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; // Output only. Product variants grouped together on primary product which diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index a8a1911f94e..53937b4b6c6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -145,8 +145,8 @@ service ProductService { // [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -172,8 +172,8 @@ service ProductService { // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -200,8 +200,8 @@ service ProductService { // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index 41f5836057f..7679f9d609d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -39,8 +39,8 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Contact Retail Support (retail-search-support@google.com) if you are -// interested in using Retail Search. +// Please submit a form [here](https://cloud.google.com/contact) to contact +// cloud sales if you are interested in using Retail Search. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -49,8 +49,8 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Contact Retail Support (retail-search-support@google.com) if you are - // interested in using Retail Search. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // cloud sales if you are interested in using Retail Search. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -75,35 +75,35 @@ message SearchRequest { // [FacetKey.query][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.query] // is not specified: // - // Textual facet keys: - // * brands - // * categories - // * genders - // * ageGroups - // * availability - // * colorFamilies - // * colors - // * sizes - // * materials - // * patterns - // * conditions - // * attributes.key - // * pickupInStore - // * shipToStore - // * sameDayDelivery - // * nextDayDelivery - // * customFulfillment1 - // * customFulfillment2 - // * customFulfillment3 - // * customFulfillment4 - // * customFulfillment5 + // * textual_field = + // * "brands" + // * "categories" + // * "genders" + // * "ageGroups" + // * "availability" + // * "colorFamilies" + // * "colors" + // * "sizes" + // * "materials" + // * "patterns" + // * "conditions" + // * "attributes.key" + // * "pickupInStore" + // * "shipToStore" + // * "sameDayDelivery" + // * "nextDayDelivery" + // * "customFulfillment1" + // * "customFulfillment2" + // * "customFulfillment3" + // * "customFulfillment4" + // * "customFulfillment5" // - // Numeric facet keys: - // * price - // * discount - // * rating - // * ratingCount - // * attributes.key + // * numerical_field = + // * "price" + // * "discount" + // * "rating" + // * "ratingCount" + // * "attributes.key" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -167,7 +167,8 @@ message SearchRequest { // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical // intervals are sorted in the order given by // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals]; - // [FulfillmentInfo.ids][] are sorted in the order given by + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // are sorted in the order given by // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.restricted_values]. string order_by = 4; @@ -289,12 +290,10 @@ message SearchRequest { // Examples: // // * To boost products with product ID "product_1" or "product_2", and - // color "Red" or "Blue": - // ``` - // (id: ANY("product_1", "product_2")) - // AND - // (colorFamilies: ANY("Red", "Blue")) - // ``` + // color + // "Red" or "Blue": + // * (id: ANY("product_1", "product_2")) AND (colorFamilies: + // ANY("Red","Blue")) string condition = 1; // Strength of the condition boost, which should be in [-1, 1]. Negative @@ -345,6 +344,11 @@ message SearchRequest { // The condition under which query expansion should occur. Default to // [Condition.DISABLED][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. Condition condition = 1; + + // Whether to pin unexpanded results. If this field is set to true, + // unexpanded products are always at the top of the search results, followed + // by the expanded results. + bool pin_unexpanded_results = 2; } // Required. The resource name of the search engine placement, such as @@ -443,9 +447,8 @@ message SearchRequest { // The specification for dynamically generated facets. Notice that only // textual facets can be dynamically generated. // - // This feature requires additional allowlisting. Contact Retail Support - // (retail-search-support@google.com) if you are interested in using dynamic - // facet feature. + // This feature requires additional allowlisting. Contact Retail Search + // support team if you are interested in using dynamic facet feature. DynamicFacetSpec dynamic_facet_spec = 21; // Boost specification to boost certain products. @@ -466,10 +469,9 @@ message SearchRequest { // [Product][google.cloud.retail.v2beta.Product]s attributes will lead to // extra query latency. Maximum number of keys is 10. // - // For - // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info], - // a fulfillment type and a fulfillment ID must be provided in the format of - // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + // For [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo], a + // fulfillment type and a fulfillment ID must be provided in the format of + // "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", // "pickupInStore" is fulfillment type and "store123" is the store ID. // // Supported keys are: @@ -480,24 +482,42 @@ message SearchRequest { // * discount // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. - // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.PICKUP_IN_STORE][]. - // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.SHIP_TO_STORE][]. - // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][]. - // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][]. - // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_1][]. - // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_2][]. - // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_3][]. - // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_4][]. - // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type - // [FulfillmentInfo.Type.CUSTOM_TYPE_5][]. + // * pickupInStore.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "pickup-in-store". + // * shipToStore.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "ship-to-store". + // * sameDayDelivery.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "same-day-delivery". + // * nextDayDelivery.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "next-day-delivery". + // * customFulfillment1.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "custom-type-1". + // * customFulfillment2.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "custom-type-2". + // * customFulfillment3.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "custom-type-3". + // * customFulfillment4.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "custom-type-4". + // * customFulfillment5.id, where id is any + // [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + // for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + // "custom-type-5". // // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. @@ -589,9 +609,8 @@ message SearchResponse { // } // } // - // For - // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info], - // the rollup values is a double value with type + // For [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo], the + // rollup values is a double value with type // [google.protobuf.Value][google.protobuf.Value]. For example, // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there // are 10 variants in this product are available in the store "store1". @@ -631,6 +650,11 @@ message SearchResponse { message QueryExpansionInfo { // Bool describing whether query expansion has occurred. bool expanded_query = 1; + + // Number of pinned results. This field will only be set when expansion + // happens and [SearchRequest.query_expansion_spec.pin_unexpanded_results][] + // is set to true. + int64 pinned_result_count = 2; } // A list of matched items. The order represents the ranking. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index f132eedcc39..325b6e54ebd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -259,9 +259,21 @@ message UserEvent { message ProductDetail { // Required. [Product][google.cloud.retail.v2beta.Product] information. // - // Only [Product.id][google.cloud.retail.v2beta.Product.id] field is used when - // ingesting an event, all other product fields are ignored as we will look - // them up from the catalog. + // Required field(s): + // + // * [Product.id][google.cloud.retail.v2beta.Product.id] + // + // Optional override field(s): + // + // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + // + // If any supported optional fields are provided, we will treat them as a full + // override when looking up product information from the catalog. Thus, it is + // important to ensure that the overriding fields are accurate and + // complete. + // + // All other product fields are ignored and instead populated via catalog + // lookup after event ingestion. Product product = 1 [(google.api.field_behavior) = REQUIRED]; // Quantity of the product associated with the user event. diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 658ef36a606..8bcc0238210 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -8077,6 +8077,9 @@ export namespace google { /** QueryExpansionSpec condition */ condition?: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null); + + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); } /** Represents a QueryExpansionSpec. */ @@ -8091,6 +8094,9 @@ export namespace google { /** QueryExpansionSpec condition. */ public condition: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition); + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; + /** * Creates a new QueryExpansionSpec instance using the specified properties. * @param [properties] Properties to set @@ -8636,6 +8642,9 @@ export namespace google { /** QueryExpansionInfo expandedQuery */ expandedQuery?: (boolean|null); + + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); } /** Represents a QueryExpansionInfo. */ @@ -8650,6 +8659,9 @@ export namespace google { /** QueryExpansionInfo expandedQuery. */ public expandedQuery: boolean; + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); + /** * Creates a new QueryExpansionInfo instance using the specified properties. * @param [properties] Properties to set @@ -17987,6 +17999,9 @@ export namespace google { /** QueryExpansionSpec condition */ condition?: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null); + + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); } /** Represents a QueryExpansionSpec. */ @@ -18001,6 +18016,9 @@ export namespace google { /** QueryExpansionSpec condition. */ public condition: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition); + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; + /** * Creates a new QueryExpansionSpec instance using the specified properties. * @param [properties] Properties to set @@ -18555,6 +18573,9 @@ export namespace google { /** QueryExpansionInfo expandedQuery */ expandedQuery?: (boolean|null); + + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); } /** Represents a QueryExpansionInfo. */ @@ -18569,6 +18590,9 @@ export namespace google { /** QueryExpansionInfo expandedQuery. */ public expandedQuery: boolean; + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); + /** * Creates a new QueryExpansionInfo instance using the specified properties. * @param [properties] Properties to set @@ -27690,6 +27714,9 @@ export namespace google { /** QueryExpansionSpec condition */ condition?: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null); + + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); } /** Represents a QueryExpansionSpec. */ @@ -27704,6 +27731,9 @@ export namespace google { /** QueryExpansionSpec condition. */ public condition: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition); + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; + /** * Creates a new QueryExpansionSpec instance using the specified properties. * @param [properties] Properties to set @@ -28249,6 +28279,9 @@ export namespace google { /** QueryExpansionInfo expandedQuery */ expandedQuery?: (boolean|null); + + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); } /** Represents a QueryExpansionInfo. */ @@ -28263,6 +28296,9 @@ export namespace google { /** QueryExpansionInfo expandedQuery. */ public expandedQuery: boolean; + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); + /** * Creates a new QueryExpansionInfo instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index c5ae26d1cb0..7f20499b9a7 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -19974,6 +19974,7 @@ * @memberof google.cloud.retail.v2.SearchRequest * @interface IQueryExpansionSpec * @property {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults */ /** @@ -19999,6 +20000,14 @@ */ QueryExpansionSpec.prototype.condition = 0; + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; + /** * Creates a new QueryExpansionSpec instance using the specified properties. * @function create @@ -20025,6 +20034,8 @@ writer = $Writer.create(); if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); return writer; }; @@ -20062,6 +20073,9 @@ case 1: message.condition = reader.int32(); break; + case 2: + message.pinUnexpandedResults = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -20106,6 +20120,9 @@ case 3: break; } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; return null; }; @@ -20135,6 +20152,8 @@ message.condition = 3; break; } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); return message; }; @@ -20151,10 +20170,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } if (message.condition != null && message.hasOwnProperty("condition")) object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; return object; }; @@ -21482,6 +21505,7 @@ * @memberof google.cloud.retail.v2.SearchResponse * @interface IQueryExpansionInfo * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount */ /** @@ -21507,6 +21531,14 @@ */ QueryExpansionInfo.prototype.expandedQuery = false; + /** + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** * Creates a new QueryExpansionInfo instance using the specified properties. * @function create @@ -21533,6 +21565,8 @@ writer = $Writer.create(); if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); return writer; }; @@ -21570,6 +21604,9 @@ case 1: message.expandedQuery = reader.bool(); break; + case 2: + message.pinnedResultCount = reader.int64(); + break; default: reader.skipType(tag & 7); break; @@ -21608,6 +21645,9 @@ if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) if (typeof message.expandedQuery !== "boolean") return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; return null; }; @@ -21625,6 +21665,15 @@ var message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); if (object.expandedQuery != null) message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); return message; }; @@ -21641,10 +21690,21 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; return object; }; @@ -44363,6 +44423,7 @@ * @memberof google.cloud.retail.v2alpha.SearchRequest * @interface IQueryExpansionSpec * @property {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults */ /** @@ -44388,6 +44449,14 @@ */ QueryExpansionSpec.prototype.condition = 0; + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; + /** * Creates a new QueryExpansionSpec instance using the specified properties. * @function create @@ -44414,6 +44483,8 @@ writer = $Writer.create(); if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); return writer; }; @@ -44451,6 +44522,9 @@ case 1: message.condition = reader.int32(); break; + case 2: + message.pinUnexpandedResults = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -44495,6 +44569,9 @@ case 3: break; } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; return null; }; @@ -44524,6 +44601,8 @@ message.condition = 3; break; } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); return message; }; @@ -44540,10 +44619,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } if (message.condition != null && message.hasOwnProperty("condition")) object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; return object; }; @@ -45891,6 +45974,7 @@ * @memberof google.cloud.retail.v2alpha.SearchResponse * @interface IQueryExpansionInfo * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount */ /** @@ -45916,6 +46000,14 @@ */ QueryExpansionInfo.prototype.expandedQuery = false; + /** + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** * Creates a new QueryExpansionInfo instance using the specified properties. * @function create @@ -45942,6 +46034,8 @@ writer = $Writer.create(); if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); return writer; }; @@ -45979,6 +46073,9 @@ case 1: message.expandedQuery = reader.bool(); break; + case 2: + message.pinnedResultCount = reader.int64(); + break; default: reader.skipType(tag & 7); break; @@ -46017,6 +46114,9 @@ if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) if (typeof message.expandedQuery !== "boolean") return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; return null; }; @@ -46034,6 +46134,15 @@ var message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); if (object.expandedQuery != null) message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); return message; }; @@ -46050,10 +46159,21 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; return object; }; @@ -68179,6 +68299,7 @@ * @memberof google.cloud.retail.v2beta.SearchRequest * @interface IQueryExpansionSpec * @property {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults */ /** @@ -68204,6 +68325,14 @@ */ QueryExpansionSpec.prototype.condition = 0; + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; + /** * Creates a new QueryExpansionSpec instance using the specified properties. * @function create @@ -68230,6 +68359,8 @@ writer = $Writer.create(); if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); return writer; }; @@ -68267,6 +68398,9 @@ case 1: message.condition = reader.int32(); break; + case 2: + message.pinUnexpandedResults = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -68311,6 +68445,9 @@ case 3: break; } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; return null; }; @@ -68340,6 +68477,8 @@ message.condition = 3; break; } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); return message; }; @@ -68356,10 +68495,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } if (message.condition != null && message.hasOwnProperty("condition")) object.condition = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; return object; }; @@ -69687,6 +69830,7 @@ * @memberof google.cloud.retail.v2beta.SearchResponse * @interface IQueryExpansionInfo * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount */ /** @@ -69712,6 +69856,14 @@ */ QueryExpansionInfo.prototype.expandedQuery = false; + /** + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** * Creates a new QueryExpansionInfo instance using the specified properties. * @function create @@ -69738,6 +69890,8 @@ writer = $Writer.create(); if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); return writer; }; @@ -69775,6 +69929,9 @@ case 1: message.expandedQuery = reader.bool(); break; + case 2: + message.pinnedResultCount = reader.int64(); + break; default: reader.skipType(tag & 7); break; @@ -69813,6 +69970,9 @@ if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) if (typeof message.expandedQuery !== "boolean") return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; return null; }; @@ -69830,6 +69990,15 @@ var message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); if (object.expandedQuery != null) message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); return message; }; @@ -69846,10 +70015,21 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; return object; }; diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index d777f391db2..61b091a4c89 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -2086,6 +2086,10 @@ "condition": { "type": "Condition", "id": 1 + }, + "pinUnexpandedResults": { + "type": "bool", + "id": 2 } }, "nested": { @@ -2212,6 +2216,10 @@ "expandedQuery": { "type": "bool", "id": 1 + }, + "pinnedResultCount": { + "type": "int64", + "id": 2 } } } @@ -4586,6 +4594,10 @@ "condition": { "type": "Condition", "id": 1 + }, + "pinUnexpandedResults": { + "type": "bool", + "id": 2 } }, "nested": { @@ -4721,6 +4733,10 @@ "expandedQuery": { "type": "bool", "id": 1 + }, + "pinnedResultCount": { + "type": "int64", + "id": 2 } } } @@ -7050,6 +7066,10 @@ "condition": { "type": "Condition", "id": 1 + }, + "pinUnexpandedResults": { + "type": "bool", + "id": 2 } }, "nested": { @@ -7176,6 +7196,10 @@ "expandedQuery": { "type": "bool", "id": 1 + }, + "pinnedResultCount": { + "type": "int64", + "id": 2 } } } diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index e02e568c1a0..266b2b5fd3a 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -131,6 +131,12 @@ export class CatalogServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -480,8 +486,8 @@ export class CatalogServiceClient { * {newBranch}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -584,8 +590,8 @@ export class CatalogServiceClient { * method under a specified parent catalog. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json index 685857e370e..dd5a76fae17 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json @@ -17,28 +17,37 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "ListCatalogs": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "UpdateCatalog": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "SetDefaultBranch": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "GetDefaultBranch": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index 6277a2b00f2..fa544ce727c 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -41,8 +41,8 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * @class * @memberof v2 */ @@ -133,6 +133,12 @@ export class CompletionServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -360,8 +366,8 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -417,12 +423,14 @@ export class CompletionServiceClient { * * user-data * * * cloud-retail - * This option is not automatically enabled. Before using cloud-retail, - * contact retail-search-support@google.com first. + * This option requires additional allowlisting. Before using cloud-retail, + * contact Cloud Retail support team first. * @param {number} request.maxSuggestions - * Completion max suggestions. + * Completion max suggestions. If left unset or set to 0, then will fallback + * to the configured value {@link |CompletionConfig.max_suggestions}. * - * The maximum allowed max suggestions is 20. The default value is 20. + * The maximum allowed max suggestions is 20. If it is set higher, it will be + * capped by 20. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -517,8 +525,8 @@ export class CompletionServiceClient { * Request processing may be synchronous. Partial updating is not supported. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -778,6 +786,7 @@ export class CompletionServiceClient { return this.completionServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2/completion_service_client_config.json b/packages/google-cloud-retail/src/v2/completion_service_client_config.json index 504bef8cd31..a6bffad0d24 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/completion_service_client_config.json @@ -17,18 +17,27 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "CompleteQuery": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "ImportCompletionData": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 4efaee18391..d2b85fcfa8c 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -122,6 +122,12 @@ export class PredictionServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client_config.json b/packages/google-cloud-retail/src/v2/prediction_service_client_config.json index 799726feef3..9ab95d31a0c 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/prediction_service_client_config.json @@ -17,13 +17,22 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "Predict": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 1b8a7b6704c..0040141cf0f 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -134,6 +134,12 @@ export class ProductServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1056,8 +1062,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -1263,8 +1269,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -1471,8 +1477,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -2227,6 +2233,7 @@ export class ProductServiceClient { return this.productServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2/product_service_client_config.json b/packages/google-cloud-retail/src/v2/product_service_client_config.json index 1c5fa2d534a..40550466926 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/product_service_client_config.json @@ -17,53 +17,71 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "49abb7cadc111ff8dd551b61fcad123362c8d090": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 300000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "CreateProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "GetProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ListProducts": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "UpdateProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "DeleteProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportProducts": { - "timeout_millis": 60000, + "timeout_millis": 300000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, "SetInventory": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "AddFulfillmentPlaces": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "RemoveFulfillmentPlaces": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 65e37da0e86..aaf1b287347 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -44,8 +44,8 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * @class * @memberof v2 */ @@ -135,6 +135,12 @@ export class SearchServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -347,8 +353,8 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -435,9 +441,8 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec @@ -453,10 +458,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra * query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -467,24 +471,42 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -641,9 +663,8 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec @@ -659,10 +680,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra * query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -673,24 +693,42 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -829,9 +867,8 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec @@ -847,10 +884,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra * query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -861,24 +897,42 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. diff --git a/packages/google-cloud-retail/src/v2/search_service_client_config.json b/packages/google-cloud-retail/src/v2/search_service_client_config.json index 6a194d85625..5132c12db6d 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/search_service_client_config.json @@ -17,13 +17,22 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "Search": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 40cd7acffc3..0d05bdb6998 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -129,6 +129,12 @@ export class UserEventServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1166,6 +1172,7 @@ export class UserEventServiceClient { return this.userEventServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2/user_event_service_client_config.json index 1baf6f127b8..7a2bfd984b5 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/user_event_service_client_config.json @@ -17,33 +17,60 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "49abb7cadc111ff8dd551b61fcad123362c8d090": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 300000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "WriteUserEvent": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "CollectUserEvent": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "PurgeUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 300000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, "RejoinUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index d1d2a08e52f..94a7ea2175c 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -131,6 +131,12 @@ export class CatalogServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -490,8 +496,8 @@ export class CatalogServiceClient { * {newBranch}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -600,8 +606,8 @@ export class CatalogServiceClient { * method under a specified parent catalog. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json index b70d6d1a205..6a6a6289bf2 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json @@ -17,28 +17,37 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "ListCatalogs": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "UpdateCatalog": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "SetDefaultBranch": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "GetDefaultBranch": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index df972014c08..1d98f724e19 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -41,8 +41,8 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * @class * @memberof v2alpha */ @@ -133,6 +133,12 @@ export class CompletionServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -364,8 +370,8 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -411,21 +417,25 @@ export class CompletionServiceClient { * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. * @param {string} request.dataset * Determines which dataset to use for fetching completion. "user-data" will - * use the imported dataset through {@link |ImportCompletionData}. "cloud-retail" - * will use the dataset generated by cloud retail based on user events. If - * leave empty, it will use the "user-data". + * use the imported dataset through + * {@link google.cloud.retail.v2alpha.CompletionService.ImportCompletionData|CompletionService.ImportCompletionData}. + * "cloud-retail" will use the dataset generated by cloud retail based on user + * events. If leave empty, it will use the "user-data". * * Current supported values: * * * user-data * * * cloud-retail - * This option is not automatically enabled. Before using cloud-retail, - * contact retail-search-support@google.com first. + * This option requires additional allowlisting. Before using cloud-retail, + * contact Cloud Retail support team first. * @param {number} request.maxSuggestions - * Completion max suggestions. + * Completion max suggestions. If left unset or set to 0, then will fallback + * to the configured value + * {@link google.cloud.retail.v2alpha.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions}. * - * The maximum allowed max suggestions is 20. The default value is 20. + * The maximum allowed max suggestions is 20. If it is set higher, it will be + * capped by 20. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -522,8 +532,8 @@ export class CompletionServiceClient { * Request processing may be synchronous. Partial updating is not supported. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -783,6 +793,7 @@ export class CompletionServiceClient { return this.completionServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json index 01602c74772..ac2795a5fb1 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client_config.json @@ -17,18 +17,27 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "CompleteQuery": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "ImportCompletionData": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index ca4cc5edfb9..a67a696e9ad 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -122,6 +122,12 @@ export class PredictionServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json index 2982aa11161..ed48fe50101 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client_config.json @@ -17,13 +17,22 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "Predict": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 08a3c9a3674..0ad01091346 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -134,6 +134,12 @@ export class ProductServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1079,8 +1085,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -1286,8 +1292,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -1494,8 +1500,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -2286,6 +2292,7 @@ export class ProductServiceClient { return this.productServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json index 97e4f50d366..541657ac5a8 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json @@ -17,53 +17,71 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "49abb7cadc111ff8dd551b61fcad123362c8d090": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 300000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "CreateProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "GetProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ListProducts": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "UpdateProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "DeleteProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportProducts": { - "timeout_millis": 60000, + "timeout_millis": 300000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, "SetInventory": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "AddFulfillmentPlaces": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "RemoveFulfillmentPlaces": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 5f11abec714..f713ea10543 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -44,8 +44,8 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * @class * @memberof v2alpha */ @@ -135,6 +135,12 @@ export class SearchServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -347,8 +353,8 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -437,14 +443,13 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur.. * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * @@ -464,10 +469,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to * extra query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -478,24 +482,51 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -654,14 +685,13 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur.. * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * @@ -681,10 +711,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to * extra query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -695,24 +724,51 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -853,14 +909,13 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur.. * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * @@ -880,10 +935,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to * extra query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -894,24 +948,51 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json index 27bdbd246c7..71a5a478c8c 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client_config.json @@ -17,13 +17,22 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "Search": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 8e6618c30ff..785f8e7d411 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -129,6 +129,12 @@ export class UserEventServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1179,6 +1185,7 @@ export class UserEventServiceClient { return this.userEventServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json index 555875a5f65..8518bc3abc1 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json @@ -17,33 +17,60 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "49abb7cadc111ff8dd551b61fcad123362c8d090": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 300000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "WriteUserEvent": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "CollectUserEvent": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "PurgeUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 300000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, "RejoinUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 040f46358ee..9826d1da8b6 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -131,6 +131,12 @@ export class CatalogServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -490,8 +496,8 @@ export class CatalogServiceClient { * {newBranch}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -600,8 +606,8 @@ export class CatalogServiceClient { * method under a specified parent catalog. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json index d9d6301b0d5..096f9c8d886 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json @@ -17,28 +17,37 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "ListCatalogs": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "UpdateCatalog": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "SetDefaultBranch": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "GetDefaultBranch": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 044499c25ea..943ad820514 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -41,8 +41,8 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * @class * @memberof v2beta */ @@ -133,6 +133,12 @@ export class CompletionServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -364,8 +370,8 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -421,12 +427,14 @@ export class CompletionServiceClient { * * user-data * * * cloud-retail - * This option is not automatically enabled. Before using cloud-retail, - * contact retail-search-support@google.com first. + * This option requires additional allowlisting. Before using cloud-retail, + * contact Cloud Retail support team first. * @param {number} request.maxSuggestions - * Completion max suggestions. + * Completion max suggestions. If left unset or set to 0, then will fallback + * to the configured value {@link |CompletionConfig.max_suggestions}. * - * The maximum allowed max suggestions is 20. The default value is 20. + * The maximum allowed max suggestions is 20. If it is set higher, it will be + * capped by 20. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -523,8 +531,8 @@ export class CompletionServiceClient { * Request processing may be synchronous. Partial updating is not supported. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -784,6 +792,7 @@ export class CompletionServiceClient { return this.completionServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json b/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json index f7f540708ce..1865fe66ef1 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client_config.json @@ -17,18 +17,27 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "CompleteQuery": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "ImportCompletionData": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 709a2949b21..7e807132806 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -122,6 +122,12 @@ export class PredictionServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json b/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json index caff0cc3ecd..ab64c45e11f 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client_config.json @@ -17,13 +17,22 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "Predict": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 97b4c27dc76..c19d92a154a 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -134,6 +134,12 @@ export class ProductServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1078,8 +1084,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -1285,8 +1291,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -1493,8 +1499,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -2261,6 +2267,7 @@ export class ProductServiceClient { return this.productServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json index bc6eb0c920c..d4f16440baf 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json @@ -17,53 +17,71 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "49abb7cadc111ff8dd551b61fcad123362c8d090": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 300000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "CreateProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "GetProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ListProducts": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "UpdateProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "DeleteProduct": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportProducts": { - "timeout_millis": 60000, + "timeout_millis": 300000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, "SetInventory": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "AddFulfillmentPlaces": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "RemoveFulfillmentPlaces": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 662953f8ef2..69620eb5ec9 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -44,8 +44,8 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * @class * @memberof v2beta */ @@ -135,6 +135,12 @@ export class SearchServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -347,8 +353,8 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Contact Retail Support (retail-search-support@google.com) if you are - * interested in using Retail Search. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. * * @param {Object} request * The request object that will be sent. @@ -435,9 +441,8 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec @@ -455,10 +460,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to * extra query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -469,24 +473,42 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -643,9 +665,8 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec @@ -663,10 +684,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to * extra query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -677,24 +697,42 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -833,9 +871,8 @@ export class SearchServiceClient { * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. * - * This feature requires additional allowlisting. Contact Retail Support - * (retail-search-support@google.com) if you are interested in using dynamic - * facet feature. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec @@ -853,10 +890,9 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to * extra query latency. Maximum number of keys is 10. * - * For - * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info}, - * a fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123", + * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. * * Supported keys are: @@ -867,24 +903,42 @@ export class SearchServiceClient { * * discount * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.PICKUP_IN_STORE}. - * * shipToStore.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SHIP_TO_STORE}. - * * sameDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.SAME_DAY_DELIVERY}. - * * nextDayDelivery.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.NEXT_DAY_DELIVERY}. - * * customFulfillment1.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_1}. - * * customFulfillment2.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_2}. - * * customFulfillment3.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_3}. - * * customFulfillment4.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_4}. - * * customFulfillment5.id, where id is any {@link |FulfillmentInfo.ids} for type - * {@link |FulfillmentInfo.Type.CUSTOM_TYPE_5}. + * * pickupInStore.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "pickup-in-store". + * * shipToStore.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-1". + * * customFulfillment2.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-2". + * * customFulfillment3.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-3". + * * customFulfillment4.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-4". + * * customFulfillment5.id, where id is any + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} + * for {@link google.cloud.retail.v2beta.FulfillmentInfo.type|FulfillmentInfo.type} + * "custom-type-5". * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client_config.json b/packages/google-cloud-retail/src/v2beta/search_service_client_config.json index 15f027a24ba..82de0f81873 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/search_service_client_config.json @@ -17,13 +17,22 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "Search": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 72340c9d9a4..fb27c34ff6c 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -129,6 +129,12 @@ export class UserEventServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1179,6 +1185,7 @@ export class UserEventServiceClient { return this.userEventServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json index 4b5af274c74..92dc408aea7 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json @@ -17,33 +17,60 @@ "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 + }, + "319f27672a8be83550d842a373549dd84649a57e": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "49abb7cadc111ff8dd551b61fcad123362c8d090": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 300000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 } }, "methods": { "WriteUserEvent": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "CollectUserEvent": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, "PurgeUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 30000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 300000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, "RejoinUserEvents": { - "timeout_millis": 60000, + "timeout_millis": 5000, "retry_codes_name": "idempotent", - "retry_params_name": "default" + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } From ef06f48f4e6a3fd376ad3e42bc18076ec975b965 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 23:38:53 +0000 Subject: [PATCH 040/103] chore: disable renovate dependency dashboard (#1194) (#97) --- packages/google-cloud-retail/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index 5018956afaa..0f6be3c91d6 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -141,8 +141,8 @@ Contributions welcome! See the [Contributing Guide](https://github.com/googleapi Please note that this `README.md`, the `samples/README.md`, and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) are generated from a central template. To edit one of these files, make an edit -to its template in this -[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). +to its templates in +[directory](https://github.com/googleapis/synthtool). ## License From b2c8c05f6f88bc5308f3a37e3b8e48a2006c6b33 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Fri, 10 Sep 2021 12:41:24 -0400 Subject: [PATCH 041/103] fix(build): set default branch to main (#98) --- packages/google-cloud-retail/README.md | 12 ++++++------ packages/google-cloud-retail/samples/README.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index 0f6be3c91d6..ab98619c7e0 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -6,7 +6,7 @@ [![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/retail.svg)](https://www.npmjs.org/package/@google-cloud/retail) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-retail/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-retail) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-retail/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-retail) @@ -15,7 +15,7 @@ Retail client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-retail/blob/master/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/nodejs-retail/blob/main/CHANGELOG.md). * [Retail API Node.js Client API Reference][client-docs] * [Retail API Documentation][product-docs] @@ -83,11 +83,11 @@ listCatalogs(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-retail/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-retail/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Quickstart | [source code](https://github.com/googleapis/nodejs-retail/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/nodejs-retail/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | @@ -136,7 +136,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-retail/blob/master/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-retail/blob/main/CONTRIBUTING.md). Please note that this `README.md`, the `samples/README.md`, and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -148,7 +148,7 @@ to its templates in Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-retail/blob/master/LICENSE) +See [LICENSE](https://github.com/googleapis/nodejs-retail/blob/main/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/retail/latest [product-docs]: https://cloud.google.com/recommendations/ diff --git a/packages/google-cloud-retail/samples/README.md b/packages/google-cloud-retail/samples/README.md index aef36e146ed..a46baa3ac51 100644 --- a/packages/google-cloud-retail/samples/README.md +++ b/packages/google-cloud-retail/samples/README.md @@ -31,7 +31,7 @@ Before running the samples, make sure you've followed the steps outlined in ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-retail/blob/master/samples/quickstart.js). +View the [source code](https://github.com/googleapis/nodejs-retail/blob/main/samples/quickstart.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) From 45528a4d52e191313a2c99e3c4373c0661b67a90 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 10 Sep 2021 10:53:07 -0700 Subject: [PATCH 042/103] chore: release 1.2.2 (#99) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 2697010549e..e110cc457ae 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.2.2](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.1...v1.2.2) (2021-09-10) + + +### Bug Fixes + +* **build:** set default branch to main ([#98](https://www.github.com/googleapis/nodejs-retail/issues/98)) ([637a23e](https://www.github.com/googleapis/nodejs-retail/commit/637a23e229641c42103c7b60f2ce2fb974e23d90)) + ### [1.2.1](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.0...v1.2.1) (2021-08-17) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 94b1b112305..b08f2886fa9 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.2.1", + "version": "1.2.2", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 035c06dbeab..36434540062 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.2.1" + "@google-cloud/retail": "^1.2.2" }, "devDependencies": { "c8": "^7.1.0", From dbf7ed9b87471324e4b5bc8adf4352598c8b2a2f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 00:46:36 +0000 Subject: [PATCH 043/103] build(node): update deps used during postprocessing (#1243) (#106) --- packages/google-cloud-retail/protos/protos.d.ts | 3 ++- packages/google-cloud-retail/protos/protos.js | 7 +++++++ packages/google-cloud-retail/protos/protos.json | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 8bcc0238210..ccaaff17452 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -29337,7 +29337,8 @@ export namespace google { OUTPUT_ONLY = 3, INPUT_ONLY = 4, IMMUTABLE = 5, - UNORDERED_LIST = 6 + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 } /** Properties of a ResourceDescriptor. */ diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 7f20499b9a7..9835f14e555 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -72271,6 +72271,7 @@ * @property {number} INPUT_ONLY=4 INPUT_ONLY value * @property {number} IMMUTABLE=5 IMMUTABLE value * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -72281,6 +72282,7 @@ values[valuesById[4] = "INPUT_ONLY"] = 4; values[valuesById[5] = "IMMUTABLE"] = 5; values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; return values; })(); @@ -78712,6 +78714,7 @@ case 4: case 5: case 6: + case 7: break; } } @@ -78816,6 +78819,10 @@ case 6: message[".google.api.fieldBehavior"][i] = 6; break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; } } if (object[".google.api.resourceReference"] != null) { diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 61b091a4c89..20ff3e3d23e 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -7511,7 +7511,8 @@ "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, "IMMUTABLE": 5, - "UNORDERED_LIST": 6 + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 } }, "resourceReference": { @@ -8187,6 +8188,18 @@ ] ], "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], [ 8, 8 From 7f3dfee2a84aaa41966cf3abf1b09cbbe690c7c7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 15:52:00 -0700 Subject: [PATCH 044/103] docs: Keep the API doc up-to-date feat: add search mode to search request. If not specified, a single search request triggers both product search and faceted search. feat: update grpc service config settings to reflect correct API deadlines PiperOrigin-RevId: 404039072 Source-Link: https://github.com/googleapis/googleapis/commit/8ef531eaf6e03d709b0dabf1e2202c16685a96d8 Source-Link: https://github.com/googleapis/googleapis-gen/commit/86e91097a445a4b0972a20e4b0e3e87f9aadd2c0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODZlOTEwOTdhNDQ1YTRiMDk3MmEyMGU0YjBlM2U4N2Y5YWFkZDJjMCJ9 --- .../google/cloud/retail/v2/common.proto | 6 +- .../google/cloud/retail/v2/product.proto | 19 +- .../cloud/retail/v2/product_service.proto | 13 +- .../cloud/retail/v2/search_service.proto | 65 ++++- .../google/cloud/retail/v2/user_event.proto | 8 +- .../google/cloud/retail/v2alpha/common.proto | 6 +- .../google/cloud/retail/v2alpha/product.proto | 10 +- .../retail/v2alpha/product_service.proto | 9 +- .../cloud/retail/v2alpha/search_service.proto | 69 ++++- .../cloud/retail/v2alpha/user_event.proto | 8 +- .../google/cloud/retail/v2beta/common.proto | 6 +- .../google/cloud/retail/v2beta/product.proto | 10 +- .../cloud/retail/v2beta/product_service.proto | 9 +- .../cloud/retail/v2beta/search_service.proto | 65 ++++- .../cloud/retail/v2beta/user_event.proto | 8 +- .../google-cloud-retail/protos/protos.d.ts | 39 +++ packages/google-cloud-retail/protos/protos.js | 168 +++++++++++ .../google-cloud-retail/protos/protos.json | 33 +++ .../v2/catalog_service.get_default_branch.js | 51 ++++ .../v2/catalog_service.list_catalogs.js | 77 +++++ .../v2/catalog_service.set_default_branch.js | 65 +++++ .../v2/catalog_service.update_catalog.js | 64 +++++ .../v2/completion_service.complete_query.js | 110 +++++++ ...mpletion_service.import_completion_data.js | 67 +++++ .../v2/prediction_service.predict.js | 152 ++++++++++ .../product_service.add_fulfillment_places.js | 109 +++++++ .../v2/product_service.create_product.js | 74 +++++ .../v2/product_service.delete_product.js | 68 +++++ .../v2/product_service.get_product.js | 59 ++++ .../v2/product_service.import_products.js | 98 +++++++ .../v2/product_service.list_products.js | 124 ++++++++ ...oduct_service.remove_fulfillment_places.js | 105 +++++++ .../v2/product_service.set_inventory.js | 104 +++++++ .../v2/product_service.update_product.js | 74 +++++ .../generated/v2/search_service.search.js | 246 ++++++++++++++++ .../user_event_service.collect_user_event.js | 72 +++++ .../user_event_service.import_user_events.js | 63 ++++ .../user_event_service.purge_user_events.js | 84 ++++++ .../user_event_service.rejoin_user_events.js | 61 ++++ .../v2/user_event_service.write_user_event.js | 58 ++++ .../catalog_service.get_default_branch.js | 51 ++++ .../v2alpha/catalog_service.list_catalogs.js | 77 +++++ .../catalog_service.set_default_branch.js | 65 +++++ .../v2alpha/catalog_service.update_catalog.js | 64 +++++ .../completion_service.complete_query.js | 111 ++++++++ ...mpletion_service.import_completion_data.js | 67 +++++ .../v2alpha/prediction_service.predict.js | 152 ++++++++++ .../product_service.add_fulfillment_places.js | 109 +++++++ .../v2alpha/product_service.create_product.js | 74 +++++ .../v2alpha/product_service.delete_product.js | 69 +++++ .../v2alpha/product_service.get_product.js | 59 ++++ .../product_service.import_products.js | 98 +++++++ .../v2alpha/product_service.list_products.js | 135 +++++++++ ...oduct_service.remove_fulfillment_places.js | 105 +++++++ .../v2alpha/product_service.set_inventory.js | 104 +++++++ .../v2alpha/product_service.update_product.js | 74 +++++ .../v2alpha/search_service.search.js | 269 ++++++++++++++++++ .../user_event_service.collect_user_event.js | 72 +++++ .../user_event_service.import_user_events.js | 63 ++++ .../user_event_service.purge_user_events.js | 85 ++++++ .../user_event_service.rejoin_user_events.js | 61 ++++ .../user_event_service.write_user_event.js | 58 ++++ .../catalog_service.get_default_branch.js | 51 ++++ .../v2beta/catalog_service.list_catalogs.js | 77 +++++ .../catalog_service.set_default_branch.js | 65 +++++ .../v2beta/catalog_service.update_catalog.js | 64 +++++ .../completion_service.complete_query.js | 110 +++++++ ...mpletion_service.import_completion_data.js | 67 +++++ .../v2beta/prediction_service.predict.js | 152 ++++++++++ .../product_service.add_fulfillment_places.js | 109 +++++++ .../v2beta/product_service.create_product.js | 74 +++++ .../v2beta/product_service.delete_product.js | 69 +++++ .../v2beta/product_service.get_product.js | 59 ++++ .../v2beta/product_service.import_products.js | 98 +++++++ .../v2beta/product_service.list_products.js | 126 ++++++++ ...oduct_service.remove_fulfillment_places.js | 105 +++++++ .../v2beta/product_service.set_inventory.js | 104 +++++++ .../v2beta/product_service.update_product.js | 74 +++++ .../generated/v2beta/search_service.search.js | 248 ++++++++++++++++ .../user_event_service.collect_user_event.js | 72 +++++ .../user_event_service.import_user_events.js | 63 ++++ .../user_event_service.purge_user_events.js | 85 ++++++ .../user_event_service.rejoin_user_events.js | 61 ++++ .../user_event_service.write_user_event.js | 58 ++++ .../src/v2/catalog_service_client.ts | 6 +- .../src/v2/product_service_client.ts | 16 +- .../src/v2/search_service_client.ts | 99 ++++--- .../src/v2alpha/catalog_service_client.ts | 6 +- .../src/v2alpha/product_service_client.ts | 12 +- .../src/v2alpha/search_service_client.ts | 111 +++++--- .../src/v2beta/catalog_service_client.ts | 6 +- .../src/v2beta/product_service_client.ts | 12 +- .../src/v2beta/search_service_client.ts | 99 ++++--- 93 files changed, 6711 insertions(+), 205 deletions(-) create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/search_service.search.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index afbdcd053a2..157d22aa0b8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -84,7 +84,7 @@ message ColorInfo { // it is expected to have only 1 color. May consider using single "Mixed" // instead of multiple values. // - // A maximum of 5 colors are allowed. Each value must be a UTF-8 encoded + // A maximum of 25 colors are allowed. Each value must be a UTF-8 encoded // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // @@ -172,8 +172,8 @@ message FulfillmentInfo { // or the region IDs for // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type]. // - // A maximum of 2000 values are allowed. Each value must be a string with a - // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as + // A maximum of 3000 values are allowed. Each value must be a string with a + // length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. repeated string place_ids = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 2c411078581..545cc99cc8f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -115,18 +115,23 @@ message Product { // and // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // + // [expire_time][google.cloud.retail.v2.Product.expire_time] must be later + // than [available_time][google.cloud.retail.v2.Product.available_time] and + // [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an + // INVALID_ARGUMENT error is thrown. + // // Google Merchant Center property // [expiration_date](https://support.google.com/merchants/answer/6324499). google.protobuf.Timestamp expire_time = 16; // Input only. The TTL (time to live) of the product. // - // If it is set, [expire_time][google.cloud.retail.v2.Product.expire_time] - // is set as current timestamp plus - // [ttl][google.cloud.retail.v2.Product.ttl]. The derived - // [expire_time][google.cloud.retail.v2.Product.expire_time] is returned in - // the output and [ttl][google.cloud.retail.v2.Product.ttl] is left blank - // when retrieving the [Product][google.cloud.retail.v2.Product]. + // If it is set, it must be a non-negative value, and + // [expire_time][google.cloud.retail.v2.Product.expire_time] is set as + // current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The + // derived [expire_time][google.cloud.retail.v2.Product.expire_time] is + // returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is + // left blank when retrieving the [Product][google.cloud.retail.v2.Product]. // // If it is set, the product is not available for // [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after @@ -141,8 +146,6 @@ message Product { // 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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index 3c381eb3e94..03c5a752b91 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -20,6 +20,7 @@ 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/common.proto"; import "google/cloud/retail/v2/import_config.proto"; import "google/cloud/retail/v2/product.proto"; import "google/cloud/retail/v2/purge_config.proto"; @@ -476,7 +477,7 @@ message SetInventoryRequest { // [Product.name][google.cloud.retail.v2.Product.name] is not found, the // inventory update will still be processed and retained for at most 1 day // until the [Product][google.cloud.retail.v2.Product] is created. If set to - // false, an INVALID_ARGUMENT error is returned if the + // false, a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2.Product] is not found. bool allow_missing = 4; } @@ -551,8 +552,8 @@ message AddFulfillmentPlacesRequest { // If set to true, and the [Product][google.cloud.retail.v2.Product] is not // found, the fulfillment information will still be processed and retained for // at most 1 day and processed once the - // [Product][google.cloud.retail.v2.Product] is created. If set to false, an - // INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2.Product] is created. If set to false, a + // NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2.Product] is not found. bool allow_missing = 5; } @@ -562,7 +563,7 @@ message AddFulfillmentPlacesRequest { // [AddFulfillmentPlaces][] method. message AddFulfillmentPlacesMetadata {} -// Response of the RemoveFulfillmentPlacesRequest. Currently empty because +// Response of the AddFulfillmentPlacesRequest. Currently empty because // there is no meaningful response populated from the [AddFulfillmentPlaces][] // method. message AddFulfillmentPlacesResponse {} @@ -622,8 +623,8 @@ message RemoveFulfillmentPlacesRequest { // If set to true, and the [Product][google.cloud.retail.v2.Product] is not // found, the fulfillment information will still be processed and retained for // at most 1 day and processed once the - // [Product][google.cloud.retail.v2.Product] is created. If set to false, an - // INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2.Product] is created. If set to false, a + // NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2.Product] is not found. bool allow_missing = 5; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 38ccb464928..bf32f607f52 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -103,6 +103,7 @@ message SearchRequest { // * "rating" // * "ratingCount" // * "attributes.key" + // * "inventory(place_id,price)" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -349,14 +350,39 @@ message SearchRequest { bool pin_unexpanded_results = 2; } + // The search mode of each search request. + enum SearchMode { + // Default value. In this case both product search and faceted search will + // be performed. Both [SearchResponse.SearchResult] and + // [SearchResponse.Facet] will be returned. + SEARCH_MODE_UNSPECIFIED = 0; + + // Only product search will be performed. The faceted search will be + // disabled. + // + // Only [SearchResponse.SearchResult] will be returned. + // [SearchResponse.Facet] will not be returned, even if + // [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs] + // or + // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec] + // is set. + PRODUCT_SEARCH_ONLY = 1; + + // Only faceted search will be performed. The product search will be + // disabled. + // + // When in this mode, one or both of [SearchRequest.facet_spec][] and + // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec] + // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only + // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] + // will not be returned. + FACETED_SEARCH_ONLY = 2; + } + // Required. The resource name of the search engine placement, such as // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - // This field is used to identify the set of models that will be used to make - // the search. - // - // We currently support one placement with the following ID: - // - // * `default_search`. + // This field is used to identify the serving configuration name and the set + // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; // The branch resource name, such as @@ -413,7 +439,8 @@ message SearchRequest { // The filter syntax consists of an expression language for constructing a // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. + // expression is case-sensitive. See more details at this [user + // guide](https://cloud.google.com/retail/docs/filter-and-order#filter). // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; @@ -431,7 +458,9 @@ message SearchRequest { // The order in which products are returned. Products can be ordered by // a field in an [Product][google.cloud.retail.v2.Product] object. Leave it - // unset if ordered by relevance. OrderBy expression is case-sensitive. + // unset if ordered by relevance. OrderBy expression is case-sensitive. See + // more details at this [user + // guide](https://cloud.google.com/retail/docs/filter-and-order#order). // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string order_by = 11; @@ -449,11 +478,19 @@ message SearchRequest { // support team if you are interested in using dynamic facet feature. DynamicFacetSpec dynamic_facet_spec = 21; - // Boost specification to boost certain products. + // Boost specification to boost certain products. See more details at this + // [user guide](https://cloud.google.com/retail/docs/boosting). + // + // Notice that if both [ServingConfig.boost_control_ids][] and + // [SearchRequest.boost_spec] are set, the boost conditions from both places + // are evaluated. If a search request matches multiple boost conditions, + // the final boost score is equal to the sum of the boost scores from all + // matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur. + // query expansion will occur. See more details at this [user + // guide](https://cloud.google.com/retail/docs/result-size#query_expansion). QueryExpansionSpec query_expansion_spec = 14; // The keys to fetch and rollup the matching @@ -476,6 +513,7 @@ message SearchRequest { // * price // * originalPrice // * discount + // * inventory(place_id,price) // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2.Product.attributes] map. // * pickupInStore.id, where id is any @@ -532,6 +570,10 @@ message SearchRequest { // instance, a special sale page may have the category hierarchy: // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. repeated string page_categories = 23; + + // The search mode of the search request. If not specified, a single search + // request triggers both product search and faceted search. + SearchMode search_mode = 31; } // Response message for @@ -646,7 +688,8 @@ message SearchResponse { bool expanded_query = 1; // Number of pinned results. This field will only be set when expansion - // happens and [SearchRequest.query_expansion_spec.pin_unexpanded_results][] + // happens and + // [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results] // is set to true. int64 pinned_result_count = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto index e4bb810b170..a1f7f217fd3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto @@ -120,12 +120,12 @@ message UserEvent { // * `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 + // user on the current page (the end user may have not finished browsing 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. + // desired. The end user may have not finished browsing the whole page yet. repeated ProductDetail product_details = 6; // The main completion details related to the event. @@ -146,7 +146,7 @@ message UserEvent { // search, and etc. map attributes = 7; - // The id or name of the associated shopping cart. This id is used + // 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 @@ -241,7 +241,7 @@ message UserEvent { // Tag Manager, this value is filled in automatically. string referrer_uri = 14; - // A unique id of a web page view. + // 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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index f74513951e3..a0d90b3ee1a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -84,7 +84,7 @@ message ColorInfo { // it is expected to have only 1 color. May consider using single "Mixed" // instead of multiple values. // - // A maximum of 5 colors are allowed. Each value must be a UTF-8 encoded + // A maximum of 25 colors are allowed. Each value must be a UTF-8 encoded // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // @@ -175,8 +175,8 @@ message FulfillmentInfo { // or the region IDs for // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2alpha.FulfillmentInfo.type]. // - // A maximum of 2000 values are allowed. Each value must be a string with a - // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as + // A maximum of 3000 values are allowed. Each value must be a string with a + // length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. repeated string place_ids = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index 0fb40bc9144..03534ed9b3d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -115,13 +115,19 @@ message Product { // and // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // + // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] must be + // later than + // [available_time][google.cloud.retail.v2alpha.Product.available_time] and + // [publish_time][google.cloud.retail.v2alpha.Product.publish_time], + // otherwise an INVALID_ARGUMENT error is thrown. + // // Google Merchant Center property // [expiration_date](https://support.google.com/merchants/answer/6324499). google.protobuf.Timestamp expire_time = 16; // Input only. The TTL (time to live) of the product. // - // If it is set, + // If it is set, it must be a non-negative value, and // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is set as // current timestamp plus [ttl][google.cloud.retail.v2alpha.Product.ttl]. // The derived @@ -144,8 +150,6 @@ message Product { // 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.v2alpha.Product] identifier, which diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index 4590a90b579..df9c77e7fac 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -20,6 +20,7 @@ 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/v2alpha/common.proto"; import "google/cloud/retail/v2alpha/export_config.proto"; import "google/cloud/retail/v2alpha/import_config.proto"; import "google/cloud/retail/v2alpha/product.proto"; @@ -505,7 +506,7 @@ message SetInventoryRequest { // name [Product.name][google.cloud.retail.v2alpha.Product.name] is not found, // the inventory update will still be processed and retained for at most 1 day // until the [Product][google.cloud.retail.v2alpha.Product] is created. If set - // to false, an INVALID_ARGUMENT error is returned if the + // to false, a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2alpha.Product] is not found. bool allow_missing = 4; } @@ -581,7 +582,7 @@ message AddFulfillmentPlacesRequest { // not found, the fulfillment information will still be processed and retained // for at most 1 day and processed once the // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // an INVALID_ARGUMENT error is returned if the + // a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2alpha.Product] is not found. bool allow_missing = 5; } @@ -591,7 +592,7 @@ message AddFulfillmentPlacesRequest { // [AddFulfillmentPlaces][] method. message AddFulfillmentPlacesMetadata {} -// Response of the RemoveFulfillmentPlacesRequest. Currently empty because +// Response of the AddFulfillmentPlacesRequest. Currently empty because // there is no meaningful response populated from the [AddFulfillmentPlaces][] // method. message AddFulfillmentPlacesResponse {} @@ -652,7 +653,7 @@ message RemoveFulfillmentPlacesRequest { // not found, the fulfillment information will still be processed and retained // for at most 1 day and processed once the // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // an INVALID_ARGUMENT error is returned if the + // a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2alpha.Product] is not found. bool allow_missing = 5; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index f728a9eaeac..874d4fa3052 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -104,6 +104,7 @@ message SearchRequest { // * "rating" // * "ratingCount" // * "attributes.key" + // * "inventory(place_id,price)" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -372,14 +373,39 @@ message SearchRequest { LOWEST = 4; } + // The search mode of each search request. + enum SearchMode { + // Default value. In this case both product search and faceted search will + // be performed. Both [SearchResponse.SearchResult] and + // [SearchResponse.Facet] will be returned. + SEARCH_MODE_UNSPECIFIED = 0; + + // Only product search will be performed. The faceted search will be + // disabled. + // + // Only [SearchResponse.SearchResult] will be returned. + // [SearchResponse.Facet] will not be returned, even if + // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] + // or + // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] + // is set. + PRODUCT_SEARCH_ONLY = 1; + + // Only faceted search will be performed. The product search will be + // disabled. + // + // When in this mode, one or both of [SearchRequest.facet_spec][] and + // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] + // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only + // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] + // will not be returned. + FACETED_SEARCH_ONLY = 2; + } + // Required. The resource name of the search engine placement, such as // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - // This field is used to identify the set of models that will be used to make - // the search. - // - // We currently support one placement with the following ID: - // - // * `default_search`. + // This field is used to identify the serving configuration name and the set + // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; // The branch resource name, such as @@ -437,7 +463,8 @@ message SearchRequest { // The filter syntax consists of an expression language for constructing a // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. + // expression is case-sensitive. See more details at this [user + // guide](https://cloud.google.com/retail/docs/filter-and-order#filter). // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; @@ -456,7 +483,9 @@ message SearchRequest { // The order in which products are returned. Products can be ordered by // a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave - // it unset if ordered by relevance. OrderBy expression is case-sensitive. + // it unset if ordered by relevance. OrderBy expression is case-sensitive. See + // more details at this [user + // guide](https://cloud.google.com/retail/docs/filter-and-order#order). // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string order_by = 11; @@ -474,11 +503,20 @@ message SearchRequest { // support team if you are interested in using dynamic facet feature. DynamicFacetSpec dynamic_facet_spec = 21; - // Boost specification to boost certain products. + // Boost specification to boost certain products. See more details at this + // [user guide](https://cloud.google.com/retail/docs/boosting). + // + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] + // and [SearchRequest.boost_spec] are set, the boost conditions from both + // places are evaluated. If a search request matches multiple boost + // conditions, the final boost score is equal to the sum of the boost scores + // from all matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur.. + // query expansion will occur. See more details at this [user + // guide](https://cloud.google.com/retail/docs/result-size#query_expansion). QueryExpansionSpec query_expansion_spec = 14; // The relevance threshold of the search results. @@ -486,7 +524,8 @@ message SearchRequest { // Defaults to // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], // which means only the most relevant results are shown, and the least number - // of results are returned. + // of results are returned. See more details at this [user + // guide](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). RelevanceThreshold relevance_threshold = 15; // The keys to fetch and rollup the matching @@ -511,6 +550,7 @@ message SearchRequest { // * price // * originalPrice // * discount + // * inventory(place_id,price) // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. // * pickupInStore.id, where id is any @@ -576,6 +616,10 @@ message SearchRequest { // instance, a special sale page may have the category hierarchy: // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. repeated string page_categories = 23; + + // The search mode of the search request. If not specified, a single search + // request triggers both product search and faceted search. + SearchMode search_mode = 31; } // Response message for @@ -692,7 +736,8 @@ message SearchResponse { bool expanded_query = 1; // Number of pinned results. This field will only be set when expansion - // happens and [SearchRequest.query_expansion_spec.pin_unexpanded_results][] + // happens and + // [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.pin_unexpanded_results] // is set to true. int64 pinned_result_count = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto index 7ea735756ef..6e025f7a902 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -120,12 +120,12 @@ message UserEvent { // * `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 + // user on the current page (the end user may have not finished browsing 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.v2alpha.UserEvent.product_details] is - // desired. The end user may have not finished broswing the whole page yet. + // desired. The end user may have not finished browsing the whole page yet. repeated ProductDetail product_details = 6; // The main completion details related to the event. @@ -146,7 +146,7 @@ message UserEvent { // search, and etc. map attributes = 7; - // The id or name of the associated shopping cart. This id is used + // 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 @@ -244,7 +244,7 @@ message UserEvent { // Tag Manager, this value is filled in automatically. string referrer_uri = 14; - // A unique id of a web page view. + // 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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index a31c8f1b26e..62d11cb58e8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -84,7 +84,7 @@ message ColorInfo { // it is expected to have only 1 color. May consider using single "Mixed" // instead of multiple values. // - // A maximum of 5 colors are allowed. Each value must be a UTF-8 encoded + // A maximum of 25 colors are allowed. Each value must be a UTF-8 encoded // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // @@ -175,8 +175,8 @@ message FulfillmentInfo { // or the region IDs for // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2beta.FulfillmentInfo.type]. // - // A maximum of 2000 values are allowed. Each value must be a string with a - // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as + // A maximum of 3000 values are allowed. Each value must be a string with a + // length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. repeated string place_ids = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 64ccef1ca45..78d45b04ad5 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -115,13 +115,19 @@ message Product { // and // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // + // [expire_time][google.cloud.retail.v2beta.Product.expire_time] must be + // later than + // [available_time][google.cloud.retail.v2beta.Product.available_time] and + // [publish_time][google.cloud.retail.v2beta.Product.publish_time], + // otherwise an INVALID_ARGUMENT error is thrown. + // // Google Merchant Center property // [expiration_date](https://support.google.com/merchants/answer/6324499). google.protobuf.Timestamp expire_time = 16; // Input only. The TTL (time to live) of the product. // - // If it is set, + // If it is set, it must be a non-negative value, and // [expire_time][google.cloud.retail.v2beta.Product.expire_time] is set as // current timestamp plus [ttl][google.cloud.retail.v2beta.Product.ttl]. The // derived [expire_time][google.cloud.retail.v2beta.Product.expire_time] is @@ -143,8 +149,6 @@ message Product { // 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.v2beta.Product] identifier, which diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index 53937b4b6c6..b1c62cb5866 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -20,6 +20,7 @@ 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/v2beta/common.proto"; import "google/cloud/retail/v2beta/export_config.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/product.proto"; @@ -481,7 +482,7 @@ message SetInventoryRequest { // name [Product.name][google.cloud.retail.v2beta.Product.name] is not found, // the inventory update will still be processed and retained for at most 1 day // until the [Product][google.cloud.retail.v2beta.Product] is created. If set - // to false, an INVALID_ARGUMENT error is returned if the + // to false, a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2beta.Product] is not found. bool allow_missing = 4; } @@ -557,7 +558,7 @@ message AddFulfillmentPlacesRequest { // not found, the fulfillment information will still be processed and retained // for at most 1 day and processed once the // [Product][google.cloud.retail.v2beta.Product] is created. If set to false, - // an INVALID_ARGUMENT error is returned if the + // a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2beta.Product] is not found. bool allow_missing = 5; } @@ -567,7 +568,7 @@ message AddFulfillmentPlacesRequest { // [AddFulfillmentPlaces][] method. message AddFulfillmentPlacesMetadata {} -// Response of the RemoveFulfillmentPlacesRequest. Currently empty because +// Response of the AddFulfillmentPlacesRequest. Currently empty because // there is no meaningful response populated from the [AddFulfillmentPlaces][] // method. message AddFulfillmentPlacesResponse {} @@ -628,7 +629,7 @@ message RemoveFulfillmentPlacesRequest { // not found, the fulfillment information will still be processed and retained // for at most 1 day and processed once the // [Product][google.cloud.retail.v2beta.Product] is created. If set to false, - // an INVALID_ARGUMENT error is returned if the + // a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2beta.Product] is not found. bool allow_missing = 5; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index 7679f9d609d..cb64c819458 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -104,6 +104,7 @@ message SearchRequest { // * "rating" // * "ratingCount" // * "attributes.key" + // * "inventory(place_id,price)" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -351,14 +352,39 @@ message SearchRequest { bool pin_unexpanded_results = 2; } + // The search mode of each search request. + enum SearchMode { + // Default value. In this case both product search and faceted search will + // be performed. Both [SearchResponse.SearchResult] and + // [SearchResponse.Facet] will be returned. + SEARCH_MODE_UNSPECIFIED = 0; + + // Only product search will be performed. The faceted search will be + // disabled. + // + // Only [SearchResponse.SearchResult] will be returned. + // [SearchResponse.Facet] will not be returned, even if + // [SearchRequest.facet_specs][google.cloud.retail.v2beta.SearchRequest.facet_specs] + // or + // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2beta.SearchRequest.dynamic_facet_spec] + // is set. + PRODUCT_SEARCH_ONLY = 1; + + // Only faceted search will be performed. The product search will be + // disabled. + // + // When in this mode, one or both of [SearchRequest.facet_spec][] and + // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2beta.SearchRequest.dynamic_facet_spec] + // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only + // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] + // will not be returned. + FACETED_SEARCH_ONLY = 2; + } + // Required. The resource name of the search engine placement, such as // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - // This field is used to identify the set of models that will be used to make - // the search. - // - // We currently support one placement with the following ID: - // - // * `default_search`. + // This field is used to identify the serving configuration name and the set + // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; // The branch resource name, such as @@ -415,7 +441,8 @@ message SearchRequest { // The filter syntax consists of an expression language for constructing a // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. + // expression is case-sensitive. See more details at this [user + // guide](https://cloud.google.com/retail/docs/filter-and-order#filter). // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; @@ -433,7 +460,9 @@ message SearchRequest { // The order in which products are returned. Products can be ordered by // a field in an [Product][google.cloud.retail.v2beta.Product] object. Leave - // it unset if ordered by relevance. OrderBy expression is case-sensitive. + // it unset if ordered by relevance. OrderBy expression is case-sensitive. See + // more details at this [user + // guide](https://cloud.google.com/retail/docs/filter-and-order#order). // // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string order_by = 11; @@ -451,11 +480,19 @@ message SearchRequest { // support team if you are interested in using dynamic facet feature. DynamicFacetSpec dynamic_facet_spec = 21; - // Boost specification to boost certain products. + // Boost specification to boost certain products. See more details at this + // [user guide](https://cloud.google.com/retail/docs/boosting). + // + // Notice that if both [ServingConfig.boost_control_ids][] and + // [SearchRequest.boost_spec] are set, the boost conditions from both places + // are evaluated. If a search request matches multiple boost conditions, + // the final boost score is equal to the sum of the boost scores from all + // matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which - // query expansion will occur. + // query expansion will occur. See more details at this [user + // guide](https://cloud.google.com/retail/docs/result-size#query_expansion). QueryExpansionSpec query_expansion_spec = 14; // The keys to fetch and rollup the matching @@ -480,6 +517,7 @@ message SearchRequest { // * price // * originalPrice // * discount + // * inventory(place_id,price) // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. // * pickupInStore.id, where id is any @@ -536,6 +574,10 @@ message SearchRequest { // instance, a special sale page may have the category hierarchy: // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. repeated string page_categories = 23; + + // The search mode of the search request. If not specified, a single search + // request triggers both product search and faceted search. + SearchMode search_mode = 31; } // Response message for @@ -652,7 +694,8 @@ message SearchResponse { bool expanded_query = 1; // Number of pinned results. This field will only be set when expansion - // happens and [SearchRequest.query_expansion_spec.pin_unexpanded_results][] + // happens and + // [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.pin_unexpanded_results] // is set to true. int64 pinned_result_count = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index 325b6e54ebd..842064a89d9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -120,12 +120,12 @@ message UserEvent { // * `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 + // user on the current page (the end user may have not finished browsing 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.v2beta.UserEvent.product_details] is - // desired. The end user may have not finished broswing the whole page yet. + // desired. The end user may have not finished browsing the whole page yet. repeated ProductDetail product_details = 6; // The main completion details related to the event. @@ -146,7 +146,7 @@ message UserEvent { // search, and etc. map attributes = 7; - // The id or name of the associated shopping cart. This id is used + // 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 @@ -242,7 +242,7 @@ message UserEvent { // Tag Manager, this value is filled in automatically. string referrer_uri = 14; - // A unique id of a web page view. + // 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 diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index ccaaff17452..07e4bdadf14 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -7411,6 +7411,9 @@ export namespace google { /** SearchRequest pageCategories */ pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode|null); } /** Represents a SearchRequest. */ @@ -7473,6 +7476,9 @@ export namespace google { /** SearchRequest pageCategories. */ public pageCategories: string[]; + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode); + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -8177,6 +8183,13 @@ export namespace google { AUTO = 3 } } + + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } } /** Properties of a SearchResponse. */ @@ -17330,6 +17343,9 @@ export namespace google { /** SearchRequest pageCategories */ pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode|null); } /** Represents a SearchRequest. */ @@ -17395,6 +17411,9 @@ export namespace google { /** SearchRequest pageCategories. */ public pageCategories: string[]; + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode); + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -18108,6 +18127,13 @@ export namespace google { LOW = 3, LOWEST = 4 } + + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } } /** Properties of a SearchResponse. */ @@ -27048,6 +27074,9 @@ export namespace google { /** SearchRequest pageCategories */ pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2beta.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SearchMode|null); } /** Represents a SearchRequest. */ @@ -27110,6 +27139,9 @@ export namespace google { /** SearchRequest pageCategories. */ public pageCategories: string[]; + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2beta.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SearchMode); + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -27814,6 +27846,13 @@ export namespace google { AUTO = 3 } } + + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } } /** Properties of a SearchResponse. */ diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 9835f14e555..2f6524a6afe 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -18072,6 +18072,7 @@ * @property {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode */ /** @@ -18228,6 +18229,14 @@ */ SearchRequest.prototype.pageCategories = $util.emptyArray; + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -18289,6 +18298,8 @@ writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); return writer; }; @@ -18380,6 +18391,9 @@ message.pageCategories = []; message.pageCategories.push(reader.string()); break; + case 31: + message.searchMode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -18488,6 +18502,15 @@ if (!$util.isString(message.pageCategories[i])) return "pageCategories: string[] expected"; } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -18567,6 +18590,20 @@ for (var i = 0; i < object.pageCategories.length; ++i) message.pageCategories[i] = String(object.pageCategories[i]); } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } return message; }; @@ -18603,6 +18640,7 @@ object.queryExpansionSpec = null; object.dynamicFacetSpec = null; object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; } if (message.placement != null && message.hasOwnProperty("placement")) object.placement = message.placement; @@ -18647,6 +18685,8 @@ } if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; return object; }; @@ -20211,6 +20251,22 @@ return QueryExpansionSpec; })(); + /** + * SearchMode enum. + * @name google.cloud.retail.v2.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + */ + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); + return SearchRequest; })(); @@ -42472,6 +42528,7 @@ * @property {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null} [relevanceThreshold] SearchRequest relevanceThreshold * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2alpha.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode */ /** @@ -42636,6 +42693,14 @@ */ SearchRequest.prototype.pageCategories = $util.emptyArray; + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2alpha.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -42699,6 +42764,8 @@ writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); return writer; }; @@ -42793,6 +42860,9 @@ message.pageCategories = []; message.pageCategories.push(reader.string()); break; + case 31: + message.searchMode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -42912,6 +42982,15 @@ if (!$util.isString(message.pageCategories[i])) return "pageCategories: string[] expected"; } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -43013,6 +43092,20 @@ for (var i = 0; i < object.pageCategories.length; ++i) message.pageCategories[i] = String(object.pageCategories[i]); } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } return message; }; @@ -43050,6 +43143,7 @@ object.relevanceThreshold = options.enums === String ? "RELEVANCE_THRESHOLD_UNSPECIFIED" : 0; object.dynamicFacetSpec = null; object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; } if (message.placement != null && message.hasOwnProperty("placement")) object.placement = message.placement; @@ -43096,6 +43190,8 @@ } if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; return object; }; @@ -44680,6 +44776,22 @@ return values; })(); + /** + * SearchMode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + */ + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); + return SearchRequest; })(); @@ -66397,6 +66509,7 @@ * @property {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2beta.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode */ /** @@ -66553,6 +66666,14 @@ */ SearchRequest.prototype.pageCategories = $util.emptyArray; + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2beta.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -66614,6 +66735,8 @@ writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); return writer; }; @@ -66705,6 +66828,9 @@ message.pageCategories = []; message.pageCategories.push(reader.string()); break; + case 31: + message.searchMode = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -66813,6 +66939,15 @@ if (!$util.isString(message.pageCategories[i])) return "pageCategories: string[] expected"; } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -66892,6 +67027,20 @@ for (var i = 0; i < object.pageCategories.length; ++i) message.pageCategories[i] = String(object.pageCategories[i]); } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } return message; }; @@ -66928,6 +67077,7 @@ object.queryExpansionSpec = null; object.dynamicFacetSpec = null; object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; } if (message.placement != null && message.hasOwnProperty("placement")) object.placement = message.placement; @@ -66972,6 +67122,8 @@ } if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] : message.searchMode; return object; }; @@ -68536,6 +68688,22 @@ return QueryExpansionSpec; })(); + /** + * SearchMode enum. + * @name google.cloud.retail.v2beta.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + */ + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); + return SearchRequest; })(); diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 20ff3e3d23e..b9fd950391f 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -1973,6 +1973,10 @@ "rule": "repeated", "type": "string", "id": 23 + }, + "searchMode": { + "type": "SearchMode", + "id": 31 } }, "nested": { @@ -2101,6 +2105,13 @@ } } } + }, + "SearchMode": { + "values": { + "SEARCH_MODE_UNSPECIFIED": 0, + "PRODUCT_SEARCH_ONLY": 1, + "FACETED_SEARCH_ONLY": 2 + } } } }, @@ -4481,6 +4492,10 @@ "rule": "repeated", "type": "string", "id": 23 + }, + "searchMode": { + "type": "SearchMode", + "id": 31 } }, "nested": { @@ -4618,6 +4633,13 @@ "LOW": 3, "LOWEST": 4 } + }, + "SearchMode": { + "values": { + "SEARCH_MODE_UNSPECIFIED": 0, + "PRODUCT_SEARCH_ONLY": 1, + "FACETED_SEARCH_ONLY": 2 + } } } }, @@ -6953,6 +6975,10 @@ "rule": "repeated", "type": "string", "id": 23 + }, + "searchMode": { + "type": "SearchMode", + "id": 31 } }, "nested": { @@ -7081,6 +7107,13 @@ } } } + }, + "SearchMode": { + "values": { + "SEARCH_MODE_UNSPECIFIED": 0, + "PRODUCT_SEARCH_ONLY": 1, + "FACETED_SEARCH_ONLY": 2 + } } } }, diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js new file mode 100644 index 00000000000..9fe97d816a5 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js @@ -0,0 +1,51 @@ +// Copyright 2021 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. + +'use strict'; + +function main() { + // [START retail_v2_generated_CatalogService_GetDefaultBranch_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function getDefaultBranch() { + // Construct request + const request = {}; + + // Run request + const response = await retailClient.getDefaultBranch(request); + console.log(response); + } + + getDefaultBranch(); + // [END retail_v2_generated_CatalogService_GetDefaultBranch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js new file mode 100644 index 00000000000..202bd7181f5 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js @@ -0,0 +1,77 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2_generated_CatalogService_ListCatalogs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const pageSize = 1234 + /** + * 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. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function listCatalogs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listCatalogsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listCatalogs(); + // [END retail_v2_generated_CatalogService_ListCatalogs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js new file mode 100644 index 00000000000..0fb5d32dfae --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js @@ -0,0 +1,65 @@ +// Copyright 2021 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. + +'use strict'; + +function main() { + // [START retail_v2_generated_CatalogService_SetDefaultBranch_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + /** + * The final component of the resource name of a branch. + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + */ + // const branchId = 'abc123' + /** + * Some note on this request, this can be retrieved by + * [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch] + * before next valid default branch set occurs. + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + */ + // const note = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function setDefaultBranch() { + // Construct request + const request = {}; + + // Run request + const response = await retailClient.setDefaultBranch(request); + console.log(response); + } + + setDefaultBranch(); + // [END retail_v2_generated_CatalogService_SetDefaultBranch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js new file mode 100644 index 00000000000..8854bfff33f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +'use strict'; + +function main(catalog) { + // [START retail_v2_generated_CatalogService_UpdateCatalog_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const catalog = '' + /** + * Indicates which fields in the provided + * [Catalog][google.cloud.retail.v2.Catalog] to update. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + */ + // const updateMask = '' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function updateCatalog() { + // Construct request + const request = { + catalog, + }; + + // Run request + const response = await retailClient.updateCatalog(request); + console.log(response); + } + + updateCatalog(); + // [END retail_v2_generated_CatalogService_UpdateCatalog_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js new file mode 100644 index 00000000000..2c3d3aa5003 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -0,0 +1,110 @@ +// Copyright 2021 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. + +'use strict'; + +function main(catalog, query) { + // [START retail_v2_generated_CompletionService_CompleteQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Catalog for which the completion is performed. + * Full resource name of catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + /** + * Required. The query used to generate suggestions. + * The maximum number of allowed characters is 255. + */ + // const query = 'abc123' + /** + * 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 logs in or 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. + */ + // const visitorId = 'abc123' + /** + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * The maximum number of allowed characters is 255. + * Only "en-US" is currently supported. + */ + // const languageCodes = 'abc123' + /** + * The device type context for completion suggestions. + * It is useful to apply different suggestions on different device types, e.g. + * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * types. + * Supported formats: + * * UNKNOWN_DEVICE_TYPE + * * DESKTOP + * * MOBILE + * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + */ + // const deviceType = 'abc123' + /** + * Determines which dataset to use for fetching completion. "user-data" will + * use the imported dataset through + * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. + * "cloud-retail" will use the dataset generated by cloud retail based on user + * events. If leave empty, it will use the "user-data". + * Current supported values: + * * user-data + * * cloud-retail + * This option requires additional allowlisting. Before using cloud-retail, + * contact Cloud Retail support team first. + */ + // const dataset = 'abc123' + /** + * Completion max suggestions. If left unset or set to 0, then will fallback + * to the configured value [CompletionConfig.max_suggestions][]. + * The maximum allowed max suggestions is 20. If it is set higher, it will be + * capped by 20. + */ + // const maxSuggestions = 1234 + + // Imports the Retail library + const {CompletionServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CompletionServiceClient(); + + async function completeQuery() { + // Construct request + const request = { + catalog, + query, + }; + + // Run request + const response = await retailClient.completeQuery(request); + console.log(response); + } + + completeQuery(); + // [END retail_v2_generated_CompletionService_CompleteQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js new file mode 100644 index 00000000000..b11a522e5d6 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js @@ -0,0 +1,67 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2_generated_CompletionService_ImportCompletionData_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog which the suggestions dataset belongs to. + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * [Operation][google.longrunning.Operation]. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + */ + // const notificationPubsubTopic = 'abc123' + + // Imports the Retail library + const {CompletionServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CompletionServiceClient(); + + async function importCompletionData() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importCompletionData(request); + const [response] = await operation.promise(); + console.log(response); + } + + importCompletionData(); + // [END retail_v2_generated_CompletionService_ImportCompletionData_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js new file mode 100644 index 00000000000..958bf3d648d --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -0,0 +1,152 @@ +// Copyright 2021 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. + +'use strict'; + +function main(placement, userEvent) { + // [START retail_v2_generated_PredictionService_Predict_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of the format: + * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} + * The ID of the Recommendations AI placement. Before you can request + * predictions from your model, you must create at least one placement for it. + * For more information, see [Managing + * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + * The full list of available placements can be seen at + * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + */ + // const placement = 'abc123' + /** + * 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. + */ + // const userEvent = '' + /** + * 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. + */ + // const pageSize = 1234 + /** + * The previous PredictResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * 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. + * Note: "Recently viewed" models don't support tag filtering at the + * moment. + * * 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`. + */ + // const filter = 'abc123' + /** + * 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. + */ + // const validateOnly = true + /** + * 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. + * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-price-reranking', 'low-price-reranking', + * 'medium-price-reranking', 'high-price-reranking'}. This gives + * request-level control and adjusts prediction results based on product + * price. + * * `diversityLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-diversity', 'low-diversity', + * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + * request-level control and adjusts prediction results based on product + * category. + */ + // const params = 1234 + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters, and cannot be empty. Values can be empty, and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + + // Imports the Retail library + const {PredictionServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new PredictionServiceClient(); + + async function predict() { + // Construct request + const request = { + placement, + userEvent, + }; + + // Run request + const response = await retailClient.predict(request); + console.log(response); + } + + predict(); + // [END retail_v2_generated_PredictionService_Predict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js new file mode 100644 index 00000000000..b933ab62f7e --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -0,0 +1,109 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, type, placeIds) { + // [START retail_v2_generated_ProductService_AddFulfillmentPlaces_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const product = 'abc123' + /** + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * Supported values: + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * This field directly corresponds to [Product.fulfillment_info.type][]. + */ + // const type = 'abc123' + /** + * Required. The IDs for this + * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as + * the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery" to be added for this + * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate + * IDs will be automatically ignored. + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * If the total number of place IDs exceeds 2000 for this + * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after + * adding, then the update will be rejected. + */ + // const placeIds = 'abc123' + /** + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + */ + // const addTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2.Product] is not + * found, the fulfillment information will still be processed and retained for + * at most 1 day and processed once the + * [Product][google.cloud.retail.v2.Product] is created. If set to false, a + * NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function addFulfillmentPlaces() { + // Construct request + const request = { + product, + type, + placeIds, + }; + + // Run request + const [operation] = await retailClient.addFulfillmentPlaces(request); + const [response] = await operation.promise(); + console.log(response); + } + + addFulfillmentPlaces(); + // [END retail_v2_generated_ProductService_AddFulfillmentPlaces_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js new file mode 100644 index 00000000000..028c99d005a --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js @@ -0,0 +1,74 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, product, productId) { + // [START retail_v2_generated_ProductService_CreateProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. + */ + // const parent = 'abc123' + /** + * Required. The [Product][google.cloud.retail.v2.Product] to create. + */ + // const product = '' + /** + * 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. + */ + // const productId = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function createProduct() { + // Construct request + const request = { + parent, + product, + productId, + }; + + // Run request + const response = await retailClient.createProduct(request); + console.log(response); + } + + createProduct(); + // [END retail_v2_generated_ProductService_CreateProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js new file mode 100644 index 00000000000..d685ce6beec --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js @@ -0,0 +1,68 @@ +// Copyright 2021 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. + +'use strict'; + +function main(name) { + // [START retail_v2_generated_ProductService_DeleteProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + * The [Product][google.cloud.retail.v2.Product] to delete can neither be a + * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2.Product] member nor a + * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2.Product] with more than one + * [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an + * INVALID_ARGUMENT error is returned. + * All inventory information for the named + * [Product][google.cloud.retail.v2.Product] will be deleted. + */ + // const name = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function deleteProduct() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteProduct(request); + console.log(response); + } + + deleteProduct(); + // [END retail_v2_generated_ProductService_DeleteProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js new file mode 100644 index 00000000000..11234b7d507 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js @@ -0,0 +1,59 @@ +// Copyright 2021 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. + +'use strict'; + +function main(name) { + // [START retail_v2_generated_ProductService_GetProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const name = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function getProduct() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getProduct(request); + console.log(response); + } + + getProduct(); + // [END retail_v2_generated_ProductService_GetProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js new file mode 100644 index 00000000000..8288a5337d4 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -0,0 +1,98 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2_generated_ProductService_ImportProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const parent = 'abc123' + /** + * Unique identifier provided by client, within the ancestor + * dataset scope. Ensures idempotency and used for request deduplication. + * Server-generated if unspecified. Up to 128 characters long and must match + * the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + * [ImportMetadata][google.cloud.retail.v2.ImportMetadata]. + * Only supported when + * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + * is set to `FULL`. + */ + // const requestId = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * The desired location of errors incurred during the Import. + */ + // const errorsConfig = '' + /** + * Indicates which fields in the provided imported 'products' to update. If + * not set, will by default update all fields. + */ + // const updateMask = '' + /** + * The mode of reconciliation between existing products and the products to be + * imported. Defaults to + * [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + */ + // const reconciliationMode = '' + /** + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * [Operation][google.longrunning.Operation]. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Only supported when + * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + * is set to `FULL`. + */ + // const notificationPubsubTopic = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function importProducts() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importProducts(request); + const [response] = await operation.promise(); + console.log(response); + } + + importProducts(); + // [END retail_v2_generated_ProductService_ImportProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js new file mode 100644 index 00000000000..f232a2ad292 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js @@ -0,0 +1,124 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2_generated_ProductService_ListProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * If the caller does not have permission to list + * [Product][google.cloud.retail.v2.Product]s under this branch, regardless of + * whether or not this branch exists, a PERMISSION_DENIED error is returned. + */ + // const parent = 'abc123' + /** + * Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If + * unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * If this field is negative, an INVALID_ARGUMENT error is returned. + */ + // const pageSize = 1234 + /** + * A page token + * [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token], + * received from a previous + * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + /** + * A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset. + * * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2.Product]s sharing the same + * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2.Product]. For example: + * `primary_product_id = "some_product_id"` + * * List [Product][google.cloud.retail.v2.Product]s bundled in a + * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2.Product]. + * For example: + * `collection_product_id = "some_product_id"` + * * List [Product][google.cloud.retail.v2.Product]s with a partibular type. + * For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * If the specified + * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2.Product] or + * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error + * is returned. + */ + // const filter = 'abc123' + /** + * The fields of [Product][google.cloud.retail.v2.Product] to return in the + * responses. If not set or empty, the following fields are returned: + * * [Product.name][google.cloud.retail.v2.Product.name] + * * [Product.id][google.cloud.retail.v2.Product.id] + * * [Product.title][google.cloud.retail.v2.Product.title] + * * [Product.uri][google.cloud.retail.v2.Product.uri] + * * [Product.images][google.cloud.retail.v2.Product.images] + * * [Product.price_info][google.cloud.retail.v2.Product.price_info] + * * [Product.brands][google.cloud.retail.v2.Product.brands] + * If "*" is provided, all fields are returned. + * [Product.name][google.cloud.retail.v2.Product.name] is always returned no + * matter what mask is set. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + */ + // const readMask = '' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function listProducts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listProductsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listProducts(); + // [END retail_v2_generated_ProductService_ListProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js new file mode 100644 index 00000000000..87bb9bcc658 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -0,0 +1,105 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, type, placeIds) { + // [START retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const product = 'abc123' + /** + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * Supported values: + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * This field directly corresponds to [Product.fulfillment_info.type][]. + */ + // const type = 'abc123' + /** + * Required. The IDs for this + * [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as + * the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery", to be removed for this + * [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]. + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const placeIds = 'abc123' + /** + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + */ + // const removeTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2.Product] is not + * found, the fulfillment information will still be processed and retained for + * at most 1 day and processed once the + * [Product][google.cloud.retail.v2.Product] is created. If set to false, a + * NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function removeFulfillmentPlaces() { + // Construct request + const request = { + product, + type, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeFulfillmentPlaces(request); + const [response] = await operation.promise(); + console.log(response); + } + + removeFulfillmentPlaces(); + // [END retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js new file mode 100644 index 00000000000..a95bd8a5037 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -0,0 +1,104 @@ +// Copyright 2021 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. + +'use strict'; + +function main(inventory) { + // [START retail_v2_generated_ProductService_SetInventory_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The inventory information to update. The allowable fields to + * update are: + * * [Product.price_info][google.cloud.retail.v2.Product.price_info] + * * [Product.availability][google.cloud.retail.v2.Product.availability] + * * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] + * * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] + * The updated inventory fields must be specified in + * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]. + * If [SetInventoryRequest.inventory.name][] is empty or invalid, an + * INVALID_ARGUMENT error is returned. + * If the caller does not have permission to update the + * [Product][google.cloud.retail.v2.Product] named in + * [Product.name][google.cloud.retail.v2.Product.name], 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 have + * existing inventory information, the provided inventory information will be + * inserted. + * If the [Product][google.cloud.retail.v2.Product] to update has existing + * inventory information, the provided inventory information will be merged + * while respecting the last update time for each inventory field, using the + * provided or default value for + * [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time]. + * The last update time is recorded for the following inventory fields: + * * [Product.price_info][google.cloud.retail.v2.Product.price_info] + * * [Product.availability][google.cloud.retail.v2.Product.availability] + * * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] + * * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] + * If a full overwrite of inventory information while ignoring timestamps is + * needed, [UpdateProduct][] should be invoked instead. + */ + // const inventory = '' + /** + * Indicates which inventory fields in the provided + * [Product][google.cloud.retail.v2.Product] to update. If not set or set with + * empty paths, all inventory fields will be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const setMask = '' + /** + * The time when the request is issued, used to prevent + * out-of-order updates on inventory fields with the last update time + * recorded. If not provided, the internal system time will be used. + */ + // const setTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2.Product] with name + * [Product.name][google.cloud.retail.v2.Product.name] is not found, the + * inventory update will still be processed and retained for at most 1 day + * until the [Product][google.cloud.retail.v2.Product] is created. If set to + * false, a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function setInventory() { + // Construct request + const request = { + inventory, + }; + + // Run request + const [operation] = await retailClient.setInventory(request); + const [response] = await operation.promise(); + console.log(response); + } + + setInventory(); + // [END retail_v2_generated_ProductService_SetInventory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js new file mode 100644 index 00000000000..c33232196c5 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js @@ -0,0 +1,74 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product) { + // [START retail_v2_generated_ProductService_UpdateProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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 + * and + * [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing] + * is not set, a NOT_FOUND error is returned. + */ + // const product = '' + /** + * 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. + */ + // const updateMask = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2.Product] is not + * found, a new [Product][google.cloud.retail.v2.Product] will be created. In + * this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function updateProduct() { + // Construct request + const request = { + product, + }; + + // Run request + const response = await retailClient.updateProduct(request); + console.log(response); + } + + updateProduct(); + // [END retail_v2_generated_ProductService_UpdateProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js new file mode 100644 index 00000000000..2d2c3c46678 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -0,0 +1,246 @@ +// Copyright 2021 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. + +'use strict'; + +function main(placement, visitorId) { + // [START retail_v2_generated_SearchService_Search_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. + */ + // const placement = 'abc123' + /** + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + */ + // const branch = 'abc123' + /** + * Raw search query. + */ + // const query = 'abc123' + /** + * 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 logs in or 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. + */ + // const visitorId = 'abc123' + /** + * User information. + */ + // const userInfo = '' + /** + * Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If + * unspecified, defaults to a reasonable value. The maximum allowed value is + * 120. Values above 120 will be coerced to 120. + * If this field is negative, an INVALID_ARGUMENT is returned. + */ + // const pageSize = 1234 + /** + * A page token + * [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token], + * received from a previous + * [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must + * match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + * error is returned. + */ + // const pageToken = 'abc123' + /** + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the [Product][google.cloud.retail.v2.Product]s + * deemed by the API as relevant) in search results. This field is only + * considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token] + * is unset. + * If this field is negative, an INVALID_ARGUMENT is returned. + */ + // const offset = 1234 + /** + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + */ + // const filter = 'abc123' + /** + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter] + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + * more details about filter syntax. + */ + // const canonicalFilter = 'abc123' + /** + * The order in which products are returned. Products can be ordered by + * a field in an [Product][google.cloud.retail.v2.Product] object. Leave it + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + */ + // const orderBy = 'abc123' + /** + * Facet specifications for faceted search. If empty, no facets are returned. + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + */ + // const facetSpecs = 1234 + /** + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. + */ + // const dynamicFacetSpec = '' + /** + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * Notice that if both [ServingConfig.boost_control_ids][] and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. + */ + // const boostSpec = '' + /** + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). + */ + // const queryExpansionSpec = '' + /** + * The keys to fetch and rollup the matching + * [variant][google.cloud.retail.v2.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2.Product]s attributes. The attributes from + * all the matching [variant][google.cloud.retail.v2.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2.Product]s are merged and de-duplicated. + * Notice that rollup [variant][google.cloud.retail.v2.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2.Product]s attributes will lead to extra + * query latency. Maximum number of keys is 10. + * For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * Supported keys are: + * * colorFamilies + * * price + * * originalPrice + * * discount + * * inventory(place_id,price) + * * attributes.key, where key is any key in the + * [Product.attributes][google.cloud.retail.v2.Product.attributes] map. + * * pickupInStore.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "pickup-in-store". + * * shipToStore.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "custom-type-1". + * * customFulfillment2.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "custom-type-2". + * * customFulfillment3.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "custom-type-3". + * * customFulfillment4.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "custom-type-4". + * * customFulfillment5.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * "custom-type-5". + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + */ + // const variantRollupKeys = 'abc123' + /** + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories]; + * 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"]. + */ + // const pageCategories = 'abc123' + /** + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. + */ + // const searchMode = '' + + // Imports the Retail library + const {SearchServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new SearchServiceClient(); + + async function search() { + // Construct request + const request = { + placement, + visitorId, + }; + + // Run request + const iterable = await retailClient.searchAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + search(); + // [END retail_v2_generated_SearchService_Search_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js new file mode 100644 index 00000000000..a0bb51b5744 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js @@ -0,0 +1,72 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, userEvent) { + // [START retail_v2_generated_UserEventService_CollectUserEvent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. URL encoded UserEvent proto with a length limit of 2,000,000 + * characters. + */ + // const userEvent = 'abc123' + /** + * 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. + */ + // const uri = 'abc123' + /** + * The event timestamp in milliseconds. This prevents browser caching of + * otherwise identical get requests. The name is abbreviated to reduce the + * payload bytes. + */ + // const ets = 1234 + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function collectUserEvent() { + // Construct request + const request = { + parent, + userEvent, + }; + + // Run request + const response = await retailClient.collectUserEvent(request); + console.log(response); + } + + collectUserEvent(); + // [END retail_v2_generated_UserEventService_CollectUserEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js new file mode 100644 index 00000000000..1c8ebdd5030 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js @@ -0,0 +1,63 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2_generated_UserEventService_ImportUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. `projects/1234/locations/global/catalogs/default_catalog` + */ + // const parent = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + */ + // const errorsConfig = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function importUserEvents() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + importUserEvents(); + // [END retail_v2_generated_UserEventService_ImportUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js new file mode 100644 index 00000000000..88eadd9b912 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js @@ -0,0 +1,84 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, filter) { + // [START retail_v2_generated_UserEventService_PurgeUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the catalog under which the events are + * created. The format is + * `projects/${projectId}/locations/global/catalogs/${catalogId}` + */ + // const parent = 'abc123' + /** + * 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. + */ + // const filter = 'abc123' + /** + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any user events. + */ + // const force = true + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function purgeUserEvents() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const [operation] = await retailClient.purgeUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + purgeUserEvents(); + // [END retail_v2_generated_UserEventService_PurgeUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js new file mode 100644 index 00000000000..9deba00979e --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js @@ -0,0 +1,61 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2_generated_UserEventService_RejoinUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const userEventRejoinScope = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function rejoinUserEvents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await retailClient.rejoinUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + rejoinUserEvents(); + // [END retail_v2_generated_UserEventService_RejoinUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js new file mode 100644 index 00000000000..ab2e40b76a6 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js @@ -0,0 +1,58 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, userEvent) { + // [START retail_v2_generated_UserEventService_WriteUserEvent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. User event to write. + */ + // const userEvent = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function writeUserEvent() { + // Construct request + const request = { + parent, + userEvent, + }; + + // Run request + const response = await retailClient.writeUserEvent(request); + console.log(response); + } + + writeUserEvent(); + // [END retail_v2_generated_UserEventService_WriteUserEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js new file mode 100644 index 00000000000..99a60b93cfd --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js @@ -0,0 +1,51 @@ +// Copyright 2021 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. + +'use strict'; + +function main() { + // [START retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function getDefaultBranch() { + // Construct request + const request = {}; + + // Run request + const response = await retailClient.getDefaultBranch(request); + console.log(response); + } + + getDefaultBranch(); + // [END retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js new file mode 100644 index 00000000000..22d71c2a9c7 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js @@ -0,0 +1,77 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2alpha_generated_CatalogService_ListCatalogs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The account resource name with an associated location. + * If the caller does not have permission to list + * [Catalog][google.cloud.retail.v2alpha.Catalog]s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + */ + // const parent = 'abc123' + /** + * Maximum number of [Catalog][google.cloud.retail.v2alpha.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. + */ + // const pageSize = 1234 + /** + * A page token + * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token], + * received from a previous + * [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function listCatalogs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listCatalogsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listCatalogs(); + // [END retail_v2alpha_generated_CatalogService_ListCatalogs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js new file mode 100644 index 00000000000..048d8633fd0 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js @@ -0,0 +1,65 @@ +// Copyright 2021 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. + +'use strict'; + +function main() { + // [START retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + /** + * The final component of the resource name of a branch. + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + */ + // const branchId = 'abc123' + /** + * Some note on this request, this can be retrieved by + * [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch] + * before next valid default branch set occurs. + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + */ + // const note = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function setDefaultBranch() { + // Construct request + const request = {}; + + // Run request + const response = await retailClient.setDefaultBranch(request); + console.log(response); + } + + setDefaultBranch(); + // [END retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js new file mode 100644 index 00000000000..f947d928485 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +'use strict'; + +function main(catalog) { + // [START retail_v2alpha_generated_CatalogService_UpdateCatalog_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The [Catalog][google.cloud.retail.v2alpha.Catalog] to update. + * If the caller does not have permission to update the + * [Catalog][google.cloud.retail.v2alpha.Catalog], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * If the [Catalog][google.cloud.retail.v2alpha.Catalog] to update does not + * exist, a NOT_FOUND error is returned. + */ + // const catalog = '' + /** + * Indicates which fields in the provided + * [Catalog][google.cloud.retail.v2alpha.Catalog] to update. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + */ + // const updateMask = '' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function updateCatalog() { + // Construct request + const request = { + catalog, + }; + + // Run request + const response = await retailClient.updateCatalog(request); + console.log(response); + } + + updateCatalog(); + // [END retail_v2alpha_generated_CatalogService_UpdateCatalog_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js new file mode 100644 index 00000000000..a97985d9b74 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -0,0 +1,111 @@ +// Copyright 2021 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. + +'use strict'; + +function main(catalog, query) { + // [START retail_v2alpha_generated_CompletionService_CompleteQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Catalog for which the completion is performed. + * Full resource name of catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + /** + * Required. The query used to generate suggestions. + * The maximum number of allowed characters is 255. + */ + // const query = 'abc123' + /** + * 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 logs in or 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. + */ + // const visitorId = 'abc123' + /** + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * The maximum number of allowed characters is 255. + * Only "en-US" is currently supported. + */ + // const languageCodes = 'abc123' + /** + * The device type context for completion suggestions. + * It is useful to apply different suggestions on different device types, e.g. + * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * types. + * Supported formats: + * * UNKNOWN_DEVICE_TYPE + * * DESKTOP + * * MOBILE + * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + */ + // const deviceType = 'abc123' + /** + * Determines which dataset to use for fetching completion. "user-data" will + * use the imported dataset through + * [CompletionService.ImportCompletionData][google.cloud.retail.v2alpha.CompletionService.ImportCompletionData]. + * "cloud-retail" will use the dataset generated by cloud retail based on user + * events. If leave empty, it will use the "user-data". + * Current supported values: + * * user-data + * * cloud-retail + * This option requires additional allowlisting. Before using cloud-retail, + * contact Cloud Retail support team first. + */ + // const dataset = 'abc123' + /** + * Completion max suggestions. If left unset or set to 0, then will fallback + * to the configured value + * [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions]. + * The maximum allowed max suggestions is 20. If it is set higher, it will be + * capped by 20. + */ + // const maxSuggestions = 1234 + + // Imports the Retail library + const {CompletionServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CompletionServiceClient(); + + async function completeQuery() { + // Construct request + const request = { + catalog, + query, + }; + + // Run request + const response = await retailClient.completeQuery(request); + console.log(response); + } + + completeQuery(); + // [END retail_v2alpha_generated_CompletionService_CompleteQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js new file mode 100644 index 00000000000..b4a8ad05490 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js @@ -0,0 +1,67 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2alpha_generated_CompletionService_ImportCompletionData_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog which the suggestions dataset belongs to. + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * [Operation][google.longrunning.Operation]. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + */ + // const notificationPubsubTopic = 'abc123' + + // Imports the Retail library + const {CompletionServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CompletionServiceClient(); + + async function importCompletionData() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importCompletionData(request); + const [response] = await operation.promise(); + console.log(response); + } + + importCompletionData(); + // [END retail_v2alpha_generated_CompletionService_ImportCompletionData_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js new file mode 100644 index 00000000000..43d369b4ff3 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -0,0 +1,152 @@ +// Copyright 2021 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. + +'use strict'; + +function main(placement, userEvent) { + // [START retail_v2alpha_generated_PredictionService_Predict_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of the format: + * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} + * The ID of the Recommendations AI placement. Before you can request + * predictions from your model, you must create at least one placement for it. + * For more information, see [Managing + * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + * The full list of available placements can be seen at + * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + */ + // const placement = 'abc123' + /** + * 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. + */ + // const userEvent = '' + /** + * 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. + */ + // const pageSize = 1234 + /** + * The previous PredictResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * 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. + * Note: "Recently viewed" models don't support tag filtering at the + * moment. + * * 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`. + */ + // const filter = 'abc123' + /** + * 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. + */ + // const validateOnly = true + /** + * 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. + * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-price-reranking', 'low-price-reranking', + * 'medium-price-reranking', 'high-price-reranking'}. This gives + * request-level control and adjusts prediction results based on product + * price. + * * `diversityLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-diversity', 'low-diversity', + * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + * request-level control and adjusts prediction results based on product + * category. + */ + // const params = 1234 + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters, and cannot be empty. Values can be empty, and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + + // Imports the Retail library + const {PredictionServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new PredictionServiceClient(); + + async function predict() { + // Construct request + const request = { + placement, + userEvent, + }; + + // Run request + const response = await retailClient.predict(request); + console.log(response); + } + + predict(); + // [END retail_v2alpha_generated_PredictionService_Predict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js new file mode 100644 index 00000000000..be177e37b6f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -0,0 +1,109 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, type, placeIds) { + // [START retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * Supported values: + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * This field directly corresponds to [Product.fulfillment_info.type][]. + */ + // const type = 'abc123' + /** + * Required. The IDs for this + * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type], such + * as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery" to be added for this + * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type]. + * Duplicate IDs will be automatically ignored. + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * If the total number of place IDs exceeds 2000 for this + * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type] after + * adding, then the update will be rejected. + */ + // const placeIds = 'abc123' + /** + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + */ + // const addTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function addFulfillmentPlaces() { + // Construct request + const request = { + product, + type, + placeIds, + }; + + // Run request + const [operation] = await retailClient.addFulfillmentPlaces(request); + const [response] = await operation.promise(); + console.log(response); + } + + addFulfillmentPlaces(); + // [END retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js new file mode 100644 index 00000000000..e9be2372ad5 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js @@ -0,0 +1,74 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, product, productId) { + // [START retail_v2alpha_generated_ProductService_CreateProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. + */ + // const parent = 'abc123' + /** + * Required. The [Product][google.cloud.retail.v2alpha.Product] to create. + */ + // const product = '' + /** + * Required. The ID to use for the + * [Product][google.cloud.retail.v2alpha.Product], which will become the final + * component of the [Product.name][google.cloud.retail.v2alpha.Product.name]. + * If the caller does not have permission to create the + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s with the same + * [parent][google.cloud.retail.v2alpha.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. + */ + // const productId = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function createProduct() { + // Construct request + const request = { + parent, + product, + productId, + }; + + // Run request + const response = await retailClient.createProduct(request); + console.log(response); + } + + createProduct(); + // [END retail_v2alpha_generated_ProductService_CreateProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js new file mode 100644 index 00000000000..1e7d7af8e95 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js @@ -0,0 +1,69 @@ +// Copyright 2021 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. + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ProductService_DeleteProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * If the [Product][google.cloud.retail.v2alpha.Product] to delete does not + * exist, a NOT_FOUND error is returned. + * The [Product][google.cloud.retail.v2alpha.Product] to delete can neither be + * a + * [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2alpha.Product] member nor a + * [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2alpha.Product] with more than one + * [variants][google.cloud.retail.v2alpha.Product.Type.VARIANT]. Otherwise, an + * INVALID_ARGUMENT error is returned. + * All inventory information for the named + * [Product][google.cloud.retail.v2alpha.Product] will be deleted. + */ + // const name = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function deleteProduct() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteProduct(request); + console.log(response); + } + + deleteProduct(); + // [END retail_v2alpha_generated_ProductService_DeleteProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js new file mode 100644 index 00000000000..bbd194262c0 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js @@ -0,0 +1,59 @@ +// Copyright 2021 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. + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ProductService_GetProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * If the requested [Product][google.cloud.retail.v2alpha.Product] does not + * exist, a NOT_FOUND error is returned. + */ + // const name = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function getProduct() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getProduct(request); + console.log(response); + } + + getProduct(); + // [END retail_v2alpha_generated_ProductService_GetProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js new file mode 100644 index 00000000000..06cea1181b0 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -0,0 +1,98 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2alpha_generated_ProductService_ImportProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const parent = 'abc123' + /** + * Unique identifier provided by client, within the ancestor + * dataset scope. Ensures idempotency and used for request deduplication. + * Server-generated if unspecified. Up to 128 characters long and must match + * the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + * [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata]. + * Only supported when + * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + * is set to `FULL`. + */ + // const requestId = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * The desired location of errors incurred during the Import. + */ + // const errorsConfig = '' + /** + * Indicates which fields in the provided imported 'products' to update. If + * not set, will by default update all fields. + */ + // const updateMask = '' + /** + * The mode of reconciliation between existing products and the products to be + * imported. Defaults to + * [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + */ + // const reconciliationMode = '' + /** + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * [Operation][google.longrunning.Operation]. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Only supported when + * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + * is set to `FULL`. + */ + // const notificationPubsubTopic = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function importProducts() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importProducts(request); + const [response] = await operation.promise(); + console.log(response); + } + + importProducts(); + // [END retail_v2alpha_generated_ProductService_ImportProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js new file mode 100644 index 00000000000..594bb847be6 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js @@ -0,0 +1,135 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2alpha_generated_ProductService_ListProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * If the caller does not have permission to list + * [Product][google.cloud.retail.v2alpha.Product]s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + */ + // const parent = 'abc123' + /** + * Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to + * return. If unspecified, defaults to 100. The maximum allowed value is 1000. + * Values above 1000 will be coerced to 1000. + * If this field is negative, an INVALID_ARGUMENT error is returned. + */ + // const pageSize = 1234 + /** + * A page token + * [ListProductsResponse.next_page_token][google.cloud.retail.v2alpha.ListProductsResponse.next_page_token], + * received from a previous + * [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + /** + * A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.retail.v2alpha.ListProductsRequest.filter] is unset. + * * List + * [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2alpha.Product]s sharing the same + * [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2alpha.Product]. For example: + * `primary_product_id = "some_product_id"` + * * List [Product][google.cloud.retail.v2alpha.Product]s bundled in a + * [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2alpha.Product]. + * For example: + * `collection_product_id = "some_product_id"` + * * List [Product][google.cloud.retail.v2alpha.Product]s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * If the specified + * [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2alpha.Product] or + * [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2alpha.Product] does not exist, a NOT_FOUND + * error is returned. + */ + // const filter = 'abc123' + /** + * The fields of [Product][google.cloud.retail.v2alpha.Product] to return in + * the responses. If not set or empty, the following fields are returned: + * * [Product.name][google.cloud.retail.v2alpha.Product.name] + * * [Product.id][google.cloud.retail.v2alpha.Product.id] + * * [Product.title][google.cloud.retail.v2alpha.Product.title] + * * [Product.uri][google.cloud.retail.v2alpha.Product.uri] + * * [Product.images][google.cloud.retail.v2alpha.Product.images] + * * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + * * [Product.brands][google.cloud.retail.v2alpha.Product.brands] + * If "*" is provided, all fields are returned. + * [Product.name][google.cloud.retail.v2alpha.Product.name] is always returned + * no matter what mask is set. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + */ + // const readMask = '' + /** + * If true and + * [page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] is + * empty, + * [ListProductsResponse.total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] + * is set to the total count of matched items irrespective of pagination. + * Notice that setting this field to true affects the performance. + */ + // const requireTotalSize = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function listProducts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listProductsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listProducts(); + // [END retail_v2alpha_generated_ProductService_ListProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js new file mode 100644 index 00000000000..c0dd6c84e02 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -0,0 +1,105 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, type, placeIds) { + // [START retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * Supported values: + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * This field directly corresponds to [Product.fulfillment_info.type][]. + */ + // const type = 'abc123' + /** + * Required. The IDs for this + * [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type], + * such as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery", to be removed for this + * [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type]. + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const placeIds = 'abc123' + /** + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + */ + // const removeTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function removeFulfillmentPlaces() { + // Construct request + const request = { + product, + type, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeFulfillmentPlaces(request); + const [response] = await operation.promise(); + console.log(response); + } + + removeFulfillmentPlaces(); + // [END retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js new file mode 100644 index 00000000000..d9333c64444 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -0,0 +1,104 @@ +// Copyright 2021 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. + +'use strict'; + +function main(inventory) { + // [START retail_v2alpha_generated_ProductService_SetInventory_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The inventory information to update. The allowable fields to + * update are: + * * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + * * [Product.availability][google.cloud.retail.v2alpha.Product.availability] + * * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] + * * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] + * The updated inventory fields must be specified in + * [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask]. + * If [SetInventoryRequest.inventory.name][] is empty or invalid, an + * INVALID_ARGUMENT error is returned. + * If the caller does not have permission to update the + * [Product][google.cloud.retail.v2alpha.Product] named in + * [Product.name][google.cloud.retail.v2alpha.Product.name], regardless of + * whether or not it exists, a PERMISSION_DENIED error is returned. + * If the [Product][google.cloud.retail.v2alpha.Product] to update does not + * have existing inventory information, the provided inventory information + * will be inserted. + * If the [Product][google.cloud.retail.v2alpha.Product] to update has + * existing inventory information, the provided inventory information will be + * merged while respecting the last update time for each inventory field, + * using the provided or default value for + * [SetInventoryRequest.set_time][google.cloud.retail.v2alpha.SetInventoryRequest.set_time]. + * The last update time is recorded for the following inventory fields: + * * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] + * * [Product.availability][google.cloud.retail.v2alpha.Product.availability] + * * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] + * * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] + * If a full overwrite of inventory information while ignoring timestamps is + * needed, [UpdateProduct][] should be invoked instead. + */ + // const inventory = '' + /** + * Indicates which inventory fields in the provided + * [Product][google.cloud.retail.v2alpha.Product] to update. If not set or set + * with empty paths, all inventory fields will be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const setMask = '' + /** + * The time when the request is issued, used to prevent + * out-of-order updates on inventory fields with the last update time + * recorded. If not provided, the internal system time will be used. + */ + // const setTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] with + * name [Product.name][google.cloud.retail.v2alpha.Product.name] is not found, + * the inventory update will still be processed and retained for at most 1 day + * until the [Product][google.cloud.retail.v2alpha.Product] is created. If set + * to false, a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function setInventory() { + // Construct request + const request = { + inventory, + }; + + // Run request + const [operation] = await retailClient.setInventory(request); + const [response] = await operation.promise(); + console.log(response); + } + + setInventory(); + // [END retail_v2alpha_generated_ProductService_SetInventory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js new file mode 100644 index 00000000000..f664194a142 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js @@ -0,0 +1,74 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product) { + // [START retail_v2alpha_generated_ProductService_UpdateProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The product to update/create. + * If the caller does not have permission to update the + * [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * If the [Product][google.cloud.retail.v2alpha.Product] to update does not + * exist and + * [allow_missing][google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing] + * is not set, a NOT_FOUND error is returned. + */ + // const product = '' + /** + * Indicates which fields in the provided + * [Product][google.cloud.retail.v2alpha.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. + */ + // const updateMask = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, a new [Product][google.cloud.retail.v2alpha.Product] will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function updateProduct() { + // Construct request + const request = { + product, + }; + + // Run request + const response = await retailClient.updateProduct(request); + console.log(response); + } + + updateProduct(); + // [END retail_v2alpha_generated_ProductService_UpdateProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js new file mode 100644 index 00000000000..86b868c6a31 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -0,0 +1,269 @@ +// Copyright 2021 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. + +'use strict'; + +function main(placement, visitorId) { + // [START retail_v2alpha_generated_SearchService_Search_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. + */ + // const placement = 'abc123' + /** + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + */ + // const branch = 'abc123' + /** + * Raw search query. + */ + // const query = 'abc123' + /** + * 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 logs in or 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. + */ + // const visitorId = 'abc123' + /** + * User information. + */ + // const userInfo = '' + /** + * Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to + * return. If unspecified, defaults to a reasonable value. The maximum allowed + * value is 120. Values above 120 will be coerced to 120. + * If this field is negative, an INVALID_ARGUMENT is returned. + */ + // const pageSize = 1234 + /** + * A page token + * [SearchResponse.next_page_token][google.cloud.retail.v2alpha.SearchResponse.next_page_token], + * received from a previous + * [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + /** + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the + * [Product][google.cloud.retail.v2alpha.Product]s deemed by the API as + * relevant) in search results. This field is only considered if + * [page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] is + * unset. + * If this field is negative, an INVALID_ARGUMENT is returned. + */ + // const offset = 1234 + /** + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + */ + // const filter = 'abc123' + /** + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * [SearchRequest.canonical_filter][google.cloud.retail.v2alpha.SearchRequest.canonical_filter] + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * See + * [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + * for more details about filter syntax. + */ + // const canonicalFilter = 'abc123' + /** + * The order in which products are returned. Products can be ordered by + * a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + */ + // const orderBy = 'abc123' + /** + * Facet specifications for faceted search. If empty, no facets are returned. + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + */ + // const facetSpecs = 1234 + /** + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. + */ + // const dynamicFacetSpec = '' + /** + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * Notice that if both + * [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. + */ + // const boostSpec = '' + /** + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). + */ + // const queryExpansionSpec = '' + /** + * The relevance threshold of the search results. + * Defaults to + * [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], + * which means only the most relevant results are shown, and the least number + * of results are returned. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). + */ + // const relevanceThreshold = '' + /** + * The keys to fetch and rollup the matching + * [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2alpha.Product]s attributes. The attributes + * from all the matching + * [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2alpha.Product]s are merged and + * de-duplicated. Notice that rollup + * [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2alpha.Product]s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * Supported keys are: + * * colorFamilies + * * price + * * originalPrice + * * discount + * * inventory(place_id,price) + * * attributes.key, where key is any key in the + * [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. + * * pickupInStore.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "pickup-in-store". + * * shipToStore.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "custom-type-1". + * * customFulfillment2.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "custom-type-2". + * * customFulfillment3.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "custom-type-3". + * * customFulfillment4.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "custom-type-4". + * * customFulfillment5.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * for + * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * "custom-type-5". + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + */ + // const variantRollupKeys = 'abc123' + /** + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; + * 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"]. + */ + // const pageCategories = 'abc123' + /** + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. + */ + // const searchMode = '' + + // Imports the Retail library + const {SearchServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new SearchServiceClient(); + + async function search() { + // Construct request + const request = { + placement, + visitorId, + }; + + // Run request + const iterable = await retailClient.searchAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + search(); + // [END retail_v2alpha_generated_SearchService_Search_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js new file mode 100644 index 00000000000..4018281ea61 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js @@ -0,0 +1,72 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, userEvent) { + // [START retail_v2alpha_generated_UserEventService_CollectUserEvent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. URL encoded UserEvent proto with a length limit of 2,000,000 + * characters. + */ + // const userEvent = 'abc123' + /** + * 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. + */ + // const uri = 'abc123' + /** + * The event timestamp in milliseconds. This prevents browser caching of + * otherwise identical get requests. The name is abbreviated to reduce the + * payload bytes. + */ + // const ets = 1234 + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function collectUserEvent() { + // Construct request + const request = { + parent, + userEvent, + }; + + // Run request + const response = await retailClient.collectUserEvent(request); + console.log(response); + } + + collectUserEvent(); + // [END retail_v2alpha_generated_UserEventService_CollectUserEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js new file mode 100644 index 00000000000..c4cb06a8cf6 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js @@ -0,0 +1,63 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2alpha_generated_UserEventService_ImportUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. `projects/1234/locations/global/catalogs/default_catalog` + */ + // const parent = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + */ + // const errorsConfig = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function importUserEvents() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + importUserEvents(); + // [END retail_v2alpha_generated_UserEventService_ImportUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js new file mode 100644 index 00000000000..5f8e511683d --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js @@ -0,0 +1,85 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, filter) { + // [START retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the catalog under which the events are + * created. The format is + * `projects/${projectId}/locations/global/catalogs/${catalogId}` + */ + // const parent = 'abc123' + /** + * 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.v2alpha.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. + */ + // const filter = 'abc123' + /** + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any user events. + */ + // const force = true + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function purgeUserEvents() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const [operation] = await retailClient.purgeUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + purgeUserEvents(); + // [END retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js new file mode 100644 index 00000000000..efbb58e2488 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js @@ -0,0 +1,61 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const userEventRejoinScope = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function rejoinUserEvents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await retailClient.rejoinUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + rejoinUserEvents(); + // [END retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js new file mode 100644 index 00000000000..be821f78f1f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js @@ -0,0 +1,58 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, userEvent) { + // [START retail_v2alpha_generated_UserEventService_WriteUserEvent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. User event to write. + */ + // const userEvent = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function writeUserEvent() { + // Construct request + const request = { + parent, + userEvent, + }; + + // Run request + const response = await retailClient.writeUserEvent(request); + console.log(response); + } + + writeUserEvent(); + // [END retail_v2alpha_generated_UserEventService_WriteUserEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js new file mode 100644 index 00000000000..5f5f443d8f0 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js @@ -0,0 +1,51 @@ +// Copyright 2021 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. + +'use strict'; + +function main() { + // [START retail_v2beta_generated_CatalogService_GetDefaultBranch_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function getDefaultBranch() { + // Construct request + const request = {}; + + // Run request + const response = await retailClient.getDefaultBranch(request); + console.log(response); + } + + getDefaultBranch(); + // [END retail_v2beta_generated_CatalogService_GetDefaultBranch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js new file mode 100644 index 00000000000..0bfd55246a7 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js @@ -0,0 +1,77 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2beta_generated_CatalogService_ListCatalogs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The account resource name with an associated location. + * If the caller does not have permission to list + * [Catalog][google.cloud.retail.v2beta.Catalog]s under this location, + * regardless of whether or not this location exists, a PERMISSION_DENIED + * error is returned. + */ + // const parent = 'abc123' + /** + * Maximum number of [Catalog][google.cloud.retail.v2beta.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. + */ + // const pageSize = 1234 + /** + * A page token + * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token], + * received from a previous + * [CatalogService.ListCatalogs][google.cloud.retail.v2beta.CatalogService.ListCatalogs] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [CatalogService.ListCatalogs][google.cloud.retail.v2beta.CatalogService.ListCatalogs] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function listCatalogs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listCatalogsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listCatalogs(); + // [END retail_v2beta_generated_CatalogService_ListCatalogs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js new file mode 100644 index 00000000000..1baa77407e3 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js @@ -0,0 +1,65 @@ +// Copyright 2021 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. + +'use strict'; + +function main() { + // [START retail_v2beta_generated_CatalogService_SetDefaultBranch_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + /** + * The final component of the resource name of a branch. + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + */ + // const branchId = 'abc123' + /** + * Some note on this request, this can be retrieved by + * [CatalogService.GetDefaultBranch][google.cloud.retail.v2beta.CatalogService.GetDefaultBranch] + * before next valid default branch set occurs. + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + */ + // const note = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function setDefaultBranch() { + // Construct request + const request = {}; + + // Run request + const response = await retailClient.setDefaultBranch(request); + console.log(response); + } + + setDefaultBranch(); + // [END retail_v2beta_generated_CatalogService_SetDefaultBranch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js new file mode 100644 index 00000000000..8dbc583396e --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +'use strict'; + +function main(catalog) { + // [START retail_v2beta_generated_CatalogService_UpdateCatalog_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The [Catalog][google.cloud.retail.v2beta.Catalog] to update. + * If the caller does not have permission to update the + * [Catalog][google.cloud.retail.v2beta.Catalog], regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * If the [Catalog][google.cloud.retail.v2beta.Catalog] to update does not + * exist, a NOT_FOUND error is returned. + */ + // const catalog = '' + /** + * Indicates which fields in the provided + * [Catalog][google.cloud.retail.v2beta.Catalog] to update. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + */ + // const updateMask = '' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function updateCatalog() { + // Construct request + const request = { + catalog, + }; + + // Run request + const response = await retailClient.updateCatalog(request); + console.log(response); + } + + updateCatalog(); + // [END retail_v2beta_generated_CatalogService_UpdateCatalog_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js new file mode 100644 index 00000000000..cb72fdc4492 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -0,0 +1,110 @@ +// Copyright 2021 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. + +'use strict'; + +function main(catalog, query) { + // [START retail_v2beta_generated_CompletionService_CompleteQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Catalog for which the completion is performed. + * Full resource name of catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + */ + // const catalog = 'abc123' + /** + * Required. The query used to generate suggestions. + * The maximum number of allowed characters is 255. + */ + // const query = 'abc123' + /** + * 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 logs in or 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. + */ + // const visitorId = 'abc123' + /** + * The list of languages of the query. This is + * the BCP-47 language code, such as "en-US" or "sr-Latn". + * For more information, see + * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * The maximum number of allowed characters is 255. + * Only "en-US" is currently supported. + */ + // const languageCodes = 'abc123' + /** + * The device type context for completion suggestions. + * It is useful to apply different suggestions on different device types, e.g. + * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * types. + * Supported formats: + * * UNKNOWN_DEVICE_TYPE + * * DESKTOP + * * MOBILE + * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + */ + // const deviceType = 'abc123' + /** + * Determines which dataset to use for fetching completion. "user-data" will + * use the imported dataset through + * [CompletionService.ImportCompletionData][google.cloud.retail.v2beta.CompletionService.ImportCompletionData]. + * "cloud-retail" will use the dataset generated by cloud retail based on user + * events. If leave empty, it will use the "user-data". + * Current supported values: + * * user-data + * * cloud-retail + * This option requires additional allowlisting. Before using cloud-retail, + * contact Cloud Retail support team first. + */ + // const dataset = 'abc123' + /** + * Completion max suggestions. If left unset or set to 0, then will fallback + * to the configured value [CompletionConfig.max_suggestions][]. + * The maximum allowed max suggestions is 20. If it is set higher, it will be + * capped by 20. + */ + // const maxSuggestions = 1234 + + // Imports the Retail library + const {CompletionServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CompletionServiceClient(); + + async function completeQuery() { + // Construct request + const request = { + catalog, + query, + }; + + // Run request + const response = await retailClient.completeQuery(request); + console.log(response); + } + + completeQuery(); + // [END retail_v2beta_generated_CompletionService_CompleteQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js new file mode 100644 index 00000000000..77c065541de --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js @@ -0,0 +1,67 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2beta_generated_CompletionService_ImportCompletionData_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog which the suggestions dataset belongs to. + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * [Operation][google.longrunning.Operation]. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + */ + // const notificationPubsubTopic = 'abc123' + + // Imports the Retail library + const {CompletionServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CompletionServiceClient(); + + async function importCompletionData() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importCompletionData(request); + const [response] = await operation.promise(); + console.log(response); + } + + importCompletionData(); + // [END retail_v2beta_generated_CompletionService_ImportCompletionData_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js new file mode 100644 index 00000000000..e01ce1ff98d --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -0,0 +1,152 @@ +// Copyright 2021 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. + +'use strict'; + +function main(placement, userEvent) { + // [START retail_v2beta_generated_PredictionService_Predict_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of the format: + * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} + * The ID of the Recommendations AI placement. Before you can request + * predictions from your model, you must create at least one placement for it. + * For more information, see [Managing + * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + * The full list of available placements can be seen at + * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + */ + // const placement = 'abc123' + /** + * 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. + */ + // const userEvent = '' + /** + * 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. + */ + // const pageSize = 1234 + /** + * The previous PredictResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * 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. + * Note: "Recently viewed" models don't support tag filtering at the + * moment. + * * 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`. + */ + // const filter = 'abc123' + /** + * 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. + */ + // const validateOnly = true + /** + * 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. + * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-price-reranking', 'low-price-reranking', + * 'medium-price-reranking', 'high-price-reranking'}. This gives + * request-level control and adjusts prediction results based on product + * price. + * * `diversityLevel`: String. Default empty. If set to be non-empty, then + * it needs to be one of {'no-diversity', 'low-diversity', + * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + * request-level control and adjusts prediction results based on product + * category. + */ + // const params = 1234 + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters, and cannot be empty. Values can be empty, and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + + // Imports the Retail library + const {PredictionServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new PredictionServiceClient(); + + async function predict() { + // Construct request + const request = { + placement, + userEvent, + }; + + // Run request + const response = await retailClient.predict(request); + console.log(response); + } + + predict(); + // [END retail_v2beta_generated_PredictionService_Predict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js new file mode 100644 index 00000000000..1a4b833e6d1 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -0,0 +1,109 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, type, placeIds) { + // [START retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * Supported values: + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * This field directly corresponds to [Product.fulfillment_info.type][]. + */ + // const type = 'abc123' + /** + * Required. The IDs for this + * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type], such + * as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery" to be added for this + * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type]. + * Duplicate IDs will be automatically ignored. + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + * If the total number of place IDs exceeds 2000 for this + * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type] after + * adding, then the update will be rejected. + */ + // const placeIds = 'abc123' + /** + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + */ + // const addTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + * a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2beta.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function addFulfillmentPlaces() { + // Construct request + const request = { + product, + type, + placeIds, + }; + + // Run request + const [operation] = await retailClient.addFulfillmentPlaces(request); + const [response] = await operation.promise(); + console.log(response); + } + + addFulfillmentPlaces(); + // [END retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js new file mode 100644 index 00000000000..344487c9e79 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js @@ -0,0 +1,74 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, product, productId) { + // [START retail_v2beta_generated_ProductService_CreateProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. + */ + // const parent = 'abc123' + /** + * Required. The [Product][google.cloud.retail.v2beta.Product] to create. + */ + // const product = '' + /** + * Required. The ID to use for the + * [Product][google.cloud.retail.v2beta.Product], which will become the final + * component of the [Product.name][google.cloud.retail.v2beta.Product.name]. + * If the caller does not have permission to create the + * [Product][google.cloud.retail.v2beta.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.v2beta.Product]s with the same + * [parent][google.cloud.retail.v2beta.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. + */ + // const productId = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function createProduct() { + // Construct request + const request = { + parent, + product, + productId, + }; + + // Run request + const response = await retailClient.createProduct(request); + console.log(response); + } + + createProduct(); + // [END retail_v2beta_generated_ProductService_CreateProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js new file mode 100644 index 00000000000..ef63e363bbc --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js @@ -0,0 +1,69 @@ +// Copyright 2021 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. + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ProductService_DeleteProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * If the [Product][google.cloud.retail.v2beta.Product] to delete does not + * exist, a NOT_FOUND error is returned. + * The [Product][google.cloud.retail.v2beta.Product] to delete can neither be + * a + * [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2beta.Product] member nor a + * [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2beta.Product] with more than one + * [variants][google.cloud.retail.v2beta.Product.Type.VARIANT]. Otherwise, an + * INVALID_ARGUMENT error is returned. + * All inventory information for the named + * [Product][google.cloud.retail.v2beta.Product] will be deleted. + */ + // const name = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function deleteProduct() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteProduct(request); + console.log(response); + } + + deleteProduct(); + // [END retail_v2beta_generated_ProductService_DeleteProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js new file mode 100644 index 00000000000..20007ea8bc4 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js @@ -0,0 +1,59 @@ +// Copyright 2021 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. + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ProductService_GetProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * If the requested [Product][google.cloud.retail.v2beta.Product] does not + * exist, a NOT_FOUND error is returned. + */ + // const name = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function getProduct() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getProduct(request); + console.log(response); + } + + getProduct(); + // [END retail_v2beta_generated_ProductService_GetProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js new file mode 100644 index 00000000000..00a1968f93e --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -0,0 +1,98 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2beta_generated_ProductService_ImportProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const parent = 'abc123' + /** + * Unique identifier provided by client, within the ancestor + * dataset scope. Ensures idempotency and used for request deduplication. + * Server-generated if unspecified. Up to 128 characters long and must match + * the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + * [ImportMetadata][google.cloud.retail.v2beta.ImportMetadata]. + * Only supported when + * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + * is set to `FULL`. + */ + // const requestId = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * The desired location of errors incurred during the Import. + */ + // const errorsConfig = '' + /** + * Indicates which fields in the provided imported 'products' to update. If + * not set, will by default update all fields. + */ + // const updateMask = '' + /** + * The mode of reconciliation between existing products and the products to be + * imported. Defaults to + * [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + */ + // const reconciliationMode = '' + /** + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * [Operation][google.longrunning.Operation]. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Only supported when + * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + * is set to `FULL`. + */ + // const notificationPubsubTopic = 'abc123' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function importProducts() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importProducts(request); + const [response] = await operation.promise(); + console.log(response); + } + + importProducts(); + // [END retail_v2beta_generated_ProductService_ImportProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js new file mode 100644 index 00000000000..29393fe37a6 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js @@ -0,0 +1,126 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2beta_generated_ProductService_ListProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use + * `default_branch` as the branch ID, to list products under the default + * branch. + * If the caller does not have permission to list + * [Product][google.cloud.retail.v2beta.Product]s under this branch, + * regardless of whether or not this branch exists, a PERMISSION_DENIED error + * is returned. + */ + // const parent = 'abc123' + /** + * Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return. + * If unspecified, defaults to 100. The maximum allowed value is 1000. Values + * above 1000 will be coerced to 1000. + * If this field is negative, an INVALID_ARGUMENT error is returned. + */ + // const pageSize = 1234 + /** + * A page token + * [ListProductsResponse.next_page_token][google.cloud.retail.v2beta.ListProductsResponse.next_page_token], + * received from a previous + * [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + /** + * A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.retail.v2beta.ListProductsRequest.filter] is unset. + * * List + * [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2beta.Product]s sharing the same + * [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2beta.Product]. For example: + * `primary_product_id = "some_product_id"` + * * List [Product][google.cloud.retail.v2beta.Product]s bundled in a + * [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2beta.Product]. + * For example: + * `collection_product_id = "some_product_id"` + * * List [Product][google.cloud.retail.v2beta.Product]s with a partibular + * type. For example: + * `type = "PRIMARY"` + * `type = "VARIANT"` + * `type = "COLLECTION"` + * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + * If the specified + * [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + * [Product][google.cloud.retail.v2beta.Product] or + * [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] + * [Product][google.cloud.retail.v2beta.Product] does not exist, a NOT_FOUND + * error is returned. + */ + // const filter = 'abc123' + /** + * The fields of [Product][google.cloud.retail.v2beta.Product] to return in + * the responses. If not set or empty, the following fields are returned: + * * [Product.name][google.cloud.retail.v2beta.Product.name] + * * [Product.id][google.cloud.retail.v2beta.Product.id] + * * [Product.title][google.cloud.retail.v2beta.Product.title] + * * [Product.uri][google.cloud.retail.v2beta.Product.uri] + * * [Product.images][google.cloud.retail.v2beta.Product.images] + * * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + * * [Product.brands][google.cloud.retail.v2beta.Product.brands] + * If "*" is provided, all fields are returned. + * [Product.name][google.cloud.retail.v2beta.Product.name] is always returned + * no matter what mask is set. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + */ + // const readMask = '' + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function listProducts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listProductsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listProducts(); + // [END retail_v2beta_generated_ProductService_ListProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js new file mode 100644 index 00000000000..49c95ad3d12 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -0,0 +1,105 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, type, placeIds) { + // [START retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. The fulfillment type, including commonly used types (such as + * pickup in store and same day delivery), and custom types. + * Supported values: + * * "pickup-in-store" + * * "ship-to-store" + * * "same-day-delivery" + * * "next-day-delivery" + * * "custom-type-1" + * * "custom-type-2" + * * "custom-type-3" + * * "custom-type-4" + * * "custom-type-5" + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + * This field directly corresponds to [Product.fulfillment_info.type][]. + */ + // const type = 'abc123' + /** + * Required. The IDs for this + * [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type], + * such as the store IDs for "pickup-in-store" or the region IDs for + * "same-day-delivery", to be removed for this + * [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type]. + * At least 1 value is required, and a maximum of 2000 values are allowed. + * Each value must be a string with a length limit of 10 characters, matching + * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const placeIds = 'abc123' + /** + * The time when the fulfillment updates are issued, used to prevent + * out-of-order updates on fulfillment information. If not provided, the + * internal system time will be used. + */ + // const removeTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + * not found, the fulfillment information will still be processed and retained + * for at most 1 day and processed once the + * [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + * a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2beta.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function removeFulfillmentPlaces() { + // Construct request + const request = { + product, + type, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeFulfillmentPlaces(request); + const [response] = await operation.promise(); + console.log(response); + } + + removeFulfillmentPlaces(); + // [END retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js new file mode 100644 index 00000000000..ae2f590a188 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -0,0 +1,104 @@ +// Copyright 2021 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. + +'use strict'; + +function main(inventory) { + // [START retail_v2beta_generated_ProductService_SetInventory_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The inventory information to update. The allowable fields to + * update are: + * * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + * * [Product.availability][google.cloud.retail.v2beta.Product.availability] + * * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] + * * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] + * The updated inventory fields must be specified in + * [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask]. + * If [SetInventoryRequest.inventory.name][] is empty or invalid, an + * INVALID_ARGUMENT error is returned. + * If the caller does not have permission to update the + * [Product][google.cloud.retail.v2beta.Product] named in + * [Product.name][google.cloud.retail.v2beta.Product.name], regardless of + * whether or not it exists, a PERMISSION_DENIED error is returned. + * If the [Product][google.cloud.retail.v2beta.Product] to update does not + * have existing inventory information, the provided inventory information + * will be inserted. + * If the [Product][google.cloud.retail.v2beta.Product] to update has existing + * inventory information, the provided inventory information will be merged + * while respecting the last update time for each inventory field, using the + * provided or default value for + * [SetInventoryRequest.set_time][google.cloud.retail.v2beta.SetInventoryRequest.set_time]. + * The last update time is recorded for the following inventory fields: + * * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] + * * [Product.availability][google.cloud.retail.v2beta.Product.availability] + * * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] + * * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] + * If a full overwrite of inventory information while ignoring timestamps is + * needed, [UpdateProduct][] should be invoked instead. + */ + // const inventory = '' + /** + * Indicates which inventory fields in the provided + * [Product][google.cloud.retail.v2beta.Product] to update. If not set or set + * with empty paths, all inventory fields will be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const setMask = '' + /** + * The time when the request is issued, used to prevent + * out-of-order updates on inventory fields with the last update time + * recorded. If not provided, the internal system time will be used. + */ + // const setTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2beta.Product] with + * name [Product.name][google.cloud.retail.v2beta.Product.name] is not found, + * the inventory update will still be processed and retained for at most 1 day + * until the [Product][google.cloud.retail.v2beta.Product] is created. If set + * to false, a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2beta.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function setInventory() { + // Construct request + const request = { + inventory, + }; + + // Run request + const [operation] = await retailClient.setInventory(request); + const [response] = await operation.promise(); + console.log(response); + } + + setInventory(); + // [END retail_v2beta_generated_ProductService_SetInventory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js new file mode 100644 index 00000000000..fee1d168be5 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js @@ -0,0 +1,74 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product) { + // [START retail_v2beta_generated_ProductService_UpdateProduct_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The product to update/create. + * If the caller does not have permission to update the + * [Product][google.cloud.retail.v2beta.Product], regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * If the [Product][google.cloud.retail.v2beta.Product] to update does not + * exist and + * [allow_missing][google.cloud.retail.v2beta.UpdateProductRequest.allow_missing] + * is not set, a NOT_FOUND error is returned. + */ + // const product = '' + /** + * Indicates which fields in the provided + * [Product][google.cloud.retail.v2beta.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. + */ + // const updateMask = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + * not found, a new [Product][google.cloud.retail.v2beta.Product] will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function updateProduct() { + // Construct request + const request = { + product, + }; + + // Run request + const response = await retailClient.updateProduct(request); + console.log(response); + } + + updateProduct(); + // [END retail_v2beta_generated_ProductService_UpdateProduct_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js new file mode 100644 index 00000000000..61f479313f8 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -0,0 +1,248 @@ +// Copyright 2021 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. + +'use strict'; + +function main(placement, visitorId) { + // [START retail_v2beta_generated_SearchService_Search_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the search engine placement, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. + */ + // const placement = 'abc123' + /** + * The branch resource name, such as + * `projects/* /locations/global/catalogs/default_catalog/branches/0`. + * Use "default_branch" as the branch ID or leave this field empty, to search + * products under the default branch. + */ + // const branch = 'abc123' + /** + * Raw search query. + */ + // const query = 'abc123' + /** + * 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 logs in or 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. + */ + // const visitorId = 'abc123' + /** + * User information. + */ + // const userInfo = '' + /** + * Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return. + * If unspecified, defaults to a reasonable value. The maximum allowed value + * is 120. Values above 120 will be coerced to 120. + * If this field is negative, an INVALID_ARGUMENT is returned. + */ + // const pageSize = 1234 + /** + * A page token + * [SearchResponse.next_page_token][google.cloud.retail.v2beta.SearchResponse.next_page_token], + * received from a previous + * [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + * must match the call that provided the page token. Otherwise, an + * INVALID_ARGUMENT error is returned. + */ + // const pageToken = 'abc123' + /** + * A 0-indexed integer that specifies the current offset (that is, starting + * result location, amongst the [Product][google.cloud.retail.v2beta.Product]s + * deemed by the API as relevant) in search results. This field is only + * considered if + * [page_token][google.cloud.retail.v2beta.SearchRequest.page_token] is unset. + * If this field is negative, an INVALID_ARGUMENT is returned. + */ + // const offset = 1234 + /** + * The filter syntax consists of an expression language for constructing a + * predicate from one or more fields of the products being filtered. Filter + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + */ + // const filter = 'abc123' + /** + * The filter applied to every search request when quality improvement such as + * query expansion is needed. For example, if a query does not have enough + * results, an expanded query with + * [SearchRequest.canonical_filter][google.cloud.retail.v2beta.SearchRequest.canonical_filter] + * will be returned as a supplement of the original query. This field is + * strongly recommended to achieve high search quality. + * See [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + * for more details about filter syntax. + */ + // const canonicalFilter = 'abc123' + /** + * The order in which products are returned. Products can be ordered by + * a field in an [Product][google.cloud.retail.v2beta.Product] object. Leave + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). + * If this field is unrecognizable, an INVALID_ARGUMENT is returned. + */ + // const orderBy = 'abc123' + /** + * Facet specifications for faceted search. If empty, no facets are returned. + * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + * is returned. + */ + // const facetSpecs = 1234 + /** + * The specification for dynamically generated facets. Notice that only + * textual facets can be dynamically generated. + * This feature requires additional allowlisting. Contact Retail Search + * support team if you are interested in using dynamic facet feature. + */ + // const dynamicFacetSpec = '' + /** + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * Notice that if both [ServingConfig.boost_control_ids][] and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. + */ + // const boostSpec = '' + /** + * The query expansion specification that specifies the conditions under which + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). + */ + // const queryExpansionSpec = '' + /** + * The keys to fetch and rollup the matching + * [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2beta.Product]s attributes. The attributes + * from all the matching + * [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2beta.Product]s are merged and + * de-duplicated. Notice that rollup + * [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] + * [Product][google.cloud.retail.v2beta.Product]s attributes will lead to + * extra query latency. Maximum number of keys is 10. + * For [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo], a + * fulfillment type and a fulfillment ID must be provided in the format of + * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", + * "pickupInStore" is fulfillment type and "store123" is the store ID. + * Supported keys are: + * * colorFamilies + * * price + * * originalPrice + * * discount + * * inventory(place_id,price) + * * attributes.key, where key is any key in the + * [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. + * * pickupInStore.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "pickup-in-store". + * * shipToStore.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "ship-to-store". + * * sameDayDelivery.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "same-day-delivery". + * * nextDayDelivery.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "next-day-delivery". + * * customFulfillment1.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "custom-type-1". + * * customFulfillment2.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "custom-type-2". + * * customFulfillment3.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "custom-type-3". + * * customFulfillment4.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "custom-type-4". + * * customFulfillment5.id, where id is any + * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] + * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * "custom-type-5". + * If this field is set to an invalid value other than these, an + * INVALID_ARGUMENT error is returned. + */ + // const variantRollupKeys = 'abc123' + /** + * The categories associated with a category page. Required for category + * navigation queries to achieve good search quality. The format should be + * the same as + * [UserEvent.page_categories][google.cloud.retail.v2beta.UserEvent.page_categories]; + * 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"]. + */ + // const pageCategories = 'abc123' + /** + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. + */ + // const searchMode = '' + + // Imports the Retail library + const {SearchServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new SearchServiceClient(); + + async function search() { + // Construct request + const request = { + placement, + visitorId, + }; + + // Run request + const iterable = await retailClient.searchAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + search(); + // [END retail_v2beta_generated_SearchService_Search_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js new file mode 100644 index 00000000000..14b0a36e874 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js @@ -0,0 +1,72 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, userEvent) { + // [START retail_v2beta_generated_UserEventService_CollectUserEvent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. URL encoded UserEvent proto with a length limit of 2,000,000 + * characters. + */ + // const userEvent = 'abc123' + /** + * 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. + */ + // const uri = 'abc123' + /** + * The event timestamp in milliseconds. This prevents browser caching of + * otherwise identical get requests. The name is abbreviated to reduce the + * payload bytes. + */ + // const ets = 1234 + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function collectUserEvent() { + // Construct request + const request = { + parent, + userEvent, + }; + + // Run request + const response = await retailClient.collectUserEvent(request); + console.log(response); + } + + collectUserEvent(); + // [END retail_v2beta_generated_UserEventService_CollectUserEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js new file mode 100644 index 00000000000..d4dc2fc4959 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js @@ -0,0 +1,63 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, inputConfig) { + // [START retail_v2beta_generated_UserEventService_ImportUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. `projects/1234/locations/global/catalogs/default_catalog` + */ + // const parent = 'abc123' + /** + * Required. The desired input location of the data. + */ + // const inputConfig = '' + /** + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + */ + // const errorsConfig = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function importUserEvents() { + // Construct request + const request = { + parent, + inputConfig, + }; + + // Run request + const [operation] = await retailClient.importUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + importUserEvents(); + // [END retail_v2beta_generated_UserEventService_ImportUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js new file mode 100644 index 00000000000..39e6980933c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js @@ -0,0 +1,85 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, filter) { + // [START retail_v2beta_generated_UserEventService_PurgeUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the catalog under which the events are + * created. The format is + * `projects/${projectId}/locations/global/catalogs/${catalogId}` + */ + // const parent = 'abc123' + /** + * 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.v2beta.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. + */ + // const filter = 'abc123' + /** + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any user events. + */ + // const force = true + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function purgeUserEvents() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const [operation] = await retailClient.purgeUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + purgeUserEvents(); + // [END retail_v2beta_generated_UserEventService_PurgeUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js new file mode 100644 index 00000000000..2ac57d1b703 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js @@ -0,0 +1,61 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent) { + // [START retail_v2beta_generated_UserEventService_RejoinUserEvents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const userEventRejoinScope = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function rejoinUserEvents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await retailClient.rejoinUserEvents(request); + const [response] = await operation.promise(); + console.log(response); + } + + rejoinUserEvents(); + // [END retail_v2beta_generated_UserEventService_RejoinUserEvents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js new file mode 100644 index 00000000000..cc58e3a36b8 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js @@ -0,0 +1,58 @@ +// Copyright 2021 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. + +'use strict'; + +function main(parent, userEvent) { + // [START retail_v2beta_generated_UserEventService_WriteUserEvent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + */ + // const parent = 'abc123' + /** + * Required. User event to write. + */ + // const userEvent = '' + + // Imports the Retail library + const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new UserEventServiceClient(); + + async function writeUserEvent() { + // Construct request + const request = { + parent, + userEvent, + }; + + // Run request + const response = await retailClient.writeUserEvent(request); + console.log(response); + } + + writeUserEvent(); + // [END retail_v2beta_generated_UserEventService_WriteUserEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 266b2b5fd3a..80dfc46ce11 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -814,7 +814,8 @@ export class CatalogServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCatalogs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( this.innerApiCalls.listCatalogs as gax.GaxCall, @@ -882,7 +883,8 @@ export class CatalogServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCatalogs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 0040141cf0f..338bd46062b 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -1119,7 +1119,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.Product.name|Product.name} is not found, the * inventory update will still be processed and retained for at most 1 day * until the {@link google.cloud.retail.v2.Product|Product} is created. If set to - * false, an INVALID_ARGUMENT error is returned if the + * false, a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1326,8 +1326,8 @@ export class ProductServiceClient { * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not * found, the fulfillment information will still be processed and retained for * at most 1 day and processed once the - * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, an - * INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, a + * NOT_FOUND error is returned if the * {@link google.cloud.retail.v2.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1529,8 +1529,8 @@ export class ProductServiceClient { * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not * found, the fulfillment information will still be processed and retained for * at most 1 day and processed once the - * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, an - * INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, a + * NOT_FOUND error is returned if the * {@link google.cloud.retail.v2.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1895,7 +1895,8 @@ export class ProductServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProducts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.createStream( this.innerApiCalls.listProducts as gax.GaxCall, @@ -2012,7 +2013,8 @@ export class ProductServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProducts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.asyncIterate( this.innerApiCalls['listProducts'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index aaf1b287347..e2652fe8cc9 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -361,12 +361,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -413,7 +409,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -429,7 +426,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it - * unset if ordered by relevance. OrderBy expression is case-sensitive. + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -444,10 +443,18 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both {@link |ServingConfig.boost_control_ids} and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} @@ -469,6 +476,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -523,6 +531,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -583,12 +594,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -635,7 +642,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -651,7 +659,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it - * unset if ordered by relevance. OrderBy expression is case-sensitive. + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -666,10 +676,18 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both {@link |ServingConfig.boost_control_ids} and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} @@ -691,6 +709,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -745,6 +764,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -769,7 +791,8 @@ export class SearchServiceClient { gax.routingHeader.fromParams({ placement: request.placement || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['search']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.createStream( this.innerApiCalls.search as gax.GaxCall, @@ -787,12 +810,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -839,7 +858,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -855,7 +875,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2.Product|Product} object. Leave it - * unset if ordered by relevance. OrderBy expression is case-sensitive. + * unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -870,10 +892,18 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both {@link |ServingConfig.boost_control_ids} and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} @@ -895,6 +925,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -949,6 +980,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -978,7 +1012,8 @@ export class SearchServiceClient { placement: request.placement || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['search']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.asyncIterate( this.innerApiCalls['search'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 94a7ea2175c..67bba9a009b 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -838,7 +838,8 @@ export class CatalogServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCatalogs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( this.innerApiCalls.listCatalogs as gax.GaxCall, @@ -906,7 +907,8 @@ export class CatalogServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCatalogs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 0ad01091346..0e973c7cc0d 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -1142,7 +1142,7 @@ export class ProductServiceClient { * name {@link google.cloud.retail.v2alpha.Product.name|Product.name} is not found, * the inventory update will still be processed and retained for at most 1 day * until the {@link google.cloud.retail.v2alpha.Product|Product} is created. If set - * to false, an INVALID_ARGUMENT error is returned if the + * to false, a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2alpha.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1350,7 +1350,7 @@ export class ProductServiceClient { * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * an INVALID_ARGUMENT error is returned if the + * a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2alpha.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1553,7 +1553,7 @@ export class ProductServiceClient { * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * an INVALID_ARGUMENT error is returned if the + * a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2alpha.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1944,7 +1944,8 @@ export class ProductServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProducts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.createStream( this.innerApiCalls.listProducts as gax.GaxCall, @@ -2071,7 +2072,8 @@ export class ProductServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProducts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.asyncIterate( this.innerApiCalls['listProducts'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index f713ea10543..7322541eb8e 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -361,12 +361,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -414,7 +410,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -431,7 +428,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -446,17 +445,27 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both + * {@link google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur.. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * * Defaults to * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, * which means only the most relevant results are shown, and the least number - * of results are returned. + * of results are returned. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} @@ -480,6 +489,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -543,6 +553,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -603,12 +616,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -656,7 +665,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -673,7 +683,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -688,17 +700,27 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both + * {@link google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur.. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * * Defaults to * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, * which means only the most relevant results are shown, and the least number - * of results are returned. + * of results are returned. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} @@ -722,6 +744,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -785,6 +808,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -809,7 +835,8 @@ export class SearchServiceClient { gax.routingHeader.fromParams({ placement: request.placement || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['search']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.createStream( this.innerApiCalls.search as gax.GaxCall, @@ -827,12 +854,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -880,7 +903,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -897,7 +921,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -912,17 +938,27 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both + * {@link google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur.. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold * The relevance threshold of the search results. * * Defaults to * {@link google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, * which means only the most relevant results are shown, and the least number - * of results are returned. + * of results are returned. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} @@ -946,6 +982,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -1009,6 +1046,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1038,7 +1078,8 @@ export class SearchServiceClient { placement: request.placement || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['search']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.asyncIterate( this.innerApiCalls['search'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 9826d1da8b6..add23f8f3b7 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -838,7 +838,8 @@ export class CatalogServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCatalogs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( this.innerApiCalls.listCatalogs as gax.GaxCall, @@ -906,7 +907,8 @@ export class CatalogServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listCatalogs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index c19d92a154a..e4a13fcf91d 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -1141,7 +1141,7 @@ export class ProductServiceClient { * name {@link google.cloud.retail.v2beta.Product.name|Product.name} is not found, * the inventory update will still be processed and retained for at most 1 day * until the {@link google.cloud.retail.v2beta.Product|Product} is created. If set - * to false, an INVALID_ARGUMENT error is returned if the + * to false, a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2beta.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1349,7 +1349,7 @@ export class ProductServiceClient { * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the * {@link google.cloud.retail.v2beta.Product|Product} is created. If set to false, - * an INVALID_ARGUMENT error is returned if the + * a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2beta.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1552,7 +1552,7 @@ export class ProductServiceClient { * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the * {@link google.cloud.retail.v2beta.Product|Product} is created. If set to false, - * an INVALID_ARGUMENT error is returned if the + * a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2beta.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1927,7 +1927,8 @@ export class ProductServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProducts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.createStream( this.innerApiCalls.listProducts as gax.GaxCall, @@ -2046,7 +2047,8 @@ export class ProductServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProducts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.asyncIterate( this.innerApiCalls['listProducts'] as GaxCall, diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 69620eb5ec9..0b613521842 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -361,12 +361,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -413,7 +409,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -429,7 +426,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -444,10 +443,18 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both {@link |ServingConfig.boost_control_ids} and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} @@ -471,6 +478,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -525,6 +533,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2beta.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -585,12 +596,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -637,7 +644,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -653,7 +661,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -668,10 +678,18 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both {@link |ServingConfig.boost_control_ids} and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} @@ -695,6 +713,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -749,6 +768,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2beta.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -773,7 +795,8 @@ export class SearchServiceClient { gax.routingHeader.fromParams({ placement: request.placement || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['search']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.createStream( this.innerApiCalls.search as gax.GaxCall, @@ -791,12 +814,8 @@ export class SearchServiceClient { * @param {string} request.placement * Required. The resource name of the search engine placement, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the set of models that will be used to make - * the search. - * - * We currently support one placement with the following ID: - * - * * `default_search`. + * This field is used to identify the serving configuration name and the set + * of models that will be used to make the search. * @param {string} request.branch * The branch resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/0`. @@ -843,7 +862,8 @@ export class SearchServiceClient { * @param {string} request.filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. + * expression is case-sensitive. See more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter @@ -859,7 +879,9 @@ export class SearchServiceClient { * @param {string} request.orderBy * The order in which products are returned. Products can be ordered by * a field in an {@link google.cloud.retail.v2beta.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. + * it unset if ordered by relevance. OrderBy expression is case-sensitive. See + * more details at this [user + * guide](https://cloud.google.com/retail/docs/filter-and-order#order). * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {number[]} request.facetSpecs @@ -874,10 +896,18 @@ export class SearchServiceClient { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. + * Boost specification to boost certain products. See more details at this + * [user guide](https://cloud.google.com/retail/docs/boosting). + * + * Notice that if both {@link |ServingConfig.boost_control_ids} and + * [SearchRequest.boost_spec] are set, the boost conditions from both places + * are evaluated. If a search request matches multiple boost conditions, + * the final boost score is equal to the sum of the boost scores from all + * matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which - * query expansion will occur. + * query expansion will occur. See more details at this [user + * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} @@ -901,6 +931,7 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * inventory(place_id,price) * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -955,6 +986,9 @@ export class SearchServiceClient { * 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"]. + * @param {google.cloud.retail.v2beta.SearchRequest.SearchMode} request.searchMode + * The search mode of the search request. If not specified, a single search + * request triggers both product search and faceted search. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -984,7 +1018,8 @@ export class SearchServiceClient { placement: request.placement || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['search']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.asyncIterate( this.innerApiCalls['search'] as GaxCall, From 55ed1b2cd4a93a338ac20d61785931f274d7e902 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 22:58:29 +0000 Subject: [PATCH 045/103] chore: release 1.3.0 (#108) :robot: I have created a release \*beep\* \*boop\* --- ## [1.3.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.2...v1.3.0) (2021-10-19) ### Features * add search mode to search request. If not specified, a single search request triggers both product search and faceted search. ([49b9b8e](https://www.github.com/googleapis/nodejs-retail/commit/49b9b8e22eba6318f54e44025df4e3c1900cb73e)) * update grpc service config settings to reflect correct API deadlines ([49b9b8e](https://www.github.com/googleapis/nodejs-retail/commit/49b9b8e22eba6318f54e44025df4e3c1900cb73e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 8 ++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index e110cc457ae..f8ba7fef83e 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.3.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.2...v1.3.0) (2021-10-19) + + +### Features + +* add search mode to search request. If not specified, a single search request triggers both product search and faceted search. ([49b9b8e](https://www.github.com/googleapis/nodejs-retail/commit/49b9b8e22eba6318f54e44025df4e3c1900cb73e)) +* update grpc service config settings to reflect correct API deadlines ([49b9b8e](https://www.github.com/googleapis/nodejs-retail/commit/49b9b8e22eba6318f54e44025df4e3c1900cb73e)) + ### [1.2.2](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.1...v1.2.2) (2021-09-10) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index b08f2886fa9..24abb5744cb 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.2.2", + "version": "1.3.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 36434540062..33a2d71badf 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.2.2" + "@google-cloud/retail": "^1.3.0" }, "devDependencies": { "c8": "^7.1.0", From e5779b9624b1c47011337a14d347a12a882f7323 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Wed, 27 Oct 2021 11:26:27 -0700 Subject: [PATCH 046/103] chore: fix the wrong post processor image (#110) --- packages/google-cloud-retail/.github/.OwlBot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/.github/.OwlBot.yaml b/packages/google-cloud-retail/.github/.OwlBot.yaml index d47a2000f2b..85b7e5ac443 100644 --- a/packages/google-cloud-retail/.github/.OwlBot.yaml +++ b/packages/google-cloud-retail/.github/.OwlBot.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. docker: - image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest deep-remove-regex: - /owl-bot-staging From 7159a042707284fdbca85c865fbc558a74d0cae6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 27 Oct 2021 22:02:22 +0200 Subject: [PATCH 047/103] chore(deps): update dependency @types/node to v16 (#109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^14.14.10` -> `^16.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/14.17.32/16.11.6) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/compatibility-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/confidence-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 24abb5744cb..56f306f5a25 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@types/mocha": "^8.0.4", - "@types/node": "^14.14.10", + "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.3.5", "gts": "^3.0.3", From a7885f5f3a0603a8a0e4db31af5024acdbaa6279 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Oct 2021 21:08:16 +0000 Subject: [PATCH 048/103] docs: fix docstring formatting (#111) - [ ] Regenerate this pull request now. Committer: @parthea PiperOrigin-RevId: 405938813 Source-Link: https://github.com/googleapis/googleapis/commit/37924239ed9e96535a025474c750db37e1b88c41 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0e3178849f8ebefce89b080743dcbef812af5063 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGUzMTc4ODQ5ZjhlYmVmY2U4OWIwODA3NDNkY2JlZjgxMmFmNTA2MyJ9 --- .../protos/google/cloud/retail/v2/common.proto | 7 ++++--- .../google/cloud/retail/v2/completion_service.proto | 10 +++++----- .../protos/google/cloud/retail/v2/import_config.proto | 2 +- .../protos/google/cloud/retail/v2/product.proto | 2 +- .../google/cloud/retail/v2/product_service.proto | 4 ++-- .../protos/google/cloud/retail/v2alpha/common.proto | 7 ++++--- .../cloud/retail/v2alpha/completion_service.proto | 10 +++++----- .../google/cloud/retail/v2alpha/import_config.proto | 2 +- .../protos/google/cloud/retail/v2alpha/product.proto | 2 +- .../google/cloud/retail/v2alpha/product_service.proto | 4 ++-- .../protos/google/cloud/retail/v2beta/common.proto | 7 ++++--- .../cloud/retail/v2beta/completion_service.proto | 10 +++++----- .../google/cloud/retail/v2beta/import_config.proto | 2 +- .../protos/google/cloud/retail/v2beta/product.proto | 2 +- .../google/cloud/retail/v2beta/product_service.proto | 4 ++-- .../generated/v2/completion_service.complete_query.js | 10 +++++----- .../v2/product_service.add_fulfillment_places.js | 2 +- .../generated/v2/product_service.import_products.js | 2 +- .../v2/product_service.remove_fulfillment_places.js | 2 +- .../v2alpha/completion_service.complete_query.js | 10 +++++----- .../v2alpha/product_service.add_fulfillment_places.js | 2 +- .../v2alpha/product_service.import_products.js | 2 +- .../product_service.remove_fulfillment_places.js | 2 +- .../v2beta/completion_service.complete_query.js | 10 +++++----- .../v2beta/product_service.add_fulfillment_places.js | 2 +- .../v2beta/product_service.import_products.js | 2 +- .../product_service.remove_fulfillment_places.js | 2 +- .../src/v2/completion_service_client.ts | 10 +++++----- .../src/v2/product_service_client.ts | 6 +++--- .../src/v2alpha/completion_service_client.ts | 10 +++++----- .../src/v2alpha/product_service_client.ts | 6 +++--- .../src/v2beta/completion_service_client.ts | 10 +++++----- .../src/v2beta/product_service_client.ts | 6 +++--- 33 files changed, 87 insertions(+), 84 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 157d22aa0b8..440a6af3986 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -173,8 +173,9 @@ message FulfillmentInfo { // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type]. // // A maximum of 3000 values are allowed. Each value must be a string with a - // length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as - // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. + // length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such + // as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is + // returned. repeated string place_ids = 2; } @@ -414,7 +415,7 @@ message Promotion { // ID of the promotion. For example, "free gift". // // The value value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, + // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is // returned. // diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto index c18d67d6845..f17db9fa311 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -110,18 +110,18 @@ message CompleteQueryRequest { // The device type context for completion suggestions. // It is useful to apply different suggestions on different device types, e.g. - // DESKTOP, MOBILE. If it is empty, the suggestions are across all device + // `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device // types. // // Supported formats: // - // * UNKNOWN_DEVICE_TYPE + // * `UNKNOWN_DEVICE_TYPE` // - // * DESKTOP + // * `DESKTOP` // - // * MOBILE + // * `MOBILE` // - // * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + // * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. string device_type = 4; // Determines which dataset to use for fetching completion. "user-data" will diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index 25170d4c28b..977e9e97963 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -183,7 +183,7 @@ message ImportProductsRequest { // Unique identifier provided by client, within the ancestor // dataset scope. Ensures idempotency and used for request deduplication. // Server-generated if unspecified. Up to 128 characters long and must match - // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + // the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in // [ImportMetadata][google.cloud.retail.v2.ImportMetadata]. // // Only supported when diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 545cc99cc8f..4d8f10a74ab 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -320,7 +320,7 @@ message Product { // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. // * For indexable attribute, the key must match the pattern: - // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. + // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; // Custom tags associated with the product. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index 03c5a752b91..b285eb4a29c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -536,7 +536,7 @@ message AddFulfillmentPlacesRequest { // // At least 1 value is required, and a maximum of 2000 values are allowed. // Each value must be a string with a length limit of 10 characters, matching - // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an // INVALID_ARGUMENT error is returned. // // If the total number of place IDs exceeds 2000 for this @@ -611,7 +611,7 @@ message RemoveFulfillmentPlacesRequest { // // At least 1 value is required, and a maximum of 2000 values are allowed. // Each value must be a string with a length limit of 10 characters, matching - // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an // INVALID_ARGUMENT error is returned. repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index a0d90b3ee1a..b0d443dd0bd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -176,8 +176,9 @@ message FulfillmentInfo { // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2alpha.FulfillmentInfo.type]. // // A maximum of 3000 values are allowed. Each value must be a string with a - // length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as - // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. + // length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such + // as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is + // returned. repeated string place_ids = 2; } @@ -423,7 +424,7 @@ message Promotion { // ID of the promotion. For example, "free gift". // // The value value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, + // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is // returned. // diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto index 73476ff6c77..6cd364e95d3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto @@ -110,18 +110,18 @@ message CompleteQueryRequest { // The device type context for completion suggestions. // It is useful to apply different suggestions on different device types, e.g. - // DESKTOP, MOBILE. If it is empty, the suggestions are across all device + // `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device // types. // // Supported formats: // - // * UNKNOWN_DEVICE_TYPE + // * `UNKNOWN_DEVICE_TYPE` // - // * DESKTOP + // * `DESKTOP` // - // * MOBILE + // * `MOBILE` // - // * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + // * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. string device_type = 4; // Determines which dataset to use for fetching completion. "user-data" will diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto index 448390a2383..1e77414a19a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto @@ -183,7 +183,7 @@ message ImportProductsRequest { // Unique identifier provided by client, within the ancestor // dataset scope. Ensures idempotency and used for request deduplication. // Server-generated if unspecified. Up to 128 characters long and must match - // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + // the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in // [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata]. // // Only supported when diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index 03534ed9b3d..88adca6206c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -327,7 +327,7 @@ message Product { // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. // * For indexable attribute, the key must match the pattern: - // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. + // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; // Custom tags associated with the product. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index df9c77e7fac..f3f22964cb5 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -565,7 +565,7 @@ message AddFulfillmentPlacesRequest { // // At least 1 value is required, and a maximum of 2000 values are allowed. // Each value must be a string with a length limit of 10 characters, matching - // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an // INVALID_ARGUMENT error is returned. // // If the total number of place IDs exceeds 2000 for this @@ -640,7 +640,7 @@ message RemoveFulfillmentPlacesRequest { // // At least 1 value is required, and a maximum of 2000 values are allowed. // Each value must be a string with a length limit of 10 characters, matching - // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an // INVALID_ARGUMENT error is returned. repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index 62d11cb58e8..b281b7dee60 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -176,8 +176,9 @@ message FulfillmentInfo { // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2beta.FulfillmentInfo.type]. // // A maximum of 3000 values are allowed. Each value must be a string with a - // length limit of 30 characters, matching the pattern [a-zA-Z0-9_-]+, such as - // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. + // length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such + // as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is + // returned. repeated string place_ids = 2; } @@ -422,7 +423,7 @@ message Promotion { // ID of the promotion. For example, "free gift". // // The value value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example, + // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is // returned. // diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto index cd9de876bb6..b7de4ce72d9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto @@ -110,18 +110,18 @@ message CompleteQueryRequest { // The device type context for completion suggestions. // It is useful to apply different suggestions on different device types, e.g. - // DESKTOP, MOBILE. If it is empty, the suggestions are across all device + // `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device // types. // // Supported formats: // - // * UNKNOWN_DEVICE_TYPE + // * `UNKNOWN_DEVICE_TYPE` // - // * DESKTOP + // * `DESKTOP` // - // * MOBILE + // * `MOBILE` // - // * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + // * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. string device_type = 4; // Determines which dataset to use for fetching completion. "user-data" will diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index d9a2f2741ca..3e0c61f0471 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -183,7 +183,7 @@ message ImportProductsRequest { // Unique identifier provided by client, within the ancestor // dataset scope. Ensures idempotency and used for request deduplication. // Server-generated if unspecified. Up to 128 characters long and must match - // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + // the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in // [ImportMetadata][google.cloud.retail.v2beta.ImportMetadata]. // // Only supported when diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 78d45b04ad5..4dd13c4b766 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -326,7 +326,7 @@ message Product { // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. // * For indexable attribute, the key must match the pattern: - // [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS. + // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, key0LikeThis or KEY_1_LIKE_THIS. map attributes = 12; // Custom tags associated with the product. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index b1c62cb5866..157a76dbb7a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -541,7 +541,7 @@ message AddFulfillmentPlacesRequest { // // At least 1 value is required, and a maximum of 2000 values are allowed. // Each value must be a string with a length limit of 10 characters, matching - // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an // INVALID_ARGUMENT error is returned. // // If the total number of place IDs exceeds 2000 for this @@ -616,7 +616,7 @@ message RemoveFulfillmentPlacesRequest { // // At least 1 value is required, and a maximum of 2000 values are allowed. // Each value must be a string with a length limit of 10 characters, matching - // the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an // INVALID_ARGUMENT error is returned. repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index 2c3d3aa5003..e57f2d0374c 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -51,13 +51,13 @@ function main(catalog, query) { /** * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. - * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device * types. * Supported formats: - * * UNKNOWN_DEVICE_TYPE - * * DESKTOP - * * MOBILE - * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * * `UNKNOWN_DEVICE_TYPE` + * * `DESKTOP` + * * `MOBILE` + * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. */ // const deviceType = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js index b933ab62f7e..099df303b45 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -55,7 +55,7 @@ function main(product, type, placeIds) { * IDs will be automatically ignored. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * If the total number of place IDs exceeds 2000 for this * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index 8288a5337d4..e950f862cac 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -30,7 +30,7 @@ function main(parent, inputConfig) { * Unique identifier provided by client, within the ancestor * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in * [ImportMetadata][google.cloud.retail.v2.ImportMetadata]. * Only supported when * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js index 87bb9bcc658..22db6417908 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -54,7 +54,7 @@ function main(product, type, placeIds) { * [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. */ // const placeIds = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index a97985d9b74..9fdbf04b281 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -51,13 +51,13 @@ function main(catalog, query) { /** * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. - * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device * types. * Supported formats: - * * UNKNOWN_DEVICE_TYPE - * * DESKTOP - * * MOBILE - * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * * `UNKNOWN_DEVICE_TYPE` + * * `DESKTOP` + * * `MOBILE` + * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. */ // const deviceType = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js index be177e37b6f..8fbf919b768 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -55,7 +55,7 @@ function main(product, type, placeIds) { * Duplicate IDs will be automatically ignored. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * If the total number of place IDs exceeds 2000 for this * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type] after diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index 06cea1181b0..ca380013932 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -30,7 +30,7 @@ function main(parent, inputConfig) { * Unique identifier provided by client, within the ancestor * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in * [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata]. * Only supported when * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js index c0dd6c84e02..a69eb6fcfe9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -54,7 +54,7 @@ function main(product, type, placeIds) { * [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type]. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. */ // const placeIds = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index cb72fdc4492..d38e3d77ca8 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -51,13 +51,13 @@ function main(catalog, query) { /** * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. - * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device * types. * Supported formats: - * * UNKNOWN_DEVICE_TYPE - * * DESKTOP - * * MOBILE - * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * * `UNKNOWN_DEVICE_TYPE` + * * `DESKTOP` + * * `MOBILE` + * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. */ // const deviceType = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js index 1a4b833e6d1..ed21e64f9d4 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -55,7 +55,7 @@ function main(product, type, placeIds) { * Duplicate IDs will be automatically ignored. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * If the total number of place IDs exceeds 2000 for this * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type] after diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index 00a1968f93e..37975519eae 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -30,7 +30,7 @@ function main(parent, inputConfig) { * Unique identifier provided by client, within the ancestor * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in + * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in * [ImportMetadata][google.cloud.retail.v2beta.ImportMetadata]. * Only supported when * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js index 49c95ad3d12..853ef48ee34 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -54,7 +54,7 @@ function main(product, type, placeIds) { * [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type]. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. */ // const placeIds = 'abc123' diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index fa544ce727c..c92fcae85f8 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -399,18 +399,18 @@ export class CompletionServiceClient { * @param {string} request.deviceType * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. - * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device * types. * * Supported formats: * - * * UNKNOWN_DEVICE_TYPE + * * `UNKNOWN_DEVICE_TYPE` * - * * DESKTOP + * * `DESKTOP` * - * * MOBILE + * * `MOBILE` * - * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. * @param {string} request.dataset * Determines which dataset to use for fetching completion. "user-data" will * use the imported dataset through diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 338bd46062b..93f17ab41ef 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -862,7 +862,7 @@ export class ProductServiceClient { * Unique identifier provided by client, within the ancestor * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: "{@link |a-zA-Z0-9_]+". This is returned as [Operation.name} in + * the pattern: `{@link |a-zA-Z0-9_]+`. This is returned as [Operation.name} in * {@link google.cloud.retail.v2.ImportMetadata|ImportMetadata}. * * Only supported when @@ -1312,7 +1312,7 @@ export class ProductServiceClient { * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * * If the total number of place IDs exceeds 2000 for this @@ -1519,7 +1519,7 @@ export class ProductServiceClient { * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * @param {google.protobuf.Timestamp} request.removeTime * The time when the fulfillment updates are issued, used to prevent diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 1d98f724e19..a0d87d38c11 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -403,18 +403,18 @@ export class CompletionServiceClient { * @param {string} request.deviceType * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. - * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device * types. * * Supported formats: * - * * UNKNOWN_DEVICE_TYPE + * * `UNKNOWN_DEVICE_TYPE` * - * * DESKTOP + * * `DESKTOP` * - * * MOBILE + * * `MOBILE` * - * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. * @param {string} request.dataset * Determines which dataset to use for fetching completion. "user-data" will * use the imported dataset through diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 0e973c7cc0d..51897149cf2 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -883,7 +883,7 @@ export class ProductServiceClient { * Unique identifier provided by client, within the ancestor * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: "{@link |a-zA-Z0-9_]+". This is returned as [Operation.name} in + * the pattern: `{@link |a-zA-Z0-9_]+`. This is returned as [Operation.name} in * {@link google.cloud.retail.v2alpha.ImportMetadata|ImportMetadata}. * * Only supported when @@ -1335,7 +1335,7 @@ export class ProductServiceClient { * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * * If the total number of place IDs exceeds 2000 for this @@ -1542,7 +1542,7 @@ export class ProductServiceClient { * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * @param {google.protobuf.Timestamp} request.removeTime * The time when the fulfillment updates are issued, used to prevent diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 943ad820514..95b9b316cf4 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -403,18 +403,18 @@ export class CompletionServiceClient { * @param {string} request.deviceType * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. - * DESKTOP, MOBILE. If it is empty, the suggestions are across all device + * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device * types. * * Supported formats: * - * * UNKNOWN_DEVICE_TYPE + * * `UNKNOWN_DEVICE_TYPE` * - * * DESKTOP + * * `DESKTOP` * - * * MOBILE + * * `MOBILE` * - * * A customized string starts with OTHER_, e.g. OTHER_IPHONE. + * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. * @param {string} request.dataset * Determines which dataset to use for fetching completion. "user-data" will * use the imported dataset through diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index e4a13fcf91d..696cdf040bc 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -883,7 +883,7 @@ export class ProductServiceClient { * Unique identifier provided by client, within the ancestor * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: "{@link |a-zA-Z0-9_]+". This is returned as [Operation.name} in + * the pattern: `{@link |a-zA-Z0-9_]+`. This is returned as [Operation.name} in * {@link google.cloud.retail.v2beta.ImportMetadata|ImportMetadata}. * * Only supported when @@ -1334,7 +1334,7 @@ export class ProductServiceClient { * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * * If the total number of place IDs exceeds 2000 for this @@ -1541,7 +1541,7 @@ export class ProductServiceClient { * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching - * the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an + * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * @param {google.protobuf.Timestamp} request.removeTime * The time when the fulfillment updates are issued, used to prevent From cd00c364fdf8a1f3ef466aeb022543b7536008c3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 29 Oct 2021 09:01:59 -0700 Subject: [PATCH 049/103] feat: Add local inventory ingestion APIs to product service in alpha channel (#112) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add local inventory ingestion APIs to product service in alpha channel PiperOrigin-RevId: 406273138 Source-Link: https://github.com/googleapis/googleapis/commit/148d29d1e766a89f780e79e1e194baa8c944def7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9e9696183a3f2d05bcf6ca118060e12562f90f55 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWU5Njk2MTgzYTNmMmQwNWJjZjZjYTExODA2MGUxMjU2MmY5MGY1NSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/retail/v2alpha/common.proto | 26 + .../retail/v2alpha/product_service.proto | 171 ++ .../google-cloud-retail/protos/protos.d.ts | 702 ++++++++ packages/google-cloud-retail/protos/protos.js | 1570 +++++++++++++++++ .../google-cloud-retail/protos/protos.json | 145 ++ .../product_service.add_local_inventories.js | 94 + ...roduct_service.remove_local_inventories.js | 79 + .../src/v2alpha/gapic_metadata.json | 20 + .../src/v2alpha/product_service_client.ts | 411 +++++ .../product_service_client_config.json | 10 + .../test/gapic_product_service_v2alpha.ts | 391 ++++ 11 files changed, 3619 insertions(+) create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index b0d443dd0bd..71d57b0b2d6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -432,3 +432,29 @@ message Promotion { // [promotion](https://support.google.com/merchants/answer/7050148). string promotion_id = 1; } + +// The inventory information at a place (e.g. a store) identified +// by a place ID. +message LocalInventory { + // The place ID for the current set of inventory information. + string place_id = 1; + + // Product price and cost information. + // + // Google Merchant Center property + // [price](https://support.google.com/merchants/answer/6324371). + PriceInfo price_info = 2; + + // Additional local inventory attributes, for example, store name, promotion + // tags, etc. + // * At most 5 values are allowed. Otherwise, an INVALID_ARGUMENT error is + // returned. + // * The key must be a UTF-8 encoded string with a length limit of 10 + // characters. + // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, + // key0LikeThis or KEY_1_LIKE_THIS. + // * The attribute values must be of the same type (text or number). + // * The max number of values per attribute is 10. + // * For text values, the length limit is 10 UTF-8 characters. + map attributes = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index f3f22964cb5..4d7ad5a5333 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -216,6 +216,74 @@ service ProductService { metadata_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" }; } + + // Updates local inventory information for a + // [Product][google.cloud.retail.v2alpha.Product] at a list of places, while + // respecting the last update timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2alpha.Product] to exist before updating + // inventory information. If the request is valid, the update will be enqueued + // and processed downstream. As a consequence, when a response is returned, + // updates are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // Store inventory information can only be modified using this method. + // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // has no effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // Cloud sales if you are interested in using Retail Search. + rpc AddLocalInventories(AddLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.AddLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" + }; + } + + // Remove local inventory information for a + // [Product][google.cloud.retail.v2alpha.Product] at a list of places at a + // removal timestamp. + // + // This process is asynchronous. If the request is valid, the removal will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, removals are not immediately manifested in the + // [Product][google.cloud.retail.v2alpha.Product] queried by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // Store inventory information can only be removed using this method. + // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // has no effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please submit a form [here](https://cloud.google.com/contact) to contact + // Cloud sales if you are interested in using Retail Search. + rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" + }; + } } // Request message for [CreateProduct][] method. @@ -597,6 +665,109 @@ message AddFulfillmentPlacesMetadata {} // method. message AddFulfillmentPlacesResponse {} +// Request message for [AddLocalInventories][] method. +message AddLocalInventoriesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of inventory information at difference places. Each place + // is identified by its place ID. At most 1000 inventories are allowed per + // request. + repeated LocalInventory local_inventories = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided list of + // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The + // field is updated to the provided value. + // + // If a field is set while the place does not have a previous local inventory, + // the local inventory at that store is created. + // + // If a field is set while the value of that field is not provided, the + // original field value, if it exists, is deleted. + // + // If the mask is not set or set with empty paths, all inventory fields will + // be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask add_mask = 4; + + // The time when the inventory updates are issued. Used to prevent + // out-of-order updates on local inventory fields. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, the local inventory will still be processed and retained for at + // most 1 day and processed once the + // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + // an INVALID_ARGUMENT error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 6; +} + +// Metadata related to the progress of the AddLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddLocalInventories][] method. +message AddLocalInventoriesMetadata {} + +// Response of the [AddLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [AddLocalInventories][] +// method. +message AddLocalInventoriesResponse {} + +// Request message for [RemoveLocalInventories][] method. +message RemoveLocalInventoriesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + // not it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of place IDs to have their inventory deleted. + // At most 1000 place IDs are allowed per request. + repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; + + // The time when the inventory deletions are issued. Used to prevent + // out-of-order updates and deletions on local inventory fields. If not + // provided, the internal system time will be used. + google.protobuf.Timestamp remove_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + // not found, the local inventory removal request will still be processed and + // retained for at most 1 day and processed once the + // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + // a NOT_FOUND error is returned if the + // [Product][google.cloud.retail.v2alpha.Product] is not found. + bool allow_missing = 3; +} + +// Metadata related to the progress of the RemoveLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveLocalInventories][] method. +message RemoveLocalInventoriesMetadata {} + +// Response of the [RemoveLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [RemoveLocalInventories][] +// method. +message RemoveLocalInventoriesResponse {} + // Request message for [RemoveFulfillmentPlaces][] method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 07e4bdadf14..a15bce019fd 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -10903,6 +10903,108 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a LocalInventory. */ + interface ILocalInventory { + + /** LocalInventory placeId */ + placeId?: (string|null); + + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + } + + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { + + /** + * Constructs a new LocalInventory. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ILocalInventory); + + /** LocalInventory placeId. */ + public placeId: string; + + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** + * Creates a new LocalInventory instance using the specified properties. + * @param [properties] Properties to set + * @returns LocalInventory instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ILocalInventory): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocalInventory message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Verifies a LocalInventory message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocalInventory + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.LocalInventory; + + /** + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @param message LocalInventory + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocalInventory to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a GcsSource. */ interface IGcsSource { @@ -15452,6 +15554,34 @@ export namespace google { * @returns Promise */ public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback): void; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @returns Promise + */ + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): Promise; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback): void; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @returns Promise + */ + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): Promise; } namespace ProductService { @@ -15518,6 +15648,20 @@ export namespace google { * @param [response] Operation */ type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } /** Properties of a CreateProductRequest. */ @@ -16684,6 +16828,564 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an AddLocalInventoriesRequest. */ + interface IAddLocalInventoriesRequest { + + /** AddLocalInventoriesRequest product */ + product?: (string|null); + + /** AddLocalInventoriesRequest localInventories */ + localInventories?: (google.cloud.retail.v2alpha.ILocalInventory[]|null); + + /** AddLocalInventoriesRequest addMask */ + addMask?: (google.protobuf.IFieldMask|null); + + /** AddLocalInventoriesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an AddLocalInventoriesRequest. */ + class AddLocalInventoriesRequest implements IAddLocalInventoriesRequest { + + /** + * Constructs a new AddLocalInventoriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest); + + /** AddLocalInventoriesRequest product. */ + public product: string; + + /** AddLocalInventoriesRequest localInventories. */ + public localInventories: google.cloud.retail.v2alpha.ILocalInventory[]; + + /** AddLocalInventoriesRequest addMask. */ + public addMask?: (google.protobuf.IFieldMask|null); + + /** AddLocalInventoriesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Verifies an AddLocalInventoriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + + /** + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message AddLocalInventoriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddLocalInventoriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddLocalInventoriesMetadata. */ + interface IAddLocalInventoriesMetadata { + } + + /** Represents an AddLocalInventoriesMetadata. */ + class AddLocalInventoriesMetadata implements IAddLocalInventoriesMetadata { + + /** + * Constructs a new AddLocalInventoriesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata); + + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Verifies an AddLocalInventoriesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message AddLocalInventoriesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AddLocalInventoriesResponse. */ + interface IAddLocalInventoriesResponse { + } + + /** Represents an AddLocalInventoriesResponse. */ + class AddLocalInventoriesResponse implements IAddLocalInventoriesResponse { + + /** + * Constructs a new AddLocalInventoriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse); + + /** + * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Verifies an AddLocalInventoriesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + + /** + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message AddLocalInventoriesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AddLocalInventoriesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveLocalInventoriesRequest. */ + interface IRemoveLocalInventoriesRequest { + + /** RemoveLocalInventoriesRequest product */ + product?: (string|null); + + /** RemoveLocalInventoriesRequest placeIds */ + placeIds?: (string[]|null); + + /** RemoveLocalInventoriesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a RemoveLocalInventoriesRequest. */ + class RemoveLocalInventoriesRequest implements IRemoveLocalInventoriesRequest { + + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest); + + /** RemoveLocalInventoriesRequest product. */ + public product: string; + + /** RemoveLocalInventoriesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveLocalInventoriesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveLocalInventoriesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Verifies a RemoveLocalInventoriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveLocalInventoriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + + /** + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveLocalInventoriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveLocalInventoriesMetadata. */ + interface IRemoveLocalInventoriesMetadata { + } + + /** Represents a RemoveLocalInventoriesMetadata. */ + class RemoveLocalInventoriesMetadata implements IRemoveLocalInventoriesMetadata { + + /** + * Constructs a new RemoveLocalInventoriesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata); + + /** + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveLocalInventoriesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Verifies a RemoveLocalInventoriesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveLocalInventoriesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + + /** + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveLocalInventoriesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveLocalInventoriesResponse. */ + interface IRemoveLocalInventoriesResponse { + } + + /** Represents a RemoveLocalInventoriesResponse. */ + class RemoveLocalInventoriesResponse implements IRemoveLocalInventoriesResponse { + + /** + * Constructs a new RemoveLocalInventoriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse); + + /** + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveLocalInventoriesResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Verifies a RemoveLocalInventoriesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveLocalInventoriesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + + /** + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveLocalInventoriesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a RemoveFulfillmentPlacesRequest. */ interface IRemoveFulfillmentPlacesRequest { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 2f6524a6afe..c53d1763a0a 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -26847,6 +26847,286 @@ return Promotion; })(); + v2alpha.LocalInventory = (function() { + + /** + * Properties of a LocalInventory. + * @memberof google.cloud.retail.v2alpha + * @interface ILocalInventory + * @property {string|null} [placeId] LocalInventory placeId + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] LocalInventory priceInfo + * @property {Object.|null} [attributes] LocalInventory attributes + */ + + /** + * Constructs a new LocalInventory. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a LocalInventory. + * @implements ILocalInventory + * @constructor + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + */ + function LocalInventory(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocalInventory placeId. + * @member {string} placeId + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + */ + LocalInventory.prototype.placeId = ""; + + /** + * LocalInventory priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + */ + LocalInventory.prototype.priceInfo = null; + + /** + * LocalInventory attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + */ + LocalInventory.prototype.attributes = $util.emptyObject; + + /** + * Creates a new LocalInventory instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory instance + */ + LocalInventory.create = function create(properties) { + return new LocalInventory(properties); + }; + + /** + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocalInventory.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocalInventory message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocalInventory.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.LocalInventory(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placeId = reader.string(); + break; + case 2: + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + case 3: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocalInventory.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocalInventory message. + * @function verify + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocalInventory.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placeId != null && message.hasOwnProperty("placeId")) + if (!$util.isString(message.placeId)) + return "placeId: string expected"; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + */ + LocalInventory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.LocalInventory) + return object; + var message = new $root.google.cloud.retail.v2alpha.LocalInventory(); + if (object.placeId != null) + message.placeId = String(object.placeId); + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.LocalInventory} message LocalInventory + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocalInventory.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.placeId = ""; + object.priceInfo = null; + } + if (message.placeId != null && message.hasOwnProperty("placeId")) + object.placeId = message.placeId; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this LocalInventory to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @instance + * @returns {Object.} JSON object + */ + LocalInventory.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocalInventory; + })(); + v2alpha.GcsSource = (function() { /** @@ -38605,6 +38885,72 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return ProductService; })(); @@ -41225,6 +41571,1230 @@ return AddFulfillmentPlacesResponse; })(); + v2alpha.AddLocalInventoriesRequest = (function() { + + /** + * Properties of an AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + */ + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.product = ""; + + /** + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; + + /** + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addMask = null; + + /** + * AddLocalInventoriesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addTime = null; + + /** + * AddLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance + */ + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2alpha.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); + break; + case 4: + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); + if (error) + return "addMask." + error; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + */ + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2alpha.LocalInventory.fromObject(object.localInventories[i]); + } + } + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} message AddLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.localInventories = []; + if (options.defaults) { + object.product = ""; + object.addMask = null; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2alpha.LocalInventory.toObject(message.localInventories[j], options); + } + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this AddLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddLocalInventoriesRequest; + })(); + + v2alpha.AddLocalInventoriesMetadata = (function() { + + /** + * Properties of an AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesMetadata + */ + + /** + * Constructs a new AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + */ + function AddLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + */ + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + */ + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + }; + + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddLocalInventoriesMetadata; + })(); + + v2alpha.AddLocalInventoriesResponse = (function() { + + /** + * Properties of an AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesResponse + */ + + /** + * Constructs a new AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + */ + function AddLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + */ + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + */ + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + }; + + /** + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} message AddLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddLocalInventoriesResponse; + })(); + + v2alpha.RemoveLocalInventoriesRequest = (function() { + + /** + * Properties of a RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + */ + function RemoveLocalInventoriesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.product = ""; + + /** + * RemoveLocalInventoriesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveLocalInventoriesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.removeTime = null; + + /** + * RemoveLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + */ + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 5: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + */ + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.allowMissing = false; + object.removeTime = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + return object; + }; + + /** + * Converts this RemoveLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveLocalInventoriesRequest; + })(); + + v2alpha.RemoveLocalInventoriesMetadata = (function() { + + /** + * Properties of a RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesMetadata + */ + + /** + * Constructs a new RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + */ + function RemoveLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + */ + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + */ + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveLocalInventoriesMetadata; + })(); + + v2alpha.RemoveLocalInventoriesResponse = (function() { + + /** + * Properties of a RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesResponse + */ + + /** + * Constructs a new RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + */ + function RemoveLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + */ + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + */ + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveLocalInventoriesResponse; + })(); + v2alpha.RemoveFulfillmentPlacesRequest = (function() { /** diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index b9fd950391f..0e3d2cf1667 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -2743,6 +2743,23 @@ } } }, + "LocalInventory": { + "fields": { + "placeId": { + "type": "string", + "id": 1 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 2 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 3 + } + } + }, "GcsSource": { "fields": { "inputUris": { @@ -4118,6 +4135,62 @@ } } ] + }, + "AddLocalInventories": { + "requestType": "AddLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.AddLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.AddLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" + } + } + ] + }, + "RemoveLocalInventories": { + "requestType": "RemoveLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" + } + } + ] } } }, @@ -4309,6 +4382,78 @@ "AddFulfillmentPlacesResponse": { "fields": {} }, + "AddLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 6 + } + } + }, + "AddLocalInventoriesMetadata": { + "fields": {} + }, + "AddLocalInventoriesResponse": { + "fields": {} + }, + "RemoveLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "RemoveLocalInventoriesMetadata": { + "fields": {} + }, + "RemoveLocalInventoriesResponse": { + "fields": {} + }, "RemoveFulfillmentPlacesRequest": { "fields": { "product": { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js new file mode 100644 index 00000000000..efb10e417fe --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -0,0 +1,94 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, localInventories) { + // [START retail_v2alpha_generated_ProductService_AddLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 1000 inventories are allowed per + * request. + */ + // const localInventories = 1234 + /** + * Indicates which inventory fields in the provided list of + * [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The + * field is updated to the provided value. + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const addMask = '' + /** + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + */ + // const addTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, the local inventory will still be processed and retained for at + * most 1 day and processed once the + * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function addLocalInventories() { + // Construct request + const request = { + product, + localInventories, + }; + + // Run request + const [operation] = await retailClient.addLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + addLocalInventories(); + // [END retail_v2alpha_generated_ProductService_AddLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js new file mode 100644 index 00000000000..e3d7d059114 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -0,0 +1,79 @@ +// Copyright 2021 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. + +'use strict'; + +function main(product, placeIds) { + // [START retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * [Product][google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. A list of place IDs to have their inventory deleted. + * At most 1000 place IDs are allowed per request. + */ + // const placeIds = 'abc123' + /** + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + */ + // const removeTime = '' + /** + * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * not found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * a NOT_FOUND error is returned if the + * [Product][google.cloud.retail.v2alpha.Product] is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function removeLocalInventories() { + // Construct request + const request = { + product, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + removeLocalInventories(); + // [END retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json index 5c5b0b48cd7..194f361b0fd 100644 --- a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json @@ -166,6 +166,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", @@ -218,6 +228,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 51897149cf2..f9dca65909b 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -225,6 +225,18 @@ export class ProductServiceClient { const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata' ) as gax.protobuf.Type; + const addLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.AddLocalInventoriesResponse' + ) as gax.protobuf.Type; + const addLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata' + ) as gax.protobuf.Type; + const removeLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse' + ) as gax.protobuf.Type; + const removeLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -251,6 +263,20 @@ export class ProductServiceClient { removeFulfillmentPlacesMetadata ) ), + addLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addLocalInventoriesResponse.decode.bind(addLocalInventoriesResponse), + addLocalInventoriesMetadata.decode.bind(addLocalInventoriesMetadata) + ), + removeLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeLocalInventoriesResponse.decode.bind( + removeLocalInventoriesResponse + ), + removeLocalInventoriesMetadata.decode.bind( + removeLocalInventoriesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -312,6 +338,8 @@ export class ProductServiceClient { 'setInventory', 'addFulfillmentPlaces', 'removeFulfillmentPlaces', + 'addLocalInventories', + 'removeLocalInventories', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -1657,6 +1685,389 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata >; } + addLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addLocalInventories( + request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates local inventory information for a + * {@link google.cloud.retail.v2alpha.Product|Product} at a list of places, while + * respecting the last update timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2alpha.Product|Product} to exist before updating + * inventory information. If the request is valid, the update will be enqueued + * and processed downstream. As a consequence, when a response is returned, + * updates are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * Store inventory information can only be modified using this method. + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * has no effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * Cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * @param {number[]} request.localInventories + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 1000 inventories are allowed per + * request. + * @param {google.protobuf.FieldMask} request.addMask + * Indicates which inventory fields in the provided list of + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory} to update. The + * field is updated to the provided value. + * + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, the local inventory will still be processed and retained for at + * most 1 day and processed once the + * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, + * an INVALID_ARGUMENT error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.addLocalInventories(request); + * const [response] = await operation.promise(); + */ + addLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addLocalInventories(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkAddLocalInventoriesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkAddLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + >; + } + removeLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeLocalInventories( + request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Remove local inventory information for a + * {@link google.cloud.retail.v2alpha.Product|Product} at a list of places at a + * removal timestamp. + * + * This process is asynchronous. If the request is valid, the removal will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, removals are not immediately manifested in the + * {@link google.cloud.retail.v2alpha.Product|Product} queried by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * Store inventory information can only be removed using this method. + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * has no effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * Cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * @param {string[]} request.placeIds + * Required. A list of place IDs to have their inventory deleted. + * At most 1000 place IDs are allowed per request. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is + * not found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, + * a NOT_FOUND error is returned if the + * {@link google.cloud.retail.v2alpha.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.removeLocalInventories(request); + * const [response] = await operation.promise(); + */ + removeLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeLocalInventories( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRemoveLocalInventoriesProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRemoveLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + >; + } listProducts( request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, options?: CallOptions diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json index 541657ac5a8..60238d936f1 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json @@ -82,6 +82,16 @@ "timeout_millis": 30000, "retry_codes_name": "idempotent", "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "AddLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "RemoveLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index ea5b795ed99..d4a3fe2fb2e 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -1454,6 +1454,397 @@ describe('v2alpha.ProductServiceClient', () => { }); }); + describe('addLocalInventories', () => { + it('invokes addLocalInventories without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addLocalInventories with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addLocalInventories(request), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeLocalInventories', () => { + it('invokes removeLocalInventories without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeLocalInventories with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeLocalInventories(request), + expectedError + ); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listProducts', () => { it('invokes listProducts without error', async () => { const client = new productserviceModule.v2alpha.ProductServiceClient({ From f3a432bac8161091a11ccea0686628c9716898a9 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Thu, 4 Nov 2021 11:50:20 -0400 Subject: [PATCH 050/103] chore(cloud-rad): delete api-extractor config (#115) --- .../google-cloud-retail/api-extractor.json | 369 ------------------ 1 file changed, 369 deletions(-) delete mode 100644 packages/google-cloud-retail/api-extractor.json diff --git a/packages/google-cloud-retail/api-extractor.json b/packages/google-cloud-retail/api-extractor.json deleted file mode 100644 index de228294b23..00000000000 --- a/packages/google-cloud-retail/api-extractor.json +++ /dev/null @@ -1,369 +0,0 @@ -/** - * Config file for API Extractor. For more info, please visit: https://api-extractor.com - */ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - /** - * Optionally specifies another JSON config file that this file extends from. This provides a way for - * standard settings to be shared across multiple projects. - * - * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains - * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be - * resolved using NodeJS require(). - * - * SUPPORTED TOKENS: none - * DEFAULT VALUE: "" - */ - // "extends": "./shared/api-extractor-base.json" - // "extends": "my-package/include/api-extractor-base.json" - - /** - * Determines the "" token that can be used with other config file settings. The project folder - * typically contains the tsconfig.json and package.json config files, but the path is user-defined. - * - * The path is resolved relative to the folder of the config file that contains the setting. - * - * The default value for "projectFolder" is the token "", which means the folder is determined by traversing - * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder - * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error - * will be reported. - * - * SUPPORTED TOKENS: - * DEFAULT VALUE: "" - */ - // "projectFolder": "..", - - /** - * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor - * analyzes the symbols exported by this module. - * - * The file extension must be ".d.ts" and not ".ts". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - */ - "mainEntryPointFilePath": "/protos/protos.d.ts", - - /** - * A list of NPM package names whose exports should be treated as part of this package. - * - * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", - * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part - * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly - * imports library2. To avoid this, we can specify: - * - * "bundledPackages": [ "library2" ], - * - * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been - * local files for library1. - */ - "bundledPackages": [ ], - - /** - * Determines how the TypeScript compiler engine will be invoked by API Extractor. - */ - "compiler": { - /** - * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * Note: This setting will be ignored if "overrideTsconfig" is used. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/tsconfig.json" - */ - // "tsconfigFilePath": "/tsconfig.json", - - /** - * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. - * The object must conform to the TypeScript tsconfig schema: - * - * http://json.schemastore.org/tsconfig - * - * If omitted, then the tsconfig.json file will be read from the "projectFolder". - * - * DEFAULT VALUE: no overrideTsconfig section - */ - // "overrideTsconfig": { - // . . . - // } - - /** - * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended - * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when - * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses - * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. - * - * DEFAULT VALUE: false - */ - // "skipLibCheck": true, - }, - - /** - * Configures how the API report file (*.api.md) will be generated. - */ - "apiReport": { - /** - * (REQUIRED) Whether to generate an API report. - */ - "enabled": true, - - /** - * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce - * a full file path. - * - * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". - * - * SUPPORTED TOKENS: , - * DEFAULT VALUE: ".api.md" - */ - // "reportFileName": ".api.md", - - /** - * Specifies the folder where the API report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, - * e.g. for an API review. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/etc/" - */ - // "reportFolder": "/etc/", - - /** - * Specifies the folder where the temporary report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * After the temporary file is written to disk, it is compared with the file in the "reportFolder". - * If they are different, a production build will fail. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/" - */ - // "reportTempFolder": "/temp/" - }, - - /** - * Configures how the doc model file (*.api.json) will be generated. - */ - "docModel": { - /** - * (REQUIRED) Whether to generate a doc model file. - */ - "enabled": true, - - /** - * The output path for the doc model file. The file extension should be ".api.json". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/.api.json" - */ - // "apiJsonFilePath": "/temp/.api.json" - }, - - /** - * Configures how the .d.ts rollup file will be generated. - */ - "dtsRollup": { - /** - * (REQUIRED) Whether to generate the .d.ts rollup file. - */ - "enabled": true, - - /** - * Specifies the output path for a .d.ts rollup file to be generated without any trimming. - * This file will include all declarations that are exported by the main entry point. - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/dist/.d.ts" - */ - // "untrimmedFilePath": "/dist/.d.ts", - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. - * This file will include only declarations that are marked as "@public" or "@beta". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "betaTrimmedFilePath": "/dist/-beta.d.ts", - - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. - * This file will include only declarations that are marked as "@public". - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "publicTrimmedFilePath": "/dist/-public.d.ts", - - /** - * When a declaration is trimmed, by default it will be replaced by a code comment such as - * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the - * declaration completely. - * - * DEFAULT VALUE: false - */ - // "omitTrimmingComments": true - }, - - /** - * Configures how the tsdoc-metadata.json file will be generated. - */ - "tsdocMetadata": { - /** - * Whether to generate the tsdoc-metadata.json file. - * - * DEFAULT VALUE: true - */ - // "enabled": true, - - /** - * Specifies where the TSDoc metadata file should be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", - * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup - * falls back to "tsdoc-metadata.json" in the package folder. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" - }, - - /** - * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files - * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. - * To use the OS's default newline kind, specify "os". - * - * DEFAULT VALUE: "crlf" - */ - // "newlineKind": "crlf", - - /** - * Configures how API Extractor reports error and warning messages produced during analysis. - * - * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. - */ - "messages": { - /** - * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing - * the input .d.ts files. - * - * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "compilerMessageReporting": { - /** - * Configures the default routing for messages that don't match an explicit rule in this table. - */ - "default": { - /** - * Specifies whether the message should be written to the the tool's output log. Note that - * the "addToApiReportFile" property may supersede this option. - * - * Possible values: "error", "warning", "none" - * - * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail - * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes - * the "--local" option), the warning is displayed but the build will not fail. - * - * DEFAULT VALUE: "warning" - */ - "logLevel": "warning", - - /** - * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), - * then the message will be written inside that file; otherwise, the message is instead logged according to - * the "logLevel" option. - * - * DEFAULT VALUE: false - */ - // "addToApiReportFile": false - }, - - // "TS2551": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by API Extractor during its analysis. - * - * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" - * - * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings - */ - "extractorMessageReporting": { - "default": { - "logLevel": "warning", - // "addToApiReportFile": false - }, - - // "ae-extra-release-tag": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by the TSDoc parser when analyzing code comments. - * - * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "tsdocMessageReporting": { - "default": { - "logLevel": "warning", - // "addToApiReportFile": false - } - - // "tsdoc-link-tag-unescaped-text": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - } - } - -} From 770cbe4f0144217695f38b4a701b2d12b4a13321 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 16:02:20 +0000 Subject: [PATCH 051/103] chore: release 1.4.0 (#113) :robot: I have created a release \*beep\* \*boop\* --- ## [1.4.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.3.0...v1.4.0) (2021-11-04) ### Features * Add local inventory ingestion APIs to product service in alpha channel ([#112](https://www.github.com/googleapis/nodejs-retail/issues/112)) ([8387781](https://www.github.com/googleapis/nodejs-retail/commit/8387781135ddb02b43af222bbbd3d5852e0147d3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index f8ba7fef83e..c4ee151bbf8 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.4.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.3.0...v1.4.0) (2021-11-04) + + +### Features + +* Add local inventory ingestion APIs to product service in alpha channel ([#112](https://www.github.com/googleapis/nodejs-retail/issues/112)) ([8387781](https://www.github.com/googleapis/nodejs-retail/commit/8387781135ddb02b43af222bbbd3d5852e0147d3)) + ## [1.3.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.2.2...v1.3.0) (2021-10-19) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 56f306f5a25..8e3407558fd 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.3.0", + "version": "1.4.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 33a2d71badf..5ba6636e98f 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.3.0" + "@google-cloud/retail": "^1.4.0" }, "devDependencies": { "c8": "^7.1.0", From 88c6d1f1a4bf5eaae8ce5b2550c0edbc32fc84e9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 4 Nov 2021 20:42:21 +0100 Subject: [PATCH 052/103] chore(deps): update dependency sinon to v12 (#114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^11.0.0` -> `^12.0.0`](https://renovatebot.com/diffs/npm/sinon/11.1.2/12.0.1) | [![age](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/compatibility-slim/11.1.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/confidence-slim/11.1.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v12.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGES.md#​1201) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.0...v12.0.1) - [`3f598221`](https://togithub.com/sinonjs/sinon/commit/3f598221045904681f2b3b3ba1df617ed5e230e3) Fix issue with npm unlink for npm version > 6 (Carl-Erik Kopseng) > 'npm unlink' would implicitly unlink the current dir > until version 7, which requires an argument - [`51417a38`](https://togithub.com/sinonjs/sinon/commit/51417a38111eeeb7cd14338bfb762cc2df487e1b) Fix bundling of cjs module ([#​2412](https://togithub.com/sinonjs/sinon/issues/2412)) (Julian Grinblat) > - Fix bundling of cjs module > > - Run prettier *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2021-11-04.* #### 12.0.0 ### [`v12.0.0`](https://togithub.com/sinonjs/sinon/compare/v11.1.2...v12.0.0) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.1.2...v12.0.0)
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 8e3407558fd..e650295640a 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -57,7 +57,7 @@ "mocha": "^8.2.1", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", - "sinon": "^11.0.0", + "sinon": "^12.0.0", "ts-loader": "^9.0.0", "typescript": "^4.1.2", "webpack": "^5.9.0", From b04ce470125ebd2a95fe02c246c24a350c38c70b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 10 Nov 2021 21:44:21 +0000 Subject: [PATCH 053/103] docs(samples): add example tags to generated samples (#116) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 408439482 Source-Link: https://github.com/googleapis/googleapis/commit/b9f61843dc80c7c285fc34fd3a40aae55082c2b9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb888bc214efc7bf43bf4634b470254565a659a5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9 --- .../linkinator.config.json | 2 +- .../v2/catalog_service.get_default_branch.js | 4 +- .../v2/catalog_service.list_catalogs.js | 14 +- .../v2/catalog_service.set_default_branch.js | 6 +- .../v2/catalog_service.update_catalog.js | 16 +- .../v2/completion_service.complete_query.js | 10 +- ...mpletion_service.import_completion_data.js | 8 +- .../v2/prediction_service.predict.js | 14 +- .../product_service.add_fulfillment_places.js | 24 +- .../v2/product_service.create_product.js | 18 +- .../v2/product_service.delete_product.js | 24 +- .../v2/product_service.get_product.js | 10 +- .../v2/product_service.import_products.js | 22 +- .../v2/product_service.list_products.js | 60 +- ...oduct_service.remove_fulfillment_places.js | 22 +- .../v2/product_service.set_inventory.js | 52 +- .../v2/product_service.update_product.js | 20 +- .../generated/v2/search_service.search.js | 106 +-- .../user_event_service.collect_user_event.js | 4 +- .../user_event_service.import_user_events.js | 8 +- .../user_event_service.purge_user_events.js | 6 +- .../user_event_service.rejoin_user_events.js | 6 +- .../v2/user_event_service.write_user_event.js | 6 +- .../catalog_service.get_default_branch.js | 4 +- .../v2alpha/catalog_service.list_catalogs.js | 14 +- .../catalog_service.set_default_branch.js | 6 +- .../v2alpha/catalog_service.update_catalog.js | 16 +- .../completion_service.complete_query.js | 10 +- ...mpletion_service.import_completion_data.js | 8 +- .../v2alpha/prediction_service.predict.js | 14 +- .../product_service.add_fulfillment_places.js | 24 +- .../product_service.add_local_inventories.js | 20 +- .../v2alpha/product_service.create_product.js | 18 +- .../v2alpha/product_service.delete_product.js | 24 +- .../v2alpha/product_service.get_product.js | 10 +- .../product_service.import_products.js | 22 +- .../v2alpha/product_service.list_products.js | 64 +- ...oduct_service.remove_fulfillment_places.js | 22 +- ...roduct_service.remove_local_inventories.js | 16 +- .../v2alpha/product_service.set_inventory.js | 52 +- .../v2alpha/product_service.update_product.js | 20 +- .../v2alpha/search_service.search.js | 114 +-- .../user_event_service.collect_user_event.js | 4 +- .../user_event_service.import_user_events.js | 8 +- .../user_event_service.purge_user_events.js | 6 +- .../user_event_service.rejoin_user_events.js | 6 +- .../user_event_service.write_user_event.js | 6 +- .../catalog_service.get_default_branch.js | 4 +- .../v2beta/catalog_service.list_catalogs.js | 14 +- .../catalog_service.set_default_branch.js | 6 +- .../v2beta/catalog_service.update_catalog.js | 16 +- .../completion_service.complete_query.js | 10 +- ...mpletion_service.import_completion_data.js | 8 +- .../v2beta/prediction_service.predict.js | 14 +- .../product_service.add_fulfillment_places.js | 24 +- .../v2beta/product_service.create_product.js | 18 +- .../v2beta/product_service.delete_product.js | 24 +- .../v2beta/product_service.get_product.js | 10 +- .../v2beta/product_service.import_products.js | 22 +- .../v2beta/product_service.list_products.js | 60 +- ...oduct_service.remove_fulfillment_places.js | 22 +- .../v2beta/product_service.set_inventory.js | 52 +- .../v2beta/product_service.update_product.js | 20 +- .../generated/v2beta/search_service.search.js | 106 +-- .../user_event_service.collect_user_event.js | 4 +- .../user_event_service.import_user_events.js | 8 +- .../user_event_service.purge_user_events.js | 6 +- .../user_event_service.rejoin_user_events.js | 6 +- .../user_event_service.write_user_event.js | 6 +- .../src/v2/catalog_service_client.ts | 226 +++-- .../src/v2/completion_service_client.ts | 136 ++- .../src/v2/prediction_service_client.ts | 58 +- .../src/v2/product_service_client.ts | 664 +++++++------- .../src/v2/search_service_client.ts | 62 +- .../src/v2/user_event_service_client.ts | 320 ++++--- .../src/v2alpha/catalog_service_client.ts | 244 +++-- .../src/v2alpha/completion_service_client.ts | 144 ++- .../src/v2alpha/prediction_service_client.ts | 58 +- .../src/v2alpha/product_service_client.ts | 850 +++++++++--------- .../src/v2alpha/search_service_client.ts | 62 +- .../src/v2alpha/user_event_service_client.ts | 328 ++++--- .../src/v2beta/catalog_service_client.ts | 244 +++-- .../src/v2beta/completion_service_client.ts | 144 ++- .../src/v2beta/prediction_service_client.ts | 58 +- .../src/v2beta/product_service_client.ts | 682 +++++++------- .../src/v2beta/search_service_client.ts | 62 +- .../src/v2beta/user_event_service_client.ts | 328 ++++--- 87 files changed, 2980 insertions(+), 3120 deletions(-) diff --git a/packages/google-cloud-retail/linkinator.config.json b/packages/google-cloud-retail/linkinator.config.json index 29a223b6db6..0121dfa684f 100644 --- a/packages/google-cloud-retail/linkinator.config.json +++ b/packages/google-cloud-retail/linkinator.config.json @@ -6,5 +6,5 @@ "img.shields.io" ], "silent": true, - "concurrency": 10 + "concurrency": 5 } diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js index 9fe97d816a5..616febdd7fe 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js @@ -31,7 +31,7 @@ function main() { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function getDefaultBranch() { + async function callGetDefaultBranch() { // Construct request const request = {}; @@ -40,7 +40,7 @@ function main() { console.log(response); } - getDefaultBranch(); + callGetDefaultBranch(); // [END retail_v2_generated_CatalogService_GetDefaultBranch_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js index 202bd7181f5..27dbac42322 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js @@ -22,13 +22,13 @@ function main(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 + * Catalog google.cloud.retail.v2.Catalog s under this location, regardless * of whether or not this location exists, a PERMISSION_DENIED error is * returned. */ // const parent = 'abc123' /** - * Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If + * 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. @@ -36,12 +36,12 @@ function main(parent) { // const pageSize = 1234 /** * A page token - * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_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] + * 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] + * CatalogService.ListCatalogs google.cloud.retail.v2.CatalogService.ListCatalogs * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -53,7 +53,7 @@ function main(parent) { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function listCatalogs() { + async function callListCatalogs() { // Construct request const request = { parent, @@ -66,7 +66,7 @@ function main(parent) { } } - listCatalogs(); + callListCatalogs(); // [END retail_v2_generated_CatalogService_ListCatalogs_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js index 0fb5d32dfae..9e25ac849cc 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js @@ -32,7 +32,7 @@ function main() { // const branchId = 'abc123' /** * Some note on this request, this can be retrieved by - * [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch] + * CatalogService.GetDefaultBranch google.cloud.retail.v2.CatalogService.GetDefaultBranch * before next valid default branch set occurs. * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -45,7 +45,7 @@ function main() { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function setDefaultBranch() { + async function callSetDefaultBranch() { // Construct request const request = {}; @@ -54,7 +54,7 @@ function main() { console.log(response); } - setDefaultBranch(); + callSetDefaultBranch(); // [END retail_v2_generated_CatalogService_SetDefaultBranch_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js index 8854bfff33f..dc4acf4c26d 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js @@ -20,21 +20,21 @@ function main(catalog) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. + * 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 + * 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, + * If the Catalog google.cloud.retail.v2.Catalog to update does not exist, * a NOT_FOUND error is returned. */ - // const catalog = '' + // const catalog = {} /** * Indicates which fields in the provided - * [Catalog][google.cloud.retail.v2.Catalog] to update. + * Catalog google.cloud.retail.v2.Catalog to update. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. */ - // const updateMask = '' + // const updateMask = {} // Imports the Retail library const {CatalogServiceClient} = require('@google-cloud/retail').v2; @@ -42,7 +42,7 @@ function main(catalog) { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function updateCatalog() { + async function callUpdateCatalog() { // Construct request const request = { catalog, @@ -53,7 +53,7 @@ function main(catalog) { console.log(response); } - updateCatalog(); + callUpdateCatalog(); // [END retail_v2_generated_CatalogService_UpdateCatalog_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index e57f2d0374c..af3d936e570 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -43,7 +43,7 @@ function main(catalog, query) { * The list of languages of the query. This is * the BCP-47 language code, such as "en-US" or "sr-Latn". * For more information, see - * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * Tags for Identifying Languages (https://tools.ietf.org/html/bcp47). * The maximum number of allowed characters is 255. * Only "en-US" is currently supported. */ @@ -63,7 +63,7 @@ function main(catalog, query) { /** * Determines which dataset to use for fetching completion. "user-data" will * use the imported dataset through - * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. + * CompletionService.ImportCompletionData google.cloud.retail.v2.CompletionService.ImportCompletionData. * "cloud-retail" will use the dataset generated by cloud retail based on user * events. If leave empty, it will use the "user-data". * Current supported values: @@ -75,7 +75,7 @@ function main(catalog, query) { // const dataset = 'abc123' /** * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value [CompletionConfig.max_suggestions][]. + * to the configured value CompletionConfig.max_suggestions . * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. */ @@ -87,7 +87,7 @@ function main(catalog, query) { // Instantiates a client const retailClient = new CompletionServiceClient(); - async function completeQuery() { + async function callCompleteQuery() { // Construct request const request = { catalog, @@ -99,7 +99,7 @@ function main(catalog, query) { console.log(response); } - completeQuery(); + callCompleteQuery(); // [END retail_v2_generated_CompletionService_CompleteQuery_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js index b11a522e5d6..7fbbeac3271 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js @@ -27,12 +27,12 @@ function main(parent, inputConfig) { /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * Pub/Sub topic for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a - * [Operation][google.longrunning.Operation]. + * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. */ // const notificationPubsubTopic = 'abc123' @@ -43,7 +43,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new CompletionServiceClient(); - async function importCompletionData() { + async function callImportCompletionData() { // Construct request const request = { parent, @@ -56,7 +56,7 @@ function main(parent, inputConfig) { console.log(response); } - importCompletionData(); + callImportCompletionData(); // [END retail_v2_generated_CompletionService_ImportCompletionData_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index 958bf3d648d..e6d65ce9168 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -24,8 +24,8 @@ function main(placement, userEvent) { * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} * The ID of the Recommendations AI placement. Before you can request * predictions from your model, you must create at least one placement for it. - * For more information, see [Managing - * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + * For more information, see Managing + * placements (https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). * The full list of available placements can be seen at * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements */ @@ -36,7 +36,7 @@ function main(placement, userEvent) { * won't be ingested to userEvent logs. Thus, a separate userEvent write * request is required for event logging. */ - // const userEvent = '' + // const userEvent = {} /** * Maximum number of results to return per page. Set this property * to the number of prediction results needed. If zero, the service will @@ -117,8 +117,8 @@ function main(placement, userEvent) { * * The key portion of a label must be unique. However, you can use the same * key with multiple resources. * * Keys must start with a lowercase letter or international character. - * See [Google Cloud - * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) * for more details. */ // const labels = 1234 @@ -129,7 +129,7 @@ function main(placement, userEvent) { // Instantiates a client const retailClient = new PredictionServiceClient(); - async function predict() { + async function callPredict() { // Construct request const request = { placement, @@ -141,7 +141,7 @@ function main(placement, userEvent) { console.log(response); } - predict(); + callPredict(); // [END retail_v2_generated_PredictionService_Predict_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js index 099df303b45..980b9b800bc 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -20,11 +20,11 @@ function main(product, type, placeIds) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Full resource name of [Product][google.cloud.retail.v2.Product], + * 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 + * Product google.cloud.retail.v2.Product, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -43,22 +43,22 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to [Product.fulfillment_info.type][]. + * This field directly corresponds to Product.fulfillment_info.type . */ // const type = 'abc123' /** * Required. The IDs for this - * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as + * type google.cloud.retail.v2.AddFulfillmentPlacesRequest.type, such as * the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery" to be added for this - * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate + * type google.cloud.retail.v2.AddFulfillmentPlacesRequest.type. Duplicate * IDs will be automatically ignored. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * If the total number of place IDs exceeds 2000 for this - * [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after + * type google.cloud.retail.v2.AddFulfillmentPlacesRequest.type after * adding, then the update will be rejected. */ // const placeIds = 'abc123' @@ -67,14 +67,14 @@ function main(product, type, placeIds) { * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. */ - // const addTime = '' + // const addTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2.Product] is not + * If set to true, and the Product google.cloud.retail.v2.Product is not * found, the fulfillment information will still be processed and retained for * at most 1 day and processed once the - * [Product][google.cloud.retail.v2.Product] is created. If set to false, a + * Product google.cloud.retail.v2.Product is created. If set to false, a * NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2.Product] is not found. + * Product google.cloud.retail.v2.Product is not found. */ // const allowMissing = true @@ -84,7 +84,7 @@ function main(product, type, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function addFulfillmentPlaces() { + async function callAddFulfillmentPlaces() { // Construct request const request = { product, @@ -98,7 +98,7 @@ function main(product, type, placeIds) { console.log(response); } - addFulfillmentPlaces(); + callAddFulfillmentPlaces(); // [END retail_v2_generated_ProductService_AddFulfillmentPlaces_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js index 028c99d005a..f2cc6a459ba 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js @@ -25,19 +25,19 @@ function main(parent, product, productId) { */ // const parent = 'abc123' /** - * Required. The [Product][google.cloud.retail.v2.Product] to create. + * Required. The Product google.cloud.retail.v2.Product to create. */ - // const product = '' + // const product = {} /** - * Required. The ID to use for the [Product][google.cloud.retail.v2.Product], + * 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]. + * 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 + * 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 + * 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. @@ -50,7 +50,7 @@ function main(parent, product, productId) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function createProduct() { + async function callCreateProduct() { // Construct request const request = { parent, @@ -63,7 +63,7 @@ function main(parent, product, productId) { console.log(response); } - createProduct(); + callCreateProduct(); // [END retail_v2_generated_ProductService_CreateProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js index d685ce6beec..966f6c6a2d3 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js @@ -20,23 +20,23 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Full resource name of [Product][google.cloud.retail.v2.Product], + * 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 + * 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, + * If the Product google.cloud.retail.v2.Product to delete does not exist, * a NOT_FOUND error is returned. - * The [Product][google.cloud.retail.v2.Product] to delete can neither be a - * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2.Product] member nor a - * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2.Product] with more than one - * [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an + * The Product google.cloud.retail.v2.Product to delete can neither be a + * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION + * Product google.cloud.retail.v2.Product member nor a + * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY + * Product google.cloud.retail.v2.Product with more than one + * variants google.cloud.retail.v2.Product.Type.VARIANT. Otherwise, an * INVALID_ARGUMENT error is returned. * All inventory information for the named - * [Product][google.cloud.retail.v2.Product] will be deleted. + * Product google.cloud.retail.v2.Product will be deleted. */ // const name = 'abc123' @@ -46,7 +46,7 @@ function main(name) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function deleteProduct() { + async function callDeleteProduct() { // Construct request const request = { name, @@ -57,7 +57,7 @@ function main(name) { console.log(response); } - deleteProduct(); + callDeleteProduct(); // [END retail_v2_generated_ProductService_DeleteProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js index 11234b7d507..307769685ff 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js @@ -20,13 +20,13 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Full resource name of [Product][google.cloud.retail.v2.Product], + * 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 + * 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, + * If the requested Product google.cloud.retail.v2.Product does not exist, * a NOT_FOUND error is returned. */ // const name = 'abc123' @@ -37,7 +37,7 @@ function main(name) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function getProduct() { + async function callGetProduct() { // Construct request const request = { name, @@ -48,7 +48,7 @@ function main(name) { console.log(response); } - getProduct(); + callGetProduct(); // [END retail_v2_generated_ProductService_GetProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index e950f862cac..b7ad9f6c6ef 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -31,39 +31,39 @@ function main(parent, inputConfig) { * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - * [ImportMetadata][google.cloud.retail.v2.ImportMetadata]. + * ImportMetadata google.cloud.retail.v2.ImportMetadata. * Only supported when - * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const requestId = 'abc123' /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * The desired location of errors incurred during the Import. */ - // const errorsConfig = '' + // const errorsConfig = {} /** * Indicates which fields in the provided imported 'products' to update. If * not set, will by default update all fields. */ - // const updateMask = '' + // const updateMask = {} /** * The mode of reconciliation between existing products and the products to be * imported. Defaults to - * [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + * ReconciliationMode.INCREMENTAL google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL. */ - // const reconciliationMode = '' + // const reconciliationMode = {} /** * Pub/Sub topic for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a - * [Operation][google.longrunning.Operation]. + * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * Only supported when - * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' @@ -74,7 +74,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function importProducts() { + async function callImportProducts() { // Construct request const request = { parent, @@ -87,7 +87,7 @@ function main(parent, inputConfig) { console.log(response); } - importProducts(); + callImportProducts(); // [END retail_v2_generated_ProductService_ImportProducts_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js index f232a2ad292..883653e1921 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js @@ -25,12 +25,12 @@ function main(parent) { * `default_branch` as the branch ID, to list products under the default * branch. * If the caller does not have permission to list - * [Product][google.cloud.retail.v2.Product]s under this branch, regardless of + * Product google.cloud.retail.v2.Product s under this branch, regardless of * whether or not this branch exists, a PERMISSION_DENIED error is returned. */ // const parent = 'abc123' /** - * Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If + * Maximum number of Product google.cloud.retail.v2.Product s to return. If * unspecified, defaults to 100. The maximum allowed value is 1000. Values * above 1000 will be coerced to 1000. * If this field is negative, an INVALID_ARGUMENT error is returned. @@ -38,12 +38,12 @@ function main(parent) { // const pageSize = 1234 /** * A page token - * [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token], + * ListProductsResponse.next_page_token google.cloud.retail.v2.ListProductsResponse.next_page_token, * received from a previous - * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + * ProductService.ListProducts google.cloud.retail.v2.ProductService.ListProducts * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + * ProductService.ListProducts google.cloud.retail.v2.ProductService.ListProducts * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -51,48 +51,48 @@ function main(parent) { /** * A filter to apply on the list results. Supported features: * * List all the products under the parent branch if - * [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset. - * * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2.Product]s sharing the same - * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2.Product]. For example: + * filter google.cloud.retail.v2.ListProductsRequest.filter is unset. + * * List Product.Type.VARIANT google.cloud.retail.v2.Product.Type.VARIANT + * Product google.cloud.retail.v2.Product s sharing the same + * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY + * Product google.cloud.retail.v2.Product. For example: * `primary_product_id = "some_product_id"` - * * List [Product][google.cloud.retail.v2.Product]s bundled in a - * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2.Product]. + * * List Product google.cloud.retail.v2.Product s bundled in a + * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION + * Product google.cloud.retail.v2.Product. * For example: * `collection_product_id = "some_product_id"` - * * List [Product][google.cloud.retail.v2.Product]s with a partibular type. + * * List Product google.cloud.retail.v2.Product s with a partibular type. * For example: * `type = "PRIMARY"` * `type = "VARIANT"` * `type = "COLLECTION"` * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. * If the specified - * [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2.Product] or - * [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error + * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY + * Product google.cloud.retail.v2.Product or + * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION + * Product google.cloud.retail.v2.Product does not exist, a NOT_FOUND error * is returned. */ // const filter = 'abc123' /** - * The fields of [Product][google.cloud.retail.v2.Product] to return in the + * The fields of Product google.cloud.retail.v2.Product to return in the * responses. If not set or empty, the following fields are returned: - * * [Product.name][google.cloud.retail.v2.Product.name] - * * [Product.id][google.cloud.retail.v2.Product.id] - * * [Product.title][google.cloud.retail.v2.Product.title] - * * [Product.uri][google.cloud.retail.v2.Product.uri] - * * [Product.images][google.cloud.retail.v2.Product.images] - * * [Product.price_info][google.cloud.retail.v2.Product.price_info] - * * [Product.brands][google.cloud.retail.v2.Product.brands] + * * Product.name google.cloud.retail.v2.Product.name + * * Product.id google.cloud.retail.v2.Product.id + * * Product.title google.cloud.retail.v2.Product.title + * * Product.uri google.cloud.retail.v2.Product.uri + * * Product.images google.cloud.retail.v2.Product.images + * * Product.price_info google.cloud.retail.v2.Product.price_info + * * Product.brands google.cloud.retail.v2.Product.brands * If "*" is provided, all fields are returned. - * [Product.name][google.cloud.retail.v2.Product.name] is always returned no + * Product.name google.cloud.retail.v2.Product.name is always returned no * matter what mask is set. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. */ - // const readMask = '' + // const readMask = {} // Imports the Retail library const {ProductServiceClient} = require('@google-cloud/retail').v2; @@ -100,7 +100,7 @@ function main(parent) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function listProducts() { + async function callListProducts() { // Construct request const request = { parent, @@ -113,7 +113,7 @@ function main(parent) { } } - listProducts(); + callListProducts(); // [END retail_v2_generated_ProductService_ListProducts_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js index 22db6417908..7c6456a7d1e 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -20,11 +20,11 @@ function main(product, type, placeIds) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Full resource name of [Product][google.cloud.retail.v2.Product], + * 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 + * Product google.cloud.retail.v2.Product, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -43,15 +43,15 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to [Product.fulfillment_info.type][]. + * This field directly corresponds to Product.fulfillment_info.type . */ // const type = 'abc123' /** * Required. The IDs for this - * [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as + * type google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type, such as * the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery", to be removed for this - * [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]. + * type google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an @@ -63,14 +63,14 @@ function main(product, type, placeIds) { * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. */ - // const removeTime = '' + // const removeTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2.Product] is not + * If set to true, and the Product google.cloud.retail.v2.Product is not * found, the fulfillment information will still be processed and retained for * at most 1 day and processed once the - * [Product][google.cloud.retail.v2.Product] is created. If set to false, a + * Product google.cloud.retail.v2.Product is created. If set to false, a * NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2.Product] is not found. + * Product google.cloud.retail.v2.Product is not found. */ // const allowMissing = true @@ -80,7 +80,7 @@ function main(product, type, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function removeFulfillmentPlaces() { + async function callRemoveFulfillmentPlaces() { // Construct request const request = { product, @@ -94,7 +94,7 @@ function main(product, type, placeIds) { console.log(response); } - removeFulfillmentPlaces(); + callRemoveFulfillmentPlaces(); // [END retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js index a95bd8a5037..195aac173e5 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -22,56 +22,56 @@ function main(inventory) { /** * Required. The inventory information to update. The allowable fields to * update are: - * * [Product.price_info][google.cloud.retail.v2.Product.price_info] - * * [Product.availability][google.cloud.retail.v2.Product.availability] - * * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] - * * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] + * * Product.price_info google.cloud.retail.v2.Product.price_info + * * Product.availability google.cloud.retail.v2.Product.availability + * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * The updated inventory fields must be specified in - * [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]. - * If [SetInventoryRequest.inventory.name][] is empty or invalid, an + * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask. + * If SetInventoryRequest.inventory.name is empty or invalid, an * INVALID_ARGUMENT error is returned. * If the caller does not have permission to update the - * [Product][google.cloud.retail.v2.Product] named in - * [Product.name][google.cloud.retail.v2.Product.name], regardless of whether + * Product google.cloud.retail.v2.Product named in + * Product.name google.cloud.retail.v2.Product.name, 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 have + * If the Product google.cloud.retail.v2.Product to update does not have * existing inventory information, the provided inventory information will be * inserted. - * If the [Product][google.cloud.retail.v2.Product] to update has existing + * If the Product google.cloud.retail.v2.Product to update has existing * inventory information, the provided inventory information will be merged * while respecting the last update time for each inventory field, using the * provided or default value for - * [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time]. + * SetInventoryRequest.set_time google.cloud.retail.v2.SetInventoryRequest.set_time. * The last update time is recorded for the following inventory fields: - * * [Product.price_info][google.cloud.retail.v2.Product.price_info] - * * [Product.availability][google.cloud.retail.v2.Product.availability] - * * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] - * * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] + * * Product.price_info google.cloud.retail.v2.Product.price_info + * * Product.availability google.cloud.retail.v2.Product.availability + * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is - * needed, [UpdateProduct][] should be invoked instead. + * needed, UpdateProduct should be invoked instead. */ - // const inventory = '' + // const inventory = {} /** * Indicates which inventory fields in the provided - * [Product][google.cloud.retail.v2.Product] to update. If not set or set with + * Product google.cloud.retail.v2.Product to update. If not set or set with * empty paths, all inventory fields will be updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ - // const setMask = '' + // const setMask = {} /** * The time when the request is issued, used to prevent * out-of-order updates on inventory fields with the last update time * recorded. If not provided, the internal system time will be used. */ - // const setTime = '' + // const setTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2.Product] with name - * [Product.name][google.cloud.retail.v2.Product.name] is not found, the + * If set to true, and the Product google.cloud.retail.v2.Product with name + * Product.name google.cloud.retail.v2.Product.name is not found, the * inventory update will still be processed and retained for at most 1 day - * until the [Product][google.cloud.retail.v2.Product] is created. If set to + * until the Product google.cloud.retail.v2.Product is created. If set to * false, a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2.Product] is not found. + * Product google.cloud.retail.v2.Product is not found. */ // const allowMissing = true @@ -81,7 +81,7 @@ function main(inventory) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function setInventory() { + async function callSetInventory() { // Construct request const request = { inventory, @@ -93,7 +93,7 @@ function main(inventory) { console.log(response); } - setInventory(); + callSetInventory(); // [END retail_v2_generated_ProductService_SetInventory_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js index c33232196c5..77f45bc400f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js @@ -22,26 +22,26 @@ function main(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 + * 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 + * If the Product google.cloud.retail.v2.Product to update does not exist * and - * [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing] + * allow_missing google.cloud.retail.v2.UpdateProductRequest.allow_missing * is not set, a NOT_FOUND error is returned. */ - // const product = '' + // const product = {} /** * Indicates which fields in the provided - * [Product][google.cloud.retail.v2.Product] to update. The immutable and + * 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. */ - // const updateMask = '' + // const updateMask = {} /** - * If set to true, and the [Product][google.cloud.retail.v2.Product] is not - * found, a new [Product][google.cloud.retail.v2.Product] will be created. In + * If set to true, and the Product google.cloud.retail.v2.Product is not + * found, a new Product google.cloud.retail.v2.Product will be created. In * this situation, `update_mask` is ignored. */ // const allowMissing = true @@ -52,7 +52,7 @@ function main(product) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function updateProduct() { + async function callUpdateProduct() { // Construct request const request = { product, @@ -63,7 +63,7 @@ function main(product) { console.log(response); } - updateProduct(); + callUpdateProduct(); // [END retail_v2_generated_ProductService_UpdateProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 2d2c3c46678..76057c922d0 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -49,9 +49,9 @@ function main(placement, visitorId) { /** * User information. */ - // const userInfo = '' + // const userInfo = {} /** - * Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If + * Maximum number of Product google.cloud.retail.v2.Product s to return. If * unspecified, defaults to a reasonable value. The maximum allowed value is * 120. Values above 120 will be coerced to 120. * If this field is negative, an INVALID_ARGUMENT is returned. @@ -59,21 +59,21 @@ function main(placement, visitorId) { // const pageSize = 1234 /** * A page token - * [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token], + * SearchResponse.next_page_token google.cloud.retail.v2.SearchResponse.next_page_token, * received from a previous - * [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call. + * SearchService.Search google.cloud.retail.v2.SearchService.Search call. * Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must + * SearchService.Search google.cloud.retail.v2.SearchService.Search must * match the call that provided the page token. Otherwise, an INVALID_ARGUMENT * error is returned. */ // const pageToken = 'abc123' /** * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the [Product][google.cloud.retail.v2.Product]s + * result location, amongst the Product google.cloud.retail.v2.Product s * deemed by the API as relevant) in search results. This field is only - * considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token] + * considered if page_token google.cloud.retail.v2.SearchRequest.page_token * is unset. * If this field is negative, an INVALID_ARGUMENT is returned. */ @@ -81,8 +81,8 @@ function main(placement, visitorId) { /** * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). + * expression is case-sensitive. See more details at this user + * guide (https://cloud.google.com/retail/docs/filter-and-order#filter). * If this field is unrecognizable, an INVALID_ARGUMENT is returned. */ // const filter = 'abc123' @@ -90,19 +90,19 @@ function main(placement, visitorId) { * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with - * [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter] + * SearchRequest.canonical_filter google.cloud.retail.v2.SearchRequest.canonical_filter * will be returned as a supplement of the original query. This field is * strongly recommended to achieve high search quality. - * See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + * See SearchRequest.filter google.cloud.retail.v2.SearchRequest.filter for * more details about filter syntax. */ // const canonicalFilter = 'abc123' /** * The order in which products are returned. Products can be ordered by - * a field in an [Product][google.cloud.retail.v2.Product] object. Leave it + * a field in an Product google.cloud.retail.v2.Product object. Leave it * unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](https://cloud.google.com/retail/docs/filter-and-order#order). + * more details at this user + * guide (https://cloud.google.com/retail/docs/filter-and-order#order). * If this field is unrecognizable, an INVALID_ARGUMENT is returned. */ // const orderBy = 'abc123' @@ -118,33 +118,33 @@ function main(placement, visitorId) { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. */ - // const dynamicFacetSpec = '' + // const dynamicFacetSpec = {} /** * Boost specification to boost certain products. See more details at this - * [user guide](https://cloud.google.com/retail/docs/boosting). - * Notice that if both [ServingConfig.boost_control_ids][] and - * [SearchRequest.boost_spec] are set, the boost conditions from both places + * user guide (https://cloud.google.com/retail/docs/boosting). + * Notice that if both ServingConfig.boost_control_ids and + * SearchRequest.boost_spec are set, the boost conditions from both places * are evaluated. If a search request matches multiple boost conditions, * the final boost score is equal to the sum of the boost scores from all * matched boost conditions. */ - // const boostSpec = '' + // const boostSpec = {} /** * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). + * query expansion will occur. See more details at this user + * guide (https://cloud.google.com/retail/docs/result-size#query_expansion). */ - // const queryExpansionSpec = '' + // const queryExpansionSpec = {} /** * The keys to fetch and rollup the matching - * [variant][google.cloud.retail.v2.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2.Product]s attributes. The attributes from - * all the matching [variant][google.cloud.retail.v2.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2.Product]s are merged and de-duplicated. - * Notice that rollup [variant][google.cloud.retail.v2.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2.Product]s attributes will lead to extra + * variant google.cloud.retail.v2.Product.Type.VARIANT + * Product google.cloud.retail.v2.Product s attributes. The attributes from + * all the matching variant google.cloud.retail.v2.Product.Type.VARIANT + * Product google.cloud.retail.v2.Product s are merged and de-duplicated. + * Notice that rollup variant google.cloud.retail.v2.Product.Type.VARIANT + * Product google.cloud.retail.v2.Product s attributes will lead to extra * query latency. Maximum number of keys is 10. - * For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a + * For FulfillmentInfo google.cloud.retail.v2.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. @@ -155,42 +155,42 @@ function main(placement, visitorId) { * * discount * * inventory(place_id,price) * * attributes.key, where key is any key in the - * [Product.attributes][google.cloud.retail.v2.Product.attributes] map. + * Product.attributes google.cloud.retail.v2.Product.attributes map. * * pickupInStore.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "pickup-in-store". * * shipToStore.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "ship-to-store". * * sameDayDelivery.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "same-day-delivery". * * nextDayDelivery.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "next-day-delivery". * * customFulfillment1.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-1". * * customFulfillment2.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-2". * * customFulfillment3.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-3". * * customFulfillment4.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-4". * * customFulfillment5.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-5". * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -200,20 +200,20 @@ function main(placement, visitorId) { * The categories associated with a category page. Required for category * navigation queries to achieve good search quality. The format should be * the same as - * [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories]; + * UserEvent.page_categories google.cloud.retail.v2.UserEvent.page_categories; * 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"]. + * "pageCategories" : "Sales > 2017 Black Friday Deals". */ // const pageCategories = 'abc123' /** * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. */ - // const searchMode = '' + // const searchMode = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2; @@ -221,7 +221,7 @@ function main(placement, visitorId) { // Instantiates a client const retailClient = new SearchServiceClient(); - async function search() { + async function callSearch() { // Construct request const request = { placement, @@ -235,7 +235,7 @@ function main(placement, visitorId) { } } - search(); + callSearch(); // [END retail_v2_generated_SearchService_Search_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js index a0bb51b5744..50c7eb99818 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js @@ -49,7 +49,7 @@ function main(parent, userEvent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function collectUserEvent() { + async function callCollectUserEvent() { // Construct request const request = { parent, @@ -61,7 +61,7 @@ function main(parent, userEvent) { console.log(response); } - collectUserEvent(); + callCollectUserEvent(); // [END retail_v2_generated_UserEventService_CollectUserEvent_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js index 1c8ebdd5030..5231d461f59 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js @@ -26,12 +26,12 @@ function main(parent, inputConfig) { /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * The desired location of errors incurred during the Import. Cannot be set * for inline user event imports. */ - // const errorsConfig = '' + // const errorsConfig = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2; @@ -39,7 +39,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function importUserEvents() { + async function callImportUserEvents() { // Construct request const request = { parent, @@ -52,7 +52,7 @@ function main(parent, inputConfig) { console.log(response); } - importUserEvents(); + callImportUserEvents(); // [END retail_v2_generated_UserEventService_ImportUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js index 88eadd9b912..16ee8277860 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js @@ -30,7 +30,7 @@ function main(parent, filter) { * 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. + * 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. @@ -60,7 +60,7 @@ function main(parent, filter) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function purgeUserEvents() { + async function callPurgeUserEvents() { // Construct request const request = { parent, @@ -73,7 +73,7 @@ function main(parent, filter) { console.log(response); } - purgeUserEvents(); + callPurgeUserEvents(); // [END retail_v2_generated_UserEventService_PurgeUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js index 9deba00979e..5db922eebeb 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js @@ -30,7 +30,7 @@ function main(parent) { * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an * invalid integer value. */ - // const userEventRejoinScope = '' + // const userEventRejoinScope = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2; @@ -38,7 +38,7 @@ function main(parent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function rejoinUserEvents() { + async function callRejoinUserEvents() { // Construct request const request = { parent, @@ -50,7 +50,7 @@ function main(parent) { console.log(response); } - rejoinUserEvents(); + callRejoinUserEvents(); // [END retail_v2_generated_UserEventService_RejoinUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js index ab2e40b76a6..a7b975cbaca 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js @@ -27,7 +27,7 @@ function main(parent, userEvent) { /** * Required. User event to write. */ - // const userEvent = '' + // const userEvent = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2; @@ -35,7 +35,7 @@ function main(parent, userEvent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function writeUserEvent() { + async function callWriteUserEvent() { // Construct request const request = { parent, @@ -47,7 +47,7 @@ function main(parent, userEvent) { console.log(response); } - writeUserEvent(); + callWriteUserEvent(); // [END retail_v2_generated_UserEventService_WriteUserEvent_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js index 99a60b93cfd..9021acdc304 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js @@ -31,7 +31,7 @@ function main() { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function getDefaultBranch() { + async function callGetDefaultBranch() { // Construct request const request = {}; @@ -40,7 +40,7 @@ function main() { console.log(response); } - getDefaultBranch(); + callGetDefaultBranch(); // [END retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js index 22d71c2a9c7..9d856ca78de 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js @@ -22,13 +22,13 @@ function main(parent) { /** * Required. The account resource name with an associated location. * If the caller does not have permission to list - * [Catalog][google.cloud.retail.v2alpha.Catalog]s under this location, + * Catalog google.cloud.retail.v2alpha.Catalog s under this location, * regardless of whether or not this location exists, a PERMISSION_DENIED * error is returned. */ // const parent = 'abc123' /** - * Maximum number of [Catalog][google.cloud.retail.v2alpha.Catalog]s to + * Maximum number of Catalog google.cloud.retail.v2alpha.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. @@ -36,12 +36,12 @@ function main(parent) { // const pageSize = 1234 /** * A page token - * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token], + * ListCatalogsResponse.next_page_token google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token, * received from a previous - * [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] + * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] + * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -53,7 +53,7 @@ function main(parent) { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function listCatalogs() { + async function callListCatalogs() { // Construct request const request = { parent, @@ -66,7 +66,7 @@ function main(parent) { } } - listCatalogs(); + callListCatalogs(); // [END retail_v2alpha_generated_CatalogService_ListCatalogs_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js index 048d8633fd0..391e65e0ef8 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js @@ -32,7 +32,7 @@ function main() { // const branchId = 'abc123' /** * Some note on this request, this can be retrieved by - * [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch] + * CatalogService.GetDefaultBranch google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch * before next valid default branch set occurs. * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -45,7 +45,7 @@ function main() { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function setDefaultBranch() { + async function callSetDefaultBranch() { // Construct request const request = {}; @@ -54,7 +54,7 @@ function main() { console.log(response); } - setDefaultBranch(); + callSetDefaultBranch(); // [END retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js index f947d928485..a77df06cc26 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js @@ -20,21 +20,21 @@ function main(catalog) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The [Catalog][google.cloud.retail.v2alpha.Catalog] to update. + * Required. The Catalog google.cloud.retail.v2alpha.Catalog to update. * If the caller does not have permission to update the - * [Catalog][google.cloud.retail.v2alpha.Catalog], regardless of whether or + * Catalog google.cloud.retail.v2alpha.Catalog, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. - * If the [Catalog][google.cloud.retail.v2alpha.Catalog] to update does not + * If the Catalog google.cloud.retail.v2alpha.Catalog to update does not * exist, a NOT_FOUND error is returned. */ - // const catalog = '' + // const catalog = {} /** * Indicates which fields in the provided - * [Catalog][google.cloud.retail.v2alpha.Catalog] to update. + * Catalog google.cloud.retail.v2alpha.Catalog to update. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. */ - // const updateMask = '' + // const updateMask = {} // Imports the Retail library const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; @@ -42,7 +42,7 @@ function main(catalog) { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function updateCatalog() { + async function callUpdateCatalog() { // Construct request const request = { catalog, @@ -53,7 +53,7 @@ function main(catalog) { console.log(response); } - updateCatalog(); + callUpdateCatalog(); // [END retail_v2alpha_generated_CatalogService_UpdateCatalog_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index 9fdbf04b281..c74af7fcebd 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -43,7 +43,7 @@ function main(catalog, query) { * The list of languages of the query. This is * the BCP-47 language code, such as "en-US" or "sr-Latn". * For more information, see - * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * Tags for Identifying Languages (https://tools.ietf.org/html/bcp47). * The maximum number of allowed characters is 255. * Only "en-US" is currently supported. */ @@ -63,7 +63,7 @@ function main(catalog, query) { /** * Determines which dataset to use for fetching completion. "user-data" will * use the imported dataset through - * [CompletionService.ImportCompletionData][google.cloud.retail.v2alpha.CompletionService.ImportCompletionData]. + * CompletionService.ImportCompletionData google.cloud.retail.v2alpha.CompletionService.ImportCompletionData. * "cloud-retail" will use the dataset generated by cloud retail based on user * events. If leave empty, it will use the "user-data". * Current supported values: @@ -76,7 +76,7 @@ function main(catalog, query) { /** * Completion max suggestions. If left unset or set to 0, then will fallback * to the configured value - * [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions]. + * CompletionConfig.max_suggestions google.cloud.retail.v2alpha.CompletionConfig.max_suggestions. * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. */ @@ -88,7 +88,7 @@ function main(catalog, query) { // Instantiates a client const retailClient = new CompletionServiceClient(); - async function completeQuery() { + async function callCompleteQuery() { // Construct request const request = { catalog, @@ -100,7 +100,7 @@ function main(catalog, query) { console.log(response); } - completeQuery(); + callCompleteQuery(); // [END retail_v2alpha_generated_CompletionService_CompleteQuery_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js index b4a8ad05490..d681cc9e989 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js @@ -27,12 +27,12 @@ function main(parent, inputConfig) { /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * Pub/Sub topic for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a - * [Operation][google.longrunning.Operation]. + * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. */ // const notificationPubsubTopic = 'abc123' @@ -43,7 +43,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new CompletionServiceClient(); - async function importCompletionData() { + async function callImportCompletionData() { // Construct request const request = { parent, @@ -56,7 +56,7 @@ function main(parent, inputConfig) { console.log(response); } - importCompletionData(); + callImportCompletionData(); // [END retail_v2alpha_generated_CompletionService_ImportCompletionData_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js index 43d369b4ff3..7f5cccba9e0 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -24,8 +24,8 @@ function main(placement, userEvent) { * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} * The ID of the Recommendations AI placement. Before you can request * predictions from your model, you must create at least one placement for it. - * For more information, see [Managing - * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + * For more information, see Managing + * placements (https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). * The full list of available placements can be seen at * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements */ @@ -36,7 +36,7 @@ function main(placement, userEvent) { * won't be ingested to userEvent logs. Thus, a separate userEvent write * request is required for event logging. */ - // const userEvent = '' + // const userEvent = {} /** * Maximum number of results to return per page. Set this property * to the number of prediction results needed. If zero, the service will @@ -117,8 +117,8 @@ function main(placement, userEvent) { * * The key portion of a label must be unique. However, you can use the same * key with multiple resources. * * Keys must start with a lowercase letter or international character. - * See [Google Cloud - * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) * for more details. */ // const labels = 1234 @@ -129,7 +129,7 @@ function main(placement, userEvent) { // Instantiates a client const retailClient = new PredictionServiceClient(); - async function predict() { + async function callPredict() { // Construct request const request = { placement, @@ -141,7 +141,7 @@ function main(placement, userEvent) { console.log(response); } - predict(); + callPredict(); // [END retail_v2alpha_generated_PredictionService_Predict_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js index 8fbf919b768..fdb7d59aaeb 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -21,10 +21,10 @@ function main(product, type, placeIds) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2alpha.Product], such as + * Product google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -43,22 +43,22 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to [Product.fulfillment_info.type][]. + * This field directly corresponds to Product.fulfillment_info.type . */ // const type = 'abc123' /** * Required. The IDs for this - * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type], such + * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type, such * as the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery" to be added for this - * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type]. + * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type. * Duplicate IDs will be automatically ignored. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * If the total number of place IDs exceeds 2000 for this - * [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type] after + * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type after * adding, then the update will be rejected. */ // const placeIds = 'abc123' @@ -67,14 +67,14 @@ function main(product, type, placeIds) { * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. */ - // const addTime = '' + // const addTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * If set to true, and the Product google.cloud.retail.v2alpha.Product is * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the - * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * Product google.cloud.retail.v2alpha.Product is created. If set to false, * a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2alpha.Product] is not found. + * Product google.cloud.retail.v2alpha.Product is not found. */ // const allowMissing = true @@ -84,7 +84,7 @@ function main(product, type, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function addFulfillmentPlaces() { + async function callAddFulfillmentPlaces() { // Construct request const request = { product, @@ -98,7 +98,7 @@ function main(product, type, placeIds) { console.log(response); } - addFulfillmentPlaces(); + callAddFulfillmentPlaces(); // [END retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js index efb10e417fe..97c63276279 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -21,10 +21,10 @@ function main(product, localInventories) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2alpha.Product], such as + * Product google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -36,7 +36,7 @@ function main(product, localInventories) { // const localInventories = 1234 /** * Indicates which inventory fields in the provided list of - * [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The + * LocalInventory google.cloud.retail.v2alpha.LocalInventory to update. The * field is updated to the provided value. * If a field is set while the place does not have a previous local inventory, * the local inventory at that store is created. @@ -47,20 +47,20 @@ function main(product, localInventories) { * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ - // const addMask = '' + // const addMask = {} /** * The time when the inventory updates are issued. Used to prevent * out-of-order updates on local inventory fields. If not provided, the * internal system time will be used. */ - // const addTime = '' + // const addTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * If set to true, and the Product google.cloud.retail.v2alpha.Product is * not found, the local inventory will still be processed and retained for at * most 1 day and processed once the - * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * Product google.cloud.retail.v2alpha.Product is created. If set to false, * an INVALID_ARGUMENT error is returned if the - * [Product][google.cloud.retail.v2alpha.Product] is not found. + * Product google.cloud.retail.v2alpha.Product is not found. */ // const allowMissing = true @@ -70,7 +70,7 @@ function main(product, localInventories) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function addLocalInventories() { + async function callAddLocalInventories() { // Construct request const request = { product, @@ -83,7 +83,7 @@ function main(product, localInventories) { console.log(response); } - addLocalInventories(); + callAddLocalInventories(); // [END retail_v2alpha_generated_ProductService_AddLocalInventories_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js index e9be2372ad5..540bbfa7be9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js @@ -25,19 +25,19 @@ function main(parent, product, productId) { */ // const parent = 'abc123' /** - * Required. The [Product][google.cloud.retail.v2alpha.Product] to create. + * Required. The Product google.cloud.retail.v2alpha.Product to create. */ - // const product = '' + // const product = {} /** * Required. The ID to use for the - * [Product][google.cloud.retail.v2alpha.Product], which will become the final - * component of the [Product.name][google.cloud.retail.v2alpha.Product.name]. + * Product google.cloud.retail.v2alpha.Product, which will become the final + * component of the Product.name google.cloud.retail.v2alpha.Product.name. * If the caller does not have permission to create the - * [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.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.v2alpha.Product]s with the same - * [parent][google.cloud.retail.v2alpha.CreateProductRequest.parent]. + * Product google.cloud.retail.v2alpha.Product s with the same + * parent google.cloud.retail.v2alpha.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. @@ -50,7 +50,7 @@ function main(parent, product, productId) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function createProduct() { + async function callCreateProduct() { // Construct request const request = { parent, @@ -63,7 +63,7 @@ function main(parent, product, productId) { console.log(response); } - createProduct(); + callCreateProduct(); // [END retail_v2alpha_generated_ProductService_CreateProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js index 1e7d7af8e95..a68cc635bd6 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js @@ -21,23 +21,23 @@ function main(name) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2alpha.Product], such as + * Product google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. - * If the [Product][google.cloud.retail.v2alpha.Product] to delete does not + * If the Product google.cloud.retail.v2alpha.Product to delete does not * exist, a NOT_FOUND error is returned. - * The [Product][google.cloud.retail.v2alpha.Product] to delete can neither be + * The Product google.cloud.retail.v2alpha.Product to delete can neither be * a - * [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2alpha.Product] member nor a - * [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2alpha.Product] with more than one - * [variants][google.cloud.retail.v2alpha.Product.Type.VARIANT]. Otherwise, an + * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION + * Product google.cloud.retail.v2alpha.Product member nor a + * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY + * Product google.cloud.retail.v2alpha.Product with more than one + * variants google.cloud.retail.v2alpha.Product.Type.VARIANT. Otherwise, an * INVALID_ARGUMENT error is returned. * All inventory information for the named - * [Product][google.cloud.retail.v2alpha.Product] will be deleted. + * Product google.cloud.retail.v2alpha.Product will be deleted. */ // const name = 'abc123' @@ -47,7 +47,7 @@ function main(name) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function deleteProduct() { + async function callDeleteProduct() { // Construct request const request = { name, @@ -58,7 +58,7 @@ function main(name) { console.log(response); } - deleteProduct(); + callDeleteProduct(); // [END retail_v2alpha_generated_ProductService_DeleteProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js index bbd194262c0..d37ebf466da 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js @@ -21,12 +21,12 @@ function main(name) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2alpha.Product], such as + * Product google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. - * If the requested [Product][google.cloud.retail.v2alpha.Product] does not + * If the requested Product google.cloud.retail.v2alpha.Product does not * exist, a NOT_FOUND error is returned. */ // const name = 'abc123' @@ -37,7 +37,7 @@ function main(name) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function getProduct() { + async function callGetProduct() { // Construct request const request = { name, @@ -48,7 +48,7 @@ function main(name) { console.log(response); } - getProduct(); + callGetProduct(); // [END retail_v2alpha_generated_ProductService_GetProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index ca380013932..7b28b9288e9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -31,39 +31,39 @@ function main(parent, inputConfig) { * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - * [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata]. + * ImportMetadata google.cloud.retail.v2alpha.ImportMetadata. * Only supported when - * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const requestId = 'abc123' /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * The desired location of errors incurred during the Import. */ - // const errorsConfig = '' + // const errorsConfig = {} /** * Indicates which fields in the provided imported 'products' to update. If * not set, will by default update all fields. */ - // const updateMask = '' + // const updateMask = {} /** * The mode of reconciliation between existing products and the products to be * imported. Defaults to - * [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + * ReconciliationMode.INCREMENTAL google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL. */ - // const reconciliationMode = '' + // const reconciliationMode = {} /** * Pub/Sub topic for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a - * [Operation][google.longrunning.Operation]. + * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * Only supported when - * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' @@ -74,7 +74,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function importProducts() { + async function callImportProducts() { // Construct request const request = { parent, @@ -87,7 +87,7 @@ function main(parent, inputConfig) { console.log(response); } - importProducts(); + callImportProducts(); // [END retail_v2alpha_generated_ProductService_ImportProducts_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js index 594bb847be6..ecda1d1cea4 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js @@ -25,13 +25,13 @@ function main(parent) { * `default_branch` as the branch ID, to list products under the default * branch. * If the caller does not have permission to list - * [Product][google.cloud.retail.v2alpha.Product]s under this branch, + * Product google.cloud.retail.v2alpha.Product s under this branch, * regardless of whether or not this branch exists, a PERMISSION_DENIED error * is returned. */ // const parent = 'abc123' /** - * Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to + * Maximum number of Product google.cloud.retail.v2alpha.Product s to * return. If unspecified, defaults to 100. The maximum allowed value is 1000. * Values above 1000 will be coerced to 1000. * If this field is negative, an INVALID_ARGUMENT error is returned. @@ -39,12 +39,12 @@ function main(parent) { // const pageSize = 1234 /** * A page token - * [ListProductsResponse.next_page_token][google.cloud.retail.v2alpha.ListProductsResponse.next_page_token], + * ListProductsResponse.next_page_token google.cloud.retail.v2alpha.ListProductsResponse.next_page_token, * received from a previous - * [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] + * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -52,54 +52,54 @@ function main(parent) { /** * A filter to apply on the list results. Supported features: * * List all the products under the parent branch if - * [filter][google.cloud.retail.v2alpha.ListProductsRequest.filter] is unset. + * filter google.cloud.retail.v2alpha.ListProductsRequest.filter is unset. * * List - * [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2alpha.Product]s sharing the same - * [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2alpha.Product]. For example: + * Product.Type.VARIANT google.cloud.retail.v2alpha.Product.Type.VARIANT + * Product google.cloud.retail.v2alpha.Product s sharing the same + * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY + * Product google.cloud.retail.v2alpha.Product. For example: * `primary_product_id = "some_product_id"` - * * List [Product][google.cloud.retail.v2alpha.Product]s bundled in a - * [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2alpha.Product]. + * * List Product google.cloud.retail.v2alpha.Product s bundled in a + * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION + * Product google.cloud.retail.v2alpha.Product. * For example: * `collection_product_id = "some_product_id"` - * * List [Product][google.cloud.retail.v2alpha.Product]s with a partibular + * * List Product google.cloud.retail.v2alpha.Product s with a partibular * type. For example: * `type = "PRIMARY"` * `type = "VARIANT"` * `type = "COLLECTION"` * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. * If the specified - * [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2alpha.Product] or - * [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2alpha.Product] does not exist, a NOT_FOUND + * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY + * Product google.cloud.retail.v2alpha.Product or + * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION + * Product google.cloud.retail.v2alpha.Product does not exist, a NOT_FOUND * error is returned. */ // const filter = 'abc123' /** - * The fields of [Product][google.cloud.retail.v2alpha.Product] to return in + * The fields of Product google.cloud.retail.v2alpha.Product to return in * the responses. If not set or empty, the following fields are returned: - * * [Product.name][google.cloud.retail.v2alpha.Product.name] - * * [Product.id][google.cloud.retail.v2alpha.Product.id] - * * [Product.title][google.cloud.retail.v2alpha.Product.title] - * * [Product.uri][google.cloud.retail.v2alpha.Product.uri] - * * [Product.images][google.cloud.retail.v2alpha.Product.images] - * * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - * * [Product.brands][google.cloud.retail.v2alpha.Product.brands] + * * Product.name google.cloud.retail.v2alpha.Product.name + * * Product.id google.cloud.retail.v2alpha.Product.id + * * Product.title google.cloud.retail.v2alpha.Product.title + * * Product.uri google.cloud.retail.v2alpha.Product.uri + * * Product.images google.cloud.retail.v2alpha.Product.images + * * Product.price_info google.cloud.retail.v2alpha.Product.price_info + * * Product.brands google.cloud.retail.v2alpha.Product.brands * If "*" is provided, all fields are returned. - * [Product.name][google.cloud.retail.v2alpha.Product.name] is always returned + * Product.name google.cloud.retail.v2alpha.Product.name is always returned * no matter what mask is set. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. */ - // const readMask = '' + // const readMask = {} /** * If true and - * [page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] is + * page_token google.cloud.retail.v2alpha.ListProductsRequest.page_token is * empty, - * [ListProductsResponse.total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] + * ListProductsResponse.total_size google.cloud.retail.v2alpha.ListProductsResponse.total_size * is set to the total count of matched items irrespective of pagination. * Notice that setting this field to true affects the performance. */ @@ -111,7 +111,7 @@ function main(parent) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function listProducts() { + async function callListProducts() { // Construct request const request = { parent, @@ -124,7 +124,7 @@ function main(parent) { } } - listProducts(); + callListProducts(); // [END retail_v2alpha_generated_ProductService_ListProducts_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js index a69eb6fcfe9..6360a86186c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -21,10 +21,10 @@ function main(product, type, placeIds) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2alpha.Product], such as + * Product google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -43,15 +43,15 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to [Product.fulfillment_info.type][]. + * This field directly corresponds to Product.fulfillment_info.type . */ // const type = 'abc123' /** * Required. The IDs for this - * [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type], + * type google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type, * such as the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery", to be removed for this - * [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type]. + * type google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an @@ -63,14 +63,14 @@ function main(product, type, placeIds) { * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. */ - // const removeTime = '' + // const removeTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * If set to true, and the Product google.cloud.retail.v2alpha.Product is * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the - * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * Product google.cloud.retail.v2alpha.Product is created. If set to false, * a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2alpha.Product] is not found. + * Product google.cloud.retail.v2alpha.Product is not found. */ // const allowMissing = true @@ -80,7 +80,7 @@ function main(product, type, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function removeFulfillmentPlaces() { + async function callRemoveFulfillmentPlaces() { // Construct request const request = { product, @@ -94,7 +94,7 @@ function main(product, type, placeIds) { console.log(response); } - removeFulfillmentPlaces(); + callRemoveFulfillmentPlaces(); // [END retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js index e3d7d059114..4210ef328ed 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -21,10 +21,10 @@ function main(product, placeIds) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2alpha.Product], such as + * Product google.cloud.retail.v2alpha.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.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -38,14 +38,14 @@ function main(product, placeIds) { * out-of-order updates and deletions on local inventory fields. If not * provided, the internal system time will be used. */ - // const removeTime = '' + // const removeTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is + * If set to true, and the Product google.cloud.retail.v2alpha.Product is * not found, the local inventory removal request will still be processed and * retained for at most 1 day and processed once the - * [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, + * Product google.cloud.retail.v2alpha.Product is created. If set to false, * a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2alpha.Product] is not found. + * Product google.cloud.retail.v2alpha.Product is not found. */ // const allowMissing = true @@ -55,7 +55,7 @@ function main(product, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function removeLocalInventories() { + async function callRemoveLocalInventories() { // Construct request const request = { product, @@ -68,7 +68,7 @@ function main(product, placeIds) { console.log(response); } - removeLocalInventories(); + callRemoveLocalInventories(); // [END retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index d9333c64444..72b2b9d96aa 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -22,56 +22,56 @@ function main(inventory) { /** * Required. The inventory information to update. The allowable fields to * update are: - * * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - * * [Product.availability][google.cloud.retail.v2alpha.Product.availability] - * * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] - * * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] + * * Product.price_info google.cloud.retail.v2alpha.Product.price_info + * * Product.availability google.cloud.retail.v2alpha.Product.availability + * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * The updated inventory fields must be specified in - * [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask]. - * If [SetInventoryRequest.inventory.name][] is empty or invalid, an + * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask. + * If SetInventoryRequest.inventory.name is empty or invalid, an * INVALID_ARGUMENT error is returned. * If the caller does not have permission to update the - * [Product][google.cloud.retail.v2alpha.Product] named in - * [Product.name][google.cloud.retail.v2alpha.Product.name], regardless of + * Product google.cloud.retail.v2alpha.Product named in + * Product.name google.cloud.retail.v2alpha.Product.name, regardless of * whether or not it exists, a PERMISSION_DENIED error is returned. - * If the [Product][google.cloud.retail.v2alpha.Product] to update does not + * If the Product google.cloud.retail.v2alpha.Product to update does not * have existing inventory information, the provided inventory information * will be inserted. - * If the [Product][google.cloud.retail.v2alpha.Product] to update has + * If the Product google.cloud.retail.v2alpha.Product to update has * existing inventory information, the provided inventory information will be * merged while respecting the last update time for each inventory field, * using the provided or default value for - * [SetInventoryRequest.set_time][google.cloud.retail.v2alpha.SetInventoryRequest.set_time]. + * SetInventoryRequest.set_time google.cloud.retail.v2alpha.SetInventoryRequest.set_time. * The last update time is recorded for the following inventory fields: - * * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - * * [Product.availability][google.cloud.retail.v2alpha.Product.availability] - * * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] - * * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] + * * Product.price_info google.cloud.retail.v2alpha.Product.price_info + * * Product.availability google.cloud.retail.v2alpha.Product.availability + * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is - * needed, [UpdateProduct][] should be invoked instead. + * needed, UpdateProduct should be invoked instead. */ - // const inventory = '' + // const inventory = {} /** * Indicates which inventory fields in the provided - * [Product][google.cloud.retail.v2alpha.Product] to update. If not set or set + * Product google.cloud.retail.v2alpha.Product to update. If not set or set * with empty paths, all inventory fields will be updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ - // const setMask = '' + // const setMask = {} /** * The time when the request is issued, used to prevent * out-of-order updates on inventory fields with the last update time * recorded. If not provided, the internal system time will be used. */ - // const setTime = '' + // const setTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] with - * name [Product.name][google.cloud.retail.v2alpha.Product.name] is not found, + * If set to true, and the Product google.cloud.retail.v2alpha.Product with + * name Product.name google.cloud.retail.v2alpha.Product.name is not found, * the inventory update will still be processed and retained for at most 1 day - * until the [Product][google.cloud.retail.v2alpha.Product] is created. If set + * until the Product google.cloud.retail.v2alpha.Product is created. If set * to false, a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2alpha.Product] is not found. + * Product google.cloud.retail.v2alpha.Product is not found. */ // const allowMissing = true @@ -81,7 +81,7 @@ function main(inventory) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function setInventory() { + async function callSetInventory() { // Construct request const request = { inventory, @@ -93,7 +93,7 @@ function main(inventory) { console.log(response); } - setInventory(); + callSetInventory(); // [END retail_v2alpha_generated_ProductService_SetInventory_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js index f664194a142..078d4fbdfec 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js @@ -22,26 +22,26 @@ function main(product) { /** * Required. The product to update/create. * If the caller does not have permission to update the - * [Product][google.cloud.retail.v2alpha.Product], regardless of whether or + * Product google.cloud.retail.v2alpha.Product, regardless of whether or * not it exists, a PERMISSION_DENIED error is returned. - * If the [Product][google.cloud.retail.v2alpha.Product] to update does not + * If the Product google.cloud.retail.v2alpha.Product to update does not * exist and - * [allow_missing][google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing] + * allow_missing google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing * is not set, a NOT_FOUND error is returned. */ - // const product = '' + // const product = {} /** * Indicates which fields in the provided - * [Product][google.cloud.retail.v2alpha.Product] to update. The immutable and + * Product google.cloud.retail.v2alpha.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. */ - // const updateMask = '' + // const updateMask = {} /** - * If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - * not found, a new [Product][google.cloud.retail.v2alpha.Product] will be + * If set to true, and the Product google.cloud.retail.v2alpha.Product is + * not found, a new Product google.cloud.retail.v2alpha.Product will be * created. In this situation, `update_mask` is ignored. */ // const allowMissing = true @@ -52,7 +52,7 @@ function main(product) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function updateProduct() { + async function callUpdateProduct() { // Construct request const request = { product, @@ -63,7 +63,7 @@ function main(product) { console.log(response); } - updateProduct(); + callUpdateProduct(); // [END retail_v2alpha_generated_ProductService_UpdateProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index 86b868c6a31..8f0b00c1c9c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -49,9 +49,9 @@ function main(placement, visitorId) { /** * User information. */ - // const userInfo = '' + // const userInfo = {} /** - * Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to + * Maximum number of Product google.cloud.retail.v2alpha.Product s to * return. If unspecified, defaults to a reasonable value. The maximum allowed * value is 120. Values above 120 will be coerced to 120. * If this field is negative, an INVALID_ARGUMENT is returned. @@ -59,12 +59,12 @@ function main(placement, visitorId) { // const pageSize = 1234 /** * A page token - * [SearchResponse.next_page_token][google.cloud.retail.v2alpha.SearchResponse.next_page_token], + * SearchResponse.next_page_token google.cloud.retail.v2alpha.SearchResponse.next_page_token, * received from a previous - * [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] + * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -72,9 +72,9 @@ function main(placement, visitorId) { /** * A 0-indexed integer that specifies the current offset (that is, starting * result location, amongst the - * [Product][google.cloud.retail.v2alpha.Product]s deemed by the API as + * Product google.cloud.retail.v2alpha.Product s deemed by the API as * relevant) in search results. This field is only considered if - * [page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] is + * page_token google.cloud.retail.v2alpha.SearchRequest.page_token is * unset. * If this field is negative, an INVALID_ARGUMENT is returned. */ @@ -82,8 +82,8 @@ function main(placement, visitorId) { /** * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). + * expression is case-sensitive. See more details at this user + * guide (https://cloud.google.com/retail/docs/filter-and-order#filter). * If this field is unrecognizable, an INVALID_ARGUMENT is returned. */ // const filter = 'abc123' @@ -91,20 +91,20 @@ function main(placement, visitorId) { * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with - * [SearchRequest.canonical_filter][google.cloud.retail.v2alpha.SearchRequest.canonical_filter] + * SearchRequest.canonical_filter google.cloud.retail.v2alpha.SearchRequest.canonical_filter * will be returned as a supplement of the original query. This field is * strongly recommended to achieve high search quality. * See - * [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + * SearchRequest.filter google.cloud.retail.v2alpha.SearchRequest.filter * for more details about filter syntax. */ // const canonicalFilter = 'abc123' /** * The order in which products are returned. Products can be ordered by - * a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave + * a field in an Product google.cloud.retail.v2alpha.Product object. Leave * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](https://cloud.google.com/retail/docs/filter-and-order#order). + * more details at this user + * guide (https://cloud.google.com/retail/docs/filter-and-order#order). * If this field is unrecognizable, an INVALID_ARGUMENT is returned. */ // const orderBy = 'abc123' @@ -120,45 +120,45 @@ function main(placement, visitorId) { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. */ - // const dynamicFacetSpec = '' + // const dynamicFacetSpec = {} /** * Boost specification to boost certain products. See more details at this - * [user guide](https://cloud.google.com/retail/docs/boosting). + * user guide (https://cloud.google.com/retail/docs/boosting). * Notice that if both - * [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - * and [SearchRequest.boost_spec] are set, the boost conditions from both + * ServingConfig.boost_control_ids google.cloud.retail.v2alpha.ServingConfig.boost_control_ids + * and SearchRequest.boost_spec are set, the boost conditions from both * places are evaluated. If a search request matches multiple boost * conditions, the final boost score is equal to the sum of the boost scores * from all matched boost conditions. */ - // const boostSpec = '' + // const boostSpec = {} /** * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). + * query expansion will occur. See more details at this user + * guide (https://cloud.google.com/retail/docs/result-size#query_expansion). */ - // const queryExpansionSpec = '' + // const queryExpansionSpec = {} /** * The relevance threshold of the search results. * Defaults to - * [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], + * RelevanceThreshold.HIGH google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH, * which means only the most relevant results are shown, and the least number - * of results are returned. See more details at this [user - * guide](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). + * of results are returned. See more details at this user + * guide (https://cloud.google.com/retail/docs/result-size#relevance_thresholding). */ - // const relevanceThreshold = '' + // const relevanceThreshold = {} /** * The keys to fetch and rollup the matching - * [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2alpha.Product]s attributes. The attributes + * variant google.cloud.retail.v2alpha.Product.Type.VARIANT + * Product google.cloud.retail.v2alpha.Product s attributes. The attributes * from all the matching - * [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2alpha.Product]s are merged and + * variant google.cloud.retail.v2alpha.Product.Type.VARIANT + * Product google.cloud.retail.v2alpha.Product s are merged and * de-duplicated. Notice that rollup - * [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2alpha.Product]s attributes will lead to + * variant google.cloud.retail.v2alpha.Product.Type.VARIANT + * Product google.cloud.retail.v2alpha.Product s attributes will lead to * extra query latency. Maximum number of keys is 10. - * For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], a + * For FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. @@ -169,51 +169,51 @@ function main(placement, visitorId) { * * discount * * inventory(place_id,price) * * attributes.key, where key is any key in the - * [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. + * Product.attributes google.cloud.retail.v2alpha.Product.attributes map. * * pickupInStore.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "pickup-in-store". * * shipToStore.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "ship-to-store". * * sameDayDelivery.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "same-day-delivery". * * nextDayDelivery.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "next-day-delivery". * * customFulfillment1.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-1". * * customFulfillment2.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-2". * * customFulfillment3.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-3". * * customFulfillment4.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-4". * * customFulfillment5.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-5". * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -223,20 +223,20 @@ function main(placement, visitorId) { * The categories associated with a category page. Required for category * navigation queries to achieve good search quality. The format should be * the same as - * [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; + * UserEvent.page_categories google.cloud.retail.v2alpha.UserEvent.page_categories; * 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"]. + * "pageCategories" : "Sales > 2017 Black Friday Deals". */ // const pageCategories = 'abc123' /** * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. */ - // const searchMode = '' + // const searchMode = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2alpha; @@ -244,7 +244,7 @@ function main(placement, visitorId) { // Instantiates a client const retailClient = new SearchServiceClient(); - async function search() { + async function callSearch() { // Construct request const request = { placement, @@ -258,7 +258,7 @@ function main(placement, visitorId) { } } - search(); + callSearch(); // [END retail_v2alpha_generated_SearchService_Search_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js index 4018281ea61..4807eb3932b 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js @@ -49,7 +49,7 @@ function main(parent, userEvent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function collectUserEvent() { + async function callCollectUserEvent() { // Construct request const request = { parent, @@ -61,7 +61,7 @@ function main(parent, userEvent) { console.log(response); } - collectUserEvent(); + callCollectUserEvent(); // [END retail_v2alpha_generated_UserEventService_CollectUserEvent_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js index c4cb06a8cf6..525442bc449 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js @@ -26,12 +26,12 @@ function main(parent, inputConfig) { /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * The desired location of errors incurred during the Import. Cannot be set * for inline user event imports. */ - // const errorsConfig = '' + // const errorsConfig = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; @@ -39,7 +39,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function importUserEvents() { + async function callImportUserEvents() { // Construct request const request = { parent, @@ -52,7 +52,7 @@ function main(parent, inputConfig) { console.log(response); } - importUserEvents(); + callImportUserEvents(); // [END retail_v2alpha_generated_UserEventService_ImportUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js index 5f8e511683d..9d8540c7da3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js @@ -30,7 +30,7 @@ function main(parent, filter) { * 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.v2alpha.UserEvent.event_type] + * UserEvent.event_type google.cloud.retail.v2alpha.UserEvent.event_type * string. * * `eventTime`: in ISO 8601 "zulu" format. * * `visitorId`: Double quoted string. Specifying this will delete all @@ -61,7 +61,7 @@ function main(parent, filter) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function purgeUserEvents() { + async function callPurgeUserEvents() { // Construct request const request = { parent, @@ -74,7 +74,7 @@ function main(parent, filter) { console.log(response); } - purgeUserEvents(); + callPurgeUserEvents(); // [END retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js index efbb58e2488..0a5997bdac0 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js @@ -30,7 +30,7 @@ function main(parent) { * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an * invalid integer value. */ - // const userEventRejoinScope = '' + // const userEventRejoinScope = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; @@ -38,7 +38,7 @@ function main(parent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function rejoinUserEvents() { + async function callRejoinUserEvents() { // Construct request const request = { parent, @@ -50,7 +50,7 @@ function main(parent) { console.log(response); } - rejoinUserEvents(); + callRejoinUserEvents(); // [END retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js index be821f78f1f..3b8ccb24025 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js @@ -27,7 +27,7 @@ function main(parent, userEvent) { /** * Required. User event to write. */ - // const userEvent = '' + // const userEvent = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2alpha; @@ -35,7 +35,7 @@ function main(parent, userEvent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function writeUserEvent() { + async function callWriteUserEvent() { // Construct request const request = { parent, @@ -47,7 +47,7 @@ function main(parent, userEvent) { console.log(response); } - writeUserEvent(); + callWriteUserEvent(); // [END retail_v2alpha_generated_UserEventService_WriteUserEvent_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js index 5f5f443d8f0..10918a1e3b0 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js @@ -31,7 +31,7 @@ function main() { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function getDefaultBranch() { + async function callGetDefaultBranch() { // Construct request const request = {}; @@ -40,7 +40,7 @@ function main() { console.log(response); } - getDefaultBranch(); + callGetDefaultBranch(); // [END retail_v2beta_generated_CatalogService_GetDefaultBranch_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js index 0bfd55246a7..eb58e87a52a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js @@ -22,13 +22,13 @@ function main(parent) { /** * Required. The account resource name with an associated location. * If the caller does not have permission to list - * [Catalog][google.cloud.retail.v2beta.Catalog]s under this location, + * Catalog google.cloud.retail.v2beta.Catalog s under this location, * regardless of whether or not this location exists, a PERMISSION_DENIED * error is returned. */ // const parent = 'abc123' /** - * Maximum number of [Catalog][google.cloud.retail.v2beta.Catalog]s to return. + * Maximum number of Catalog google.cloud.retail.v2beta.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. @@ -36,12 +36,12 @@ function main(parent) { // const pageSize = 1234 /** * A page token - * [ListCatalogsResponse.next_page_token][google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token], + * ListCatalogsResponse.next_page_token google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token, * received from a previous - * [CatalogService.ListCatalogs][google.cloud.retail.v2beta.CatalogService.ListCatalogs] + * CatalogService.ListCatalogs google.cloud.retail.v2beta.CatalogService.ListCatalogs * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [CatalogService.ListCatalogs][google.cloud.retail.v2beta.CatalogService.ListCatalogs] + * CatalogService.ListCatalogs google.cloud.retail.v2beta.CatalogService.ListCatalogs * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -53,7 +53,7 @@ function main(parent) { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function listCatalogs() { + async function callListCatalogs() { // Construct request const request = { parent, @@ -66,7 +66,7 @@ function main(parent) { } } - listCatalogs(); + callListCatalogs(); // [END retail_v2beta_generated_CatalogService_ListCatalogs_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js index 1baa77407e3..be8bc09a380 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js @@ -32,7 +32,7 @@ function main() { // const branchId = 'abc123' /** * Some note on this request, this can be retrieved by - * [CatalogService.GetDefaultBranch][google.cloud.retail.v2beta.CatalogService.GetDefaultBranch] + * CatalogService.GetDefaultBranch google.cloud.retail.v2beta.CatalogService.GetDefaultBranch * before next valid default branch set occurs. * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -45,7 +45,7 @@ function main() { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function setDefaultBranch() { + async function callSetDefaultBranch() { // Construct request const request = {}; @@ -54,7 +54,7 @@ function main() { console.log(response); } - setDefaultBranch(); + callSetDefaultBranch(); // [END retail_v2beta_generated_CatalogService_SetDefaultBranch_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js index 8dbc583396e..73cc1451a66 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js @@ -20,21 +20,21 @@ function main(catalog) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The [Catalog][google.cloud.retail.v2beta.Catalog] to update. + * Required. The Catalog google.cloud.retail.v2beta.Catalog to update. * If the caller does not have permission to update the - * [Catalog][google.cloud.retail.v2beta.Catalog], regardless of whether or not + * Catalog google.cloud.retail.v2beta.Catalog, regardless of whether or not * it exists, a PERMISSION_DENIED error is returned. - * If the [Catalog][google.cloud.retail.v2beta.Catalog] to update does not + * If the Catalog google.cloud.retail.v2beta.Catalog to update does not * exist, a NOT_FOUND error is returned. */ - // const catalog = '' + // const catalog = {} /** * Indicates which fields in the provided - * [Catalog][google.cloud.retail.v2beta.Catalog] to update. + * Catalog google.cloud.retail.v2beta.Catalog to update. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. */ - // const updateMask = '' + // const updateMask = {} // Imports the Retail library const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; @@ -42,7 +42,7 @@ function main(catalog) { // Instantiates a client const retailClient = new CatalogServiceClient(); - async function updateCatalog() { + async function callUpdateCatalog() { // Construct request const request = { catalog, @@ -53,7 +53,7 @@ function main(catalog) { console.log(response); } - updateCatalog(); + callUpdateCatalog(); // [END retail_v2beta_generated_CatalogService_UpdateCatalog_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index d38e3d77ca8..c992ee208ef 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -43,7 +43,7 @@ function main(catalog, query) { * The list of languages of the query. This is * the BCP-47 language code, such as "en-US" or "sr-Latn". * For more information, see - * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + * Tags for Identifying Languages (https://tools.ietf.org/html/bcp47). * The maximum number of allowed characters is 255. * Only "en-US" is currently supported. */ @@ -63,7 +63,7 @@ function main(catalog, query) { /** * Determines which dataset to use for fetching completion. "user-data" will * use the imported dataset through - * [CompletionService.ImportCompletionData][google.cloud.retail.v2beta.CompletionService.ImportCompletionData]. + * CompletionService.ImportCompletionData google.cloud.retail.v2beta.CompletionService.ImportCompletionData. * "cloud-retail" will use the dataset generated by cloud retail based on user * events. If leave empty, it will use the "user-data". * Current supported values: @@ -75,7 +75,7 @@ function main(catalog, query) { // const dataset = 'abc123' /** * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value [CompletionConfig.max_suggestions][]. + * to the configured value CompletionConfig.max_suggestions . * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. */ @@ -87,7 +87,7 @@ function main(catalog, query) { // Instantiates a client const retailClient = new CompletionServiceClient(); - async function completeQuery() { + async function callCompleteQuery() { // Construct request const request = { catalog, @@ -99,7 +99,7 @@ function main(catalog, query) { console.log(response); } - completeQuery(); + callCompleteQuery(); // [END retail_v2beta_generated_CompletionService_CompleteQuery_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js index 77c065541de..2b3d4297fb2 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js @@ -27,12 +27,12 @@ function main(parent, inputConfig) { /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * Pub/Sub topic for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a - * [Operation][google.longrunning.Operation]. + * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. */ // const notificationPubsubTopic = 'abc123' @@ -43,7 +43,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new CompletionServiceClient(); - async function importCompletionData() { + async function callImportCompletionData() { // Construct request const request = { parent, @@ -56,7 +56,7 @@ function main(parent, inputConfig) { console.log(response); } - importCompletionData(); + callImportCompletionData(); // [END retail_v2beta_generated_CompletionService_ImportCompletionData_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index e01ce1ff98d..b9fdab6115a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -24,8 +24,8 @@ function main(placement, userEvent) { * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} * The ID of the Recommendations AI placement. Before you can request * predictions from your model, you must create at least one placement for it. - * For more information, see [Managing - * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + * For more information, see Managing + * placements (https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). * The full list of available placements can be seen at * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements */ @@ -36,7 +36,7 @@ function main(placement, userEvent) { * won't be ingested to userEvent logs. Thus, a separate userEvent write * request is required for event logging. */ - // const userEvent = '' + // const userEvent = {} /** * Maximum number of results to return per page. Set this property * to the number of prediction results needed. If zero, the service will @@ -117,8 +117,8 @@ function main(placement, userEvent) { * * The key portion of a label must be unique. However, you can use the same * key with multiple resources. * * Keys must start with a lowercase letter or international character. - * See [Google Cloud - * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) * for more details. */ // const labels = 1234 @@ -129,7 +129,7 @@ function main(placement, userEvent) { // Instantiates a client const retailClient = new PredictionServiceClient(); - async function predict() { + async function callPredict() { // Construct request const request = { placement, @@ -141,7 +141,7 @@ function main(placement, userEvent) { console.log(response); } - predict(); + callPredict(); // [END retail_v2beta_generated_PredictionService_Predict_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js index ed21e64f9d4..7ebff9f7383 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -21,10 +21,10 @@ function main(product, type, placeIds) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2beta.Product], such as + * Product google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * Product google.cloud.retail.v2beta.Product, regardless of whether or not * it exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -43,22 +43,22 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to [Product.fulfillment_info.type][]. + * This field directly corresponds to Product.fulfillment_info.type . */ // const type = 'abc123' /** * Required. The IDs for this - * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type], such + * type google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type, such * as the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery" to be added for this - * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type]. + * type google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type. * Duplicate IDs will be automatically ignored. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * If the total number of place IDs exceeds 2000 for this - * [type][google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type] after + * type google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type after * adding, then the update will be rejected. */ // const placeIds = 'abc123' @@ -67,14 +67,14 @@ function main(product, type, placeIds) { * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. */ - // const addTime = '' + // const addTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + * If set to true, and the Product google.cloud.retail.v2beta.Product is * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the - * [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + * Product google.cloud.retail.v2beta.Product is created. If set to false, * a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2beta.Product] is not found. + * Product google.cloud.retail.v2beta.Product is not found. */ // const allowMissing = true @@ -84,7 +84,7 @@ function main(product, type, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function addFulfillmentPlaces() { + async function callAddFulfillmentPlaces() { // Construct request const request = { product, @@ -98,7 +98,7 @@ function main(product, type, placeIds) { console.log(response); } - addFulfillmentPlaces(); + callAddFulfillmentPlaces(); // [END retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js index 344487c9e79..99b3712c648 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js @@ -25,19 +25,19 @@ function main(parent, product, productId) { */ // const parent = 'abc123' /** - * Required. The [Product][google.cloud.retail.v2beta.Product] to create. + * Required. The Product google.cloud.retail.v2beta.Product to create. */ - // const product = '' + // const product = {} /** * Required. The ID to use for the - * [Product][google.cloud.retail.v2beta.Product], which will become the final - * component of the [Product.name][google.cloud.retail.v2beta.Product.name]. + * Product google.cloud.retail.v2beta.Product, which will become the final + * component of the Product.name google.cloud.retail.v2beta.Product.name. * If the caller does not have permission to create the - * [Product][google.cloud.retail.v2beta.Product], regardless of whether or not + * Product google.cloud.retail.v2beta.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.v2beta.Product]s with the same - * [parent][google.cloud.retail.v2beta.CreateProductRequest.parent]. + * Product google.cloud.retail.v2beta.Product s with the same + * parent google.cloud.retail.v2beta.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. @@ -50,7 +50,7 @@ function main(parent, product, productId) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function createProduct() { + async function callCreateProduct() { // Construct request const request = { parent, @@ -63,7 +63,7 @@ function main(parent, product, productId) { console.log(response); } - createProduct(); + callCreateProduct(); // [END retail_v2beta_generated_ProductService_CreateProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js index ef63e363bbc..8198869cd66 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js @@ -21,23 +21,23 @@ function main(name) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2beta.Product], such as + * Product google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * Product google.cloud.retail.v2beta.Product, regardless of whether or not * it exists, a PERMISSION_DENIED error is returned. - * If the [Product][google.cloud.retail.v2beta.Product] to delete does not + * If the Product google.cloud.retail.v2beta.Product to delete does not * exist, a NOT_FOUND error is returned. - * The [Product][google.cloud.retail.v2beta.Product] to delete can neither be + * The Product google.cloud.retail.v2beta.Product to delete can neither be * a - * [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2beta.Product] member nor a - * [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2beta.Product] with more than one - * [variants][google.cloud.retail.v2beta.Product.Type.VARIANT]. Otherwise, an + * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION + * Product google.cloud.retail.v2beta.Product member nor a + * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY + * Product google.cloud.retail.v2beta.Product with more than one + * variants google.cloud.retail.v2beta.Product.Type.VARIANT. Otherwise, an * INVALID_ARGUMENT error is returned. * All inventory information for the named - * [Product][google.cloud.retail.v2beta.Product] will be deleted. + * Product google.cloud.retail.v2beta.Product will be deleted. */ // const name = 'abc123' @@ -47,7 +47,7 @@ function main(name) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function deleteProduct() { + async function callDeleteProduct() { // Construct request const request = { name, @@ -58,7 +58,7 @@ function main(name) { console.log(response); } - deleteProduct(); + callDeleteProduct(); // [END retail_v2beta_generated_ProductService_DeleteProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js index 20007ea8bc4..a36cae42916 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js @@ -21,12 +21,12 @@ function main(name) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2beta.Product], such as + * Product google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * Product google.cloud.retail.v2beta.Product, regardless of whether or not * it exists, a PERMISSION_DENIED error is returned. - * If the requested [Product][google.cloud.retail.v2beta.Product] does not + * If the requested Product google.cloud.retail.v2beta.Product does not * exist, a NOT_FOUND error is returned. */ // const name = 'abc123' @@ -37,7 +37,7 @@ function main(name) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function getProduct() { + async function callGetProduct() { // Construct request const request = { name, @@ -48,7 +48,7 @@ function main(name) { console.log(response); } - getProduct(); + callGetProduct(); // [END retail_v2beta_generated_ProductService_GetProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index 37975519eae..7db5f12367c 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -31,39 +31,39 @@ function main(parent, inputConfig) { * dataset scope. Ensures idempotency and used for request deduplication. * Server-generated if unspecified. Up to 128 characters long and must match * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - * [ImportMetadata][google.cloud.retail.v2beta.ImportMetadata]. + * ImportMetadata google.cloud.retail.v2beta.ImportMetadata. * Only supported when - * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const requestId = 'abc123' /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * The desired location of errors incurred during the Import. */ - // const errorsConfig = '' + // const errorsConfig = {} /** * Indicates which fields in the provided imported 'products' to update. If * not set, will by default update all fields. */ - // const updateMask = '' + // const updateMask = {} /** * The mode of reconciliation between existing products and the products to be * imported. Defaults to - * [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. + * ReconciliationMode.INCREMENTAL google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL. */ - // const reconciliationMode = '' + // const reconciliationMode = {} /** * Pub/Sub topic for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a - * [Operation][google.longrunning.Operation]. + * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * Only supported when - * [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' @@ -74,7 +74,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function importProducts() { + async function callImportProducts() { // Construct request const request = { parent, @@ -87,7 +87,7 @@ function main(parent, inputConfig) { console.log(response); } - importProducts(); + callImportProducts(); // [END retail_v2beta_generated_ProductService_ImportProducts_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js index 29393fe37a6..5b770e84942 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js @@ -25,13 +25,13 @@ function main(parent) { * `default_branch` as the branch ID, to list products under the default * branch. * If the caller does not have permission to list - * [Product][google.cloud.retail.v2beta.Product]s under this branch, + * Product google.cloud.retail.v2beta.Product s under this branch, * regardless of whether or not this branch exists, a PERMISSION_DENIED error * is returned. */ // const parent = 'abc123' /** - * Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return. + * Maximum number of Product google.cloud.retail.v2beta.Product s to return. * If unspecified, defaults to 100. The maximum allowed value is 1000. Values * above 1000 will be coerced to 1000. * If this field is negative, an INVALID_ARGUMENT error is returned. @@ -39,12 +39,12 @@ function main(parent) { // const pageSize = 1234 /** * A page token - * [ListProductsResponse.next_page_token][google.cloud.retail.v2beta.ListProductsResponse.next_page_token], + * ListProductsResponse.next_page_token google.cloud.retail.v2beta.ListProductsResponse.next_page_token, * received from a previous - * [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + * ProductService.ListProducts google.cloud.retail.v2beta.ProductService.ListProducts * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] + * ProductService.ListProducts google.cloud.retail.v2beta.ProductService.ListProducts * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -52,49 +52,49 @@ function main(parent) { /** * A filter to apply on the list results. Supported features: * * List all the products under the parent branch if - * [filter][google.cloud.retail.v2beta.ListProductsRequest.filter] is unset. + * filter google.cloud.retail.v2beta.ListProductsRequest.filter is unset. * * List - * [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2beta.Product]s sharing the same - * [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2beta.Product]. For example: + * Product.Type.VARIANT google.cloud.retail.v2beta.Product.Type.VARIANT + * Product google.cloud.retail.v2beta.Product s sharing the same + * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY + * Product google.cloud.retail.v2beta.Product. For example: * `primary_product_id = "some_product_id"` - * * List [Product][google.cloud.retail.v2beta.Product]s bundled in a - * [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2beta.Product]. + * * List Product google.cloud.retail.v2beta.Product s bundled in a + * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION + * Product google.cloud.retail.v2beta.Product. * For example: * `collection_product_id = "some_product_id"` - * * List [Product][google.cloud.retail.v2beta.Product]s with a partibular + * * List Product google.cloud.retail.v2beta.Product s with a partibular * type. For example: * `type = "PRIMARY"` * `type = "VARIANT"` * `type = "COLLECTION"` * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. * If the specified - * [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] - * [Product][google.cloud.retail.v2beta.Product] or - * [Product.Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION] - * [Product][google.cloud.retail.v2beta.Product] does not exist, a NOT_FOUND + * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY + * Product google.cloud.retail.v2beta.Product or + * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION + * Product google.cloud.retail.v2beta.Product does not exist, a NOT_FOUND * error is returned. */ // const filter = 'abc123' /** - * The fields of [Product][google.cloud.retail.v2beta.Product] to return in + * The fields of Product google.cloud.retail.v2beta.Product to return in * the responses. If not set or empty, the following fields are returned: - * * [Product.name][google.cloud.retail.v2beta.Product.name] - * * [Product.id][google.cloud.retail.v2beta.Product.id] - * * [Product.title][google.cloud.retail.v2beta.Product.title] - * * [Product.uri][google.cloud.retail.v2beta.Product.uri] - * * [Product.images][google.cloud.retail.v2beta.Product.images] - * * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] - * * [Product.brands][google.cloud.retail.v2beta.Product.brands] + * * Product.name google.cloud.retail.v2beta.Product.name + * * Product.id google.cloud.retail.v2beta.Product.id + * * Product.title google.cloud.retail.v2beta.Product.title + * * Product.uri google.cloud.retail.v2beta.Product.uri + * * Product.images google.cloud.retail.v2beta.Product.images + * * Product.price_info google.cloud.retail.v2beta.Product.price_info + * * Product.brands google.cloud.retail.v2beta.Product.brands * If "*" is provided, all fields are returned. - * [Product.name][google.cloud.retail.v2beta.Product.name] is always returned + * Product.name google.cloud.retail.v2beta.Product.name is always returned * no matter what mask is set. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. */ - // const readMask = '' + // const readMask = {} // Imports the Retail library const {ProductServiceClient} = require('@google-cloud/retail').v2beta; @@ -102,7 +102,7 @@ function main(parent) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function listProducts() { + async function callListProducts() { // Construct request const request = { parent, @@ -115,7 +115,7 @@ function main(parent) { } } - listProducts(); + callListProducts(); // [END retail_v2beta_generated_ProductService_ListProducts_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js index 853ef48ee34..12f13f6991b 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -21,10 +21,10 @@ function main(product, type, placeIds) { */ /** * Required. Full resource name of - * [Product][google.cloud.retail.v2beta.Product], such as + * Product google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + * Product google.cloud.retail.v2beta.Product, regardless of whether or not * it exists, a PERMISSION_DENIED error is returned. */ // const product = 'abc123' @@ -43,15 +43,15 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to [Product.fulfillment_info.type][]. + * This field directly corresponds to Product.fulfillment_info.type . */ // const type = 'abc123' /** * Required. The IDs for this - * [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type], + * type google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type, * such as the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery", to be removed for this - * [type][google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type]. + * type google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type. * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an @@ -63,14 +63,14 @@ function main(product, type, placeIds) { * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. */ - // const removeTime = '' + // const removeTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + * If set to true, and the Product google.cloud.retail.v2beta.Product is * not found, the fulfillment information will still be processed and retained * for at most 1 day and processed once the - * [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + * Product google.cloud.retail.v2beta.Product is created. If set to false, * a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2beta.Product] is not found. + * Product google.cloud.retail.v2beta.Product is not found. */ // const allowMissing = true @@ -80,7 +80,7 @@ function main(product, type, placeIds) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function removeFulfillmentPlaces() { + async function callRemoveFulfillmentPlaces() { // Construct request const request = { product, @@ -94,7 +94,7 @@ function main(product, type, placeIds) { console.log(response); } - removeFulfillmentPlaces(); + callRemoveFulfillmentPlaces(); // [END retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js index ae2f590a188..fa4cfb98690 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -22,56 +22,56 @@ function main(inventory) { /** * Required. The inventory information to update. The allowable fields to * update are: - * * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] - * * [Product.availability][google.cloud.retail.v2beta.Product.availability] - * * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] - * * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] + * * Product.price_info google.cloud.retail.v2beta.Product.price_info + * * Product.availability google.cloud.retail.v2beta.Product.availability + * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * The updated inventory fields must be specified in - * [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask]. - * If [SetInventoryRequest.inventory.name][] is empty or invalid, an + * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask. + * If SetInventoryRequest.inventory.name is empty or invalid, an * INVALID_ARGUMENT error is returned. * If the caller does not have permission to update the - * [Product][google.cloud.retail.v2beta.Product] named in - * [Product.name][google.cloud.retail.v2beta.Product.name], regardless of + * Product google.cloud.retail.v2beta.Product named in + * Product.name google.cloud.retail.v2beta.Product.name, regardless of * whether or not it exists, a PERMISSION_DENIED error is returned. - * If the [Product][google.cloud.retail.v2beta.Product] to update does not + * If the Product google.cloud.retail.v2beta.Product to update does not * have existing inventory information, the provided inventory information * will be inserted. - * If the [Product][google.cloud.retail.v2beta.Product] to update has existing + * If the Product google.cloud.retail.v2beta.Product to update has existing * inventory information, the provided inventory information will be merged * while respecting the last update time for each inventory field, using the * provided or default value for - * [SetInventoryRequest.set_time][google.cloud.retail.v2beta.SetInventoryRequest.set_time]. + * SetInventoryRequest.set_time google.cloud.retail.v2beta.SetInventoryRequest.set_time. * The last update time is recorded for the following inventory fields: - * * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] - * * [Product.availability][google.cloud.retail.v2beta.Product.availability] - * * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] - * * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] + * * Product.price_info google.cloud.retail.v2beta.Product.price_info + * * Product.availability google.cloud.retail.v2beta.Product.availability + * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is - * needed, [UpdateProduct][] should be invoked instead. + * needed, UpdateProduct should be invoked instead. */ - // const inventory = '' + // const inventory = {} /** * Indicates which inventory fields in the provided - * [Product][google.cloud.retail.v2beta.Product] to update. If not set or set + * Product google.cloud.retail.v2beta.Product to update. If not set or set * with empty paths, all inventory fields will be updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ - // const setMask = '' + // const setMask = {} /** * The time when the request is issued, used to prevent * out-of-order updates on inventory fields with the last update time * recorded. If not provided, the internal system time will be used. */ - // const setTime = '' + // const setTime = {} /** - * If set to true, and the [Product][google.cloud.retail.v2beta.Product] with - * name [Product.name][google.cloud.retail.v2beta.Product.name] is not found, + * If set to true, and the Product google.cloud.retail.v2beta.Product with + * name Product.name google.cloud.retail.v2beta.Product.name is not found, * the inventory update will still be processed and retained for at most 1 day - * until the [Product][google.cloud.retail.v2beta.Product] is created. If set + * until the Product google.cloud.retail.v2beta.Product is created. If set * to false, a NOT_FOUND error is returned if the - * [Product][google.cloud.retail.v2beta.Product] is not found. + * Product google.cloud.retail.v2beta.Product is not found. */ // const allowMissing = true @@ -81,7 +81,7 @@ function main(inventory) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function setInventory() { + async function callSetInventory() { // Construct request const request = { inventory, @@ -93,7 +93,7 @@ function main(inventory) { console.log(response); } - setInventory(); + callSetInventory(); // [END retail_v2beta_generated_ProductService_SetInventory_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js index fee1d168be5..112b4f4ff8d 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js @@ -22,26 +22,26 @@ function main(product) { /** * Required. The product to update/create. * If the caller does not have permission to update the - * [Product][google.cloud.retail.v2beta.Product], regardless of whether or not + * Product google.cloud.retail.v2beta.Product, regardless of whether or not * it exists, a PERMISSION_DENIED error is returned. - * If the [Product][google.cloud.retail.v2beta.Product] to update does not + * If the Product google.cloud.retail.v2beta.Product to update does not * exist and - * [allow_missing][google.cloud.retail.v2beta.UpdateProductRequest.allow_missing] + * allow_missing google.cloud.retail.v2beta.UpdateProductRequest.allow_missing * is not set, a NOT_FOUND error is returned. */ - // const product = '' + // const product = {} /** * Indicates which fields in the provided - * [Product][google.cloud.retail.v2beta.Product] to update. The immutable and + * Product google.cloud.retail.v2beta.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. */ - // const updateMask = '' + // const updateMask = {} /** - * If set to true, and the [Product][google.cloud.retail.v2beta.Product] is - * not found, a new [Product][google.cloud.retail.v2beta.Product] will be + * If set to true, and the Product google.cloud.retail.v2beta.Product is + * not found, a new Product google.cloud.retail.v2beta.Product will be * created. In this situation, `update_mask` is ignored. */ // const allowMissing = true @@ -52,7 +52,7 @@ function main(product) { // Instantiates a client const retailClient = new ProductServiceClient(); - async function updateProduct() { + async function callUpdateProduct() { // Construct request const request = { product, @@ -63,7 +63,7 @@ function main(product) { console.log(response); } - updateProduct(); + callUpdateProduct(); // [END retail_v2beta_generated_ProductService_UpdateProduct_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index 61f479313f8..b6cfbb95a5b 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -49,9 +49,9 @@ function main(placement, visitorId) { /** * User information. */ - // const userInfo = '' + // const userInfo = {} /** - * Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return. + * Maximum number of Product google.cloud.retail.v2beta.Product s to return. * If unspecified, defaults to a reasonable value. The maximum allowed value * is 120. Values above 120 will be coerced to 120. * If this field is negative, an INVALID_ARGUMENT is returned. @@ -59,30 +59,30 @@ function main(placement, visitorId) { // const pageSize = 1234 /** * A page token - * [SearchResponse.next_page_token][google.cloud.retail.v2beta.SearchResponse.next_page_token], + * SearchResponse.next_page_token google.cloud.retail.v2beta.SearchResponse.next_page_token, * received from a previous - * [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + * SearchService.Search google.cloud.retail.v2beta.SearchService.Search * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search] + * SearchService.Search google.cloud.retail.v2beta.SearchService.Search * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ // const pageToken = 'abc123' /** * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the [Product][google.cloud.retail.v2beta.Product]s + * result location, amongst the Product google.cloud.retail.v2beta.Product s * deemed by the API as relevant) in search results. This field is only * considered if - * [page_token][google.cloud.retail.v2beta.SearchRequest.page_token] is unset. + * page_token google.cloud.retail.v2beta.SearchRequest.page_token is unset. * If this field is negative, an INVALID_ARGUMENT is returned. */ // const offset = 1234 /** * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. See more details at this [user - * guide](https://cloud.google.com/retail/docs/filter-and-order#filter). + * expression is case-sensitive. See more details at this user + * guide (https://cloud.google.com/retail/docs/filter-and-order#filter). * If this field is unrecognizable, an INVALID_ARGUMENT is returned. */ // const filter = 'abc123' @@ -90,19 +90,19 @@ function main(placement, visitorId) { * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with - * [SearchRequest.canonical_filter][google.cloud.retail.v2beta.SearchRequest.canonical_filter] + * SearchRequest.canonical_filter google.cloud.retail.v2beta.SearchRequest.canonical_filter * will be returned as a supplement of the original query. This field is * strongly recommended to achieve high search quality. - * See [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + * See SearchRequest.filter google.cloud.retail.v2beta.SearchRequest.filter * for more details about filter syntax. */ // const canonicalFilter = 'abc123' /** * The order in which products are returned. Products can be ordered by - * a field in an [Product][google.cloud.retail.v2beta.Product] object. Leave + * a field in an Product google.cloud.retail.v2beta.Product object. Leave * it unset if ordered by relevance. OrderBy expression is case-sensitive. See - * more details at this [user - * guide](https://cloud.google.com/retail/docs/filter-and-order#order). + * more details at this user + * guide (https://cloud.google.com/retail/docs/filter-and-order#order). * If this field is unrecognizable, an INVALID_ARGUMENT is returned. */ // const orderBy = 'abc123' @@ -118,35 +118,35 @@ function main(placement, visitorId) { * This feature requires additional allowlisting. Contact Retail Search * support team if you are interested in using dynamic facet feature. */ - // const dynamicFacetSpec = '' + // const dynamicFacetSpec = {} /** * Boost specification to boost certain products. See more details at this - * [user guide](https://cloud.google.com/retail/docs/boosting). - * Notice that if both [ServingConfig.boost_control_ids][] and - * [SearchRequest.boost_spec] are set, the boost conditions from both places + * user guide (https://cloud.google.com/retail/docs/boosting). + * Notice that if both ServingConfig.boost_control_ids and + * SearchRequest.boost_spec are set, the boost conditions from both places * are evaluated. If a search request matches multiple boost conditions, * the final boost score is equal to the sum of the boost scores from all * matched boost conditions. */ - // const boostSpec = '' + // const boostSpec = {} /** * The query expansion specification that specifies the conditions under which - * query expansion will occur. See more details at this [user - * guide](https://cloud.google.com/retail/docs/result-size#query_expansion). + * query expansion will occur. See more details at this user + * guide (https://cloud.google.com/retail/docs/result-size#query_expansion). */ - // const queryExpansionSpec = '' + // const queryExpansionSpec = {} /** * The keys to fetch and rollup the matching - * [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2beta.Product]s attributes. The attributes + * variant google.cloud.retail.v2beta.Product.Type.VARIANT + * Product google.cloud.retail.v2beta.Product s attributes. The attributes * from all the matching - * [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2beta.Product]s are merged and + * variant google.cloud.retail.v2beta.Product.Type.VARIANT + * Product google.cloud.retail.v2beta.Product s are merged and * de-duplicated. Notice that rollup - * [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - * [Product][google.cloud.retail.v2beta.Product]s attributes will lead to + * variant google.cloud.retail.v2beta.Product.Type.VARIANT + * Product google.cloud.retail.v2beta.Product s attributes will lead to * extra query latency. Maximum number of keys is 10. - * For [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo], a + * For FulfillmentInfo google.cloud.retail.v2beta.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", * "pickupInStore" is fulfillment type and "store123" is the store ID. @@ -157,42 +157,42 @@ function main(placement, visitorId) { * * discount * * inventory(place_id,price) * * attributes.key, where key is any key in the - * [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. + * Product.attributes google.cloud.retail.v2beta.Product.attributes map. * * pickupInStore.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "pickup-in-store". * * shipToStore.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "ship-to-store". * * sameDayDelivery.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "same-day-delivery". * * nextDayDelivery.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "next-day-delivery". * * customFulfillment1.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-1". * * customFulfillment2.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-2". * * customFulfillment3.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-3". * * customFulfillment4.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-4". * * customFulfillment5.id, where id is any - * [FulfillmentInfo.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] - * for [FulfillmentInfo.type][google.cloud.retail.v2beta.FulfillmentInfo.type] + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-5". * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -202,20 +202,20 @@ function main(placement, visitorId) { * The categories associated with a category page. Required for category * navigation queries to achieve good search quality. The format should be * the same as - * [UserEvent.page_categories][google.cloud.retail.v2beta.UserEvent.page_categories]; + * UserEvent.page_categories google.cloud.retail.v2beta.UserEvent.page_categories; * 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"]. + * "pageCategories" : "Sales > 2017 Black Friday Deals". */ // const pageCategories = 'abc123' /** * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. */ - // const searchMode = '' + // const searchMode = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2beta; @@ -223,7 +223,7 @@ function main(placement, visitorId) { // Instantiates a client const retailClient = new SearchServiceClient(); - async function search() { + async function callSearch() { // Construct request const request = { placement, @@ -237,7 +237,7 @@ function main(placement, visitorId) { } } - search(); + callSearch(); // [END retail_v2beta_generated_SearchService_Search_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js index 14b0a36e874..5257ffc8738 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js @@ -49,7 +49,7 @@ function main(parent, userEvent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function collectUserEvent() { + async function callCollectUserEvent() { // Construct request const request = { parent, @@ -61,7 +61,7 @@ function main(parent, userEvent) { console.log(response); } - collectUserEvent(); + callCollectUserEvent(); // [END retail_v2beta_generated_UserEventService_CollectUserEvent_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js index d4dc2fc4959..e2b50f9541d 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js @@ -26,12 +26,12 @@ function main(parent, inputConfig) { /** * Required. The desired input location of the data. */ - // const inputConfig = '' + // const inputConfig = {} /** * The desired location of errors incurred during the Import. Cannot be set * for inline user event imports. */ - // const errorsConfig = '' + // const errorsConfig = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; @@ -39,7 +39,7 @@ function main(parent, inputConfig) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function importUserEvents() { + async function callImportUserEvents() { // Construct request const request = { parent, @@ -52,7 +52,7 @@ function main(parent, inputConfig) { console.log(response); } - importUserEvents(); + callImportUserEvents(); // [END retail_v2beta_generated_UserEventService_ImportUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js index 39e6980933c..fefe0b66cee 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js @@ -30,7 +30,7 @@ function main(parent, filter) { * 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.v2beta.UserEvent.event_type] + * UserEvent.event_type google.cloud.retail.v2beta.UserEvent.event_type * string. * * `eventTime`: in ISO 8601 "zulu" format. * * `visitorId`: Double quoted string. Specifying this will delete all @@ -61,7 +61,7 @@ function main(parent, filter) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function purgeUserEvents() { + async function callPurgeUserEvents() { // Construct request const request = { parent, @@ -74,7 +74,7 @@ function main(parent, filter) { console.log(response); } - purgeUserEvents(); + callPurgeUserEvents(); // [END retail_v2beta_generated_UserEventService_PurgeUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js index 2ac57d1b703..33eb3d5f6d3 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js @@ -30,7 +30,7 @@ function main(parent) { * USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an * invalid integer value. */ - // const userEventRejoinScope = '' + // const userEventRejoinScope = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; @@ -38,7 +38,7 @@ function main(parent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function rejoinUserEvents() { + async function callRejoinUserEvents() { // Construct request const request = { parent, @@ -50,7 +50,7 @@ function main(parent) { console.log(response); } - rejoinUserEvents(); + callRejoinUserEvents(); // [END retail_v2beta_generated_UserEventService_RejoinUserEvents_async] } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js index cc58e3a36b8..f1368ba57f2 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js @@ -27,7 +27,7 @@ function main(parent, userEvent) { /** * Required. User event to write. */ - // const userEvent = '' + // const userEvent = {} // Imports the Retail library const {UserEventServiceClient} = require('@google-cloud/retail').v2beta; @@ -35,7 +35,7 @@ function main(parent, userEvent) { // Instantiates a client const retailClient = new UserEventServiceClient(); - async function writeUserEvent() { + async function callWriteUserEvent() { // Construct request const request = { parent, @@ -47,7 +47,7 @@ function main(parent, userEvent) { console.log(response); } - writeUserEvent(); + callWriteUserEvent(); // [END retail_v2beta_generated_UserEventService_WriteUserEvent_async] } diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 80dfc46ce11..16ee045dc50 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -325,33 +325,6 @@ export class CatalogServiceClient { // ------------------- // -- Service calls -- // ------------------- - updateCatalog( - request?: protos.google.cloud.retail.v2.IUpdateCatalogRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.ICatalog, - protos.google.cloud.retail.v2.IUpdateCatalogRequest | undefined, - {} | undefined - ] - >; - updateCatalog( - request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2.ICatalog, - protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, - {} | null | undefined - > - ): void; - updateCatalog( - request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, - callback: Callback< - protos.google.cloud.retail.v2.ICatalog, - protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Updates the {@link google.cloud.retail.v2.Catalog|Catalog}s. * @@ -379,9 +352,36 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.updateCatalog(request); + * @example include:samples/generated/v2/catalog_service.update_catalog.js + * region_tag:retail_v2_generated_CatalogService_UpdateCatalog_async */ + updateCatalog( + request?: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | undefined, + {} | undefined + ] + >; + updateCatalog( + request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, + {} | null | undefined + > + ): void; + updateCatalog( + request: protos.google.cloud.retail.v2.IUpdateCatalogRequest, + callback: Callback< + protos.google.cloud.retail.v2.ICatalog, + protos.google.cloud.retail.v2.IUpdateCatalogRequest | null | undefined, + {} | null | undefined + > + ): void; updateCatalog( request?: protos.google.cloud.retail.v2.IUpdateCatalogRequest, optionsOrCallback?: @@ -423,33 +423,6 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } - setDefaultBranch( - request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, - {} | undefined - ] - >; - setDefaultBranch( - request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, - {} | null | undefined - > - ): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Set a specified branch id as default branch. API methods such as * {@link google.cloud.retail.v2.SearchService.Search|SearchService.Search}, @@ -513,9 +486,36 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.setDefaultBranch(request); + * @example include:samples/generated/v2/catalog_service.set_default_branch.js + * region_tag:retail_v2_generated_CatalogService_SetDefaultBranch_async */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; setDefaultBranch( request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, optionsOrCallback?: @@ -557,6 +557,30 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.setDefaultBranch(request, options, callback); } + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.get_default_branch.js + * region_tag:retail_v2_generated_CatalogService_GetDefaultBranch_async + */ getDefaultBranch( request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, options?: CallOptions @@ -584,30 +608,6 @@ export class CatalogServiceClient { {} | null | undefined > ): void; - /** - * Get which branch is currently default branch set by - * {@link google.cloud.retail.v2.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. - * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2.GetDefaultBranchResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getDefaultBranch(request); - */ getDefaultBranch( request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, optionsOrCallback?: @@ -650,33 +650,6 @@ export class CatalogServiceClient { return this.innerApiCalls.getDefaultBranch(request, options, callback); } - listCatalogs( - request?: protos.google.cloud.retail.v2.IListCatalogsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.ICatalog[], - protos.google.cloud.retail.v2.IListCatalogsRequest | null, - protos.google.cloud.retail.v2.IListCatalogsResponse - ] - >; - listCatalogs( - request: protos.google.cloud.retail.v2.IListCatalogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2.IListCatalogsRequest, - protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, - protos.google.cloud.retail.v2.ICatalog - > - ): void; - listCatalogs( - request: protos.google.cloud.retail.v2.IListCatalogsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2.IListCatalogsRequest, - protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, - protos.google.cloud.retail.v2.ICatalog - > - ): void; /** * Lists all the {@link google.cloud.retail.v2.Catalog|Catalog}s associated with * the project. @@ -720,6 +693,33 @@ export class CatalogServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listCatalogs( + request?: protos.google.cloud.retail.v2.IListCatalogsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICatalog[], + protos.google.cloud.retail.v2.IListCatalogsRequest | null, + protos.google.cloud.retail.v2.IListCatalogsResponse + ] + >; + listCatalogs( + request: protos.google.cloud.retail.v2.IListCatalogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListCatalogsRequest, + protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, + protos.google.cloud.retail.v2.ICatalog + > + ): void; + listCatalogs( + request: protos.google.cloud.retail.v2.IListCatalogsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListCatalogsRequest, + protos.google.cloud.retail.v2.IListCatalogsResponse | null | undefined, + protos.google.cloud.retail.v2.ICatalog + > + ): void; listCatalogs( request?: protos.google.cloud.retail.v2.IListCatalogsRequest, optionsOrCallback?: @@ -864,11 +864,8 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listCatalogsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2/catalog_service.list_catalogs.js + * region_tag:retail_v2_generated_CatalogService_ListCatalogs_async */ listCatalogsAsync( request?: protos.google.cloud.retail.v2.IListCatalogsRequest, @@ -882,7 +879,6 @@ export class CatalogServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index c92fcae85f8..7a5b0bf2310 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -335,33 +335,6 @@ export class CompletionServiceClient { // ------------------- // -- Service calls -- // ------------------- - completeQuery( - request?: protos.google.cloud.retail.v2.ICompleteQueryRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.ICompleteQueryResponse, - protos.google.cloud.retail.v2.ICompleteQueryRequest | undefined, - {} | undefined - ] - >; - completeQuery( - request: protos.google.cloud.retail.v2.ICompleteQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2.ICompleteQueryResponse, - protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, - {} | null | undefined - > - ): void; - completeQuery( - request: protos.google.cloud.retail.v2.ICompleteQueryRequest, - callback: Callback< - protos.google.cloud.retail.v2.ICompleteQueryResponse, - protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Completes the specified prefix with keyword suggestions. * @@ -438,9 +411,36 @@ export class CompletionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.completeQuery(request); + * @example include:samples/generated/v2/completion_service.complete_query.js + * region_tag:retail_v2_generated_CompletionService_CompleteQuery_async */ + completeQuery( + request?: protos.google.cloud.retail.v2.ICompleteQueryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | undefined, + {} | undefined + ] + >; + completeQuery( + request: protos.google.cloud.retail.v2.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, + {} | null | undefined + > + ): void; + completeQuery( + request: protos.google.cloud.retail.v2.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.retail.v2.ICompleteQueryResponse, + protos.google.cloud.retail.v2.ICompleteQueryRequest | null | undefined, + {} | null | undefined + > + ): void; completeQuery( request?: protos.google.cloud.retail.v2.ICompleteQueryRequest, optionsOrCallback?: @@ -483,6 +483,41 @@ export class CompletionServiceClient { return this.innerApiCalls.completeQuery(request, options, callback); } + /** + * Bulk import of processed completion dataset. + * + * Request processing may be synchronous. Partial updating is not supported. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog which the suggestions dataset belongs to. + * + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2.CompletionDataInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/completion_service.import_completion_data.js + * region_tag:retail_v2_generated_CompletionService_ImportCompletionData_async + */ importCompletionData( request?: protos.google.cloud.retail.v2.IImportCompletionDataRequest, options?: CallOptions @@ -519,42 +554,6 @@ export class CompletionServiceClient { {} | null | undefined > ): void; - /** - * Bulk import of processed completion dataset. - * - * Request processing may be synchronous. Partial updating is not supported. - * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog which the suggestions dataset belongs to. - * - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2.CompletionDataInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a - * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importCompletionData(request); - * const [response] = await operation.promise(); - */ importCompletionData( request?: protos.google.cloud.retail.v2.IImportCompletionDataRequest, optionsOrCallback?: @@ -612,11 +611,8 @@ export class CompletionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportCompletionDataProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/completion_service.import_completion_data.js + * region_tag:retail_v2_generated_CompletionService_ImportCompletionData_async */ async checkImportCompletionDataProgress( name: string diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index d2b85fcfa8c..4ff765ed50b 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -294,33 +294,6 @@ export class PredictionServiceClient { // ------------------- // -- Service calls -- // ------------------- - predict( - request?: protos.google.cloud.retail.v2.IPredictRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.IPredictResponse, - protos.google.cloud.retail.v2.IPredictRequest | undefined, - {} | undefined - ] - >; - predict( - request: protos.google.cloud.retail.v2.IPredictRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2.IPredictResponse, - protos.google.cloud.retail.v2.IPredictRequest | null | undefined, - {} | null | undefined - > - ): void; - predict( - request: protos.google.cloud.retail.v2.IPredictRequest, - callback: Callback< - protos.google.cloud.retail.v2.IPredictResponse, - protos.google.cloud.retail.v2.IPredictRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Makes a recommendation prediction. * @@ -431,9 +404,36 @@ export class PredictionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.predict(request); + * @example include:samples/generated/v2/prediction_service.predict.js + * region_tag:retail_v2_generated_PredictionService_Predict_async */ + predict( + request?: protos.google.cloud.retail.v2.IPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | undefined, + {} | undefined + ] + >; + predict( + request: protos.google.cloud.retail.v2.IPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + predict( + request: protos.google.cloud.retail.v2.IPredictRequest, + callback: Callback< + protos.google.cloud.retail.v2.IPredictResponse, + protos.google.cloud.retail.v2.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; predict( request?: protos.google.cloud.retail.v2.IPredictRequest, optionsOrCallback?: diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 93f17ab41ef..46c20ec7617 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -397,33 +397,6 @@ export class ProductServiceClient { // ------------------- // -- Service calls -- // ------------------- - createProduct( - request?: protos.google.cloud.retail.v2.ICreateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.IProduct, - protos.google.cloud.retail.v2.ICreateProductRequest | undefined, - {} | undefined - ] - >; - createProduct( - request: protos.google.cloud.retail.v2.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2.IProduct, - protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, - {} | null | undefined - > - ): void; - createProduct( - request: protos.google.cloud.retail.v2.ICreateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2.IProduct, - protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Creates a {@link google.cloud.retail.v2.Product|Product}. * @@ -457,9 +430,36 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.createProduct(request); + * @example include:samples/generated/v2/product_service.create_product.js + * region_tag:retail_v2_generated_ProductService_CreateProduct_async */ + createProduct( + request?: protos.google.cloud.retail.v2.ICreateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protos.google.cloud.retail.v2.ICreateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, + {} | null | undefined + > + ): void; + createProduct( + request: protos.google.cloud.retail.v2.ICreateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, + {} | null | undefined + > + ): void; createProduct( request?: protos.google.cloud.retail.v2.ICreateProductRequest, optionsOrCallback?: @@ -501,6 +501,32 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); } + /** + * Gets a {@link google.cloud.retail.v2.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * + * If the requested {@link google.cloud.retail.v2.Product|Product} does not exist, + * a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/product_service.get_product.js + * region_tag:retail_v2_generated_ProductService_GetProduct_async + */ getProduct( request?: protos.google.cloud.retail.v2.IGetProductRequest, options?: CallOptions @@ -528,32 +554,6 @@ export class ProductServiceClient { {} | null | undefined > ): void; - /** - * Gets a {@link google.cloud.retail.v2.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 - * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it - * exists, a PERMISSION_DENIED error is returned. - * - * If the requested {@link google.cloud.retail.v2.Product|Product} does not exist, - * a NOT_FOUND error is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2.Product}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getProduct(request); - */ getProduct( request?: protos.google.cloud.retail.v2.IGetProductRequest, optionsOrCallback?: @@ -593,33 +593,6 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); } - updateProduct( - request?: protos.google.cloud.retail.v2.IUpdateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.IProduct, - protos.google.cloud.retail.v2.IUpdateProductRequest | undefined, - {} | undefined - ] - >; - updateProduct( - request: protos.google.cloud.retail.v2.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2.IProduct, - protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request: protos.google.cloud.retail.v2.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2.IProduct, - protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Updates a {@link google.cloud.retail.v2.Product|Product}. * @@ -655,9 +628,36 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.updateProduct(request); + * @example include:samples/generated/v2/product_service.update_product.js + * region_tag:retail_v2_generated_ProductService_UpdateProduct_async */ + updateProduct( + request?: protos.google.cloud.retail.v2.IUpdateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protos.google.cloud.retail.v2.IUpdateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, + {} | null | undefined + > + ): void; + updateProduct( + request: protos.google.cloud.retail.v2.IUpdateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2.IProduct, + protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, + {} | null | undefined + > + ): void; updateProduct( request?: protos.google.cloud.retail.v2.IUpdateProductRequest, optionsOrCallback?: @@ -699,33 +699,6 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); } - deleteProduct( - request?: protos.google.cloud.retail.v2.IDeleteProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.IDeleteProductRequest | undefined, - {} | undefined - ] - >; - deleteProduct( - request: protos.google.cloud.retail.v2.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request: protos.google.cloud.retail.v2.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Deletes a {@link google.cloud.retail.v2.Product|Product}. * @@ -760,9 +733,36 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.deleteProduct(request); + * @example include:samples/generated/v2/product_service.delete_product.js + * region_tag:retail_v2_generated_ProductService_DeleteProduct_async */ + deleteProduct( + request?: protos.google.cloud.retail.v2.IDeleteProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protos.google.cloud.retail.v2.IDeleteProductRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteProduct( + request: protos.google.cloud.retail.v2.IDeleteProductRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, + {} | null | undefined + > + ): void; deleteProduct( request?: protos.google.cloud.retail.v2.IDeleteProductRequest, optionsOrCallback?: @@ -805,42 +805,6 @@ export class ProductServiceClient { return this.innerApiCalls.deleteProduct(request, options, callback); } - importProducts( - request?: protos.google.cloud.retail.v2.IImportProductsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2.IImportProductsResponse, - protos.google.cloud.retail.v2.IImportMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - importProducts( - request: protos.google.cloud.retail.v2.IImportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IImportProductsResponse, - protos.google.cloud.retail.v2.IImportMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProducts( - request: protos.google.cloud.retail.v2.IImportProductsRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IImportProductsResponse, - protos.google.cloud.retail.v2.IImportMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Bulk import of multiple {@link google.cloud.retail.v2.Product|Product}s. * @@ -898,10 +862,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.importProducts(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2/product_service.import_products.js + * region_tag:retail_v2_generated_ProductService_ImportProducts_async */ + importProducts( + request?: protos.google.cloud.retail.v2.IImportProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProducts( + request: protos.google.cloud.retail.v2.IImportProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importProducts( + request: protos.google.cloud.retail.v2.IImportProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IImportProductsResponse, + protos.google.cloud.retail.v2.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; importProducts( request?: protos.google.cloud.retail.v2.IImportProductsRequest, optionsOrCallback?: @@ -959,70 +958,31 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportProductsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/product_service.import_products.js + * region_tag:retail_v2_generated_ProductService_ImportProducts_async */ async checkImportProductsProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.retail.v2.ImportProductsResponse, - protos.google.cloud.retail.v2.ImportMetadata - > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.importProducts, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.retail.v2.ImportProductsResponse, - protos.google.cloud.retail.v2.ImportMetadata - >; - } - setInventory( - request?: protos.google.cloud.retail.v2.ISetInventoryRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2.ISetInventoryResponse, - protos.google.cloud.retail.v2.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - setInventory( - request: protos.google.cloud.retail.v2.ISetInventoryRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.ISetInventoryResponse, - protos.google.cloud.retail.v2.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - setInventory( - request: protos.google.cloud.retail.v2.ISetInventoryRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.ISetInventoryResponse, - protos.google.cloud.retail.v2.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.ImportProductsResponse, + protos.google.cloud.retail.v2.ImportMetadata > - ): void; + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importProducts, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.ImportProductsResponse, + protos.google.cloud.retail.v2.ImportMetadata + >; + } /** * Updates inventory information for a * {@link google.cloud.retail.v2.Product|Product} while respecting the last update @@ -1130,10 +1090,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.setInventory(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2/product_service.set_inventory.js + * region_tag:retail_v2_generated_ProductService_SetInventory_async */ + setInventory( + request?: protos.google.cloud.retail.v2.ISetInventoryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setInventory( + request: protos.google.cloud.retail.v2.ISetInventoryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setInventory( + request: protos.google.cloud.retail.v2.ISetInventoryRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.ISetInventoryResponse, + protos.google.cloud.retail.v2.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; setInventory( request?: protos.google.cloud.retail.v2.ISetInventoryRequest, optionsOrCallback?: @@ -1191,11 +1186,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkSetInventoryProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/product_service.set_inventory.js + * region_tag:retail_v2_generated_ProductService_SetInventory_async */ async checkSetInventoryProgress( name: string @@ -1219,42 +1211,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.SetInventoryMetadata >; } - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Incrementally adds place IDs to * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. @@ -1338,10 +1294,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.addFulfillmentPlaces(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2/product_service.add_fulfillment_places.js + * region_tag:retail_v2_generated_ProductService_AddFulfillmentPlaces_async */ + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; addFulfillmentPlaces( request?: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, optionsOrCallback?: @@ -1399,11 +1390,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkAddFulfillmentPlacesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/product_service.add_fulfillment_places.js + * region_tag:retail_v2_generated_ProductService_AddFulfillmentPlaces_async */ async checkAddFulfillmentPlacesProgress( name: string @@ -1427,42 +1415,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.AddFulfillmentPlacesMetadata >; } - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Incrementally removes place IDs from a * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. @@ -1541,10 +1493,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.removeFulfillmentPlaces(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2/product_service.remove_fulfillment_places.js + * region_tag:retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async */ + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; removeFulfillmentPlaces( request?: protos.google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, optionsOrCallback?: @@ -1606,11 +1593,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRemoveFulfillmentPlacesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/product_service.remove_fulfillment_places.js + * region_tag:retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async */ async checkRemoveFulfillmentPlacesProgress( name: string @@ -1634,33 +1618,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata >; } - listProducts( - request?: protos.google.cloud.retail.v2.IListProductsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.IProduct[], - protos.google.cloud.retail.v2.IListProductsRequest | null, - protos.google.cloud.retail.v2.IListProductsResponse - ] - >; - listProducts( - request: protos.google.cloud.retail.v2.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2.IListProductsRequest, - protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, - protos.google.cloud.retail.v2.IProduct - > - ): void; - listProducts( - request: protos.google.cloud.retail.v2.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2.IListProductsRequest, - protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, - protos.google.cloud.retail.v2.IProduct - > - ): void; /** * Gets a list of {@link google.cloud.retail.v2.Product|Product}s. * @@ -1752,6 +1709,33 @@ export class ProductServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listProducts( + request?: protos.google.cloud.retail.v2.IListProductsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IProduct[], + protos.google.cloud.retail.v2.IListProductsRequest | null, + protos.google.cloud.retail.v2.IListProductsResponse + ] + >; + listProducts( + request: protos.google.cloud.retail.v2.IListProductsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListProductsRequest, + protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, + protos.google.cloud.retail.v2.IProduct + > + ): void; + listProducts( + request: protos.google.cloud.retail.v2.IListProductsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListProductsRequest, + protos.google.cloud.retail.v2.IListProductsResponse | null | undefined, + protos.google.cloud.retail.v2.IProduct + > + ): void; listProducts( request?: protos.google.cloud.retail.v2.IListProductsRequest, optionsOrCallback?: @@ -1994,11 +1978,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listProductsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2/product_service.list_products.js + * region_tag:retail_v2_generated_ProductService_ListProducts_async */ listProductsAsync( request?: protos.google.cloud.retail.v2.IListProductsRequest, @@ -2012,7 +1993,6 @@ export class ProductServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index e2652fe8cc9..e70153e5fa5 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -322,33 +322,6 @@ export class SearchServiceClient { // -- Service calls -- // ------------------- - search( - request?: protos.google.cloud.retail.v2.ISearchRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2.ISearchRequest | null, - protos.google.cloud.retail.v2.ISearchResponse - ] - >; - search( - request: protos.google.cloud.retail.v2.ISearchRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2.ISearchRequest, - protos.google.cloud.retail.v2.ISearchResponse | null | undefined, - protos.google.cloud.retail.v2.SearchResponse.ISearchResult - > - ): void; - search( - request: protos.google.cloud.retail.v2.ISearchRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2.ISearchRequest, - protos.google.cloud.retail.v2.ISearchResponse | null | undefined, - protos.google.cloud.retail.v2.SearchResponse.ISearchResult - > - ): void; /** * Performs a search. * @@ -547,6 +520,33 @@ export class SearchServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + search( + request?: protos.google.cloud.retail.v2.ISearchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2.ISearchRequest | null, + protos.google.cloud.retail.v2.ISearchResponse + ] + >; + search( + request: protos.google.cloud.retail.v2.ISearchRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.ISearchRequest, + protos.google.cloud.retail.v2.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2.SearchResponse.ISearchResult + > + ): void; + search( + request: protos.google.cloud.retail.v2.ISearchRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.ISearchRequest, + protos.google.cloud.retail.v2.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2.SearchResponse.ISearchResult + > + ): void; search( request?: protos.google.cloud.retail.v2.ISearchRequest, optionsOrCallback?: @@ -993,11 +993,8 @@ export class SearchServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.searchAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2/search_service.search.js + * region_tag:retail_v2_generated_SearchService_Search_async */ searchAsync( request?: protos.google.cloud.retail.v2.ISearchRequest, @@ -1011,7 +1008,6 @@ export class SearchServiceClient { gax.routingHeader.fromParams({ placement: request.placement || '', }); - options = options || {}; const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 0d05bdb6998..8e8a3289578 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -356,6 +356,26 @@ export class UserEventServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Writes a single user event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2.UserEvent} request.userEvent + * Required. User event to write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2.UserEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/user_event_service.write_user_event.js + * region_tag:retail_v2_generated_UserEventService_WriteUserEvent_async + */ writeUserEvent( request?: protos.google.cloud.retail.v2.IWriteUserEventRequest, options?: CallOptions @@ -383,26 +403,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * Writes a single user event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2.UserEvent} request.userEvent - * Required. User event to write. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2.UserEvent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.writeUserEvent(request); - */ writeUserEvent( request?: protos.google.cloud.retail.v2.IWriteUserEventRequest, optionsOrCallback?: @@ -444,33 +444,6 @@ export class UserEventServiceClient { this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); } - collectUserEvent( - request?: protos.google.cloud.retail.v2.ICollectUserEventRequest, - options?: CallOptions - ): Promise< - [ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2.ICollectUserEventRequest | undefined, - {} | undefined - ] - >; - collectUserEvent( - request: protos.google.cloud.retail.v2.ICollectUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, - {} | null | undefined - > - ): void; - collectUserEvent( - request: protos.google.cloud.retail.v2.ICollectUserEventRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, - {} | null | undefined - > - ): void; /** * 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. @@ -502,9 +475,36 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.collectUserEvent(request); + * @example include:samples/generated/v2/user_event_service.collect_user_event.js + * region_tag:retail_v2_generated_UserEventService_CollectUserEvent_async */ + collectUserEvent( + request?: protos.google.cloud.retail.v2.ICollectUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | undefined, + {} | undefined + ] + >; + collectUserEvent( + request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, + {} | null | undefined + > + ): void; + collectUserEvent( + request: protos.google.cloud.retail.v2.ICollectUserEventRequest, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, + {} | null | undefined + > + ): void; collectUserEvent( request?: protos.google.cloud.retail.v2.ICollectUserEventRequest, optionsOrCallback?: @@ -547,42 +547,6 @@ export class UserEventServiceClient { return this.innerApiCalls.collectUserEvent(request, options, callback); } - purgeUserEvents( - request?: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2.IPurgeMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - purgeUserEvents( - request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2.IPurgeMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeUserEvents( - request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2.IPurgeMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Deletes permanently all user events specified by the filter provided. * Depending on the number of events specified by the filter, this operation @@ -632,10 +596,45 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.purgeUserEvents(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2/user_event_service.purge_user_events.js + * region_tag:retail_v2_generated_UserEventService_PurgeUserEvents_async */ + purgeUserEvents( + request?: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeUserEvents( + request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeUserEvents( + request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; purgeUserEvents( request?: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, optionsOrCallback?: @@ -693,11 +692,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkPurgeUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/user_event_service.purge_user_events.js + * region_tag:retail_v2_generated_UserEventService_PurgeUserEvents_async */ async checkPurgeUserEventsProgress( name: string @@ -721,6 +717,36 @@ export class UserEventServiceClient { protos.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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. `projects/1234/locations/global/catalogs/default_catalog` + * @param {google.cloud.retail.v2.UserEventInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/user_event_service.import_user_events.js + * region_tag:retail_v2_generated_UserEventService_ImportUserEvents_async + */ importUserEvents( request?: protos.google.cloud.retail.v2.IImportUserEventsRequest, options?: CallOptions @@ -757,37 +783,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2.UserEventInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importUserEvents(request); - * const [response] = await operation.promise(); - */ importUserEvents( request?: protos.google.cloud.retail.v2.IImportUserEventsRequest, optionsOrCallback?: @@ -845,11 +840,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/user_event_service.import_user_events.js + * region_tag:retail_v2_generated_UserEventService_ImportUserEvents_async */ async checkImportUserEventsProgress( name: string @@ -873,6 +865,37 @@ export class UserEventServiceClient { protos.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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/user_event_service.rejoin_user_events.js + * region_tag:retail_v2_generated_UserEventService_RejoinUserEvents_async + */ rejoinUserEvents( request?: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, options?: CallOptions @@ -909,38 +932,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} request.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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.rejoinUserEvents(request); - * const [response] = await operation.promise(); - */ rejoinUserEvents( request?: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, optionsOrCallback?: @@ -998,11 +989,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRejoinUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2/user_event_service.rejoin_user_events.js + * region_tag:retail_v2_generated_UserEventService_RejoinUserEvents_async */ async checkRejoinUserEventsProgress( name: string diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 67bba9a009b..f9ce0a35cbf 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -325,6 +325,36 @@ export class CatalogServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Updates the {@link google.cloud.retail.v2alpha.Catalog|Catalog}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.Catalog} request.catalog + * Required. The {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2alpha.Catalog|Catalog}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update does not + * exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2alpha.Catalog}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.update_catalog.js + * region_tag:retail_v2alpha_generated_CatalogService_UpdateCatalog_async + */ updateCatalog( request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, options?: CallOptions @@ -356,36 +386,6 @@ export class CatalogServiceClient { {} | null | undefined > ): void; - /** - * Updates the {@link google.cloud.retail.v2alpha.Catalog|Catalog}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Catalog} request.catalog - * Required. The {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. - * - * If the caller does not have permission to update the - * {@link google.cloud.retail.v2alpha.Catalog|Catalog}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update does not - * exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link google.cloud.retail.v2alpha.Catalog|Catalog} to update. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2alpha.Catalog}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateCatalog(request); - */ updateCatalog( request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, optionsOrCallback?: @@ -429,37 +429,6 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, - {} | undefined - ] - >; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest - | null - | undefined, - {} | null | undefined - > - ): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Set a specified branch id as default branch. API methods such as * {@link google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search}, @@ -523,9 +492,40 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.setDefaultBranch(request); + * @example include:samples/generated/v2alpha/catalog_service.set_default_branch.js + * region_tag:retail_v2alpha_generated_CatalogService_SetDefaultBranch_async */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; setDefaultBranch( request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, optionsOrCallback?: @@ -569,6 +569,30 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.setDefaultBranch(request, options, callback); } + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2alpha.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.get_default_branch.js + * region_tag:retail_v2alpha_generated_CatalogService_GetDefaultBranch_async + */ getDefaultBranch( request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, options?: CallOptions @@ -600,30 +624,6 @@ export class CatalogServiceClient { {} | null | undefined > ): void; - /** - * Get which branch is currently default branch set by - * {@link google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. - * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2alpha.GetDefaultBranchResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getDefaultBranch(request); - */ getDefaultBranch( request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, optionsOrCallback?: @@ -668,37 +668,6 @@ export class CatalogServiceClient { return this.innerApiCalls.getDefaultBranch(request, options, callback); } - listCatalogs( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest | null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ] - >; - listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - | protos.google.cloud.retail.v2alpha.IListCatalogsResponse - | null - | undefined, - protos.google.cloud.retail.v2alpha.ICatalog - > - ): void; - listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - | protos.google.cloud.retail.v2alpha.IListCatalogsResponse - | null - | undefined, - protos.google.cloud.retail.v2alpha.ICatalog - > - ): void; /** * Lists all the {@link google.cloud.retail.v2alpha.Catalog|Catalog}s associated * with the project. @@ -742,6 +711,37 @@ export class CatalogServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listCatalogs( + request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICatalog[], + protos.google.cloud.retail.v2alpha.IListCatalogsRequest | null, + protos.google.cloud.retail.v2alpha.IListCatalogsResponse + ] + >; + listCatalogs( + request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + | protos.google.cloud.retail.v2alpha.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.ICatalog + > + ): void; + listCatalogs( + request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListCatalogsRequest, + | protos.google.cloud.retail.v2alpha.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.ICatalog + > + ): void; listCatalogs( request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, optionsOrCallback?: @@ -888,11 +888,8 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listCatalogsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2alpha/catalog_service.list_catalogs.js + * region_tag:retail_v2alpha_generated_CatalogService_ListCatalogs_async */ listCatalogsAsync( request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, @@ -906,7 +903,6 @@ export class CatalogServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index a0d87d38c11..428558ac04e 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -335,37 +335,6 @@ export class CompletionServiceClient { // ------------------- // -- Service calls -- // ------------------- - completeQuery( - request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest | undefined, - {} | undefined - ] - >; - completeQuery( - request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest - | null - | undefined, - {} | null | undefined - > - ): void; - completeQuery( - request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Completes the specified prefix with keyword suggestions. * @@ -443,9 +412,40 @@ export class CompletionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.completeQuery(request); + * @example include:samples/generated/v2alpha/completion_service.complete_query.js + * region_tag:retail_v2alpha_generated_CompletionService_CompleteQuery_async */ + completeQuery( + request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + protos.google.cloud.retail.v2alpha.ICompleteQueryRequest | undefined, + {} | undefined + ] + >; + completeQuery( + request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeQuery( + request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, + | protos.google.cloud.retail.v2alpha.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; completeQuery( request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, optionsOrCallback?: @@ -490,6 +490,41 @@ export class CompletionServiceClient { return this.innerApiCalls.completeQuery(request, options, callback); } + /** + * Bulk import of processed completion dataset. + * + * Request processing may be synchronous. Partial updating is not supported. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog which the suggestions dataset belongs to. + * + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/completion_service.import_completion_data.js + * region_tag:retail_v2alpha_generated_CompletionService_ImportCompletionData_async + */ importCompletionData( request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, options?: CallOptions @@ -526,42 +561,6 @@ export class CompletionServiceClient { {} | null | undefined > ): void; - /** - * Bulk import of processed completion dataset. - * - * Request processing may be synchronous. Partial updating is not supported. - * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog which the suggestions dataset belongs to. - * - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a - * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importCompletionData(request); - * const [response] = await operation.promise(); - */ importCompletionData( request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, optionsOrCallback?: @@ -619,11 +618,8 @@ export class CompletionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportCompletionDataProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/completion_service.import_completion_data.js + * region_tag:retail_v2alpha_generated_CompletionService_ImportCompletionData_async */ async checkImportCompletionDataProgress( name: string diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index a67a696e9ad..46349b02da0 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -294,33 +294,6 @@ export class PredictionServiceClient { // ------------------- // -- Service calls -- // ------------------- - predict( - request?: protos.google.cloud.retail.v2alpha.IPredictRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest | undefined, - {} | undefined - ] - >; - predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, - {} | null | undefined - > - ): void; - predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Makes a recommendation prediction. * @@ -431,9 +404,36 @@ export class PredictionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.predict(request); + * @example include:samples/generated/v2alpha/prediction_service.predict.js + * region_tag:retail_v2alpha_generated_PredictionService_Predict_async */ + predict( + request?: protos.google.cloud.retail.v2alpha.IPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | undefined, + {} | undefined + ] + >; + predict( + request: protos.google.cloud.retail.v2alpha.IPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + predict( + request: protos.google.cloud.retail.v2alpha.IPredictRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IPredictResponse, + protos.google.cloud.retail.v2alpha.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; predict( request?: protos.google.cloud.retail.v2alpha.IPredictRequest, optionsOrCallback?: diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index f9dca65909b..51778d106b8 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -425,37 +425,6 @@ export class ProductServiceClient { // ------------------- // -- Service calls -- // ------------------- - createProduct( - request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest | undefined, - {} | undefined - ] - >; - createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - | protos.google.cloud.retail.v2alpha.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - | protos.google.cloud.retail.v2alpha.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Creates a {@link google.cloud.retail.v2alpha.Product|Product}. * @@ -489,9 +458,40 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.createProduct(request); + * @example include:samples/generated/v2alpha/product_service.create_product.js + * region_tag:retail_v2alpha_generated_ProductService_CreateProduct_async */ + createProduct( + request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProduct( + request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; createProduct( request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, optionsOrCallback?: @@ -535,6 +535,32 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); } + /** + * Gets a {@link google.cloud.retail.v2alpha.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of + * {@link google.cloud.retail.v2alpha.Product|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 + * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or + * not it exists, a PERMISSION_DENIED error is returned. + * + * If the requested {@link google.cloud.retail.v2alpha.Product|Product} does not + * exist, a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2alpha.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/product_service.get_product.js + * region_tag:retail_v2alpha_generated_ProductService_GetProduct_async + */ getProduct( request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, options?: CallOptions @@ -562,32 +588,6 @@ export class ProductServiceClient { {} | null | undefined > ): void; - /** - * Gets a {@link google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of - * {@link google.cloud.retail.v2alpha.Product|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 - * {@link google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the requested {@link google.cloud.retail.v2alpha.Product|Product} does not - * exist, a NOT_FOUND error is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2alpha.Product}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getProduct(request); - */ getProduct( request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, optionsOrCallback?: @@ -629,37 +629,6 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); } - updateProduct( - request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest | undefined, - {} | undefined - ] - >; - updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - | protos.google.cloud.retail.v2alpha.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - | protos.google.cloud.retail.v2alpha.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Updates a {@link google.cloud.retail.v2alpha.Product|Product}. * @@ -695,9 +664,40 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.updateProduct(request); + * @example include:samples/generated/v2alpha/product_service.update_product.js + * region_tag:retail_v2alpha_generated_ProductService_UpdateProduct_async */ + updateProduct( + request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct, + protos.google.cloud.retail.v2alpha.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateProduct( + request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IProduct, + | protos.google.cloud.retail.v2alpha.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; updateProduct( request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, optionsOrCallback?: @@ -741,37 +741,6 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); } - deleteProduct( - request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest | undefined, - {} | undefined - ] - >; - deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Deletes a {@link google.cloud.retail.v2alpha.Product|Product}. * @@ -807,9 +776,40 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.deleteProduct(request); + * @example include:samples/generated/v2alpha/product_service.delete_product.js + * region_tag:retail_v2alpha_generated_ProductService_DeleteProduct_async */ + deleteProduct( + request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteProduct( + request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; deleteProduct( request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, optionsOrCallback?: @@ -854,42 +854,6 @@ export class ProductServiceClient { return this.innerApiCalls.deleteProduct(request, options, callback); } - importProducts( - request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.IImportProductsResponse, - protos.google.cloud.retail.v2alpha.IImportMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IImportProductsResponse, - protos.google.cloud.retail.v2alpha.IImportMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IImportProductsResponse, - protos.google.cloud.retail.v2alpha.IImportMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Bulk import of multiple {@link google.cloud.retail.v2alpha.Product|Product}s. * @@ -947,10 +911,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.importProducts(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/product_service.import_products.js + * region_tag:retail_v2alpha_generated_ProductService_ImportProducts_async */ + importProducts( + request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProducts( + request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importProducts( + request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IImportProductsResponse, + protos.google.cloud.retail.v2alpha.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; importProducts( request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, optionsOrCallback?: @@ -1008,11 +1007,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportProductsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/product_service.import_products.js + * region_tag:retail_v2alpha_generated_ProductService_ImportProducts_async */ async checkImportProductsProgress( name: string @@ -1036,42 +1032,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.ImportMetadata >; } - setInventory( - request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.ISetInventoryResponse, - protos.google.cloud.retail.v2alpha.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - setInventory( - request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.ISetInventoryResponse, - protos.google.cloud.retail.v2alpha.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - setInventory( - request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.ISetInventoryResponse, - protos.google.cloud.retail.v2alpha.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Updates inventory information for a * {@link google.cloud.retail.v2alpha.Product|Product} while respecting the last @@ -1181,10 +1141,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.setInventory(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/product_service.set_inventory.js + * region_tag:retail_v2alpha_generated_ProductService_SetInventory_async */ + setInventory( + request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setInventory( + request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setInventory( + request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ISetInventoryResponse, + protos.google.cloud.retail.v2alpha.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; setInventory( request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, optionsOrCallback?: @@ -1242,11 +1237,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkSetInventoryProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/product_service.set_inventory.js + * region_tag:retail_v2alpha_generated_ProductService_SetInventory_async */ async checkSetInventoryProgress( name: string @@ -1270,42 +1262,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.SetInventoryMetadata >; } - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Incrementally adds place IDs to * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. @@ -1389,10 +1345,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.addFulfillmentPlaces(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/product_service.add_fulfillment_places.js + * region_tag:retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async */ + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; addFulfillmentPlaces( request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, optionsOrCallback?: @@ -1450,11 +1441,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkAddFulfillmentPlacesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/product_service.add_fulfillment_places.js + * region_tag:retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async */ async checkAddFulfillmentPlacesProgress( name: string @@ -1465,55 +1453,19 @@ export class ProductServiceClient { > > { const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.addFulfillmentPlaces, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - >; - } - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addFulfillmentPlaces, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + >; + } /** * Incrementally removes place IDs from a * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. @@ -1592,10 +1544,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.removeFulfillmentPlaces(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/product_service.remove_fulfillment_places.js + * region_tag:retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async */ + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; removeFulfillmentPlaces( request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, optionsOrCallback?: @@ -1657,11 +1644,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRemoveFulfillmentPlacesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/product_service.remove_fulfillment_places.js + * region_tag:retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async */ async checkRemoveFulfillmentPlacesProgress( name: string @@ -1685,42 +1669,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata >; } - addLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, - protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - addLocalInventories( - request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, - protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - addLocalInventories( - request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, - protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Updates local inventory information for a * {@link google.cloud.retail.v2alpha.Product|Product} at a list of places, while @@ -1795,10 +1743,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.addLocalInventories(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/product_service.add_local_inventories.js + * region_tag:retail_v2alpha_generated_ProductService_AddLocalInventories_async */ + addLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addLocalInventories( + request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; addLocalInventories( request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, optionsOrCallback?: @@ -1856,11 +1839,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkAddLocalInventoriesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/product_service.add_local_inventories.js + * region_tag:retail_v2alpha_generated_ProductService_AddLocalInventories_async */ async checkAddLocalInventoriesProgress( name: string @@ -1884,42 +1864,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata >; } - removeLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, - protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - removeLocalInventories( - request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, - protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - removeLocalInventories( - request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, - protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Remove local inventory information for a * {@link google.cloud.retail.v2alpha.Product|Product} at a list of places at a @@ -1975,10 +1919,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.removeLocalInventories(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/product_service.remove_local_inventories.js + * region_tag:retail_v2alpha_generated_ProductService_RemoveLocalInventories_async */ + removeLocalInventories( + request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeLocalInventories( + request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; removeLocalInventories( request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, optionsOrCallback?: @@ -2040,11 +2019,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRemoveLocalInventoriesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/product_service.remove_local_inventories.js + * region_tag:retail_v2alpha_generated_ProductService_RemoveLocalInventories_async */ async checkRemoveLocalInventoriesProgress( name: string @@ -2068,37 +2044,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata >; } - listProducts( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest | null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ] - >; - listProducts( - request: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - | protos.google.cloud.retail.v2alpha.IListProductsResponse - | null - | undefined, - protos.google.cloud.retail.v2alpha.IProduct - > - ): void; - listProducts( - request: protos.google.cloud.retail.v2alpha.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - | protos.google.cloud.retail.v2alpha.IListProductsResponse - | null - | undefined, - protos.google.cloud.retail.v2alpha.IProduct - > - ): void; /** * Gets a list of {@link google.cloud.retail.v2alpha.Product|Product}s. * @@ -2200,6 +2145,37 @@ export class ProductServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listProducts( + request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IProduct[], + protos.google.cloud.retail.v2alpha.IListProductsRequest | null, + protos.google.cloud.retail.v2alpha.IListProductsResponse + ] + >; + listProducts( + request: protos.google.cloud.retail.v2alpha.IListProductsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListProductsRequest, + | protos.google.cloud.retail.v2alpha.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IProduct + > + ): void; + listProducts( + request: protos.google.cloud.retail.v2alpha.IListProductsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListProductsRequest, + | protos.google.cloud.retail.v2alpha.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IProduct + > + ): void; listProducts( request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, optionsOrCallback?: @@ -2464,11 +2440,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listProductsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2alpha/product_service.list_products.js + * region_tag:retail_v2alpha_generated_ProductService_ListProducts_async */ listProductsAsync( request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, @@ -2482,7 +2455,6 @@ export class ProductServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 7322541eb8e..26fbaff142d 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -322,33 +322,6 @@ export class SearchServiceClient { // -- Service calls -- // ------------------- - search( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest | null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ] - >; - search( - request: protos.google.cloud.retail.v2alpha.ISearchRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult - > - ): void; - search( - request: protos.google.cloud.retail.v2alpha.ISearchRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult - > - ): void; /** * Performs a search. * @@ -569,6 +542,33 @@ export class SearchServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + search( + request?: protos.google.cloud.retail.v2alpha.ISearchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2alpha.ISearchRequest | null, + protos.google.cloud.retail.v2alpha.ISearchResponse + ] + >; + search( + request: protos.google.cloud.retail.v2alpha.ISearchRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.ISearchRequest, + protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult + > + ): void; + search( + request: protos.google.cloud.retail.v2alpha.ISearchRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.ISearchRequest, + protos.google.cloud.retail.v2alpha.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult + > + ): void; search( request?: protos.google.cloud.retail.v2alpha.ISearchRequest, optionsOrCallback?: @@ -1059,11 +1059,8 @@ export class SearchServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.searchAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2alpha/search_service.search.js + * region_tag:retail_v2alpha_generated_SearchService_Search_async */ searchAsync( request?: protos.google.cloud.retail.v2alpha.ISearchRequest, @@ -1077,7 +1074,6 @@ export class SearchServiceClient { gax.routingHeader.fromParams({ placement: request.placement || '', }); - options = options || {}; const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 785f8e7d411..6092fdc96f7 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -356,6 +356,26 @@ export class UserEventServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Writes a single user event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent + * Required. User event to write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2alpha.UserEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/user_event_service.write_user_event.js + * region_tag:retail_v2alpha_generated_UserEventService_WriteUserEvent_async + */ writeUserEvent( request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, options?: CallOptions @@ -387,26 +407,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * Writes a single user event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent - * Required. User event to write. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2alpha.UserEvent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.writeUserEvent(request); - */ writeUserEvent( request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, optionsOrCallback?: @@ -450,37 +450,6 @@ export class UserEventServiceClient { this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); } - collectUserEvent( - request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - options?: CallOptions - ): Promise< - [ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest | undefined, - {} | undefined - ] - >; - collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest - | null - | undefined, - {} | null | undefined - > - ): void; - collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - callback: Callback< - protos.google.api.IHttpBody, - | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * 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. @@ -512,9 +481,40 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.collectUserEvent(request); + * @example include:samples/generated/v2alpha/user_event_service.collect_user_event.js + * region_tag:retail_v2alpha_generated_UserEventService_CollectUserEvent_async */ + collectUserEvent( + request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2alpha.ICollectUserEventRequest | undefined, + {} | undefined + ] + >; + collectUserEvent( + request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + collectUserEvent( + request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2alpha.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; collectUserEvent( request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, optionsOrCallback?: @@ -559,42 +559,6 @@ export class UserEventServiceClient { return this.innerApiCalls.collectUserEvent(request, options, callback); } - purgeUserEvents( - request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2alpha.IPurgeMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2alpha.IPurgeMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2alpha.IPurgeMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Deletes permanently all user events specified by the filter provided. * Depending on the number of events specified by the filter, this operation @@ -645,10 +609,45 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.purgeUserEvents(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2alpha/user_event_service.purge_user_events.js + * region_tag:retail_v2alpha_generated_UserEventService_PurgeUserEvents_async */ + purgeUserEvents( + request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeUserEvents( + request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeUserEvents( + request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2alpha.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; purgeUserEvents( request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, optionsOrCallback?: @@ -706,11 +705,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkPurgeUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/user_event_service.purge_user_events.js + * region_tag:retail_v2alpha_generated_UserEventService_PurgeUserEvents_async */ async checkPurgeUserEventsProgress( name: string @@ -734,6 +730,36 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2alpha.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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. `projects/1234/locations/global/catalogs/default_catalog` + * @param {google.cloud.retail.v2alpha.UserEventInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/user_event_service.import_user_events.js + * region_tag:retail_v2alpha_generated_UserEventService_ImportUserEvents_async + */ importUserEvents( request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, options?: CallOptions @@ -770,37 +796,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2alpha.UserEventInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importUserEvents(request); - * const [response] = await operation.promise(); - */ importUserEvents( request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, optionsOrCallback?: @@ -858,11 +853,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/user_event_service.import_user_events.js + * region_tag:retail_v2alpha_generated_UserEventService_ImportUserEvents_async */ async checkImportUserEventsProgress( name: string @@ -886,6 +878,37 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2alpha.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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/user_event_service.rejoin_user_events.js + * region_tag:retail_v2alpha_generated_UserEventService_RejoinUserEvents_async + */ rejoinUserEvents( request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, options?: CallOptions @@ -922,38 +945,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} request.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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.rejoinUserEvents(request); - * const [response] = await operation.promise(); - */ rejoinUserEvents( request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, optionsOrCallback?: @@ -1011,11 +1002,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRejoinUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2alpha/user_event_service.rejoin_user_events.js + * region_tag:retail_v2alpha_generated_UserEventService_RejoinUserEvents_async */ async checkRejoinUserEventsProgress( name: string diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index add23f8f3b7..b490b61567b 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -325,6 +325,36 @@ export class CatalogServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Updates the {@link google.cloud.retail.v2beta.Catalog|Catalog}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.Catalog} request.catalog + * Required. The {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2beta.Catalog|Catalog}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2beta.Catalog|Catalog} to update does not + * exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2beta.Catalog}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.update_catalog.js + * region_tag:retail_v2beta_generated_CatalogService_UpdateCatalog_async + */ updateCatalog( request?: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, options?: CallOptions @@ -356,36 +386,6 @@ export class CatalogServiceClient { {} | null | undefined > ): void; - /** - * Updates the {@link google.cloud.retail.v2beta.Catalog|Catalog}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2beta.Catalog} request.catalog - * Required. The {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. - * - * If the caller does not have permission to update the - * {@link google.cloud.retail.v2beta.Catalog|Catalog}, regardless of whether or not - * it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link google.cloud.retail.v2beta.Catalog|Catalog} to update does not - * exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link google.cloud.retail.v2beta.Catalog|Catalog} to update. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Catalog]{@link google.cloud.retail.v2beta.Catalog}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateCatalog(request); - */ updateCatalog( request?: protos.google.cloud.retail.v2beta.IUpdateCatalogRequest, optionsOrCallback?: @@ -429,37 +429,6 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); } - setDefaultBranch( - request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, - {} | undefined - ] - >; - setDefaultBranch( - request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest - | null - | undefined, - {} | null | undefined - > - ): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Set a specified branch id as default branch. API methods such as * {@link google.cloud.retail.v2beta.SearchService.Search|SearchService.Search}, @@ -523,9 +492,40 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.setDefaultBranch(request); + * @example include:samples/generated/v2beta/catalog_service.set_default_branch.js + * region_tag:retail_v2beta_generated_CatalogService_SetDefaultBranch_async */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; setDefaultBranch( request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, optionsOrCallback?: @@ -569,6 +569,30 @@ export class CatalogServiceClient { this.initialize(); return this.innerApiCalls.setDefaultBranch(request, options, callback); } + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2beta.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2beta.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.get_default_branch.js + * region_tag:retail_v2beta_generated_CatalogService_GetDefaultBranch_async + */ getDefaultBranch( request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, options?: CallOptions @@ -600,30 +624,6 @@ export class CatalogServiceClient { {} | null | undefined > ): void; - /** - * Get which branch is currently default branch set by - * {@link google.cloud.retail.v2beta.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. - * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2beta.GetDefaultBranchResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getDefaultBranch(request); - */ getDefaultBranch( request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, optionsOrCallback?: @@ -668,37 +668,6 @@ export class CatalogServiceClient { return this.innerApiCalls.getDefaultBranch(request, options, callback); } - listCatalogs( - request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.ICatalog[], - protos.google.cloud.retail.v2beta.IListCatalogsRequest | null, - protos.google.cloud.retail.v2beta.IListCatalogsResponse - ] - >; - listCatalogs( - request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2beta.IListCatalogsRequest, - | protos.google.cloud.retail.v2beta.IListCatalogsResponse - | null - | undefined, - protos.google.cloud.retail.v2beta.ICatalog - > - ): void; - listCatalogs( - request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2beta.IListCatalogsRequest, - | protos.google.cloud.retail.v2beta.IListCatalogsResponse - | null - | undefined, - protos.google.cloud.retail.v2beta.ICatalog - > - ): void; /** * Lists all the {@link google.cloud.retail.v2beta.Catalog|Catalog}s associated * with the project. @@ -742,6 +711,37 @@ export class CatalogServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listCatalogs( + request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICatalog[], + protos.google.cloud.retail.v2beta.IListCatalogsRequest | null, + protos.google.cloud.retail.v2beta.IListCatalogsResponse + ] + >; + listCatalogs( + request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListCatalogsRequest, + | protos.google.cloud.retail.v2beta.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.ICatalog + > + ): void; + listCatalogs( + request: protos.google.cloud.retail.v2beta.IListCatalogsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListCatalogsRequest, + | protos.google.cloud.retail.v2beta.IListCatalogsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.ICatalog + > + ): void; listCatalogs( request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, optionsOrCallback?: @@ -888,11 +888,8 @@ export class CatalogServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listCatalogsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2beta/catalog_service.list_catalogs.js + * region_tag:retail_v2beta_generated_CatalogService_ListCatalogs_async */ listCatalogsAsync( request?: protos.google.cloud.retail.v2beta.IListCatalogsRequest, @@ -906,7 +903,6 @@ export class CatalogServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 95b9b316cf4..2682fc469bb 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -335,37 +335,6 @@ export class CompletionServiceClient { // ------------------- // -- Service calls -- // ------------------- - completeQuery( - request?: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.ICompleteQueryResponse, - protos.google.cloud.retail.v2beta.ICompleteQueryRequest | undefined, - {} | undefined - ] - >; - completeQuery( - request: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2beta.ICompleteQueryResponse, - | protos.google.cloud.retail.v2beta.ICompleteQueryRequest - | null - | undefined, - {} | null | undefined - > - ): void; - completeQuery( - request: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, - callback: Callback< - protos.google.cloud.retail.v2beta.ICompleteQueryResponse, - | protos.google.cloud.retail.v2beta.ICompleteQueryRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Completes the specified prefix with keyword suggestions. * @@ -442,9 +411,40 @@ export class CompletionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.completeQuery(request); + * @example include:samples/generated/v2beta/completion_service.complete_query.js + * region_tag:retail_v2beta_generated_CompletionService_CompleteQuery_async */ + completeQuery( + request?: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + protos.google.cloud.retail.v2beta.ICompleteQueryRequest | undefined, + {} | undefined + ] + >; + completeQuery( + request: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + | protos.google.cloud.retail.v2beta.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeQuery( + request: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompleteQueryResponse, + | protos.google.cloud.retail.v2beta.ICompleteQueryRequest + | null + | undefined, + {} | null | undefined + > + ): void; completeQuery( request?: protos.google.cloud.retail.v2beta.ICompleteQueryRequest, optionsOrCallback?: @@ -489,6 +489,41 @@ export class CompletionServiceClient { return this.innerApiCalls.completeQuery(request, options, callback); } + /** + * Bulk import of processed completion dataset. + * + * Request processing may be synchronous. Partial updating is not supported. + * + * This feature is only available for users who have Retail Search enabled. + * Please submit a form [here](https://cloud.google.com/contact) to contact + * cloud sales if you are interested in using Retail Search. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog which the suggestions dataset belongs to. + * + * Format: `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2beta.CompletionDataInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {string} request.notificationPubsubTopic + * Pub/Sub topic for receiving notification. If this field is set, + * when the import is finished, a notification will be sent to + * specified Pub/Sub topic. The message data will be JSON string of a + * {@link google.longrunning.Operation|Operation}. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/completion_service.import_completion_data.js + * region_tag:retail_v2beta_generated_CompletionService_ImportCompletionData_async + */ importCompletionData( request?: protos.google.cloud.retail.v2beta.IImportCompletionDataRequest, options?: CallOptions @@ -525,42 +560,6 @@ export class CompletionServiceClient { {} | null | undefined > ): void; - /** - * Bulk import of processed completion dataset. - * - * Request processing may be synchronous. Partial updating is not supported. - * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog which the suggestions dataset belongs to. - * - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2beta.CompletionDataInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a - * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importCompletionData(request); - * const [response] = await operation.promise(); - */ importCompletionData( request?: protos.google.cloud.retail.v2beta.IImportCompletionDataRequest, optionsOrCallback?: @@ -618,11 +617,8 @@ export class CompletionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportCompletionDataProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/completion_service.import_completion_data.js + * region_tag:retail_v2beta_generated_CompletionService_ImportCompletionData_async */ async checkImportCompletionDataProgress( name: string diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 7e807132806..77ffb3cf587 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -294,33 +294,6 @@ export class PredictionServiceClient { // ------------------- // -- Service calls -- // ------------------- - predict( - request?: protos.google.cloud.retail.v2beta.IPredictRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.IPredictResponse, - protos.google.cloud.retail.v2beta.IPredictRequest | undefined, - {} | undefined - ] - >; - predict( - request: protos.google.cloud.retail.v2beta.IPredictRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2beta.IPredictResponse, - protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, - {} | null | undefined - > - ): void; - predict( - request: protos.google.cloud.retail.v2beta.IPredictRequest, - callback: Callback< - protos.google.cloud.retail.v2beta.IPredictResponse, - protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, - {} | null | undefined - > - ): void; /** * Makes a recommendation prediction. * @@ -431,9 +404,36 @@ export class PredictionServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.predict(request); + * @example include:samples/generated/v2beta/prediction_service.predict.js + * region_tag:retail_v2beta_generated_PredictionService_Predict_async */ + predict( + request?: protos.google.cloud.retail.v2beta.IPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | undefined, + {} | undefined + ] + >; + predict( + request: protos.google.cloud.retail.v2beta.IPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; + predict( + request: protos.google.cloud.retail.v2beta.IPredictRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IPredictResponse, + protos.google.cloud.retail.v2beta.IPredictRequest | null | undefined, + {} | null | undefined + > + ): void; predict( request?: protos.google.cloud.retail.v2beta.IPredictRequest, optionsOrCallback?: diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 696cdf040bc..fe721c55f3c 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -397,37 +397,6 @@ export class ProductServiceClient { // ------------------- // -- Service calls -- // ------------------- - createProduct( - request?: protos.google.cloud.retail.v2beta.ICreateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.IProduct, - protos.google.cloud.retail.v2beta.ICreateProductRequest | undefined, - {} | undefined - ] - >; - createProduct( - request: protos.google.cloud.retail.v2beta.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2beta.IProduct, - | protos.google.cloud.retail.v2beta.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProduct( - request: protos.google.cloud.retail.v2beta.ICreateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2beta.IProduct, - | protos.google.cloud.retail.v2beta.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Creates a {@link google.cloud.retail.v2beta.Product|Product}. * @@ -461,9 +430,40 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.createProduct(request); + * @example include:samples/generated/v2beta/product_service.create_product.js + * region_tag:retail_v2beta_generated_ProductService_CreateProduct_async */ + createProduct( + request?: protos.google.cloud.retail.v2beta.ICreateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProduct( + request: protos.google.cloud.retail.v2beta.ICreateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.ICreateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; createProduct( request?: protos.google.cloud.retail.v2beta.ICreateProductRequest, optionsOrCallback?: @@ -507,6 +507,32 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); } + /** + * Gets a {@link google.cloud.retail.v2beta.Product|Product}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * + * If the requested {@link google.cloud.retail.v2beta.Product|Product} does not + * exist, a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2beta.Product}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/product_service.get_product.js + * region_tag:retail_v2beta_generated_ProductService_GetProduct_async + */ getProduct( request?: protos.google.cloud.retail.v2beta.IGetProductRequest, options?: CallOptions @@ -534,32 +560,6 @@ export class ProductServiceClient { {} | null | undefined > ): void; - /** - * Gets a {@link google.cloud.retail.v2beta.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of - * {@link google.cloud.retail.v2beta.Product|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 - * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not - * it exists, a PERMISSION_DENIED error is returned. - * - * If the requested {@link google.cloud.retail.v2beta.Product|Product} does not - * exist, a NOT_FOUND error is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.retail.v2beta.Product}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getProduct(request); - */ getProduct( request?: protos.google.cloud.retail.v2beta.IGetProductRequest, optionsOrCallback?: @@ -601,37 +601,6 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); } - updateProduct( - request?: protos.google.cloud.retail.v2beta.IUpdateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.IProduct, - protos.google.cloud.retail.v2beta.IUpdateProductRequest | undefined, - {} | undefined - ] - >; - updateProduct( - request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2beta.IProduct, - | protos.google.cloud.retail.v2beta.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2beta.IProduct, - | protos.google.cloud.retail.v2beta.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Updates a {@link google.cloud.retail.v2beta.Product|Product}. * @@ -667,9 +636,40 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.updateProduct(request); + * @example include:samples/generated/v2beta/product_service.update_product.js + * region_tag:retail_v2beta_generated_ProductService_UpdateProduct_async */ + updateProduct( + request?: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct, + protos.google.cloud.retail.v2beta.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateProduct( + request: protos.google.cloud.retail.v2beta.IUpdateProductRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IProduct, + | protos.google.cloud.retail.v2beta.IUpdateProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; updateProduct( request?: protos.google.cloud.retail.v2beta.IUpdateProductRequest, optionsOrCallback?: @@ -713,37 +713,6 @@ export class ProductServiceClient { this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); } - deleteProduct( - request?: protos.google.cloud.retail.v2beta.IDeleteProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2beta.IDeleteProductRequest | undefined, - {} | undefined - ] - >; - deleteProduct( - request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Deletes a {@link google.cloud.retail.v2beta.Product|Product}. * @@ -779,9 +748,40 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.deleteProduct(request); + * @example include:samples/generated/v2beta/product_service.delete_product.js + * region_tag:retail_v2beta_generated_ProductService_DeleteProduct_async */ + deleteProduct( + request?: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteProduct( + request: protos.google.cloud.retail.v2beta.IDeleteProductRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteProductRequest + | null + | undefined, + {} | null | undefined + > + ): void; deleteProduct( request?: protos.google.cloud.retail.v2beta.IDeleteProductRequest, optionsOrCallback?: @@ -826,42 +826,6 @@ export class ProductServiceClient { return this.innerApiCalls.deleteProduct(request, options, callback); } - importProducts( - request?: protos.google.cloud.retail.v2beta.IImportProductsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2beta.IImportProductsResponse, - protos.google.cloud.retail.v2beta.IImportMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - importProducts( - request: protos.google.cloud.retail.v2beta.IImportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IImportProductsResponse, - protos.google.cloud.retail.v2beta.IImportMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProducts( - request: protos.google.cloud.retail.v2beta.IImportProductsRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IImportProductsResponse, - protos.google.cloud.retail.v2beta.IImportMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Bulk import of multiple {@link google.cloud.retail.v2beta.Product|Product}s. * @@ -919,10 +883,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.importProducts(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2beta/product_service.import_products.js + * region_tag:retail_v2beta_generated_ProductService_ImportProducts_async */ + importProducts( + request?: protos.google.cloud.retail.v2beta.IImportProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProducts( + request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importProducts( + request: protos.google.cloud.retail.v2beta.IImportProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IImportProductsResponse, + protos.google.cloud.retail.v2beta.IImportMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; importProducts( request?: protos.google.cloud.retail.v2beta.IImportProductsRequest, optionsOrCallback?: @@ -980,11 +979,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportProductsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/product_service.import_products.js + * region_tag:retail_v2beta_generated_ProductService_ImportProducts_async */ async checkImportProductsProgress( name: string @@ -995,55 +991,19 @@ export class ProductServiceClient { > > { const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.importProducts, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.retail.v2beta.ImportProductsResponse, - protos.google.cloud.retail.v2beta.ImportMetadata - >; - } - setInventory( - request?: protos.google.cloud.retail.v2beta.ISetInventoryRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2beta.ISetInventoryResponse, - protos.google.cloud.retail.v2beta.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - setInventory( - request: protos.google.cloud.retail.v2beta.ISetInventoryRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.ISetInventoryResponse, - protos.google.cloud.retail.v2beta.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - setInventory( - request: protos.google.cloud.retail.v2beta.ISetInventoryRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.ISetInventoryResponse, - protos.google.cloud.retail.v2beta.ISetInventoryMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importProducts, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.ImportProductsResponse, + protos.google.cloud.retail.v2beta.ImportMetadata + >; + } /** * Updates inventory information for a * {@link google.cloud.retail.v2beta.Product|Product} while respecting the last @@ -1152,10 +1112,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.setInventory(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2beta/product_service.set_inventory.js + * region_tag:retail_v2beta_generated_ProductService_SetInventory_async */ + setInventory( + request?: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setInventory( + request: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setInventory( + request: protos.google.cloud.retail.v2beta.ISetInventoryRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ISetInventoryResponse, + protos.google.cloud.retail.v2beta.ISetInventoryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; setInventory( request?: protos.google.cloud.retail.v2beta.ISetInventoryRequest, optionsOrCallback?: @@ -1213,11 +1208,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkSetInventoryProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/product_service.set_inventory.js + * region_tag:retail_v2beta_generated_ProductService_SetInventory_async */ async checkSetInventoryProgress( name: string @@ -1241,42 +1233,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.SetInventoryMetadata >; } - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, - protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Incrementally adds place IDs to * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. @@ -1360,10 +1316,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.addFulfillmentPlaces(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2beta/product_service.add_fulfillment_places.js + * region_tag:retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async */ + addFulfillmentPlaces( + request?: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; addFulfillmentPlaces( request?: protos.google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, optionsOrCallback?: @@ -1421,11 +1412,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkAddFulfillmentPlacesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/product_service.add_fulfillment_places.js + * region_tag:retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async */ async checkAddFulfillmentPlacesProgress( name: string @@ -1449,42 +1437,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata >; } - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, - protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Incrementally removes place IDs from a * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. @@ -1563,10 +1515,45 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.removeFulfillmentPlaces(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2beta/product_service.remove_fulfillment_places.js + * region_tag:retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async */ + removeFulfillmentPlaces( + request?: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeFulfillmentPlaces( + request: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, + protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; removeFulfillmentPlaces( request?: protos.google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, optionsOrCallback?: @@ -1628,11 +1615,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRemoveFulfillmentPlacesProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/product_service.remove_fulfillment_places.js + * region_tag:retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async */ async checkRemoveFulfillmentPlacesProgress( name: string @@ -1656,37 +1640,6 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata >; } - listProducts( - request?: protos.google.cloud.retail.v2beta.IListProductsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.IProduct[], - protos.google.cloud.retail.v2beta.IListProductsRequest | null, - protos.google.cloud.retail.v2beta.IListProductsResponse - ] - >; - listProducts( - request: protos.google.cloud.retail.v2beta.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2beta.IListProductsRequest, - | protos.google.cloud.retail.v2beta.IListProductsResponse - | null - | undefined, - protos.google.cloud.retail.v2beta.IProduct - > - ): void; - listProducts( - request: protos.google.cloud.retail.v2beta.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2beta.IListProductsRequest, - | protos.google.cloud.retail.v2beta.IListProductsResponse - | null - | undefined, - protos.google.cloud.retail.v2beta.IProduct - > - ): void; /** * Gets a list of {@link google.cloud.retail.v2beta.Product|Product}s. * @@ -1780,6 +1733,37 @@ export class ProductServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listProducts( + request?: protos.google.cloud.retail.v2beta.IListProductsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IProduct[], + protos.google.cloud.retail.v2beta.IListProductsRequest | null, + protos.google.cloud.retail.v2beta.IListProductsResponse + ] + >; + listProducts( + request: protos.google.cloud.retail.v2beta.IListProductsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListProductsRequest, + | protos.google.cloud.retail.v2beta.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IProduct + > + ): void; + listProducts( + request: protos.google.cloud.retail.v2beta.IListProductsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListProductsRequest, + | protos.google.cloud.retail.v2beta.IListProductsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IProduct + > + ): void; listProducts( request?: protos.google.cloud.retail.v2beta.IListProductsRequest, optionsOrCallback?: @@ -2028,11 +2012,8 @@ export class ProductServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listProductsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2beta/product_service.list_products.js + * region_tag:retail_v2beta_generated_ProductService_ListProducts_async */ listProductsAsync( request?: protos.google.cloud.retail.v2beta.IListProductsRequest, @@ -2046,7 +2027,6 @@ export class ProductServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 0b613521842..a7ed9346f67 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -322,33 +322,6 @@ export class SearchServiceClient { // -- Service calls -- // ------------------- - search( - request?: protos.google.cloud.retail.v2beta.ISearchRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2beta.ISearchRequest | null, - protos.google.cloud.retail.v2beta.ISearchResponse - ] - >; - search( - request: protos.google.cloud.retail.v2beta.ISearchRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2beta.ISearchRequest, - protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, - protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult - > - ): void; - search( - request: protos.google.cloud.retail.v2beta.ISearchRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2beta.ISearchRequest, - protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, - protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult - > - ): void; /** * Performs a search. * @@ -549,6 +522,33 @@ export class SearchServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + search( + request?: protos.google.cloud.retail.v2beta.ISearchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult[], + protos.google.cloud.retail.v2beta.ISearchRequest | null, + protos.google.cloud.retail.v2beta.ISearchResponse + ] + >; + search( + request: protos.google.cloud.retail.v2beta.ISearchRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.ISearchRequest, + protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult + > + ): void; + search( + request: protos.google.cloud.retail.v2beta.ISearchRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.ISearchRequest, + protos.google.cloud.retail.v2beta.ISearchResponse | null | undefined, + protos.google.cloud.retail.v2beta.SearchResponse.ISearchResult + > + ): void; search( request?: protos.google.cloud.retail.v2beta.ISearchRequest, optionsOrCallback?: @@ -999,11 +999,8 @@ export class SearchServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.searchAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v2beta/search_service.search.js + * region_tag:retail_v2beta_generated_SearchService_Search_async */ searchAsync( request?: protos.google.cloud.retail.v2beta.ISearchRequest, @@ -1017,7 +1014,6 @@ export class SearchServiceClient { gax.routingHeader.fromParams({ placement: request.placement || '', }); - options = options || {}; const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index fb27c34ff6c..6841441e06b 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -356,6 +356,26 @@ export class UserEventServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Writes a single user event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2beta.UserEvent} request.userEvent + * Required. User event to write. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2beta.UserEvent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/user_event_service.write_user_event.js + * region_tag:retail_v2beta_generated_UserEventService_WriteUserEvent_async + */ writeUserEvent( request?: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, options?: CallOptions @@ -387,26 +407,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * Writes a single user event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2beta.UserEvent} request.userEvent - * Required. User event to write. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [UserEvent]{@link google.cloud.retail.v2beta.UserEvent}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.writeUserEvent(request); - */ writeUserEvent( request?: protos.google.cloud.retail.v2beta.IWriteUserEventRequest, optionsOrCallback?: @@ -450,37 +450,6 @@ export class UserEventServiceClient { this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); } - collectUserEvent( - request?: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, - options?: CallOptions - ): Promise< - [ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2beta.ICollectUserEventRequest | undefined, - {} | undefined - ] - >; - collectUserEvent( - request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - | protos.google.cloud.retail.v2beta.ICollectUserEventRequest - | null - | undefined, - {} | null | undefined - > - ): void; - collectUserEvent( - request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, - callback: Callback< - protos.google.api.IHttpBody, - | protos.google.cloud.retail.v2beta.ICollectUserEventRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * 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. @@ -512,9 +481,40 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.collectUserEvent(request); + * @example include:samples/generated/v2beta/user_event_service.collect_user_event.js + * region_tag:retail_v2beta_generated_UserEventService_CollectUserEvent_async */ + collectUserEvent( + request?: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IHttpBody, + protos.google.cloud.retail.v2beta.ICollectUserEventRequest | undefined, + {} | undefined + ] + >; + collectUserEvent( + request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2beta.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; + collectUserEvent( + request: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, + callback: Callback< + protos.google.api.IHttpBody, + | protos.google.cloud.retail.v2beta.ICollectUserEventRequest + | null + | undefined, + {} | null | undefined + > + ): void; collectUserEvent( request?: protos.google.cloud.retail.v2beta.ICollectUserEventRequest, optionsOrCallback?: @@ -559,42 +559,6 @@ export class UserEventServiceClient { return this.innerApiCalls.collectUserEvent(request, options, callback); } - purgeUserEvents( - request?: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2beta.IPurgeMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - purgeUserEvents( - request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2beta.IPurgeMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeUserEvents( - request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, - callback: Callback< - LROperation< - protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, - protos.google.cloud.retail.v2beta.IPurgeMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; /** * Deletes permanently all user events specified by the filter provided. * Depending on the number of events specified by the filter, this operation @@ -645,10 +609,45 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const [operation] = await client.purgeUserEvents(request); - * const [response] = await operation.promise(); + * @example include:samples/generated/v2beta/user_event_service.purge_user_events.js + * region_tag:retail_v2beta_generated_UserEventService_PurgeUserEvents_async */ + purgeUserEvents( + request?: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeUserEvents( + request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeUserEvents( + request: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IPurgeUserEventsResponse, + protos.google.cloud.retail.v2beta.IPurgeMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; purgeUserEvents( request?: protos.google.cloud.retail.v2beta.IPurgeUserEventsRequest, optionsOrCallback?: @@ -706,11 +705,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkPurgeUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/user_event_service.purge_user_events.js + * region_tag:retail_v2beta_generated_UserEventService_PurgeUserEvents_async */ async checkPurgeUserEventsProgress( name: string @@ -734,6 +730,36 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2beta.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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. `projects/1234/locations/global/catalogs/default_catalog` + * @param {google.cloud.retail.v2beta.UserEventInputConfig} request.inputConfig + * Required. The desired input location of the data. + * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig + * The desired location of errors incurred during the Import. Cannot be set + * for inline user event imports. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/user_event_service.import_user_events.js + * region_tag:retail_v2beta_generated_UserEventService_ImportUserEvents_async + */ importUserEvents( request?: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, options?: CallOptions @@ -770,37 +796,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2beta.UserEventInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.importUserEvents(request); - * const [response] = await operation.promise(); - */ importUserEvents( request?: protos.google.cloud.retail.v2beta.IImportUserEventsRequest, optionsOrCallback?: @@ -858,11 +853,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkImportUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/user_event_service.import_user_events.js + * region_tag:retail_v2beta_generated_UserEventService_ImportUserEvents_async */ async checkImportUserEventsProgress( name: string @@ -886,6 +878,37 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2beta.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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent catalog resource name, such as + * `projects/1234/locations/global/catalogs/default_catalog`. + * @param {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/user_event_service.rejoin_user_events.js + * region_tag:retail_v2beta_generated_UserEventService_RejoinUserEvents_async + */ rejoinUserEvents( request?: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, options?: CallOptions @@ -922,38 +945,6 @@ export class UserEventServiceClient { {} | null | undefined > ): void; - /** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope} request.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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.rejoinUserEvents(request); - * const [response] = await operation.promise(); - */ rejoinUserEvents( request?: protos.google.cloud.retail.v2beta.IRejoinUserEventsRequest, optionsOrCallback?: @@ -1011,11 +1002,8 @@ export class UserEventServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkRejoinUserEventsProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v2beta/user_event_service.rejoin_user_events.js + * region_tag:retail_v2beta_generated_UserEventService_RejoinUserEvents_async */ async checkRejoinUserEventsProgress( name: string From 8dde01a443e83548bd9070cc7efbfc2ec8376727 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Nov 2021 17:43:33 +0000 Subject: [PATCH 054/103] feat: update grpc service config settings to reflect correct API deadlines (#117) feat: update grpc service config settings to reflect correct API deadlines PiperOrigin-RevId: 411660243 Source-Link: https://github.com/googleapis/googleapis/commit/72adf13fe75a34bc21411e0e8d44164fc8e1111b Source-Link: https://github.com/googleapis/googleapis-gen/commit/3e39fd553ab288192a77fb3c0d3e7cd2db116485 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2UzOWZkNTUzYWIyODgxOTJhNzdmYjNjMGQzZTdjZDJkYjExNjQ4NSJ9 --- .../protos/google/cloud/retail/v2/catalog.proto | 12 ++++++------ .../google/cloud/retail/v2/search_service.proto | 5 +++++ .../google/cloud/retail/v2alpha/catalog.proto | 16 ++++++++-------- .../google/cloud/retail/v2alpha/common.proto | 2 ++ .../cloud/retail/v2alpha/product_service.proto | 2 +- .../cloud/retail/v2alpha/search_service.proto | 5 +++++ .../google/cloud/retail/v2beta/catalog.proto | 12 ++++++------ .../cloud/retail/v2beta/search_service.proto | 5 +++++ .../generated/v2/search_service.search.js | 3 +++ .../product_service.add_local_inventories.js | 2 +- .../generated/v2alpha/search_service.search.js | 3 +++ .../generated/v2beta/search_service.search.js | 3 +++ .../src/v2/search_service_client.ts | 9 +++++++++ .../src/v2/user_event_service_client_config.json | 2 +- .../src/v2alpha/product_service_client.ts | 2 +- .../src/v2alpha/search_service_client.ts | 9 +++++++++ .../user_event_service_client_config.json | 2 +- .../src/v2beta/search_service_client.ts | 9 +++++++++ .../v2beta/user_event_service_client_config.json | 2 +- 19 files changed, 79 insertions(+), 26 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto index f449e9016c9..e9405807513 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto @@ -37,12 +37,12 @@ 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]. + // * `primary` (default): You can ingest + // [Product][google.cloud.retail.v2.Product]s of all types. When + // ingesting a [Product][google.cloud.retail.v2.Product], its type will + // default to + // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if + // unset. // * `variant`: You can only ingest // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] // [Product][google.cloud.retail.v2.Product]s. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index bf32f607f52..5e5135f11de 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -96,6 +96,7 @@ message SearchRequest { // * "customFulfillment3" // * "customFulfillment4" // * "customFulfillment5" + // * "inventory(place_id,attributes.key)" // // * numerical_field = // * "price" @@ -104,6 +105,7 @@ message SearchRequest { // * "ratingCount" // * "attributes.key" // * "inventory(place_id,price)" + // * "inventory(place_id,attributes.key)" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -513,7 +515,10 @@ message SearchRequest { // * price // * originalPrice // * discount + // * variantId // * inventory(place_id,price) + // * inventory(place_id,attributes.key), where key is any key in the + // [Product.inventories.attributes][] map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2.Product.attributes] map. // * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index 63c09331d19..f628bb36156 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -37,12 +37,12 @@ message ProductLevelConfig { // The type of [Product][google.cloud.retail.v2alpha.Product]s allowed to be // ingested into the catalog. Acceptable values are: // - // * `primary` (default): You can only ingest - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s. This means - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // can only be empty or set to the same value as - // [Product.id][google.cloud.retail.v2alpha.Product.id]. + // * `primary` (default): You can ingest + // [Product][google.cloud.retail.v2alpha.Product]s of all types. When + // ingesting a [Product][google.cloud.retail.v2alpha.Product], its type will + // default to + // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] + // if unset. // * `variant`: You can only ingest // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] // [Product][google.cloud.retail.v2alpha.Product]s. @@ -106,8 +106,8 @@ message MerchantCenterLink { // List of possible values can be found here. // [https://support.google.com/merchants/answer/7501026] // List of allowed string values: - // "shopping-ads", "buy-on-google-listings", "display-ads", "local-inventory - // -ads", "free-listings", "free-local-listings" + // "Shopping_ads", "Buy_on_google_listings", "Display_ads", "Local_inventory + // _ads", "Free_listings", "Free_local_listings" // NOTE: The string values are case sensitive. repeated string destinations = 3; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index 71d57b0b2d6..fac3529b351 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -456,5 +456,7 @@ message LocalInventory { // * The attribute values must be of the same type (text or number). // * The max number of values per attribute is 10. // * For text values, the length limit is 10 UTF-8 characters. + // * The attribute does not support search. The `searchable` field should be + // unset or set to false. map attributes = 3; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index 4d7ad5a5333..c88e6504120 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -711,7 +711,7 @@ message AddLocalInventoriesRequest { // not found, the local inventory will still be processed and retained for at // most 1 day and processed once the // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // an INVALID_ARGUMENT error is returned if the + // a NOT_FOUND error is returned if the // [Product][google.cloud.retail.v2alpha.Product] is not found. bool allow_missing = 6; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index 874d4fa3052..3d903a65cc4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -97,6 +97,7 @@ message SearchRequest { // * "customFulfillment3" // * "customFulfillment4" // * "customFulfillment5" + // * "inventory(place_id,attributes.key)" // // * numerical_field = // * "price" @@ -105,6 +106,7 @@ message SearchRequest { // * "ratingCount" // * "attributes.key" // * "inventory(place_id,price)" + // * "inventory(place_id,attributes.key)" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -550,7 +552,10 @@ message SearchRequest { // * price // * originalPrice // * discount + // * variantId // * inventory(place_id,price) + // * inventory(place_id,attributes.key), where key is any key in the + // [Product.inventories.attributes][] map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. // * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto index aac00ef8d0c..ffec074fe4d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto @@ -37,12 +37,12 @@ message ProductLevelConfig { // The type of [Product][google.cloud.retail.v2beta.Product]s allowed to be // ingested into the catalog. Acceptable values are: // - // * `primary` (default): You can only ingest - // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2beta.Product]s. This means - // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id] - // can only be empty or set to the same value as - // [Product.id][google.cloud.retail.v2beta.Product.id]. + // * `primary` (default): You can ingest + // [Product][google.cloud.retail.v2beta.Product]s of all types. When + // ingesting a [Product][google.cloud.retail.v2beta.Product], its type will + // default to + // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] + // if unset. // * `variant`: You can only ingest // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] // [Product][google.cloud.retail.v2beta.Product]s. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index cb64c819458..62149b989a4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -97,6 +97,7 @@ message SearchRequest { // * "customFulfillment3" // * "customFulfillment4" // * "customFulfillment5" + // * "inventory(place_id,attributes.key)" // // * numerical_field = // * "price" @@ -105,6 +106,7 @@ message SearchRequest { // * "ratingCount" // * "attributes.key" // * "inventory(place_id,price)" + // * "inventory(place_id,attributes.key)" string key = 1 [(google.api.field_behavior) = REQUIRED]; // Set only if values should be bucketized into intervals. Must be set @@ -517,7 +519,10 @@ message SearchRequest { // * price // * originalPrice // * discount + // * variantId // * inventory(place_id,price) + // * inventory(place_id,attributes.key), where key is any key in the + // [Product.inventories.attributes][] map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. // * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 76057c922d0..212fbff9a2d 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -153,7 +153,10 @@ function main(placement, visitorId) { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * Product.inventories.attributes map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2.Product.attributes map. * * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js index 97c63276279..b7608b54335 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -59,7 +59,7 @@ function main(product, localInventories) { * not found, the local inventory will still be processed and retained for at * most 1 day and processed once the * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * an INVALID_ARGUMENT error is returned if the + * a NOT_FOUND error is returned if the * Product google.cloud.retail.v2alpha.Product is not found. */ // const allowMissing = true diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index 8f0b00c1c9c..24a80d3340a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -167,7 +167,10 @@ function main(placement, visitorId) { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * Product.inventories.attributes map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2alpha.Product.attributes map. * * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index b6cfbb95a5b..e7e8a49fee3 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -155,7 +155,10 @@ function main(placement, visitorId) { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * Product.inventories.attributes map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2beta.Product.attributes map. * * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index e70153e5fa5..7ea63a4990b 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -449,7 +449,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -709,7 +712,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -925,7 +931,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2/user_event_service_client_config.json index 7a2bfd984b5..a3938b37468 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/user_event_service_client_config.json @@ -63,7 +63,7 @@ "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportUserEvents": { - "timeout_millis": 300000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 51778d106b8..9cdc89a68eb 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -1732,7 +1732,7 @@ export class ProductServiceClient { * not found, the local inventory will still be processed and retained for at * most 1 day and processed once the * {@link google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * an INVALID_ARGUMENT error is returned if the + * a NOT_FOUND error is returned if the * {@link google.cloud.retail.v2alpha.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 26fbaff142d..22cbdad1be4 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -462,7 +462,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -744,7 +747,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -982,7 +988,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json index 8518bc3abc1..21dfac2e12b 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client_config.json @@ -63,7 +63,7 @@ "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportUserEvents": { - "timeout_millis": 300000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index a7ed9346f67..7865c14c778 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -451,7 +451,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -713,7 +716,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -931,7 +937,10 @@ export class SearchServiceClient { * * price * * originalPrice * * discount + * * variantId * * inventory(place_id,price) + * * inventory(place_id,attributes.key), where key is any key in the + * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json b/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json index 92dc408aea7..f5bd2baedcc 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client_config.json @@ -63,7 +63,7 @@ "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, "ImportUserEvents": { - "timeout_millis": 300000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" }, From 299d45822c80fa77d925216b0cd8406bf0dbac9a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 29 Nov 2021 10:07:18 -0800 Subject: [PATCH 055/103] chore: release 1.5.0 (#118) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 8 ++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index c4ee151bbf8..903cacda2af 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.5.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.4.0...v1.5.0) (2021-11-23) + + +### Features + +* update grpc service config settings to reflect correct API deadlines ([0f24f0e](https://www.github.com/googleapis/nodejs-retail/commit/0f24f0e42c0cb3430935487fe6569873cfdb6860)) +* update grpc service config settings to reflect correct API deadlines ([#117](https://www.github.com/googleapis/nodejs-retail/issues/117)) ([0f24f0e](https://www.github.com/googleapis/nodejs-retail/commit/0f24f0e42c0cb3430935487fe6569873cfdb6860)) + ## [1.4.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.3.0...v1.4.0) (2021-11-04) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index e650295640a..cc26e754537 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.4.0", + "version": "1.5.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 5ba6636e98f..55e3f26cd8b 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/retail": "^1.4.0" + "@google-cloud/retail": "^1.5.0" }, "devDependencies": { "c8": "^7.1.0", From 950308fc44550fa74b8258e384ee2811a4381d73 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 10 Dec 2021 21:18:29 +0000 Subject: [PATCH 056/103] build: add generated samples to .eslintignore (#120) --- packages/google-cloud-retail/.eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-retail/.eslintignore b/packages/google-cloud-retail/.eslintignore index 9340ad9b86d..ea5b04aebe6 100644 --- a/packages/google-cloud-retail/.eslintignore +++ b/packages/google-cloud-retail/.eslintignore @@ -4,3 +4,4 @@ test/fixtures build/ docs/ protos/ +samples/generated/ From 79f3bb2bf9c159467b4835ce354a35ed5905abf1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Dec 2021 21:36:34 +0000 Subject: [PATCH 057/103] docs(node): support "stable"/"preview" release level (#1312) (#123) --- packages/google-cloud-retail/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index ab98619c7e0..6e6383e339b 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -130,6 +130,8 @@ are addressed with the highest priority. + + More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages From fac544fbee77778a4f64bfb5340e0db8ff9866d3 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 30 Dec 2021 12:01:10 -0500 Subject: [PATCH 058/103] chore: add api_shortname and library_type to repo metadata (#122) --- packages/google-cloud-retail/.repo-metadata.json | 6 ++++-- packages/google-cloud-retail/README.md | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json index a7488f782c6..bdda91d1895 100644 --- a/packages/google-cloud-retail/.repo-metadata.json +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -2,7 +2,7 @@ "client_documentation": "https://cloud.google.com/nodejs/docs/reference/retail/latest", "api_id": "retail.googleapis.com", "distribution_name": "@google-cloud/retail", - "release_level": "ga", + "release_level": "stable", "default_version": "v2beta", "language": "nodejs", "name_pretty": "Retail API", @@ -10,5 +10,7 @@ "product_documentation": "https://cloud.google.com/recommendations/", "requires_billing": true, "name": "retail", - "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues" + "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues", + "api_shortname": "retail", + "library_type": "GAPIC_AUTO" } diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index 6e6383e339b..ab5d3211498 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -4,7 +4,7 @@ # [Retail API: Node.js Client](https://github.com/googleapis/nodejs-retail) -[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) + [![npm version](https://img.shields.io/npm/v/@google-cloud/retail.svg)](https://www.npmjs.org/package/@google-cloud/retail) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-retail/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-retail) @@ -120,10 +120,10 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). -This library is considered to be **General Availability (GA)**. This means it -is stable; the code surface will not change in backwards-incompatible ways + +This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with -an extensive deprecation period. Issues and requests against **GA** libraries +an extensive deprecation period. Issues and requests against **stable** libraries are addressed with the highest priority. @@ -131,7 +131,6 @@ are addressed with the highest priority. - More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages From 8ec9e1ce1d41e2b086cb57cf2045a5a3e68f6ab5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Dec 2021 23:10:24 +0000 Subject: [PATCH 059/103] docs(badges): tweak badge to use new preview/stable language (#1314) (#125) --- packages/google-cloud-retail/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index ab5d3211498..da628b54bfb 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -4,9 +4,8 @@ # [Retail API: Node.js Client](https://github.com/googleapis/nodejs-retail) - +[![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/retail.svg)](https://www.npmjs.org/package/@google-cloud/retail) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-retail/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-retail) From 4b04ca3c796991d26dd96b9bde011ae5cab77d70 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 10:37:33 -0800 Subject: [PATCH 060/103] test(nodejs): remove 15 add 16 (#1322) (#127) Source-Link: https://github.com/googleapis/synthtool/commit/6981da4f29c0ae3dd783d58f1be5ab222d6a5642 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:3563b6b264989c4f5aa31a3682e4df36c95756cfef275d3201508947cbfc511e Co-authored-by: Owl Bot --- packages/google-cloud-retail/protos/protos.d.ts | 2 +- packages/google-cloud-retail/protos/protos.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index a15bce019fd..b89c8cdda46 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index c53d1763a0a..eb6f6cef82c 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 83d09ffe31c61d23d6566307320d62117cfcb278 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 20 Jan 2022 00:25:27 -0800 Subject: [PATCH 061/103] build: update copyright year to 2022 (#129) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): upgrade gapic-generator-java to 2.4.1 PiperOrigin-RevId: 422607515 Source-Link: https://github.com/googleapis/googleapis/commit/ba2ffd6fe6642e28b4fed2ffae217b4c5f084034 Source-Link: https://github.com/googleapis/googleapis-gen/commit/73ba4add239a619da567ffbd4e5730fdd6de04d3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzNiYTRhZGQyMzlhNjE5ZGE1NjdmZmJkNGU1NzMwZmRkNmRlMDRkMyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- packages/google-cloud-retail/.jsdoc.js | 4 +- .../v2/catalog_service.get_default_branch.js | 4 +- .../v2/catalog_service.list_catalogs.js | 7 ++- .../v2/catalog_service.set_default_branch.js | 6 +- .../v2/catalog_service.update_catalog.js | 1 + .../v2/completion_service.complete_query.js | 1 + ...mpletion_service.import_completion_data.js | 1 + .../v2/prediction_service.predict.js | 1 + .../product_service.add_fulfillment_places.js | 1 + .../v2/product_service.create_product.js | 1 + .../v2/product_service.delete_product.js | 5 +- .../v2/product_service.get_product.js | 1 + .../v2/product_service.import_products.js | 5 +- .../v2/product_service.list_products.js | 31 ++++++----- ...oduct_service.remove_fulfillment_places.js | 1 + .../v2/product_service.set_inventory.js | 17 +++--- .../v2/product_service.update_product.js | 3 +- .../generated/v2/search_service.search.js | 49 +++++++++-------- .../user_event_service.collect_user_event.js | 1 + .../user_event_service.import_user_events.js | 1 + .../user_event_service.purge_user_events.js | 1 + .../user_event_service.rejoin_user_events.js | 1 + .../v2/user_event_service.write_user_event.js | 1 + .../catalog_service.get_default_branch.js | 4 +- .../v2alpha/catalog_service.list_catalogs.js | 7 ++- .../catalog_service.set_default_branch.js | 6 +- .../v2alpha/catalog_service.update_catalog.js | 1 + .../completion_service.complete_query.js | 1 + ...mpletion_service.import_completion_data.js | 1 + .../v2alpha/prediction_service.predict.js | 1 + .../product_service.add_fulfillment_places.js | 1 + .../product_service.add_local_inventories.js | 1 + .../v2alpha/product_service.create_product.js | 1 + .../v2alpha/product_service.delete_product.js | 5 +- .../v2alpha/product_service.get_product.js | 1 + .../product_service.import_products.js | 5 +- .../v2alpha/product_service.list_products.js | 33 +++++------ ...oduct_service.remove_fulfillment_places.js | 1 + ...roduct_service.remove_local_inventories.js | 1 + .../v2alpha/product_service.set_inventory.js | 17 +++--- .../v2alpha/product_service.update_product.js | 3 +- .../v2alpha/search_service.search.js | 55 ++++++++++--------- .../user_event_service.collect_user_event.js | 1 + .../user_event_service.import_user_events.js | 1 + .../user_event_service.purge_user_events.js | 3 +- .../user_event_service.rejoin_user_events.js | 1 + .../user_event_service.write_user_event.js | 1 + .../catalog_service.get_default_branch.js | 4 +- .../v2beta/catalog_service.list_catalogs.js | 7 ++- .../catalog_service.set_default_branch.js | 6 +- .../v2beta/catalog_service.update_catalog.js | 1 + .../completion_service.complete_query.js | 1 + ...mpletion_service.import_completion_data.js | 1 + .../v2beta/prediction_service.predict.js | 1 + .../product_service.add_fulfillment_places.js | 1 + .../v2beta/product_service.create_product.js | 1 + .../v2beta/product_service.delete_product.js | 5 +- .../v2beta/product_service.get_product.js | 1 + .../v2beta/product_service.import_products.js | 5 +- .../v2beta/product_service.list_products.js | 31 ++++++----- ...oduct_service.remove_fulfillment_places.js | 1 + .../v2beta/product_service.set_inventory.js | 17 +++--- .../v2beta/product_service.update_product.js | 3 +- .../generated/v2beta/search_service.search.js | 53 +++++++++--------- .../user_event_service.collect_user_event.js | 1 + .../user_event_service.import_user_events.js | 1 + .../user_event_service.purge_user_events.js | 3 +- .../user_event_service.rejoin_user_events.js | 1 + .../user_event_service.write_user_event.js | 1 + .../src/v2/catalog_service_client.ts | 2 +- .../src/v2/completion_service_client.ts | 2 +- packages/google-cloud-retail/src/v2/index.ts | 2 +- .../src/v2/prediction_service_client.ts | 2 +- .../src/v2/product_service_client.ts | 2 +- .../src/v2/search_service_client.ts | 2 +- .../src/v2/user_event_service_client.ts | 2 +- .../src/v2alpha/catalog_service_client.ts | 2 +- .../src/v2alpha/completion_service_client.ts | 2 +- .../google-cloud-retail/src/v2alpha/index.ts | 2 +- .../src/v2alpha/prediction_service_client.ts | 2 +- .../src/v2alpha/product_service_client.ts | 2 +- .../src/v2alpha/search_service_client.ts | 2 +- .../src/v2alpha/user_event_service_client.ts | 2 +- .../src/v2beta/catalog_service_client.ts | 2 +- .../src/v2beta/completion_service_client.ts | 2 +- .../google-cloud-retail/src/v2beta/index.ts | 2 +- .../src/v2beta/prediction_service_client.ts | 2 +- .../src/v2beta/product_service_client.ts | 2 +- .../src/v2beta/search_service_client.ts | 2 +- .../src/v2beta/user_event_service_client.ts | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- .../system-test/install.ts | 2 +- .../test/gapic_catalog_service_v2.ts | 2 +- .../test/gapic_catalog_service_v2alpha.ts | 2 +- .../test/gapic_catalog_service_v2beta.ts | 2 +- .../test/gapic_completion_service_v2.ts | 2 +- .../test/gapic_completion_service_v2alpha.ts | 2 +- .../test/gapic_completion_service_v2beta.ts | 2 +- .../test/gapic_prediction_service_v2.ts | 2 +- .../test/gapic_prediction_service_v2alpha.ts | 2 +- .../test/gapic_prediction_service_v2beta.ts | 2 +- .../test/gapic_product_service_v2.ts | 2 +- .../test/gapic_product_service_v2alpha.ts | 2 +- .../test/gapic_product_service_v2beta.ts | 2 +- .../test/gapic_search_service_v2.ts | 2 +- .../test/gapic_search_service_v2alpha.ts | 2 +- .../test/gapic_search_service_v2beta.ts | 2 +- .../test/gapic_user_event_service_v2.ts | 2 +- .../test/gapic_user_event_service_v2alpha.ts | 2 +- .../test/gapic_user_event_service_v2beta.ts | 2 +- 111 files changed, 300 insertions(+), 226 deletions(-) diff --git a/packages/google-cloud-retail/.jsdoc.js b/packages/google-cloud-retail/.jsdoc.js index 65875741d0a..1972981017b 100644 --- a/packages/google-cloud-retail/.jsdoc.js +++ b/packages/google-cloud-retail/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2021 Google LLC', + copyright: 'Copyright 2022 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/retail', diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js index 616febdd7fe..7a079eab442 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -33,7 +34,8 @@ function main() { async function callGetDefaultBranch() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await retailClient.getDefaultBranch(request); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js index 27dbac42322..691edbe893f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -38,10 +39,10 @@ function main(parent) { * 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 + * 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 + * CatalogService.ListCatalogs google.cloud.retail.v2.CatalogService.ListCatalogs * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -62,7 +63,7 @@ function main(parent) { // Run request const iterable = await retailClient.listCatalogsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js index 9e25ac849cc..8716d5c0837 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -32,7 +33,7 @@ function main() { // const branchId = 'abc123' /** * Some note on this request, this can be retrieved by - * CatalogService.GetDefaultBranch google.cloud.retail.v2.CatalogService.GetDefaultBranch + * CatalogService.GetDefaultBranch google.cloud.retail.v2.CatalogService.GetDefaultBranch * before next valid default branch set occurs. * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -47,7 +48,8 @@ function main() { async function callSetDefaultBranch() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await retailClient.setDefaultBranch(request); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js index dc4acf4c26d..56703900c77 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(catalog) { diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index af3d936e570..d1228a67598 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(catalog, query) { diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js index 7fbbeac3271..7d993e411df 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index e6d65ce9168..4a2dcbe7989 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(placement, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js index 980b9b800bc..c4437254d3f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, type, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js index f2cc6a459ba..78a19eb0330 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, product, productId) { diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js index 966f6c6a2d3..65f8ff4b4b3 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -29,9 +30,9 @@ function main(name) { * If the Product google.cloud.retail.v2.Product to delete does not exist, * a NOT_FOUND error is returned. * The Product google.cloud.retail.v2.Product to delete can neither be a - * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION * Product google.cloud.retail.v2.Product member nor a - * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY * Product google.cloud.retail.v2.Product with more than one * variants google.cloud.retail.v2.Product.Type.VARIANT. Otherwise, an * INVALID_ARGUMENT error is returned. diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js index 307769685ff..a92d2d84e9a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index b7ad9f6c6ef..fcf29e1c7ab 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { @@ -33,7 +34,7 @@ function main(parent, inputConfig) { * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in * ImportMetadata google.cloud.retail.v2.ImportMetadata. * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const requestId = 'abc123' @@ -63,7 +64,7 @@ function main(parent, inputConfig) { * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js index 883653e1921..72f25da2891 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -40,10 +41,10 @@ function main(parent) { * A page token * ListProductsResponse.next_page_token google.cloud.retail.v2.ListProductsResponse.next_page_token, * received from a previous - * ProductService.ListProducts google.cloud.retail.v2.ProductService.ListProducts + * ProductService.ListProducts google.cloud.retail.v2.ProductService.ListProducts * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * ProductService.ListProducts google.cloud.retail.v2.ProductService.ListProducts + * ProductService.ListProducts google.cloud.retail.v2.ProductService.ListProducts * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -52,13 +53,13 @@ function main(parent) { * A filter to apply on the list results. Supported features: * * List all the products under the parent branch if * filter google.cloud.retail.v2.ListProductsRequest.filter is unset. - * * List Product.Type.VARIANT google.cloud.retail.v2.Product.Type.VARIANT + * * List Product.Type.VARIANT google.cloud.retail.v2.Product.Type.VARIANT * Product google.cloud.retail.v2.Product s sharing the same - * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY * Product google.cloud.retail.v2.Product. For example: * `primary_product_id = "some_product_id"` * * List Product google.cloud.retail.v2.Product s bundled in a - * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION * Product google.cloud.retail.v2.Product. * For example: * `collection_product_id = "some_product_id"` @@ -69,9 +70,9 @@ function main(parent) { * `type = "COLLECTION"` * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. * If the specified - * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2.Product.Type.PRIMARY * Product google.cloud.retail.v2.Product or - * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2.Product.Type.COLLECTION * Product google.cloud.retail.v2.Product does not exist, a NOT_FOUND error * is returned. */ @@ -79,13 +80,13 @@ function main(parent) { /** * The fields of Product google.cloud.retail.v2.Product to return in the * responses. If not set or empty, the following fields are returned: - * * Product.name google.cloud.retail.v2.Product.name - * * Product.id google.cloud.retail.v2.Product.id - * * Product.title google.cloud.retail.v2.Product.title - * * Product.uri google.cloud.retail.v2.Product.uri - * * Product.images google.cloud.retail.v2.Product.images - * * Product.price_info google.cloud.retail.v2.Product.price_info - * * Product.brands google.cloud.retail.v2.Product.brands + * * Product.name google.cloud.retail.v2.Product.name + * * Product.id google.cloud.retail.v2.Product.id + * * Product.title google.cloud.retail.v2.Product.title + * * Product.uri google.cloud.retail.v2.Product.uri + * * Product.images google.cloud.retail.v2.Product.images + * * Product.price_info google.cloud.retail.v2.Product.price_info + * * Product.brands google.cloud.retail.v2.Product.brands * If "*" is provided, all fields are returned. * Product.name google.cloud.retail.v2.Product.name is always returned no * matter what mask is set. @@ -109,7 +110,7 @@ function main(parent) { // Run request const iterable = await retailClient.listProductsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js index 7c6456a7d1e..0ae62e6c7e8 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, type, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js index 195aac173e5..4cf7e61d60f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(inventory) { @@ -22,10 +23,10 @@ function main(inventory) { /** * Required. The inventory information to update. The allowable fields to * update are: - * * Product.price_info google.cloud.retail.v2.Product.price_info - * * Product.availability google.cloud.retail.v2.Product.availability - * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info + * * Product.price_info google.cloud.retail.v2.Product.price_info + * * Product.availability google.cloud.retail.v2.Product.availability + * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * The updated inventory fields must be specified in * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask. * If SetInventoryRequest.inventory.name is empty or invalid, an @@ -43,10 +44,10 @@ function main(inventory) { * provided or default value for * SetInventoryRequest.set_time google.cloud.retail.v2.SetInventoryRequest.set_time. * The last update time is recorded for the following inventory fields: - * * Product.price_info google.cloud.retail.v2.Product.price_info - * * Product.availability google.cloud.retail.v2.Product.availability - * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info + * * Product.price_info google.cloud.retail.v2.Product.price_info + * * Product.availability google.cloud.retail.v2.Product.availability + * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is * needed, UpdateProduct should be invoked instead. */ diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js index 77f45bc400f..32b9e87639a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product) { @@ -26,7 +27,7 @@ function main(product) { * exists, a PERMISSION_DENIED error is returned. * If the Product google.cloud.retail.v2.Product to update does not exist * and - * allow_missing google.cloud.retail.v2.UpdateProductRequest.allow_missing + * allow_missing google.cloud.retail.v2.UpdateProductRequest.allow_missing * is not set, a NOT_FOUND error is returned. */ // const product = {} diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 212fbff9a2d..b9f98813845 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(placement, visitorId) { @@ -73,7 +74,7 @@ function main(placement, visitorId) { * A 0-indexed integer that specifies the current offset (that is, starting * result location, amongst the Product google.cloud.retail.v2.Product s * deemed by the API as relevant) in search results. This field is only - * considered if page_token google.cloud.retail.v2.SearchRequest.page_token + * considered if page_token google.cloud.retail.v2.SearchRequest.page_token * is unset. * If this field is negative, an INVALID_ARGUMENT is returned. */ @@ -90,7 +91,7 @@ function main(placement, visitorId) { * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with - * SearchRequest.canonical_filter google.cloud.retail.v2.SearchRequest.canonical_filter + * SearchRequest.canonical_filter google.cloud.retail.v2.SearchRequest.canonical_filter * will be returned as a supplement of the original query. This field is * strongly recommended to achieve high search quality. * See SearchRequest.filter google.cloud.retail.v2.SearchRequest.filter for @@ -137,11 +138,11 @@ function main(placement, visitorId) { // const queryExpansionSpec = {} /** * The keys to fetch and rollup the matching - * variant google.cloud.retail.v2.Product.Type.VARIANT + * variant google.cloud.retail.v2.Product.Type.VARIANT * Product google.cloud.retail.v2.Product s attributes. The attributes from - * all the matching variant google.cloud.retail.v2.Product.Type.VARIANT + * all the matching variant google.cloud.retail.v2.Product.Type.VARIANT * Product google.cloud.retail.v2.Product s are merged and de-duplicated. - * Notice that rollup variant google.cloud.retail.v2.Product.Type.VARIANT + * Notice that rollup variant google.cloud.retail.v2.Product.Type.VARIANT * Product google.cloud.retail.v2.Product s attributes will lead to extra * query latency. Maximum number of keys is 10. * For FulfillmentInfo google.cloud.retail.v2.FulfillmentInfo, a @@ -160,40 +161,40 @@ function main(placement, visitorId) { * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2.Product.attributes map. * * pickupInStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "pickup-in-store". * * shipToStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "ship-to-store". * * sameDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "same-day-delivery". * * nextDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "next-day-delivery". * * customFulfillment1.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-1". * * customFulfillment2.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-2". * * customFulfillment3.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-3". * * customFulfillment4.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-4". * * customFulfillment5.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2.FulfillmentInfo.type * "custom-type-5". * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -234,7 +235,7 @@ function main(placement, visitorId) { // Run request const iterable = await retailClient.searchAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js index 50c7eb99818..d419aed42f1 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js index 5231d461f59..1ab9e1496fc 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js index 16ee8277860..fada57566a6 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, filter) { diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js index 5db922eebeb..dd1d9fa86e4 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js index a7b975cbaca..bf904b29e14 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js index 9021acdc304..02a961ca3a8 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -33,7 +34,8 @@ function main() { async function callGetDefaultBranch() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await retailClient.getDefaultBranch(request); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js index 9d856ca78de..7d8a9b4b294 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -38,10 +39,10 @@ function main(parent) { * A page token * ListCatalogsResponse.next_page_token google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token, * received from a previous - * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs + * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs + * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -62,7 +63,7 @@ function main(parent) { // Run request const iterable = await retailClient.listCatalogsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js index 391e65e0ef8..105fb5eac03 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -32,7 +33,7 @@ function main() { // const branchId = 'abc123' /** * Some note on this request, this can be retrieved by - * CatalogService.GetDefaultBranch google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch + * CatalogService.GetDefaultBranch google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch * before next valid default branch set occurs. * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -47,7 +48,8 @@ function main() { async function callSetDefaultBranch() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await retailClient.setDefaultBranch(request); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js index a77df06cc26..d18159368fb 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(catalog) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index c74af7fcebd..96b7daa2326 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(catalog, query) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js index d681cc9e989..74ad29468db 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js index 7f5cccba9e0..0b66302f5a1 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(placement, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js index fdb7d59aaeb..2012a047e66 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, type, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js index b7608b54335..27de3024417 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, localInventories) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js index 540bbfa7be9..59be17e94c5 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, product, productId) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js index a68cc635bd6..cb3b87e506c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -30,9 +31,9 @@ function main(name) { * exist, a NOT_FOUND error is returned. * The Product google.cloud.retail.v2alpha.Product to delete can neither be * a - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION * Product google.cloud.retail.v2alpha.Product member nor a - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY * Product google.cloud.retail.v2alpha.Product with more than one * variants google.cloud.retail.v2alpha.Product.Type.VARIANT. Otherwise, an * INVALID_ARGUMENT error is returned. diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js index d37ebf466da..f28b5923834 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index 7b28b9288e9..ee490d71471 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { @@ -33,7 +34,7 @@ function main(parent, inputConfig) { * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in * ImportMetadata google.cloud.retail.v2alpha.ImportMetadata. * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const requestId = 'abc123' @@ -63,7 +64,7 @@ function main(parent, inputConfig) { * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js index ecda1d1cea4..a9a0d7ea007 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -41,10 +42,10 @@ function main(parent) { * A page token * ListProductsResponse.next_page_token google.cloud.retail.v2alpha.ListProductsResponse.next_page_token, * received from a previous - * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts + * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts + * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -54,13 +55,13 @@ function main(parent) { * * List all the products under the parent branch if * filter google.cloud.retail.v2alpha.ListProductsRequest.filter is unset. * * List - * Product.Type.VARIANT google.cloud.retail.v2alpha.Product.Type.VARIANT + * Product.Type.VARIANT google.cloud.retail.v2alpha.Product.Type.VARIANT * Product google.cloud.retail.v2alpha.Product s sharing the same - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY * Product google.cloud.retail.v2alpha.Product. For example: * `primary_product_id = "some_product_id"` * * List Product google.cloud.retail.v2alpha.Product s bundled in a - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION * Product google.cloud.retail.v2alpha.Product. * For example: * `collection_product_id = "some_product_id"` @@ -71,9 +72,9 @@ function main(parent) { * `type = "COLLECTION"` * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. * If the specified - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY * Product google.cloud.retail.v2alpha.Product or - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION * Product google.cloud.retail.v2alpha.Product does not exist, a NOT_FOUND * error is returned. */ @@ -81,13 +82,13 @@ function main(parent) { /** * The fields of Product google.cloud.retail.v2alpha.Product to return in * the responses. If not set or empty, the following fields are returned: - * * Product.name google.cloud.retail.v2alpha.Product.name - * * Product.id google.cloud.retail.v2alpha.Product.id - * * Product.title google.cloud.retail.v2alpha.Product.title - * * Product.uri google.cloud.retail.v2alpha.Product.uri - * * Product.images google.cloud.retail.v2alpha.Product.images - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.brands google.cloud.retail.v2alpha.Product.brands + * * Product.name google.cloud.retail.v2alpha.Product.name + * * Product.id google.cloud.retail.v2alpha.Product.id + * * Product.title google.cloud.retail.v2alpha.Product.title + * * Product.uri google.cloud.retail.v2alpha.Product.uri + * * Product.images google.cloud.retail.v2alpha.Product.images + * * Product.price_info google.cloud.retail.v2alpha.Product.price_info + * * Product.brands google.cloud.retail.v2alpha.Product.brands * If "*" is provided, all fields are returned. * Product.name google.cloud.retail.v2alpha.Product.name is always returned * no matter what mask is set. @@ -99,7 +100,7 @@ function main(parent) { * If true and * page_token google.cloud.retail.v2alpha.ListProductsRequest.page_token is * empty, - * ListProductsResponse.total_size google.cloud.retail.v2alpha.ListProductsResponse.total_size + * ListProductsResponse.total_size google.cloud.retail.v2alpha.ListProductsResponse.total_size * is set to the total count of matched items irrespective of pagination. * Notice that setting this field to true affects the performance. */ @@ -120,7 +121,7 @@ function main(parent) { // Run request const iterable = await retailClient.listProductsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js index 6360a86186c..7d85e0cdd4b 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, type, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js index 4210ef328ed..205da855e08 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index 72b2b9d96aa..10cc6f9fb0c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(inventory) { @@ -22,10 +23,10 @@ function main(inventory) { /** * Required. The inventory information to update. The allowable fields to * update are: - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.availability google.cloud.retail.v2alpha.Product.availability - * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info + * * Product.price_info google.cloud.retail.v2alpha.Product.price_info + * * Product.availability google.cloud.retail.v2alpha.Product.availability + * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * The updated inventory fields must be specified in * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask. * If SetInventoryRequest.inventory.name is empty or invalid, an @@ -43,10 +44,10 @@ function main(inventory) { * using the provided or default value for * SetInventoryRequest.set_time google.cloud.retail.v2alpha.SetInventoryRequest.set_time. * The last update time is recorded for the following inventory fields: - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.availability google.cloud.retail.v2alpha.Product.availability - * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info + * * Product.price_info google.cloud.retail.v2alpha.Product.price_info + * * Product.availability google.cloud.retail.v2alpha.Product.availability + * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is * needed, UpdateProduct should be invoked instead. */ diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js index 078d4fbdfec..36d0038609a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product) { @@ -26,7 +27,7 @@ function main(product) { * not it exists, a PERMISSION_DENIED error is returned. * If the Product google.cloud.retail.v2alpha.Product to update does not * exist and - * allow_missing google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing + * allow_missing google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing * is not set, a NOT_FOUND error is returned. */ // const product = {} diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index 24a80d3340a..f38a7cf18e4 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(placement, visitorId) { @@ -61,10 +62,10 @@ function main(placement, visitorId) { * A page token * SearchResponse.next_page_token google.cloud.retail.v2alpha.SearchResponse.next_page_token, * received from a previous - * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search + * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search + * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -91,11 +92,11 @@ function main(placement, visitorId) { * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with - * SearchRequest.canonical_filter google.cloud.retail.v2alpha.SearchRequest.canonical_filter + * SearchRequest.canonical_filter google.cloud.retail.v2alpha.SearchRequest.canonical_filter * will be returned as a supplement of the original query. This field is * strongly recommended to achieve high search quality. * See - * SearchRequest.filter google.cloud.retail.v2alpha.SearchRequest.filter + * SearchRequest.filter google.cloud.retail.v2alpha.SearchRequest.filter * for more details about filter syntax. */ // const canonicalFilter = 'abc123' @@ -125,7 +126,7 @@ function main(placement, visitorId) { * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). * Notice that if both - * ServingConfig.boost_control_ids google.cloud.retail.v2alpha.ServingConfig.boost_control_ids + * ServingConfig.boost_control_ids google.cloud.retail.v2alpha.ServingConfig.boost_control_ids * and SearchRequest.boost_spec are set, the boost conditions from both * places are evaluated. If a search request matches multiple boost * conditions, the final boost score is equal to the sum of the boost scores @@ -149,13 +150,13 @@ function main(placement, visitorId) { // const relevanceThreshold = {} /** * The keys to fetch and rollup the matching - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT + * variant google.cloud.retail.v2alpha.Product.Type.VARIANT * Product google.cloud.retail.v2alpha.Product s attributes. The attributes * from all the matching - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT + * variant google.cloud.retail.v2alpha.Product.Type.VARIANT * Product google.cloud.retail.v2alpha.Product s are merged and * de-duplicated. Notice that rollup - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT + * variant google.cloud.retail.v2alpha.Product.Type.VARIANT * Product google.cloud.retail.v2alpha.Product s attributes will lead to * extra query latency. Maximum number of keys is 10. * For FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo, a @@ -174,49 +175,49 @@ function main(placement, visitorId) { * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2alpha.Product.attributes map. * * pickupInStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "pickup-in-store". * * shipToStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "ship-to-store". * * sameDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "same-day-delivery". * * nextDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "next-day-delivery". * * customFulfillment1.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-1". * * customFulfillment2.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-2". * * customFulfillment3.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-3". * * customFulfillment4.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-4". * * customFulfillment5.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids + * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type + * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type * "custom-type-5". * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -257,7 +258,7 @@ function main(placement, visitorId) { // Run request const iterable = await retailClient.searchAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js index 4807eb3932b..930f51fc5bd 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js index 525442bc449..06b7559e630 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js index 9d8540c7da3..ecc1b6e0368 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, filter) { @@ -30,7 +31,7 @@ function main(parent, filter) { * 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.v2alpha.UserEvent.event_type + * UserEvent.event_type google.cloud.retail.v2alpha.UserEvent.event_type * string. * * `eventTime`: in ISO 8601 "zulu" format. * * `visitorId`: Double quoted string. Specifying this will delete all diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js index 0a5997bdac0..8114ee822bf 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js index 3b8ccb24025..15c086eded7 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js index 10918a1e3b0..50d2b13b58b 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -33,7 +34,8 @@ function main() { async function callGetDefaultBranch() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await retailClient.getDefaultBranch(request); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js index eb58e87a52a..8d75723e386 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -38,10 +39,10 @@ function main(parent) { * A page token * ListCatalogsResponse.next_page_token google.cloud.retail.v2beta.ListCatalogsResponse.next_page_token, * received from a previous - * CatalogService.ListCatalogs google.cloud.retail.v2beta.CatalogService.ListCatalogs + * CatalogService.ListCatalogs google.cloud.retail.v2beta.CatalogService.ListCatalogs * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * CatalogService.ListCatalogs google.cloud.retail.v2beta.CatalogService.ListCatalogs + * CatalogService.ListCatalogs google.cloud.retail.v2beta.CatalogService.ListCatalogs * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -62,7 +63,7 @@ function main(parent) { // Run request const iterable = await retailClient.listCatalogsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js index be8bc09a380..7322b000eb2 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -32,7 +33,7 @@ function main() { // const branchId = 'abc123' /** * Some note on this request, this can be retrieved by - * CatalogService.GetDefaultBranch google.cloud.retail.v2beta.CatalogService.GetDefaultBranch + * CatalogService.GetDefaultBranch google.cloud.retail.v2beta.CatalogService.GetDefaultBranch * before next valid default branch set occurs. * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. @@ -47,7 +48,8 @@ function main() { async function callSetDefaultBranch() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await retailClient.setDefaultBranch(request); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js index 73cc1451a66..45e754b4054 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(catalog) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index c992ee208ef..e1f2b9a3af7 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(catalog, query) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js index 2b3d4297fb2..c09b24b11d1 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index b9fdab6115a..a3a8173aefd 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(placement, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js index 7ebff9f7383..3701ea3f7af 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, type, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js index 99b3712c648..18a4a77d0e4 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, product, productId) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js index 8198869cd66..cc9e2cc8a3c 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -30,9 +31,9 @@ function main(name) { * exist, a NOT_FOUND error is returned. * The Product google.cloud.retail.v2beta.Product to delete can neither be * a - * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION * Product google.cloud.retail.v2beta.Product member nor a - * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY * Product google.cloud.retail.v2beta.Product with more than one * variants google.cloud.retail.v2beta.Product.Type.VARIANT. Otherwise, an * INVALID_ARGUMENT error is returned. diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js index a36cae42916..08b461617ae 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index 7db5f12367c..99d7812776b 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { @@ -33,7 +34,7 @@ function main(parent, inputConfig) { * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in * ImportMetadata google.cloud.retail.v2beta.ImportMetadata. * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const requestId = 'abc123' @@ -63,7 +64,7 @@ function main(parent, inputConfig) { * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js index 5b770e84942..f3f720cc833 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -41,10 +42,10 @@ function main(parent) { * A page token * ListProductsResponse.next_page_token google.cloud.retail.v2beta.ListProductsResponse.next_page_token, * received from a previous - * ProductService.ListProducts google.cloud.retail.v2beta.ProductService.ListProducts + * ProductService.ListProducts google.cloud.retail.v2beta.ProductService.ListProducts * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * ProductService.ListProducts google.cloud.retail.v2beta.ProductService.ListProducts + * ProductService.ListProducts google.cloud.retail.v2beta.ProductService.ListProducts * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -54,13 +55,13 @@ function main(parent) { * * List all the products under the parent branch if * filter google.cloud.retail.v2beta.ListProductsRequest.filter is unset. * * List - * Product.Type.VARIANT google.cloud.retail.v2beta.Product.Type.VARIANT + * Product.Type.VARIANT google.cloud.retail.v2beta.Product.Type.VARIANT * Product google.cloud.retail.v2beta.Product s sharing the same - * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY * Product google.cloud.retail.v2beta.Product. For example: * `primary_product_id = "some_product_id"` * * List Product google.cloud.retail.v2beta.Product s bundled in a - * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION * Product google.cloud.retail.v2beta.Product. * For example: * `collection_product_id = "some_product_id"` @@ -71,9 +72,9 @@ function main(parent) { * `type = "COLLECTION"` * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. * If the specified - * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY + * Product.Type.PRIMARY google.cloud.retail.v2beta.Product.Type.PRIMARY * Product google.cloud.retail.v2beta.Product or - * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION + * Product.Type.COLLECTION google.cloud.retail.v2beta.Product.Type.COLLECTION * Product google.cloud.retail.v2beta.Product does not exist, a NOT_FOUND * error is returned. */ @@ -81,13 +82,13 @@ function main(parent) { /** * The fields of Product google.cloud.retail.v2beta.Product to return in * the responses. If not set or empty, the following fields are returned: - * * Product.name google.cloud.retail.v2beta.Product.name - * * Product.id google.cloud.retail.v2beta.Product.id - * * Product.title google.cloud.retail.v2beta.Product.title - * * Product.uri google.cloud.retail.v2beta.Product.uri - * * Product.images google.cloud.retail.v2beta.Product.images - * * Product.price_info google.cloud.retail.v2beta.Product.price_info - * * Product.brands google.cloud.retail.v2beta.Product.brands + * * Product.name google.cloud.retail.v2beta.Product.name + * * Product.id google.cloud.retail.v2beta.Product.id + * * Product.title google.cloud.retail.v2beta.Product.title + * * Product.uri google.cloud.retail.v2beta.Product.uri + * * Product.images google.cloud.retail.v2beta.Product.images + * * Product.price_info google.cloud.retail.v2beta.Product.price_info + * * Product.brands google.cloud.retail.v2beta.Product.brands * If "*" is provided, all fields are returned. * Product.name google.cloud.retail.v2beta.Product.name is always returned * no matter what mask is set. @@ -111,7 +112,7 @@ function main(parent) { // Run request const iterable = await retailClient.listProductsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js index 12f13f6991b..95eb55e64dd 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product, type, placeIds) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js index fa4cfb98690..d8de314294a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(inventory) { @@ -22,10 +23,10 @@ function main(inventory) { /** * Required. The inventory information to update. The allowable fields to * update are: - * * Product.price_info google.cloud.retail.v2beta.Product.price_info - * * Product.availability google.cloud.retail.v2beta.Product.availability - * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info + * * Product.price_info google.cloud.retail.v2beta.Product.price_info + * * Product.availability google.cloud.retail.v2beta.Product.availability + * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * The updated inventory fields must be specified in * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask. * If SetInventoryRequest.inventory.name is empty or invalid, an @@ -43,10 +44,10 @@ function main(inventory) { * provided or default value for * SetInventoryRequest.set_time google.cloud.retail.v2beta.SetInventoryRequest.set_time. * The last update time is recorded for the following inventory fields: - * * Product.price_info google.cloud.retail.v2beta.Product.price_info - * * Product.availability google.cloud.retail.v2beta.Product.availability - * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info + * * Product.price_info google.cloud.retail.v2beta.Product.price_info + * * Product.availability google.cloud.retail.v2beta.Product.availability + * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity + * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is * needed, UpdateProduct should be invoked instead. */ diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js index 112b4f4ff8d..06cb8b6586f 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(product) { @@ -26,7 +27,7 @@ function main(product) { * it exists, a PERMISSION_DENIED error is returned. * If the Product google.cloud.retail.v2beta.Product to update does not * exist and - * allow_missing google.cloud.retail.v2beta.UpdateProductRequest.allow_missing + * allow_missing google.cloud.retail.v2beta.UpdateProductRequest.allow_missing * is not set, a NOT_FOUND error is returned. */ // const product = {} diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index e7e8a49fee3..9ff5589ce95 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(placement, visitorId) { @@ -61,10 +62,10 @@ function main(placement, visitorId) { * A page token * SearchResponse.next_page_token google.cloud.retail.v2beta.SearchResponse.next_page_token, * received from a previous - * SearchService.Search google.cloud.retail.v2beta.SearchService.Search + * SearchService.Search google.cloud.retail.v2beta.SearchService.Search * call. Provide this to retrieve the subsequent page. * When paginating, all other parameters provided to - * SearchService.Search google.cloud.retail.v2beta.SearchService.Search + * SearchService.Search google.cloud.retail.v2beta.SearchService.Search * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. */ @@ -90,10 +91,10 @@ function main(placement, visitorId) { * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with - * SearchRequest.canonical_filter google.cloud.retail.v2beta.SearchRequest.canonical_filter + * SearchRequest.canonical_filter google.cloud.retail.v2beta.SearchRequest.canonical_filter * will be returned as a supplement of the original query. This field is * strongly recommended to achieve high search quality. - * See SearchRequest.filter google.cloud.retail.v2beta.SearchRequest.filter + * See SearchRequest.filter google.cloud.retail.v2beta.SearchRequest.filter * for more details about filter syntax. */ // const canonicalFilter = 'abc123' @@ -137,13 +138,13 @@ function main(placement, visitorId) { // const queryExpansionSpec = {} /** * The keys to fetch and rollup the matching - * variant google.cloud.retail.v2beta.Product.Type.VARIANT + * variant google.cloud.retail.v2beta.Product.Type.VARIANT * Product google.cloud.retail.v2beta.Product s attributes. The attributes * from all the matching - * variant google.cloud.retail.v2beta.Product.Type.VARIANT + * variant google.cloud.retail.v2beta.Product.Type.VARIANT * Product google.cloud.retail.v2beta.Product s are merged and * de-duplicated. Notice that rollup - * variant google.cloud.retail.v2beta.Product.Type.VARIANT + * variant google.cloud.retail.v2beta.Product.Type.VARIANT * Product google.cloud.retail.v2beta.Product s attributes will lead to * extra query latency. Maximum number of keys is 10. * For FulfillmentInfo google.cloud.retail.v2beta.FulfillmentInfo, a @@ -162,40 +163,40 @@ function main(placement, visitorId) { * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2beta.Product.attributes map. * * pickupInStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "pickup-in-store". * * shipToStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "ship-to-store". * * sameDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "same-day-delivery". * * nextDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "next-day-delivery". * * customFulfillment1.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-1". * * customFulfillment2.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-2". * * customFulfillment3.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-3". * * customFulfillment4.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-4". * * customFulfillment5.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids - * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type + * FulfillmentInfo.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids + * for FulfillmentInfo.type google.cloud.retail.v2beta.FulfillmentInfo.type * "custom-type-5". * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. @@ -236,7 +237,7 @@ function main(placement, visitorId) { // Run request const iterable = await retailClient.searchAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js index 5257ffc8738..9bb64cfbc32 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, userEvent) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js index e2b50f9541d..038c2205176 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, inputConfig) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js index fefe0b66cee..afd6b27c011 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, filter) { @@ -30,7 +31,7 @@ function main(parent, filter) { * 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.v2beta.UserEvent.event_type + * UserEvent.event_type google.cloud.retail.v2beta.UserEvent.event_type * string. * * `eventTime`: in ISO 8601 "zulu" format. * * `visitorId`: Double quoted string. Specifying this will delete all diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js index 33eb3d5f6d3..e3c9cfbf810 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js index f1368ba57f2..363c3ec27e0 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent, userEvent) { diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 16ee045dc50..7ceb236c6e3 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index 7a5b0bf2310..c0ef2336174 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2/index.ts b/packages/google-cloud-retail/src/v2/index.ts index c0d103f8c56..79cde8aa80a 100644 --- a/packages/google-cloud-retail/src/v2/index.ts +++ b/packages/google-cloud-retail/src/v2/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 4ff765ed50b..aa9fc02d2e1 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 46c20ec7617..3724cb283da 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 7ea63a4990b..4352de1ee1a 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 8e8a3289578..549b370b818 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index f9ce0a35cbf..658ad04a489 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 428558ac04e..5522dfcd564 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/index.ts b/packages/google-cloud-retail/src/v2alpha/index.ts index c0d103f8c56..79cde8aa80a 100644 --- a/packages/google-cloud-retail/src/v2alpha/index.ts +++ b/packages/google-cloud-retail/src/v2alpha/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 46349b02da0..ae7eb5fd19c 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 9cdc89a68eb..322dbdc4da2 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 22cbdad1be4..5bc5c39e209 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 6092fdc96f7..f46ba91e496 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index b490b61567b..4082bf1f4bc 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 2682fc469bb..6603baf2dad 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/index.ts b/packages/google-cloud-retail/src/v2beta/index.ts index c0d103f8c56..79cde8aa80a 100644 --- a/packages/google-cloud-retail/src/v2beta/index.ts +++ b/packages/google-cloud-retail/src/v2beta/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 77ffb3cf587..01129b50d33 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index fe721c55f3c..9cb73ce1df1 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 7865c14c778..e8f1a53ef10 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 6841441e06b..c89416c92f5 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js index 4c65a68f89c..986ce62b21c 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts index 6dbf8105ff8..4dfeab32f92 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/system-test/install.ts b/packages/google-cloud-retail/system-test/install.ts index d2d61c0396f..6dd1eaadafa 100644 --- a/packages/google-cloud-retail/system-test/install.ts +++ b/packages/google-cloud-retail/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index 6819dea39cf..582e6e6df15 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index ffb098d3ae0..374e9e18a43 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index b572de9e6d6..630efa9fa1b 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index 68dd6788fe6..17e5c1275f6 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index 7a9fa4c4fd1..1262558bb16 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index 1ff395475cf..6f72dda218c 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 96fcc59fd03..40cd065044d 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index 05dd2edfb24..59b633b6217 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index 03ca999805f..121f9424ec7 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 4fb8c470959..cfdc6106b9e 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index d4a3fe2fb2e..fda30691e5e 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index c7596bf30c8..4fd231802e6 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index 9843b0bc519..1e632056031 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index a90d253718d..f56fbf1da7f 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index ba2f81f1b48..0e2db3f4341 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index 246309144e2..0e090b06fd8 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index 91225ec816b..7437fdcc4c5 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index fd1b4979a08..3ac156f753e 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 6fb130c726bc508c29ea9cb3e879947bdf984fe0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 26 Jan 2022 19:58:17 +0000 Subject: [PATCH 062/103] chore: update v2.12.0 gapic-generator-typescript (#132) - [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 424244721 Source-Link: https://github.com/googleapis/googleapis/commit/4b6b01f507ebc3df95fdf8e1d76b0ae0ae33e52c Source-Link: https://github.com/googleapis/googleapis-gen/commit/8ac83fba606d008c7e8a42e7d55b6596ec4be35f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGFjODNmYmE2MDZkMDA4YzdlOGE0MmU3ZDU1YjY1OTZlYzRiZTM1ZiJ9 --- packages/google-cloud-retail/linkinator.config.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/linkinator.config.json b/packages/google-cloud-retail/linkinator.config.json index 0121dfa684f..befd23c8633 100644 --- a/packages/google-cloud-retail/linkinator.config.json +++ b/packages/google-cloud-retail/linkinator.config.json @@ -3,8 +3,14 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io" + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" ], "silent": true, - "concurrency": 5 + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 } From 1e20e287b2e2f8b6e3b51de44ae639ee26022159 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Feb 2022 01:34:41 +0000 Subject: [PATCH 063/103] feat: add ControlService feat: and ServingConfigService (#139) PiperOrigin-RevId: 425694473 Source-Link: https://github.com/googleapis/googleapis/commit/eceb9e8a36b73ad8a3355d267ec9204d8e40b3bc Source-Link: https://github.com/googleapis/googleapis-gen/commit/45478758666606b75ff29ef6422d71f5c43dbbe5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDU0Nzg3NTg2NjY2MDZiNzVmZjI5ZWY2NDIyZDcxZjVjNDNkYmJlNSJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/retail/v2alpha/catalog.proto | 18 + .../retail/v2alpha/catalog_service.proto | 2 + .../google/cloud/retail/v2alpha/common.proto | 265 +- .../cloud/retail/v2alpha/import_config.proto | 10 + .../google/cloud/retail/v2alpha/product.proto | 77 +- .../retail/v2alpha/product_service.proto | 13 +- .../cloud/retail/v2alpha/purge_config.proto | 2 + .../cloud/retail/v2alpha/search_service.proto | 24 +- .../cloud/retail/v2alpha/user_event.proto | 20 +- .../google-cloud-retail/protos/protos.d.ts | 1544 +++++++- packages/google-cloud-retail/protos/protos.js | 3374 ++++++++++++++++- .../google-cloud-retail/protos/protos.json | 220 ++ .../product_service.add_local_inventories.js | 2 +- ...roduct_service.remove_local_inventories.js | 2 +- .../v2alpha/product_service.set_inventory.js | 4 +- .../v2alpha/search_service.search.js | 18 +- .../src/v2alpha/product_service_client.ts | 13 +- .../src/v2alpha/search_service_client.ts | 57 +- 18 files changed, 5240 insertions(+), 425 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index f628bb36156..7cb4da0eca6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -110,6 +110,24 @@ message MerchantCenterLink { // _ads", "Free_listings", "Free_local_listings" // NOTE: The string values are case sensitive. repeated string destinations = 3; + + // Region code of offers to accept. 2-letter Uppercase ISO 3166-1 alpha-2 + // code. List of values can be found + // [here](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) + // under the `region` tag. If left blank no region filtering will be + // performed. + // + // Example value: `US`. + string region_code = 4; + + // Language of the title/description and other string attributes. Use language + // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + // ISO 639-1. + // + // This specifies the language of offers in Merchant Center that will be + // accepted. + // If empty no language filtering will be performed. + string language_code = 5; } // Configures Merchant Center linking. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto index ac77b924056..bd7265ac927 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto @@ -21,6 +21,8 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/catalog.proto"; +import "google/cloud/retail/v2alpha/import_config.proto"; +import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index fac3529b351..696bd73f2bc 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -29,6 +29,249 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; option ruby_package = "Google::Cloud::Retail::V2alpha"; +// The type of solution. +enum SolutionType { + // Default value. + SOLUTION_TYPE_UNSPECIFIED = 0; + + // Used for Recommendations AI. + SOLUTION_TYPE_RECOMMENDATION = 1; + + // Used for Retail Search. + SOLUTION_TYPE_SEARCH = 2; +} + +// Metadata that is used to define a condition that triggers an action. +// A valid condition must specify at least one of 'query_terms' or +// 'products_filter'. If multiple fields are specified, the condition is met if +// all the fields are satisfied e.g. if a set of query terms and product_filter +// are set, then only items matching the product_filter for requests with a +// query matching the query terms wil get boosted. +message Condition { + // Query terms that we want to match on. + message QueryTerm { + // The value of the term to match on. + // Value cannot be empty. + // Value can have at most 3 terms if specified as a partial match. Each + // space separated string is considered as one term. + // Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not + // allowed for partial match. + string value = 1; + + // Whether this is supposed to be a full or partial match. + bool full_match = 2; + } + + // Used for time-dependent conditions. + // Example: Want to have rule applied for week long sale. + message TimeRange { + // Start of time range. Range is inclusive. + google.protobuf.Timestamp start_time = 1; + + // End of time range. Range is inclusive. + google.protobuf.Timestamp end_time = 2; + } + + // A list (up to 10 entries) of terms to match the query on. If not + // specified, match all queries. + // If many query terms are specified, the condition + // is matched if any of the terms is a match (i.e. using the OR operator). + repeated QueryTerm query_terms = 1; + + // Range of time(s) specifying when Condition is active. + // Condition true if any time range matches. + repeated TimeRange active_time_range = 3; +} + +// A rule is a condition-action pair +// * A condition defines when a rule is to be triggered. +// * An action specifies what occurs on that trigger. +// Currently only boost rules are supported. +// Currently only supported by the search endpoint. +message Rule { + // A boost action to apply to results matching condition specified above. + message BoostAction { + // Strength of the condition boost, which must be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 1; + + // The filter can have a max size of 5000 characters. + // An expression which specifies which products to apply an action to. + // The syntax and supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] + // for detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string products_filter = 2; + } + + // * Rule Condition: + // - No [Condition][query_terms] provided is a global match. + // - 1 or more [Condition][query_terms] provided is combined with OR + // operator. + // * Action Input: The request query and filter that will be applied to the + // retrieved products, in addition to any filters already provided with the + // SearchRequest. The AND operator is used to combine the query's existing + // filters with the filter rule(s). NOTE: May result in 0 results when + // filters conflict. + // * Action Result: Filters the returned objects to be ONLY those that passed + // the filter. + message FilterAction { + // A filter to apply on the matching condition results. Supported features: + // + // * [filter][google.cloud.retail.v2alpha.Rule.FilterAction.filter] must be + // set. + // * Filter syntax is identical to + // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. + // See more + // details at the Retail Search + // [user guide](/retail/search/docs/filter-and-order#filter). + // * To filter products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string filter = 1; + } + + // Redirects a shopper to a specific page. + // * Rule Condition: + // - Must specify [Condition][query_terms]. + // * Action Input: Request Query + // * Action Result: Redirects shopper to provided uri. + message RedirectAction { + // URL must have length equal or less than 2000 characters. + string redirect_uri = 1; + } + + // Creates a set of terms that will be treated as synonyms of each other. + // Example: synonyms of "sneakers" and "shoes". + // * "sneakers" will use a synonym of "shoes". + // * "shoes" will use a synonym of "sneakers". + message TwowaySynonymsAction { + // Defines a set of synonyms. + // Can specify up to 100 synonyms. + // Must specify at least 2 synonyms. + repeated string synonyms = 1; + } + + // Maps a set of terms to a set of synonyms. + // Set of synonyms will be treated as synonyms of each query term only. + // `query_terms` will not be treated as synonyms of each other. + // Example: "sneakers" will use a synonym of "shoes". + // "shoes" will not use a synonym of "sneakers". + message OnewaySynonymsAction { + // Terms from the search query. + // Will treat synonyms as their synonyms. + // Not themselves synonyms of the synonyms. + // Can specify up to 100 terms. + repeated string query_terms = 3; + + // Defines a set of synonyms. + // Cannot contain duplicates. + // Can specify up to 100 synonyms. + repeated string synonyms = 4; + + // Will be [deprecated = true] post migration; + repeated string oneway_terms = 2; + } + + // Prevents `query_term` from being associated with specified terms during + // search. + // Example: Don't associate "gShoe" and "cheap". + message DoNotAssociateAction { + // Terms from the search query. + // Will not consider do_not_associate_terms for search if in search query. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Cannot contain duplicates or the query term. + // Can specify up to 100 terms. + repeated string do_not_associate_terms = 3; + + // Will be [deprecated = true] post migration; + repeated string terms = 1; + } + + // Replaces a term in the query. Multiple replacement candidates can be + // specified. All `query_terms` will be replaced with the replacement term. + // Example: Replace "gShoe" with "google shoe". + message ReplacementAction { + // Terms from the search query. + // Will be replaced by replacement term. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Term that will be used for replacement. + string replacement_term = 3; + + // Will be [deprecated = true] post migration; + string term = 1; + } + + // Prevents a term in the query from being used in search. + // Example: Don't search for "shoddy". + message IgnoreAction { + // Terms to ignore in the search query. + repeated string ignore_terms = 1; + } + + // An action must be provided. + oneof action { + // A boost action. + BoostAction boost_action = 2; + + // Redirects a shopper to a specific page. + RedirectAction redirect_action = 3; + + // Treats specific term as a synonym with a group of terms. + // Group of terms will not be treated as synonyms with the specific term. + OnewaySynonymsAction oneway_synonyms_action = 6; + + // Prevents term from being associated with other terms. + DoNotAssociateAction do_not_associate_action = 7; + + // Replaces specific terms in the query. + ReplacementAction replacement_action = 8; + + // Ignores specific terms from query during search. + IgnoreAction ignore_action = 9; + + // Filters results. + FilterAction filter_action = 10; + + // Treats a set of terms as synonyms of one another. + TwowaySynonymsAction twoway_synonyms_action = 11; + } + + // Required. The condition that triggers the rule. + // If the condition is empty, the rule will always apply. + Condition condition = 1 [(google.api.field_behavior) = REQUIRED]; +} + // An intended audience of the [Product][google.cloud.retail.v2alpha.Product] // for whom it's sold. message Audience { @@ -100,10 +343,6 @@ 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.v2alpha.CustomAttribute.text] or // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. @@ -112,9 +351,6 @@ message CustomAttribute { // 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.v2alpha.CustomAttribute.text] or // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. @@ -281,7 +517,7 @@ message PriceInfo { // // Google Merchant Center property // [price](https://support.google.com/merchants/answer/6324371). Schema.org - // property [Offer.priceSpecification](https://schema.org/priceSpecification). + // property [Offer.price](https://schema.org/price). float price = 2; // Price of the product without any discount. If zero, by default set to be @@ -447,16 +683,21 @@ message LocalInventory { // Additional local inventory attributes, for example, store name, promotion // tags, etc. - // * At most 5 values are allowed. Otherwise, an INVALID_ARGUMENT error is - // returned. - // * The key must be a UTF-8 encoded string with a length limit of 10 + // + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * At most 30 attributes are allowed. + // * The key must be a UTF-8 encoded string with a length limit of 32 // characters. // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, // key0LikeThis or KEY_1_LIKE_THIS. // * The attribute values must be of the same type (text or number). // * The max number of values per attribute is 10. - // * For text values, the length limit is 10 UTF-8 characters. + // * For text values, the length limit is 256 UTF-8 characters. // * The attribute does not support search. The `searchable` field should be // unset or set to false. + // * The max summed total bytes of custom attribute keys and values per + // product is 5MiB. map attributes = 3; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto index 1e77414a19a..b8cc15f89e3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto @@ -64,6 +64,16 @@ message GcsSource { // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. // * `user_event_ga360`: Using // https://support.google.com/analytics/answer/3437719. + // + // Supported values for control imports: + // + // * 'control' (default): One JSON + // [Control][google.cloud.retail.v2alpha.Control] per line. + // + // Supported values for catalog attribute imports: + // + // * 'catalog_attribute' (default): One CSV + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] per line. string data_schema = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index 88adca6206c..0d6fef3e97e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -121,7 +121,7 @@ message Product { // [publish_time][google.cloud.retail.v2alpha.Product.publish_time], // otherwise an INVALID_ARGUMENT error is thrown. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [expiration_date](https://support.google.com/merchants/answer/6324499). google.protobuf.Timestamp expire_time = 16; @@ -161,9 +161,9 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [id](https://support.google.com/merchants/answer/6324405). Schema.org - // Property [Product.sku](https://schema.org/sku). + // property [Product.sku](https://schema.org/sku). string id = 2 [(google.api.field_behavior) = IMMUTABLE]; // Immutable. The type of the product. Default to @@ -186,21 +186,23 @@ message Product { // [Product][google.cloud.retail.v2alpha.Product]. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center Property + // Corresponding properties: Google Merchant Center property // [item_group_id](https://support.google.com/merchants/answer/6324507). - // Schema.org Property + // 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; // The [id][google.cloud.retail.v2alpha.Product.id] of the collection members // when [type][google.cloud.retail.v2alpha.Product.type] is // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]. // - // Should not set it for other types. A maximum of 1000 values are allowed. - // Otherwise, an INVALID_ARGUMENT error is return. + // Non-existent product ids are allowed. + // The [type][google.cloud.retail.v2alpha.Product.type] of the members must be + // either [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] or + // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] otherwise + // and INVALID_ARGUMENT error is thrown. Should not set it for other types. A + // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is + // return. repeated string collection_member_ids = 5; // The Global Trade Item Number (GTIN) of the product. @@ -211,13 +213,13 @@ message Product { // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is // returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [gtin](https://support.google.com/merchants/answer/6324461). // Schema.org property - // [Product.isbn](https://schema.org/isbn) or - // [Product.gtin8](https://schema.org/gtin8) or - // [Product.gtin12](https://schema.org/gtin12) or - // [Product.gtin13](https://schema.org/gtin13) or + // [Product.isbn](https://schema.org/isbn), + // [Product.gtin8](https://schema.org/gtin8), + // [Product.gtin12](https://schema.org/gtin12), + // [Product.gtin13](https://schema.org/gtin13), or // [Product.gtin14](https://schema.org/gtin14). // // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. @@ -252,7 +254,7 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [google_product_category][mc_google_product_category]. Schema.org property // [Product.category] (https://schema.org/category). // @@ -265,7 +267,7 @@ message Product { // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: 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]; @@ -276,7 +278,7 @@ message Product { // string with a length limit of 1,000 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [brand](https://support.google.com/merchants/answer/6324351). Schema.org // property [Product.brand](https://schema.org/brand). repeated string brands = 9; @@ -286,13 +288,13 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [description](https://support.google.com/merchants/answer/6324468). - // schema.org property [Product.description](https://schema.org/description). + // Schema.org property [Product.description](https://schema.org/description). string description = 10; // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt]. + // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). // // For product prediction, this field is ignored and the model automatically // detects the text language. The @@ -327,7 +329,12 @@ message Product { // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. // * For indexable attribute, the key must match the pattern: - // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, key0LikeThis or KEY_1_LIKE_THIS. + // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or + // `KEY_1_LIKE_THIS`. + // * For text attributes, 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. + // * For number attributes, at most 400 values are allowed. map attributes = 12; // Custom tags associated with the product. @@ -341,13 +348,13 @@ message Product { // tag as part of the // [PredictRequest.filter][google.cloud.retail.v2alpha.PredictRequest.filter]. // - // Google Merchant Center property + // Corresponding properties: 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 + // Corresponding properties: Google Merchant Center property // [price](https://support.google.com/merchants/answer/6324371). PriceInfo price_info = 14; @@ -363,9 +370,9 @@ message Product { // [Product][google.cloud.retail.v2alpha.Product]. Default to // [Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK]. // - // Google Merchant Center Property + // Corresponding properties: Google Merchant Center property // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org Property [Offer.availability](https://schema.org/availability). + // Schema.org property [Offer.availability](https://schema.org/availability). Availability availability = 19; // The available quantity of the item. @@ -387,7 +394,7 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [link](https://support.google.com/merchants/answer/6324416). Schema.org // property [Offer.url](https://schema.org/url). string uri = 22; @@ -397,7 +404,7 @@ message Product { // // A maximum of 300 images are allowed. // - // Google Merchant Center property + // Corresponding properties: 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; @@ -408,7 +415,7 @@ message Product { // The color of the product. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [color](https://support.google.com/merchants/answer/6324487). Schema.org // property [Product.color](https://schema.org/color). ColorInfo color_info = 25; @@ -426,9 +433,9 @@ message Product { // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [size](https://support.google.com/merchants/answer/6324492), - // [size_type](https://support.google.com/merchants/answer/6324497) and + // [size_type](https://support.google.com/merchants/answer/6324497), and // [size_system](https://support.google.com/merchants/answer/6324502). // Schema.org property [Product.size](https://schema.org/size). repeated string sizes = 26; @@ -439,7 +446,7 @@ message Product { // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [material](https://support.google.com/merchants/answer/6324410). Schema.org // property [Product.material](https://schema.org/material). repeated string materials = 27; @@ -452,7 +459,7 @@ message Product { // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org // property [Product.pattern](https://schema.org/pattern). repeated string patterns = 28; @@ -460,12 +467,12 @@ message Product { // The condition of the product. Strongly encouraged to use the standard // values: "new", "refurbished", "used". // - // A maximum of 5 values are allowed per + // A maximum of 1 value is allowed per // [Product][google.cloud.retail.v2alpha.Product]. Each value 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 + // Corresponding properties: Google Merchant Center property // [condition](https://support.google.com/merchants/answer/6324469). // Schema.org property // [Offer.itemCondition](https://schema.org/itemCondition). diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index c88e6504120..23bb0ff69f8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -230,7 +230,7 @@ service ProductService { // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // - // Store inventory information can only be modified using this method. + // Local inventory information can only be modified using this method. // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] // and // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] @@ -263,7 +263,7 @@ service ProductService { // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // - // Store inventory information can only be removed using this method. + // Local inventory information can only be removed using this method. // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] // and // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] @@ -558,8 +558,9 @@ message SetInventoryRequest { Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which inventory fields in the provided - // [Product][google.cloud.retail.v2alpha.Product] to update. If not set or set - // with empty paths, all inventory fields will be updated. + // [Product][google.cloud.retail.v2alpha.Product] to update. + // + // At least one field must be provided. // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned and the entire update will be ignored. @@ -680,7 +681,7 @@ message AddLocalInventoriesRequest { ]; // Required. A list of inventory information at difference places. Each place - // is identified by its place ID. At most 1000 inventories are allowed per + // is identified by its place ID. At most 3000 inventories are allowed per // request. repeated LocalInventory local_inventories = 2 [(google.api.field_behavior) = REQUIRED]; @@ -741,7 +742,7 @@ message RemoveLocalInventoriesRequest { ]; // Required. A list of place IDs to have their inventory deleted. - // At most 1000 place IDs are allowed per request. + // At most 3000 place IDs are allowed per request. repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; // The time when the inventory deletions are issued. Used to prevent diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto index 269ae2ffe82..638e8f67b84 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto @@ -18,6 +18,8 @@ package google.cloud.retail.v2alpha; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index 3d903a65cc4..aec89f85c45 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -106,6 +106,7 @@ message SearchRequest { // * "ratingCount" // * "attributes.key" // * "inventory(place_id,price)" + // * "inventory(place_id,original_price)" // * "inventory(place_id,attributes.key)" string key = 1 [(google.api.field_behavior) = REQUIRED]; @@ -427,6 +428,9 @@ message SearchRequest { // identify a visitor on a single device. This unique identifier should not // change if the visitor logs in or out of the website. // + // This should be the same identifier as + // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id]. + // // 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 = 4 [(google.api.field_behavior) = REQUIRED]; @@ -532,14 +536,15 @@ message SearchRequest { // The keys to fetch and rollup the matching // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s attributes. The attributes - // from all the matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s are merged and - // de-duplicated. Notice that rollup + // [Product][google.cloud.retail.v2alpha.Product]s attributes, + // [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo] or + // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory]s attributes. + // The attributes from all the matching // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s attributes will lead to - // extra query latency. Maximum number of keys is 10. + // [Product][google.cloud.retail.v2alpha.Product]s or + // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory]s are merged + // and de-duplicated. Notice that rollup attributes will lead to extra query + // latency. Maximum number of keys is 30. // // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], a // fulfillment type and a fulfillment ID must be provided in the format of @@ -554,6 +559,7 @@ message SearchRequest { // * discount // * variantId // * inventory(place_id,price) + // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the // [Product.inventories.attributes][] map. // * attributes.key, where key is any key in the @@ -783,4 +789,8 @@ message SearchResponse { // [attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] // will be set in the response. string redirect_uri = 10; + + // The fully qualified resource name of applied + // [controls](https://cloud.google.com/retail/docs/serving-control-rules). + repeated string applied_controls = 12; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto index 6e025f7a902..6b2d048e1ec 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -40,7 +40,6 @@ message UserEvent { // * `add-to-cart`: Products being added to cart. // * `category-page-view`: Special pages such as sale or promotion pages // viewed. - // * `completion`: Completion query result showed/clicked. // * `detail-page-view`: Products detail page viewed. // * `home-page-view`: Homepage viewed. // * `promotion-offered`: Promotion is offered to a user. @@ -118,6 +117,7 @@ message UserEvent { // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` + // * `search` // // 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 browsing the @@ -128,17 +128,23 @@ message UserEvent { // desired. The end user may have not finished browsing the whole page yet. repeated ProductDetail product_details = 6; - // The main completion details related to the event. + // The main auto-completion details related to the event. // - // In a `completion` event, this field represents the completions returned to - // the end user and the clicked completion by the end user. In a `search` - // event, it represents the search event happens after clicking completion. + // This field should be set for `search` event when autocomplete function is + // enabled and the user clicks a suggestion for search. CompletionDetail completion_detail = 22; // 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. + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * The key must be a UTF-8 encoded string with a length limit of 5,000 + // characters. + // * For text attributes, 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. + // * For number attributes, at most 400 values are allowed. // // For product recommendation, an example of extra user information is // traffic_channel, i.e. how user arrives at the site. Users can arrive diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index b89c8cdda46..e3f5f57ef22 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -9471,6 +9471,12 @@ export namespace google { /** MerchantCenterLink destinations */ destinations?: (string[]|null); + + /** MerchantCenterLink regionCode */ + regionCode?: (string|null); + + /** MerchantCenterLink languageCode */ + languageCode?: (string|null); } /** Represents a MerchantCenterLink. */ @@ -9491,6 +9497,12 @@ export namespace google { /** MerchantCenterLink destinations. */ public destinations: string[]; + /** MerchantCenterLink regionCode. */ + public regionCode: string; + + /** MerchantCenterLink languageCode. */ + public languageCode: string; + /** * Creates a new MerchantCenterLink instance using the specified properties. * @param [properties] Properties to set @@ -9565,199 +9577,1403 @@ export namespace google { /** Properties of a MerchantCenterLinkingConfig. */ interface IMerchantCenterLinkingConfig { - /** MerchantCenterLinkingConfig links */ - links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); - } + /** MerchantCenterLinkingConfig links */ + links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); + } + + /** Represents a MerchantCenterLinkingConfig. */ + class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { + + /** + * Constructs a new MerchantCenterLinkingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); + + /** MerchantCenterLinkingConfig links. */ + public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; + + /** + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MerchantCenterLinkingConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Verifies a MerchantCenterLinkingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MerchantCenterLinkingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @param message MerchantCenterLinkingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MerchantCenterLinkingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig */ + merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + } + + /** Represents a Catalog. */ + class Catalog implements ICatalog { + + /** + * Constructs a new Catalog. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig. */ + public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + + /** + * Creates a new Catalog instance using the specified properties. + * @param [properties] Properties to set + * @returns Catalog instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + + /** + * Verifies a Catalog message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Catalog + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Catalog to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** SolutionType enum. */ + enum SolutionType { + SOLUTION_TYPE_UNSPECIFIED = 0, + SOLUTION_TYPE_RECOMMENDATION = 1, + SOLUTION_TYPE_SEARCH = 2 + } + + /** Properties of a Condition. */ + interface ICondition { + + /** Condition queryTerms */ + queryTerms?: (google.cloud.retail.v2alpha.Condition.IQueryTerm[]|null); + + /** Condition activeTimeRange */ + activeTimeRange?: (google.cloud.retail.v2alpha.Condition.ITimeRange[]|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { + + /** + * Constructs a new Condition. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICondition); + + /** Condition queryTerms. */ + public queryTerms: google.cloud.retail.v2alpha.Condition.IQueryTerm[]; + + /** Condition activeTimeRange. */ + public activeTimeRange: google.cloud.retail.v2alpha.Condition.ITimeRange[]; + + /** + * Creates a new Condition instance using the specified properties. + * @param [properties] Properties to set + * @returns Condition instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICondition): google.cloud.retail.v2alpha.Condition; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition; + + /** + * Verifies a Condition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Condition + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Condition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Condition { + + /** Properties of a QueryTerm. */ + interface IQueryTerm { + + /** QueryTerm value */ + value?: (string|null); + + /** QueryTerm fullMatch */ + fullMatch?: (boolean|null); + } + + /** Represents a QueryTerm. */ + class QueryTerm implements IQueryTerm { + + /** + * Constructs a new QueryTerm. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm); + + /** QueryTerm value. */ + public value: string; + + /** QueryTerm fullMatch. */ + public fullMatch: boolean; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTerm instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Verifies a QueryTerm message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTerm + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @param message QueryTerm + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTerm to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TimeRange. */ + interface ITimeRange { + + /** TimeRange startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TimeRange. */ + class TimeRange implements ITimeRange { + + /** + * Constructs a new TimeRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange); + + /** TimeRange startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TimeRange instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeRange instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Verifies a TimeRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @param message TimeRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Rule. */ + interface IRule { + + /** Rule boostAction */ + boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + + /** Rule redirectAction */ + redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction */ + onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction */ + doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction */ + replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + + /** Rule ignoreAction */ + ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + + /** Rule filterAction */ + filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction */ + twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + + /** Rule condition */ + condition?: (google.cloud.retail.v2alpha.ICondition|null); + } + + /** Represents a Rule. */ + class Rule implements IRule { + + /** + * Constructs a new Rule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRule); + + /** Rule boostAction. */ + public boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + + /** Rule redirectAction. */ + public redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction. */ + public onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction. */ + public doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction. */ + public replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + + /** Rule ignoreAction. */ + public ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + + /** Rule filterAction. */ + public filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction. */ + public twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + + /** Rule condition. */ + public condition?: (google.cloud.retail.v2alpha.ICondition|null); + + /** Rule action. */ + public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + + /** + * Creates a new Rule instance using the specified properties. + * @param [properties] Properties to set + * @returns Rule instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRule): google.cloud.retail.v2alpha.Rule; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule; + + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule; + + /** + * Verifies a Rule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @param message Rule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Rule { + + /** Properties of a BoostAction. */ + interface IBoostAction { + + /** BoostAction boost */ + boost?: (number|null); + + /** BoostAction productsFilter */ + productsFilter?: (string|null); + } + + /** Represents a BoostAction. */ + class BoostAction implements IBoostAction { + + /** + * Constructs a new BoostAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction); + + /** BoostAction boost. */ + public boost: number; + + /** BoostAction productsFilter. */ + public productsFilter: string; + + /** + * Creates a new BoostAction instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Verifies a BoostAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @param message BoostAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FilterAction. */ + interface IFilterAction { + + /** FilterAction filter */ + filter?: (string|null); + } + + /** Represents a FilterAction. */ + class FilterAction implements IFilterAction { + + /** + * Constructs a new FilterAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction); + + /** FilterAction filter. */ + public filter: string; + + /** + * Creates a new FilterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns FilterAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Verifies a FilterAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FilterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @param message FilterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FilterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RedirectAction. */ + interface IRedirectAction { + + /** RedirectAction redirectUri */ + redirectUri?: (string|null); + } + + /** Represents a RedirectAction. */ + class RedirectAction implements IRedirectAction { + + /** + * Constructs a new RedirectAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction); + + /** RedirectAction redirectUri. */ + public redirectUri: string; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RedirectAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Verifies a RedirectAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RedirectAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @param message RedirectAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RedirectAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TwowaySynonymsAction. */ + interface ITwowaySynonymsAction { + + /** TwowaySynonymsAction synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a TwowaySynonymsAction. */ + class TwowaySynonymsAction implements ITwowaySynonymsAction { + + /** + * Constructs a new TwowaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction); + + /** TwowaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns TwowaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Verifies a TwowaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TwowaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @param message TwowaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TwowaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OnewaySynonymsAction. */ + interface IOnewaySynonymsAction { + + /** OnewaySynonymsAction queryTerms */ + queryTerms?: (string[]|null); + + /** OnewaySynonymsAction synonyms */ + synonyms?: (string[]|null); + + /** OnewaySynonymsAction onewayTerms */ + onewayTerms?: (string[]|null); + } + + /** Represents an OnewaySynonymsAction. */ + class OnewaySynonymsAction implements IOnewaySynonymsAction { + + /** + * Constructs a new OnewaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction); + + /** OnewaySynonymsAction queryTerms. */ + public queryTerms: string[]; + + /** OnewaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** OnewaySynonymsAction onewayTerms. */ + public onewayTerms: string[]; + + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OnewaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Verifies an OnewaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnewaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @param message OnewaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DoNotAssociateAction. */ + interface IDoNotAssociateAction { + + /** DoNotAssociateAction queryTerms */ + queryTerms?: (string[]|null); + + /** DoNotAssociateAction doNotAssociateTerms */ + doNotAssociateTerms?: (string[]|null); + + /** DoNotAssociateAction terms */ + terms?: (string[]|null); + } + + /** Represents a DoNotAssociateAction. */ + class DoNotAssociateAction implements IDoNotAssociateAction { + + /** + * Constructs a new DoNotAssociateAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction); + + /** DoNotAssociateAction queryTerms. */ + public queryTerms: string[]; + + /** DoNotAssociateAction doNotAssociateTerms. */ + public doNotAssociateTerms: string[]; + + /** DoNotAssociateAction terms. */ + public terms: string[]; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DoNotAssociateAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Verifies a DoNotAssociateAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoNotAssociateAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @param message DoNotAssociateAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Represents a MerchantCenterLinkingConfig. */ - class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { + /** Properties of a ReplacementAction. */ + interface IReplacementAction { - /** - * Constructs a new MerchantCenterLinkingConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); + /** ReplacementAction queryTerms */ + queryTerms?: (string[]|null); - /** MerchantCenterLinkingConfig links. */ - public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; + /** ReplacementAction replacementTerm */ + replacementTerm?: (string|null); - /** - * Creates a new MerchantCenterLinkingConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns MerchantCenterLinkingConfig instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + /** ReplacementAction term */ + term?: (string|null); + } - /** - * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @param message MerchantCenterLinkingConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a ReplacementAction. */ + class ReplacementAction implements IReplacementAction { - /** - * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @param message MerchantCenterLinkingConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new ReplacementAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IReplacementAction); - /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MerchantCenterLinkingConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + /** ReplacementAction queryTerms. */ + public queryTerms: string[]; - /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MerchantCenterLinkingConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + /** ReplacementAction replacementTerm. */ + public replacementTerm: string; - /** - * Verifies a MerchantCenterLinkingConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** ReplacementAction term. */ + public term: string; - /** - * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MerchantCenterLinkingConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + /** + * Creates a new ReplacementAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplacementAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IReplacementAction): google.cloud.retail.v2alpha.Rule.ReplacementAction; - /** - * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. - * @param message MerchantCenterLinkingConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this MerchantCenterLinkingConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a Catalog. */ - interface ICatalog { + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.ReplacementAction; - /** Catalog name */ - name?: (string|null); + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.ReplacementAction; - /** Catalog displayName */ - displayName?: (string|null); + /** + * Verifies a ReplacementAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplacementAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.ReplacementAction; - /** Catalog merchantCenterLinkingConfig */ - merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); - } + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @param message ReplacementAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** + * Converts this ReplacementAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Constructs a new Catalog. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.ICatalog); + /** Properties of an IgnoreAction. */ + interface IIgnoreAction { - /** Catalog name. */ - public name: string; + /** IgnoreAction ignoreTerms */ + ignoreTerms?: (string[]|null); + } - /** Catalog displayName. */ - public displayName: string; + /** Represents an IgnoreAction. */ + class IgnoreAction implements IIgnoreAction { - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + /** + * Constructs a new IgnoreAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IIgnoreAction); - /** Catalog merchantCenterLinkingConfig. */ - public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + /** IgnoreAction ignoreTerms. */ + public ignoreTerms: string[]; - /** - * Creates a new Catalog instance using the specified properties. - * @param [properties] Properties to set - * @returns Catalog instance - */ - public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + /** + * Creates a new IgnoreAction instance using the specified properties. + * @param [properties] Properties to set + * @returns IgnoreAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IIgnoreAction): google.cloud.retail.v2alpha.Rule.IgnoreAction; - /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a Catalog message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Catalog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.IgnoreAction; - /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Catalog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.IgnoreAction; - /** - * Verifies a Catalog message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies an IgnoreAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Catalog - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IgnoreAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.IgnoreAction; - /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @param message IgnoreAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this Catalog to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Converts this IgnoreAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Properties of an Audience. */ @@ -18864,6 +20080,9 @@ export namespace google { /** SearchResponse redirectUri */ redirectUri?: (string|null); + + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); } /** Represents a SearchResponse. */ @@ -18899,6 +20118,9 @@ export namespace google { /** SearchResponse redirectUri. */ public redirectUri: string; + /** SearchResponse appliedControls. */ + public appliedControls: string[]; + /** * Creates a new SearchResponse instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index eb6f6cef82c..a5eb010f454 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -23300,6 +23300,8 @@ * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId * @property {string|null} [branchId] MerchantCenterLink branchId * @property {Array.|null} [destinations] MerchantCenterLink destinations + * @property {string|null} [regionCode] MerchantCenterLink regionCode + * @property {string|null} [languageCode] MerchantCenterLink languageCode */ /** @@ -23342,6 +23344,22 @@ */ MerchantCenterLink.prototype.destinations = $util.emptyArray; + /** + * MerchantCenterLink regionCode. + * @member {string} regionCode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.regionCode = ""; + + /** + * MerchantCenterLink languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.languageCode = ""; + /** * Creates a new MerchantCenterLink instance using the specified properties. * @function create @@ -23373,6 +23391,10 @@ if (message.destinations != null && message.destinations.length) for (var i = 0; i < message.destinations.length; ++i) writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.regionCode); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.languageCode); return writer; }; @@ -23418,6 +23440,12 @@ message.destinations = []; message.destinations.push(reader.string()); break; + case 4: + message.regionCode = reader.string(); + break; + case 5: + message.languageCode = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -23466,6 +23494,12 @@ if (!$util.isString(message.destinations[i])) return "destinations: string[] expected"; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + if (!$util.isString(message.regionCode)) + return "regionCode: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; return null; }; @@ -23499,6 +23533,10 @@ for (var i = 0; i < object.destinations.length; ++i) message.destinations[i] = String(object.destinations[i]); } + if (object.regionCode != null) + message.regionCode = String(object.regionCode); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); return message; }; @@ -23524,6 +23562,8 @@ } else object.merchantCenterAccountId = options.longs === String ? "0" : 0; object.branchId = ""; + object.regionCode = ""; + object.languageCode = ""; } if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) if (typeof message.merchantCenterAccountId === "number") @@ -23537,6 +23577,10 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = message.destinations[j]; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; return object; }; @@ -23856,174 +23900,3148 @@ return writer; }; - /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); + break; + case 6: + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (error) + return "merchantCenterLinkingConfig." + error; + } + return null; + }; + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + */ + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + return object; + var message = new $root.google.cloud.retail.v2alpha.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); + } + if (object.merchantCenterLinkingConfig != null) { + if (typeof object.merchantCenterLinkingConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); + } + return message; + }; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + object.merchantCenterLinkingConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) + object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); + return object; + }; + + /** + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + * @returns {Object.} JSON object + */ + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Catalog; + })(); + + /** + * SolutionType enum. + * @name google.cloud.retail.v2alpha.SolutionType + * @enum {number} + * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value + * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value + * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value + */ + v2alpha.SolutionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; + values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; + return values; + })(); + + v2alpha.Condition = (function() { + + /** + * Properties of a Condition. + * @memberof google.cloud.retail.v2alpha + * @interface ICondition + * @property {Array.|null} [queryTerms] Condition queryTerms + * @property {Array.|null} [activeTimeRange] Condition activeTimeRange + */ + + /** + * Constructs a new Condition. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Condition. + * @implements ICondition + * @constructor + * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + */ + function Condition(properties) { + this.queryTerms = []; + this.activeTimeRange = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Condition queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + */ + Condition.prototype.queryTerms = $util.emptyArray; + + /** + * Condition activeTimeRange. + * @member {Array.} activeTimeRange + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + */ + Condition.prototype.activeTimeRange = $util.emptyArray; + + /** + * Creates a new Condition instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition} Condition instance + */ + Condition.create = function create(properties) { + return new Condition(properties); + }; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + $root.google.cloud.retail.v2alpha.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeTimeRange != null && message.activeTimeRange.length) + for (var i = 0; i < message.activeTimeRange.length; ++i) + $root.google.cloud.retail.v2alpha.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Condition message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Condition.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.verify(message.queryTerms[i]); + if (error) + return "queryTerms." + error; + } + } + if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { + if (!Array.isArray(message.activeTimeRange)) + return "activeTimeRange: array expected"; + for (var i = 0; i < message.activeTimeRange.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Condition.TimeRange.verify(message.activeTimeRange[i]); + if (error) + return "activeTimeRange." + error; + } + } + return null; + }; + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Condition} Condition + */ + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition) + return object; + var message = new $root.google.cloud.retail.v2alpha.Condition(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) { + if (typeof object.queryTerms[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: object expected"); + message.queryTerms[i] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.fromObject(object.queryTerms[i]); + } + } + if (object.activeTimeRange) { + if (!Array.isArray(object.activeTimeRange)) + throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: array expected"); + message.activeTimeRange = []; + for (var i = 0; i < object.activeTimeRange.length; ++i) { + if (typeof object.activeTimeRange[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: object expected"); + message.activeTimeRange[i] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.fromObject(object.activeTimeRange[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.Condition} message Condition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Condition.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.queryTerms = []; + object.activeTimeRange = []; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.toObject(message.queryTerms[j], options); + } + if (message.activeTimeRange && message.activeTimeRange.length) { + object.activeTimeRange = []; + for (var j = 0; j < message.activeTimeRange.length; ++j) + object.activeTimeRange[j] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.toObject(message.activeTimeRange[j], options); + } + return object; + }; + + /** + * Converts this Condition to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + * @returns {Object.} JSON object + */ + Condition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Condition.QueryTerm = (function() { + + /** + * Properties of a QueryTerm. + * @memberof google.cloud.retail.v2alpha.Condition + * @interface IQueryTerm + * @property {string|null} [value] QueryTerm value + * @property {boolean|null} [fullMatch] QueryTerm fullMatch + */ + + /** + * Constructs a new QueryTerm. + * @memberof google.cloud.retail.v2alpha.Condition + * @classdesc Represents a QueryTerm. + * @implements IQueryTerm + * @constructor + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set + */ + function QueryTerm(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTerm value. + * @member {string} value + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.value = ""; + + /** + * QueryTerm fullMatch. + * @member {boolean} fullMatch + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.fullMatch = false; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm instance + */ + QueryTerm.create = function create(properties) { + return new QueryTerm(properties); + }; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); + return writer; + }; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.fullMatch = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTerm message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTerm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + if (typeof message.fullMatch !== "boolean") + return "fullMatch: boolean expected"; + return null; + }; + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm + */ + QueryTerm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition.QueryTerm) + return object; + var message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); + if (object.value != null) + message.value = String(object.value); + if (object.fullMatch != null) + message.fullMatch = Boolean(object.fullMatch); + return message; + }; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2alpha.Condition.QueryTerm} message QueryTerm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTerm.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.fullMatch = false; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + object.fullMatch = message.fullMatch; + return object; + }; + + /** + * Converts this QueryTerm to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @instance + * @returns {Object.} JSON object + */ + QueryTerm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTerm; + })(); + + Condition.TimeRange = (function() { + + /** + * Properties of a TimeRange. + * @memberof google.cloud.retail.v2alpha.Condition + * @interface ITimeRange + * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime + */ + + /** + * Constructs a new TimeRange. + * @memberof google.cloud.retail.v2alpha.Condition + * @classdesc Represents a TimeRange. + * @implements ITimeRange + * @constructor + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set + */ + function TimeRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeRange startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @instance + */ + TimeRange.prototype.startTime = null; + + /** + * TimeRange endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @instance + */ + TimeRange.prototype.endTime = null; + + /** + * Creates a new TimeRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange instance + */ + TimeRange.create = function create(properties) { + return new TimeRange(properties); + }; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeRange message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange + */ + TimeRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition.TimeRange) + return object; + var message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2alpha.Condition.TimeRange} message TimeRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this TimeRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @instance + * @returns {Object.} JSON object + */ + TimeRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimeRange; + })(); + + return Condition; + })(); + + v2alpha.Rule = (function() { + + /** + * Properties of a Rule. + * @memberof google.cloud.retail.v2alpha + * @interface IRule + * @property {google.cloud.retail.v2alpha.Rule.IBoostAction|null} [boostAction] Rule boostAction + * @property {google.cloud.retail.v2alpha.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction + * @property {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction + * @property {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction + * @property {google.cloud.retail.v2alpha.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction + * @property {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction + * @property {google.cloud.retail.v2alpha.Rule.IFilterAction|null} [filterAction] Rule filterAction + * @property {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction + * @property {google.cloud.retail.v2alpha.ICondition|null} [condition] Rule condition + */ + + /** + * Constructs a new Rule. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Rule. + * @implements IRule + * @constructor + * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + */ + function Rule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Rule boostAction. + * @member {google.cloud.retail.v2alpha.Rule.IBoostAction|null|undefined} boostAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.boostAction = null; + + /** + * Rule redirectAction. + * @member {google.cloud.retail.v2alpha.Rule.IRedirectAction|null|undefined} redirectAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.redirectAction = null; + + /** + * Rule onewaySynonymsAction. + * @member {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.onewaySynonymsAction = null; + + /** + * Rule doNotAssociateAction. + * @member {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.doNotAssociateAction = null; + + /** + * Rule replacementAction. + * @member {google.cloud.retail.v2alpha.Rule.IReplacementAction|null|undefined} replacementAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.replacementAction = null; + + /** + * Rule ignoreAction. + * @member {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null|undefined} ignoreAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.ignoreAction = null; + + /** + * Rule filterAction. + * @member {google.cloud.retail.v2alpha.Rule.IFilterAction|null|undefined} filterAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.filterAction = null; + + /** + * Rule twowaySynonymsAction. + * @member {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.twowaySynonymsAction = null; + + /** + * Rule condition. + * @member {google.cloud.retail.v2alpha.ICondition|null|undefined} condition + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.condition = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Rule action. + * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Object.defineProperty(Rule.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Rule instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule} Rule instance + */ + Rule.create = function create(properties) { + return new Rule(properties); + }; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.cloud.retail.v2alpha.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) + $root.google.cloud.retail.v2alpha.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) + $root.google.cloud.retail.v2alpha.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) + $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) + $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) + $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) + $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) + $root.google.cloud.retail.v2alpha.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) + $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Rule message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); + break; + case 3: + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + case 6: + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + case 7: + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + case 8: + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + case 9: + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + case 10: + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); + break; + case 11: + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + case 1: + message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Rule message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Rule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.BoostAction.verify(message.boostAction); + if (error) + return "boostAction." + error; + } + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.verify(message.redirectAction); + if (error) + return "redirectAction." + error; + } + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); + if (error) + return "onewaySynonymsAction." + error; + } + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); + if (error) + return "doNotAssociateAction." + error; + } + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.verify(message.replacementAction); + if (error) + return "replacementAction." + error; + } + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.verify(message.ignoreAction); + if (error) + return "ignoreAction." + error; + } + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.FilterAction.verify(message.filterAction); + if (error) + return "filterAction." + error; + } + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (error) + return "twowaySynonymsAction." + error; + } + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.cloud.retail.v2alpha.Condition.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule} Rule + */ + Rule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule(); + if (object.boostAction != null) { + if (typeof object.boostAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.boostAction: object expected"); + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.fromObject(object.boostAction); + } + if (object.redirectAction != null) { + if (typeof object.redirectAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.redirectAction: object expected"); + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.fromObject(object.redirectAction); + } + if (object.onewaySynonymsAction != null) { + if (typeof object.onewaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.onewaySynonymsAction: object expected"); + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + } + if (object.doNotAssociateAction != null) { + if (typeof object.doNotAssociateAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.doNotAssociateAction: object expected"); + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); + } + if (object.replacementAction != null) { + if (typeof object.replacementAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.replacementAction: object expected"); + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.fromObject(object.replacementAction); + } + if (object.ignoreAction != null) { + if (typeof object.ignoreAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.ignoreAction: object expected"); + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.fromObject(object.ignoreAction); + } + if (object.filterAction != null) { + if (typeof object.filterAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.filterAction: object expected"); + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.fromObject(object.filterAction); + } + if (object.twowaySynonymsAction != null) { + if (typeof object.twowaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.twowaySynonymsAction: object expected"); + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.condition: object expected"); + message.condition = $root.google.cloud.retail.v2alpha.Condition.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.Rule} message Rule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Rule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.condition = null; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.cloud.retail.v2alpha.Condition.toObject(message.condition, options); + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + object.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.toObject(message.boostAction, options); + if (options.oneofs) + object.action = "boostAction"; + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + object.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.toObject(message.redirectAction, options); + if (options.oneofs) + object.action = "redirectAction"; + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + object.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); + if (options.oneofs) + object.action = "onewaySynonymsAction"; + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + object.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); + if (options.oneofs) + object.action = "doNotAssociateAction"; + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + object.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.toObject(message.replacementAction, options); + if (options.oneofs) + object.action = "replacementAction"; + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + object.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.toObject(message.ignoreAction, options); + if (options.oneofs) + object.action = "ignoreAction"; + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + object.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.toObject(message.filterAction, options); + if (options.oneofs) + object.action = "filterAction"; + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + object.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); + if (options.oneofs) + object.action = "twowaySynonymsAction"; + } + return object; + }; + + /** + * Converts this Rule to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + * @returns {Object.} JSON object + */ + Rule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Rule.BoostAction = (function() { + + /** + * Properties of a BoostAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IBoostAction + * @property {number|null} [boost] BoostAction boost + * @property {string|null} [productsFilter] BoostAction productsFilter + */ + + /** + * Constructs a new BoostAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a BoostAction. + * @implements IBoostAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set + */ + function BoostAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostAction boost. + * @member {number} boost + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @instance + */ + BoostAction.prototype.boost = 0; + + /** + * BoostAction productsFilter. + * @member {string} productsFilter + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @instance + */ + BoostAction.prototype.productsFilter = ""; + + /** + * Creates a new BoostAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction instance + */ + BoostAction.create = function create(properties) { + return new BoostAction(properties); + }; + + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); + if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + return writer; + }; + + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.boost = reader.float(); + break; + case 2: + message.productsFilter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + if (!$util.isString(message.productsFilter)) + return "productsFilter: string expected"; + return null; + }; + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + */ + BoostAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.BoostAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); + if (object.boost != null) + message.boost = Number(object.boost); + if (object.productsFilter != null) + message.productsFilter = String(object.productsFilter); + return message; + }; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.BoostAction} message BoostAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.boost = 0; + object.productsFilter = ""; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + object.productsFilter = message.productsFilter; + return object; + }; + + /** + * Converts this BoostAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @instance + * @returns {Object.} JSON object + */ + BoostAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoostAction; + })(); + + Rule.FilterAction = (function() { + + /** + * Properties of a FilterAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IFilterAction + * @property {string|null} [filter] FilterAction filter + */ + + /** + * Constructs a new FilterAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a FilterAction. + * @implements IFilterAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set + */ + function FilterAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FilterAction filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @instance + */ + FilterAction.prototype.filter = ""; + + /** + * Creates a new FilterAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction instance + */ + FilterAction.create = function create(properties) { + return new FilterAction(properties); + }; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + return writer; + }; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FilterAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilterAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + */ + FilterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.FilterAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.FilterAction} message FilterAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilterAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.filter = ""; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this FilterAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @instance + * @returns {Object.} JSON object + */ + FilterAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FilterAction; + })(); + + Rule.RedirectAction = (function() { + + /** + * Properties of a RedirectAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IRedirectAction + * @property {string|null} [redirectUri] RedirectAction redirectUri + */ + + /** + * Constructs a new RedirectAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a RedirectAction. + * @implements IRedirectAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set + */ + function RedirectAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RedirectAction redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @instance + */ + RedirectAction.prototype.redirectUri = ""; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction instance + */ + RedirectAction.create = function create(properties) { + return new RedirectAction(properties); + }; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); + return writer; + }; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redirectUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RedirectAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedirectAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction + */ + RedirectAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.RedirectAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.RedirectAction} message RedirectAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedirectAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.redirectUri = ""; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + return object; + }; + + /** + * Converts this RedirectAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @instance + * @returns {Object.} JSON object + */ + RedirectAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RedirectAction; + })(); + + Rule.TwowaySynonymsAction = (function() { + + /** + * Properties of a TwowaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface ITwowaySynonymsAction + * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms + */ + + /** + * Constructs a new TwowaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a TwowaySynonymsAction. + * @implements ITwowaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set + */ + function TwowaySynonymsAction(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TwowaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @instance + */ + TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance + */ + TwowaySynonymsAction.create = function create(properties) { + return new TwowaySynonymsAction(properties); + }; + + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TwowaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TwowaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction + */ + TwowaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} message TwowaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TwowaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this TwowaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + TwowaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TwowaySynonymsAction; + })(); + + Rule.OnewaySynonymsAction = (function() { + + /** + * Properties of an OnewaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IOnewaySynonymsAction + * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms + * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms + * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms + */ + + /** + * Constructs a new OnewaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents an OnewaySynonymsAction. + * @implements IOnewaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + */ + function OnewaySynonymsAction(properties) { + this.queryTerms = []; + this.synonyms = []; + this.onewayTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OnewaySynonymsAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; + + /** + * OnewaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; + + /** + * OnewaySynonymsAction onewayTerms. + * @member {Array.} onewayTerms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; + + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + */ + OnewaySynonymsAction.create = function create(properties) { + return new OnewaySynonymsAction(properties); + }; + + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.onewayTerms != null && message.onewayTerms.length) + for (var i = 0; i < message.onewayTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 4: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + case 2: + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OnewaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnewaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { + if (!Array.isArray(message.onewayTerms)) + return "onewayTerms: array expected"; + for (var i = 0; i < message.onewayTerms.length; ++i) + if (!$util.isString(message.onewayTerms[i])) + return "onewayTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + */ + OnewaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + if (object.onewayTerms) { + if (!Array.isArray(object.onewayTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.onewayTerms: array expected"); + message.onewayTerms = []; + for (var i = 0; i < object.onewayTerms.length; ++i) + message.onewayTerms[i] = String(object.onewayTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnewaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.onewayTerms = []; + object.queryTerms = []; + object.synonyms = []; + } + if (message.onewayTerms && message.onewayTerms.length) { + object.onewayTerms = []; + for (var j = 0; j < message.onewayTerms.length; ++j) + object.onewayTerms[j] = message.onewayTerms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + OnewaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OnewaySynonymsAction; + })(); + + Rule.DoNotAssociateAction = (function() { + + /** + * Properties of a DoNotAssociateAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IDoNotAssociateAction + * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms + * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms + * @property {Array.|null} [terms] DoNotAssociateAction terms + */ + + /** + * Constructs a new DoNotAssociateAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a DoNotAssociateAction. + * @implements IDoNotAssociateAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + */ + function DoNotAssociateAction(properties) { + this.queryTerms = []; + this.doNotAssociateTerms = []; + this.terms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoNotAssociateAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; + + /** + * DoNotAssociateAction doNotAssociateTerms. + * @member {Array.} doNotAssociateTerms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; + + /** + * DoNotAssociateAction terms. + * @member {Array.} terms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.terms = $util.emptyArray; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction instance + */ + DoNotAssociateAction.create = function create(properties) { + return new DoNotAssociateAction(properties); + }; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.terms != null && message.terms.length) + for (var i = 0; i < message.terms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + return writer; + }; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + case 1: + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoNotAssociateAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoNotAssociateAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { + if (!Array.isArray(message.doNotAssociateTerms)) + return "doNotAssociateTerms: array expected"; + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + if (!$util.isString(message.doNotAssociateTerms[i])) + return "doNotAssociateTerms: string[] expected"; + } + if (message.terms != null && message.hasOwnProperty("terms")) { + if (!Array.isArray(message.terms)) + return "terms: array expected"; + for (var i = 0; i < message.terms.length; ++i) + if (!$util.isString(message.terms[i])) + return "terms: string[] expected"; + } + return null; + }; + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + */ + DoNotAssociateAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.doNotAssociateTerms) { + if (!Array.isArray(object.doNotAssociateTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); + message.doNotAssociateTerms = []; + for (var i = 0; i < object.doNotAssociateTerms.length; ++i) + message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); + } + if (object.terms) { + if (!Array.isArray(object.terms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.terms: array expected"); + message.terms = []; + for (var i = 0; i < object.terms.length; ++i) + message.terms[i] = String(object.terms[i]); + } + return message; + }; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoNotAssociateAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.terms = []; + object.queryTerms = []; + object.doNotAssociateTerms = []; + } + if (message.terms && message.terms.length) { + object.terms = []; + for (var j = 0; j < message.terms.length; ++j) + object.terms[j] = message.terms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { + object.doNotAssociateTerms = []; + for (var j = 0; j < message.doNotAssociateTerms.length; ++j) + object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; + } + return object; + }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + * @returns {Object.} JSON object + */ + DoNotAssociateAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DoNotAssociateAction; + })(); + + Rule.ReplacementAction = (function() { + + /** + * Properties of a ReplacementAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IReplacementAction + * @property {Array.|null} [queryTerms] ReplacementAction queryTerms + * @property {string|null} [replacementTerm] ReplacementAction replacementTerm + * @property {string|null} [term] ReplacementAction term + */ + + /** + * Constructs a new ReplacementAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a ReplacementAction. + * @implements IReplacementAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + */ + function ReplacementAction(properties) { + this.queryTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplacementAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.queryTerms = $util.emptyArray; + + /** + * ReplacementAction replacementTerm. + * @member {string} replacementTerm + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.replacementTerm = ""; + + /** + * ReplacementAction term. + * @member {string} term + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.term = ""; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction instance + */ + ReplacementAction.create = function create(properties) { + return new ReplacementAction(properties); + }; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.term != null && Object.hasOwnProperty.call(message, "term")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + return writer; + }; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + message.replacementTerm = reader.string(); + break; + case 1: + message.term = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplacementAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplacementAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + if (!$util.isString(message.replacementTerm)) + return "replacementTerm: string expected"; + if (message.term != null && message.hasOwnProperty("term")) + if (!$util.isString(message.term)) + return "term: string expected"; + return null; + }; + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + */ + ReplacementAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.ReplacementAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.ReplacementAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.replacementTerm != null) + message.replacementTerm = String(object.replacementTerm); + if (object.term != null) + message.term = String(object.term); + return message; + }; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ReplacementAction} message ReplacementAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplacementAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.queryTerms = []; + if (options.defaults) { + object.term = ""; + object.replacementTerm = ""; + } + if (message.term != null && message.hasOwnProperty("term")) + object.term = message.term; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + object.replacementTerm = message.replacementTerm; + return object; + }; + + /** + * Converts this ReplacementAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + * @returns {Object.} JSON object + */ + ReplacementAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReplacementAction; + })(); + + Rule.IgnoreAction = (function() { + + /** + * Properties of an IgnoreAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IIgnoreAction + * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + */ + + /** + * Constructs a new IgnoreAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents an IgnoreAction. + * @implements IIgnoreAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + */ + function IgnoreAction(properties) { + this.ignoreTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IgnoreAction ignoreTerms. + * @member {Array.} ignoreTerms + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @instance + */ + IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction instance + */ + IgnoreAction.create = function create(properties) { + return new IgnoreAction(properties); + }; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ignoreTerms != null && message.ignoreTerms.length) + for (var i = 0; i < message.ignoreTerms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + return writer; + }; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Catalog message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Catalog.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); - break; - case 6: - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Catalog.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a Catalog message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Catalog.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); - if (error) - return "productLevelConfig." + error; - } - if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { - var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); - if (error) - return "merchantCenterLinkingConfig." + error; - } - return null; - }; + /** + * Verifies an IgnoreAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IgnoreAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { + if (!Array.isArray(message.ignoreTerms)) + return "ignoreTerms: array expected"; + for (var i = 0; i < message.ignoreTerms.length; ++i) + if (!$util.isString(message.ignoreTerms[i])) + return "ignoreTerms: string[] expected"; + } + return null; + }; - /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog - */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + */ + IgnoreAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.IgnoreAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + if (object.ignoreTerms) { + if (!Array.isArray(object.ignoreTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.IgnoreAction.ignoreTerms: array expected"); + message.ignoreTerms = []; + for (var i = 0; i < object.ignoreTerms.length; ++i) + message.ignoreTerms[i] = String(object.ignoreTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IgnoreAction} message IgnoreAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IgnoreAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreTerms = []; + if (message.ignoreTerms && message.ignoreTerms.length) { + object.ignoreTerms = []; + for (var j = 0; j < message.ignoreTerms.length; ++j) + object.ignoreTerms[j] = message.ignoreTerms[j]; + } return object; - var message = new $root.google.cloud.retail.v2alpha.Catalog(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); - } - if (object.merchantCenterLinkingConfig != null) { - if (typeof object.merchantCenterLinkingConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); - } - return message; - }; + }; - /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {google.cloud.retail.v2alpha.Catalog} message Catalog - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Catalog.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; - object.merchantCenterLinkingConfig = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); - if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) - object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); - return object; - }; + /** + * Converts this IgnoreAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @instance + * @returns {Object.} JSON object + */ + IgnoreAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this Catalog to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - * @returns {Object.} JSON object - */ - Catalog.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return IgnoreAction; + })(); - return Catalog; + return Rule; })(); v2alpha.Audience = (function() { @@ -46379,6 +49397,7 @@ * @property {string|null} [nextPageToken] SearchResponse nextPageToken * @property {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls */ /** @@ -46392,6 +49411,7 @@ function SearchResponse(properties) { this.results = []; this.facets = []; + this.appliedControls = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46462,6 +49482,14 @@ */ SearchResponse.prototype.redirectUri = ""; + /** + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.appliedControls = $util.emptyArray; + /** * Creates a new SearchResponse instance using the specified properties. * @function create @@ -46504,6 +49532,9 @@ $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); return writer; }; @@ -46566,6 +49597,11 @@ case 10: message.redirectUri = reader.string(); break; + case 12: + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; default: reader.skipType(tag & 7); break; @@ -46639,6 +49675,13 @@ if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) if (!$util.isString(message.redirectUri)) return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; + } return null; }; @@ -46689,6 +49732,13 @@ } if (object.redirectUri != null) message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); + } return message; }; @@ -46708,6 +49758,7 @@ if (options.arrays || options.defaults) { object.results = []; object.facets = []; + object.appliedControls = []; } if (options.defaults) { object.totalSize = 0; @@ -46739,6 +49790,11 @@ object.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; + } return object; }; diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 0e3d2cf1667..4e86f935598 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -2470,6 +2470,14 @@ "rule": "repeated", "type": "string", "id": 3 + }, + "regionCode": { + "type": "string", + "id": 4 + }, + "languageCode": { + "type": "string", + "id": 5 } } }, @@ -2515,6 +2523,213 @@ } } }, + "SolutionType": { + "values": { + "SOLUTION_TYPE_UNSPECIFIED": 0, + "SOLUTION_TYPE_RECOMMENDATION": 1, + "SOLUTION_TYPE_SEARCH": 2 + } + }, + "Condition": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "QueryTerm", + "id": 1 + }, + "activeTimeRange": { + "rule": "repeated", + "type": "TimeRange", + "id": 3 + } + }, + "nested": { + "QueryTerm": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "fullMatch": { + "type": "bool", + "id": 2 + } + } + }, + "TimeRange": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } + }, + "Rule": { + "oneofs": { + "action": { + "oneof": [ + "boostAction", + "redirectAction", + "onewaySynonymsAction", + "doNotAssociateAction", + "replacementAction", + "ignoreAction", + "filterAction", + "twowaySynonymsAction" + ] + } + }, + "fields": { + "boostAction": { + "type": "BoostAction", + "id": 2 + }, + "redirectAction": { + "type": "RedirectAction", + "id": 3 + }, + "onewaySynonymsAction": { + "type": "OnewaySynonymsAction", + "id": 6 + }, + "doNotAssociateAction": { + "type": "DoNotAssociateAction", + "id": 7 + }, + "replacementAction": { + "type": "ReplacementAction", + "id": 8 + }, + "ignoreAction": { + "type": "IgnoreAction", + "id": 9 + }, + "filterAction": { + "type": "FilterAction", + "id": 10 + }, + "twowaySynonymsAction": { + "type": "TwowaySynonymsAction", + "id": 11 + }, + "condition": { + "type": "Condition", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "BoostAction": { + "fields": { + "boost": { + "type": "float", + "id": 1 + }, + "productsFilter": { + "type": "string", + "id": 2 + } + } + }, + "FilterAction": { + "fields": { + "filter": { + "type": "string", + "id": 1 + } + } + }, + "RedirectAction": { + "fields": { + "redirectUri": { + "type": "string", + "id": 1 + } + } + }, + "TwowaySynonymsAction": { + "fields": { + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "OnewaySynonymsAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "onewayTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "DoNotAssociateAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "doNotAssociateTerms": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "terms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "ReplacementAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "replacementTerm": { + "type": "string", + "id": 3 + }, + "term": { + "type": "string", + "id": 1 + } + } + }, + "IgnoreAction": { + "fields": { + "ignoreTerms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } + }, "Audience": { "fields": { "genders": { @@ -4823,6 +5038,11 @@ "redirectUri": { "type": "string", "id": 10 + }, + "appliedControls": { + "rule": "repeated", + "type": "string", + "id": 12 } }, "nested": { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js index 27de3024417..7683142fb87 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -31,7 +31,7 @@ function main(product, localInventories) { // const product = 'abc123' /** * Required. A list of inventory information at difference places. Each place - * is identified by its place ID. At most 1000 inventories are allowed per + * is identified by its place ID. At most 3000 inventories are allowed per * request. */ // const localInventories = 1234 diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js index 205da855e08..f67a0815c39 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -31,7 +31,7 @@ function main(product, placeIds) { // const product = 'abc123' /** * Required. A list of place IDs to have their inventory deleted. - * At most 1000 place IDs are allowed per request. + * At most 3000 place IDs are allowed per request. */ // const placeIds = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index 10cc6f9fb0c..b3858e261a6 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -54,8 +54,8 @@ function main(inventory) { // const inventory = {} /** * Indicates which inventory fields in the provided - * Product google.cloud.retail.v2alpha.Product to update. If not set or set - * with empty paths, all inventory fields will be updated. + * Product google.cloud.retail.v2alpha.Product to update. + * At least one field must be provided. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index f38a7cf18e4..044d5cd218a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -43,6 +43,8 @@ function main(placement, visitorId) { * 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 logs in or out of the website. + * This should be the same identifier as + * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id. * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. */ @@ -151,14 +153,15 @@ function main(placement, visitorId) { /** * The keys to fetch and rollup the matching * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s attributes. The attributes - * from all the matching + * Product google.cloud.retail.v2alpha.Product s attributes, + * FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo or + * LocalInventory google.cloud.retail.v2alpha.LocalInventory s attributes. + * The attributes from all the matching * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s are merged and - * de-duplicated. Notice that rollup - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * Product google.cloud.retail.v2alpha.Product s or + * LocalInventory google.cloud.retail.v2alpha.LocalInventory s are merged + * and de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * For FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", @@ -170,6 +173,7 @@ function main(placement, visitorId) { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * Product.inventories.attributes map. * * attributes.key, where key is any key in the diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 322dbdc4da2..ac1b2786bc3 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -1116,8 +1116,9 @@ export class ProductServiceClient { * needed, {@link |UpdateProduct} should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided - * {@link google.cloud.retail.v2alpha.Product|Product} to update. If not set or set - * with empty paths, all inventory fields will be updated. + * {@link google.cloud.retail.v2alpha.Product|Product} to update. + * + * At least one field must be provided. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. @@ -1683,7 +1684,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. * - * Store inventory information can only be modified using this method. + * Local inventory information can only be modified using this method. * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} * and * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} @@ -1705,7 +1706,7 @@ export class ProductServiceClient { * not it exists, a PERMISSION_DENIED error is returned. * @param {number[]} request.localInventories * Required. A list of inventory information at difference places. Each place - * is identified by its place ID. At most 1000 inventories are allowed per + * is identified by its place ID. At most 3000 inventories are allowed per * request. * @param {google.protobuf.FieldMask} request.addMask * Indicates which inventory fields in the provided list of @@ -1876,7 +1877,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. * - * Store inventory information can only be removed using this method. + * Local inventory information can only be removed using this method. * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} * and * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} @@ -1898,7 +1899,7 @@ export class ProductServiceClient { * not it exists, a PERMISSION_DENIED error is returned. * @param {string[]} request.placeIds * Required. A list of place IDs to have their inventory deleted. - * At most 1000 place IDs are allowed per request. + * At most 3000 place IDs are allowed per request. * @param {google.protobuf.Timestamp} request.removeTime * The time when the inventory deletions are issued. Used to prevent * out-of-order updates and deletions on local inventory fields. If not diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 5bc5c39e209..7c9930018ab 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -350,6 +350,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo @@ -442,14 +445,15 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s attributes. The attributes - * from all the matching - * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s are merged and - * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes, + * {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. + * The attributes from all the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2alpha.Product|Product}s or + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged + * and de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -464,6 +468,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -635,6 +640,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo @@ -727,14 +735,15 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s attributes. The attributes - * from all the matching + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes, + * {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. + * The attributes from all the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s are merged and - * de-duplicated. Notice that rollup - * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2alpha.Product|Product}s or + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged + * and de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -749,6 +758,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -876,6 +886,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo @@ -968,14 +981,15 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s attributes. The attributes - * from all the matching - * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s are merged and - * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2alpha.Product|Product}s attributes, + * {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. + * The attributes from all the matching * {@link google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2alpha.Product|Product}s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2alpha.Product|Product}s or + * {@link google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged + * and de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -990,6 +1004,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the From 0a15b20ca73931fadb8042645e2f5adc23484e68 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Feb 2022 16:08:57 +0000 Subject: [PATCH 064/103] docs(nodejs): version support policy edits (#1346) (#143) --- packages/google-cloud-retail/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index da628b54bfb..ce8867a072e 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -98,21 +98,21 @@ also contains samples. Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). Libraries are compatible with all current _active_ and _maintenance_ versions of Node.js. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. - -_Legacy Node.js versions are supported as a best effort:_ +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: -* Legacy versions will not be tested in continuous integration. -* Some security patches may not be able to be backported. -* Dependencies will not be kept up-to-date, and features will not be backported. +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. -#### Legacy tags available - -* `legacy-8`: install client libraries from this dist-tag for versions - compatible with Node.js 8. +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/retail@legacy-8` installs client libraries +for versions compatible with Node.js 8. ## Versioning From 4487e32299258858e364e431d01ce5700ca4ec17 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 5 Feb 2022 18:39:01 +0100 Subject: [PATCH 065/103] chore(deps): update dependency sinon to v13 (#138) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^12.0.0` -> `^13.0.0`](https://renovatebot.com/diffs/npm/sinon/12.0.1/13.0.1) | [![age](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/compatibility-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/confidence-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v13.0.1`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1301) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v13.0.0...v13.0.1) - [`ec4223f9`](https://togithub.com/sinonjs/sinon/commit/ec4223f94076d809483e3c6a7536cfc1278dd3c9) Bump nise to fix [sinonjs/nise#​193](https://togithub.com/sinonjs/nise/issues/193) (Carl-Erik Kopseng) - [`f329a010`](https://togithub.com/sinonjs/sinon/commit/f329a01040bfa5a79e039419220b21eda56935d6) Add unimported to workflow ([#​2441](https://togithub.com/sinonjs/sinon/issues/2441)) (Morgan Roderick) - [`7f16cec9`](https://togithub.com/sinonjs/sinon/commit/7f16cec968c3c8d4e580267fb00195916d6f827d) Enable updates to same major version (Carl-Erik Kopseng) - [`f784d7ad`](https://togithub.com/sinonjs/sinon/commit/f784d7ad2c86be0fc65477d69f8bdafca846ef2c) Re-introduce new version.sh script to version hook (Joel Bradshaw) > This was inadvertently removed during merge conflicts, and is required > for any of the new release process stuff to work - [`51c508ab`](https://togithub.com/sinonjs/sinon/commit/51c508ab77cf0f9fb8c5305ff626f6a2eada178f) Add dry run mode to `npm version` ([#​2436](https://togithub.com/sinonjs/sinon/issues/2436)) (Joel Bradshaw) > - Add DRY_RUN flag to skip publish/push > > - Allow overriding branch names for testing - [`05341dcf`](https://togithub.com/sinonjs/sinon/commit/05341dcf92ddca4a1d4c90966b1fcdc7039cff18) Update npm version scripts to manage new releases branch (Joel Bradshaw) - [`fe658261`](https://togithub.com/sinonjs/sinon/commit/fe65826171db69ed2986a1060db77944dbc98a6d) Remove release archives from master (Joel Bradshaw) > These archives made it difficult to find things in the GitHub interface, > and take up a lot of space in a checked-out repo for something that is > not useful to most people checking out the repository. > > The main purpose of these archives is to make old versions and > documentation available on the Sinon website that is run out of this > repo. This can be supported by using a separate branch for website > releases, and to maintain the archives. > > Following this commit, the `npm version` scripts will be updated to > automatically handle archiving the releases in the new releases branch > and keeping it up to date with master. > > Also remove the directories we removed from .prettierignore, since they > don't exist any more. *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2022-02-01.* ### [`v13.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1300) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.1...v13.0.0) - [`cf3d6c0c`](https://togithub.com/sinonjs/sinon/commit/cf3d6c0cd9689c0ee673b3daa8bf9abd70304392) Upgrade packages ([#​2431](https://togithub.com/sinonjs/sinon/issues/2431)) (Carl-Erik Kopseng) > - Update all @​sinonjs/ packages > > - Upgrade to fake-timers 9 > > - chore: ensure always using latest LTS release - [`41710467`](https://togithub.com/sinonjs/sinon/commit/417104670d575e96a1b645ea40ce763afa76fb1b) Adjust deploy scripts to archive old releases in a separate branch, move existing releases out of master ([#​2426](https://togithub.com/sinonjs/sinon/issues/2426)) (Joel Bradshaw) > Co-authored-by: Carl-Erik Kopseng - [`c80a7266`](https://togithub.com/sinonjs/sinon/commit/c80a72660e89d88b08275eff1028ecb9e26fd8e9) Bump node-fetch from 2.6.1 to 2.6.7 ([#​2430](https://togithub.com/sinonjs/sinon/issues/2430)) (dependabot\[bot]) > Co-authored-by: dependabot\[bot] <49699333+dependabot\[bot][@​users](https://togithub.com/users).noreply.github.com> - [`a00f14a9`](https://togithub.com/sinonjs/sinon/commit/a00f14a97dbe8c65afa89674e16ad73fc7d2fdc0) Add explicit export for `./*` ([#​2413](https://togithub.com/sinonjs/sinon/issues/2413)) (なつき) - [`b82ca7ad`](https://togithub.com/sinonjs/sinon/commit/b82ca7ad9b1add59007771f65a18ee34415de8ca) Bump cached-path-relative from 1.0.2 to 1.1.0 ([#​2428](https://togithub.com/sinonjs/sinon/issues/2428)) (dependabot\[bot]) - [`a9ea1427`](https://togithub.com/sinonjs/sinon/commit/a9ea142716c094ef3c432ecc4089f8207b8dd8b6) Add documentation for assert.calledOnceWithMatch ([#​2424](https://togithub.com/sinonjs/sinon/issues/2424)) (Mathias Schreck) - [`1d5ab86b`](https://togithub.com/sinonjs/sinon/commit/1d5ab86ba60e50dd69593ffed2bffd4b8faa0d38) Be more general in stripping off stack frames to fix Firefox tests ([#​2425](https://togithub.com/sinonjs/sinon/issues/2425)) (Joel Bradshaw) - [`56b06129`](https://togithub.com/sinonjs/sinon/commit/56b06129e223eae690265c37b1113067e2b31bdc) Check call count type ([#​2410](https://togithub.com/sinonjs/sinon/issues/2410)) (Joel Bradshaw) - [`7863e2df`](https://togithub.com/sinonjs/sinon/commit/7863e2dfdbda79e0a32e42af09e6539fc2f2b80f) Fix [#​2414](https://togithub.com/sinonjs/sinon/issues/2414): make Sinon available on homepage (Carl-Erik Kopseng) - [`fabaabdd`](https://togithub.com/sinonjs/sinon/commit/fabaabdda82f39a7f5b75b55bd56cf77b1cd4a8f) Bump nokogiri from 1.11.4 to 1.13.1 ([#​2423](https://togithub.com/sinonjs/sinon/issues/2423)) (dependabot\[bot]) - [`dbc0fbd2`](https://togithub.com/sinonjs/sinon/commit/dbc0fbd263c8419fa47f9c3b20cf47890a242d21) Bump shelljs from 0.8.4 to 0.8.5 ([#​2422](https://togithub.com/sinonjs/sinon/issues/2422)) (dependabot\[bot]) - [`fb8b3d72`](https://togithub.com/sinonjs/sinon/commit/fb8b3d72a85dc8fb0547f859baf3f03a22a039f7) Run Prettier (Carl-Erik Kopseng) - [`12a45939`](https://togithub.com/sinonjs/sinon/commit/12a45939e9b047b6d3663fe55f2eb383ec63c4e1) Fix 2377: Throw error when trying to stub non-configurable or non-writable properties ([#​2417](https://togithub.com/sinonjs/sinon/issues/2417)) (Stuart Dotson) > Fixes issue [#​2377](https://togithub.com/sinonjs/sinon/issues/2377) by throwing an error when trying to stub non-configurable or non-writable properties *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2022-01-28.*
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index cc26e754537..e8c9a9fd3ea 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -57,7 +57,7 @@ "mocha": "^8.2.1", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", - "sinon": "^12.0.0", + "sinon": "^13.0.0", "ts-loader": "^9.0.0", "typescript": "^4.1.2", "webpack": "^5.9.0", From 1e809fdb93571c870706a713ef9595a1e104dede Mon Sep 17 00:00:00 2001 From: nmykhailets <94851929+nmykhailets@users.noreply.github.com> Date: Tue, 15 Feb 2022 17:40:48 +0200 Subject: [PATCH 066/103] test: create/delete test resources scripts (#145) --- packages/google-cloud-retail/samples/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 55e3f26cd8b..c7fe4541265 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -10,10 +10,12 @@ "*.js" ], "scripts": { - "test": "c8 mocha --timeout 600000 test/*.js" + "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.5.0" + "@google-cloud/retail": "^1.5.0", + "@google-cloud/bigquery": "^5.9.2", + "@google-cloud/storage": "^5.16.1" }, "devDependencies": { "c8": "^7.1.0", From f9453e3a6ee3d47bcc18da22b5b96c70f3f422ca Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 17:36:50 +0000 Subject: [PATCH 067/103] chore(main): release 1.6.0 (#141) :robot: I have created a release *beep* *boop* --- ## [1.6.0](https://github.com/googleapis/nodejs-retail/compare/v1.5.0...v1.6.0) (2022-02-15) ### Features * add ControlService ([92d4d84](https://github.com/googleapis/nodejs-retail/commit/92d4d849b9c4093778cf81bd56e8ebc2d6afd98b)) * add ServingConfigService ([92d4d84](https://github.com/googleapis/nodejs-retail/commit/92d4d849b9c4093778cf81bd56e8ebc2d6afd98b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 8 ++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 903cacda2af..b206a9bd032 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.6.0](https://github.com/googleapis/nodejs-retail/compare/v1.5.0...v1.6.0) (2022-02-15) + + +### Features + +* add ControlService ([92d4d84](https://github.com/googleapis/nodejs-retail/commit/92d4d849b9c4093778cf81bd56e8ebc2d6afd98b)) +* add ServingConfigService ([92d4d84](https://github.com/googleapis/nodejs-retail/commit/92d4d849b9c4093778cf81bd56e8ebc2d6afd98b)) + ## [1.5.0](https://www.github.com/googleapis/nodejs-retail/compare/v1.4.0...v1.5.0) (2021-11-23) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index e8c9a9fd3ea..13dbb5999d4 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.5.0", + "version": "1.6.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index c7fe4541265..77ebaa7428e 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.5.0", + "@google-cloud/retail": "^1.6.0", "@google-cloud/bigquery": "^5.9.2", "@google-cloud/storage": "^5.16.1" }, From a864a9238ac24761cec51bd1c95b5c4d6c22364a Mon Sep 17 00:00:00 2001 From: Lei Chen Date: Wed, 16 Feb 2022 15:36:49 -0800 Subject: [PATCH 068/103] chore(samples): add cloud-retail-team as sample owners (#137) 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/nodejs-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) --- packages/google-cloud-retail/.repo-metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json index bdda91d1895..629f2b90f04 100644 --- a/packages/google-cloud-retail/.repo-metadata.json +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -12,5 +12,6 @@ "name": "retail", "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues", "api_shortname": "retail", - "library_type": "GAPIC_AUTO" + "library_type": "GAPIC_AUTO", + "codeowner_team": "@googleapis/cloud-retail-team" } From 9b34eba59c1a19b05fbfc77bb321c120e1a4f2e9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 02:02:49 +0000 Subject: [PATCH 069/103] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#148) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 429395631 Source-Link: https://github.com/googleapis/googleapis/commit/84594b35af0c38efcd6967e8179d801702ad96ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/ed74f970fd82914874e6b27b04763cfa66bafe9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9 --- .../cloud/retail/v2beta/catalog_service.proto | 2 + .../google/cloud/retail/v2beta/common.proto | 252 +- .../cloud/retail/v2beta/import_config.proto | 9 + .../google/cloud/retail/v2beta/product.proto | 77 +- .../cloud/retail/v2beta/product_service.proto | 5 +- .../cloud/retail/v2beta/purge_config.proto | 2 + .../cloud/retail/v2beta/search_service.proto | 33 +- .../cloud/retail/v2beta/user_event.proto | 20 +- .../google-cloud-retail/protos/protos.d.ts | 1210 +++++++ packages/google-cloud-retail/protos/protos.js | 3012 +++++++++++++++++ .../google-cloud-retail/protos/protos.json | 212 ++ .../v2/catalog_service.get_default_branch.js | 9 +- .../v2/catalog_service.list_catalogs.js | 9 +- .../v2/catalog_service.set_default_branch.js | 9 +- .../v2/catalog_service.update_catalog.js | 9 +- .../v2/completion_service.complete_query.js | 9 +- ...mpletion_service.import_completion_data.js | 9 +- .../v2/prediction_service.predict.js | 9 +- .../product_service.add_fulfillment_places.js | 9 +- .../v2/product_service.create_product.js | 9 +- .../v2/product_service.delete_product.js | 9 +- .../v2/product_service.get_product.js | 9 +- .../v2/product_service.import_products.js | 9 +- .../v2/product_service.list_products.js | 9 +- ...oduct_service.remove_fulfillment_places.js | 9 +- .../v2/product_service.set_inventory.js | 9 +- .../v2/product_service.update_product.js | 9 +- .../generated/v2/search_service.search.js | 9 +- ...ippet_metadata.google.cloud.retail.v2.json | 1179 +++++++ .../user_event_service.collect_user_event.js | 9 +- .../user_event_service.import_user_events.js | 9 +- .../user_event_service.purge_user_events.js | 9 +- .../user_event_service.rejoin_user_events.js | 9 +- .../v2/user_event_service.write_user_event.js | 9 +- .../catalog_service.get_default_branch.js | 9 +- .../v2alpha/catalog_service.list_catalogs.js | 9 +- .../catalog_service.set_default_branch.js | 9 +- .../v2alpha/catalog_service.update_catalog.js | 9 +- .../completion_service.complete_query.js | 9 +- ...mpletion_service.import_completion_data.js | 9 +- .../v2alpha/prediction_service.predict.js | 9 +- .../product_service.add_fulfillment_places.js | 9 +- .../product_service.add_local_inventories.js | 9 +- .../v2alpha/product_service.create_product.js | 9 +- .../v2alpha/product_service.delete_product.js | 9 +- .../v2alpha/product_service.get_product.js | 9 +- .../product_service.import_products.js | 9 +- .../v2alpha/product_service.list_products.js | 9 +- ...oduct_service.remove_fulfillment_places.js | 9 +- ...roduct_service.remove_local_inventories.js | 9 +- .../v2alpha/product_service.set_inventory.js | 9 +- .../v2alpha/product_service.update_product.js | 9 +- .../v2alpha/search_service.search.js | 9 +- ..._metadata.google.cloud.retail.v2alpha.json | 1295 +++++++ .../user_event_service.collect_user_event.js | 9 +- .../user_event_service.import_user_events.js | 9 +- .../user_event_service.purge_user_events.js | 9 +- .../user_event_service.rejoin_user_events.js | 9 +- .../user_event_service.write_user_event.js | 9 +- .../catalog_service.get_default_branch.js | 9 +- .../v2beta/catalog_service.list_catalogs.js | 9 +- .../catalog_service.set_default_branch.js | 9 +- .../v2beta/catalog_service.update_catalog.js | 9 +- .../completion_service.complete_query.js | 9 +- ...mpletion_service.import_completion_data.js | 9 +- .../v2beta/prediction_service.predict.js | 9 +- .../product_service.add_fulfillment_places.js | 9 +- .../v2beta/product_service.create_product.js | 9 +- .../v2beta/product_service.delete_product.js | 9 +- .../v2beta/product_service.get_product.js | 9 +- .../v2beta/product_service.import_products.js | 9 +- .../v2beta/product_service.list_products.js | 9 +- ...oduct_service.remove_fulfillment_places.js | 9 +- .../v2beta/product_service.set_inventory.js | 13 +- .../v2beta/product_service.update_product.js | 9 +- .../generated/v2beta/search_service.search.js | 36 +- ...t_metadata.google.cloud.retail.v2beta.json | 1179 +++++++ .../user_event_service.collect_user_event.js | 9 +- .../user_event_service.import_user_events.js | 9 +- .../user_event_service.purge_user_events.js | 9 +- .../user_event_service.rejoin_user_events.js | 9 +- .../user_event_service.write_user_event.js | 9 +- .../src/v2/catalog_service_client.ts | 5 +- .../src/v2/completion_service_client.ts | 5 +- .../src/v2/prediction_service_client.ts | 5 +- .../src/v2/product_service_client.ts | 5 +- .../src/v2/search_service_client.ts | 5 +- .../src/v2/user_event_service_client.ts | 5 +- .../src/v2alpha/catalog_service_client.ts | 5 +- .../src/v2alpha/completion_service_client.ts | 5 +- .../src/v2alpha/prediction_service_client.ts | 5 +- .../src/v2alpha/product_service_client.ts | 5 +- .../src/v2alpha/search_service_client.ts | 5 +- .../src/v2alpha/user_event_service_client.ts | 5 +- .../src/v2beta/catalog_service_client.ts | 5 +- .../src/v2beta/completion_service_client.ts | 5 +- .../src/v2beta/prediction_service_client.ts | 5 +- .../src/v2beta/product_service_client.ts | 10 +- .../src/v2beta/search_service_client.ts | 89 +- .../src/v2beta/user_event_service_client.ts | 5 +- .../test/gapic_catalog_service_v2.ts | 68 +- .../test/gapic_catalog_service_v2alpha.ts | 68 +- .../test/gapic_catalog_service_v2beta.ts | 68 +- .../test/gapic_completion_service_v2.ts | 35 +- .../test/gapic_completion_service_v2alpha.ts | 36 +- .../test/gapic_completion_service_v2beta.ts | 37 +- .../test/gapic_prediction_service_v2.ts | 35 +- .../test/gapic_prediction_service_v2alpha.ts | 36 +- .../test/gapic_prediction_service_v2beta.ts | 37 +- .../test/gapic_product_service_v2.ts | 84 +- .../test/gapic_product_service_v2alpha.ts | 84 +- .../test/gapic_product_service_v2beta.ts | 84 +- .../test/gapic_search_service_v2.ts | 19 +- .../test/gapic_search_service_v2alpha.ts | 19 +- .../test/gapic_search_service_v2beta.ts | 19 +- .../test/gapic_user_event_service_v2.ts | 51 +- .../test/gapic_user_event_service_v2alpha.ts | 51 +- .../test/gapic_user_event_service_v2beta.ts | 51 +- 118 files changed, 9849 insertions(+), 342 deletions(-) create mode 100644 packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto index c87e2ba968b..5f2892858e8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto @@ -21,6 +21,8 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/catalog.proto"; +import "google/cloud/retail/v2beta/import_config.proto"; +import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index b281b7dee60..27208c8618a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -29,6 +29,249 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2beta"; option ruby_package = "Google::Cloud::Retail::V2beta"; +// The type of solution. +enum SolutionType { + // Default value. + SOLUTION_TYPE_UNSPECIFIED = 0; + + // Used for Recommendations AI. + SOLUTION_TYPE_RECOMMENDATION = 1; + + // Used for Retail Search. + SOLUTION_TYPE_SEARCH = 2; +} + +// Metadata that is used to define a condition that triggers an action. +// A valid condition must specify at least one of 'query_terms' or +// 'products_filter'. If multiple fields are specified, the condition is met if +// all the fields are satisfied e.g. if a set of query terms and product_filter +// are set, then only items matching the product_filter for requests with a +// query matching the query terms wil get boosted. +message Condition { + // Query terms that we want to match on. + message QueryTerm { + // The value of the term to match on. + // Value cannot be empty. + // Value can have at most 3 terms if specified as a partial match. Each + // space separated string is considered as one term. + // Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not + // allowed for partial match. + string value = 1; + + // Whether this is supposed to be a full or partial match. + bool full_match = 2; + } + + // Used for time-dependent conditions. + // Example: Want to have rule applied for week long sale. + message TimeRange { + // Start of time range. Range is inclusive. + google.protobuf.Timestamp start_time = 1; + + // End of time range. Range is inclusive. + google.protobuf.Timestamp end_time = 2; + } + + // A list (up to 10 entries) of terms to match the query on. If not + // specified, match all queries. + // If many query terms are specified, the condition + // is matched if any of the terms is a match (i.e. using the OR operator). + repeated QueryTerm query_terms = 1; + + // Range of time(s) specifying when Condition is active. + // Condition true if any time range matches. + repeated TimeRange active_time_range = 3; +} + +// A rule is a condition-action pair +// * A condition defines when a rule is to be triggered. +// * An action specifies what occurs on that trigger. +// Currently only boost rules are supported. +// Currently only supported by the search endpoint. +message Rule { + // A boost action to apply to results matching condition specified above. + message BoostAction { + // Strength of the condition boost, which must be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 1; + + // The filter can have a max size of 5000 characters. + // An expression which specifies which products to apply an action to. + // The syntax and supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter] + // for detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string products_filter = 2; + } + + // * Rule Condition: + // - No [Condition][query_terms] provided is a global match. + // - 1 or more [Condition][query_terms] provided is combined with OR + // operator. + // * Action Input: The request query and filter that will be applied to the + // retrieved products, in addition to any filters already provided with the + // SearchRequest. The AND operator is used to combine the query's existing + // filters with the filter rule(s). NOTE: May result in 0 results when + // filters conflict. + // * Action Result: Filters the returned objects to be ONLY those that passed + // the filter. + message FilterAction { + // A filter to apply on the matching condition results. Supported features: + // + // * [filter][google.cloud.retail.v2beta.Rule.FilterAction.filter] must be + // set. + // * Filter syntax is identical to + // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter]. + // See more + // details at the Retail Search + // [user guide](/retail/search/docs/filter-and-order#filter). + // * To filter products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string filter = 1; + } + + // Redirects a shopper to a specific page. + // * Rule Condition: + // - Must specify [Condition][query_terms]. + // * Action Input: Request Query + // * Action Result: Redirects shopper to provided uri. + message RedirectAction { + // URL must have length equal or less than 2000 characters. + string redirect_uri = 1; + } + + // Creates a set of terms that will be treated as synonyms of each other. + // Example: synonyms of "sneakers" and "shoes". + // * "sneakers" will use a synonym of "shoes". + // * "shoes" will use a synonym of "sneakers". + message TwowaySynonymsAction { + // Defines a set of synonyms. + // Can specify up to 100 synonyms. + // Must specify at least 2 synonyms. + repeated string synonyms = 1; + } + + // Maps a set of terms to a set of synonyms. + // Set of synonyms will be treated as synonyms of each query term only. + // `query_terms` will not be treated as synonyms of each other. + // Example: "sneakers" will use a synonym of "shoes". + // "shoes" will not use a synonym of "sneakers". + message OnewaySynonymsAction { + // Terms from the search query. + // Will treat synonyms as their synonyms. + // Not themselves synonyms of the synonyms. + // Can specify up to 100 terms. + repeated string query_terms = 3; + + // Defines a set of synonyms. + // Cannot contain duplicates. + // Can specify up to 100 synonyms. + repeated string synonyms = 4; + + // Will be [deprecated = true] post migration; + repeated string oneway_terms = 2; + } + + // Prevents `query_term` from being associated with specified terms during + // search. + // Example: Don't associate "gShoe" and "cheap". + message DoNotAssociateAction { + // Terms from the search query. + // Will not consider do_not_associate_terms for search if in search query. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Cannot contain duplicates or the query term. + // Can specify up to 100 terms. + repeated string do_not_associate_terms = 3; + + // Will be [deprecated = true] post migration; + repeated string terms = 1; + } + + // Replaces a term in the query. Multiple replacement candidates can be + // specified. All `query_terms` will be replaced with the replacement term. + // Example: Replace "gShoe" with "google shoe". + message ReplacementAction { + // Terms from the search query. + // Will be replaced by replacement term. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Term that will be used for replacement. + string replacement_term = 3; + + // Will be [deprecated = true] post migration; + string term = 1; + } + + // Prevents a term in the query from being used in search. + // Example: Don't search for "shoddy". + message IgnoreAction { + // Terms to ignore in the search query. + repeated string ignore_terms = 1; + } + + // An action must be provided. + oneof action { + // A boost action. + BoostAction boost_action = 2; + + // Redirects a shopper to a specific page. + RedirectAction redirect_action = 3; + + // Treats specific term as a synonym with a group of terms. + // Group of terms will not be treated as synonyms with the specific term. + OnewaySynonymsAction oneway_synonyms_action = 6; + + // Prevents term from being associated with other terms. + DoNotAssociateAction do_not_associate_action = 7; + + // Replaces specific terms in the query. + ReplacementAction replacement_action = 8; + + // Ignores specific terms from query during search. + IgnoreAction ignore_action = 9; + + // Filters results. + FilterAction filter_action = 10; + + // Treats a set of terms as synonyms of one another. + TwowaySynonymsAction twoway_synonyms_action = 11; + } + + // Required. The condition that triggers the rule. + // If the condition is empty, the rule will always apply. + Condition condition = 1 [(google.api.field_behavior) = REQUIRED]; +} + // An intended audience of the [Product][google.cloud.retail.v2beta.Product] for // whom it's sold. message Audience { @@ -100,10 +343,6 @@ 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.v2beta.CustomAttribute.text] or // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. @@ -112,9 +351,6 @@ message CustomAttribute { // 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.v2beta.CustomAttribute.text] or // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. @@ -280,7 +516,7 @@ message PriceInfo { // // Google Merchant Center property // [price](https://support.google.com/merchants/answer/6324371). Schema.org - // property [Offer.priceSpecification](https://schema.org/priceSpecification). + // property [Offer.price](https://schema.org/price). float price = 2; // Price of the product without any discount. If zero, by default set to be diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index 3e0c61f0471..f2e27174d73 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -64,6 +64,15 @@ message GcsSource { // [UserEvent][google.cloud.retail.v2beta.UserEvent] per line. // * `user_event_ga360`: Using // https://support.google.com/analytics/answer/3437719. + // + // Supported values for control imports: + // + // * 'control' (default): One JSON + // [Control][google.cloud.retail.v2beta.Control] per line. + // + // Supported values for catalog attribute imports: + // + // * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. string data_schema = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 4dd13c4b766..0899d387264 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -121,7 +121,7 @@ message Product { // [publish_time][google.cloud.retail.v2beta.Product.publish_time], // otherwise an INVALID_ARGUMENT error is thrown. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [expiration_date](https://support.google.com/merchants/answer/6324499). google.protobuf.Timestamp expire_time = 16; @@ -160,9 +160,9 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [id](https://support.google.com/merchants/answer/6324405). Schema.org - // Property [Product.sku](https://schema.org/sku). + // property [Product.sku](https://schema.org/sku). string id = 2 [(google.api.field_behavior) = IMMUTABLE]; // Immutable. The type of the product. Default to @@ -185,21 +185,23 @@ message Product { // [Product][google.cloud.retail.v2beta.Product]. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center Property + // Corresponding properties: Google Merchant Center property // [item_group_id](https://support.google.com/merchants/answer/6324507). - // Schema.org Property + // 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; // The [id][google.cloud.retail.v2beta.Product.id] of the collection members // when [type][google.cloud.retail.v2beta.Product.type] is // [Type.COLLECTION][google.cloud.retail.v2beta.Product.Type.COLLECTION]. // - // Should not set it for other types. A maximum of 1000 values are allowed. - // Otherwise, an INVALID_ARGUMENT error is return. + // Non-existent product ids are allowed. + // The [type][google.cloud.retail.v2beta.Product.type] of the members must be + // either [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] or + // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] otherwise + // and INVALID_ARGUMENT error is thrown. Should not set it for other types. A + // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is + // return. repeated string collection_member_ids = 5; // The Global Trade Item Number (GTIN) of the product. @@ -210,13 +212,13 @@ message Product { // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is // returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [gtin](https://support.google.com/merchants/answer/6324461). // Schema.org property - // [Product.isbn](https://schema.org/isbn) or - // [Product.gtin8](https://schema.org/gtin8) or - // [Product.gtin12](https://schema.org/gtin12) or - // [Product.gtin13](https://schema.org/gtin13) or + // [Product.isbn](https://schema.org/isbn), + // [Product.gtin8](https://schema.org/gtin8), + // [Product.gtin12](https://schema.org/gtin12), + // [Product.gtin13](https://schema.org/gtin13), or // [Product.gtin14](https://schema.org/gtin14). // // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. @@ -251,7 +253,7 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [google_product_category][mc_google_product_category]. Schema.org property // [Product.category] (https://schema.org/category). // @@ -264,7 +266,7 @@ message Product { // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: 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]; @@ -275,7 +277,7 @@ message Product { // string with a length limit of 1,000 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [brand](https://support.google.com/merchants/answer/6324351). Schema.org // property [Product.brand](https://schema.org/brand). repeated string brands = 9; @@ -285,13 +287,13 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [description](https://support.google.com/merchants/answer/6324468). - // schema.org property [Product.description](https://schema.org/description). + // Schema.org property [Product.description](https://schema.org/description). string description = 10; // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt]. + // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). // // For product prediction, this field is ignored and the model automatically // detects the text language. The @@ -326,7 +328,12 @@ message Product { // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. // * For indexable attribute, the key must match the pattern: - // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, key0LikeThis or KEY_1_LIKE_THIS. + // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or + // `KEY_1_LIKE_THIS`. + // * For text attributes, 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. + // * For number attributes, at most 400 values are allowed. map attributes = 12; // Custom tags associated with the product. @@ -340,13 +347,13 @@ message Product { // tag as part of the // [PredictRequest.filter][google.cloud.retail.v2beta.PredictRequest.filter]. // - // Google Merchant Center property + // Corresponding properties: 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 + // Corresponding properties: Google Merchant Center property // [price](https://support.google.com/merchants/answer/6324371). PriceInfo price_info = 14; @@ -362,9 +369,9 @@ message Product { // [Product][google.cloud.retail.v2beta.Product]. Default to // [Availability.IN_STOCK][google.cloud.retail.v2beta.Product.Availability.IN_STOCK]. // - // Google Merchant Center Property + // Corresponding properties: Google Merchant Center property // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org Property [Offer.availability](https://schema.org/availability). + // Schema.org property [Offer.availability](https://schema.org/availability). Availability availability = 19; // The available quantity of the item. @@ -386,7 +393,7 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [link](https://support.google.com/merchants/answer/6324416). Schema.org // property [Offer.url](https://schema.org/url). string uri = 22; @@ -396,7 +403,7 @@ message Product { // // A maximum of 300 images are allowed. // - // Google Merchant Center property + // Corresponding properties: 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; @@ -407,7 +414,7 @@ message Product { // The color of the product. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [color](https://support.google.com/merchants/answer/6324487). Schema.org // property [Product.color](https://schema.org/color). ColorInfo color_info = 25; @@ -425,9 +432,9 @@ message Product { // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [size](https://support.google.com/merchants/answer/6324492), - // [size_type](https://support.google.com/merchants/answer/6324497) and + // [size_type](https://support.google.com/merchants/answer/6324497), and // [size_system](https://support.google.com/merchants/answer/6324502). // Schema.org property [Product.size](https://schema.org/size). repeated string sizes = 26; @@ -438,7 +445,7 @@ message Product { // string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [material](https://support.google.com/merchants/answer/6324410). Schema.org // property [Product.material](https://schema.org/material). repeated string materials = 27; @@ -451,7 +458,7 @@ message Product { // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org // property [Product.pattern](https://schema.org/pattern). repeated string patterns = 28; @@ -459,12 +466,12 @@ message Product { // The condition of the product. Strongly encouraged to use the standard // values: "new", "refurbished", "used". // - // A maximum of 5 values are allowed per + // A maximum of 1 value is allowed per // [Product][google.cloud.retail.v2beta.Product]. Each value 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 + // Corresponding properties: Google Merchant Center property // [condition](https://support.google.com/merchants/answer/6324469). // Schema.org property // [Offer.itemCondition](https://schema.org/itemCondition). diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index 157a76dbb7a..beb380e7404 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -466,8 +466,9 @@ message SetInventoryRequest { Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which inventory fields in the provided - // [Product][google.cloud.retail.v2beta.Product] to update. If not set or set - // with empty paths, all inventory fields will be updated. + // [Product][google.cloud.retail.v2beta.Product] to update. + // + // At least one field must be provided. // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned and the entire update will be ignored. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto index 0d87246fa7f..1474fe8d6dd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto @@ -18,6 +18,8 @@ package google.cloud.retail.v2beta; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index 62149b989a4..d38f1eb4a57 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -106,6 +106,7 @@ message SearchRequest { // * "ratingCount" // * "attributes.key" // * "inventory(place_id,price)" + // * "inventory(place_id,original_price)" // * "inventory(place_id,attributes.key)" string key = 1 [(google.api.field_behavior) = REQUIRED]; @@ -406,6 +407,9 @@ message SearchRequest { // identify a visitor on a single device. This unique identifier should not // change if the visitor logs in or out of the website. // + // This should be the same identifier as + // [UserEvent.visitor_id][google.cloud.retail.v2beta.UserEvent.visitor_id]. + // // 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 = 4 [(google.api.field_behavior) = REQUIRED]; @@ -485,11 +489,12 @@ message SearchRequest { // Boost specification to boost certain products. See more details at this // [user guide](https://cloud.google.com/retail/docs/boosting). // - // Notice that if both [ServingConfig.boost_control_ids][] and - // [SearchRequest.boost_spec] are set, the boost conditions from both places - // are evaluated. If a search request matches multiple boost conditions, - // the final boost score is equal to the sum of the boost scores from all - // matched boost conditions. + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2beta.ServingConfig.boost_control_ids] + // and [SearchRequest.boost_spec] are set, the boost conditions from both + // places are evaluated. If a search request matches multiple boost + // conditions, the final boost score is equal to the sum of the boost scores + // from all matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which @@ -499,14 +504,13 @@ message SearchRequest { // The keys to fetch and rollup the matching // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2beta.Product]s attributes. The attributes - // from all the matching - // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2beta.Product]s are merged and - // de-duplicated. Notice that rollup + // [Product][google.cloud.retail.v2beta.Product]s attributes, + // [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo] or + // [LocalInventory][]s attributes. The attributes from all the matching // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2beta.Product]s attributes will lead to - // extra query latency. Maximum number of keys is 10. + // [Product][google.cloud.retail.v2beta.Product]s or [LocalInventory][]s are + // merged and de-duplicated. Notice that rollup attributes will lead to extra + // query latency. Maximum number of keys is 30. // // For [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo], a // fulfillment type and a fulfillment ID must be provided in the format of @@ -521,6 +525,7 @@ message SearchRequest { // * discount // * variantId // * inventory(place_id,price) + // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the // [Product.inventories.attributes][] map. // * attributes.key, where key is any key in the @@ -741,4 +746,8 @@ message SearchResponse { // [attribution_token][google.cloud.retail.v2beta.SearchResponse.attribution_token] // will be set in the response. string redirect_uri = 10; + + // The fully qualified resource name of applied + // [controls](https://cloud.google.com/retail/docs/serving-control-rules). + repeated string applied_controls = 12; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index 842064a89d9..637697ef9ed 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -40,7 +40,6 @@ message UserEvent { // * `add-to-cart`: Products being added to cart. // * `category-page-view`: Special pages such as sale or promotion pages // viewed. - // * `completion`: Completion query result showed/clicked. // * `detail-page-view`: Products detail page viewed. // * `home-page-view`: Homepage viewed. // * `promotion-offered`: Promotion is offered to a user. @@ -118,6 +117,7 @@ message UserEvent { // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` + // * `search` // // 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 browsing the @@ -128,17 +128,23 @@ message UserEvent { // desired. The end user may have not finished browsing the whole page yet. repeated ProductDetail product_details = 6; - // The main completion details related to the event. + // The main auto-completion details related to the event. // - // In a `completion` event, this field represents the completions returned to - // the end user and the clicked completion by the end user. In a `search` - // event, it represents the search event happens after clicking completion. + // This field should be set for `search` event when autocomplete function is + // enabled and the user clicks a suggestion for search. CompletionDetail completion_detail = 22; // 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. + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * The key must be a UTF-8 encoded string with a length limit of 5,000 + // characters. + // * For text attributes, 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. + // * For number attributes, at most 400 values are allowed. // // For product recommendation, an example of extra user information is // traffic_channel, i.e. how user arrives at the site. Users can arrive diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index e3f5f57ef22..ead42a10a1c 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -21430,6 +21430,1210 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** SolutionType enum. */ + enum SolutionType { + SOLUTION_TYPE_UNSPECIFIED = 0, + SOLUTION_TYPE_RECOMMENDATION = 1, + SOLUTION_TYPE_SEARCH = 2 + } + + /** Properties of a Condition. */ + interface ICondition { + + /** Condition queryTerms */ + queryTerms?: (google.cloud.retail.v2beta.Condition.IQueryTerm[]|null); + + /** Condition activeTimeRange */ + activeTimeRange?: (google.cloud.retail.v2beta.Condition.ITimeRange[]|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { + + /** + * Constructs a new Condition. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICondition); + + /** Condition queryTerms. */ + public queryTerms: google.cloud.retail.v2beta.Condition.IQueryTerm[]; + + /** Condition activeTimeRange. */ + public activeTimeRange: google.cloud.retail.v2beta.Condition.ITimeRange[]; + + /** + * Creates a new Condition instance using the specified properties. + * @param [properties] Properties to set + * @returns Condition instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICondition): google.cloud.retail.v2beta.Condition; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition; + + /** + * Verifies a Condition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Condition + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Condition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Condition { + + /** Properties of a QueryTerm. */ + interface IQueryTerm { + + /** QueryTerm value */ + value?: (string|null); + + /** QueryTerm fullMatch */ + fullMatch?: (boolean|null); + } + + /** Represents a QueryTerm. */ + class QueryTerm implements IQueryTerm { + + /** + * Constructs a new QueryTerm. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Condition.IQueryTerm); + + /** QueryTerm value. */ + public value: string; + + /** QueryTerm fullMatch. */ + public fullMatch: boolean; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTerm instance + */ + public static create(properties?: google.cloud.retail.v2beta.Condition.IQueryTerm): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Verifies a QueryTerm message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTerm + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @param message QueryTerm + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTerm to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TimeRange. */ + interface ITimeRange { + + /** TimeRange startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TimeRange. */ + class TimeRange implements ITimeRange { + + /** + * Constructs a new TimeRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Condition.ITimeRange); + + /** TimeRange startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TimeRange instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeRange instance + */ + public static create(properties?: google.cloud.retail.v2beta.Condition.ITimeRange): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Verifies a TimeRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @param message TimeRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Rule. */ + interface IRule { + + /** Rule boostAction */ + boostAction?: (google.cloud.retail.v2beta.Rule.IBoostAction|null); + + /** Rule redirectAction */ + redirectAction?: (google.cloud.retail.v2beta.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction */ + onewaySynonymsAction?: (google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction */ + doNotAssociateAction?: (google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction */ + replacementAction?: (google.cloud.retail.v2beta.Rule.IReplacementAction|null); + + /** Rule ignoreAction */ + ignoreAction?: (google.cloud.retail.v2beta.Rule.IIgnoreAction|null); + + /** Rule filterAction */ + filterAction?: (google.cloud.retail.v2beta.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction */ + twowaySynonymsAction?: (google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null); + + /** Rule condition */ + condition?: (google.cloud.retail.v2beta.ICondition|null); + } + + /** Represents a Rule. */ + class Rule implements IRule { + + /** + * Constructs a new Rule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRule); + + /** Rule boostAction. */ + public boostAction?: (google.cloud.retail.v2beta.Rule.IBoostAction|null); + + /** Rule redirectAction. */ + public redirectAction?: (google.cloud.retail.v2beta.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction. */ + public onewaySynonymsAction?: (google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction. */ + public doNotAssociateAction?: (google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction. */ + public replacementAction?: (google.cloud.retail.v2beta.Rule.IReplacementAction|null); + + /** Rule ignoreAction. */ + public ignoreAction?: (google.cloud.retail.v2beta.Rule.IIgnoreAction|null); + + /** Rule filterAction. */ + public filterAction?: (google.cloud.retail.v2beta.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction. */ + public twowaySynonymsAction?: (google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null); + + /** Rule condition. */ + public condition?: (google.cloud.retail.v2beta.ICondition|null); + + /** Rule action. */ + public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + + /** + * Creates a new Rule instance using the specified properties. + * @param [properties] Properties to set + * @returns Rule instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRule): google.cloud.retail.v2beta.Rule; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule; + + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule; + + /** + * Verifies a Rule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @param message Rule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Rule { + + /** Properties of a BoostAction. */ + interface IBoostAction { + + /** BoostAction boost */ + boost?: (number|null); + + /** BoostAction productsFilter */ + productsFilter?: (string|null); + } + + /** Represents a BoostAction. */ + class BoostAction implements IBoostAction { + + /** + * Constructs a new BoostAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IBoostAction); + + /** BoostAction boost. */ + public boost: number; + + /** BoostAction productsFilter. */ + public productsFilter: string; + + /** + * Creates a new BoostAction instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IBoostAction): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Verifies a BoostAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @param message BoostAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FilterAction. */ + interface IFilterAction { + + /** FilterAction filter */ + filter?: (string|null); + } + + /** Represents a FilterAction. */ + class FilterAction implements IFilterAction { + + /** + * Constructs a new FilterAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IFilterAction); + + /** FilterAction filter. */ + public filter: string; + + /** + * Creates a new FilterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns FilterAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IFilterAction): google.cloud.retail.v2beta.Rule.FilterAction; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.FilterAction; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.FilterAction; + + /** + * Verifies a FilterAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FilterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.FilterAction; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @param message FilterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FilterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RedirectAction. */ + interface IRedirectAction { + + /** RedirectAction redirectUri */ + redirectUri?: (string|null); + } + + /** Represents a RedirectAction. */ + class RedirectAction implements IRedirectAction { + + /** + * Constructs a new RedirectAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IRedirectAction); + + /** RedirectAction redirectUri. */ + public redirectUri: string; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RedirectAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IRedirectAction): google.cloud.retail.v2beta.Rule.RedirectAction; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.RedirectAction; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.RedirectAction; + + /** + * Verifies a RedirectAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RedirectAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.RedirectAction; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @param message RedirectAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RedirectAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TwowaySynonymsAction. */ + interface ITwowaySynonymsAction { + + /** TwowaySynonymsAction synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a TwowaySynonymsAction. */ + class TwowaySynonymsAction implements ITwowaySynonymsAction { + + /** + * Constructs a new TwowaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction); + + /** TwowaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns TwowaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + + /** + * Verifies a TwowaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TwowaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @param message TwowaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TwowaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OnewaySynonymsAction. */ + interface IOnewaySynonymsAction { + + /** OnewaySynonymsAction queryTerms */ + queryTerms?: (string[]|null); + + /** OnewaySynonymsAction synonyms */ + synonyms?: (string[]|null); + + /** OnewaySynonymsAction onewayTerms */ + onewayTerms?: (string[]|null); + } + + /** Represents an OnewaySynonymsAction. */ + class OnewaySynonymsAction implements IOnewaySynonymsAction { + + /** + * Constructs a new OnewaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction); + + /** OnewaySynonymsAction queryTerms. */ + public queryTerms: string[]; + + /** OnewaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** OnewaySynonymsAction onewayTerms. */ + public onewayTerms: string[]; + + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OnewaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + + /** + * Verifies an OnewaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnewaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @param message OnewaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DoNotAssociateAction. */ + interface IDoNotAssociateAction { + + /** DoNotAssociateAction queryTerms */ + queryTerms?: (string[]|null); + + /** DoNotAssociateAction doNotAssociateTerms */ + doNotAssociateTerms?: (string[]|null); + + /** DoNotAssociateAction terms */ + terms?: (string[]|null); + } + + /** Represents a DoNotAssociateAction. */ + class DoNotAssociateAction implements IDoNotAssociateAction { + + /** + * Constructs a new DoNotAssociateAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction); + + /** DoNotAssociateAction queryTerms. */ + public queryTerms: string[]; + + /** DoNotAssociateAction doNotAssociateTerms. */ + public doNotAssociateTerms: string[]; + + /** DoNotAssociateAction terms. */ + public terms: string[]; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DoNotAssociateAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + + /** + * Verifies a DoNotAssociateAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoNotAssociateAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @param message DoNotAssociateAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReplacementAction. */ + interface IReplacementAction { + + /** ReplacementAction queryTerms */ + queryTerms?: (string[]|null); + + /** ReplacementAction replacementTerm */ + replacementTerm?: (string|null); + + /** ReplacementAction term */ + term?: (string|null); + } + + /** Represents a ReplacementAction. */ + class ReplacementAction implements IReplacementAction { + + /** + * Constructs a new ReplacementAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IReplacementAction); + + /** ReplacementAction queryTerms. */ + public queryTerms: string[]; + + /** ReplacementAction replacementTerm. */ + public replacementTerm: string; + + /** ReplacementAction term. */ + public term: string; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplacementAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IReplacementAction): google.cloud.retail.v2beta.Rule.ReplacementAction; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.ReplacementAction; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.ReplacementAction; + + /** + * Verifies a ReplacementAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplacementAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.ReplacementAction; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @param message ReplacementAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplacementAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an IgnoreAction. */ + interface IIgnoreAction { + + /** IgnoreAction ignoreTerms */ + ignoreTerms?: (string[]|null); + } + + /** Represents an IgnoreAction. */ + class IgnoreAction implements IIgnoreAction { + + /** + * Constructs a new IgnoreAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IIgnoreAction); + + /** IgnoreAction ignoreTerms. */ + public ignoreTerms: string[]; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @param [properties] Properties to set + * @returns IgnoreAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IIgnoreAction): google.cloud.retail.v2beta.Rule.IgnoreAction; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.IgnoreAction; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.IgnoreAction; + + /** + * Verifies an IgnoreAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IgnoreAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.IgnoreAction; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @param message IgnoreAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IgnoreAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Properties of an Audience. */ interface IAudience { @@ -29805,6 +31009,9 @@ export namespace google { /** SearchResponse redirectUri */ redirectUri?: (string|null); + + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); } /** Represents a SearchResponse. */ @@ -29840,6 +31047,9 @@ export namespace google { /** SearchResponse redirectUri. */ public redirectUri: string; + /** SearchResponse appliedControls. */ + public appliedControls: string[]; + /** * Creates a new SearchResponse instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index a5eb010f454..d272e456f9a 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -52679,6 +52679,2980 @@ return Catalog; })(); + /** + * SolutionType enum. + * @name google.cloud.retail.v2beta.SolutionType + * @enum {number} + * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value + * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value + * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value + */ + v2beta.SolutionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; + values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; + return values; + })(); + + v2beta.Condition = (function() { + + /** + * Properties of a Condition. + * @memberof google.cloud.retail.v2beta + * @interface ICondition + * @property {Array.|null} [queryTerms] Condition queryTerms + * @property {Array.|null} [activeTimeRange] Condition activeTimeRange + */ + + /** + * Constructs a new Condition. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Condition. + * @implements ICondition + * @constructor + * @param {google.cloud.retail.v2beta.ICondition=} [properties] Properties to set + */ + function Condition(properties) { + this.queryTerms = []; + this.activeTimeRange = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Condition queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Condition + * @instance + */ + Condition.prototype.queryTerms = $util.emptyArray; + + /** + * Condition activeTimeRange. + * @member {Array.} activeTimeRange + * @memberof google.cloud.retail.v2beta.Condition + * @instance + */ + Condition.prototype.activeTimeRange = $util.emptyArray; + + /** + * Creates a new Condition instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {google.cloud.retail.v2beta.ICondition=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Condition} Condition instance + */ + Condition.create = function create(properties) { + return new Condition(properties); + }; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {google.cloud.retail.v2beta.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + $root.google.cloud.retail.v2beta.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeTimeRange != null && message.activeTimeRange.length) + for (var i = 0; i < message.activeTimeRange.length; ++i) + $root.google.cloud.retail.v2beta.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {google.cloud.retail.v2beta.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2beta.Condition.QueryTerm.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2beta.Condition.TimeRange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Condition message. + * @function verify + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Condition.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Condition.QueryTerm.verify(message.queryTerms[i]); + if (error) + return "queryTerms." + error; + } + } + if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { + if (!Array.isArray(message.activeTimeRange)) + return "activeTimeRange: array expected"; + for (var i = 0; i < message.activeTimeRange.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Condition.TimeRange.verify(message.activeTimeRange[i]); + if (error) + return "activeTimeRange." + error; + } + } + return null; + }; + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Condition} Condition + */ + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Condition) + return object; + var message = new $root.google.cloud.retail.v2beta.Condition(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Condition.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) { + if (typeof object.queryTerms[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.queryTerms: object expected"); + message.queryTerms[i] = $root.google.cloud.retail.v2beta.Condition.QueryTerm.fromObject(object.queryTerms[i]); + } + } + if (object.activeTimeRange) { + if (!Array.isArray(object.activeTimeRange)) + throw TypeError(".google.cloud.retail.v2beta.Condition.activeTimeRange: array expected"); + message.activeTimeRange = []; + for (var i = 0; i < object.activeTimeRange.length; ++i) { + if (typeof object.activeTimeRange[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.activeTimeRange: object expected"); + message.activeTimeRange[i] = $root.google.cloud.retail.v2beta.Condition.TimeRange.fromObject(object.activeTimeRange[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {google.cloud.retail.v2beta.Condition} message Condition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Condition.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.queryTerms = []; + object.activeTimeRange = []; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = $root.google.cloud.retail.v2beta.Condition.QueryTerm.toObject(message.queryTerms[j], options); + } + if (message.activeTimeRange && message.activeTimeRange.length) { + object.activeTimeRange = []; + for (var j = 0; j < message.activeTimeRange.length; ++j) + object.activeTimeRange[j] = $root.google.cloud.retail.v2beta.Condition.TimeRange.toObject(message.activeTimeRange[j], options); + } + return object; + }; + + /** + * Converts this Condition to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Condition + * @instance + * @returns {Object.} JSON object + */ + Condition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Condition.QueryTerm = (function() { + + /** + * Properties of a QueryTerm. + * @memberof google.cloud.retail.v2beta.Condition + * @interface IQueryTerm + * @property {string|null} [value] QueryTerm value + * @property {boolean|null} [fullMatch] QueryTerm fullMatch + */ + + /** + * Constructs a new QueryTerm. + * @memberof google.cloud.retail.v2beta.Condition + * @classdesc Represents a QueryTerm. + * @implements IQueryTerm + * @constructor + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm=} [properties] Properties to set + */ + function QueryTerm(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTerm value. + * @member {string} value + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.value = ""; + + /** + * QueryTerm fullMatch. + * @member {boolean} fullMatch + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.fullMatch = false; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm instance + */ + QueryTerm.create = function create(properties) { + return new QueryTerm(properties); + }; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); + return writer; + }; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition.QueryTerm(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.fullMatch = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTerm message. + * @function verify + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTerm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + if (typeof message.fullMatch !== "boolean") + return "fullMatch: boolean expected"; + return null; + }; + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + */ + QueryTerm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Condition.QueryTerm) + return object; + var message = new $root.google.cloud.retail.v2beta.Condition.QueryTerm(); + if (object.value != null) + message.value = String(object.value); + if (object.fullMatch != null) + message.fullMatch = Boolean(object.fullMatch); + return message; + }; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.QueryTerm} message QueryTerm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTerm.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.fullMatch = false; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + object.fullMatch = message.fullMatch; + return object; + }; + + /** + * Converts this QueryTerm to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @instance + * @returns {Object.} JSON object + */ + QueryTerm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTerm; + })(); + + Condition.TimeRange = (function() { + + /** + * Properties of a TimeRange. + * @memberof google.cloud.retail.v2beta.Condition + * @interface ITimeRange + * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime + */ + + /** + * Constructs a new TimeRange. + * @memberof google.cloud.retail.v2beta.Condition + * @classdesc Represents a TimeRange. + * @implements ITimeRange + * @constructor + * @param {google.cloud.retail.v2beta.Condition.ITimeRange=} [properties] Properties to set + */ + function TimeRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeRange startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @instance + */ + TimeRange.prototype.startTime = null; + + /** + * TimeRange endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @instance + */ + TimeRange.prototype.endTime = null; + + /** + * Creates a new TimeRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.ITimeRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange instance + */ + TimeRange.create = function create(properties) { + return new TimeRange(properties); + }; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition.TimeRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeRange message. + * @function verify + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + */ + TimeRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Condition.TimeRange) + return object; + var message = new $root.google.cloud.retail.v2beta.Condition.TimeRange(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.TimeRange.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.TimeRange.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.TimeRange} message TimeRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this TimeRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @instance + * @returns {Object.} JSON object + */ + TimeRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimeRange; + })(); + + return Condition; + })(); + + v2beta.Rule = (function() { + + /** + * Properties of a Rule. + * @memberof google.cloud.retail.v2beta + * @interface IRule + * @property {google.cloud.retail.v2beta.Rule.IBoostAction|null} [boostAction] Rule boostAction + * @property {google.cloud.retail.v2beta.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction + * @property {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction + * @property {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction + * @property {google.cloud.retail.v2beta.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction + * @property {google.cloud.retail.v2beta.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction + * @property {google.cloud.retail.v2beta.Rule.IFilterAction|null} [filterAction] Rule filterAction + * @property {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction + * @property {google.cloud.retail.v2beta.ICondition|null} [condition] Rule condition + */ + + /** + * Constructs a new Rule. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Rule. + * @implements IRule + * @constructor + * @param {google.cloud.retail.v2beta.IRule=} [properties] Properties to set + */ + function Rule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Rule boostAction. + * @member {google.cloud.retail.v2beta.Rule.IBoostAction|null|undefined} boostAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.boostAction = null; + + /** + * Rule redirectAction. + * @member {google.cloud.retail.v2beta.Rule.IRedirectAction|null|undefined} redirectAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.redirectAction = null; + + /** + * Rule onewaySynonymsAction. + * @member {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.onewaySynonymsAction = null; + + /** + * Rule doNotAssociateAction. + * @member {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.doNotAssociateAction = null; + + /** + * Rule replacementAction. + * @member {google.cloud.retail.v2beta.Rule.IReplacementAction|null|undefined} replacementAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.replacementAction = null; + + /** + * Rule ignoreAction. + * @member {google.cloud.retail.v2beta.Rule.IIgnoreAction|null|undefined} ignoreAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.ignoreAction = null; + + /** + * Rule filterAction. + * @member {google.cloud.retail.v2beta.Rule.IFilterAction|null|undefined} filterAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.filterAction = null; + + /** + * Rule twowaySynonymsAction. + * @member {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.twowaySynonymsAction = null; + + /** + * Rule condition. + * @member {google.cloud.retail.v2beta.ICondition|null|undefined} condition + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.condition = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Rule action. + * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Object.defineProperty(Rule.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Rule instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {google.cloud.retail.v2beta.IRule=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule} Rule instance + */ + Rule.create = function create(properties) { + return new Rule(properties); + }; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {google.cloud.retail.v2beta.IRule} message Rule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.cloud.retail.v2beta.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) + $root.google.cloud.retail.v2beta.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) + $root.google.cloud.retail.v2beta.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) + $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) + $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) + $root.google.cloud.retail.v2beta.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) + $root.google.cloud.retail.v2beta.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) + $root.google.cloud.retail.v2beta.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) + $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {google.cloud.retail.v2beta.IRule} message Rule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Rule message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule} Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.decode(reader, reader.uint32()); + break; + case 3: + message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + case 6: + message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + case 7: + message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + case 8: + message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + case 9: + message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + case 10: + message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.decode(reader, reader.uint32()); + break; + case 11: + message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + case 1: + message.condition = $root.google.cloud.retail.v2beta.Condition.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule} Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Rule message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Rule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.BoostAction.verify(message.boostAction); + if (error) + return "boostAction." + error; + } + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.RedirectAction.verify(message.redirectAction); + if (error) + return "redirectAction." + error; + } + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); + if (error) + return "onewaySynonymsAction." + error; + } + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); + if (error) + return "doNotAssociateAction." + error; + } + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.verify(message.replacementAction); + if (error) + return "replacementAction." + error; + } + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.verify(message.ignoreAction); + if (error) + return "ignoreAction." + error; + } + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.FilterAction.verify(message.filterAction); + if (error) + return "filterAction." + error; + } + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (error) + return "twowaySynonymsAction." + error; + } + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.cloud.retail.v2beta.Condition.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule} Rule + */ + Rule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule(); + if (object.boostAction != null) { + if (typeof object.boostAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.boostAction: object expected"); + message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.fromObject(object.boostAction); + } + if (object.redirectAction != null) { + if (typeof object.redirectAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.redirectAction: object expected"); + message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.fromObject(object.redirectAction); + } + if (object.onewaySynonymsAction != null) { + if (typeof object.onewaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.onewaySynonymsAction: object expected"); + message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + } + if (object.doNotAssociateAction != null) { + if (typeof object.doNotAssociateAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.doNotAssociateAction: object expected"); + message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); + } + if (object.replacementAction != null) { + if (typeof object.replacementAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.replacementAction: object expected"); + message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.fromObject(object.replacementAction); + } + if (object.ignoreAction != null) { + if (typeof object.ignoreAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.ignoreAction: object expected"); + message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.fromObject(object.ignoreAction); + } + if (object.filterAction != null) { + if (typeof object.filterAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.filterAction: object expected"); + message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.fromObject(object.filterAction); + } + if (object.twowaySynonymsAction != null) { + if (typeof object.twowaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.twowaySynonymsAction: object expected"); + message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.condition: object expected"); + message.condition = $root.google.cloud.retail.v2beta.Condition.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {google.cloud.retail.v2beta.Rule} message Rule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Rule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.condition = null; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.cloud.retail.v2beta.Condition.toObject(message.condition, options); + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + object.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.toObject(message.boostAction, options); + if (options.oneofs) + object.action = "boostAction"; + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + object.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.toObject(message.redirectAction, options); + if (options.oneofs) + object.action = "redirectAction"; + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + object.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); + if (options.oneofs) + object.action = "onewaySynonymsAction"; + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + object.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); + if (options.oneofs) + object.action = "doNotAssociateAction"; + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + object.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.toObject(message.replacementAction, options); + if (options.oneofs) + object.action = "replacementAction"; + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + object.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.toObject(message.ignoreAction, options); + if (options.oneofs) + object.action = "ignoreAction"; + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + object.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.toObject(message.filterAction, options); + if (options.oneofs) + object.action = "filterAction"; + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + object.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); + if (options.oneofs) + object.action = "twowaySynonymsAction"; + } + return object; + }; + + /** + * Converts this Rule to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule + * @instance + * @returns {Object.} JSON object + */ + Rule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Rule.BoostAction = (function() { + + /** + * Properties of a BoostAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IBoostAction + * @property {number|null} [boost] BoostAction boost + * @property {string|null} [productsFilter] BoostAction productsFilter + */ + + /** + * Constructs a new BoostAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a BoostAction. + * @implements IBoostAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IBoostAction=} [properties] Properties to set + */ + function BoostAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostAction boost. + * @member {number} boost + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @instance + */ + BoostAction.prototype.boost = 0; + + /** + * BoostAction productsFilter. + * @member {string} productsFilter + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @instance + */ + BoostAction.prototype.productsFilter = ""; + + /** + * Creates a new BoostAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IBoostAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction instance + */ + BoostAction.create = function create(properties) { + return new BoostAction(properties); + }; + + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); + if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + return writer; + }; + + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.BoostAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.boost = reader.float(); + break; + case 2: + message.productsFilter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + if (!$util.isString(message.productsFilter)) + return "productsFilter: string expected"; + return null; + }; + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + */ + BoostAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.BoostAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.BoostAction(); + if (object.boost != null) + message.boost = Number(object.boost); + if (object.productsFilter != null) + message.productsFilter = String(object.productsFilter); + return message; + }; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.BoostAction} message BoostAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.boost = 0; + object.productsFilter = ""; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + object.productsFilter = message.productsFilter; + return object; + }; + + /** + * Converts this BoostAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @instance + * @returns {Object.} JSON object + */ + BoostAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoostAction; + })(); + + Rule.FilterAction = (function() { + + /** + * Properties of a FilterAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IFilterAction + * @property {string|null} [filter] FilterAction filter + */ + + /** + * Constructs a new FilterAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a FilterAction. + * @implements IFilterAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IFilterAction=} [properties] Properties to set + */ + function FilterAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FilterAction filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @instance + */ + FilterAction.prototype.filter = ""; + + /** + * Creates a new FilterAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IFilterAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction instance + */ + FilterAction.create = function create(properties) { + return new FilterAction(properties); + }; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + return writer; + }; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.FilterAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FilterAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilterAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + */ + FilterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.FilterAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.FilterAction(); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.FilterAction} message FilterAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilterAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.filter = ""; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this FilterAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @instance + * @returns {Object.} JSON object + */ + FilterAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FilterAction; + })(); + + Rule.RedirectAction = (function() { + + /** + * Properties of a RedirectAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IRedirectAction + * @property {string|null} [redirectUri] RedirectAction redirectUri + */ + + /** + * Constructs a new RedirectAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a RedirectAction. + * @implements IRedirectAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction=} [properties] Properties to set + */ + function RedirectAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RedirectAction redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @instance + */ + RedirectAction.prototype.redirectUri = ""; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction instance + */ + RedirectAction.create = function create(properties) { + return new RedirectAction(properties); + }; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); + return writer; + }; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.RedirectAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redirectUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RedirectAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedirectAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + */ + RedirectAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.RedirectAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.RedirectAction(); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.RedirectAction} message RedirectAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedirectAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.redirectUri = ""; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + return object; + }; + + /** + * Converts this RedirectAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @instance + * @returns {Object.} JSON object + */ + RedirectAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RedirectAction; + })(); + + Rule.TwowaySynonymsAction = (function() { + + /** + * Properties of a TwowaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface ITwowaySynonymsAction + * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms + */ + + /** + * Constructs a new TwowaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a TwowaySynonymsAction. + * @implements ITwowaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction=} [properties] Properties to set + */ + function TwowaySynonymsAction(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TwowaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @instance + */ + TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance + */ + TwowaySynonymsAction.create = function create(properties) { + return new TwowaySynonymsAction(properties); + }; + + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TwowaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TwowaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction + */ + TwowaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction(); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} message TwowaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TwowaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this TwowaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + TwowaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TwowaySynonymsAction; + })(); + + Rule.OnewaySynonymsAction = (function() { + + /** + * Properties of an OnewaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IOnewaySynonymsAction + * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms + * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms + * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms + */ + + /** + * Constructs a new OnewaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents an OnewaySynonymsAction. + * @implements IOnewaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction=} [properties] Properties to set + */ + function OnewaySynonymsAction(properties) { + this.queryTerms = []; + this.synonyms = []; + this.onewayTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OnewaySynonymsAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; + + /** + * OnewaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; + + /** + * OnewaySynonymsAction onewayTerms. + * @member {Array.} onewayTerms + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; + + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + */ + OnewaySynonymsAction.create = function create(properties) { + return new OnewaySynonymsAction(properties); + }; + + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.onewayTerms != null && message.onewayTerms.length) + for (var i = 0; i < message.onewayTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 4: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + case 2: + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OnewaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnewaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { + if (!Array.isArray(message.onewayTerms)) + return "onewayTerms: array expected"; + for (var i = 0; i < message.onewayTerms.length; ++i) + if (!$util.isString(message.onewayTerms[i])) + return "onewayTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction + */ + OnewaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + if (object.onewayTerms) { + if (!Array.isArray(object.onewayTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.onewayTerms: array expected"); + message.onewayTerms = []; + for (var i = 0; i < object.onewayTerms.length; ++i) + message.onewayTerms[i] = String(object.onewayTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnewaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.onewayTerms = []; + object.queryTerms = []; + object.synonyms = []; + } + if (message.onewayTerms && message.onewayTerms.length) { + object.onewayTerms = []; + for (var j = 0; j < message.onewayTerms.length; ++j) + object.onewayTerms[j] = message.onewayTerms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + OnewaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OnewaySynonymsAction; + })(); + + Rule.DoNotAssociateAction = (function() { + + /** + * Properties of a DoNotAssociateAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IDoNotAssociateAction + * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms + * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms + * @property {Array.|null} [terms] DoNotAssociateAction terms + */ + + /** + * Constructs a new DoNotAssociateAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a DoNotAssociateAction. + * @implements IDoNotAssociateAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction=} [properties] Properties to set + */ + function DoNotAssociateAction(properties) { + this.queryTerms = []; + this.doNotAssociateTerms = []; + this.terms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoNotAssociateAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; + + /** + * DoNotAssociateAction doNotAssociateTerms. + * @member {Array.} doNotAssociateTerms + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; + + /** + * DoNotAssociateAction terms. + * @member {Array.} terms + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.terms = $util.emptyArray; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction instance + */ + DoNotAssociateAction.create = function create(properties) { + return new DoNotAssociateAction(properties); + }; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.terms != null && message.terms.length) + for (var i = 0; i < message.terms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + return writer; + }; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + case 1: + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoNotAssociateAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoNotAssociateAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { + if (!Array.isArray(message.doNotAssociateTerms)) + return "doNotAssociateTerms: array expected"; + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + if (!$util.isString(message.doNotAssociateTerms[i])) + return "doNotAssociateTerms: string[] expected"; + } + if (message.terms != null && message.hasOwnProperty("terms")) { + if (!Array.isArray(message.terms)) + return "terms: array expected"; + for (var i = 0; i < message.terms.length; ++i) + if (!$util.isString(message.terms[i])) + return "terms: string[] expected"; + } + return null; + }; + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction + */ + DoNotAssociateAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.doNotAssociateTerms) { + if (!Array.isArray(object.doNotAssociateTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); + message.doNotAssociateTerms = []; + for (var i = 0; i < object.doNotAssociateTerms.length; ++i) + message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); + } + if (object.terms) { + if (!Array.isArray(object.terms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.terms: array expected"); + message.terms = []; + for (var i = 0; i < object.terms.length; ++i) + message.terms[i] = String(object.terms[i]); + } + return message; + }; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoNotAssociateAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.terms = []; + object.queryTerms = []; + object.doNotAssociateTerms = []; + } + if (message.terms && message.terms.length) { + object.terms = []; + for (var j = 0; j < message.terms.length; ++j) + object.terms[j] = message.terms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { + object.doNotAssociateTerms = []; + for (var j = 0; j < message.doNotAssociateTerms.length; ++j) + object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; + } + return object; + }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + * @returns {Object.} JSON object + */ + DoNotAssociateAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DoNotAssociateAction; + })(); + + Rule.ReplacementAction = (function() { + + /** + * Properties of a ReplacementAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IReplacementAction + * @property {Array.|null} [queryTerms] ReplacementAction queryTerms + * @property {string|null} [replacementTerm] ReplacementAction replacementTerm + * @property {string|null} [term] ReplacementAction term + */ + + /** + * Constructs a new ReplacementAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a ReplacementAction. + * @implements IReplacementAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction=} [properties] Properties to set + */ + function ReplacementAction(properties) { + this.queryTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplacementAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.queryTerms = $util.emptyArray; + + /** + * ReplacementAction replacementTerm. + * @member {string} replacementTerm + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.replacementTerm = ""; + + /** + * ReplacementAction term. + * @member {string} term + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.term = ""; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction instance + */ + ReplacementAction.create = function create(properties) { + return new ReplacementAction(properties); + }; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.term != null && Object.hasOwnProperty.call(message, "term")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + return writer; + }; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.ReplacementAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + message.replacementTerm = reader.string(); + break; + case 1: + message.term = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplacementAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplacementAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + if (!$util.isString(message.replacementTerm)) + return "replacementTerm: string expected"; + if (message.term != null && message.hasOwnProperty("term")) + if (!$util.isString(message.term)) + return "term: string expected"; + return null; + }; + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction + */ + ReplacementAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.ReplacementAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.ReplacementAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.ReplacementAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.replacementTerm != null) + message.replacementTerm = String(object.replacementTerm); + if (object.term != null) + message.term = String(object.term); + return message; + }; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ReplacementAction} message ReplacementAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplacementAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.queryTerms = []; + if (options.defaults) { + object.term = ""; + object.replacementTerm = ""; + } + if (message.term != null && message.hasOwnProperty("term")) + object.term = message.term; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + object.replacementTerm = message.replacementTerm; + return object; + }; + + /** + * Converts this ReplacementAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + * @returns {Object.} JSON object + */ + ReplacementAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReplacementAction; + })(); + + Rule.IgnoreAction = (function() { + + /** + * Properties of an IgnoreAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IIgnoreAction + * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + */ + + /** + * Constructs a new IgnoreAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents an IgnoreAction. + * @implements IIgnoreAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction=} [properties] Properties to set + */ + function IgnoreAction(properties) { + this.ignoreTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IgnoreAction ignoreTerms. + * @member {Array.} ignoreTerms + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @instance + */ + IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction instance + */ + IgnoreAction.create = function create(properties) { + return new IgnoreAction(properties); + }; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ignoreTerms != null && message.ignoreTerms.length) + for (var i = 0; i < message.ignoreTerms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + return writer; + }; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.IgnoreAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IgnoreAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IgnoreAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { + if (!Array.isArray(message.ignoreTerms)) + return "ignoreTerms: array expected"; + for (var i = 0; i < message.ignoreTerms.length; ++i) + if (!$util.isString(message.ignoreTerms[i])) + return "ignoreTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction + */ + IgnoreAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.IgnoreAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.IgnoreAction(); + if (object.ignoreTerms) { + if (!Array.isArray(object.ignoreTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.IgnoreAction.ignoreTerms: array expected"); + message.ignoreTerms = []; + for (var i = 0; i < object.ignoreTerms.length; ++i) + message.ignoreTerms[i] = String(object.ignoreTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IgnoreAction} message IgnoreAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IgnoreAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreTerms = []; + if (message.ignoreTerms && message.ignoreTerms.length) { + object.ignoreTerms = []; + for (var j = 0; j < message.ignoreTerms.length; ++j) + object.ignoreTerms[j] = message.ignoreTerms[j]; + } + return object; + }; + + /** + * Converts this IgnoreAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @instance + * @returns {Object.} JSON object + */ + IgnoreAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IgnoreAction; + })(); + + return Rule; + })(); + v2beta.Audience = (function() { /** @@ -73347,6 +76321,7 @@ * @property {string|null} [nextPageToken] SearchResponse nextPageToken * @property {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls */ /** @@ -73360,6 +76335,7 @@ function SearchResponse(properties) { this.results = []; this.facets = []; + this.appliedControls = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73430,6 +76406,14 @@ */ SearchResponse.prototype.redirectUri = ""; + /** + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + */ + SearchResponse.prototype.appliedControls = $util.emptyArray; + /** * Creates a new SearchResponse instance using the specified properties. * @function create @@ -73472,6 +76456,9 @@ $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); return writer; }; @@ -73534,6 +76521,11 @@ case 10: message.redirectUri = reader.string(); break; + case 12: + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; default: reader.skipType(tag & 7); break; @@ -73607,6 +76599,13 @@ if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) if (!$util.isString(message.redirectUri)) return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; + } return null; }; @@ -73657,6 +76656,13 @@ } if (object.redirectUri != null) message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); + } return message; }; @@ -73676,6 +76682,7 @@ if (options.arrays || options.defaults) { object.results = []; object.facets = []; + object.appliedControls = []; } if (options.defaults) { object.totalSize = 0; @@ -73707,6 +76714,11 @@ object.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; + } return object; }; diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 4e86f935598..08d47c68824 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -5375,6 +5375,213 @@ } } }, + "SolutionType": { + "values": { + "SOLUTION_TYPE_UNSPECIFIED": 0, + "SOLUTION_TYPE_RECOMMENDATION": 1, + "SOLUTION_TYPE_SEARCH": 2 + } + }, + "Condition": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "QueryTerm", + "id": 1 + }, + "activeTimeRange": { + "rule": "repeated", + "type": "TimeRange", + "id": 3 + } + }, + "nested": { + "QueryTerm": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "fullMatch": { + "type": "bool", + "id": 2 + } + } + }, + "TimeRange": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } + }, + "Rule": { + "oneofs": { + "action": { + "oneof": [ + "boostAction", + "redirectAction", + "onewaySynonymsAction", + "doNotAssociateAction", + "replacementAction", + "ignoreAction", + "filterAction", + "twowaySynonymsAction" + ] + } + }, + "fields": { + "boostAction": { + "type": "BoostAction", + "id": 2 + }, + "redirectAction": { + "type": "RedirectAction", + "id": 3 + }, + "onewaySynonymsAction": { + "type": "OnewaySynonymsAction", + "id": 6 + }, + "doNotAssociateAction": { + "type": "DoNotAssociateAction", + "id": 7 + }, + "replacementAction": { + "type": "ReplacementAction", + "id": 8 + }, + "ignoreAction": { + "type": "IgnoreAction", + "id": 9 + }, + "filterAction": { + "type": "FilterAction", + "id": 10 + }, + "twowaySynonymsAction": { + "type": "TwowaySynonymsAction", + "id": 11 + }, + "condition": { + "type": "Condition", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "BoostAction": { + "fields": { + "boost": { + "type": "float", + "id": 1 + }, + "productsFilter": { + "type": "string", + "id": 2 + } + } + }, + "FilterAction": { + "fields": { + "filter": { + "type": "string", + "id": 1 + } + } + }, + "RedirectAction": { + "fields": { + "redirectUri": { + "type": "string", + "id": 1 + } + } + }, + "TwowaySynonymsAction": { + "fields": { + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "OnewaySynonymsAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "onewayTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "DoNotAssociateAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "doNotAssociateTerms": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "terms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "ReplacementAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "replacementTerm": { + "type": "string", + "id": 3 + }, + "term": { + "type": "string", + "id": 1 + } + } + }, + "IgnoreAction": { + "fields": { + "ignoreTerms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } + }, "Audience": { "fields": { "genders": { @@ -7517,6 +7724,11 @@ "redirectUri": { "type": "string", "id": 10 + }, + "appliedControls": { + "rule": "repeated", + "type": "string", + "id": 12 } }, "nested": { diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js index 7a079eab442..fa840318989 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js index 691edbe893f..b5c79c5163a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js index 8716d5c0837..6e1fb716d07 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js index 56703900c77..33d552b5cae 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index d1228a67598..1ed48516ef4 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js index 7d993e411df..4ccdcfe6c93 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index 4a2dcbe7989..7f93a971926 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js index c4437254d3f..79ea0522be9 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js index 78a19eb0330..e64ffbdfd60 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js index 65f8ff4b4b3..7838dfa1b3b 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js index a92d2d84e9a..007c35ea423 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index fcf29e1c7ab..3cf71650c5c 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js index 72f25da2891..00b71a9aa23 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js index 0ae62e6c7e8..3be188b891d 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js index 4cf7e61d60f..85b8419df49 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js index 32b9e87639a..359a30ef80d 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index b9f98813845..e95b1561193 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json new file mode 100644 index 00000000000..bb8b2fe4abd --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -0,0 +1,1179 @@ +{ + "clientLibrary": { + "name": "nodejs-retail", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.retail.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "retail_v2_generated_CatalogService_ListCatalogs_async", + "title": "CatalogService listCatalogs Sample", + "origin": "API_DEFINITION", + "description": " Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.", + "canonical": true, + "file": "catalog_service.list_catalogs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2.CatalogService.ListCatalogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ListCatalogsResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2.CatalogService.ListCatalogs", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_UpdateCatalog_async", + "title": "CatalogService updateCatalog Sample", + "origin": "API_DEFINITION", + "description": " Updates the [Catalog][google.cloud.retail.v2.Catalog]s.", + "canonical": true, + "file": "catalog_service.update_catalog.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateCatalog", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": ".google.cloud.retail.v2.Catalog" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.Catalog", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateCatalog", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_SetDefaultBranch_async", + "title": "CatalogService setDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "catalog_service.set_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "branch_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_GetDefaultBranch_async", + "title": "CatalogService getDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] method under a specified parent catalog. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "catalog_service.get_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.GetDefaultBranchResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "completion_service.complete_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 108, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing may be synchronous. Partial updating is not supported. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 150, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2.PredictionService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 122, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2.ProductService.DeleteProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_ImportProducts_async", + "title": "CatalogService importProducts Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "product_service.import_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 96, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2.ProductService.ImportProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.ProductInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2.ImportErrorsConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "reconciliation_mode", + "type": ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2.ProductService.ImportProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_SetInventory_async", + "title": "CatalogService setInventory Sample", + "origin": "API_DEFINITION", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.set_inventory.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 102, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_SearchService_Search_async", + "title": "CatalogService search Sample", + "origin": "API_DEFINITION", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "search_service.search.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 247, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2.SearchService.Search", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "branch", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "user_info", + "type": ".google.cloud.retail.v2.UserInfo" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "offset", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "canonical_filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "facet_specs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "dynamic_facet_spec", + "type": ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec" + }, + { + "name": "boost_spec", + "type": ".google.cloud.retail.v2.SearchRequest.BoostSpec" + }, + { + "name": "query_expansion_spec", + "type": ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec" + }, + { + "name": "variant_rollup_keys", + "type": "TYPE_STRING[]" + }, + { + "name": "page_categories", + "type": "TYPE_STRING[]" + }, + { + "name": "search_mode", + "type": ".google.cloud.retail.v2.SearchRequest.SearchMode" + } + ], + "resultType": ".google.cloud.retail.v2.SearchResponse", + "client": { + "shortName": "SearchServiceClient", + "fullName": "google.cloud.retail.v2.SearchServiceClient" + }, + "method": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2.SearchService.Search", + "service": { + "shortName": "SearchService", + "fullName": "google.cloud.retail.v2.SearchService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_UserEventService_WriteUserEvent_async", + "title": "CatalogService writeUserEvent Sample", + "origin": "API_DEFINITION", + "description": " Writes a single user event.", + "canonical": true, + "file": "user_event_service.write_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.WriteUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2.UserEvent" + } + ], + "resultType": ".google.cloud.retail.v2.UserEvent", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.WriteUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_UserEventService_CollectUserEvent_async", + "title": "CatalogService collectUserEvent Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.collect_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.CollectUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": "TYPE_STRING" + }, + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "ets", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.CollectUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_UserEventService_PurgeUserEvents_async", + "title": "CatalogService purgeUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.purge_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_UserEventService_ImportUserEvents_async", + "title": "CatalogService importUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.import_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.ImportUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.UserEventInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2.ImportErrorsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.ImportUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_UserEventService_RejoinUserEvents_async", + "title": "CatalogService rejoinUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.rejoin_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event_rejoin_scope", + "type": ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js index d419aed42f1..40992711843 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js index 1ab9e1496fc..fa18d38d26f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js index fada57566a6..0a008d5d05b 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js index dd1d9fa86e4..925f96b6700 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js index bf904b29e14..6df073a34b4 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js index 02a961ca3a8..075a2b10f5a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js index 7d8a9b4b294..2bed2f3ff7b 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js index 105fb5eac03..288a6dc9d4b 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js index d18159368fb..81ee698f731 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index 96b7daa2326..35881432233 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js index 74ad29468db..b54422e5b1c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js index 0b66302f5a1..a4105bf6a9b 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js index 2012a047e66..c15b5aa04f9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js index 7683142fb87..1a0bcb74263 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js index 59be17e94c5..d452aae491d 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js index cb3b87e506c..7470b33d5a5 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js index f28b5923834..5234024040c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index ee490d71471..6f3d4566bdf 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js index a9a0d7ea007..a9e1ed2f580 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js index 7d85e0cdd4b..9543acded96 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js index f67a0815c39..903fe7388f7 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index b3858e261a6..ea7b0435fbb 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js index 36d0038609a..db9b00e442a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index 044d5cd218a..f433adcde3c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json new file mode 100644 index 00000000000..ba90db93d2b --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -0,0 +1,1295 @@ +{ + "clientLibrary": { + "name": "nodejs-retail", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.retail.v2alpha", + "version": "v2alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "retail_v2alpha_generated_CatalogService_ListCatalogs_async", + "title": "CatalogService listCatalogs Sample", + "origin": "API_DEFINITION", + "description": " Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.", + "canonical": true, + "file": "catalog_service.list_catalogs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListCatalogsResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCatalog_async", + "title": "CatalogService updateCatalog Sample", + "origin": "API_DEFINITION", + "description": " Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.", + "canonical": true, + "file": "catalog_service.update_catalog.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": ".google.cloud.retail.v2alpha.Catalog" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Catalog", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_SetDefaultBranch_async", + "title": "CatalogService setDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "catalog_service.set_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "branch_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_GetDefaultBranch_async", + "title": "CatalogService getDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "catalog_service.get_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.GetDefaultBranchResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "completion_service.complete_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 109, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2alpha.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2alpha.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing may be synchronous. Partial updating is not supported. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2alpha.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2alpha.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 150, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2alpha.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2alpha.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2alpha.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2alpha.PredictionService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2alpha.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2alpha.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 133, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "require_total_size", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2alpha.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", + "title": "CatalogService importProducts Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s to be successfully updated.", + "canonical": true, + "file": "product_service.import_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 96, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2alpha.ProductInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "reconciliation_mode", + "type": ".google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", + "title": "CatalogService setInventory Sample", + "origin": "API_DEFINITION", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.set_inventory.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 102, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2alpha.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", + "title": "CatalogService addLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact Cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.add_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "local_inventories", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "add_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", + "title": "CatalogService removeLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact Cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.remove_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_SearchService_Search_async", + "title": "CatalogService search Sample", + "origin": "API_DEFINITION", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "search_service.search.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 274, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2alpha.SearchService.Search", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "branch", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "user_info", + "type": ".google.cloud.retail.v2alpha.UserInfo" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "offset", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "canonical_filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "facet_specs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "dynamic_facet_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec" + }, + { + "name": "boost_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.BoostSpec" + }, + { + "name": "query_expansion_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec" + }, + { + "name": "relevance_threshold", + "type": ".google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold" + }, + { + "name": "variant_rollup_keys", + "type": "TYPE_STRING[]" + }, + { + "name": "page_categories", + "type": "TYPE_STRING[]" + }, + { + "name": "search_mode", + "type": ".google.cloud.retail.v2alpha.SearchRequest.SearchMode" + } + ], + "resultType": ".google.cloud.retail.v2alpha.SearchResponse", + "client": { + "shortName": "SearchServiceClient", + "fullName": "google.cloud.retail.v2alpha.SearchServiceClient" + }, + "method": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2alpha.SearchService.Search", + "service": { + "shortName": "SearchService", + "fullName": "google.cloud.retail.v2alpha.SearchService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_UserEventService_WriteUserEvent_async", + "title": "CatalogService writeUserEvent Sample", + "origin": "API_DEFINITION", + "description": " Writes a single user event.", + "canonical": true, + "file": "user_event_service.write_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2alpha.UserEvent" + } + ], + "resultType": ".google.cloud.retail.v2alpha.UserEvent", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_UserEventService_CollectUserEvent_async", + "title": "CatalogService collectUserEvent Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.collect_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": "TYPE_STRING" + }, + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "ets", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_UserEventService_PurgeUserEvents_async", + "title": "CatalogService purgeUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.purge_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_UserEventService_ImportUserEvents_async", + "title": "CatalogService importUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.import_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2alpha.UserEventInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_UserEventService_RejoinUserEvents_async", + "title": "CatalogService rejoinUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.rejoin_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event_rejoin_scope", + "type": ".google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js index 930f51fc5bd..2c259bbf953 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js index 06b7559e630..733e1b2f6a6 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js index ecc1b6e0368..9d1d604c61f 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js index 8114ee822bf..e72b2378c20 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js index 15c086eded7..8742b9806bf 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js index 50d2b13b58b..11ab8856dc8 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js index 8d75723e386..a72872cb6b1 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js index 7322b000eb2..ea0695ceaf5 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js index 45e754b4054..3f75b996678 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index e1f2b9a3af7..3dc80166d9c 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js index c09b24b11d1..046aa015223 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index a3a8173aefd..cd878f44770 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js index 3701ea3f7af..f25e375ddc9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js index 18a4a77d0e4..b6387d2e22f 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js index cc9e2cc8a3c..95f4548f553 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js index 08b461617ae..d0520d7e9e5 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index 99d7812776b..f57e330bd80 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js index f3f720cc833..d4971483391 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js index 95eb55e64dd..3163edcb7fa 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js index d8de314294a..b7fb846e6e9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; @@ -54,8 +59,8 @@ function main(inventory) { // const inventory = {} /** * Indicates which inventory fields in the provided - * Product google.cloud.retail.v2beta.Product to update. If not set or set - * with empty paths, all inventory fields will be updated. + * Product google.cloud.retail.v2beta.Product to update. + * At least one field must be provided. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js index 06cb8b6586f..ed319228b47 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index 9ff5589ce95..d5b74ef8ab1 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; @@ -43,6 +48,8 @@ function main(placement, visitorId) { * 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 logs in or out of the website. + * This should be the same identifier as + * UserEvent.visitor_id google.cloud.retail.v2beta.UserEvent.visitor_id. * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. */ @@ -123,11 +130,12 @@ function main(placement, visitorId) { /** * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). - * Notice that if both ServingConfig.boost_control_ids and - * SearchRequest.boost_spec are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * Notice that if both + * ServingConfig.boost_control_ids google.cloud.retail.v2beta.ServingConfig.boost_control_ids + * and SearchRequest.boost_spec are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. */ // const boostSpec = {} /** @@ -139,14 +147,13 @@ function main(placement, visitorId) { /** * The keys to fetch and rollup the matching * variant google.cloud.retail.v2beta.Product.Type.VARIANT - * Product google.cloud.retail.v2beta.Product s attributes. The attributes - * from all the matching - * variant google.cloud.retail.v2beta.Product.Type.VARIANT - * Product google.cloud.retail.v2beta.Product s are merged and - * de-duplicated. Notice that rollup + * Product google.cloud.retail.v2beta.Product s attributes, + * FulfillmentInfo google.cloud.retail.v2beta.FulfillmentInfo or + * LocalInventory s attributes. The attributes from all the matching * variant google.cloud.retail.v2beta.Product.Type.VARIANT - * Product google.cloud.retail.v2beta.Product s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * Product google.cloud.retail.v2beta.Product s or LocalInventory s are + * merged and de-duplicated. Notice that rollup attributes will lead to extra + * query latency. Maximum number of keys is 30. * For FulfillmentInfo google.cloud.retail.v2beta.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", @@ -158,6 +165,7 @@ function main(placement, visitorId) { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * Product.inventories.attributes map. * * attributes.key, where key is any key in the diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json new file mode 100644 index 00000000000..732ea9469d3 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -0,0 +1,1179 @@ +{ + "clientLibrary": { + "name": "nodejs-retail", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.retail.v2beta", + "version": "v2beta" + } + ] + }, + "snippets": [ + { + "regionTag": "retail_v2beta_generated_CatalogService_ListCatalogs_async", + "title": "CatalogService listCatalogs Sample", + "origin": "API_DEFINITION", + "description": " Lists all the [Catalog][google.cloud.retail.v2beta.Catalog]s associated with the project.", + "canonical": true, + "file": "catalog_service.list_catalogs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2beta.CatalogService.ListCatalogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListCatalogsResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2beta.CatalogService.ListCatalogs", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_CatalogService_UpdateCatalog_async", + "title": "CatalogService updateCatalog Sample", + "origin": "API_DEFINITION", + "description": " Updates the [Catalog][google.cloud.retail.v2beta.Catalog]s.", + "canonical": true, + "file": "catalog_service.update_catalog.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCatalog", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": ".google.cloud.retail.v2beta.Catalog" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.Catalog", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCatalog", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_CatalogService_SetDefaultBranch_async", + "title": "CatalogService setDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "catalog_service.set_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.SetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "branch_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.SetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_CatalogService_GetDefaultBranch_async", + "title": "CatalogService getDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] method under a specified parent catalog. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "catalog_service.get_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.GetDefaultBranchResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "completion_service.complete_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 108, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2beta.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2beta.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing may be synchronous. Partial updating is not supported. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2beta.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 150, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2beta.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2beta.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2beta.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2beta.PredictionService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2beta.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 124, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_ImportProducts_async", + "title": "CatalogService importProducts Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2beta.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.v2beta.Product]s to be successfully updated.", + "canonical": true, + "file": "product_service.import_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 96, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ImportProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.ProductInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2beta.ImportErrorsConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "reconciliation_mode", + "type": ".google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ImportProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_SetInventory_async", + "title": "CatalogService setInventory Sample", + "origin": "API_DEFINITION", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.set_inventory.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 102, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_SearchService_Search_async", + "title": "CatalogService search Sample", + "origin": "API_DEFINITION", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "canonical": true, + "file": "search_service.search.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 252, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2beta.SearchService.Search", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "branch", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "user_info", + "type": ".google.cloud.retail.v2beta.UserInfo" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "offset", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "canonical_filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "facet_specs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "dynamic_facet_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec" + }, + { + "name": "boost_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.BoostSpec" + }, + { + "name": "query_expansion_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec" + }, + { + "name": "variant_rollup_keys", + "type": "TYPE_STRING[]" + }, + { + "name": "page_categories", + "type": "TYPE_STRING[]" + }, + { + "name": "search_mode", + "type": ".google.cloud.retail.v2beta.SearchRequest.SearchMode" + } + ], + "resultType": ".google.cloud.retail.v2beta.SearchResponse", + "client": { + "shortName": "SearchServiceClient", + "fullName": "google.cloud.retail.v2beta.SearchServiceClient" + }, + "method": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2beta.SearchService.Search", + "service": { + "shortName": "SearchService", + "fullName": "google.cloud.retail.v2beta.SearchService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_UserEventService_WriteUserEvent_async", + "title": "CatalogService writeUserEvent Sample", + "origin": "API_DEFINITION", + "description": " Writes a single user event.", + "canonical": true, + "file": "user_event_service.write_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.WriteUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2beta.UserEvent" + } + ], + "resultType": ".google.cloud.retail.v2beta.UserEvent", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.WriteUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_UserEventService_CollectUserEvent_async", + "title": "CatalogService collectUserEvent Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.collect_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.CollectUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": "TYPE_STRING" + }, + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "ets", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.CollectUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_UserEventService_PurgeUserEvents_async", + "title": "CatalogService purgeUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.purge_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.PurgeUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.PurgeUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_UserEventService_ImportUserEvents_async", + "title": "CatalogService importUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.import_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.ImportUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.UserEventInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2beta.ImportErrorsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.ImportUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_UserEventService_RejoinUserEvents_async", + "title": "CatalogService rejoinUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.rejoin_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.RejoinUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event_rejoin_scope", + "type": ".google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.RejoinUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js index 9bb64cfbc32..933ec59d13c 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js index 038c2205176..842e14dd3f5 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js index afd6b27c011..059d6944a45 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js index e3c9cfbf810..aebf64dcae9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js index 363c3ec27e0..da53a1423e0 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 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 +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 7ceb236c6e3..74a0fc48d76 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -1132,9 +1132,8 @@ export class CatalogServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.catalogServiceStub!.then(stub => { + if (this.catalogServiceStub && !this._terminated) { + return this.catalogServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index c0ef2336174..365893fa40f 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -777,9 +777,8 @@ export class CompletionServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.completionServiceStub!.then(stub => { + if (this.completionServiceStub && !this._terminated) { + return this.completionServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index aa9fc02d2e1..5f81bbc6219 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -615,9 +615,8 @@ export class PredictionServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.predictionServiceStub!.then(stub => { + if (this.predictionServiceStub && !this._terminated) { + return this.predictionServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 3724cb283da..741291525ae 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -2210,9 +2210,8 @@ export class ProductServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.productServiceStub!.then(stub => { + if (this.productServiceStub && !this._terminated) { + return this.productServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 4352de1ee1a..e676995b5bc 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -1234,9 +1234,8 @@ export class SearchServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.searchServiceStub!.then(stub => { + if (this.searchServiceStub && !this._terminated) { + return this.searchServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 549b370b818..cb78d27b192 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -1155,9 +1155,8 @@ export class UserEventServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.userEventServiceStub!.then(stub => { + if (this.userEventServiceStub && !this._terminated) { + return this.userEventServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 658ad04a489..051ed95de95 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -1156,9 +1156,8 @@ export class CatalogServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.catalogServiceStub!.then(stub => { + if (this.catalogServiceStub && !this._terminated) { + return this.catalogServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 5522dfcd564..0e387d057f9 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -784,9 +784,8 @@ export class CompletionServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.completionServiceStub!.then(stub => { + if (this.completionServiceStub && !this._terminated) { + return this.completionServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index ae7eb5fd19c..0f563f287b0 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -615,9 +615,8 @@ export class PredictionServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.predictionServiceStub!.then(stub => { + if (this.predictionServiceStub && !this._terminated) { + return this.predictionServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index ac1b2786bc3..2806ae36306 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -2673,9 +2673,8 @@ export class ProductServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.productServiceStub!.then(stub => { + if (this.productServiceStub && !this._terminated) { + return this.productServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 7c9930018ab..d329cb4a810 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -1315,9 +1315,8 @@ export class SearchServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.searchServiceStub!.then(stub => { + if (this.searchServiceStub && !this._terminated) { + return this.searchServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index f46ba91e496..b14372d79be 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -1168,9 +1168,8 @@ export class UserEventServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.userEventServiceStub!.then(stub => { + if (this.userEventServiceStub && !this._terminated) { + return this.userEventServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 4082bf1f4bc..5c244a23ca2 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -1156,9 +1156,8 @@ export class CatalogServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.catalogServiceStub!.then(stub => { + if (this.catalogServiceStub && !this._terminated) { + return this.catalogServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 6603baf2dad..c4c1acb2f00 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -783,9 +783,8 @@ export class CompletionServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.completionServiceStub!.then(stub => { + if (this.completionServiceStub && !this._terminated) { + return this.completionServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 01129b50d33..a89b187a973 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -615,9 +615,8 @@ export class PredictionServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.predictionServiceStub!.then(stub => { + if (this.predictionServiceStub && !this._terminated) { + return this.predictionServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 9cb73ce1df1..aa5f24129f2 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -1087,8 +1087,9 @@ export class ProductServiceClient { * needed, {@link |UpdateProduct} should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided - * {@link google.cloud.retail.v2beta.Product|Product} to update. If not set or set - * with empty paths, all inventory fields will be updated. + * {@link google.cloud.retail.v2beta.Product|Product} to update. + * + * At least one field must be provided. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. @@ -2244,9 +2245,8 @@ export class ProductServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.productServiceStub!.then(stub => { + if (this.productServiceStub && !this._terminated) { + return this.productServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index e8f1a53ef10..d48e22859a0 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -350,6 +350,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2beta.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2beta.UserInfo} request.userInfo @@ -419,11 +422,12 @@ export class SearchServiceClient { * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). * - * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * Notice that if both + * {@link google.cloud.retail.v2beta.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -431,14 +435,13 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s attributes. The attributes - * from all the matching - * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s are merged and - * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2beta.Product|Product}s attributes, + * {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo} or + * {@link |LocalInventory}s attributes. The attributes from all the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2beta.Product|Product}s or {@link |LocalInventory}s are + * merged and de-duplicated. Notice that rollup attributes will lead to extra + * query latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -453,6 +456,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -615,6 +619,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2beta.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2beta.UserInfo} request.userInfo @@ -684,11 +691,12 @@ export class SearchServiceClient { * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). * - * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * Notice that if both + * {@link google.cloud.retail.v2beta.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -696,14 +704,13 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s attributes. The attributes - * from all the matching - * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s are merged and - * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2beta.Product|Product}s attributes, + * {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo} or + * {@link |LocalInventory}s attributes. The attributes from all the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2beta.Product|Product}s or {@link |LocalInventory}s are + * merged and de-duplicated. Notice that rollup attributes will lead to extra + * query latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -718,6 +725,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -836,6 +844,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2beta.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2beta.UserInfo} request.userInfo @@ -905,11 +916,12 @@ export class SearchServiceClient { * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). * - * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * Notice that if both + * {@link google.cloud.retail.v2beta.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and [SearchRequest.boost_spec] are set, the boost conditions from both + * places are evaluated. If a search request matches multiple boost + * conditions, the final boost score is equal to the sum of the boost scores + * from all matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -917,14 +929,13 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s attributes. The attributes - * from all the matching - * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s are merged and - * de-duplicated. Notice that rollup + * {@link google.cloud.retail.v2beta.Product|Product}s attributes, + * {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo} or + * {@link |LocalInventory}s attributes. The attributes from all the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s attributes will lead to - * extra query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2beta.Product|Product}s or {@link |LocalInventory}s are + * merged and de-duplicated. Notice that rollup attributes will lead to extra + * query latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -939,6 +950,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -1240,9 +1252,8 @@ export class SearchServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.searchServiceStub!.then(stub => { + if (this.searchServiceStub && !this._terminated) { + return this.searchServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index c89416c92f5..b927ad9af4e 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -1168,9 +1168,8 @@ export class UserEventServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.userEventServiceStub!.then(stub => { + if (this.userEventServiceStub && !this._terminated) { + return this.userEventServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index 582e6e6df15..9979bd3fda6 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -153,12 +153,27 @@ describe('v2.CatalogServiceClient', () => { assert(client.catalogServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new catalogserviceModule.v2.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.catalogServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -307,6 +322,23 @@ describe('v2.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateCatalog with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCatalog(request), expectedError); + }); }); describe('setDefaultBranch', () => { @@ -418,6 +450,22 @@ describe('v2.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes setDefaultBranch with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setDefaultBranch(request), expectedError); + }); }); describe('getDefaultBranch', () => { @@ -529,6 +577,22 @@ describe('v2.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getDefaultBranch with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDefaultBranch(request), expectedError); + }); }); describe('listCatalogs', () => { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 374e9e18a43..41de9cdeff3 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -153,12 +153,27 @@ describe('v2alpha.CatalogServiceClient', () => { assert(client.catalogServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.catalogServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -307,6 +322,23 @@ describe('v2alpha.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateCatalog with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCatalog(request), expectedError); + }); }); describe('setDefaultBranch', () => { @@ -418,6 +450,22 @@ describe('v2alpha.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes setDefaultBranch with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setDefaultBranch(request), expectedError); + }); }); describe('getDefaultBranch', () => { @@ -529,6 +577,22 @@ describe('v2alpha.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getDefaultBranch with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDefaultBranch(request), expectedError); + }); }); describe('listCatalogs', () => { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 630efa9fa1b..93134fb70e7 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -153,12 +153,27 @@ describe('v2beta.CatalogServiceClient', () => { assert(client.catalogServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.catalogServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -307,6 +322,23 @@ describe('v2beta.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateCatalog with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() + ); + request.catalog = {}; + request.catalog.name = ''; + const expectedHeaderRequestParams = 'catalog.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCatalog(request), expectedError); + }); }); describe('setDefaultBranch', () => { @@ -418,6 +450,22 @@ describe('v2beta.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes setDefaultBranch with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setDefaultBranch(request), expectedError); + }); }); describe('getDefaultBranch', () => { @@ -529,6 +577,22 @@ describe('v2beta.CatalogServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getDefaultBranch with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDefaultBranch(request), expectedError); + }); }); describe('listCatalogs', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index 17e5c1275f6..1a2780ede7a 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -122,12 +122,27 @@ describe('v2.CompletionServiceClient', () => { assert(client.completionServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new completionserviceModule.v2.CompletionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.completionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -273,6 +288,22 @@ describe('v2.CompletionServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes completeQuery with closed client', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeQuery(request), expectedError); + }); }); describe('importCompletionData', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index 1262558bb16..33c9c6c55c0 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -123,12 +123,27 @@ describe('v2alpha.CompletionServiceClient', () => { assert(client.completionServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new completionserviceModule.v2alpha.CompletionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.completionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -277,6 +292,23 @@ describe('v2alpha.CompletionServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes completeQuery with closed client', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeQuery(request), expectedError); + }); }); describe('importCompletionData', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index 6f72dda218c..6089c17536f 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -122,12 +122,27 @@ describe('v2beta.CompletionServiceClient', () => { assert(client.completionServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new completionserviceModule.v2beta.CompletionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.completionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new completionserviceModule.v2beta.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -279,6 +294,24 @@ describe('v2beta.CompletionServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes completeQuery with closed client', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompleteQueryRequest() + ); + request.catalog = ''; + const expectedHeaderRequestParams = 'catalog='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeQuery(request), expectedError); + }); }); describe('importCompletionData', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 40cd065044d..fbcc6897b1b 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -90,12 +90,27 @@ describe('v2.PredictionServiceClient', () => { assert(client.predictionServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new predictionserviceModule.v2.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.predictionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -238,6 +253,22 @@ describe('v2.PredictionServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes predict with closed client', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.predict(request), expectedError); + }); }); describe('Path templates', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index 59b633b6217..6e700f7ba38 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -91,12 +91,27 @@ describe('v2alpha.PredictionServiceClient', () => { assert(client.predictionServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.predictionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -242,6 +257,23 @@ describe('v2alpha.PredictionServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes predict with closed client', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.predict(request), expectedError); + }); }); describe('Path templates', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index 121f9424ec7..6ff717d5b4d 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -90,12 +90,27 @@ describe('v2beta.PredictionServiceClient', () => { assert(client.predictionServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new predictionserviceModule.v2beta.PredictionServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.predictionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -244,6 +259,24 @@ describe('v2beta.PredictionServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes predict with closed client', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PredictRequest() + ); + request.placement = ''; + const expectedHeaderRequestParams = 'placement='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.predict(request), expectedError); + }); }); describe('Path templates', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index cfdc6106b9e..546d55048ef 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -185,12 +185,27 @@ describe('v2.ProductServiceClient', () => { assert(client.productServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new productserviceModule.v2.ProductServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.productServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -336,6 +351,22 @@ describe('v2.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createProduct with closed client', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProduct(request), expectedError); + }); }); describe('getProduct', () => { @@ -447,6 +478,22 @@ describe('v2.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getProduct with closed client', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProduct(request), expectedError); + }); }); describe('updateProduct', () => { @@ -561,6 +608,23 @@ describe('v2.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateProduct with closed client', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateProduct(request), expectedError); + }); }); describe('deleteProduct', () => { @@ -672,6 +736,22 @@ describe('v2.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteProduct with closed client', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteProduct(request), expectedError); + }); }); describe('importProducts', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index fda30691e5e..65f39f083ec 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -185,12 +185,27 @@ describe('v2alpha.ProductServiceClient', () => { assert(client.productServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new productserviceModule.v2alpha.ProductServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.productServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -336,6 +351,22 @@ describe('v2alpha.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createProduct with closed client', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProduct(request), expectedError); + }); }); describe('getProduct', () => { @@ -447,6 +478,22 @@ describe('v2alpha.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getProduct with closed client', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProduct(request), expectedError); + }); }); describe('updateProduct', () => { @@ -561,6 +608,23 @@ describe('v2alpha.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateProduct with closed client', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateProduct(request), expectedError); + }); }); describe('deleteProduct', () => { @@ -672,6 +736,22 @@ describe('v2alpha.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteProduct with closed client', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteProduct(request), expectedError); + }); }); describe('importProducts', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 4fd231802e6..b446625d2b2 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -185,12 +185,27 @@ describe('v2beta.ProductServiceClient', () => { assert(client.productServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new productserviceModule.v2beta.ProductServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.productServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -336,6 +351,22 @@ describe('v2beta.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createProduct with closed client', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateProductRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProduct(request), expectedError); + }); }); describe('getProduct', () => { @@ -447,6 +478,22 @@ describe('v2beta.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getProduct with closed client', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProduct(request), expectedError); + }); }); describe('updateProduct', () => { @@ -561,6 +608,23 @@ describe('v2beta.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateProduct with closed client', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateProductRequest() + ); + request.product = {}; + request.product.name = ''; + const expectedHeaderRequestParams = 'product.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateProduct(request), expectedError); + }); }); describe('deleteProduct', () => { @@ -672,6 +736,22 @@ describe('v2beta.ProductServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteProduct with closed client', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteProductRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteProduct(request), expectedError); + }); }); describe('importProducts', () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index 1e632056031..dd4830b5759 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -151,12 +151,27 @@ describe('v2.SearchServiceClient', () => { assert(client.searchServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new searchserviceModule.v2.SearchServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.searchServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index f56fbf1da7f..cc14a9e1427 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -153,12 +153,27 @@ describe('v2alpha.SearchServiceClient', () => { assert(client.searchServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new searchserviceModule.v2alpha.SearchServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.searchServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index 0e2db3f4341..b325ad1e2de 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -153,12 +153,27 @@ describe('v2beta.SearchServiceClient', () => { assert(client.searchServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new searchserviceModule.v2beta.SearchServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.searchServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index 0e090b06fd8..334b20da5a2 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -122,12 +122,27 @@ describe('v2.UserEventServiceClient', () => { assert(client.userEventServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new usereventserviceModule.v2.UserEventServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.userEventServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -273,6 +288,22 @@ describe('v2.UserEventServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes writeUserEvent with closed client', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.writeUserEvent(request), expectedError); + }); }); describe('collectUserEvent', () => { @@ -381,6 +412,22 @@ describe('v2.UserEventServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes collectUserEvent with closed client', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.collectUserEvent(request), expectedError); + }); }); describe('purgeUserEvents', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index 7437fdcc4c5..ac0e91e270d 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -122,12 +122,27 @@ describe('v2alpha.UserEventServiceClient', () => { assert(client.userEventServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.userEventServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -273,6 +288,22 @@ describe('v2alpha.UserEventServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes writeUserEvent with closed client', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.writeUserEvent(request), expectedError); + }); }); describe('collectUserEvent', () => { @@ -381,6 +412,22 @@ describe('v2alpha.UserEventServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes collectUserEvent with closed client', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.collectUserEvent(request), expectedError); + }); }); describe('purgeUserEvents', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index 3ac156f753e..fd1a2966fb2 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -122,12 +122,27 @@ describe('v2beta.UserEventServiceClient', () => { assert(client.userEventServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new usereventserviceModule.v2beta.UserEventServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.userEventServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -273,6 +288,22 @@ describe('v2beta.UserEventServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes writeUserEvent with closed client', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.WriteUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.writeUserEvent(request), expectedError); + }); }); describe('collectUserEvent', () => { @@ -381,6 +412,22 @@ describe('v2beta.UserEventServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes collectUserEvent with closed client', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CollectUserEventRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.collectUserEvent(request), expectedError); + }); }); describe('purgeUserEvents', () => { From 2093cf5f8c6f1745b35df8a3fabf1917fd231ca6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 09:49:47 -0800 Subject: [PATCH 070/103] chore: remove unused imports in google/cloud/retail/v2 (#154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: remove unused imports in google/cloud/retail/v2 PiperOrigin-RevId: 431915215 Source-Link: https://github.com/googleapis/googleapis/commit/d4f3468ef85278428005ed555b3a85db91551ee6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8107661b7121ed0caf259d3492c4e520cdbf8287 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODEwNzY2MWI3MTIxZWQwY2FmMjU5ZDM0OTJjNGU1MjBjZGJmODI4NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/retail/v2/catalog.proto | 3 - .../google/cloud/retail/v2/common.proto | 1 - .../cloud/retail/v2/import_config.proto | 1 - .../google/cloud/retail/v2/product.proto | 1 - .../cloud/retail/v2/product_service.proto | 2 - .../google/cloud/retail/v2/purge_config.proto | 1 - .../cloud/retail/v2/search_service.proto | 2 - .../google/cloud/retail/v2/user_event.proto | 1 - .../google-cloud-retail/protos/protos.d.ts | 6014 +++--- packages/google-cloud-retail/protos/protos.js | 17352 ++++++++-------- .../google-cloud-retail/protos/protos.json | 926 +- 11 files changed, 12146 insertions(+), 12158 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto index e9405807513..b5de698d9c4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto @@ -16,11 +16,8 @@ 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/cloud/retail/v2/import_config.proto"; option csharp_namespace = "Google.Cloud.Retail.V2"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 440a6af3986..9f0e1fc16f1 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index 977e9e97963..770a93eadb6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -16,7 +16,6 @@ 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/product.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 4d8f10a74ab..3bec3b06cd1 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -16,7 +16,6 @@ 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"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index b285eb4a29c..ca157d896d5 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -20,10 +20,8 @@ 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/common.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"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto index 6c8ce100fcd..b87d3177436 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto @@ -16,7 +16,6 @@ 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"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 5e5135f11de..8bd231332f8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -24,8 +24,6 @@ import "google/cloud/retail/v2/common.proto"; import "google/cloud/retail/v2/product.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.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"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto index a1f7f217fd3..c0023cf2d03 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto @@ -16,7 +16,6 @@ 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"; diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index ead42a10a1c..87780c6ce97 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -224,4788 +224,4788 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of an Audience. */ - interface IAudience { + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { - /** Audience genders */ - genders?: (string[]|null); + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** Audience ageGroups */ - ageGroups?: (string[]|null); + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback): void; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise + */ + public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest): Promise; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + */ + public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback): void; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise + */ + public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest): Promise; } - /** Represents an Audience. */ - class Audience implements IAudience { + namespace CatalogService { /** - * Constructs a new Audience. + * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2.GetDefaultBranchResponse) => void; + } + + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { + + /** + * Constructs a new ListCatalogsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IAudience); + constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); - /** Audience genders. */ - public genders: string[]; + /** ListCatalogsRequest parent. */ + public parent: string; - /** Audience ageGroups. */ - public ageGroups: string[]; + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; /** - * Creates a new Audience instance using the specified properties. + * Creates a new ListCatalogsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Audience instance + * @returns ListCatalogsRequest instance */ - public static create(properties?: google.cloud.retail.v2.IAudience): google.cloud.retail.v2.Audience; + public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Audience message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Audience + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Audience; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; /** - * Decodes an Audience message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Audience + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Audience; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; /** - * Verifies an Audience message. + * Verifies a ListCatalogsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Audience + * @returns ListCatalogsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Audience; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @param message Audience + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Audience to JSON. + * Converts this ListCatalogsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ColorInfo. */ - interface IColorInfo { + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { - /** ColorInfo colorFamilies */ - colorFamilies?: (string[]|null); + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2.ICatalog[]|null); - /** ColorInfo colors */ - colors?: (string[]|null); + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { /** - * Constructs a new ColorInfo. + * Constructs a new ListCatalogsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IColorInfo); + constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); - /** ColorInfo colorFamilies. */ - public colorFamilies: string[]; + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2.ICatalog[]; - /** ColorInfo colors. */ - public colors: string[]; + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ColorInfo instance + * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2.IColorInfo): google.cloud.retail.v2.ColorInfo; + public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ColorInfo + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ColorInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ColorInfo + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ColorInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; /** - * Verifies a ColorInfo message. + * Verifies a ListCatalogsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ColorInfo + * @returns ListCatalogsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ColorInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @param message ColorInfo + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ColorInfo to JSON. + * Converts this ListCatalogsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { - - /** CustomAttribute text */ - text?: (string[]|null); - - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { - /** CustomAttribute searchable */ - searchable?: (boolean|null); + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2.ICatalog|null); - /** CustomAttribute indexable */ - indexable?: (boolean|null); + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { /** - * Constructs a new CustomAttribute. + * Constructs a new UpdateCatalogRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICustomAttribute); - - /** CustomAttribute text. */ - public text: string[]; - - /** CustomAttribute numbers. */ - public numbers: number[]; - - /** CustomAttribute searchable. */ - public searchable?: (boolean|null); - - /** CustomAttribute indexable. */ - public indexable?: (boolean|null); + constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); - /** CustomAttribute _searchable. */ - public _searchable?: "searchable"; + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2.ICatalog|null); - /** CustomAttribute _indexable. */ - public _indexable?: "indexable"; + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns UpdateCatalogRequest instance */ - public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; + public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Verifies a CustomAttribute message. + * Verifies an UpdateCatalogRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns UpdateCatalogRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this UpdateCatalogRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FulfillmentInfo. */ - interface IFulfillmentInfo { + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { - /** FulfillmentInfo type */ - type?: (string|null); + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); - /** FulfillmentInfo placeIds */ - placeIds?: (string[]|null); + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); + + /** SetDefaultBranchRequest note */ + note?: (string|null); } - /** Represents a FulfillmentInfo. */ - class FulfillmentInfo implements IFulfillmentInfo { + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { /** - * Constructs a new FulfillmentInfo. + * Constructs a new SetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IFulfillmentInfo); + constructor(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest); - /** FulfillmentInfo type. */ - public type: string; + /** SetDefaultBranchRequest catalog. */ + public catalog: string; - /** FulfillmentInfo placeIds. */ - public placeIds: string[]; + /** SetDefaultBranchRequest branchId. */ + public branchId: string; + + /** SetDefaultBranchRequest note. */ + public note: string; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns FulfillmentInfo instance + * @returns SetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2.IFulfillmentInfo): google.cloud.retail.v2.FulfillmentInfo; + public static create(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FulfillmentInfo + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.FulfillmentInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FulfillmentInfo + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.FulfillmentInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Verifies a FulfillmentInfo message. + * Verifies a SetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FulfillmentInfo + * @returns SetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.FulfillmentInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. - * @param message FulfillmentInfo + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Image. */ - interface IImage { - - /** Image uri */ - uri?: (string|null); - - /** Image height */ - height?: (number|null); + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { - /** Image width */ - width?: (number|null); + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); } - /** Represents an Image. */ - class Image implements IImage { + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { /** - * Constructs a new Image. + * Constructs a new GetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImage); - - /** Image uri. */ - public uri: string; - - /** Image height. */ - public height: number; + constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest); - /** Image width. */ - public width: number; + /** GetDefaultBranchRequest catalog. */ + public catalog: string; /** - * Creates a new Image instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns GetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImage): google.cloud.retail.v2.Image; + public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Verifies an Image message. + * Verifies a GetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns GetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Interval. */ - interface IInterval { - - /** Interval minimum */ - minimum?: (number|null); + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { - /** Interval exclusiveMinimum */ - exclusiveMinimum?: (number|null); + /** GetDefaultBranchResponse branch */ + branch?: (string|null); - /** Interval maximum */ - maximum?: (number|null); + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); - /** Interval exclusiveMaximum */ - exclusiveMaximum?: (number|null); + /** GetDefaultBranchResponse note */ + note?: (string|null); } - /** Represents an Interval. */ - class Interval implements IInterval { + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { /** - * Constructs a new Interval. + * Constructs a new GetDefaultBranchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IInterval); - - /** Interval minimum. */ - public minimum?: (number|null); - - /** Interval exclusiveMinimum. */ - public exclusiveMinimum?: (number|null); - - /** Interval maximum. */ - public maximum?: (number|null); + constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse); - /** Interval exclusiveMaximum. */ - public exclusiveMaximum?: (number|null); + /** GetDefaultBranchResponse branch. */ + public branch: string; - /** Interval min. */ - public min?: ("minimum"|"exclusiveMinimum"); + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); - /** Interval max. */ - public max?: ("maximum"|"exclusiveMaximum"); + /** GetDefaultBranchResponse note. */ + public note: string; /** - * Creates a new Interval instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Interval instance + * @returns GetDefaultBranchResponse instance */ - public static create(properties?: google.cloud.retail.v2.IInterval): google.cloud.retail.v2.Interval; + public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Interval + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Interval; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Interval + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Interval; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Verifies an Interval message. + * Verifies a GetDefaultBranchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Interval + * @returns GetDefaultBranchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Interval; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @param message Interval + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Interval to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PriceInfo. */ - interface IPriceInfo { - - /** PriceInfo currencyCode */ - currencyCode?: (string|null); - - /** PriceInfo price */ - price?: (number|null); - - /** PriceInfo originalPrice */ - originalPrice?: (number|null); - - /** PriceInfo cost */ - cost?: (number|null); - - /** PriceInfo priceEffectiveTime */ - priceEffectiveTime?: (google.protobuf.ITimestamp|null); + /** Properties of an Audience. */ + interface IAudience { - /** PriceInfo priceExpireTime */ - priceExpireTime?: (google.protobuf.ITimestamp|null); + /** Audience genders */ + genders?: (string[]|null); - /** PriceInfo priceRange */ - priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + /** Audience ageGroups */ + ageGroups?: (string[]|null); } - /** Represents a PriceInfo. */ - class PriceInfo implements IPriceInfo { + /** Represents an Audience. */ + class Audience implements IAudience { /** - * Constructs a new PriceInfo. + * Constructs a new Audience. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPriceInfo); - - /** PriceInfo currencyCode. */ - public currencyCode: string; - - /** PriceInfo price. */ - public price: number; - - /** PriceInfo originalPrice. */ - public originalPrice: number; - - /** PriceInfo cost. */ - public cost: number; - - /** PriceInfo priceEffectiveTime. */ - public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + constructor(properties?: google.cloud.retail.v2.IAudience); - /** PriceInfo priceExpireTime. */ - public priceExpireTime?: (google.protobuf.ITimestamp|null); + /** Audience genders. */ + public genders: string[]; - /** PriceInfo priceRange. */ - public priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + /** Audience ageGroups. */ + public ageGroups: string[]; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @param [properties] Properties to set - * @returns PriceInfo instance + * @returns Audience instance */ - public static create(properties?: google.cloud.retail.v2.IPriceInfo): google.cloud.retail.v2.PriceInfo; + public static create(properties?: google.cloud.retail.v2.IAudience): google.cloud.retail.v2.Audience; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceInfo + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Audience; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceInfo + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Audience; /** - * Verifies a PriceInfo message. + * Verifies an Audience message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceInfo + * @returns Audience */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Audience; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @param message PriceInfo + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceInfo to JSON. + * Converts this Audience to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PriceInfo { - - /** Properties of a PriceRange. */ - interface IPriceRange { - - /** PriceRange price */ - price?: (google.cloud.retail.v2.IInterval|null); - - /** PriceRange originalPrice */ - originalPrice?: (google.cloud.retail.v2.IInterval|null); - } - - /** Represents a PriceRange. */ - class PriceRange implements IPriceRange { - - /** - * Constructs a new PriceRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange); - - /** PriceRange price. */ - public price?: (google.cloud.retail.v2.IInterval|null); - - /** PriceRange originalPrice. */ - public originalPrice?: (google.cloud.retail.v2.IInterval|null); - - /** - * Creates a new PriceRange instance using the specified properties. - * @param [properties] Properties to set - * @returns PriceRange instance - */ - public static create(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PriceRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Verifies a PriceRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PriceRange - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @param message PriceRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PriceRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } - - /** Properties of a Rating. */ - interface IRating { - - /** Rating ratingCount */ - ratingCount?: (number|null); + /** Properties of a ColorInfo. */ + interface IColorInfo { - /** Rating averageRating */ - averageRating?: (number|null); + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); - /** Rating ratingHistogram */ - ratingHistogram?: (number[]|null); + /** ColorInfo colors */ + colors?: (string[]|null); } - /** Represents a Rating. */ - class Rating implements IRating { + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { /** - * Constructs a new Rating. + * Constructs a new ColorInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRating); - - /** Rating ratingCount. */ - public ratingCount: number; + constructor(properties?: google.cloud.retail.v2.IColorInfo); - /** Rating averageRating. */ - public averageRating: number; + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; - /** Rating ratingHistogram. */ - public ratingHistogram: number[]; + /** ColorInfo colors. */ + public colors: string[]; /** - * Creates a new Rating instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @param [properties] Properties to set - * @returns Rating instance + * @returns ColorInfo instance */ - public static create(properties?: google.cloud.retail.v2.IRating): google.cloud.retail.v2.Rating; + public static create(properties?: google.cloud.retail.v2.IColorInfo): google.cloud.retail.v2.ColorInfo; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rating + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rating; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ColorInfo; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rating + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rating; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ColorInfo; /** - * Verifies a Rating message. + * Verifies a ColorInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rating + * @returns ColorInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rating; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ColorInfo; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. - * @param message Rating + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rating to JSON. + * Converts this ColorInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserInfo. */ - interface IUserInfo { + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { - /** UserInfo userId */ - userId?: (string|null); + /** CustomAttribute text */ + text?: (string[]|null); - /** UserInfo ipAddress */ - ipAddress?: (string|null); + /** CustomAttribute numbers */ + numbers?: (number[]|null); - /** UserInfo userAgent */ - userAgent?: (string|null); + /** CustomAttribute searchable */ + searchable?: (boolean|null); - /** UserInfo directUserRequest */ - directUserRequest?: (boolean|null); + /** CustomAttribute indexable */ + indexable?: (boolean|null); } - /** Represents a UserInfo. */ - class UserInfo implements IUserInfo { + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { /** - * Constructs a new UserInfo. + * Constructs a new CustomAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserInfo); + constructor(properties?: google.cloud.retail.v2.ICustomAttribute); - /** UserInfo userId. */ - public userId: string; + /** CustomAttribute text. */ + public text: string[]; - /** UserInfo ipAddress. */ - public ipAddress: string; + /** CustomAttribute numbers. */ + public numbers: number[]; - /** UserInfo userAgent. */ - public userAgent: string; + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); - /** UserInfo directUserRequest. */ - public directUserRequest: boolean; + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new CustomAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns UserInfo instance + * @returns CustomAttribute instance */ - public static create(properties?: google.cloud.retail.v2.IUserInfo): google.cloud.retail.v2.UserInfo; + public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserInfo + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserInfo + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; /** - * Verifies a UserInfo message. + * Verifies a CustomAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserInfo + * @returns CustomAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. - * @param message UserInfo + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserInfo to JSON. + * Converts this CustomAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Promotion. */ - interface IPromotion { + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { - /** Promotion promotionId */ - promotionId?: (string|null); + /** FulfillmentInfo type */ + type?: (string|null); + + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); } - /** Represents a Promotion. */ - class Promotion implements IPromotion { + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { /** - * Constructs a new Promotion. + * Constructs a new FulfillmentInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPromotion); + constructor(properties?: google.cloud.retail.v2.IFulfillmentInfo); - /** Promotion promotionId. */ - public promotionId: string; + /** FulfillmentInfo type. */ + public type: string; + + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; /** - * Creates a new Promotion instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @param [properties] Properties to set - * @returns Promotion instance + * @returns FulfillmentInfo instance */ - public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; + public static create(properties?: google.cloud.retail.v2.IFulfillmentInfo): google.cloud.retail.v2.FulfillmentInfo; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Promotion + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.FulfillmentInfo; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Promotion + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.FulfillmentInfo; /** - * Verifies a Promotion message. + * Verifies a FulfillmentInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Promotion + * @returns FulfillmentInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.FulfillmentInfo; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. - * @param message Promotion + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Promotion to JSON. + * Converts this FulfillmentInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { + /** Properties of an Image. */ + interface IImage { - /** GcsSource inputUris */ - inputUris?: (string[]|null); + /** Image uri */ + uri?: (string|null); - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents an Image. */ + class Image implements IImage { /** - * Constructs a new GcsSource. + * Constructs a new Image. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGcsSource); + constructor(properties?: google.cloud.retail.v2.IImage); - /** GcsSource inputUris. */ - public inputUris: string[]; + /** Image uri. */ + public uri: string; - /** GcsSource dataSchema. */ - public dataSchema: string; + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new Image instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns Image instance */ - public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; + public static create(properties?: google.cloud.retail.v2.IImage): google.cloud.retail.v2.Image; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Image; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Image; /** - * Verifies a GcsSource message. + * Verifies an Image message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns Image */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Image; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this Image to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { - - /** BigQuerySource partitionDate */ - partitionDate?: (google.type.IDate|null); - - /** BigQuerySource projectId */ - projectId?: (string|null); + /** Properties of an Interval. */ + interface IInterval { - /** BigQuerySource datasetId */ - datasetId?: (string|null); + /** Interval minimum */ + minimum?: (number|null); - /** BigQuerySource tableId */ - tableId?: (string|null); + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); - /** BigQuerySource gcsStagingDir */ - gcsStagingDir?: (string|null); + /** Interval maximum */ + maximum?: (number|null); - /** BigQuerySource dataSchema */ - dataSchema?: (string|null); + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); } - /** Represents a BigQuerySource. */ - class BigQuerySource implements IBigQuerySource { + /** Represents an Interval. */ + class Interval implements IInterval { /** - * Constructs a new BigQuerySource. + * Constructs a new Interval. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IBigQuerySource); - - /** BigQuerySource partitionDate. */ - public partitionDate?: (google.type.IDate|null); + constructor(properties?: google.cloud.retail.v2.IInterval); - /** BigQuerySource projectId. */ - public projectId: string; + /** Interval minimum. */ + public minimum?: (number|null); - /** BigQuerySource datasetId. */ - public datasetId: string; + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); - /** BigQuerySource tableId. */ - public tableId: string; + /** Interval maximum. */ + public maximum?: (number|null); - /** BigQuerySource gcsStagingDir. */ - public gcsStagingDir: string; + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); - /** BigQuerySource dataSchema. */ - public dataSchema: string; + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); - /** BigQuerySource partition. */ - public partition?: "partitionDate"; + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new Interval instance using the specified properties. * @param [properties] Properties to set - * @returns BigQuerySource instance + * @returns Interval instance */ - public static create(properties?: google.cloud.retail.v2.IBigQuerySource): google.cloud.retail.v2.BigQuerySource; + public static create(properties?: google.cloud.retail.v2.IInterval): google.cloud.retail.v2.Interval; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BigQuerySource + * @returns Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.BigQuerySource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Interval; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BigQuerySource + * @returns Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.BigQuerySource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Interval; /** - * Verifies a BigQuerySource message. + * Verifies an Interval message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BigQuerySource + * @returns Interval */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.BigQuerySource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Interval; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. - * @param message BigQuerySource + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BigQuerySource to JSON. + * Converts this Interval to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInlineSource. */ - interface IProductInlineSource { + /** Properties of a PriceInfo. */ + interface IPriceInfo { - /** ProductInlineSource products */ - products?: (google.cloud.retail.v2.IProduct[]|null); + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); } - /** Represents a ProductInlineSource. */ - class ProductInlineSource implements IProductInlineSource { + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { /** - * Constructs a new ProductInlineSource. + * Constructs a new PriceInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProductInlineSource); + constructor(properties?: google.cloud.retail.v2.IPriceInfo); - /** ProductInlineSource products. */ - public products: google.cloud.retail.v2.IProduct[]; + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new PriceInfo instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInlineSource instance + * @returns PriceInfo instance */ - public static create(properties?: google.cloud.retail.v2.IProductInlineSource): google.cloud.retail.v2.ProductInlineSource; + public static create(properties?: google.cloud.retail.v2.IPriceInfo): google.cloud.retail.v2.PriceInfo; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInlineSource + * @returns PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInlineSource + * @returns PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo; /** - * Verifies a ProductInlineSource message. + * Verifies a PriceInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInlineSource + * @returns PriceInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @param message ProductInlineSource + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInlineSource to JSON. + * Converts this PriceInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInlineSource. */ - interface IUserEventInlineSource { + namespace PriceInfo { - /** UserEventInlineSource userEvents */ - userEvents?: (google.cloud.retail.v2.IUserEvent[]|null); + /** Properties of a PriceRange. */ + interface IPriceRange { + + /** PriceRange price */ + price?: (google.cloud.retail.v2.IInterval|null); + + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2.IInterval|null); + } + + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { + + /** + * Constructs a new PriceRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange); + + /** PriceRange price. */ + public price?: (google.cloud.retail.v2.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2.IInterval|null); + + /** + * Creates a new PriceRange instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceRange instance + */ + public static create(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Verifies a PriceRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } - /** Represents a UserEventInlineSource. */ - class UserEventInlineSource implements IUserEventInlineSource { + /** Properties of a Rating. */ + interface IRating { + + /** Rating ratingCount */ + ratingCount?: (number|null); + + /** Rating averageRating */ + averageRating?: (number|null); + + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } + + /** Represents a Rating. */ + class Rating implements IRating { /** - * Constructs a new UserEventInlineSource. + * Constructs a new Rating. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEventInlineSource); + constructor(properties?: google.cloud.retail.v2.IRating); - /** UserEventInlineSource userEvents. */ - public userEvents: google.cloud.retail.v2.IUserEvent[]; + /** Rating ratingCount. */ + public ratingCount: number; + + /** Rating averageRating. */ + public averageRating: number; + + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new Rating instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInlineSource instance + * @returns Rating instance */ - public static create(properties?: google.cloud.retail.v2.IUserEventInlineSource): google.cloud.retail.v2.UserEventInlineSource; + public static create(properties?: google.cloud.retail.v2.IRating): google.cloud.retail.v2.Rating; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a Rating message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInlineSource + * @returns Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rating; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a Rating message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInlineSource + * @returns Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rating; /** - * Verifies a UserEventInlineSource message. + * Verifies a Rating message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a Rating message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInlineSource + * @returns Rating */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rating; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @param message UserEventInlineSource + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this Rating to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportErrorsConfig. */ - interface IImportErrorsConfig { + /** Properties of a UserInfo. */ + interface IUserInfo { - /** ImportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); - } + /** UserInfo userId */ + userId?: (string|null); - /** Represents an ImportErrorsConfig. */ - class ImportErrorsConfig implements IImportErrorsConfig { + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { /** - * Constructs a new ImportErrorsConfig. + * Constructs a new UserInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportErrorsConfig); + constructor(properties?: google.cloud.retail.v2.IUserInfo); - /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + /** UserInfo userId. */ + public userId: string; - /** ImportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** UserInfo ipAddress. */ + public ipAddress: string; + + /** UserInfo userAgent. */ + public userAgent: string; + + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new UserInfo instance using the specified properties. * @param [properties] Properties to set - * @returns ImportErrorsConfig instance + * @returns UserInfo instance */ - public static create(properties?: google.cloud.retail.v2.IImportErrorsConfig): google.cloud.retail.v2.ImportErrorsConfig; + public static create(properties?: google.cloud.retail.v2.IUserInfo): google.cloud.retail.v2.UserInfo; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a UserInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportErrorsConfig + * @returns UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportErrorsConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserInfo; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a UserInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportErrorsConfig + * @returns UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportErrorsConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserInfo; /** - * Verifies an ImportErrorsConfig message. + * Verifies a UserInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportErrorsConfig + * @returns UserInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportErrorsConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserInfo; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @param message ImportErrorsConfig + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this UserInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportProductsRequest. */ - interface IImportProductsRequest { - - /** ImportProductsRequest parent */ - parent?: (string|null); - - /** ImportProductsRequest requestId */ - requestId?: (string|null); - - /** ImportProductsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); - - /** ImportProductsRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - - /** ImportProductsRequest reconciliationMode */ - reconciliationMode?: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null); + /** Properties of a Promotion. */ + interface IPromotion { - /** ImportProductsRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** Promotion promotionId */ + promotionId?: (string|null); } - /** Represents an ImportProductsRequest. */ - class ImportProductsRequest implements IImportProductsRequest { + /** Represents a Promotion. */ + class Promotion implements IPromotion { /** - * Constructs a new ImportProductsRequest. + * Constructs a new Promotion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportProductsRequest); - - /** ImportProductsRequest parent. */ - public parent: string; - - /** ImportProductsRequest requestId. */ - public requestId: string; - - /** ImportProductsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); - - /** ImportProductsRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** ImportProductsRequest reconciliationMode. */ - public reconciliationMode: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode); + constructor(properties?: google.cloud.retail.v2.IPromotion); - /** ImportProductsRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** Promotion promotionId. */ + public promotionId: string; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsRequest instance + * @returns Promotion instance */ - public static create(properties?: google.cloud.retail.v2.IImportProductsRequest): google.cloud.retail.v2.ImportProductsRequest; + public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsRequest + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsRequest + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; /** - * Verifies an ImportProductsRequest message. + * Verifies a Promotion message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsRequest + * @returns Promotion */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @param message ImportProductsRequest + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this Promotion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ImportProductsRequest { - - /** ReconciliationMode enum. */ - enum ReconciliationMode { - RECONCILIATION_MODE_UNSPECIFIED = 0, - INCREMENTAL = 1, - FULL = 2 - } - } - - /** Properties of an ImportUserEventsRequest. */ - interface IImportUserEventsRequest { - - /** ImportUserEventsRequest parent */ - parent?: (string|null); - - /** ImportUserEventsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); - - /** ImportUserEventsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); - } - - /** Represents an ImportUserEventsRequest. */ - class ImportUserEventsRequest implements IImportUserEventsRequest { - - /** - * Constructs a new ImportUserEventsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IImportUserEventsRequest); - - /** ImportUserEventsRequest parent. */ - public parent: string; - - /** ImportUserEventsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); - - /** ImportUserEventsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { /** - * Creates a new ImportUserEventsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportUserEventsRequest instance + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static create(properties?: google.cloud.retail.v2.IImportUserEventsRequest): google.cloud.retail.v2.ImportUserEventsRequest; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static encode(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest, callback: google.cloud.retail.v2.CompletionService.CompleteQueryCallback): void; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsRequest; + public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest): Promise; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsRequest; + public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest, callback: google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback): void; /** - * Verifies an ImportUserEventsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest): Promise; + } - /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportUserEventsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsRequest; + namespace CompletionService { /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @param message ImportUserEventsRequest - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse */ - public static toObject(message: google.cloud.retail.v2.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompleteQueryResponse) => void; /** - * Converts this ImportUserEventsRequest to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of an ImportCompletionDataRequest. */ - interface IImportCompletionDataRequest { + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { - /** ImportCompletionDataRequest parent */ - parent?: (string|null); + /** CompleteQueryRequest catalog */ + catalog?: (string|null); - /** ImportCompletionDataRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + /** CompleteQueryRequest query */ + query?: (string|null); - /** ImportCompletionDataRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); } - /** Represents an ImportCompletionDataRequest. */ - class ImportCompletionDataRequest implements IImportCompletionDataRequest { + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportCompletionDataRequest); + constructor(properties?: google.cloud.retail.v2.ICompleteQueryRequest); - /** ImportCompletionDataRequest parent. */ - public parent: string; + /** CompleteQueryRequest catalog. */ + public catalog: string; - /** ImportCompletionDataRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + /** CompleteQueryRequest query. */ + public query: string; - /** ImportCompletionDataRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** CompleteQueryRequest visitorId. */ + public visitorId: string; + + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; + + /** CompleteQueryRequest deviceType. */ + public deviceType: string; + + /** CompleteQueryRequest dataset. */ + public dataset: string; + + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportCompletionDataRequest instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportCompletionDataRequest): google.cloud.retail.v2.ImportCompletionDataRequest; + public static create(properties?: google.cloud.retail.v2.ICompleteQueryRequest): google.cloud.retail.v2.CompleteQueryRequest; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportCompletionDataRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryRequest; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryRequest; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportCompletionDataRequest + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryRequest; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. - * @param message ImportCompletionDataRequest + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInputConfig. */ - interface IProductInputConfig { + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { - /** ProductInputConfig productInlineSource */ - productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]|null); - /** ProductInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); - /** ProductInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents a ProductInputConfig. */ - class ProductInputConfig implements IProductInputConfig { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new ProductInputConfig. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProductInputConfig); - - /** ProductInputConfig productInlineSource. */ - public productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + constructor(properties?: google.cloud.retail.v2.ICompleteQueryResponse); - /** ProductInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]; - /** ProductInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; - /** ProductInputConfig source. */ - public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInputConfig instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2.IProductInputConfig): google.cloud.retail.v2.ProductInputConfig; + public static create(properties?: google.cloud.retail.v2.ICompleteQueryResponse): google.cloud.retail.v2.CompleteQueryResponse; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInputConfig + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInputConfig + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse; /** - * Verifies a ProductInputConfig message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInputConfig + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @param message ProductInputConfig + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInputConfig to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInputConfig. */ - interface IUserEventInputConfig { + namespace CompleteQueryResponse { - /** UserEventInputConfig userEventInlineSource */ - userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); + /** Properties of a CompletionResult. */ + interface ICompletionResult { - /** UserEventInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + /** CompletionResult suggestion */ + suggestion?: (string|null); - /** UserEventInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); - } + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + } - /** Represents a UserEventInputConfig. */ - class UserEventInputConfig implements IUserEventInputConfig { + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { + + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult); + + /** CompletionResult suggestion. */ + public suggestion: string; + + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { + + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); + } + + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { + + /** + * Constructs a new RecentSearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult); + + /** RecentSearchResult recentSearch. */ + public recentSearch: string; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentSearchResult instance + */ + public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Verifies a RecentSearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentSearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentSearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource inputUris */ + inputUris?: (string[]|null); + + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { /** - * Constructs a new UserEventInputConfig. + * Constructs a new GcsSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEventInputConfig); - - /** UserEventInputConfig userEventInlineSource. */ - public userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); - - /** UserEventInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + constructor(properties?: google.cloud.retail.v2.IGcsSource); - /** UserEventInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** GcsSource inputUris. */ + public inputUris: string[]; - /** UserEventInputConfig source. */ - public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + /** GcsSource dataSchema. */ + public dataSchema: string; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInputConfig instance + * @returns GcsSource instance */ - public static create(properties?: google.cloud.retail.v2.IUserEventInputConfig): google.cloud.retail.v2.UserEventInputConfig; + public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInputConfig + * @returns GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInputConfig + * @returns GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; /** - * Verifies a UserEventInputConfig message. + * Verifies a GcsSource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInputConfig + * @returns GcsSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @param message UserEventInputConfig + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this GcsSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompletionDataInputConfig. */ - interface ICompletionDataInputConfig { + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { - /** CompletionDataInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); } - /** Represents a CompletionDataInputConfig. */ - class CompletionDataInputConfig implements ICompletionDataInputConfig { + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new BigQuerySource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompletionDataInputConfig); + constructor(properties?: google.cloud.retail.v2.IBigQuerySource); - /** CompletionDataInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); - /** CompletionDataInputConfig source. */ - public source?: "bigQuerySource"; + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** BigQuerySource partition. */ + public partition?: "partitionDate"; /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * Creates a new BigQuerySource instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDataInputConfig instance + * @returns BigQuerySource instance */ - public static create(properties?: google.cloud.retail.v2.ICompletionDataInputConfig): google.cloud.retail.v2.CompletionDataInputConfig; + public static create(properties?: google.cloud.retail.v2.IBigQuerySource): google.cloud.retail.v2.BigQuerySource; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDataInputConfig + * @returns BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDataInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.BigQuerySource; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDataInputConfig + * @returns BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDataInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.BigQuerySource; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a BigQuerySource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDataInputConfig + * @returns BigQuerySource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDataInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.BigQuerySource; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. - * @param message CompletionDataInputConfig + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this BigQuerySource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportMetadata. */ - interface IImportMetadata { - - /** ImportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** ImportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - - /** ImportMetadata successCount */ - successCount?: (number|Long|string|null); - - /** ImportMetadata failureCount */ - failureCount?: (number|Long|string|null); - - /** ImportMetadata requestId */ - requestId?: (string|null); + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { - /** ImportMetadata notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2.IProduct[]|null); } - /** Represents an ImportMetadata. */ - class ImportMetadata implements IImportMetadata { + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { /** - * Constructs a new ImportMetadata. + * Constructs a new ProductInlineSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportMetadata); - - /** ImportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** ImportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** ImportMetadata successCount. */ - public successCount: (number|Long|string); - - /** ImportMetadata failureCount. */ - public failureCount: (number|Long|string); - - /** ImportMetadata requestId. */ - public requestId: string; + constructor(properties?: google.cloud.retail.v2.IProductInlineSource); - /** ImportMetadata notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2.IProduct[]; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @param [properties] Properties to set - * @returns ImportMetadata instance + * @returns ProductInlineSource instance */ - public static create(properties?: google.cloud.retail.v2.IImportMetadata): google.cloud.retail.v2.ImportMetadata; + public static create(properties?: google.cloud.retail.v2.IProductInlineSource): google.cloud.retail.v2.ProductInlineSource; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportMetadata + * @returns ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInlineSource; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportMetadata + * @returns ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInlineSource; /** - * Verifies an ImportMetadata message. + * Verifies a ProductInlineSource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportMetadata + * @returns ProductInlineSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInlineSource; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. - * @param message ImportMetadata + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportMetadata to JSON. + * Converts this ProductInlineSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportProductsResponse. */ - interface IImportProductsResponse { - - /** ImportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { - /** ImportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2.IUserEvent[]|null); } - /** Represents an ImportProductsResponse. */ - class ImportProductsResponse implements IImportProductsResponse { + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { /** - * Constructs a new ImportProductsResponse. + * Constructs a new UserEventInlineSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportProductsResponse); - - /** ImportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + constructor(properties?: google.cloud.retail.v2.IUserEventInlineSource); - /** ImportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2.IUserEvent[]; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Creates a new UserEventInlineSource instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsResponse instance + * @returns UserEventInlineSource instance */ - public static create(properties?: google.cloud.retail.v2.IImportProductsResponse): google.cloud.retail.v2.ImportProductsResponse; + public static create(properties?: google.cloud.retail.v2.IUserEventInlineSource): google.cloud.retail.v2.UserEventInlineSource; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsResponse + * @returns UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInlineSource; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsResponse + * @returns UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInlineSource; /** - * Verifies an ImportProductsResponse message. + * Verifies a UserEventInlineSource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsResponse + * @returns UserEventInlineSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInlineSource; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @param message ImportProductsResponse + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this UserEventInlineSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportUserEventsResponse. */ - interface IImportUserEventsResponse { - - /** ImportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - - /** ImportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { - /** ImportUserEventsResponse importSummary */ - importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); } - /** Represents an ImportUserEventsResponse. */ - class ImportUserEventsResponse implements IImportUserEventsResponse { + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new ImportErrorsConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportUserEventsResponse); - - /** ImportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + constructor(properties?: google.cloud.retail.v2.IImportErrorsConfig); - /** ImportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); - /** ImportUserEventsResponse importSummary. */ - public importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Creates a new ImportErrorsConfig instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsResponse instance + * @returns ImportErrorsConfig instance */ - public static create(properties?: google.cloud.retail.v2.IImportUserEventsResponse): google.cloud.retail.v2.ImportUserEventsResponse; + public static create(properties?: google.cloud.retail.v2.IImportErrorsConfig): google.cloud.retail.v2.ImportErrorsConfig; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes an ImportErrorsConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsResponse + * @returns ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportErrorsConfig; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsResponse + * @returns ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportErrorsConfig; /** - * Verifies an ImportUserEventsResponse message. + * Verifies an ImportErrorsConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsResponse + * @returns ImportErrorsConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportErrorsConfig; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. - * @param message ImportUserEventsResponse + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this ImportErrorsConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventImportSummary. */ - interface IUserEventImportSummary { + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { - /** UserEventImportSummary joinedEventsCount */ - joinedEventsCount?: (number|Long|string|null); + /** ImportProductsRequest parent */ + parent?: (string|null); - /** UserEventImportSummary unjoinedEventsCount */ - unjoinedEventsCount?: (number|Long|string|null); + /** ImportProductsRequest requestId */ + requestId?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null); + + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a UserEventImportSummary. */ - class UserEventImportSummary implements IUserEventImportSummary { + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { /** - * Constructs a new UserEventImportSummary. + * Constructs a new ImportProductsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEventImportSummary); + constructor(properties?: google.cloud.retail.v2.IImportProductsRequest); - /** UserEventImportSummary joinedEventsCount. */ - public joinedEventsCount: (number|Long|string); + /** ImportProductsRequest parent. */ + public parent: string; - /** UserEventImportSummary unjoinedEventsCount. */ - public unjoinedEventsCount: (number|Long|string); + /** ImportProductsRequest requestId. */ + public requestId: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode); + + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * Creates a new ImportProductsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventImportSummary instance + * @returns ImportProductsRequest instance */ - public static create(properties?: google.cloud.retail.v2.IUserEventImportSummary): google.cloud.retail.v2.UserEventImportSummary; + public static create(properties?: google.cloud.retail.v2.IImportProductsRequest): google.cloud.retail.v2.ImportProductsRequest; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventImportSummary + * @returns ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventImportSummary; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsRequest; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventImportSummary + * @returns ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventImportSummary; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsRequest; /** - * Verifies a UserEventImportSummary message. + * Verifies an ImportProductsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventImportSummary + * @returns ImportProductsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventImportSummary; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsRequest; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @param message UserEventImportSummary + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this ImportProductsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportCompletionDataResponse. */ - interface IImportCompletionDataResponse { + namespace ImportProductsRequest { - /** ImportCompletionDataResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } } - /** Represents an ImportCompletionDataResponse. */ - class ImportCompletionDataResponse implements IImportCompletionDataResponse { + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ + parent?: (string|null); + + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { /** - * Constructs a new ImportCompletionDataResponse. + * Constructs a new ImportUserEventsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportCompletionDataResponse); + constructor(properties?: google.cloud.retail.v2.IImportUserEventsRequest); - /** ImportCompletionDataResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. + * Creates a new ImportUserEventsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportCompletionDataResponse instance + * @returns ImportUserEventsRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportCompletionDataResponse): google.cloud.retail.v2.ImportCompletionDataResponse; + public static create(properties?: google.cloud.retail.v2.IImportUserEventsRequest): google.cloud.retail.v2.ImportUserEventsRequest; /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportCompletionDataResponse + * @returns ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsRequest; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataResponse + * @returns ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsRequest; /** - * Verifies an ImportCompletionDataResponse message. + * Verifies an ImportUserEventsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportCompletionDataResponse + * @returns ImportUserEventsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsRequest; /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. - * @param message ImportCompletionDataResponse + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportCompletionDataResponse to JSON. + * Converts this ImportUserEventsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Product. */ - interface IProduct { - - /** Product expireTime */ - expireTime?: (google.protobuf.ITimestamp|null); - - /** Product ttl */ - ttl?: (google.protobuf.IDuration|null); + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { - /** Product name */ - name?: (string|null); + /** ImportCompletionDataRequest parent */ + parent?: (string|null); - /** Product id */ - id?: (string|null); + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); - /** Product type */ - type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } - /** Product primaryProductId */ - primaryProductId?: (string|null); + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { - /** Product collectionMemberIds */ - collectionMemberIds?: (string[]|null); + /** + * Constructs a new ImportCompletionDataRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportCompletionDataRequest); - /** Product gtin */ - gtin?: (string|null); + /** ImportCompletionDataRequest parent. */ + public parent: string; - /** Product categories */ - categories?: (string[]|null); + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); - /** Product title */ - title?: (string|null); + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; - /** Product brands */ - brands?: (string[]|null); + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportCompletionDataRequest): google.cloud.retail.v2.ImportCompletionDataRequest; - /** Product description */ - description?: (string|null); + /** + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product languageCode */ - languageCode?: (string|null); + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataRequest; - /** Product tags */ - tags?: (string[]|null); + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataRequest; - /** Product priceInfo */ - priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + /** + * Verifies an ImportCompletionDataRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Product rating */ - rating?: (google.cloud.retail.v2.IRating|null); + /** + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataRequest; - /** Product availableTime */ - availableTime?: (google.protobuf.ITimestamp|null); + /** + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Product availability */ - availability?: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability|null); + /** + * Converts this ImportCompletionDataRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Product availableQuantity */ - availableQuantity?: (google.protobuf.IInt32Value|null); + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { - /** Product fulfillmentInfo */ - fulfillmentInfo?: (google.cloud.retail.v2.IFulfillmentInfo[]|null); + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); - /** Product uri */ - uri?: (string|null); + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2.IGcsSource|null); - /** Product images */ - images?: (google.cloud.retail.v2.IImage[]|null); + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + } - /** Product audience */ - audience?: (google.cloud.retail.v2.IAudience|null); + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { - /** Product colorInfo */ - colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + /** + * Constructs a new ProductInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductInputConfig); - /** Product sizes */ - sizes?: (string[]|null); + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); - /** Product materials */ - materials?: (string[]|null); + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); - /** Product patterns */ - patterns?: (string[]|null); + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); - /** Product conditions */ - conditions?: (string[]|null); + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); - /** Product promotions */ - promotions?: (google.cloud.retail.v2.IPromotion[]|null); + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IProductInputConfig): google.cloud.retail.v2.ProductInputConfig; - /** Product publishTime */ - publishTime?: (google.protobuf.ITimestamp|null); + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product retrievableFields */ - retrievableFields?: (google.protobuf.IFieldMask|null); + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product variants */ - variants?: (google.cloud.retail.v2.IProduct[]|null); - } + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInputConfig; - /** Represents a Product. */ - class Product implements IProduct { + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInputConfig; /** - * Constructs a new Product. - * @param [properties] Properties to set + * Verifies a ProductInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - constructor(properties?: google.cloud.retail.v2.IProduct); + public static verify(message: { [k: string]: any }): (string|null); - /** Product expireTime. */ - public expireTime?: (google.protobuf.ITimestamp|null); - - /** Product ttl. */ - public ttl?: (google.protobuf.IDuration|null); - - /** Product name. */ - public name: string; - - /** Product id. */ - public id: string; - - /** Product type. */ - public type: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type); - - /** Product primaryProductId. */ - public primaryProductId: string; - - /** Product collectionMemberIds. */ - public collectionMemberIds: string[]; - - /** Product gtin. */ - public gtin: string; - - /** Product categories. */ - public categories: string[]; - - /** Product title. */ - public title: string; - - /** Product brands. */ - public brands: string[]; - - /** Product description. */ - public description: string; - - /** Product languageCode. */ - public languageCode: string; - - /** Product attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - - /** Product tags. */ - public tags: string[]; - - /** Product priceInfo. */ - public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); - - /** Product rating. */ - public rating?: (google.cloud.retail.v2.IRating|null); - - /** Product availableTime. */ - public availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability. */ - public availability: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability); - - /** Product availableQuantity. */ - public availableQuantity?: (google.protobuf.IInt32Value|null); - - /** Product fulfillmentInfo. */ - public fulfillmentInfo: google.cloud.retail.v2.IFulfillmentInfo[]; - - /** Product uri. */ - public uri: string; - - /** Product images. */ - public images: google.cloud.retail.v2.IImage[]; - - /** Product audience. */ - public audience?: (google.cloud.retail.v2.IAudience|null); - - /** Product colorInfo. */ - public colorInfo?: (google.cloud.retail.v2.IColorInfo|null); - - /** Product sizes. */ - public sizes: string[]; - - /** Product materials. */ - public materials: string[]; - - /** Product patterns. */ - public patterns: string[]; - - /** Product conditions. */ - public conditions: string[]; - - /** Product promotions. */ - public promotions: google.cloud.retail.v2.IPromotion[]; - - /** Product publishTime. */ - public publishTime?: (google.protobuf.ITimestamp|null); - - /** Product retrievableFields. */ - public retrievableFields?: (google.protobuf.IFieldMask|null); - - /** Product variants. */ - public variants: google.cloud.retail.v2.IProduct[]; - - /** Product expiration. */ - public expiration?: ("expireTime"|"ttl"); - - /** - * Creates a new Product instance using the specified properties. - * @param [properties] Properties to set - * @returns Product instance - */ - public static create(properties?: google.cloud.retail.v2.IProduct): google.cloud.retail.v2.Product; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInputConfig; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Product message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Product; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Product; - - /** - * Verifies a Product message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Product - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Product; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Product to JSON. + * Converts this ProductInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Product { - - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - VARIANT = 2, - COLLECTION = 3 - } - - /** Availability enum. */ - enum Availability { - AVAILABILITY_UNSPECIFIED = 0, - IN_STOCK = 1, - OUT_OF_STOCK = 2, - PREORDER = 3, - BACKORDER = 4 - } - } - - /** Properties of a UserEvent. */ - interface IUserEvent { - - /** UserEvent eventType */ - eventType?: (string|null); - - /** UserEvent visitorId */ - visitorId?: (string|null); - - /** UserEvent sessionId */ - sessionId?: (string|null); - - /** UserEvent eventTime */ - eventTime?: (google.protobuf.ITimestamp|null); - - /** UserEvent experimentIds */ - experimentIds?: (string[]|null); - - /** UserEvent attributionToken */ - attributionToken?: (string|null); - - /** UserEvent productDetails */ - productDetails?: (google.cloud.retail.v2.IProductDetail[]|null); - - /** UserEvent completionDetail */ - completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); - - /** UserEvent attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); - - /** UserEvent cartId */ - cartId?: (string|null); - - /** UserEvent purchaseTransaction */ - purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); - - /** UserEvent searchQuery */ - searchQuery?: (string|null); - - /** UserEvent filter */ - filter?: (string|null); - - /** UserEvent orderBy */ - orderBy?: (string|null); - - /** UserEvent offset */ - offset?: (number|null); - - /** UserEvent pageCategories */ - pageCategories?: (string[]|null); - - /** UserEvent userInfo */ - userInfo?: (google.cloud.retail.v2.IUserInfo|null); + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { - /** UserEvent uri */ - uri?: (string|null); + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); - /** UserEvent referrerUri */ - referrerUri?: (string|null); + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2.IGcsSource|null); - /** UserEvent pageViewId */ - pageViewId?: (string|null); + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); } - /** Represents a UserEvent. */ - class UserEvent implements IUserEvent { + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { /** - * Constructs a new UserEvent. + * Constructs a new UserEventInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEvent); - - /** UserEvent eventType. */ - public eventType: string; - - /** UserEvent visitorId. */ - public visitorId: string; - - /** UserEvent sessionId. */ - public sessionId: string; - - /** UserEvent eventTime. */ - public eventTime?: (google.protobuf.ITimestamp|null); - - /** UserEvent experimentIds. */ - public experimentIds: string[]; - - /** UserEvent attributionToken. */ - public attributionToken: string; - - /** UserEvent productDetails. */ - public productDetails: google.cloud.retail.v2.IProductDetail[]; - - /** UserEvent completionDetail. */ - public completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); - - /** UserEvent attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - - /** UserEvent cartId. */ - public cartId: string; - - /** UserEvent purchaseTransaction. */ - public purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); - - /** UserEvent searchQuery. */ - public searchQuery: string; - - /** UserEvent filter. */ - public filter: string; - - /** UserEvent orderBy. */ - public orderBy: string; - - /** UserEvent offset. */ - public offset: number; - - /** UserEvent pageCategories. */ - public pageCategories: string[]; + constructor(properties?: google.cloud.retail.v2.IUserEventInputConfig); - /** UserEvent userInfo. */ - public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); - /** UserEvent uri. */ - public uri: string; + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); - /** UserEvent referrerUri. */ - public referrerUri: string; + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); - /** UserEvent pageViewId. */ - public pageViewId: string; + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new UserEventInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns UserEvent instance + * @returns UserEventInputConfig instance */ - public static create(properties?: google.cloud.retail.v2.IUserEvent): google.cloud.retail.v2.UserEvent; + public static create(properties?: google.cloud.retail.v2.IUserEventInputConfig): google.cloud.retail.v2.UserEventInputConfig; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEvent + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEvent; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInputConfig; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEvent + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEvent; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInputConfig; /** - * Verifies a UserEvent message. + * Verifies a UserEventInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEvent + * @returns UserEventInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEvent; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInputConfig; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @param message UserEvent + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEvent to JSON. + * Converts this UserEventInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductDetail. */ - interface IProductDetail { - - /** ProductDetail product */ - product?: (google.cloud.retail.v2.IProduct|null); + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { - /** ProductDetail quantity */ - quantity?: (google.protobuf.IInt32Value|null); + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); } - /** Represents a ProductDetail. */ - class ProductDetail implements IProductDetail { + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { /** - * Constructs a new ProductDetail. + * Constructs a new CompletionDataInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProductDetail); + constructor(properties?: google.cloud.retail.v2.ICompletionDataInputConfig); - /** ProductDetail product. */ - public product?: (google.cloud.retail.v2.IProduct|null); + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); - /** ProductDetail quantity. */ - public quantity?: (google.protobuf.IInt32Value|null); + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns ProductDetail instance + * @returns CompletionDataInputConfig instance */ - public static create(properties?: google.cloud.retail.v2.IProductDetail): google.cloud.retail.v2.ProductDetail; + public static create(properties?: google.cloud.retail.v2.ICompletionDataInputConfig): google.cloud.retail.v2.CompletionDataInputConfig; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductDetail + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDataInputConfig; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductDetail + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDataInputConfig; /** - * Verifies a ProductDetail message. + * Verifies a CompletionDataInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductDetail + * @returns CompletionDataInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDataInputConfig; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @param message ProductDetail + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductDetail to JSON. + * Converts this CompletionDataInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompletionDetail. */ - interface ICompletionDetail { + /** Properties of an ImportMetadata. */ + interface IImportMetadata { - /** CompletionDetail completionAttributionToken */ - completionAttributionToken?: (string|null); + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** CompletionDetail selectedSuggestion */ - selectedSuggestion?: (string|null); + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); - /** CompletionDetail selectedPosition */ - selectedPosition?: (number|null); + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a CompletionDetail. */ - class CompletionDetail implements ICompletionDetail { + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { /** - * Constructs a new CompletionDetail. + * Constructs a new ImportMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompletionDetail); + constructor(properties?: google.cloud.retail.v2.IImportMetadata); - /** CompletionDetail completionAttributionToken. */ - public completionAttributionToken: string; + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** CompletionDetail selectedSuggestion. */ - public selectedSuggestion: string; + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); - /** CompletionDetail selectedPosition. */ - public selectedPosition: number; + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** ImportMetadata requestId. */ + public requestId: string; + + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new CompletionDetail instance using the specified properties. + * Creates a new ImportMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDetail instance + * @returns ImportMetadata instance */ - public static create(properties?: google.cloud.retail.v2.ICompletionDetail): google.cloud.retail.v2.CompletionDetail; + public static create(properties?: google.cloud.retail.v2.IImportMetadata): google.cloud.retail.v2.ImportMetadata; /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDetail message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDetail + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportMetadata; /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDetail + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportMetadata; /** - * Verifies a CompletionDetail message. + * Verifies an ImportMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDetail + * @returns ImportMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportMetadata; /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. - * @param message CompletionDetail + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDetail to JSON. + * Converts this ImportMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurchaseTransaction. */ - interface IPurchaseTransaction { - - /** PurchaseTransaction id */ - id?: (string|null); - - /** PurchaseTransaction revenue */ - revenue?: (number|null); - - /** PurchaseTransaction tax */ - tax?: (number|null); + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { - /** PurchaseTransaction cost */ - cost?: (number|null); + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** PurchaseTransaction currencyCode */ - currencyCode?: (string|null); + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); } - /** Represents a PurchaseTransaction. */ - class PurchaseTransaction implements IPurchaseTransaction { + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { /** - * Constructs a new PurchaseTransaction. + * Constructs a new ImportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurchaseTransaction); - - /** PurchaseTransaction id. */ - public id: string; - - /** PurchaseTransaction revenue. */ - public revenue: number; - - /** PurchaseTransaction tax. */ - public tax: number; + constructor(properties?: google.cloud.retail.v2.IImportProductsResponse); - /** PurchaseTransaction cost. */ - public cost: number; + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** PurchaseTransaction currencyCode. */ - public currencyCode: string; + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurchaseTransaction instance + * @returns ImportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2.IPurchaseTransaction): google.cloud.retail.v2.PurchaseTransaction; + public static create(properties?: google.cloud.retail.v2.IImportProductsResponse): google.cloud.retail.v2.ImportProductsResponse; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurchaseTransaction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurchaseTransaction; - - /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurchaseTransaction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurchaseTransaction; - - /** - * Verifies a PurchaseTransaction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurchaseTransaction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurchaseTransaction; - - /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @param message PurchaseTransaction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PurchaseTransaction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { - - /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; - - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse - */ - public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; - - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise - */ - public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; - - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog - */ - public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; - - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise - */ - public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; - - /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback): void; - - /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @returns Promise - */ - public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsResponse; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @returns Promise + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest): Promise; - } - - namespace CatalogService { + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsResponse; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse + * Verifies an ImportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsResponse */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsResponse; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. - * @param error Error, if any - * @param [response] Empty + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse + * @param [options] Conversion options + * @returns Plain object */ - type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static toObject(message: google.cloud.retail.v2.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. - * @param error Error, if any - * @param [response] GetDefaultBranchResponse + * Converts this ImportProductsResponse to JSON. + * @returns JSON object */ - type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2.GetDefaultBranchResponse) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { - /** ListCatalogsRequest parent */ - parent?: (string|null); + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** ListCatalogsRequest pageSize */ - pageSize?: (number|null); + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); - /** ListCatalogsRequest pageToken */ - pageToken?: (string|null); + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new ImportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); + constructor(properties?: google.cloud.retail.v2.IImportUserEventsResponse); - /** ListCatalogsRequest parent. */ - public parent: string; + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** ListCatalogsRequest pageSize. */ - public pageSize: number; + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); - /** ListCatalogsRequest pageToken. */ - public pageToken: string; + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns ImportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2.IImportUserEventsResponse): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Verifies a ListCatalogsRequest message. + * Verifies an ImportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns ImportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ImportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2.ICatalog[]|null); + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); - /** ListCatalogsResponse nextPageToken */ - nextPageToken?: (string|null); + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { /** - * Constructs a new ListCatalogsResponse. + * Constructs a new UserEventImportSummary. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); + constructor(properties?: google.cloud.retail.v2.IUserEventImportSummary); - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2.ICatalog[]; + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); - /** ListCatalogsResponse nextPageToken. */ - public nextPageToken: string; + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance + * @returns UserEventImportSummary instance */ - public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; + public static create(properties?: google.cloud.retail.v2.IUserEventImportSummary): google.cloud.retail.v2.UserEventImportSummary; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventImportSummary; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventImportSummary; /** - * Verifies a ListCatalogsResponse message. + * Verifies a UserEventImportSummary message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns UserEventImportSummary */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventImportSummary; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this UserEventImportSummary to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { - - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2.ICatalog|null); + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new ImportCompletionDataResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); - - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2.ICatalog|null); + constructor(properties?: google.cloud.retail.v2.IImportCompletionDataResponse); - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns ImportCompletionDataResponse instance */ - public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2.IImportCompletionDataResponse): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Verifies an UpdateCatalogRequest message. + * Verifies an ImportCompletionDataResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns ImportCompletionDataResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetDefaultBranchRequest. */ - interface ISetDefaultBranchRequest { + /** Properties of a Product. */ + interface IProduct { - /** SetDefaultBranchRequest catalog */ - catalog?: (string|null); + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); - /** SetDefaultBranchRequest branchId */ - branchId?: (string|null); + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); - /** SetDefaultBranchRequest note */ - note?: (string|null); + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); + + /** Product gtin */ + gtin?: (string|null); + + /** Product categories */ + categories?: (string[]|null); + + /** Product title */ + title?: (string|null); + + /** Product brands */ + brands?: (string[]|null); + + /** Product description */ + description?: (string|null); + + /** Product languageCode */ + languageCode?: (string|null); + + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** Product rating */ + rating?: (google.cloud.retail.v2.IRating|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2.IFulfillmentInfo[]|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2.IImage[]|null); + + /** Product audience */ + audience?: (google.cloud.retail.v2.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); + + /** Product promotions */ + promotions?: (google.cloud.retail.v2.IPromotion[]|null); + + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants */ + variants?: (google.cloud.retail.v2.IProduct[]|null); } - /** Represents a SetDefaultBranchRequest. */ - class SetDefaultBranchRequest implements ISetDefaultBranchRequest { + /** Represents a Product. */ + class Product implements IProduct { /** - * Constructs a new SetDefaultBranchRequest. + * Constructs a new Product. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest); + constructor(properties?: google.cloud.retail.v2.IProduct); - /** SetDefaultBranchRequest catalog. */ - public catalog: string; + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); - /** SetDefaultBranchRequest branchId. */ - public branchId: string; + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); - /** SetDefaultBranchRequest note. */ - public note: string; + /** Product name. */ + public name: string; + + /** Product id. */ + public id: string; + + /** Product type. */ + public type: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type); + + /** Product primaryProductId. */ + public primaryProductId: string; + + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; + + /** Product gtin. */ + public gtin: string; + + /** Product categories. */ + public categories: string[]; + + /** Product title. */ + public title: string; + + /** Product brands. */ + public brands: string[]; + + /** Product description. */ + public description: string; + + /** Product languageCode. */ + public languageCode: string; + + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** Product tags. */ + public tags: string[]; + + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** Product rating. */ + public rating?: (google.cloud.retail.v2.IRating|null); + + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability. */ + public availability: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability); + + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2.IFulfillmentInfo[]; + + /** Product uri. */ + public uri: string; + + /** Product images. */ + public images: google.cloud.retail.v2.IImage[]; + + /** Product audience. */ + public audience?: (google.cloud.retail.v2.IAudience|null); + + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + + /** Product sizes. */ + public sizes: string[]; + + /** Product materials. */ + public materials: string[]; + + /** Product patterns. */ + public patterns: string[]; + + /** Product conditions. */ + public conditions: string[]; + + /** Product promotions. */ + public promotions: google.cloud.retail.v2.IPromotion[]; + + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants. */ + public variants: google.cloud.retail.v2.IProduct[]; + + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. + * Creates a new Product instance using the specified properties. * @param [properties] Properties to set - * @returns SetDefaultBranchRequest instance + * @returns Product instance */ - public static create(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest): google.cloud.retail.v2.SetDefaultBranchRequest; + public static create(properties?: google.cloud.retail.v2.IProduct): google.cloud.retail.v2.Product; - /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetDefaultBranchRequest + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetDefaultBranchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Product; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetDefaultBranchRequest + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetDefaultBranchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Product; /** - * Verifies a SetDefaultBranchRequest message. + * Verifies a Product message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetDefaultBranchRequest + * @returns Product */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetDefaultBranchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Product; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message SetDefaultBranchRequest + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetDefaultBranchRequest to JSON. + * Converts this Product to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetDefaultBranchRequest. */ - interface IGetDefaultBranchRequest { + namespace Product { - /** GetDefaultBranchRequest catalog */ - catalog?: (string|null); + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } + + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } } - /** Represents a GetDefaultBranchRequest. */ - class GetDefaultBranchRequest implements IGetDefaultBranchRequest { + /** Properties of a UserEvent. */ + interface IUserEvent { + + /** UserEvent eventType */ + eventType?: (string|null); + + /** UserEvent visitorId */ + visitorId?: (string|null); + + /** UserEvent sessionId */ + sessionId?: (string|null); + + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); + + /** UserEvent attributionToken */ + attributionToken?: (string|null); + + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2.IProductDetail[]|null); + + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent filter */ + filter?: (string|null); + + /** UserEvent orderBy */ + orderBy?: (string|null); + + /** UserEvent offset */ + offset?: (number|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } + + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { /** - * Constructs a new GetDefaultBranchRequest. + * Constructs a new UserEvent. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest); + constructor(properties?: google.cloud.retail.v2.IUserEvent); - /** GetDefaultBranchRequest catalog. */ - public catalog: string; + /** UserEvent eventType. */ + public eventType: string; + + /** UserEvent visitorId. */ + public visitorId: string; + + /** UserEvent sessionId. */ + public sessionId: string; + + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2.IProductDetail[]; + + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent filter. */ + public filter: string; + + /** UserEvent orderBy. */ + public orderBy: string; + + /** UserEvent offset. */ + public offset: number; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. + * Creates a new UserEvent instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchRequest instance + * @returns UserEvent instance */ - public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest): google.cloud.retail.v2.GetDefaultBranchRequest; + public static create(properties?: google.cloud.retail.v2.IUserEvent): google.cloud.retail.v2.UserEvent; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a UserEvent message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchRequest + * @returns UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEvent; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a UserEvent message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchRequest + * @returns UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEvent; /** - * Verifies a GetDefaultBranchRequest message. + * Verifies a UserEvent message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchRequest + * @returns UserEvent */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEvent; /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message GetDefaultBranchRequest + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetDefaultBranchRequest to JSON. + * Converts this UserEvent to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetDefaultBranchResponse. */ - interface IGetDefaultBranchResponse { - - /** GetDefaultBranchResponse branch */ - branch?: (string|null); + /** Properties of a ProductDetail. */ + interface IProductDetail { - /** GetDefaultBranchResponse setTime */ - setTime?: (google.protobuf.ITimestamp|null); + /** ProductDetail product */ + product?: (google.cloud.retail.v2.IProduct|null); - /** GetDefaultBranchResponse note */ - note?: (string|null); + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); } - /** Represents a GetDefaultBranchResponse. */ - class GetDefaultBranchResponse implements IGetDefaultBranchResponse { + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { /** - * Constructs a new GetDefaultBranchResponse. + * Constructs a new ProductDetail. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse); - - /** GetDefaultBranchResponse branch. */ - public branch: string; + constructor(properties?: google.cloud.retail.v2.IProductDetail); - /** GetDefaultBranchResponse setTime. */ - public setTime?: (google.protobuf.ITimestamp|null); + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2.IProduct|null); - /** GetDefaultBranchResponse note. */ - public note: string; + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. + * Creates a new ProductDetail instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchResponse instance + * @returns ProductDetail instance */ - public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse): google.cloud.retail.v2.GetDefaultBranchResponse; + public static create(properties?: google.cloud.retail.v2.IProductDetail): google.cloud.retail.v2.ProductDetail; /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * Decodes a ProductDetail message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchResponse + * @returns ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductDetail; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchResponse + * @returns ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductDetail; /** - * Verifies a GetDefaultBranchResponse message. + * Verifies a ProductDetail message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchResponse + * @returns ProductDetail */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductDetail; /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. - * @param message GetDefaultBranchResponse + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetDefaultBranchResponse to JSON. + * Converts this ProductDetail to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CompletionService */ - class CompletionService extends $protobuf.rpc.Service { - - /** - * Constructs a new CompletionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new CompletionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; - - /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse - */ - public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest, callback: google.cloud.retail.v2.CompletionService.CompleteQueryCallback): void; - - /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @returns Promise - */ - public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest): Promise; - - /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest, callback: google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback): void; - - /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @returns Promise - */ - public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest): Promise; - } - - namespace CompletionService { - - /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. - * @param error Error, if any - * @param [response] CompleteQueryResponse - */ - type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompleteQueryResponse) => void; - - /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a CompleteQueryRequest. */ - interface ICompleteQueryRequest { - - /** CompleteQueryRequest catalog */ - catalog?: (string|null); - - /** CompleteQueryRequest query */ - query?: (string|null); - - /** CompleteQueryRequest visitorId */ - visitorId?: (string|null); - - /** CompleteQueryRequest languageCodes */ - languageCodes?: (string[]|null); + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { - /** CompleteQueryRequest deviceType */ - deviceType?: (string|null); + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); - /** CompleteQueryRequest dataset */ - dataset?: (string|null); + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); - /** CompleteQueryRequest maxSuggestions */ - maxSuggestions?: (number|null); + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); } - /** Represents a CompleteQueryRequest. */ - class CompleteQueryRequest implements ICompleteQueryRequest { + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { /** - * Constructs a new CompleteQueryRequest. + * Constructs a new CompletionDetail. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompleteQueryRequest); - - /** CompleteQueryRequest catalog. */ - public catalog: string; - - /** CompleteQueryRequest query. */ - public query: string; - - /** CompleteQueryRequest visitorId. */ - public visitorId: string; - - /** CompleteQueryRequest languageCodes. */ - public languageCodes: string[]; + constructor(properties?: google.cloud.retail.v2.ICompletionDetail); - /** CompleteQueryRequest deviceType. */ - public deviceType: string; + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; - /** CompleteQueryRequest dataset. */ - public dataset: string; + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; - /** CompleteQueryRequest maxSuggestions. */ - public maxSuggestions: number; + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new CompletionDetail instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryRequest instance + * @returns CompletionDetail instance */ - public static create(properties?: google.cloud.retail.v2.ICompleteQueryRequest): google.cloud.retail.v2.CompleteQueryRequest; + public static create(properties?: google.cloud.retail.v2.ICompletionDetail): google.cloud.retail.v2.CompletionDetail; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a CompletionDetail message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryRequest + * @returns CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDetail; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryRequest + * @returns CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDetail; /** - * Verifies a CompleteQueryRequest message. + * Verifies a CompletionDetail message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryRequest + * @returns CompletionDetail */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDetail; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. - * @param message CompleteQueryRequest + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this CompletionDetail to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompleteQueryResponse. */ - interface ICompleteQueryResponse { + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { - /** CompleteQueryResponse completionResults */ - completionResults?: (google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]|null); + /** PurchaseTransaction id */ + id?: (string|null); - /** CompleteQueryResponse attributionToken */ - attributionToken?: (string|null); + /** PurchaseTransaction revenue */ + revenue?: (number|null); - /** CompleteQueryResponse recentSearchResults */ - recentSearchResults?: (google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]|null); + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); } - /** Represents a CompleteQueryResponse. */ - class CompleteQueryResponse implements ICompleteQueryResponse { + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { /** - * Constructs a new CompleteQueryResponse. + * Constructs a new PurchaseTransaction. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompleteQueryResponse); + constructor(properties?: google.cloud.retail.v2.IPurchaseTransaction); - /** CompleteQueryResponse completionResults. */ - public completionResults: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]; + /** PurchaseTransaction id. */ + public id: string; - /** CompleteQueryResponse attributionToken. */ - public attributionToken: string; + /** PurchaseTransaction revenue. */ + public revenue: number; - /** CompleteQueryResponse recentSearchResults. */ - public recentSearchResults: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]; + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new PurchaseTransaction instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryResponse instance + * @returns PurchaseTransaction instance */ - public static create(properties?: google.cloud.retail.v2.ICompleteQueryResponse): google.cloud.retail.v2.CompleteQueryResponse; + public static create(properties?: google.cloud.retail.v2.IPurchaseTransaction): google.cloud.retail.v2.PurchaseTransaction; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes a PurchaseTransaction message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryResponse + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurchaseTransaction; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryResponse + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurchaseTransaction; /** - * Verifies a CompleteQueryResponse message. + * Verifies a PurchaseTransaction message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryResponse + * @returns PurchaseTransaction */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurchaseTransaction; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. - * @param message CompleteQueryResponse + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this PurchaseTransaction to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CompleteQueryResponse { - - /** Properties of a CompletionResult. */ - interface ICompletionResult { - - /** CompletionResult suggestion */ - suggestion?: (string|null); - - /** CompletionResult attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); - } - - /** Represents a CompletionResult. */ - class CompletionResult implements ICompletionResult { - - /** - * Constructs a new CompletionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult); - - /** CompletionResult suggestion. */ - public suggestion: string; - - /** CompletionResult attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - - /** - * Creates a new CompletionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns CompletionResult instance - */ - public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Verifies a CompletionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompletionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @param message CompletionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CompletionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a RecentSearchResult. */ - interface IRecentSearchResult { - - /** RecentSearchResult recentSearch */ - recentSearch?: (string|null); - } - - /** Represents a RecentSearchResult. */ - class RecentSearchResult implements IRecentSearchResult { - - /** - * Constructs a new RecentSearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult); - - /** RecentSearchResult recentSearch. */ - public recentSearch: string; - - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns RecentSearchResult instance - */ - public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Verifies a RecentSearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RecentSearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @param message RecentSearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RecentSearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } - /** Represents a PredictionService */ class PredictionService extends $protobuf.rpc.Service { @@ -32163,6 +32163,256 @@ export namespace google { /** Namespace api. */ namespace api { + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Http. */ interface IHttp { @@ -32502,256 +32752,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** FieldBehavior enum. */ - enum FieldBehavior { - FIELD_BEHAVIOR_UNSPECIFIED = 0, - OPTIONAL = 1, - REQUIRED = 2, - OUTPUT_ONLY = 3, - INPUT_ONLY = 4, - IMMUTABLE = 5, - UNORDERED_LIST = 6, - NON_EMPTY_DEFAULT = 7 - } - - /** Properties of a ResourceDescriptor. */ - interface IResourceDescriptor { - - /** ResourceDescriptor type */ - type?: (string|null); - - /** ResourceDescriptor pattern */ - pattern?: (string[]|null); - - /** ResourceDescriptor nameField */ - nameField?: (string|null); - - /** ResourceDescriptor history */ - history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); - - /** ResourceDescriptor plural */ - plural?: (string|null); - - /** ResourceDescriptor singular */ - singular?: (string|null); - - /** ResourceDescriptor style */ - style?: (google.api.ResourceDescriptor.Style[]|null); - } - - /** Represents a ResourceDescriptor. */ - class ResourceDescriptor implements IResourceDescriptor { - - /** - * Constructs a new ResourceDescriptor. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceDescriptor); - - /** ResourceDescriptor type. */ - public type: string; - - /** ResourceDescriptor pattern. */ - public pattern: string[]; - - /** ResourceDescriptor nameField. */ - public nameField: string; - - /** ResourceDescriptor history. */ - public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); - - /** ResourceDescriptor plural. */ - public plural: string; - - /** ResourceDescriptor singular. */ - public singular: string; - - /** ResourceDescriptor style. */ - public style: google.api.ResourceDescriptor.Style[]; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceDescriptor instance - */ - public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; - - /** - * Verifies a ResourceDescriptor message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceDescriptor - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; - - /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. - * @param message ResourceDescriptor - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceDescriptor to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - namespace ResourceDescriptor { - - /** History enum. */ - enum History { - HISTORY_UNSPECIFIED = 0, - ORIGINALLY_SINGLE_PATTERN = 1, - FUTURE_MULTI_PATTERN = 2 - } - - /** Style enum. */ - enum Style { - STYLE_UNSPECIFIED = 0, - DECLARATIVE_FRIENDLY = 1 - } - } - - /** Properties of a ResourceReference. */ - interface IResourceReference { - - /** ResourceReference type */ - type?: (string|null); - - /** ResourceReference childType */ - childType?: (string|null); - } - - /** Represents a ResourceReference. */ - class ResourceReference implements IResourceReference { - - /** - * Constructs a new ResourceReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceReference); - - /** ResourceReference type. */ - public type: string; - - /** ResourceReference childType. */ - public childType: string; - - /** - * Creates a new ResourceReference instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceReference instance - */ - public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; - - /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; - - /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; - - /** - * Verifies a ResourceReference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceReference - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @param message ResourceReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a HttpBody. */ interface IHttpBody { @@ -35987,193 +35987,85 @@ export namespace google { } } - /** Properties of a Timestamp. */ - interface ITimestamp { - - /** Timestamp seconds */ - seconds?: (number|Long|string|null); - - /** Timestamp nanos */ - nanos?: (number|null); - } - - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { - - /** - * Constructs a new Timestamp. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ITimestamp); - - /** Timestamp seconds. */ - public seconds: (number|Long|string); - - /** Timestamp nanos. */ - public nanos: number; - - /** - * Creates a new Timestamp instance using the specified properties. - * @param [properties] Properties to set - * @returns Timestamp instance - */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; - - /** - * Verifies a Timestamp message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Timestamp - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @param message Timestamp - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Timestamp to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a Duration. */ - interface IDuration { - - /** Duration seconds */ - seconds?: (number|Long|string|null); - - /** Duration nanos */ - nanos?: (number|null); + /** Properties of an Empty. */ + interface IEmpty { } - /** Represents a Duration. */ - class Duration implements IDuration { + /** Represents an Empty. */ + class Empty implements IEmpty { /** - * Constructs a new Duration. + * Constructs a new Empty. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IDuration); - - /** Duration seconds. */ - public seconds: (number|Long|string); - - /** Duration nanos. */ - public nanos: number; + constructor(properties?: google.protobuf.IEmpty); /** - * Creates a new Duration instance using the specified properties. + * Creates a new Empty instance using the specified properties. * @param [properties] Properties to set - * @returns Duration instance + * @returns Empty instance */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes an Empty message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Duration + * @returns Empty * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes an Empty message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Duration + * @returns Empty * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; /** - * Verifies a Duration message. + * Verifies an Empty message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates an Empty message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Duration + * @returns Empty */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @param message Duration + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Duration to JSON. + * Converts this Empty to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -36269,6 +36161,198 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a DoubleValue. */ interface IDoubleValue { @@ -37175,90 +37259,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of an Empty. */ - interface IEmpty { - } - - /** Represents an Empty. */ - class Empty implements IEmpty { - - /** - * Constructs a new Empty. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEmpty); - - /** - * Creates a new Empty instance using the specified properties. - * @param [properties] Properties to set - * @returns Empty instance - */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; - - /** - * Verifies an Empty message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Empty - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @param message Empty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Empty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a Struct. */ interface IStruct { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index d272e456f9a..f4ea68b17ad 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -513,27 +513,193 @@ return Catalog; })(); - v2.Audience = (function() { + v2.CatalogService = (function() { /** - * Properties of an Audience. + * Constructs a new CatalogService service. * @memberof google.cloud.retail.v2 - * @interface IAudience - * @property {Array.|null} [genders] Audience genders - * @property {Array.|null} [ageGroups] Audience ageGroups + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; /** - * Constructs a new Audience. + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + */ + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2.GetDefaultBranchRequest, $root.google.cloud.retail.v2.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an Audience. - * @implements IAudience + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest * @constructor - * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set */ - function Audience(properties) { - this.genders = []; - this.ageGroups = []; + function ListCatalogsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -541,94 +707,101 @@ } /** - * Audience genders. - * @member {Array.} genders - * @memberof google.cloud.retail.v2.Audience + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance */ - Audience.prototype.genders = $util.emptyArray; + ListCatalogsRequest.prototype.parent = ""; /** - * Audience ageGroups. - * @member {Array.} ageGroups - * @memberof google.cloud.retail.v2.Audience + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance */ - Audience.prototype.ageGroups = $util.emptyArray; + ListCatalogsRequest.prototype.pageSize = 0; /** - * Creates a new Audience instance using the specified properties. + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Audience} Audience instance + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance */ - Audience.create = function create(properties) { - return new Audience(properties); + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); }; /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Audience.encode = function encode(message, writer) { + ListCatalogsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.genders != null && message.genders.length) - for (var i = 0; i < message.genders.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); - if (message.ageGroups != null && message.ageGroups.length) - for (var i = 0; i < message.ageGroups.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Audience.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Audience message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Audience} Audience + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Audience.decode = function decode(reader, length) { + ListCatalogsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Audience(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); + message.parent = reader.string(); break; case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -639,143 +812,126 @@ }; /** - * Decodes an Audience message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Audience} Audience + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Audience.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Audience message. + * Verifies a ListCatalogsRequest message. * @function verify - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Audience.verify = function verify(message) { + ListCatalogsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.genders != null && message.hasOwnProperty("genders")) { - if (!Array.isArray(message.genders)) - return "genders: array expected"; - for (var i = 0; i < message.genders.length; ++i) - if (!$util.isString(message.genders[i])) - return "genders: string[] expected"; - } - if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { - if (!Array.isArray(message.ageGroups)) - return "ageGroups: array expected"; - for (var i = 0; i < message.ageGroups.length; ++i) - if (!$util.isString(message.ageGroups[i])) - return "ageGroups: string[] expected"; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Audience} Audience + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest */ - Audience.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Audience) + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) return object; - var message = new $root.google.cloud.retail.v2.Audience(); - if (object.genders) { - if (!Array.isArray(object.genders)) - throw TypeError(".google.cloud.retail.v2.Audience.genders: array expected"); - message.genders = []; - for (var i = 0; i < object.genders.length; ++i) - message.genders[i] = String(object.genders[i]); - } - if (object.ageGroups) { - if (!Array.isArray(object.ageGroups)) - throw TypeError(".google.cloud.retail.v2.Audience.ageGroups: array expected"); - message.ageGroups = []; - for (var i = 0; i < object.ageGroups.length; ++i) - message.ageGroups[i] = String(object.ageGroups[i]); - } + var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.Audience} message Audience + * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Audience.toObject = function toObject(message, options) { + ListCatalogsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.genders = []; - object.ageGroups = []; - } - if (message.genders && message.genders.length) { - object.genders = []; - for (var j = 0; j < message.genders.length; ++j) - object.genders[j] = message.genders[j]; - } - if (message.ageGroups && message.ageGroups.length) { - object.ageGroups = []; - for (var j = 0; j < message.ageGroups.length; ++j) - object.ageGroups[j] = message.ageGroups[j]; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; return object; }; /** - * Converts this Audience to JSON. + * Converts this ListCatalogsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Audience + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance * @returns {Object.} JSON object */ - Audience.prototype.toJSON = function toJSON() { + ListCatalogsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Audience; + return ListCatalogsRequest; })(); - v2.ColorInfo = (function() { + v2.ListCatalogsResponse = (function() { /** - * Properties of a ColorInfo. + * Properties of a ListCatalogsResponse. * @memberof google.cloud.retail.v2 - * @interface IColorInfo - * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies - * @property {Array.|null} [colors] ColorInfo colors + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken */ /** - * Constructs a new ColorInfo. + * Constructs a new ListCatalogsResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse * @constructor - * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set */ - function ColorInfo(properties) { - this.colorFamilies = []; - this.colors = []; + function ListCatalogsResponse(properties) { + this.catalogs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -783,94 +939,91 @@ } /** - * ColorInfo colorFamilies. - * @member {Array.} colorFamilies - * @memberof google.cloud.retail.v2.ColorInfo + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance */ - ColorInfo.prototype.colorFamilies = $util.emptyArray; + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; /** - * ColorInfo colors. - * @member {Array.} colors - * @memberof google.cloud.retail.v2.ColorInfo + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance */ - ColorInfo.prototype.colors = $util.emptyArray; + ListCatalogsResponse.prototype.nextPageToken = ""; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo instance + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); }; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encode = function encode(message, writer) { + ListCatalogsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.colorFamilies != null && message.colorFamilies.length) - for (var i = 0; i < message.colorFamilies.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decode = function decode(reader, length) { + ListCatalogsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ColorInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); break; case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -881,145 +1034,134 @@ }; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ColorInfo message. + * Verifies a ListCatalogsResponse message. * @function verify - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ColorInfo.verify = function verify(message) { + ListCatalogsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { - if (!Array.isArray(message.colorFamilies)) - return "colorFamilies: array expected"; - for (var i = 0; i < message.colorFamilies.length; ++i) - if (!$util.isString(message.colorFamilies[i])) - return "colorFamilies: string[] expected"; - } - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) - if (!$util.isString(message.colors[i])) - return "colors: string[] expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ColorInfo) + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) return object; - var message = new $root.google.cloud.retail.v2.ColorInfo(); - if (object.colorFamilies) { - if (!Array.isArray(object.colorFamilies)) - throw TypeError(".google.cloud.retail.v2.ColorInfo.colorFamilies: array expected"); - message.colorFamilies = []; - for (var i = 0; i < object.colorFamilies.length; ++i) - message.colorFamilies[i] = String(object.colorFamilies[i]); - } - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.retail.v2.ColorInfo.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) - message.colors[i] = String(object.colors[i]); + var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); + } } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.ColorInfo} message ColorInfo + * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ColorInfo.toObject = function toObject(message, options) { + ListCatalogsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.colorFamilies = []; - object.colors = []; - } - if (message.colorFamilies && message.colorFamilies.length) { - object.colorFamilies = []; - for (var j = 0; j < message.colorFamilies.length; ++j) - object.colorFamilies[j] = message.colorFamilies[j]; - } - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = message.colors[j]; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this ColorInfo to JSON. + * Converts this ListCatalogsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ColorInfo + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance * @returns {Object.} JSON object */ - ColorInfo.prototype.toJSON = function toJSON() { + ListCatalogsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ColorInfo; + return ListCatalogsResponse; })(); - v2.CustomAttribute = (function() { + v2.UpdateCatalogRequest = (function() { /** - * Properties of a CustomAttribute. + * Properties of an UpdateCatalogRequest. * @memberof google.cloud.retail.v2 - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers - * @property {boolean|null} [searchable] CustomAttribute searchable - * @property {boolean|null} [indexable] CustomAttribute indexable + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask */ /** - * Constructs a new CustomAttribute. + * Constructs a new UpdateCatalogRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest * @constructor - * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; + function UpdateCatalogRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1027,153 +1169,88 @@ } /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.text = $util.emptyArray; - - /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.numbers = $util.emptyArray; - - /** - * CustomAttribute searchable. - * @member {boolean|null|undefined} searchable - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.searchable = null; - - /** - * CustomAttribute indexable. - * @member {boolean|null|undefined} indexable - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.indexable = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * CustomAttribute _searchable. - * @member {"searchable"|undefined} _searchable - * @memberof google.cloud.retail.v2.CustomAttribute + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance */ - Object.defineProperty(CustomAttribute.prototype, "_searchable", { - get: $util.oneOfGetter($oneOfFields = ["searchable"]), - set: $util.oneOfSetter($oneOfFields) - }); + UpdateCatalogRequest.prototype.catalog = null; /** - * CustomAttribute _indexable. - * @member {"indexable"|undefined} _indexable - * @memberof google.cloud.retail.v2.CustomAttribute + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance */ - Object.defineProperty(CustomAttribute.prototype, "_indexable", { - get: $util.oneOfGetter($oneOfFields = ["indexable"]), - set: $util.oneOfSetter($oneOfFields) - }); + UpdateCatalogRequest.prototype.updateMask = null; /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); }; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encode = function encode(message, writer) { + UpdateCatalogRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } - if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); - if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decode = function decode(reader, length) { + UpdateCatalogRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); + message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); break; case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1184,167 +1261,128 @@ }; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomAttribute message. + * Verifies an UpdateCatalogRequest message. * @function verify - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomAttribute.verify = function verify(message) { + UpdateCatalogRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - properties._searchable = 1; - if (typeof message.searchable !== "boolean") - return "searchable: boolean expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - properties._indexable = 1; - if (typeof message.indexable !== "boolean") - return "indexable: boolean expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } return null; }; /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) return object; - var message = new $root.google.cloud.retail.v2.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); + var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } - if (object.searchable != null) - message.searchable = Boolean(object.searchable); - if (object.indexable != null) - message.indexable = Boolean(object.indexable); return message; }; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute + * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomAttribute.toObject = function toObject(message, options) { + UpdateCatalogRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - object.searchable = message.searchable; - if (options.oneofs) - object._searchable = "searchable"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - object.indexable = message.indexable; - if (options.oneofs) - object._indexable = "indexable"; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this CustomAttribute to JSON. + * Converts this UpdateCatalogRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CustomAttribute + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance * @returns {Object.} JSON object */ - CustomAttribute.prototype.toJSON = function toJSON() { + UpdateCatalogRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomAttribute; + return UpdateCatalogRequest; })(); - v2.FulfillmentInfo = (function() { + v2.SetDefaultBranchRequest = (function() { /** - * Properties of a FulfillmentInfo. + * Properties of a SetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @interface IFulfillmentInfo - * @property {string|null} [type] FulfillmentInfo type - * @property {Array.|null} [placeIds] FulfillmentInfo placeIds + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note */ /** - * Constructs a new FulfillmentInfo. + * Constructs a new SetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a FulfillmentInfo. - * @implements IFulfillmentInfo + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set */ - function FulfillmentInfo(properties) { - this.placeIds = []; + function SetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1352,91 +1390,101 @@ } /** - * FulfillmentInfo type. - * @member {string} type - * @memberof google.cloud.retail.v2.FulfillmentInfo + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance */ - FulfillmentInfo.prototype.type = ""; + SetDefaultBranchRequest.prototype.catalog = ""; /** - * FulfillmentInfo placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2.FulfillmentInfo + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance */ - FulfillmentInfo.prototype.placeIds = $util.emptyArray; + SetDefaultBranchRequest.prototype.branchId = ""; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.note = ""; + + /** + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest instance */ - FulfillmentInfo.create = function create(properties) { - return new FulfillmentInfo(properties); + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); }; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encode = function encode(message, writer) { + SetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decode = function decode(reader, length) { + SetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.FulfillmentInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.string(); + message.catalog = reader.string(); break; case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + message.branchId = reader.string(); + break; + case 3: + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -1447,130 +1495,124 @@ }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FulfillmentInfo message. + * Verifies a SetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FulfillmentInfo.verify = function verify(message) { + SetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest */ - FulfillmentInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.FulfillmentInfo) + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2.FulfillmentInfo(); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2.FulfillmentInfo.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } + var message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.FulfillmentInfo} message FulfillmentInfo + * @param {google.cloud.retail.v2.SetDefaultBranchRequest} message SetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FulfillmentInfo.toObject = function toObject(message, options) { + SetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) - object.type = ""; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (options.defaults) { + object.catalog = ""; + object.branchId = ""; + object.note = ""; } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - FulfillmentInfo.prototype.toJSON = function toJSON() { + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FulfillmentInfo; + return SetDefaultBranchRequest; })(); - v2.Image = (function() { + v2.GetDefaultBranchRequest = (function() { /** - * Properties of an Image. + * Properties of a GetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @interface IImage - * @property {string|null} [uri] Image uri - * @property {number|null} [height] Image height - * @property {number|null} [width] Image width + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog */ /** - * Constructs a new Image. + * Constructs a new GetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2.IImage=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set */ - function Image(properties) { + function GetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1578,101 +1620,75 @@ } /** - * Image uri. - * @member {string} uri - * @memberof google.cloud.retail.v2.Image - * @instance - */ - Image.prototype.uri = ""; - - /** - * Image height. - * @member {number} height - * @memberof google.cloud.retail.v2.Image - * @instance - */ - Image.prototype.height = 0; - - /** - * Image width. - * @member {number} width - * @memberof google.cloud.retail.v2.Image + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @instance */ - Image.prototype.width = 0; + GetDefaultBranchRequest.prototype.catalog = ""; /** - * Creates a new Image instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IImage=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Image} Image instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest instance */ - Image.create = function create(properties) { - return new Image(properties); + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + GetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Image} Image + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + GetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); + message.catalog = reader.string(); break; default: reader.skipType(tag & 7); @@ -1683,127 +1699,109 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Image} Image + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a GetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + GetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Image} Image + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Image) + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2.Image(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.height != null) - message.height = object.height | 0; - if (object.width != null) - message.width = object.width | 0; + var message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.Image} message Image + * @param {google.cloud.retail.v2.GetDefaultBranchRequest} message GetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + GetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.uri = ""; - object.height = 0; - object.width = 0; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; return object; }; /** - * Converts this Image to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Image + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return GetDefaultBranchRequest; })(); - v2.Interval = (function() { + v2.GetDefaultBranchResponse = (function() { /** - * Properties of an Interval. + * Properties of a GetDefaultBranchResponse. * @memberof google.cloud.retail.v2 - * @interface IInterval - * @property {number|null} [minimum] Interval minimum - * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum - * @property {number|null} [maximum] Interval maximum - * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note */ /** - * Constructs a new Interval. + * Constructs a new GetDefaultBranchResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents an Interval. - * @implements IInterval + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse * @constructor - * @param {google.cloud.retail.v2.IInterval=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set */ - function Interval(properties) { + function GetDefaultBranchResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1811,139 +1809,101 @@ } /** - * Interval minimum. - * @member {number|null|undefined} minimum - * @memberof google.cloud.retail.v2.Interval - * @instance - */ - Interval.prototype.minimum = null; - - /** - * Interval exclusiveMinimum. - * @member {number|null|undefined} exclusiveMinimum - * @memberof google.cloud.retail.v2.Interval - * @instance - */ - Interval.prototype.exclusiveMinimum = null; - - /** - * Interval maximum. - * @member {number|null|undefined} maximum - * @memberof google.cloud.retail.v2.Interval - * @instance - */ - Interval.prototype.maximum = null; - - /** - * Interval exclusiveMaximum. - * @member {number|null|undefined} exclusiveMaximum - * @memberof google.cloud.retail.v2.Interval + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance */ - Interval.prototype.exclusiveMaximum = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + GetDefaultBranchResponse.prototype.branch = ""; /** - * Interval min. - * @member {"minimum"|"exclusiveMinimum"|undefined} min - * @memberof google.cloud.retail.v2.Interval + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance */ - Object.defineProperty(Interval.prototype, "min", { - get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetDefaultBranchResponse.prototype.setTime = null; /** - * Interval max. - * @member {"maximum"|"exclusiveMaximum"|undefined} max - * @memberof google.cloud.retail.v2.Interval + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance */ - Object.defineProperty(Interval.prototype, "max", { - get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), - set: $util.oneOfSetter($oneOfFields) - }); + GetDefaultBranchResponse.prototype.note = ""; /** - * Creates a new Interval instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IInterval=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Interval} Interval instance + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse instance */ - Interval.create = function create(properties) { - return new Interval(properties); + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); }; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IInterval} message Interval message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Interval.encode = function encode(message, writer) { + GetDefaultBranchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); - if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); - if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) - writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); - if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) - writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IInterval} message Interval message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Interval.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Interval} Interval + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Interval.decode = function decode(reader, length) { + GetDefaultBranchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Interval(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.minimum = reader.double(); + message.branch = reader.string(); break; case 2: - message.exclusiveMinimum = reader.double(); + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.maximum = reader.double(); - break; - case 4: - message.exclusiveMaximum = reader.double(); + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -1954,157 +1914,132 @@ }; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Interval} Interval + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Interval.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Interval message. + * Verifies a GetDefaultBranchResponse message. * @function verify - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Interval.verify = function verify(message) { + GetDefaultBranchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - properties.min = 1; - if (typeof message.minimum !== "number") - return "minimum: number expected"; - } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - if (properties.min === 1) - return "min: multiple values"; - properties.min = 1; - if (typeof message.exclusiveMinimum !== "number") - return "exclusiveMinimum: number expected"; - } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - properties.max = 1; - if (typeof message.maximum !== "number") - return "maximum: number expected"; - } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - if (properties.max === 1) - return "max: multiple values"; - properties.max = 1; - if (typeof message.exclusiveMaximum !== "number") - return "exclusiveMaximum: number expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; } + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Interval} Interval + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse */ - Interval.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Interval) + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchResponse) return object; - var message = new $root.google.cloud.retail.v2.Interval(); - if (object.minimum != null) - message.minimum = Number(object.minimum); - if (object.exclusiveMinimum != null) - message.exclusiveMinimum = Number(object.exclusiveMinimum); - if (object.maximum != null) - message.maximum = Number(object.maximum); - if (object.exclusiveMaximum != null) - message.exclusiveMaximum = Number(object.exclusiveMaximum); + var message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.Interval} message Interval + * @param {google.cloud.retail.v2.GetDefaultBranchResponse} message GetDefaultBranchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Interval.toObject = function toObject(message, options) { + GetDefaultBranchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; - if (options.oneofs) - object.min = "minimum"; - } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; - if (options.oneofs) - object.min = "exclusiveMinimum"; - } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; - if (options.oneofs) - object.max = "maximum"; - } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; - if (options.oneofs) - object.max = "exclusiveMaximum"; + if (options.defaults) { + object.branch = ""; + object.setTime = null; + object.note = ""; } + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this Interval to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Interval + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance * @returns {Object.} JSON object */ - Interval.prototype.toJSON = function toJSON() { + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Interval; + return GetDefaultBranchResponse; })(); - v2.PriceInfo = (function() { + v2.Audience = (function() { /** - * Properties of a PriceInfo. + * Properties of an Audience. * @memberof google.cloud.retail.v2 - * @interface IPriceInfo - * @property {string|null} [currencyCode] PriceInfo currencyCode - * @property {number|null} [price] PriceInfo price - * @property {number|null} [originalPrice] PriceInfo originalPrice - * @property {number|null} [cost] PriceInfo cost - * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime - * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime - * @property {google.cloud.retail.v2.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups */ /** - * Constructs a new PriceInfo. + * Constructs a new Audience. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PriceInfo. - * @implements IPriceInfo + * @classdesc Represents an Audience. + * @implements IAudience * @constructor - * @param {google.cloud.retail.v2.IPriceInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set */ - function PriceInfo(properties) { + function Audience(properties) { + this.genders = []; + this.ageGroups = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2112,153 +2047,336 @@ } /** - * PriceInfo currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2.PriceInfo + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2.Audience * @instance */ - PriceInfo.prototype.currencyCode = ""; + Audience.prototype.genders = $util.emptyArray; /** - * PriceInfo price. - * @member {number} price - * @memberof google.cloud.retail.v2.PriceInfo + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2.Audience * @instance */ - PriceInfo.prototype.price = 0; + Audience.prototype.ageGroups = $util.emptyArray; /** - * PriceInfo originalPrice. - * @member {number} originalPrice - * @memberof google.cloud.retail.v2.PriceInfo - * @instance + * Creates a new Audience instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Audience} Audience instance */ - PriceInfo.prototype.originalPrice = 0; + Audience.create = function create(properties) { + return new Audience(properties); + }; /** - * PriceInfo cost. - * @member {number} cost - * @memberof google.cloud.retail.v2.PriceInfo - * @instance + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - PriceInfo.prototype.cost = 0; + Audience.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); + return writer; + }; /** - * PriceInfo priceEffectiveTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime - * @memberof google.cloud.retail.v2.PriceInfo + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Audience.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Audience message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Audience} Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Audience.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Audience(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); + break; + case 2: + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Audience message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Audience} Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Audience.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Audience message. + * @function verify + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Audience.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; + } + return null; + }; + + /** + * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Audience} Audience + */ + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Audience) + return object; + var message = new $root.google.cloud.retail.v2.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); + } + return message; + }; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {google.cloud.retail.v2.Audience} message Audience + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Audience.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; + } + return object; + }; + + /** + * Converts this Audience to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Audience * @instance + * @returns {Object.} JSON object */ - PriceInfo.prototype.priceEffectiveTime = null; + Audience.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Audience; + })(); + + v2.ColorInfo = (function() { /** - * PriceInfo priceExpireTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime - * @memberof google.cloud.retail.v2.PriceInfo + * Properties of a ColorInfo. + * @memberof google.cloud.retail.v2 + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors + */ + + /** + * Constructs a new ColorInfo. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ColorInfo. + * @implements IColorInfo + * @constructor + * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set + */ + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2.ColorInfo * @instance */ - PriceInfo.prototype.priceExpireTime = null; + ColorInfo.prototype.colorFamilies = $util.emptyArray; /** - * PriceInfo priceRange. - * @member {google.cloud.retail.v2.PriceInfo.IPriceRange|null|undefined} priceRange - * @memberof google.cloud.retail.v2.PriceInfo + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2.ColorInfo * @instance */ - PriceInfo.prototype.priceRange = null; + ColorInfo.prototype.colors = $util.emptyArray; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.IPriceInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo instance + * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo instance */ - PriceInfo.create = function create(properties) { - return new PriceInfo(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) - $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) - $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) - $root.google.cloud.retail.v2.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); return writer; }; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decode = function decode(reader, length) { + ColorInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PriceInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.currencyCode = reader.string(); + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); break; case 2: - message.price = reader.float(); - break; - case 3: - message.originalPrice = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.decode(reader, reader.uint32()); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -2269,394 +2387,145 @@ }; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PriceInfo message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PriceInfo.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - if (message.price != null && message.hasOwnProperty("price")) - if (typeof message.price !== "number") - return "price: number expected"; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - if (typeof message.originalPrice !== "number") - return "originalPrice: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); - if (error) - return "priceEffectiveTime." + error; - } - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); - if (error) - return "priceExpireTime." + error; + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; } - if (message.priceRange != null && message.hasOwnProperty("priceRange")) { - var error = $root.google.cloud.retail.v2.PriceInfo.PriceRange.verify(message.priceRange); - if (error) - return "priceRange." + error; + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; } return null; }; /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo */ - PriceInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PriceInfo) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ColorInfo) return object; - var message = new $root.google.cloud.retail.v2.PriceInfo(); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - if (object.price != null) - message.price = Number(object.price); - if (object.originalPrice != null) - message.originalPrice = Number(object.originalPrice); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.priceEffectiveTime != null) { - if (typeof object.priceEffectiveTime !== "object") - throw TypeError(".google.cloud.retail.v2.PriceInfo.priceEffectiveTime: object expected"); - message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); - } - if (object.priceExpireTime != null) { - if (typeof object.priceExpireTime !== "object") - throw TypeError(".google.cloud.retail.v2.PriceInfo.priceExpireTime: object expected"); - message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + var message = new $root.google.cloud.retail.v2.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); } - if (object.priceRange != null) { - if (typeof object.priceRange !== "object") - throw TypeError(".google.cloud.retail.v2.PriceInfo.priceRange: object expected"); - message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.fromObject(object.priceRange); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); } return message; }; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @static - * @param {google.cloud.retail.v2.PriceInfo} message PriceInfo + * @param {google.cloud.retail.v2.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PriceInfo.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.currencyCode = ""; - object.price = 0; - object.originalPrice = 0; - object.cost = 0; - object.priceEffectiveTime = null; - object.priceExpireTime = null; - object.priceRange = null; + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; + } + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; + } + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; } - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - if (message.price != null && message.hasOwnProperty("price")) - object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) - object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) - object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); - if (message.priceRange != null && message.hasOwnProperty("priceRange")) - object.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; /** - * Converts this PriceInfo to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PriceInfo + * @memberof google.cloud.retail.v2.ColorInfo * @instance * @returns {Object.} JSON object */ - PriceInfo.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PriceInfo.PriceRange = (function() { + return ColorInfo; + })(); - /** - * Properties of a PriceRange. - * @memberof google.cloud.retail.v2.PriceInfo - * @interface IPriceRange - * @property {google.cloud.retail.v2.IInterval|null} [price] PriceRange price - * @property {google.cloud.retail.v2.IInterval|null} [originalPrice] PriceRange originalPrice - */ - - /** - * Constructs a new PriceRange. - * @memberof google.cloud.retail.v2.PriceInfo - * @classdesc Represents a PriceRange. - * @implements IPriceRange - * @constructor - * @param {google.cloud.retail.v2.PriceInfo.IPriceRange=} [properties] Properties to set - */ - function PriceRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PriceRange price. - * @member {google.cloud.retail.v2.IInterval|null|undefined} price - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.price = null; - - /** - * PriceRange originalPrice. - * @member {google.cloud.retail.v2.IInterval|null|undefined} originalPrice - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.originalPrice = null; - - /** - * Creates a new PriceRange instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2.PriceInfo.IPriceRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange instance - */ - PriceRange.create = function create(properties) { - return new PriceRange(properties); - }; - - /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2.PriceInfo.IPriceRange} message PriceRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - $root.google.cloud.retail.v2.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - $root.google.cloud.retail.v2.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2.PriceInfo.IPriceRange} message PriceRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PriceRange message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PriceInfo.PriceRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); - break; - case 2: - message.originalPrice = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PriceRange message. - * @function verify - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PriceRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.price != null && message.hasOwnProperty("price")) { - var error = $root.google.cloud.retail.v2.Interval.verify(message.price); - if (error) - return "price." + error; - } - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { - var error = $root.google.cloud.retail.v2.Interval.verify(message.originalPrice); - if (error) - return "originalPrice." + error; - } - return null; - }; - - /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange - */ - PriceRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PriceInfo.PriceRange) - return object; - var message = new $root.google.cloud.retail.v2.PriceInfo.PriceRange(); - if (object.price != null) { - if (typeof object.price !== "object") - throw TypeError(".google.cloud.retail.v2.PriceInfo.PriceRange.price: object expected"); - message.price = $root.google.cloud.retail.v2.Interval.fromObject(object.price); - } - if (object.originalPrice != null) { - if (typeof object.originalPrice !== "object") - throw TypeError(".google.cloud.retail.v2.PriceInfo.PriceRange.originalPrice: object expected"); - message.originalPrice = $root.google.cloud.retail.v2.Interval.fromObject(object.originalPrice); - } - return message; - }; - - /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2.PriceInfo.PriceRange} message PriceRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PriceRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.price = null; - object.originalPrice = null; - } - if (message.price != null && message.hasOwnProperty("price")) - object.price = $root.google.cloud.retail.v2.Interval.toObject(message.price, options); - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = $root.google.cloud.retail.v2.Interval.toObject(message.originalPrice, options); - return object; - }; - - /** - * Converts this PriceRange to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.PriceInfo.PriceRange - * @instance - * @returns {Object.} JSON object - */ - PriceRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PriceRange; - })(); - - return PriceInfo; - })(); - - v2.Rating = (function() { + v2.CustomAttribute = (function() { /** - * Properties of a Rating. + * Properties of a CustomAttribute. * @memberof google.cloud.retail.v2 - * @interface IRating - * @property {number|null} [ratingCount] Rating ratingCount - * @property {number|null} [averageRating] Rating averageRating - * @property {Array.|null} [ratingHistogram] Rating ratingHistogram + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable */ /** - * Constructs a new Rating. + * Constructs a new CustomAttribute. * @memberof google.cloud.retail.v2 - * @classdesc Represents a Rating. - * @implements IRating + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute * @constructor - * @param {google.cloud.retail.v2.IRating=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set */ - function Rating(properties) { - this.ratingHistogram = []; + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2664,112 +2533,153 @@ } /** - * Rating ratingCount. - * @member {number} ratingCount - * @memberof google.cloud.retail.v2.Rating + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2.CustomAttribute * @instance */ - Rating.prototype.ratingCount = 0; + CustomAttribute.prototype.text = $util.emptyArray; /** - * Rating averageRating. - * @member {number} averageRating - * @memberof google.cloud.retail.v2.Rating + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2.CustomAttribute * @instance */ - Rating.prototype.averageRating = 0; + CustomAttribute.prototype.numbers = $util.emptyArray; /** - * Rating ratingHistogram. - * @member {Array.} ratingHistogram - * @memberof google.cloud.retail.v2.Rating + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2.CustomAttribute * @instance */ - Rating.prototype.ratingHistogram = $util.emptyArray; + CustomAttribute.prototype.searchable = null; /** - * Creates a new Rating instance using the specified properties. + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.indexable = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.IRating=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Rating} Rating instance + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance */ - Rating.create = function create(properties) { - return new Rating(properties); + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); }; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.IRating} message Rating message or plain object to encode + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rating.encode = function encode(message, writer) { + CustomAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); - if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); - if (message.ratingHistogram != null && message.ratingHistogram.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (var i = 0; i < message.ratingHistogram.length; ++i) - writer.int32(message.ratingHistogram[i]); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); writer.ldelim(); } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.IRating} message Rating message or plain object to encode + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rating.encodeDelimited = function encodeDelimited(message, writer) { + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Rating} Rating + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rating.decode = function decode(reader, length) { + CustomAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rating(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.ratingCount = reader.int32(); + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); break; case 2: - message.averageRating = reader.float(); - break; - case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; + if (!(message.numbers && message.numbers.length)) + message.numbers = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) - message.ratingHistogram.push(reader.int32()); + message.numbers.push(reader.double()); } else - message.ratingHistogram.push(reader.int32()); + message.numbers.push(reader.double()); + break; + case 3: + message.searchable = reader.bool(); + break; + case 4: + message.indexable = reader.bool(); break; default: reader.skipType(tag & 7); @@ -2780,140 +2690,167 @@ }; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Rating} Rating + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rating.decodeDelimited = function decodeDelimited(reader) { + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Rating message. + * Verifies a CustomAttribute message. * @function verify - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rating.verify = function verify(message) { + CustomAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - if (!$util.isInteger(message.ratingCount)) - return "ratingCount: integer expected"; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - if (typeof message.averageRating !== "number") - return "averageRating: number expected"; - if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { - if (!Array.isArray(message.ratingHistogram)) - return "ratingHistogram: array expected"; - for (var i = 0; i < message.ratingHistogram.length; ++i) - if (!$util.isInteger(message.ratingHistogram[i])) - return "ratingHistogram: integer[] expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; } return null; }; /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Rating} Rating + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute */ - Rating.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Rating) + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) return object; - var message = new $root.google.cloud.retail.v2.Rating(); - if (object.ratingCount != null) - message.ratingCount = object.ratingCount | 0; - if (object.averageRating != null) - message.averageRating = Number(object.averageRating); - if (object.ratingHistogram) { - if (!Array.isArray(object.ratingHistogram)) - throw TypeError(".google.cloud.retail.v2.Rating.ratingHistogram: array expected"); - message.ratingHistogram = []; - for (var i = 0; i < object.ratingHistogram.length; ++i) - message.ratingHistogram[i] = object.ratingHistogram[i] | 0; + var message = new $root.google.cloud.retail.v2.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); return message; }; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @static - * @param {google.cloud.retail.v2.Rating} message Rating + * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Rating.toObject = function toObject(message, options) { + CustomAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.ratingHistogram = []; - if (options.defaults) { - object.ratingCount = 0; - object.averageRating = 0; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; } - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - object.ratingCount = message.ratingCount; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; - if (message.ratingHistogram && message.ratingHistogram.length) { - object.ratingHistogram = []; - for (var j = 0; j < message.ratingHistogram.length; ++j) - object.ratingHistogram[j] = message.ratingHistogram[j]; + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; + if (options.oneofs) + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; } return object; }; /** - * Converts this Rating to JSON. + * Converts this CustomAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Rating + * @memberof google.cloud.retail.v2.CustomAttribute * @instance * @returns {Object.} JSON object */ - Rating.prototype.toJSON = function toJSON() { + CustomAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Rating; + return CustomAttribute; })(); - v2.UserInfo = (function() { + v2.FulfillmentInfo = (function() { /** - * Properties of a UserInfo. + * Properties of a FulfillmentInfo. * @memberof google.cloud.retail.v2 - * @interface IUserInfo - * @property {string|null} [userId] UserInfo userId - * @property {string|null} [ipAddress] UserInfo ipAddress - * @property {string|null} [userAgent] UserInfo userAgent - * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds */ /** - * Constructs a new UserInfo. + * Constructs a new FulfillmentInfo. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserInfo. - * @implements IUserInfo + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo * @constructor - * @param {google.cloud.retail.v2.IUserInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set */ - function UserInfo(properties) { + function FulfillmentInfo(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2921,114 +2858,91 @@ } /** - * UserInfo userId. - * @member {string} userId - * @memberof google.cloud.retail.v2.UserInfo - * @instance - */ - UserInfo.prototype.userId = ""; - - /** - * UserInfo ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.retail.v2.UserInfo - * @instance - */ - UserInfo.prototype.ipAddress = ""; - - /** - * UserInfo userAgent. - * @member {string} userAgent - * @memberof google.cloud.retail.v2.UserInfo + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2.FulfillmentInfo * @instance */ - UserInfo.prototype.userAgent = ""; + FulfillmentInfo.prototype.type = ""; /** - * UserInfo directUserRequest. - * @member {boolean} directUserRequest - * @memberof google.cloud.retail.v2.UserInfo + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.FulfillmentInfo * @instance */ - UserInfo.prototype.directUserRequest = false; + FulfillmentInfo.prototype.placeIds = $util.emptyArray; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.IUserInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserInfo} UserInfo instance + * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo instance */ - UserInfo.create = function create(properties) { - return new UserInfo(properties); + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); }; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encode = function encode(message, writer) { + FulfillmentInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); return writer; }; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserInfo} UserInfo + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decode = function decode(reader, length) { + FulfillmentInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.FulfillmentInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userId = reader.string(); + message.type = reader.string(); break; case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -3039,132 +2953,130 @@ }; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserInfo} UserInfo + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decodeDelimited = function decodeDelimited(reader) { + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserInfo message. + * Verifies a FulfillmentInfo message. * @function verify - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserInfo.verify = function verify(message) { + FulfillmentInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userId != null && message.hasOwnProperty("userId")) - if (!$util.isString(message.userId)) - return "userId: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - if (typeof message.directUserRequest !== "boolean") - return "directUserRequest: boolean expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } return null; }; /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UserInfo} UserInfo + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo */ - UserInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UserInfo) + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.FulfillmentInfo) return object; - var message = new $root.google.cloud.retail.v2.UserInfo(); - if (object.userId != null) - message.userId = String(object.userId); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.directUserRequest != null) - message.directUserRequest = Boolean(object.directUserRequest); + var message = new $root.google.cloud.retail.v2.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } return message; }; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @static - * @param {google.cloud.retail.v2.UserInfo} message UserInfo + * @param {google.cloud.retail.v2.FulfillmentInfo} message FulfillmentInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserInfo.toObject = function toObject(message, options) { + FulfillmentInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.userId = ""; - object.ipAddress = ""; - object.userAgent = ""; - object.directUserRequest = false; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; } - if (message.userId != null && message.hasOwnProperty("userId")) - object.userId = message.userId; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this UserInfo to JSON. + * Converts this FulfillmentInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UserInfo + * @memberof google.cloud.retail.v2.FulfillmentInfo * @instance * @returns {Object.} JSON object */ - UserInfo.prototype.toJSON = function toJSON() { + FulfillmentInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserInfo; + return FulfillmentInfo; })(); - v2.Promotion = (function() { + v2.Image = (function() { /** - * Properties of a Promotion. + * Properties of an Image. * @memberof google.cloud.retail.v2 - * @interface IPromotion - * @property {string|null} [promotionId] Promotion promotionId + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width */ /** - * Constructs a new Promotion. + * Constructs a new Image. * @memberof google.cloud.retail.v2 - * @classdesc Represents a Promotion. - * @implements IPromotion + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImage=} [properties] Properties to set */ - function Promotion(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3172,75 +3084,101 @@ } /** - * Promotion promotionId. - * @member {string} promotionId - * @memberof google.cloud.retail.v2.Promotion + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.Image * @instance */ - Promotion.prototype.promotionId = ""; + Image.prototype.uri = ""; /** - * Creates a new Promotion instance using the specified properties. + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2.Image + * @instance + */ + Image.prototype.height = 0; + + /** + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static - * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Promotion} Promotion instance + * @param {google.cloud.retail.v2.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Image} Image instance */ - Promotion.create = function create(properties) { - return new Promotion(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static - * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); return writer; }; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static - * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Promotion} Promotion + * @returns {google.cloud.retail.v2.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decode = function decode(reader, length) { + Image.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Promotion(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.promotionId = reader.string(); + message.uri = reader.string(); + break; + case 2: + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); break; default: reader.skipType(tag & 7); @@ -3251,109 +3189,127 @@ }; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Promotion} Promotion + * @returns {google.cloud.retail.v2.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Promotion message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Promotion.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - if (!$util.isString(message.promotionId)) - return "promotionId: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; return null; }; /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Promotion} Promotion + * @returns {google.cloud.retail.v2.Image} Image */ - Promotion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Promotion) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Image) return object; - var message = new $root.google.cloud.retail.v2.Promotion(); - if (object.promotionId != null) - message.promotionId = String(object.promotionId); + var message = new $root.google.cloud.retail.v2.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; return message; }; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @static - * @param {google.cloud.retail.v2.Promotion} message Promotion + * @param {google.cloud.retail.v2.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Promotion.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.promotionId = ""; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - object.promotionId = message.promotionId; + if (options.defaults) { + object.uri = ""; + object.height = 0; + object.width = 0; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; return object; }; /** - * Converts this Promotion to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.Image * @instance * @returns {Object.} JSON object */ - Promotion.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Promotion; + return Image; })(); - v2.GcsSource = (function() { + v2.Interval = (function() { /** - * Properties of a GcsSource. + * Properties of an Interval. * @memberof google.cloud.retail.v2 - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum */ /** - * Constructs a new GcsSource. + * Constructs a new Interval. * @memberof google.cloud.retail.v2 - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents an Interval. + * @implements IInterval * @constructor - * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IInterval=} [properties] Properties to set */ - function GcsSource(properties) { - this.inputUris = []; + function Interval(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3361,91 +3317,139 @@ } /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2.GcsSource + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2.Interval * @instance */ - GcsSource.prototype.inputUris = $util.emptyArray; + Interval.prototype.minimum = null; /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2.GcsSource + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2.Interval * @instance */ - GcsSource.prototype.dataSchema = ""; + Interval.prototype.exclusiveMinimum = null; /** - * Creates a new GcsSource instance using the specified properties. + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Interval.prototype.maximum = null; + + /** + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Interval instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static - * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GcsSource} GcsSource instance + * @param {google.cloud.retail.v2.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Interval} Interval instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + Interval.create = function create(properties) { + return new Interval(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static - * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + Interval.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static - * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + Interval.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + Interval.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Interval(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); + message.minimum = reader.double(); break; case 2: - message.dataSchema = reader.string(); + message.exclusiveMinimum = reader.double(); + break; + case 3: + message.maximum = reader.double(); + break; + case 4: + message.exclusiveMaximum = reader.double(); break; default: reader.skipType(tag & 7); @@ -3456,133 +3460,157 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + Interval.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies an Interval message. * @function verify - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + Interval.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.Interval} Interval */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GcsSource) + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Interval) return object; - var message = new $root.google.cloud.retail.v2.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); - } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); + var message = new $root.google.cloud.retail.v2.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from an Interval message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @static - * @param {google.cloud.retail.v2.GcsSource} message GcsSource + * @param {google.cloud.retail.v2.Interval} message Interval * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + Interval.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.inputUris = []; - if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; return object; }; /** - * Converts this GcsSource to JSON. + * Converts this Interval to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.Interval * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + Interval.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return Interval; })(); - v2.BigQuerySource = (function() { + v2.PriceInfo = (function() { /** - * Properties of a BigQuerySource. + * Properties of a PriceInfo. * @memberof google.cloud.retail.v2 - * @interface IBigQuerySource - * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange */ /** - * Constructs a new BigQuerySource. + * Constructs a new PriceInfo. * @memberof google.cloud.retail.v2 - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo * @constructor - * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IPriceInfo=} [properties] Properties to set */ - function BigQuerySource(properties) { + function PriceInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3590,154 +3618,153 @@ } /** - * BigQuerySource partitionDate. - * @member {google.type.IDate|null|undefined} partitionDate - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - BigQuerySource.prototype.partitionDate = null; + PriceInfo.prototype.currencyCode = ""; /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - BigQuerySource.prototype.projectId = ""; + PriceInfo.prototype.price = 0; /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - BigQuerySource.prototype.datasetId = ""; + PriceInfo.prototype.originalPrice = 0; /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - BigQuerySource.prototype.tableId = ""; + PriceInfo.prototype.cost = 0; /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - BigQuerySource.prototype.gcsStagingDir = ""; + PriceInfo.prototype.priceEffectiveTime = null; /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - BigQuerySource.prototype.dataSchema = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + PriceInfo.prototype.priceExpireTime = null; /** - * BigQuerySource partition. - * @member {"partitionDate"|undefined} partition - * @memberof google.cloud.retail.v2.BigQuerySource + * PriceInfo priceRange. + * @member {google.cloud.retail.v2.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2.PriceInfo * @instance */ - Object.defineProperty(BigQuerySource.prototype, "partition", { - get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), - set: $util.oneOfSetter($oneOfFields) - }); + PriceInfo.prototype.priceRange = null; /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new PriceInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static - * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource instance + * @param {google.cloud.retail.v2.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo instance */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); }; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static - * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encode = function encode(message, writer) { + PriceInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); - if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) - $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static - * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + PriceInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PriceInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 5: - message.projectId = reader.string(); - break; case 1: - message.datasetId = reader.string(); + message.currencyCode = reader.string(); break; case 2: - message.tableId = reader.string(); + message.price = reader.float(); break; case 3: - message.gcsStagingDir = reader.string(); + message.originalPrice = reader.float(); break; case 4: - message.dataSchema = reader.string(); + message.cost = reader.float(); + break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -3748,160 +3775,394 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + PriceInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies a PriceInfo message. * @function verify - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + PriceInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - properties.partition = 1; - { - var error = $root.google.type.Date.verify(message.partitionDate); - if (error) - return "partitionDate." + error; - } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; } - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.PriceInfo} PriceInfo */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.BigQuerySource) + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PriceInfo) return object; - var message = new $root.google.cloud.retail.v2.BigQuerySource(); - if (object.partitionDate != null) { - if (typeof object.partitionDate !== "object") - throw TypeError(".google.cloud.retail.v2.BigQuerySource.partitionDate: object expected"); - message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); + var message = new $root.google.cloud.retail.v2.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.fromObject(object.priceRange); } - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @static - * @param {google.cloud.retail.v2.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2.PriceInfo} message PriceInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + PriceInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; - } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); - if (options.oneofs) - object.partition = "partitionDate"; + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this PriceInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.PriceInfo * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + PriceInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BigQuerySource; - })(); - - v2.ProductInlineSource = (function() { + PriceInfo.PriceRange = (function() { - /** - * Properties of a ProductInlineSource. - * @memberof google.cloud.retail.v2 - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products - */ + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2.IInterval|null} [originalPrice] PriceRange originalPrice + */ - /** - * Constructs a new ProductInlineSource. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource - * @constructor - * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceRange price. + * @member {google.cloud.retail.v2.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; + + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; + + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + + return PriceInfo; + })(); + + v2.Rating = (function() { + + /** + * Properties of a Rating. + * @memberof google.cloud.retail.v2 + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram */ - function ProductInlineSource(properties) { - this.products = []; + + /** + * Constructs a new Rating. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a Rating. + * @implements IRating + * @constructor + * @param {google.cloud.retail.v2.IRating=} [properties] Properties to set + */ + function Rating(properties) { + this.ratingHistogram = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3909,78 +4170,112 @@ } /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2.ProductInlineSource + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2.Rating * @instance */ - ProductInlineSource.prototype.products = $util.emptyArray; + Rating.prototype.ratingCount = 0; /** - * Creates a new ProductInlineSource instance using the specified properties. + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2.Rating + * @instance + */ + Rating.prototype.averageRating = 0; + + /** + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2.Rating + * @instance + */ + Rating.prototype.ratingHistogram = $util.emptyArray; + + /** + * Creates a new Rating instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static - * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource instance + * @param {google.cloud.retail.v2.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rating} Rating instance */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); + Rating.create = function create(properties) { + return new Rating(properties); }; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static - * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encode = function encode(message, writer) { + Rating.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static - * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + Rating.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a Rating message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decode = function decode(reader, length) { + Rating.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rating(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + message.ratingCount = reader.int32(); + break; + case 2: + message.averageRating = reader.float(); + break; + case 3: + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -3991,125 +4286,140 @@ }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a Rating message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + Rating.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInlineSource message. + * Verifies a Rating message. * @function verify - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInlineSource.verify = function verify(message) { + Rating.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); - if (error) - return "products." + error; - } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; } return null; }; /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a Rating message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.Rating} Rating */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ProductInlineSource) + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rating) return object; - var message = new $root.google.cloud.retail.v2.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); - } + var message = new $root.google.cloud.retail.v2.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; } return message; }; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * Creates a plain object from a Rating message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @static - * @param {google.cloud.retail.v2.ProductInlineSource} message ProductInlineSource + * @param {google.cloud.retail.v2.Rating} message Rating * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInlineSource.toObject = function toObject(message, options) { + Rating.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); + object.ratingHistogram = []; + if (options.defaults) { + object.ratingCount = 0; + object.averageRating = 0; + } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; } return object; }; /** - * Converts this ProductInlineSource to JSON. + * Converts this Rating to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.Rating * @instance * @returns {Object.} JSON object */ - ProductInlineSource.prototype.toJSON = function toJSON() { + Rating.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInlineSource; + return Rating; })(); - v2.UserEventInlineSource = (function() { + v2.UserInfo = (function() { /** - * Properties of a UserEventInlineSource. + * Properties of a UserInfo. * @memberof google.cloud.retail.v2 - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest */ /** - * Constructs a new UserEventInlineSource. + * Constructs a new UserInfo. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource + * @classdesc Represents a UserInfo. + * @implements IUserInfo * @constructor - * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUserInfo=} [properties] Properties to set */ - function UserEventInlineSource(properties) { - this.userEvents = []; + function UserInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4117,78 +4427,114 @@ } /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2.UserEventInlineSource + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2.UserInfo * @instance */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; + UserInfo.prototype.userId = ""; /** - * Creates a new UserEventInlineSource instance using the specified properties. + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.ipAddress = ""; + + /** + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static - * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource instance + * @param {google.cloud.retail.v2.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserInfo} UserInfo instance */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); + UserInfo.create = function create(properties) { + return new UserInfo(properties); }; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static - * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encode = function encode(message, writer) { + UserInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); return writer; }; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static - * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a UserInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decode = function decode(reader, length) { + UserInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); break; default: reader.skipType(tag & 7); @@ -4199,124 +4545,132 @@ }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a UserInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + UserInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInlineSource message. + * Verifies a UserInfo message. * @function verify - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInlineSource.verify = function verify(message) { + UserInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvents[i]); - if (error) - return "userEvents." + error; - } - } + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; return null; }; /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2.UserInfo} UserInfo */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UserEventInlineSource) + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserInfo) return object; - var message = new $root.google.cloud.retail.v2.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvents[i]); - } - } + var message = new $root.google.cloud.retail.v2.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); return message; }; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @static - * @param {google.cloud.retail.v2.UserEventInlineSource} message UserEventInlineSource + * @param {google.cloud.retail.v2.UserInfo} message UserInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInlineSource.toObject = function toObject(message, options) { + UserInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvents[j], options); + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this UserInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UserEventInlineSource + * @memberof google.cloud.retail.v2.UserInfo * @instance * @returns {Object.} JSON object */ - UserEventInlineSource.prototype.toJSON = function toJSON() { + UserInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInlineSource; + return UserInfo; })(); - v2.ImportErrorsConfig = (function() { + v2.Promotion = (function() { /** - * Properties of an ImportErrorsConfig. + * Properties of a Promotion. * @memberof google.cloud.retail.v2 - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId */ /** - * Constructs a new ImportErrorsConfig. + * Constructs a new Promotion. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig + * @classdesc Represents a Promotion. + * @implements IPromotion * @constructor - * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set */ - function ImportErrorsConfig(properties) { + function Promotion(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4324,89 +4678,75 @@ } /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @instance - */ - ImportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2.Promotion * @instance */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + Promotion.prototype.promotionId = ""; /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static - * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig instance + * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Promotion} Promotion instance */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); + Promotion.create = function create(properties) { + return new Promotion(properties); }; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static - * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encode = function encode(message, writer) { + Promotion.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); return writer; }; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static - * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + Promotion.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2.Promotion} Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decode = function decode(reader, length) { + Promotion.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Promotion(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + message.promotionId = reader.string(); break; default: reader.skipType(tag & 7); @@ -4417,117 +4757,215 @@ }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2.Promotion} Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + Promotion.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportErrorsConfig message. + * Verifies a Promotion message. * @function verify - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportErrorsConfig.verify = function verify(message) { + Promotion.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; return null; }; /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2.Promotion} Promotion */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportErrorsConfig) + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Promotion) return object; - var message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); + var message = new $root.google.cloud.retail.v2.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); return message; }; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from a Promotion message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @static - * @param {google.cloud.retail.v2.ImportErrorsConfig} message ImportErrorsConfig + * @param {google.cloud.retail.v2.Promotion} message Promotion * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportErrorsConfig.toObject = function toObject(message, options) { + Promotion.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; - } + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; return object; }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this Promotion to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @memberof google.cloud.retail.v2.Promotion * @instance * @returns {Object.} JSON object */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { + Promotion.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportErrorsConfig; + return Promotion; })(); - v2.ImportProductsRequest = (function() { + v2.CompletionService = (function() { /** - * Properties of an ImportProductsRequest. + * Constructs a new CompletionService service. * @memberof google.cloud.retail.v2 - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {string|null} [requestId] ImportProductsRequest requestId - * @property {google.cloud.retail.v2.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask - * @property {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode - * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; /** - * Constructs a new ImportProductsRequest. + * Creates new CompletionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.CompletionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. + */ + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.CompleteQueryResponse} [response] CompleteQueryResponse + */ + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2.CompleteQueryRequest, $root.google.cloud.retail.v2.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; + })(); + + v2.CompleteQueryRequest = (function() { + + /** + * Properties of a CompleteQueryRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + */ + + /** + * Constructs a new CompleteQueryRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest * @constructor - * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set */ - function ImportProductsRequest(properties) { + function CompleteQueryRequest(properties) { + this.languageCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4535,153 +4973,156 @@ } /** - * ImportProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.parent = ""; + CompleteQueryRequest.prototype.catalog = ""; /** - * ImportProductsRequest requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.requestId = ""; + CompleteQueryRequest.prototype.query = ""; /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.inputConfig = null; + CompleteQueryRequest.prototype.visitorId = ""; /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.errorsConfig = null; + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.updateMask = null; + CompleteQueryRequest.prototype.deviceType = ""; /** - * ImportProductsRequest reconciliationMode. - * @member {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} reconciliationMode - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.reconciliationMode = 0; + CompleteQueryRequest.prototype.dataset = ""; /** - * ImportProductsRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2.ImportProductsRequest + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - ImportProductsRequest.prototype.notificationPubsubTopic = ""; + CompleteQueryRequest.prototype.maxSuggestions = 0; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest instance */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); }; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encode = function encode(message, writer) { + CompleteQueryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); - return writer; - }; - - /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + return writer; + }; + + /** + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decode = function decode(reader, length) { + CompleteQueryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); + message.catalog = reader.string(); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); break; case 3: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); break; case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.deviceType = reader.string(); break; - case 5: - message.reconciliationMode = reader.int32(); + case 6: + message.dataset = reader.string(); break; - case 7: - message.notificationPubsubTopic = reader.string(); + case 5: + message.maxSuggestions = reader.int32(); break; default: reader.skipType(tag & 7); @@ -4692,207 +5133,173 @@ }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsRequest message. + * Verifies a CompleteQueryRequest message. * @function verify - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsRequest.verify = function verify(message) { + CompleteQueryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2.ProductInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; } - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - switch (message.reconciliationMode) { - default: - return "reconciliationMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; return null; }; /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest */ - ImportProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportProductsRequest) + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryRequest) return object; - var message = new $root.google.cloud.retail.v2.ImportProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - switch (object.reconciliationMode) { - case "RECONCILIATION_MODE_UNSPECIFIED": - case 0: - message.reconciliationMode = 0; - break; - case "INCREMENTAL": - case 1: - message.reconciliationMode = 1; - break; - case "FULL": - case 2: - message.reconciliationMode = 2; - break; + var message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; return message; }; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.ImportProductsRequest} message ImportProductsRequest + * @param {google.cloud.retail.v2.CompleteQueryRequest} message CompleteQueryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsRequest.toObject = function toObject(message, options) { + CompleteQueryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - object.updateMask = null; - object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; return object; }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportProductsRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance * @returns {Object.} JSON object */ - ImportProductsRequest.prototype.toJSON = function toJSON() { + CompleteQueryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * ReconciliationMode enum. - * @name google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode - * @enum {number} - * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value - * @property {number} INCREMENTAL=1 INCREMENTAL value - * @property {number} FULL=2 FULL value - */ - ImportProductsRequest.ReconciliationMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INCREMENTAL"] = 1; - values[valuesById[2] = "FULL"] = 2; - return values; - })(); - - return ImportProductsRequest; + return CompleteQueryRequest; })(); - v2.ImportUserEventsRequest = (function() { + v2.CompleteQueryResponse = (function() { /** - * Properties of an ImportUserEventsRequest. + * Properties of a CompleteQueryResponse. * @memberof google.cloud.retail.v2 - * @interface IImportUserEventsRequest - * @property {string|null} [parent] ImportUserEventsRequest parent - * @property {google.cloud.retail.v2.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig - * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults */ /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new CompleteQueryResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportUserEventsRequest. - * @implements IImportUserEventsRequest + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse * @constructor - * @param {google.cloud.retail.v2.IImportUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set */ - function ImportUserEventsRequest(properties) { + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4900,101 +5307,107 @@ } /** - * ImportUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance */ - ImportUserEventsRequest.prototype.parent = ""; + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; /** - * ImportUserEventsRequest inputConfig. - * @member {google.cloud.retail.v2.IUserEventInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance */ - ImportUserEventsRequest.prototype.inputConfig = null; + CompleteQueryResponse.prototype.attributionToken = ""; /** - * ImportUserEventsRequest errorsConfig. - * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance */ - ImportUserEventsRequest.prototype.errorsConfig = null; + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IImportUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest instance + * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse instance */ - ImportUserEventsRequest.create = function create(properties) { - return new ImportUserEventsRequest(properties); + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); }; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encode = function encode(message, writer) { + CompleteQueryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decode = function decode(reader, length) { + CompleteQueryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.decode(reader, reader.uint32()); + message.attributionToken = reader.string(); break; case 3: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -5005,136 +5418,600 @@ }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a CompleteQueryResponse message. * @function verify - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsRequest.verify = function verify(message) { + CompleteQueryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2.UserEventInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } } return null; }; /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse */ - ImportUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportUserEventsRequest) + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse) return object; - var message = new $root.google.cloud.retail.v2.ImportUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportUserEventsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportUserEventsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } } return message; }; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {google.cloud.retail.v2.CompleteQueryResponse} message CompleteQueryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsRequest.toObject = function toObject(message, options) { + CompleteQueryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this CompleteQueryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance * @returns {Object.} JSON object */ - ImportUserEventsRequest.prototype.toJSON = function toJSON() { + CompleteQueryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsRequest; + CompleteQueryResponse.CompletionResult = (function() { + + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ + + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; + + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.suggestion = reader.string(); + break; + case 2: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionResult; + })(); + + CompleteQueryResponse.RecentSearchResult = (function() { + + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ + + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; })(); - v2.ImportCompletionDataRequest = (function() { + v2.GcsSource = (function() { /** - * Properties of an ImportCompletionDataRequest. + * Properties of a GcsSource. * @memberof google.cloud.retail.v2 - * @interface IImportCompletionDataRequest - * @property {string|null} [parent] ImportCompletionDataRequest parent - * @property {google.cloud.retail.v2.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig - * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema */ /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new GcsSource. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportCompletionDataRequest. - * @implements IImportCompletionDataRequest + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.retail.v2.IImportCompletionDataRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set */ - function ImportCompletionDataRequest(properties) { + function GcsSource(properties) { + this.inputUris = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5142,101 +6019,91 @@ } /** - * ImportCompletionDataRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest - * @instance - */ - ImportCompletionDataRequest.prototype.parent = ""; - - /** - * ImportCompletionDataRequest inputConfig. - * @member {google.cloud.retail.v2.ICompletionDataInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2.GcsSource * @instance */ - ImportCompletionDataRequest.prototype.inputConfig = null; + GcsSource.prototype.inputUris = $util.emptyArray; /** - * ImportCompletionDataRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2.GcsSource * @instance */ - ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + GcsSource.prototype.dataSchema = ""; /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static - * @param {google.cloud.retail.v2.IImportCompletionDataRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest instance + * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GcsSource} GcsSource instance */ - ImportCompletionDataRequest.create = function create(properties) { - return new ImportCompletionDataRequest(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static - * @param {google.cloud.retail.v2.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataRequest.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); return writer; }; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static - * @param {google.cloud.retail.v2.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataRequest.decode = function decode(reader, length) { + GcsSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportCompletionDataRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.notificationPubsubTopic = reader.string(); + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -5247,131 +6114,133 @@ }; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportCompletionDataRequest.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2.CompletionDataInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2.GcsSource} GcsSource */ - ImportCompletionDataRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportCompletionDataRequest) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GcsSource) return object; - var message = new $root.google.cloud.retail.v2.ImportCompletionDataRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportCompletionDataRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.retail.v2.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @static - * @param {google.cloud.retail.v2.ImportCompletionDataRequest} message ImportCompletionDataRequest + * @param {google.cloud.retail.v2.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportCompletionDataRequest.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.notificationPubsubTopic = ""; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.toObject(message.inputConfig, options); - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; return object; }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2.GcsSource * @instance * @returns {Object.} JSON object */ - ImportCompletionDataRequest.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportCompletionDataRequest; + return GcsSource; })(); - v2.ProductInputConfig = (function() { + v2.BigQuerySource = (function() { /** - * Properties of a ProductInputConfig. + * Properties of a BigQuerySource. * @memberof google.cloud.retail.v2 - * @interface IProductInputConfig - * @property {google.cloud.retail.v2.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema */ /** - * Constructs a new ProductInputConfig. + * Constructs a new BigQuerySource. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource * @constructor - * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set */ - function ProductInputConfig(properties) { + function BigQuerySource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5379,115 +6248,154 @@ } /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2.ProductInputConfig + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - ProductInputConfig.prototype.productInlineSource = null; + BigQuerySource.prototype.partitionDate = null; /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2.ProductInputConfig + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - ProductInputConfig.prototype.gcsSource = null; + BigQuerySource.prototype.projectId = ""; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2.ProductInputConfig + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - ProductInputConfig.prototype.bigQuerySource = null; + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2.ProductInputConfig + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new BigQuerySource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + BigQuerySource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + BigQuerySource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.BigQuerySource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 5: + message.projectId = reader.string(); + break; case 1: - message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); + message.datasetId = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + message.tableId = reader.string(); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -5498,159 +6406,160 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies a BigQuerySource message. * @function verify - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + BigQuerySource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; { - var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + var error = $root.google.type.Date.verify(message.partitionDate); if (error) - return "bigQuerySource." + error; + return "partitionDate." + error; } } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ProductInputConfig) + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.BigQuerySource) return object; - var message = new $root.google.cloud.retail.v2.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.fromObject(object.productInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); - } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); } + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.ProductInputConfig} message ProductInputConfig + * @param {google.cloud.retail.v2.BigQuerySource} message BigQuerySource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInputConfig.toObject = function toObject(message, options) { + BigQuerySource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); if (options.oneofs) - object.source = "bigQuerySource"; + object.partition = "partitionDate"; } return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this BigQuerySource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ProductInputConfig + * @memberof google.cloud.retail.v2.BigQuerySource * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + BigQuerySource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; + return BigQuerySource; })(); - v2.UserEventInputConfig = (function() { + v2.ProductInlineSource = (function() { /** - * Properties of a UserEventInputConfig. + * Properties of a ProductInlineSource. * @memberof google.cloud.retail.v2 - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products */ /** - * Constructs a new UserEventInputConfig. + * Constructs a new ProductInlineSource. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource * @constructor - * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set */ - function UserEventInputConfig(properties) { + function ProductInlineSource(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5658,115 +6567,78 @@ } /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.userEventInlineSource = null; - - /** - * UserEventInputConfig gcsSource. - * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.gcsSource = null; - - /** - * UserEventInputConfig bigQuerySource. - * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2.UserEventInputConfig + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2.ProductInlineSource * @instance */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + ProductInlineSource.prototype.products = $util.emptyArray; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig instance + * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource instance */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); }; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encode = function encode(message, writer) { + ProductInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decode = function decode(reader, length) { + ProductInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -5777,157 +6649,125 @@ }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInputConfig message. + * Verifies a ProductInlineSource message. * @function verify - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInputConfig.verify = function verify(message) { + ProductInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.UserEventInlineSource.verify(message.userEventInlineSource); - if (error) - return "userEventInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); if (error) - return "bigQuerySource." + error; + return "products." + error; } } return null; }; /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource */ - UserEventInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UserEventInputConfig) + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductInlineSource) return object; - var message = new $root.google.cloud.retail.v2.UserEventInputConfig(); - if (object.userEventInlineSource != null) { - if (typeof object.userEventInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.userEventInlineSource: object expected"); - message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.fromObject(object.userEventInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); - } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); + } } return message; }; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.UserEventInputConfig} message UserEventInputConfig + * @param {google.cloud.retail.v2.ProductInlineSource} message ProductInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInputConfig.toObject = function toObject(message, options) { + ProductInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - object.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.toObject(message.userEventInlineSource, options); - if (options.oneofs) - object.source = "userEventInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); } return object; }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this ProductInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UserEventInputConfig + * @memberof google.cloud.retail.v2.ProductInlineSource * @instance * @returns {Object.} JSON object */ - UserEventInputConfig.prototype.toJSON = function toJSON() { + ProductInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInputConfig; + return ProductInlineSource; })(); - v2.CompletionDataInputConfig = (function() { + v2.UserEventInlineSource = (function() { /** - * Properties of a CompletionDataInputConfig. + * Properties of a UserEventInlineSource. * @memberof google.cloud.retail.v2 - * @interface ICompletionDataInputConfig - * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents */ /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new UserEventInlineSource. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompletionDataInputConfig. - * @implements ICompletionDataInputConfig + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource * @constructor - * @param {google.cloud.retail.v2.ICompletionDataInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set */ - function CompletionDataInputConfig(properties) { + function UserEventInlineSource(properties) { + this.userEvents = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5935,89 +6775,78 @@ } /** - * CompletionDataInputConfig bigQuerySource. - * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2.CompletionDataInputConfig - * @instance - */ - CompletionDataInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * CompletionDataInputConfig source. - * @member {"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2.UserEventInlineSource * @instance */ - Object.defineProperty(CompletionDataInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + UserEventInlineSource.prototype.userEvents = $util.emptyArray; /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * Creates a new UserEventInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static - * @param {google.cloud.retail.v2.ICompletionDataInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig instance + * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource instance */ - CompletionDataInputConfig.create = function create(properties) { - return new CompletionDataInputConfig(properties); + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); }; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static - * @param {google.cloud.retail.v2.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encode = function encode(message, writer) { + UserEventInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static - * @param {google.cloud.retail.v2.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decode = function decode(reader, length) { + UserEventInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionDataInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -6028,122 +6857,124 @@ }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a UserEventInlineSource message. * @function verify - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompletionDataInputConfig.verify = function verify(message) { + UserEventInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvents[i]); if (error) - return "bigQuerySource." + error; + return "userEvents." + error; } } return null; }; /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource */ - CompletionDataInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompletionDataInputConfig) + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventInlineSource) return object; - var message = new $root.google.cloud.retail.v2.CompletionDataInputConfig(); - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2.CompletionDataInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvents[i]); + } } return message; }; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static - * @param {google.cloud.retail.v2.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {google.cloud.retail.v2.UserEventInlineSource} message UserEventInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompletionDataInputConfig.toObject = function toObject(message, options) { + UserEventInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvents[j], options); } return object; }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this UserEventInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @memberof google.cloud.retail.v2.UserEventInlineSource * @instance * @returns {Object.} JSON object */ - CompletionDataInputConfig.prototype.toJSON = function toJSON() { + UserEventInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompletionDataInputConfig; + return UserEventInlineSource; })(); - v2.ImportMetadata = (function() { + v2.ImportErrorsConfig = (function() { /** - * Properties of an ImportMetadata. + * Properties of an ImportErrorsConfig. * @memberof google.cloud.retail.v2 - * @interface IImportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime - * @property {number|Long|null} [successCount] ImportMetadata successCount - * @property {number|Long|null} [failureCount] ImportMetadata failureCount - * @property {string|null} [requestId] ImportMetadata requestId - * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix */ /** - * Constructs a new ImportMetadata. + * Constructs a new ImportErrorsConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportMetadata. - * @implements IImportMetadata + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig * @constructor - * @param {google.cloud.retail.v2.IImportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set */ - function ImportMetadata(properties) { + function ImportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6151,140 +6982,89 @@ } /** - * ImportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2.ImportMetadata - * @instance - */ - ImportMetadata.prototype.createTime = null; - - /** - * ImportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2.ImportMetadata - * @instance - */ - ImportMetadata.prototype.updateTime = null; - - /** - * ImportMetadata successCount. - * @member {number|Long} successCount - * @memberof google.cloud.retail.v2.ImportMetadata - * @instance - */ - ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ImportMetadata failureCount. - * @member {number|Long} failureCount - * @memberof google.cloud.retail.v2.ImportMetadata + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance */ - ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportErrorsConfig.prototype.gcsPrefix = null; - /** - * ImportMetadata requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2.ImportMetadata - * @instance - */ - ImportMetadata.prototype.requestId = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ImportMetadata notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2.ImportMetadata + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance */ - ImportMetadata.prototype.notificationPubsubTopic = ""; + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new ImportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.IImportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata instance + * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig instance */ - ImportMetadata.create = function create(properties) { - return new ImportMetadata(properties); + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); }; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encode = function encode(message, writer) { + ImportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); - if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes an ImportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decode = function decode(reader, length) { + ImportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -6295,188 +7075,117 @@ }; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportMetadata message. + * Verifies an ImportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportMetadata.verify = function verify(message) { + ImportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) - return "successCount: integer|Long expected"; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) - return "failureCount: integer|Long expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig */ - ImportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportMetadata) + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2.ImportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2.ImportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2.ImportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } - if (object.successCount != null) - if ($util.Long) - (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; - else if (typeof object.successCount === "string") - message.successCount = parseInt(object.successCount, 10); - else if (typeof object.successCount === "number") - message.successCount = object.successCount; - else if (typeof object.successCount === "object") - message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); - if (object.failureCount != null) - if ($util.Long) - (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; - else if (typeof object.failureCount === "string") - message.failureCount = parseInt(object.failureCount, 10); - else if (typeof object.failureCount === "number") - message.failureCount = object.failureCount; - else if (typeof object.failureCount === "object") - message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); + var message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.ImportMetadata} message ImportMetadata + * @param {google.cloud.retail.v2.ImportErrorsConfig} message ImportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportMetadata.toObject = function toObject(message, options) { + ImportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.createTime = null; - object.updateTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.successCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failureCount = options.longs === String ? "0" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (typeof message.successCount === "number") - object.successCount = options.longs === String ? String(message.successCount) : message.successCount; - else - object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (typeof message.failureCount === "number") - object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; - else - object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportMetadata to JSON. + * Converts this ImportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportMetadata + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance * @returns {Object.} JSON object */ - ImportMetadata.prototype.toJSON = function toJSON() { + ImportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportMetadata; + return ImportErrorsConfig; })(); - v2.ImportProductsResponse = (function() { + v2.ImportProductsRequest = (function() { /** - * Properties of an ImportProductsResponse. + * Properties of an ImportProductsRequest. * @memberof google.cloud.retail.v2 - * @interface IImportProductsResponse - * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples - * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic */ /** - * Constructs a new ImportProductsResponse. + * Constructs a new ImportProductsRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportProductsResponse. - * @implements IImportProductsResponse + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest * @constructor - * @param {google.cloud.retail.v2.IImportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set */ - function ImportProductsResponse(properties) { - this.errorSamples = []; + function ImportProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6484,92 +7193,154 @@ } /** - * ImportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2.ImportProductsResponse + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportProductsRequest * @instance */ - ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + ImportProductsRequest.prototype.parent = ""; /** - * ImportProductsResponse errorsConfig. + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.requestId = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @instance */ - ImportProductsResponse.prototype.errorsConfig = null; + ImportProductsRequest.prototype.errorsConfig = null; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.IImportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse instance + * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest instance */ - ImportProductsResponse.create = function create(properties) { - return new ImportProductsResponse(properties); + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); }; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encode = function encode(message, writer) { + ImportProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decode = function decode(reader, length) { + ImportProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.parent = reader.string(); + break; + case 6: + message.requestId = reader.string(); break; case 2: + message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: + message.notificationPubsubTopic = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -6579,141 +7350,207 @@ }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsResponse message. + * Verifies an ImportProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsResponse.verify = function verify(message) { + ImportProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); if (error) return "errorsConfig." + error; } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest */ - ImportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportProductsResponse) + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportProductsRequest) return object; - var message = new $root.google.cloud.retail.v2.ImportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } + var message = new $root.google.cloud.retail.v2.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.fromObject(object.inputConfig); } if (object.errorsConfig != null) { if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorsConfig: object expected"); + throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.errorsConfig: object expected"); message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.ImportProductsResponse} message ImportProductsResponse + * @param {google.cloud.retail.v2.ImportProductsRequest} message ImportProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsResponse.toObject = function toObject(message, options) { + ImportProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.toObject(message.inputConfig, options); if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this ImportProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportProductsResponse + * @memberof google.cloud.retail.v2.ImportProductsRequest * @instance * @returns {Object.} JSON object */ - ImportProductsResponse.prototype.toJSON = function toJSON() { + ImportProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsResponse; + /** + * ReconciliationMode enum. + * @name google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value + */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); + + return ImportProductsRequest; })(); - v2.ImportUserEventsResponse = (function() { + v2.ImportUserEventsRequest = (function() { /** - * Properties of an ImportUserEventsResponse. + * Properties of an ImportUserEventsRequest. * @memberof google.cloud.retail.v2 - * @interface IImportUserEventsResponse - * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig - * @property {google.cloud.retail.v2.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig */ /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new ImportUserEventsRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportUserEventsResponse. - * @implements IImportUserEventsResponse + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest * @constructor - * @param {google.cloud.retail.v2.IImportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportUserEventsRequest=} [properties] Properties to set */ - function ImportUserEventsResponse(properties) { - this.errorSamples = []; + function ImportUserEventsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6721,104 +7558,101 @@ } /** - * ImportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @instance */ - ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + ImportUserEventsRequest.prototype.parent = ""; /** - * ImportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @instance */ - ImportUserEventsResponse.prototype.errorsConfig = null; + ImportUserEventsRequest.prototype.inputConfig = null; /** - * ImportUserEventsResponse importSummary. - * @member {google.cloud.retail.v2.IUserEventImportSummary|null|undefined} importSummary - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @instance */ - ImportUserEventsResponse.prototype.importSummary = null; + ImportUserEventsRequest.prototype.errorsConfig = null; /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Creates a new ImportUserEventsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2.IImportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest instance */ - ImportUserEventsResponse.create = function create(properties) { - return new ImportUserEventsResponse(properties); + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); }; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encode = function encode(message, writer) { + ImportUserEventsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) - $root.google.cloud.retail.v2.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decode = function decode(reader, length) { + ImportUserEventsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportUserEventsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.decode(reader, reader.uint32()); break; case 3: - message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.decode(reader, reader.uint32()); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -6829,153 +7663,136 @@ }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsResponse message. + * Verifies an ImportUserEventsRequest message. * @function verify - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsResponse.verify = function verify(message) { + ImportUserEventsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); if (error) return "errorsConfig." + error; } - if (message.importSummary != null && message.hasOwnProperty("importSummary")) { - var error = $root.google.cloud.retail.v2.UserEventImportSummary.verify(message.importSummary); - if (error) - return "importSummary." + error; - } return null; }; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2.ImportUserEventsRequest} ImportUserEventsRequest */ - ImportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportUserEventsResponse) + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportUserEventsRequest) return object; - var message = new $root.google.cloud.retail.v2.ImportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } + var message = new $root.google.cloud.retail.v2.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.fromObject(object.inputConfig); } if (object.errorsConfig != null) { if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorsConfig: object expected"); + throw TypeError(".google.cloud.retail.v2.ImportUserEventsRequest.errorsConfig: object expected"); message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); } - if (object.importSummary != null) { - if (typeof object.importSummary !== "object") - throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.importSummary: object expected"); - message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.fromObject(object.importSummary); - } return message; }; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {google.cloud.retail.v2.ImportUserEventsRequest} message ImportUserEventsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsResponse.toObject = function toObject(message, options) { + ImportUserEventsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; if (options.defaults) { + object.parent = ""; + object.inputConfig = null; object.errorsConfig = null; - object.importSummary = null; - } - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.toObject(message.inputConfig, options); if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.importSummary != null && message.hasOwnProperty("importSummary")) - object.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this ImportUserEventsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @memberof google.cloud.retail.v2.ImportUserEventsRequest * @instance * @returns {Object.} JSON object */ - ImportUserEventsResponse.prototype.toJSON = function toJSON() { + ImportUserEventsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsResponse; + return ImportUserEventsRequest; })(); - v2.UserEventImportSummary = (function() { + v2.ImportCompletionDataRequest = (function() { /** - * Properties of a UserEventImportSummary. + * Properties of an ImportCompletionDataRequest. * @memberof google.cloud.retail.v2 - * @interface IUserEventImportSummary - * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount - * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic */ /** - * Constructs a new UserEventImportSummary. + * Constructs a new ImportCompletionDataRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventImportSummary. - * @implements IUserEventImportSummary + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest * @constructor - * @param {google.cloud.retail.v2.IUserEventImportSummary=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportCompletionDataRequest=} [properties] Properties to set */ - function UserEventImportSummary(properties) { + function ImportCompletionDataRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6983,88 +7800,101 @@ } /** - * UserEventImportSummary joinedEventsCount. - * @member {number|Long} joinedEventsCount - * @memberof google.cloud.retail.v2.UserEventImportSummary + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance */ - UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportCompletionDataRequest.prototype.parent = ""; /** - * UserEventImportSummary unjoinedEventsCount. - * @member {number|Long} unjoinedEventsCount - * @memberof google.cloud.retail.v2.UserEventImportSummary + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance */ - UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportCompletionDataRequest.prototype.inputConfig = null; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.IUserEventImportSummary=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest instance */ - UserEventImportSummary.create = function create(properties) { - return new UserEventImportSummary(properties); + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); }; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encode = function encode(message, writer) { + ImportCompletionDataRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); - if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decode = function decode(reader, length) { + ImportCompletionDataRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventImportSummary(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportCompletionDataRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.joinedEventsCount = reader.int64(); + message.parent = reader.string(); break; case 2: - message.unjoinedEventsCount = reader.int64(); + message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -7075,145 +7905,131 @@ }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventImportSummary message. + * Verifies an ImportCompletionDataRequest message. * @function verify - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventImportSummary.verify = function verify(message) { + ImportCompletionDataRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) - return "joinedEventsCount: integer|Long expected"; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) - return "unjoinedEventsCount: integer|Long expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2.ImportCompletionDataRequest} ImportCompletionDataRequest */ - UserEventImportSummary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UserEventImportSummary) + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportCompletionDataRequest) return object; - var message = new $root.google.cloud.retail.v2.UserEventImportSummary(); - if (object.joinedEventsCount != null) - if ($util.Long) - (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; - else if (typeof object.joinedEventsCount === "string") - message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); - else if (typeof object.joinedEventsCount === "number") - message.joinedEventsCount = object.joinedEventsCount; - else if (typeof object.joinedEventsCount === "object") - message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); - if (object.unjoinedEventsCount != null) - if ($util.Long) - (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; - else if (typeof object.unjoinedEventsCount === "string") - message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); - else if (typeof object.unjoinedEventsCount === "number") - message.unjoinedEventsCount = object.unjoinedEventsCount; - else if (typeof object.unjoinedEventsCount === "object") - message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.fromObject(object.inputConfig); + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2.UserEventImportSummary} message UserEventImportSummary + * @param {google.cloud.retail.v2.ImportCompletionDataRequest} message ImportCompletionDataRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventImportSummary.toObject = function toObject(message, options) { + ImportCompletionDataRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.joinedEventsCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.unjoinedEventsCount = options.longs === String ? "0" : 0; + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; } - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (typeof message.joinedEventsCount === "number") - object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; - else - object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (typeof message.unjoinedEventsCount === "number") - object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; - else - object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this ImportCompletionDataRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UserEventImportSummary + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest * @instance * @returns {Object.} JSON object */ - UserEventImportSummary.prototype.toJSON = function toJSON() { + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventImportSummary; + return ImportCompletionDataRequest; })(); - v2.ImportCompletionDataResponse = (function() { + v2.ProductInputConfig = (function() { /** - * Properties of an ImportCompletionDataResponse. + * Properties of a ProductInputConfig. * @memberof google.cloud.retail.v2 - * @interface IImportCompletionDataResponse - * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples + * @interface IProductInputConfig + * @property {google.cloud.retail.v2.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource */ /** - * Constructs a new ImportCompletionDataResponse. + * Constructs a new ProductInputConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportCompletionDataResponse. - * @implements IImportCompletionDataResponse + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig * @constructor - * @param {google.cloud.retail.v2.IImportCompletionDataResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set */ - function ImportCompletionDataResponse(properties) { - this.errorSamples = []; + function ProductInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7221,78 +8037,115 @@ } /** - * ImportCompletionDataResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2.ProductInputConfig * @instance */ - ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + ProductInputConfig.prototype.productInlineSource = null; /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2.ProductInputConfig * @static - * @param {google.cloud.retail.v2.IImportCompletionDataResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse instance + * @param {google.cloud.retail.v2.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig instance */ - ImportCompletionDataResponse.create = function create(properties) { - return new ImportCompletionDataResponse(properties); + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); }; /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2.ProductInputConfig * @static - * @param {google.cloud.retail.v2.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encode = function encode(message, writer) { + ProductInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2.ProductInputConfig * @static - * @param {google.cloud.retail.v2.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decode = function decode(reader, length) { + ProductInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportCompletionDataResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7303,1462 +8156,159 @@ }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; - - /** - * Verifies an ImportCompletionDataResponse message. - * @function verify - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportCompletionDataResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - return null; - }; - - /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse - */ - ImportCompletionDataResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportCompletionDataResponse) - return object; - var message = new $root.google.cloud.retail.v2.ImportCompletionDataResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2.ImportCompletionDataResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ImportCompletionDataResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse - * @static - * @param {google.cloud.retail.v2.ImportCompletionDataResponse} message ImportCompletionDataResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportCompletionDataResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); - } - return object; - }; - - /** - * Converts this ImportCompletionDataResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.ImportCompletionDataResponse - * @instance - * @returns {Object.} JSON object - */ - ImportCompletionDataResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ImportCompletionDataResponse; - })(); - - v2.Product = (function() { - - /** - * Properties of a Product. - * @memberof google.cloud.retail.v2 - * @interface IProduct - * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime - * @property {google.protobuf.IDuration|null} [ttl] Product ttl - * @property {string|null} [name] Product name - * @property {string|null} [id] Product id - * @property {google.cloud.retail.v2.Product.Type|null} [type] Product type - * @property {string|null} [primaryProductId] Product primaryProductId - * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds - * @property {string|null} [gtin] Product gtin - * @property {Array.|null} [categories] Product categories - * @property {string|null} [title] Product title - * @property {Array.|null} [brands] Product brands - * @property {string|null} [description] Product description - * @property {string|null} [languageCode] Product languageCode - * @property {Object.|null} [attributes] Product attributes - * @property {Array.|null} [tags] Product tags - * @property {google.cloud.retail.v2.IPriceInfo|null} [priceInfo] Product priceInfo - * @property {google.cloud.retail.v2.IRating|null} [rating] Product rating - * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime - * @property {google.cloud.retail.v2.Product.Availability|null} [availability] Product availability - * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity - * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo - * @property {string|null} [uri] Product uri - * @property {Array.|null} [images] Product images - * @property {google.cloud.retail.v2.IAudience|null} [audience] Product audience - * @property {google.cloud.retail.v2.IColorInfo|null} [colorInfo] Product colorInfo - * @property {Array.|null} [sizes] Product sizes - * @property {Array.|null} [materials] Product materials - * @property {Array.|null} [patterns] Product patterns - * @property {Array.|null} [conditions] Product conditions - * @property {Array.|null} [promotions] Product promotions - * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime - * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields - * @property {Array.|null} [variants] Product variants - */ - - /** - * Constructs a new Product. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a Product. - * @implements IProduct - * @constructor - * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set - */ - function Product(properties) { - this.collectionMemberIds = []; - this.categories = []; - this.brands = []; - this.attributes = {}; - this.tags = []; - this.fulfillmentInfo = []; - this.images = []; - this.sizes = []; - this.materials = []; - this.patterns = []; - this.conditions = []; - this.promotions = []; - this.variants = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Product expireTime. - * @member {google.protobuf.ITimestamp|null|undefined} expireTime - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.expireTime = null; - - /** - * Product ttl. - * @member {google.protobuf.IDuration|null|undefined} ttl - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.ttl = null; - - /** - * Product name. - * @member {string} name - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.name = ""; - - /** - * Product id. - * @member {string} id - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.id = ""; - - /** - * Product type. - * @member {google.cloud.retail.v2.Product.Type} type - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.type = 0; - - /** - * Product primaryProductId. - * @member {string} primaryProductId - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.primaryProductId = ""; - - /** - * Product collectionMemberIds. - * @member {Array.} collectionMemberIds - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.collectionMemberIds = $util.emptyArray; - - /** - * Product gtin. - * @member {string} gtin - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.gtin = ""; - - /** - * Product categories. - * @member {Array.} categories - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.categories = $util.emptyArray; - - /** - * Product title. - * @member {string} title - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.title = ""; - - /** - * Product brands. - * @member {Array.} brands - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.brands = $util.emptyArray; - - /** - * Product description. - * @member {string} description - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.description = ""; - - /** - * Product languageCode. - * @member {string} languageCode - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.languageCode = ""; - - /** - * Product attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.attributes = $util.emptyObject; - - /** - * Product tags. - * @member {Array.} tags - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.tags = $util.emptyArray; - - /** - * Product priceInfo. - * @member {google.cloud.retail.v2.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.priceInfo = null; - - /** - * Product rating. - * @member {google.cloud.retail.v2.IRating|null|undefined} rating - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.rating = null; - - /** - * Product availableTime. - * @member {google.protobuf.ITimestamp|null|undefined} availableTime - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.availableTime = null; - - /** - * Product availability. - * @member {google.cloud.retail.v2.Product.Availability} availability - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.availability = 0; - - /** - * Product availableQuantity. - * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.availableQuantity = null; - - /** - * Product fulfillmentInfo. - * @member {Array.} fulfillmentInfo - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.fulfillmentInfo = $util.emptyArray; - - /** - * Product uri. - * @member {string} uri - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.uri = ""; - - /** - * Product images. - * @member {Array.} images - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.images = $util.emptyArray; - - /** - * Product audience. - * @member {google.cloud.retail.v2.IAudience|null|undefined} audience - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.audience = null; - - /** - * Product colorInfo. - * @member {google.cloud.retail.v2.IColorInfo|null|undefined} colorInfo - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.colorInfo = null; - - /** - * Product sizes. - * @member {Array.} sizes - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.sizes = $util.emptyArray; - - /** - * Product materials. - * @member {Array.} materials - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.materials = $util.emptyArray; - - /** - * Product patterns. - * @member {Array.} patterns - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.patterns = $util.emptyArray; - - /** - * Product conditions. - * @member {Array.} conditions - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.conditions = $util.emptyArray; - - /** - * Product promotions. - * @member {Array.} promotions - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.promotions = $util.emptyArray; - - /** - * Product publishTime. - * @member {google.protobuf.ITimestamp|null|undefined} publishTime - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.publishTime = null; - - /** - * Product retrievableFields. - * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.retrievableFields = null; - - /** - * Product variants. - * @member {Array.} variants - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Product.prototype.variants = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Product expiration. - * @member {"expireTime"|"ttl"|undefined} expiration - * @memberof google.cloud.retail.v2.Product - * @instance - */ - Object.defineProperty(Product.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Product instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.Product - * @static - * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Product} Product instance - */ - Product.create = function create(properties) { - return new Product(properties); - }; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.Product - * @static - * @param {google.cloud.retail.v2.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); - if (message.collectionMemberIds != null && message.collectionMemberIds.length) - for (var i = 0; i < message.collectionMemberIds.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); - if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); - if (message.brands != null && message.brands.length) - for (var i = 0; i < message.brands.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) - $root.google.cloud.retail.v2.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) - $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) - $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) - $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); - if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) - $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) - for (var i = 0; i < message.fulfillmentInfo.length; ++i) - $root.google.cloud.retail.v2.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); - if (message.images != null && message.images.length) - for (var i = 0; i < message.images.length; ++i) - $root.google.cloud.retail.v2.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); - if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) - $root.google.cloud.retail.v2.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) - $root.google.cloud.retail.v2.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.sizes != null && message.sizes.length) - for (var i = 0; i < message.sizes.length; ++i) - writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); - if (message.materials != null && message.materials.length) - for (var i = 0; i < message.materials.length; ++i) - writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); - if (message.patterns != null && message.patterns.length) - for (var i = 0; i < message.patterns.length; ++i) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); - if (message.conditions != null && message.conditions.length) - for (var i = 0; i < message.conditions.length; ++i) - writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); - if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) - $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); - if (message.variants != null && message.variants.length) - for (var i = 0; i < message.variants.length; ++i) - $root.google.cloud.retail.v2.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); - if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) - $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); - if (message.promotions != null && message.promotions.length) - for (var i = 0; i < message.promotions.length; ++i) - $root.google.cloud.retail.v2.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.Product - * @static - * @param {google.cloud.retail.v2.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Product message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.Product - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Product(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 16: - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 17: - message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.id = reader.string(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 5: - if (!(message.collectionMemberIds && message.collectionMemberIds.length)) - message.collectionMemberIds = []; - message.collectionMemberIds.push(reader.string()); - break; - case 6: - message.gtin = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 9: - if (!(message.brands && message.brands.length)) - message.brands = []; - message.brands.push(reader.string()); - break; - case 10: - message.description = reader.string(); - break; - case 11: - message.languageCode = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); - break; - case 15: - message.rating = $root.google.cloud.retail.v2.Rating.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 21: - if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) - message.fulfillmentInfo = []; - message.fulfillmentInfo.push($root.google.cloud.retail.v2.FulfillmentInfo.decode(reader, reader.uint32())); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2.Image.decode(reader, reader.uint32())); - break; - case 24: - message.audience = $root.google.cloud.retail.v2.Audience.decode(reader, reader.uint32()); - break; - case 25: - message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.decode(reader, reader.uint32()); - break; - case 26: - if (!(message.sizes && message.sizes.length)) - message.sizes = []; - message.sizes.push(reader.string()); - break; - case 27: - if (!(message.materials && message.materials.length)) - message.materials = []; - message.materials.push(reader.string()); - break; - case 28: - if (!(message.patterns && message.patterns.length)) - message.patterns = []; - message.patterns.push(reader.string()); - break; - case 29: - if (!(message.conditions && message.conditions.length)) - message.conditions = []; - message.conditions.push(reader.string()); - break; - case 34: - if (!(message.promotions && message.promotions.length)) - message.promotions = []; - message.promotions.push($root.google.cloud.retail.v2.Promotion.decode(reader, reader.uint32())); - break; - case 33: - message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 30: - message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 31: - if (!(message.variants && message.variants.length)) - message.variants = []; - message.variants.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.Product - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Product message. - * @function verify - * @memberof google.cloud.retail.v2.Product - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Product.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - properties.expiration = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.expireTime); - if (error) - return "expireTime." + error; - } - } - if (message.ttl != null && message.hasOwnProperty("ttl")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; - { - var error = $root.google.protobuf.Duration.verify(message.ttl); - if (error) - return "ttl." + error; - } - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - if (!$util.isString(message.primaryProductId)) - return "primaryProductId: string expected"; - if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { - if (!Array.isArray(message.collectionMemberIds)) - return "collectionMemberIds: array expected"; - for (var i = 0; i < message.collectionMemberIds.length; ++i) - if (!$util.isString(message.collectionMemberIds[i])) - return "collectionMemberIds: string[] expected"; - } - if (message.gtin != null && message.hasOwnProperty("gtin")) - if (!$util.isString(message.gtin)) - return "gtin: string expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) - if (!$util.isString(message.categories[i])) - return "categories: string[] expected"; - } - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.brands != null && message.hasOwnProperty("brands")) { - if (!Array.isArray(message.brands)) - return "brands: array expected"; - for (var i = 0; i < message.brands.length; ++i) - if (!$util.isString(message.brands[i])) - return "brands: string[] expected"; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; - } - if (message.rating != null && message.hasOwnProperty("rating")) { - var error = $root.google.cloud.retail.v2.Rating.verify(message.rating); - if (error) - return "rating." + error; - } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.availableTime); - if (error) - return "availableTime." + error; - } - if (message.availability != null && message.hasOwnProperty("availability")) - switch (message.availability) { - default: - return "availability: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); - if (error) - return "availableQuantity." + error; - } - if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { - if (!Array.isArray(message.fulfillmentInfo)) - return "fulfillmentInfo: array expected"; - for (var i = 0; i < message.fulfillmentInfo.length; ++i) { - var error = $root.google.cloud.retail.v2.FulfillmentInfo.verify(message.fulfillmentInfo[i]); - if (error) - return "fulfillmentInfo." + error; - } - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.images != null && message.hasOwnProperty("images")) { - if (!Array.isArray(message.images)) - return "images: array expected"; - for (var i = 0; i < message.images.length; ++i) { - var error = $root.google.cloud.retail.v2.Image.verify(message.images[i]); - if (error) - return "images." + error; - } - } - if (message.audience != null && message.hasOwnProperty("audience")) { - var error = $root.google.cloud.retail.v2.Audience.verify(message.audience); - if (error) - return "audience." + error; - } - if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { - var error = $root.google.cloud.retail.v2.ColorInfo.verify(message.colorInfo); - if (error) - return "colorInfo." + error; - } - if (message.sizes != null && message.hasOwnProperty("sizes")) { - if (!Array.isArray(message.sizes)) - return "sizes: array expected"; - for (var i = 0; i < message.sizes.length; ++i) - if (!$util.isString(message.sizes[i])) - return "sizes: string[] expected"; - } - if (message.materials != null && message.hasOwnProperty("materials")) { - if (!Array.isArray(message.materials)) - return "materials: array expected"; - for (var i = 0; i < message.materials.length; ++i) - if (!$util.isString(message.materials[i])) - return "materials: string[] expected"; - } - if (message.patterns != null && message.hasOwnProperty("patterns")) { - if (!Array.isArray(message.patterns)) - return "patterns: array expected"; - for (var i = 0; i < message.patterns.length; ++i) - if (!$util.isString(message.patterns[i])) - return "patterns: string[] expected"; - } - if (message.conditions != null && message.hasOwnProperty("conditions")) { - if (!Array.isArray(message.conditions)) - return "conditions: array expected"; - for (var i = 0; i < message.conditions.length; ++i) - if (!$util.isString(message.conditions[i])) - return "conditions: string[] expected"; - } - if (message.promotions != null && message.hasOwnProperty("promotions")) { - if (!Array.isArray(message.promotions)) - return "promotions: array expected"; - for (var i = 0; i < message.promotions.length; ++i) { - var error = $root.google.cloud.retail.v2.Promotion.verify(message.promotions[i]); - if (error) - return "promotions." + error; - } - } - if (message.publishTime != null && message.hasOwnProperty("publishTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.publishTime); - if (error) - return "publishTime." + error; - } - if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { - var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); - if (error) - return "retrievableFields." + error; - } - if (message.variants != null && message.hasOwnProperty("variants")) { - if (!Array.isArray(message.variants)) - return "variants: array expected"; - for (var i = 0; i < message.variants.length; ++i) { - var error = $root.google.cloud.retail.v2.Product.verify(message.variants[i]); - if (error) - return "variants." + error; - } - } - return null; - }; - - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.Product - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Product} Product - */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Product) - return object; - var message = new $root.google.cloud.retail.v2.Product(); - if (object.expireTime != null) { - if (typeof object.expireTime !== "object") - throw TypeError(".google.cloud.retail.v2.Product.expireTime: object expected"); - message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); - } - if (object.ttl != null) { - if (typeof object.ttl !== "object") - throw TypeError(".google.cloud.retail.v2.Product.ttl: object expected"); - message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); - } - if (object.name != null) - message.name = String(object.name); - if (object.id != null) - message.id = String(object.id); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "VARIANT": - case 2: - message.type = 2; - break; - case "COLLECTION": - case 3: - message.type = 3; - break; - } - if (object.primaryProductId != null) - message.primaryProductId = String(object.primaryProductId); - if (object.collectionMemberIds) { - if (!Array.isArray(object.collectionMemberIds)) - throw TypeError(".google.cloud.retail.v2.Product.collectionMemberIds: array expected"); - message.collectionMemberIds = []; - for (var i = 0; i < object.collectionMemberIds.length; ++i) - message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); - } - if (object.gtin != null) - message.gtin = String(object.gtin); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.retail.v2.Product.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) - message.categories[i] = String(object.categories[i]); - } - if (object.title != null) - message.title = String(object.title); - if (object.brands) { - if (!Array.isArray(object.brands)) - throw TypeError(".google.cloud.retail.v2.Product.brands: array expected"); - message.brands = []; - for (var i = 0; i < object.brands.length; ++i) - message.brands[i] = String(object.brands[i]); - } - if (object.description != null) - message.description = String(object.description); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.retail.v2.Product.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2.Product.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.fromObject(object.priceInfo); - } - if (object.rating != null) { - if (typeof object.rating !== "object") - throw TypeError(".google.cloud.retail.v2.Product.rating: object expected"); - message.rating = $root.google.cloud.retail.v2.Rating.fromObject(object.rating); - } - if (object.availableTime != null) { - if (typeof object.availableTime !== "object") - throw TypeError(".google.cloud.retail.v2.Product.availableTime: object expected"); - message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); - } - switch (object.availability) { - case "AVAILABILITY_UNSPECIFIED": - case 0: - message.availability = 0; - break; - case "IN_STOCK": - case 1: - message.availability = 1; - break; - case "OUT_OF_STOCK": - case 2: - message.availability = 2; - break; - case "PREORDER": - case 3: - message.availability = 3; - break; - case "BACKORDER": - case 4: - message.availability = 4; - break; - } - if (object.availableQuantity != null) { - if (typeof object.availableQuantity !== "object") - throw TypeError(".google.cloud.retail.v2.Product.availableQuantity: object expected"); - message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); - } - if (object.fulfillmentInfo) { - if (!Array.isArray(object.fulfillmentInfo)) - throw TypeError(".google.cloud.retail.v2.Product.fulfillmentInfo: array expected"); - message.fulfillmentInfo = []; - for (var i = 0; i < object.fulfillmentInfo.length; ++i) { - if (typeof object.fulfillmentInfo[i] !== "object") - throw TypeError(".google.cloud.retail.v2.Product.fulfillmentInfo: object expected"); - message.fulfillmentInfo[i] = $root.google.cloud.retail.v2.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); - } - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.images) { - if (!Array.isArray(object.images)) - throw TypeError(".google.cloud.retail.v2.Product.images: array expected"); - message.images = []; - for (var i = 0; i < object.images.length; ++i) { - if (typeof object.images[i] !== "object") - throw TypeError(".google.cloud.retail.v2.Product.images: object expected"); - message.images[i] = $root.google.cloud.retail.v2.Image.fromObject(object.images[i]); - } - } - if (object.audience != null) { - if (typeof object.audience !== "object") - throw TypeError(".google.cloud.retail.v2.Product.audience: object expected"); - message.audience = $root.google.cloud.retail.v2.Audience.fromObject(object.audience); - } - if (object.colorInfo != null) { - if (typeof object.colorInfo !== "object") - throw TypeError(".google.cloud.retail.v2.Product.colorInfo: object expected"); - message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.fromObject(object.colorInfo); - } - if (object.sizes) { - if (!Array.isArray(object.sizes)) - throw TypeError(".google.cloud.retail.v2.Product.sizes: array expected"); - message.sizes = []; - for (var i = 0; i < object.sizes.length; ++i) - message.sizes[i] = String(object.sizes[i]); - } - if (object.materials) { - if (!Array.isArray(object.materials)) - throw TypeError(".google.cloud.retail.v2.Product.materials: array expected"); - message.materials = []; - for (var i = 0; i < object.materials.length; ++i) - message.materials[i] = String(object.materials[i]); - } - if (object.patterns) { - if (!Array.isArray(object.patterns)) - throw TypeError(".google.cloud.retail.v2.Product.patterns: array expected"); - message.patterns = []; - for (var i = 0; i < object.patterns.length; ++i) - message.patterns[i] = String(object.patterns[i]); - } - if (object.conditions) { - if (!Array.isArray(object.conditions)) - throw TypeError(".google.cloud.retail.v2.Product.conditions: array expected"); - message.conditions = []; - for (var i = 0; i < object.conditions.length; ++i) - message.conditions[i] = String(object.conditions[i]); - } - if (object.promotions) { - if (!Array.isArray(object.promotions)) - throw TypeError(".google.cloud.retail.v2.Product.promotions: array expected"); - message.promotions = []; - for (var i = 0; i < object.promotions.length; ++i) { - if (typeof object.promotions[i] !== "object") - throw TypeError(".google.cloud.retail.v2.Product.promotions: object expected"); - message.promotions[i] = $root.google.cloud.retail.v2.Promotion.fromObject(object.promotions[i]); - } - } - if (object.publishTime != null) { - if (typeof object.publishTime !== "object") - throw TypeError(".google.cloud.retail.v2.Product.publishTime: object expected"); - message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); - } - if (object.retrievableFields != null) { - if (typeof object.retrievableFields !== "object") - throw TypeError(".google.cloud.retail.v2.Product.retrievableFields: object expected"); - message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); - } - if (object.variants) { - if (!Array.isArray(object.variants)) - throw TypeError(".google.cloud.retail.v2.Product.variants: array expected"); - message.variants = []; - for (var i = 0; i < object.variants.length; ++i) { - if (typeof object.variants[i] !== "object") - throw TypeError(".google.cloud.retail.v2.Product.variants: object expected"); - message.variants[i] = $root.google.cloud.retail.v2.Product.fromObject(object.variants[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.Product - * @static - * @param {google.cloud.retail.v2.Product} message Product - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Product.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.collectionMemberIds = []; - object.categories = []; - object.brands = []; - object.tags = []; - object.fulfillmentInfo = []; - object.images = []; - object.sizes = []; - object.materials = []; - object.patterns = []; - object.conditions = []; - object.variants = []; - object.promotions = []; - } - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) { - object.name = ""; - object.id = ""; - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.primaryProductId = ""; - object.gtin = ""; - object.title = ""; - object.description = ""; - object.languageCode = ""; - object.priceInfo = null; - object.rating = null; - object.availableTime = null; - object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; - object.availableQuantity = null; - object.uri = ""; - object.audience = null; - object.colorInfo = null; - object.retrievableFields = null; - object.publishTime = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2.Product.Type[message.type] : message.type; - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - object.primaryProductId = message.primaryProductId; - if (message.collectionMemberIds && message.collectionMemberIds.length) { - object.collectionMemberIds = []; - for (var j = 0; j < message.collectionMemberIds.length; ++j) - object.collectionMemberIds[j] = message.collectionMemberIds[j]; - } - if (message.gtin != null && message.hasOwnProperty("gtin")) - object.gtin = message.gtin; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = message.categories[j]; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.brands && message.brands.length) { - object.brands = []; - for (var j = 0; j < message.brands.length; ++j) - object.brands[j] = message.brands[j]; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2.PriceInfo.toObject(message.priceInfo, options); - if (message.rating != null && message.hasOwnProperty("rating")) - object.rating = $root.google.cloud.retail.v2.Rating.toObject(message.rating, options); - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); - if (options.oneofs) - object.expiration = "expireTime"; - } - if (message.ttl != null && message.hasOwnProperty("ttl")) { - object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); - if (options.oneofs) - object.expiration = "ttl"; + + /** + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) - object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); - if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2.Product.Availability[message.availability] : message.availability; - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) - object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); - if (message.fulfillmentInfo && message.fulfillmentInfo.length) { - object.fulfillmentInfo = []; - for (var j = 0; j < message.fulfillmentInfo.length; ++j) - object.fulfillmentInfo[j] = $root.google.cloud.retail.v2.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.images && message.images.length) { - object.images = []; - for (var j = 0; j < message.images.length; ++j) - object.images[j] = $root.google.cloud.retail.v2.Image.toObject(message.images[j], options); + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } } - if (message.audience != null && message.hasOwnProperty("audience")) - object.audience = $root.google.cloud.retail.v2.Audience.toObject(message.audience, options); - if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) - object.colorInfo = $root.google.cloud.retail.v2.ColorInfo.toObject(message.colorInfo, options); - if (message.sizes && message.sizes.length) { - object.sizes = []; - for (var j = 0; j < message.sizes.length; ++j) - object.sizes[j] = message.sizes[j]; + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.fromObject(object.productInlineSource); } - if (message.materials && message.materials.length) { - object.materials = []; - for (var j = 0; j < message.materials.length; ++j) - object.materials[j] = message.materials[j]; + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); } - if (message.patterns && message.patterns.length) { - object.patterns = []; - for (var j = 0; j < message.patterns.length; ++j) - object.patterns[j] = message.patterns[j]; + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); } - if (message.conditions && message.conditions.length) { - object.conditions = []; - for (var j = 0; j < message.conditions.length; ++j) - object.conditions[j] = message.conditions[j]; + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {google.cloud.retail.v2.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; } - if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) - object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); - if (message.variants && message.variants.length) { - object.variants = []; - for (var j = 0; j < message.variants.length; ++j) - object.variants[j] = $root.google.cloud.retail.v2.Product.toObject(message.variants[j], options); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; } - if (message.publishTime != null && message.hasOwnProperty("publishTime")) - object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); - if (message.promotions && message.promotions.length) { - object.promotions = []; - for (var j = 0; j < message.promotions.length; ++j) - object.promotions[j] = $root.google.cloud.retail.v2.Promotion.toObject(message.promotions[j], options); + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } return object; }; /** - * Converts this Product to JSON. + * Converts this ProductInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Product + * @memberof google.cloud.retail.v2.ProductInputConfig * @instance * @returns {Object.} JSON object */ - Product.prototype.toJSON = function toJSON() { + ProductInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.retail.v2.Product.Type - * @enum {number} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} VARIANT=2 VARIANT value - * @property {number} COLLECTION=3 COLLECTION value - */ - Product.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "VARIANT"] = 2; - values[valuesById[3] = "COLLECTION"] = 3; - return values; - })(); - - /** - * Availability enum. - * @name google.cloud.retail.v2.Product.Availability - * @enum {number} - * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value - * @property {number} IN_STOCK=1 IN_STOCK value - * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value - * @property {number} PREORDER=3 PREORDER value - * @property {number} BACKORDER=4 BACKORDER value - */ - Product.Availability = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "IN_STOCK"] = 1; - values[valuesById[2] = "OUT_OF_STOCK"] = 2; - values[valuesById[3] = "PREORDER"] = 3; - values[valuesById[4] = "BACKORDER"] = 4; - return values; - })(); - - return Product; + return ProductInputConfig; })(); - v2.UserEvent = (function() { + v2.UserEventInputConfig = (function() { /** - * Properties of a UserEvent. + * Properties of a UserEventInputConfig. * @memberof google.cloud.retail.v2 - * @interface IUserEvent - * @property {string|null} [eventType] UserEvent eventType - * @property {string|null} [visitorId] UserEvent visitorId - * @property {string|null} [sessionId] UserEvent sessionId - * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime - * @property {Array.|null} [experimentIds] UserEvent experimentIds - * @property {string|null} [attributionToken] UserEvent attributionToken - * @property {Array.|null} [productDetails] UserEvent productDetails - * @property {google.cloud.retail.v2.ICompletionDetail|null} [completionDetail] UserEvent completionDetail - * @property {Object.|null} [attributes] UserEvent attributes - * @property {string|null} [cartId] UserEvent cartId - * @property {google.cloud.retail.v2.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction - * @property {string|null} [searchQuery] UserEvent searchQuery - * @property {string|null} [filter] UserEvent filter - * @property {string|null} [orderBy] UserEvent orderBy - * @property {number|null} [offset] UserEvent offset - * @property {Array.|null} [pageCategories] UserEvent pageCategories - * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] UserEvent userInfo - * @property {string|null} [uri] UserEvent uri - * @property {string|null} [referrerUri] UserEvent referrerUri - * @property {string|null} [pageViewId] UserEvent pageViewId + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource */ /** - * Constructs a new UserEvent. + * Constructs a new UserEventInputConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEvent. - * @implements IUserEvent + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig * @constructor - * @param {google.cloud.retail.v2.IUserEvent=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set */ - function UserEvent(properties) { - this.experimentIds = []; - this.productDetails = []; - this.attributes = {}; - this.pageCategories = []; + function UserEventInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -8766,353 +8316,366 @@ } /** - * UserEvent eventType. - * @member {string} eventType - * @memberof google.cloud.retail.v2.UserEvent + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2.UserEventInputConfig * @instance */ - UserEvent.prototype.eventType = ""; + UserEventInputConfig.prototype.userEventInlineSource = null; /** - * UserEvent visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2.UserEvent + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2.UserEventInputConfig * @instance */ - UserEvent.prototype.visitorId = ""; + UserEventInputConfig.prototype.gcsSource = null; /** - * UserEvent sessionId. - * @member {string} sessionId - * @memberof google.cloud.retail.v2.UserEvent + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.UserEventInputConfig * @instance */ - UserEvent.prototype.sessionId = ""; + UserEventInputConfig.prototype.bigQuerySource = null; - /** - * UserEvent eventTime. - * @member {google.protobuf.ITimestamp|null|undefined} eventTime - * @memberof google.cloud.retail.v2.UserEvent - * @instance - */ - UserEvent.prototype.eventTime = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * UserEvent experimentIds. - * @member {Array.} experimentIds - * @memberof google.cloud.retail.v2.UserEvent + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.UserEventInputConfig * @instance */ - UserEvent.prototype.experimentIds = $util.emptyArray; + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * UserEvent attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig instance */ - UserEvent.prototype.attributionToken = ""; + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; /** - * UserEvent productDetails. - * @member {Array.} productDetails - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.productDetails = $util.emptyArray; + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; /** - * UserEvent completionDetail. - * @member {google.cloud.retail.v2.ICompletionDetail|null|undefined} completionDetail - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.completionDetail = null; + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * UserEvent attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.attributes = $util.emptyObject; + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * UserEvent cartId. - * @member {string} cartId - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.cartId = ""; + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * UserEvent purchaseTransaction. - * @member {google.cloud.retail.v2.IPurchaseTransaction|null|undefined} purchaseTransaction - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.prototype.purchaseTransaction = null; + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; /** - * UserEvent searchQuery. - * @member {string} searchQuery - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UserEventInputConfig} UserEventInputConfig */ - UserEvent.prototype.searchQuery = ""; + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventInputConfig) + return object; + var message = new $root.google.cloud.retail.v2.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.fromObject(object.userEventInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; /** - * UserEvent filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2.UserEventInputConfig} message UserEventInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - UserEvent.prototype.filter = ""; + UserEventInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; /** - * UserEvent orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2.UserEvent + * Converts this UserEventInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserEventInputConfig * @instance + * @returns {Object.} JSON object */ - UserEvent.prototype.orderBy = ""; + UserEventInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * UserEvent offset. - * @member {number} offset - * @memberof google.cloud.retail.v2.UserEvent - * @instance - */ - UserEvent.prototype.offset = 0; + return UserEventInputConfig; + })(); + + v2.CompletionDataInputConfig = (function() { /** - * UserEvent pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Properties of a CompletionDataInputConfig. + * @memberof google.cloud.retail.v2 + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource */ - UserEvent.prototype.pageCategories = $util.emptyArray; /** - * UserEvent userInfo. - * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2.UserEvent - * @instance + * Constructs a new CompletionDataInputConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig + * @constructor + * @param {google.cloud.retail.v2.ICompletionDataInputConfig=} [properties] Properties to set */ - UserEvent.prototype.userInfo = null; + function CompletionDataInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * UserEvent uri. - * @member {string} uri - * @memberof google.cloud.retail.v2.UserEvent + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @instance */ - UserEvent.prototype.uri = ""; + CompletionDataInputConfig.prototype.bigQuerySource = null; - /** - * UserEvent referrerUri. - * @member {string} referrerUri - * @memberof google.cloud.retail.v2.UserEvent - * @instance - */ - UserEvent.prototype.referrerUri = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * UserEvent pageViewId. - * @member {string} pageViewId - * @memberof google.cloud.retail.v2.UserEvent + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @instance */ - UserEvent.prototype.pageViewId = ""; + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2.IUserEvent=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserEvent} UserEvent instance + * @param {google.cloud.retail.v2.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig instance */ - UserEvent.create = function create(properties) { - return new UserEvent(properties); + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); }; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encode = function encode(message, writer) { + CompletionDataInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); - if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) - $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.experimentIds != null && message.experimentIds.length) - for (var i = 0; i < message.experimentIds.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.productDetails != null && message.productDetails.length) - for (var i = 0; i < message.productDetails.length; ++i) - $root.google.cloud.retail.v2.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); - if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) - $root.google.cloud.retail.v2.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); - if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); - if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); - if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) - writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); - if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) - $root.google.cloud.retail.v2.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserEvent} UserEvent + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decode = function decode(reader, length) { + CompletionDataInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEvent(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionDataInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.eventType = reader.string(); - break; - case 2: - message.visitorId = reader.string(); - break; - case 21: - message.sessionId = reader.string(); - break; - case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2.ProductDetail.decode(reader, reader.uint32())); - break; - case 22: - message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.decode(reader, reader.uint32()); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 16: - message.filter = reader.string(); - break; - case 17: - message.orderBy = reader.string(); - break; - case 18: - message.offset = reader.int32(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -9123,344 +8686,122 @@ }; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserEvent} UserEvent + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decodeDelimited = function decodeDelimited(reader) { + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEvent message. + * Verifies a CompletionDataInputConfig message. * @function verify - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.verify = function verify(message) { + CompletionDataInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.eventType != null && message.hasOwnProperty("eventType")) - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.sessionId != null && message.hasOwnProperty("sessionId")) - if (!$util.isString(message.sessionId)) - return "sessionId: string expected"; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.eventTime); - if (error) - return "eventTime." + error; - } - if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { - if (!Array.isArray(message.experimentIds)) - return "experimentIds: array expected"; - for (var i = 0; i < message.experimentIds.length; ++i) - if (!$util.isString(message.experimentIds[i])) - return "experimentIds: string[] expected"; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.productDetails != null && message.hasOwnProperty("productDetails")) { - if (!Array.isArray(message.productDetails)) - return "productDetails: array expected"; - for (var i = 0; i < message.productDetails.length; ++i) { - var error = $root.google.cloud.retail.v2.ProductDetail.verify(message.productDetails[i]); - if (error) - return "productDetails." + error; - } - } - if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { - var error = $root.google.cloud.retail.v2.CompletionDetail.verify(message.completionDetail); - if (error) - return "completionDetail." + error; - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2.BigQuerySource.verify(message.bigQuerySource); if (error) - return "attributes." + error; + return "bigQuerySource." + error; } } - if (message.cartId != null && message.hasOwnProperty("cartId")) - if (!$util.isString(message.cartId)) - return "cartId: string expected"; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { - var error = $root.google.cloud.retail.v2.PurchaseTransaction.verify(message.purchaseTransaction); - if (error) - return "purchaseTransaction." + error; - } - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - if (!$util.isString(message.searchQuery)) - return "searchQuery: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; - } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - if (!$util.isString(message.referrerUri)) - return "referrerUri: string expected"; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - if (!$util.isString(message.pageViewId)) - return "pageViewId: string expected"; return null; }; /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UserEvent} UserEvent + * @returns {google.cloud.retail.v2.CompletionDataInputConfig} CompletionDataInputConfig */ - UserEvent.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UserEvent) + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompletionDataInputConfig) return object; - var message = new $root.google.cloud.retail.v2.UserEvent(); - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.sessionId != null) - message.sessionId = String(object.sessionId); - if (object.eventTime != null) { - if (typeof object.eventTime !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.eventTime: object expected"); - message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); - } - if (object.experimentIds) { - if (!Array.isArray(object.experimentIds)) - throw TypeError(".google.cloud.retail.v2.UserEvent.experimentIds: array expected"); - message.experimentIds = []; - for (var i = 0; i < object.experimentIds.length; ++i) - message.experimentIds[i] = String(object.experimentIds[i]); - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.productDetails) { - if (!Array.isArray(object.productDetails)) - throw TypeError(".google.cloud.retail.v2.UserEvent.productDetails: array expected"); - message.productDetails = []; - for (var i = 0; i < object.productDetails.length; ++i) { - if (typeof object.productDetails[i] !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.productDetails: object expected"); - message.productDetails[i] = $root.google.cloud.retail.v2.ProductDetail.fromObject(object.productDetails[i]); - } - } - if (object.completionDetail != null) { - if (typeof object.completionDetail !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.completionDetail: object expected"); - message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.fromObject(object.completionDetail); - } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.cartId != null) - message.cartId = String(object.cartId); - if (object.purchaseTransaction != null) { - if (typeof object.purchaseTransaction !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.purchaseTransaction: object expected"); - message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.fromObject(object.purchaseTransaction); - } - if (object.searchQuery != null) - message.searchQuery = String(object.searchQuery); - if (object.filter != null) - message.filter = String(object.filter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2.UserEvent.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2.UserEvent.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); + var message = new $root.google.cloud.retail.v2.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.fromObject(object.bigQuerySource); } - if (object.uri != null) - message.uri = String(object.uri); - if (object.referrerUri != null) - message.referrerUri = String(object.referrerUri); - if (object.pageViewId != null) - message.pageViewId = String(object.pageViewId); return message; }; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2.UserEvent} message UserEvent + * @param {google.cloud.retail.v2.CompletionDataInputConfig} message CompletionDataInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.experimentIds = []; - object.productDetails = []; - object.pageCategories = []; - } - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) { - object.eventType = ""; - object.visitorId = ""; - object.eventTime = null; - object.attributionToken = ""; - object.cartId = ""; - object.purchaseTransaction = null; - object.searchQuery = ""; - object.userInfo = null; - object.uri = ""; - object.referrerUri = ""; - object.pageViewId = ""; - object.filter = ""; - object.orderBy = ""; - object.offset = 0; - object.sessionId = ""; - object.completionDetail = null; - } - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) - object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); - if (message.experimentIds && message.experimentIds.length) { - object.experimentIds = []; - for (var j = 0; j < message.experimentIds.length; ++j) - object.experimentIds[j] = message.experimentIds[j]; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.productDetails && message.productDetails.length) { - object.productDetails = []; - for (var j = 0; j < message.productDetails.length; ++j) - object.productDetails[j] = $root.google.cloud.retail.v2.ProductDetail.toObject(message.productDetails[j], options); - } - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - object.cartId = message.cartId; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) - object.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.toObject(message.purchaseTransaction, options); - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - object.searchQuery = message.searchQuery; - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; - } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - object.referrerUri = message.referrerUri; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - object.pageViewId = message.pageViewId; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.sessionId != null && message.hasOwnProperty("sessionId")) - object.sessionId = message.sessionId; - if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) - object.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.toObject(message.completionDetail, options); + CompletionDataInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } return object; }; /** - * Converts this UserEvent to JSON. + * Converts this CompletionDataInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UserEvent + * @memberof google.cloud.retail.v2.CompletionDataInputConfig * @instance * @returns {Object.} JSON object */ - UserEvent.prototype.toJSON = function toJSON() { + CompletionDataInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEvent; + return CompletionDataInputConfig; })(); - v2.ProductDetail = (function() { + v2.ImportMetadata = (function() { /** - * Properties of a ProductDetail. + * Properties of an ImportMetadata. * @memberof google.cloud.retail.v2 - * @interface IProductDetail - * @property {google.cloud.retail.v2.IProduct|null} [product] ProductDetail product - * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic */ /** - * Constructs a new ProductDetail. + * Constructs a new ImportMetadata. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductDetail. - * @implements IProductDetail + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata * @constructor - * @param {google.cloud.retail.v2.IProductDetail=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportMetadata=} [properties] Properties to set */ - function ProductDetail(properties) { + function ImportMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9468,88 +8809,140 @@ } /** - * ProductDetail product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.ProductDetail + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2.ImportMetadata * @instance */ - ProductDetail.prototype.product = null; + ImportMetadata.prototype.createTime = null; /** - * ProductDetail quantity. - * @member {google.protobuf.IInt32Value|null|undefined} quantity - * @memberof google.cloud.retail.v2.ProductDetail + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2.ImportMetadata * @instance */ - ProductDetail.prototype.quantity = null; + ImportMetadata.prototype.updateTime = null; /** - * Creates a new ProductDetail instance using the specified properties. + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.requestId = ""; + + /** + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportMetadata + * @instance + */ + ImportMetadata.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static - * @param {google.cloud.retail.v2.IProductDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail instance + * @param {google.cloud.retail.v2.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata instance */ - ProductDetail.create = function create(properties) { - return new ProductDetail(properties); + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); }; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static - * @param {google.cloud.retail.v2.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encode = function encode(message, writer) { + ImportMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) - $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static - * @param {google.cloud.retail.v2.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decode = function decode(reader, length) { + ImportMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductDetail(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + case 5: + message.requestId = reader.string(); + break; + case 6: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -9560,128 +8953,188 @@ }; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decodeDelimited = function decodeDelimited(reader) { + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductDetail message. + * Verifies an ImportMetadata message. * @function verify - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductDetail.verify = function verify(message) { + ImportMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) - return "product." + error; + return "createTime." + error; } - if (message.quantity != null && message.hasOwnProperty("quantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); if (error) - return "quantity." + error; + return "updateTime." + error; } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2.ImportMetadata} ImportMetadata */ - ProductDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ProductDetail) + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportMetadata) return object; - var message = new $root.google.cloud.retail.v2.ProductDetail(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.ProductDetail.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.quantity != null) { - if (typeof object.quantity !== "object") - throw TypeError(".google.cloud.retail.v2.ProductDetail.quantity: object expected"); - message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @static - * @param {google.cloud.retail.v2.ProductDetail} message ProductDetail + * @param {google.cloud.retail.v2.ImportMetadata} message ImportMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductDetail.toObject = function toObject(message, options) { + ImportMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.product = null; - object.quantity = null; + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.quantity != null && message.hasOwnProperty("quantity")) - object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ProductDetail to JSON. + * Converts this ImportMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ProductDetail + * @memberof google.cloud.retail.v2.ImportMetadata * @instance * @returns {Object.} JSON object */ - ProductDetail.prototype.toJSON = function toJSON() { + ImportMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductDetail; + return ImportMetadata; })(); - v2.CompletionDetail = (function() { + v2.ImportProductsResponse = (function() { /** - * Properties of a CompletionDetail. + * Properties of an ImportProductsResponse. * @memberof google.cloud.retail.v2 - * @interface ICompletionDetail - * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken - * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion - * @property {number|null} [selectedPosition] CompletionDetail selectedPosition + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig */ /** - * Constructs a new CompletionDetail. + * Constructs a new ImportProductsResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompletionDetail. - * @implements ICompletionDetail + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse * @constructor - * @param {google.cloud.retail.v2.ICompletionDetail=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportProductsResponse=} [properties] Properties to set */ - function CompletionDetail(properties) { + function ImportProductsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9689,101 +9142,91 @@ } /** - * CompletionDetail completionAttributionToken. - * @member {string} completionAttributionToken - * @memberof google.cloud.retail.v2.CompletionDetail - * @instance - */ - CompletionDetail.prototype.completionAttributionToken = ""; - - /** - * CompletionDetail selectedSuggestion. - * @member {string} selectedSuggestion - * @memberof google.cloud.retail.v2.CompletionDetail + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ImportProductsResponse * @instance */ - CompletionDetail.prototype.selectedSuggestion = ""; + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * CompletionDetail selectedPosition. - * @member {number} selectedPosition - * @memberof google.cloud.retail.v2.CompletionDetail + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportProductsResponse * @instance */ - CompletionDetail.prototype.selectedPosition = 0; + ImportProductsResponse.prototype.errorsConfig = null; /** - * Creates a new CompletionDetail instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static - * @param {google.cloud.retail.v2.ICompletionDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail instance + * @param {google.cloud.retail.v2.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse instance */ - CompletionDetail.create = function create(properties) { - return new CompletionDetail(properties); + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); }; /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static - * @param {google.cloud.retail.v2.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {google.cloud.retail.v2.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDetail.encode = function encode(message, writer) { + ImportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); - if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); - if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static - * @param {google.cloud.retail.v2.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {google.cloud.retail.v2.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompletionDetail message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDetail.decode = function decode(reader, length) { + ImportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionDetail(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.completionAttributionToken = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.selectedSuggestion = reader.string(); - break; - case 3: - message.selectedPosition = reader.int32(); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -9794,128 +9237,141 @@ }; /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDetail.decodeDelimited = function decodeDelimited(reader) { + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompletionDetail message. + * Verifies an ImportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompletionDetail.verify = function verify(message) { + ImportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) - if (!$util.isString(message.completionAttributionToken)) - return "completionAttributionToken: string expected"; - if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) - if (!$util.isString(message.selectedSuggestion)) - return "selectedSuggestion: string expected"; - if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) - if (!$util.isInteger(message.selectedPosition)) - return "selectedPosition: integer expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } return null; }; /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail + * @returns {google.cloud.retail.v2.ImportProductsResponse} ImportProductsResponse */ - CompletionDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompletionDetail) + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2.CompletionDetail(); - if (object.completionAttributionToken != null) - message.completionAttributionToken = String(object.completionAttributionToken); - if (object.selectedSuggestion != null) - message.selectedSuggestion = String(object.selectedSuggestion); - if (object.selectedPosition != null) - message.selectedPosition = object.selectedPosition | 0; + var message = new $root.google.cloud.retail.v2.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + } return message; }; /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @static - * @param {google.cloud.retail.v2.CompletionDetail} message CompletionDetail + * @param {google.cloud.retail.v2.ImportProductsResponse} message ImportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompletionDetail.toObject = function toObject(message, options) { + ImportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.completionAttributionToken = ""; - object.selectedSuggestion = ""; - object.selectedPosition = 0; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) - object.completionAttributionToken = message.completionAttributionToken; - if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) - object.selectedSuggestion = message.selectedSuggestion; - if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) - object.selectedPosition = message.selectedPosition; + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this CompletionDetail to JSON. + * Converts this ImportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CompletionDetail + * @memberof google.cloud.retail.v2.ImportProductsResponse * @instance * @returns {Object.} JSON object */ - CompletionDetail.prototype.toJSON = function toJSON() { + ImportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompletionDetail; + return ImportProductsResponse; })(); - v2.PurchaseTransaction = (function() { + v2.ImportUserEventsResponse = (function() { /** - * Properties of a PurchaseTransaction. + * Properties of an ImportUserEventsResponse. * @memberof google.cloud.retail.v2 - * @interface IPurchaseTransaction - * @property {string|null} [id] PurchaseTransaction id - * @property {number|null} [revenue] PurchaseTransaction revenue - * @property {number|null} [tax] PurchaseTransaction tax - * @property {number|null} [cost] PurchaseTransaction cost - * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary */ /** - * Constructs a new PurchaseTransaction. + * Constructs a new ImportUserEventsResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurchaseTransaction. - * @implements IPurchaseTransaction + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse * @constructor - * @param {google.cloud.retail.v2.IPurchaseTransaction=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportUserEventsResponse=} [properties] Properties to set */ - function PurchaseTransaction(properties) { + function ImportUserEventsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9923,127 +9379,104 @@ } /** - * PurchaseTransaction id. - * @member {string} id - * @memberof google.cloud.retail.v2.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.id = ""; - - /** - * PurchaseTransaction revenue. - * @member {number} revenue - * @memberof google.cloud.retail.v2.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.revenue = 0; - - /** - * PurchaseTransaction tax. - * @member {number} tax - * @memberof google.cloud.retail.v2.PurchaseTransaction + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @instance */ - PurchaseTransaction.prototype.tax = 0; + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; /** - * PurchaseTransaction cost. - * @member {number} cost - * @memberof google.cloud.retail.v2.PurchaseTransaction + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @instance */ - PurchaseTransaction.prototype.cost = 0; + ImportUserEventsResponse.prototype.errorsConfig = null; /** - * PurchaseTransaction currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2.PurchaseTransaction + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @instance */ - PurchaseTransaction.prototype.currencyCode = ""; + ImportUserEventsResponse.prototype.importSummary = null; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2.IPurchaseTransaction=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction instance + * @param {google.cloud.retail.v2.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse instance */ - PurchaseTransaction.create = function create(properties) { - return new PurchaseTransaction(properties); + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); }; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encode = function encode(message, writer) { + ImportUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); - if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decode = function decode(reader, length) { + ImportUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurchaseTransaction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.revenue = reader.float(); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); break; case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); + message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -10054,309 +9487,153 @@ }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurchaseTransaction message. + * Verifies an ImportUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurchaseTransaction.verify = function verify(message) { + ImportUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.revenue != null && message.hasOwnProperty("revenue")) - if (typeof message.revenue !== "number") - return "revenue: number expected"; - if (message.tax != null && message.hasOwnProperty("tax")) - if (typeof message.tax !== "number") - return "tax: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } return null; }; /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2.ImportUserEventsResponse} ImportUserEventsResponse */ - PurchaseTransaction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurchaseTransaction) + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2.PurchaseTransaction(); - if (object.id != null) - message.id = String(object.id); - if (object.revenue != null) - message.revenue = Number(object.revenue); - if (object.tax != null) - message.tax = Number(object.tax); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); + var message = new $root.google.cloud.retail.v2.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.fromObject(object.importSummary); + } return message; }; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2.PurchaseTransaction} message PurchaseTransaction + * @param {google.cloud.retail.v2.ImportUserEventsResponse} message ImportUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurchaseTransaction.toObject = function toObject(message, options) { + ImportUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; if (options.defaults) { - object.id = ""; - object.revenue = 0; - object.tax = 0; - object.cost = 0; - object.currencyCode = ""; + object.errorsConfig = null; + object.importSummary = null; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.revenue != null && message.hasOwnProperty("revenue")) - object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; - if (message.tax != null && message.hasOwnProperty("tax")) - object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this ImportUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurchaseTransaction + * @memberof google.cloud.retail.v2.ImportUserEventsResponse * @instance * @returns {Object.} JSON object */ - PurchaseTransaction.prototype.toJSON = function toJSON() { + ImportUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurchaseTransaction; - })(); - - v2.CatalogService = (function() { - - /** - * Constructs a new CatalogService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CatalogService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.CatalogService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. - */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef ListCatalogsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse - */ - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef UpdateCatalogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Catalog} [response] Catalog - */ - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef SetDefaultBranchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { - return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "SetDefaultBranch" }); - - /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef GetDefaultBranchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.GetDefaultBranchResponse} [response] GetDefaultBranchResponse - */ - - /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { - return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2.GetDefaultBranchRequest, $root.google.cloud.retail.v2.GetDefaultBranchResponse, request, callback); - }, "name", { value: "GetDefaultBranch" }); - - /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return CatalogService; + return ImportUserEventsResponse; })(); - v2.ListCatalogsRequest = (function() { + v2.UserEventImportSummary = (function() { /** - * Properties of a ListCatalogsRequest. + * Properties of a UserEventImportSummary. * @memberof google.cloud.retail.v2 - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount */ /** - * Constructs a new ListCatalogsRequest. + * Constructs a new UserEventImportSummary. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary * @constructor - * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUserEventImportSummary=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function UserEventImportSummary(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10364,101 +9641,88 @@ } /** - * ListCatalogsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ListCatalogsRequest - * @instance - */ - ListCatalogsRequest.prototype.parent = ""; - - /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2.UserEventImportSummary * @instance */ - ListCatalogsRequest.prototype.pageSize = 0; + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2.UserEventImportSummary * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + UserEventImportSummary.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + UserEventImportSummary.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventImportSummary(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.joinedEventsCount = reader.int64(); break; case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); + message.unjoinedEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -10469,126 +9733,145 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies a UserEventImportSummary message. * @function verify - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + UserEventImportSummary.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.UserEventImportSummary} UserEventImportSummary */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventImportSummary) return object; - var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + var message = new $root.google.cloud.retail.v2.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @static - * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2.UserEventImportSummary} message UserEventImportSummary * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + UserEventImportSummary.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; return object; }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this UserEventImportSummary to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.UserEventImportSummary * @instance * @returns {Object.} JSON object */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { + UserEventImportSummary.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsRequest; + return UserEventImportSummary; })(); - v2.ListCatalogsResponse = (function() { + v2.ImportCompletionDataResponse = (function() { /** - * Properties of a ListCatalogsResponse. + * Properties of an ImportCompletionDataResponse. * @memberof google.cloud.retail.v2 - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples */ /** - * Constructs a new ListCatalogsResponse. + * Constructs a new ImportCompletionDataResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse * @constructor - * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportCompletionDataResponse=} [properties] Properties to set */ - function ListCatalogsResponse(properties) { - this.catalogs = []; + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10596,91 +9879,78 @@ } /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2.ListCatalogsResponse - * @instance - */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; - - /** - * ListCatalogsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @instance */ - ListCatalogsResponse.prototype.nextPageToken = ""; + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance + * @param {google.cloud.retail.v2.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse instance */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); }; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encode = function encode(message, writer) { + ImportCompletionDataResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decode = function decode(reader, length) { + ImportCompletionDataResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportCompletionDataResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -10691,134 +9961,169 @@ }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsResponse message. + * Verifies an ImportCompletionDataResponse message. * @function verify - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsResponse.verify = function verify(message) { + ImportCompletionDataResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); if (error) - return "catalogs." + error; + return "errorSamples." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; return null; }; /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.ImportCompletionDataResponse} ImportCompletionDataResponse */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportCompletionDataResponse) return object; - var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); + var message = new $root.google.cloud.retail.v2.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); } } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse + * @param {google.cloud.retail.v2.ImportCompletionDataResponse} message ImportCompletionDataResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsResponse.toObject = function toObject(message, options) { + ImportCompletionDataResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.catalogs = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse * @instance * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsResponse; + return ImportCompletionDataResponse; })(); - v2.UpdateCatalogRequest = (function() { + v2.Product = (function() { /** - * Properties of an UpdateCatalogRequest. + * Properties of a Product. * @memberof google.cloud.retail.v2 - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands + * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2.IRating|null} [rating] Product rating + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants */ /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new Product. * @memberof google.cloud.retail.v2 - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest + * @classdesc Represents a Product. + * @implements IProduct * @constructor - * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set */ - function UpdateCatalogRequest(properties) { + function Product(properties) { + this.collectionMemberIds = []; + this.categories = []; + this.brands = []; + this.attributes = {}; + this.tags = []; + this.fulfillmentInfo = []; + this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10826,322 +10131,563 @@ } /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.expireTime = null; + + /** + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.ttl = null; + + /** + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.name = ""; + + /** + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.id = ""; + + /** + * Product type. + * @member {google.cloud.retail.v2.Product.Type} type + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.type = 0; + + /** + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.primaryProductId = ""; + + /** + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.collectionMemberIds = $util.emptyArray; + + /** + * Product gtin. + * @member {string} gtin + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.gtin = ""; + + /** + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.categories = $util.emptyArray; + + /** + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.title = ""; + + /** + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.brands = $util.emptyArray; + + /** + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.description = ""; + + /** + * Product languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.languageCode = ""; + + /** + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product rating. + * @member {google.cloud.retail.v2.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.rating = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2.Product * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + Product.prototype.availableTime = null; /** - * UpdateCatalogRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * Product availability. + * @member {google.cloud.retail.v2.Product.Availability} availability + * @memberof google.cloud.retail.v2.Product * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + Product.prototype.availability = 0; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); - }; + Product.prototype.availableQuantity = null; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + Product.prototype.fulfillmentInfo = $util.emptyArray; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Product.prototype.uri = ""; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + Product.prototype.images = $util.emptyArray; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product audience. + * @member {google.cloud.retail.v2.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Product.prototype.audience = null; /** - * Verifies an UpdateCatalogRequest message. - * @function verify - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Product colorInfo. + * @member {google.cloud.retail.v2.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); - if (error) - return "catalog." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; + Product.prototype.colorInfo = null; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) - return object; - var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; + Product.prototype.sizes = $util.emptyArray; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2.Product + * @instance */ - UpdateCatalogRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.catalog = null; - object.updateMask = null; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; + Product.prototype.materials = $util.emptyArray; /** - * Converts this UpdateCatalogRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2.Product * @instance - * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UpdateCatalogRequest; - })(); + Product.prototype.patterns = $util.emptyArray; - v2.SetDefaultBranchRequest = (function() { + /** + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.conditions = $util.emptyArray; /** - * Properties of a SetDefaultBranchRequest. - * @memberof google.cloud.retail.v2 - * @interface ISetDefaultBranchRequest - * @property {string|null} [catalog] SetDefaultBranchRequest catalog - * @property {string|null} [branchId] SetDefaultBranchRequest branchId - * @property {string|null} [note] SetDefaultBranchRequest note + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2.Product + * @instance */ + Product.prototype.promotions = $util.emptyArray; /** - * Constructs a new SetDefaultBranchRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a SetDefaultBranchRequest. - * @implements ISetDefaultBranchRequest - * @constructor - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2.Product + * @instance */ - function SetDefaultBranchRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Product.prototype.publishTime = null; /** - * SetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2.Product * @instance */ - SetDefaultBranchRequest.prototype.catalog = ""; + Product.prototype.retrievableFields = null; /** - * SetDefaultBranchRequest branchId. - * @member {string} branchId - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2.Product * @instance */ - SetDefaultBranchRequest.prototype.branchId = ""; + Product.prototype.variants = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * SetDefaultBranchRequest note. - * @member {string} note - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2.Product * @instance */ - SetDefaultBranchRequest.prototype.note = ""; + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. + * Creates a new Product instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest instance + * @param {google.cloud.retail.v2.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Product} Product instance */ - SetDefaultBranchRequest.create = function create(properties) { - return new SetDefaultBranchRequest(properties); + Product.create = function create(properties) { + return new Product(properties); }; /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2.IProduct} message Product message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetDefaultBranchRequest.encode = function encode(message, writer) { + Product.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) + $root.google.cloud.retail.v2.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + $root.google.cloud.retail.v2.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) + $root.google.cloud.retail.v2.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.sizes != null && message.sizes.length) + for (var i = 0; i < message.sizes.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); + if (message.materials != null && message.materials.length) + for (var i = 0; i < message.materials.length; ++i) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); + if (message.patterns != null && message.patterns.length) + for (var i = 0; i < message.patterns.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); + if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) + $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.variants != null && message.variants.length) + for (var i = 0; i < message.variants.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.promotions != null && message.promotions.length) + for (var i = 0; i < message.promotions.length; ++i) + $root.google.cloud.retail.v2.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); return writer; }; /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2.IProduct} message Product message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + Product.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Product} Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetDefaultBranchRequest.decode = function decode(reader, length) { + Product.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Product(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 16: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; case 1: - message.catalog = reader.string(); + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 5: + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + case 6: + message.gtin = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 9: + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + case 10: + message.description = reader.string(); + break; + case 11: + message.languageCode = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); + break; + case 15: + message.rating = $root.google.cloud.retail.v2.Rating.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 21: + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2.FulfillmentInfo.decode(reader, reader.uint32())); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2.Image.decode(reader, reader.uint32())); + break; + case 24: + message.audience = $root.google.cloud.retail.v2.Audience.decode(reader, reader.uint32()); + break; + case 25: + message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.decode(reader, reader.uint32()); + break; + case 26: + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); break; - case 2: - message.branchId = reader.string(); + case 27: + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); break; - case 3: - message.note = reader.string(); + case 28: + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + case 29: + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + case 34: + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2.Promotion.decode(reader, reader.uint32())); + break; + case 33: + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 30: + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 31: + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -11152,124 +10698,725 @@ }; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Product} Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + Product.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetDefaultBranchRequest message. + * Verifies a Product message. * @function verify - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetDefaultBranchRequest.verify = function verify(message) { + Product.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.branchId != null && message.hasOwnProperty("branchId")) - if (!$util.isString(message.branchId)) - return "branchId: string expected"; - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; + var properties = {}; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.ttl); + if (error) + return "ttl." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { + if (!Array.isArray(message.collectionMemberIds)) + return "collectionMemberIds: array expected"; + for (var i = 0; i < message.collectionMemberIds.length; ++i) + if (!$util.isString(message.collectionMemberIds[i])) + return "collectionMemberIds: string[] expected"; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + if (!$util.isString(message.gtin)) + return "gtin: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.brands != null && message.hasOwnProperty("brands")) { + if (!Array.isArray(message.brands)) + return "brands: array expected"; + for (var i = 0; i < message.brands.length; ++i) + if (!$util.isString(message.brands[i])) + return "brands: string[] expected"; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.rating != null && message.hasOwnProperty("rating")) { + var error = $root.google.cloud.retail.v2.Rating.verify(message.rating); + if (error) + return "rating." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + if (!Array.isArray(message.fulfillmentInfo)) + return "fulfillmentInfo: array expected"; + for (var i = 0; i < message.fulfillmentInfo.length; ++i) { + var error = $root.google.cloud.retail.v2.FulfillmentInfo.verify(message.fulfillmentInfo[i]); + if (error) + return "fulfillmentInfo." + error; + } + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + if (message.audience != null && message.hasOwnProperty("audience")) { + var error = $root.google.cloud.retail.v2.Audience.verify(message.audience); + if (error) + return "audience." + error; + } + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { + var error = $root.google.cloud.retail.v2.ColorInfo.verify(message.colorInfo); + if (error) + return "colorInfo." + error; + } + if (message.sizes != null && message.hasOwnProperty("sizes")) { + if (!Array.isArray(message.sizes)) + return "sizes: array expected"; + for (var i = 0; i < message.sizes.length; ++i) + if (!$util.isString(message.sizes[i])) + return "sizes: string[] expected"; + } + if (message.materials != null && message.hasOwnProperty("materials")) { + if (!Array.isArray(message.materials)) + return "materials: array expected"; + for (var i = 0; i < message.materials.length; ++i) + if (!$util.isString(message.materials[i])) + return "materials: string[] expected"; + } + if (message.patterns != null && message.hasOwnProperty("patterns")) { + if (!Array.isArray(message.patterns)) + return "patterns: array expected"; + for (var i = 0; i < message.patterns.length; ++i) + if (!$util.isString(message.patterns[i])) + return "patterns: string[] expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) + if (!$util.isString(message.conditions[i])) + return "conditions: string[] expected"; + } + if (message.promotions != null && message.hasOwnProperty("promotions")) { + if (!Array.isArray(message.promotions)) + return "promotions: array expected"; + for (var i = 0; i < message.promotions.length; ++i) { + var error = $root.google.cloud.retail.v2.Promotion.verify(message.promotions[i]); + if (error) + return "promotions." + error; + } + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.publishTime); + if (error) + return "publishTime." + error; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { + var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); + if (error) + return "retrievableFields." + error; + } + if (message.variants != null && message.hasOwnProperty("variants")) { + if (!Array.isArray(message.variants)) + return "variants: array expected"; + for (var i = 0; i < message.variants.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.variants[i]); + if (error) + return "variants." + error; + } + } return null; }; /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Product} Product */ - SetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SetDefaultBranchRequest) + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Product) return object; - var message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.branchId != null) - message.branchId = String(object.branchId); - if (object.note != null) - message.note = String(object.note); + var message = new $root.google.cloud.retail.v2.Product(); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.retail.v2.Product.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + if (object.ttl != null) { + if (typeof object.ttl !== "object") + throw TypeError(".google.cloud.retail.v2.Product.ttl: object expected"); + message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); + } + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.collectionMemberIds) { + if (!Array.isArray(object.collectionMemberIds)) + throw TypeError(".google.cloud.retail.v2.Product.collectionMemberIds: array expected"); + message.collectionMemberIds = []; + for (var i = 0; i < object.collectionMemberIds.length; ++i) + message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); + } + if (object.gtin != null) + message.gtin = String(object.gtin); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.brands) { + if (!Array.isArray(object.brands)) + throw TypeError(".google.cloud.retail.v2.Product.brands: array expected"); + message.brands = []; + for (var i = 0; i < object.brands.length; ++i) + message.brands[i] = String(object.brands[i]); + } + if (object.description != null) + message.description = String(object.description); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.fromObject(object.priceInfo); + } + if (object.rating != null) { + if (typeof object.rating !== "object") + throw TypeError(".google.cloud.retail.v2.Product.rating: object expected"); + message.rating = $root.google.cloud.retail.v2.Rating.fromObject(object.rating); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.fulfillmentInfo) { + if (!Array.isArray(object.fulfillmentInfo)) + throw TypeError(".google.cloud.retail.v2.Product.fulfillmentInfo: array expected"); + message.fulfillmentInfo = []; + for (var i = 0; i < object.fulfillmentInfo.length; ++i) { + if (typeof object.fulfillmentInfo[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.fulfillmentInfo: object expected"); + message.fulfillmentInfo[i] = $root.google.cloud.retail.v2.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); + } + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2.Image.fromObject(object.images[i]); + } + } + if (object.audience != null) { + if (typeof object.audience !== "object") + throw TypeError(".google.cloud.retail.v2.Product.audience: object expected"); + message.audience = $root.google.cloud.retail.v2.Audience.fromObject(object.audience); + } + if (object.colorInfo != null) { + if (typeof object.colorInfo !== "object") + throw TypeError(".google.cloud.retail.v2.Product.colorInfo: object expected"); + message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.fromObject(object.colorInfo); + } + if (object.sizes) { + if (!Array.isArray(object.sizes)) + throw TypeError(".google.cloud.retail.v2.Product.sizes: array expected"); + message.sizes = []; + for (var i = 0; i < object.sizes.length; ++i) + message.sizes[i] = String(object.sizes[i]); + } + if (object.materials) { + if (!Array.isArray(object.materials)) + throw TypeError(".google.cloud.retail.v2.Product.materials: array expected"); + message.materials = []; + for (var i = 0; i < object.materials.length; ++i) + message.materials[i] = String(object.materials[i]); + } + if (object.patterns) { + if (!Array.isArray(object.patterns)) + throw TypeError(".google.cloud.retail.v2.Product.patterns: array expected"); + message.patterns = []; + for (var i = 0; i < object.patterns.length; ++i) + message.patterns[i] = String(object.patterns[i]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.cloud.retail.v2.Product.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) + message.conditions[i] = String(object.conditions[i]); + } + if (object.promotions) { + if (!Array.isArray(object.promotions)) + throw TypeError(".google.cloud.retail.v2.Product.promotions: array expected"); + message.promotions = []; + for (var i = 0; i < object.promotions.length; ++i) { + if (typeof object.promotions[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.promotions: object expected"); + message.promotions[i] = $root.google.cloud.retail.v2.Promotion.fromObject(object.promotions[i]); + } + } + if (object.publishTime != null) { + if (typeof object.publishTime !== "object") + throw TypeError(".google.cloud.retail.v2.Product.publishTime: object expected"); + message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + } + if (object.retrievableFields != null) { + if (typeof object.retrievableFields !== "object") + throw TypeError(".google.cloud.retail.v2.Product.retrievableFields: object expected"); + message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + } + if (object.variants) { + if (!Array.isArray(object.variants)) + throw TypeError(".google.cloud.retail.v2.Product.variants: array expected"); + message.variants = []; + for (var i = 0; i < object.variants.length; ++i) { + if (typeof object.variants[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.variants: object expected"); + message.variants[i] = $root.google.cloud.retail.v2.Product.fromObject(object.variants[i]); + } + } return message; }; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * Creates a plain object from a Product message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @static - * @param {google.cloud.retail.v2.SetDefaultBranchRequest} message SetDefaultBranchRequest + * @param {google.cloud.retail.v2.Product} message Product * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetDefaultBranchRequest.toObject = function toObject(message, options) { + Product.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.collectionMemberIds = []; + object.categories = []; + object.brands = []; + object.tags = []; + object.fulfillmentInfo = []; + object.images = []; + object.sizes = []; + object.materials = []; + object.patterns = []; + object.conditions = []; + object.variants = []; + object.promotions = []; + } + if (options.objects || options.defaults) + object.attributes = {}; if (options.defaults) { - object.catalog = ""; - object.branchId = ""; - object.note = ""; + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.gtin = ""; + object.title = ""; + object.description = ""; + object.languageCode = ""; + object.priceInfo = null; + object.rating = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + object.audience = null; + object.colorInfo = null; + object.retrievableFields = null; + object.publishTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.collectionMemberIds && message.collectionMemberIds.length) { + object.collectionMemberIds = []; + for (var j = 0; j < message.collectionMemberIds.length; ++j) + object.collectionMemberIds[j] = message.collectionMemberIds[j]; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + object.gtin = message.gtin; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.brands && message.brands.length) { + object.brands = []; + for (var j = 0; j < message.brands.length; ++j) + object.brands[j] = message.brands[j]; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2.PriceInfo.toObject(message.priceInfo, options); + if (message.rating != null && message.hasOwnProperty("rating")) + object.rating = $root.google.cloud.retail.v2.Rating.toObject(message.rating, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (options.oneofs) + object.expiration = "expireTime"; + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (options.oneofs) + object.expiration = "ttl"; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.fulfillmentInfo && message.fulfillmentInfo.length) { + object.fulfillmentInfo = []; + for (var j = 0; j < message.fulfillmentInfo.length; ++j) + object.fulfillmentInfo[j] = $root.google.cloud.retail.v2.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2.Image.toObject(message.images[j], options); + } + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = $root.google.cloud.retail.v2.Audience.toObject(message.audience, options); + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) + object.colorInfo = $root.google.cloud.retail.v2.ColorInfo.toObject(message.colorInfo, options); + if (message.sizes && message.sizes.length) { + object.sizes = []; + for (var j = 0; j < message.sizes.length; ++j) + object.sizes[j] = message.sizes[j]; + } + if (message.materials && message.materials.length) { + object.materials = []; + for (var j = 0; j < message.materials.length; ++j) + object.materials[j] = message.materials[j]; + } + if (message.patterns && message.patterns.length) { + object.patterns = []; + for (var j = 0; j < message.patterns.length; ++j) + object.patterns[j] = message.patterns[j]; + } + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = message.conditions[j]; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) + object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); + if (message.variants && message.variants.length) { + object.variants = []; + for (var j = 0; j < message.variants.length; ++j) + object.variants[j] = $root.google.cloud.retail.v2.Product.toObject(message.variants[j], options); + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); + if (message.promotions && message.promotions.length) { + object.promotions = []; + for (var j = 0; j < message.promotions.length; ++j) + object.promotions[j] = $root.google.cloud.retail.v2.Promotion.toObject(message.promotions[j], options); } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.branchId != null && message.hasOwnProperty("branchId")) - object.branchId = message.branchId; - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; return object; }; /** - * Converts this SetDefaultBranchRequest to JSON. + * Converts this Product to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Product * @instance * @returns {Object.} JSON object */ - SetDefaultBranchRequest.prototype.toJSON = function toJSON() { + Product.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetDefaultBranchRequest; + /** + * Type enum. + * @name google.cloud.retail.v2.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; })(); - v2.GetDefaultBranchRequest = (function() { + v2.UserEvent = (function() { /** - * Properties of a GetDefaultBranchRequest. + * Properties of a UserEvent. * @memberof google.cloud.retail.v2 - * @interface IGetDefaultBranchRequest - * @property {string|null} [catalog] GetDefaultBranchRequest catalog + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2.ICompletionDetail|null} [completionDetail] UserEvent completionDetail + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {string|null} [filter] UserEvent filter + * @property {string|null} [orderBy] UserEvent orderBy + * @property {number|null} [offset] UserEvent offset + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId */ /** - * Constructs a new GetDefaultBranchRequest. + * Constructs a new UserEvent. * @memberof google.cloud.retail.v2 - * @classdesc Represents a GetDefaultBranchRequest. - * @implements IGetDefaultBranchRequest + * @classdesc Represents a UserEvent. + * @implements IUserEvent * @constructor - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUserEvent=} [properties] Properties to set */ - function GetDefaultBranchRequest(properties) { + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11277,290 +11424,353 @@ } /** - * GetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2.UserEvent * @instance */ - GetDefaultBranchRequest.prototype.catalog = ""; + UserEvent.prototype.eventType = ""; /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest instance + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.create = function create(properties) { - return new GetDefaultBranchRequest(properties); - }; + UserEvent.prototype.visitorId = ""; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * UserEvent sessionId. + * @member {string} sessionId + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - return writer; - }; + UserEvent.prototype.sessionId = ""; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + UserEvent.prototype.eventTime = null; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + UserEvent.prototype.experimentIds = $util.emptyArray; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + UserEvent.prototype.attributionToken = ""; /** - * Verifies a GetDefaultBranchRequest message. - * @function verify - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - return null; - }; + UserEvent.prototype.productDetails = $util.emptyArray; /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest + * UserEvent completionDetail. + * @member {google.cloud.retail.v2.ICompletionDetail|null|undefined} completionDetail + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchRequest) - return object; - var message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - return message; - }; + UserEvent.prototype.completionDetail = null; /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2.GetDefaultBranchRequest} message GetDefaultBranchRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - GetDefaultBranchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.catalog = ""; - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - return object; - }; + UserEvent.prototype.attributes = $util.emptyObject; /** - * Converts this GetDefaultBranchRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2.UserEvent * @instance - * @returns {Object.} JSON object */ - GetDefaultBranchRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + UserEvent.prototype.cartId = ""; - return GetDefaultBranchRequest; - })(); + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; - v2.GetDefaultBranchResponse = (function() { + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; /** - * Properties of a GetDefaultBranchResponse. - * @memberof google.cloud.retail.v2 - * @interface IGetDefaultBranchResponse - * @property {string|null} [branch] GetDefaultBranchResponse branch - * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime - * @property {string|null} [note] GetDefaultBranchResponse note + * UserEvent filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ + UserEvent.prototype.filter = ""; /** - * Constructs a new GetDefaultBranchResponse. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a GetDefaultBranchResponse. - * @implements IGetDefaultBranchResponse - * @constructor - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set + * UserEvent orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.UserEvent + * @instance */ - function GetDefaultBranchResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + UserEvent.prototype.orderBy = ""; /** - * GetDefaultBranchResponse branch. - * @member {string} branch - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * UserEvent offset. + * @member {number} offset + * @memberof google.cloud.retail.v2.UserEvent * @instance */ - GetDefaultBranchResponse.prototype.branch = ""; + UserEvent.prototype.offset = 0; /** - * GetDefaultBranchResponse setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2.UserEvent * @instance */ - GetDefaultBranchResponse.prototype.setTime = null; + UserEvent.prototype.pageCategories = $util.emptyArray; /** - * GetDefaultBranchResponse note. - * @member {string} note - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * UserEvent userInfo. + * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2.UserEvent * @instance */ - GetDefaultBranchResponse.prototype.note = ""; + UserEvent.prototype.userInfo = null; /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse instance + * @param {google.cloud.retail.v2.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEvent} UserEvent instance */ - GetDefaultBranchResponse.create = function create(properties) { - return new GetDefaultBranchResponse(properties); + UserEvent.create = function create(properties) { + return new UserEvent(properties); }; /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {google.cloud.retail.v2.IUserEvent} message UserEvent message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchResponse.encode = function encode(message, writer) { + UserEvent.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); + if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) + $root.google.cloud.retail.v2.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {google.cloud.retail.v2.IUserEvent} message UserEvent message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * Decodes a UserEvent message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2.UserEvent} UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchResponse.decode = function decode(reader, length) { + UserEvent.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEvent(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.branch = reader.string(); + message.eventType = reader.string(); break; case 2: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.visitorId = reader.string(); + break; + case 21: + message.sessionId = reader.string(); break; case 3: - message.note = reader.string(); + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2.ProductDetail.decode(reader, reader.uint32())); + break; + case 22: + message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.decode(reader, reader.uint32()); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 16: + message.filter = reader.string(); + break; + case 17: + message.orderBy = reader.string(); + break; + case 18: + message.offset = reader.int32(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); break; default: reader.skipType(tag & 7); @@ -11571,237 +11781,344 @@ }; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * Decodes a UserEvent message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2.UserEvent} UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { + UserEvent.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDefaultBranchResponse message. + * Verifies a UserEvent message. * @function verify - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDefaultBranchResponse.verify = function verify(message) { + UserEvent.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isString(message.sessionId)) + return "sessionId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); if (error) - return "setTime." + error; + return "eventTime." + error; } - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { + var error = $root.google.cloud.retail.v2.CompletionDetail.verify(message.completionDetail); + if (error) + return "completionDetail." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; return null; }; /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2.UserEvent} UserEvent */ - GetDefaultBranchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchResponse) + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEvent) return object; - var message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); - if (object.branch != null) - message.branch = String(object.branch); - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2.GetDefaultBranchResponse.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + var message = new $root.google.cloud.retail.v2.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.sessionId != null) + message.sessionId = String(object.sessionId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); } - if (object.note != null) - message.note = String(object.note); + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2.ProductDetail.fromObject(object.productDetails[i]); + } + } + if (object.completionDetail != null) { + if (typeof object.completionDetail !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.completionDetail: object expected"); + message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.fromObject(object.completionDetail); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); return message; }; /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2.UserEvent * @static - * @param {google.cloud.retail.v2.GetDefaultBranchResponse} message GetDefaultBranchResponse + * @param {google.cloud.retail.v2.UserEvent} message UserEvent * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDefaultBranchResponse.toObject = function toObject(message, options) { + UserEvent.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; if (options.defaults) { - object.branch = ""; - object.setTime = null; - object.note = ""; + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + object.filter = ""; + object.orderBy = ""; + object.offset = 0; + object.sessionId = ""; + object.completionDetail = null; } - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; - return object; - }; - - /** - * Converts this GetDefaultBranchResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @instance - * @returns {Object.} JSON object - */ - GetDefaultBranchResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetDefaultBranchResponse; - })(); - - v2.CompletionService = (function() { - - /** - * Constructs a new CompletionService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompletionService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CompletionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; - - /** - * Creates new CompletionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.CompletionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. - */ - CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. - * @memberof google.cloud.retail.v2.CompletionService - * @typedef CompleteQueryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.CompleteQueryResponse} [response] CompleteQueryResponse - */ - - /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2.CompletionService - * @instance - * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @param {google.cloud.retail.v2.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { - return this.rpcCall(completeQuery, $root.google.cloud.retail.v2.CompleteQueryRequest, $root.google.cloud.retail.v2.CompleteQueryResponse, request, callback); - }, "name", { value: "CompleteQuery" }); - - /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2.CompletionService - * @instance - * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. - * @memberof google.cloud.retail.v2.CompletionService - * @typedef ImportCompletionDataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2.CompletionService - * @instance - * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @param {google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { - return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportCompletionData" }); + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) + object.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.toObject(message.completionDetail, options); + return object; + }; /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2.CompletionService + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UserEvent * @instance - * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return CompletionService; + return UserEvent; })(); - v2.CompleteQueryRequest = (function() { + v2.ProductDetail = (function() { /** - * Properties of a CompleteQueryRequest. + * Properties of a ProductDetail. * @memberof google.cloud.retail.v2 - * @interface ICompleteQueryRequest - * @property {string|null} [catalog] CompleteQueryRequest catalog - * @property {string|null} [query] CompleteQueryRequest query - * @property {string|null} [visitorId] CompleteQueryRequest visitorId - * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes - * @property {string|null} [deviceType] CompleteQueryRequest deviceType - * @property {string|null} [dataset] CompleteQueryRequest dataset - * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + * @interface IProductDetail + * @property {google.cloud.retail.v2.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity */ /** - * Constructs a new CompleteQueryRequest. + * Constructs a new ProductDetail. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompleteQueryRequest. - * @implements ICompleteQueryRequest + * @classdesc Represents a ProductDetail. + * @implements IProductDetail * @constructor - * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IProductDetail=} [properties] Properties to set */ - function CompleteQueryRequest(properties) { - this.languageCodes = []; + function ProductDetail(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11809,156 +12126,88 @@ } /** - * CompleteQueryRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.catalog = ""; - - /** - * CompleteQueryRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.query = ""; - - /** - * CompleteQueryRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.visitorId = ""; - - /** - * CompleteQueryRequest languageCodes. - * @member {Array.} languageCodes - * @memberof google.cloud.retail.v2.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; - - /** - * CompleteQueryRequest deviceType. - * @member {string} deviceType - * @memberof google.cloud.retail.v2.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.deviceType = ""; - - /** - * CompleteQueryRequest dataset. - * @member {string} dataset - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * ProductDetail product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.ProductDetail * @instance */ - CompleteQueryRequest.prototype.dataset = ""; + ProductDetail.prototype.product = null; /** - * CompleteQueryRequest maxSuggestions. - * @member {number} maxSuggestions - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2.ProductDetail * @instance */ - CompleteQueryRequest.prototype.maxSuggestions = 0; + ProductDetail.prototype.quantity = null; /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new ProductDetail instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static - * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest instance + * @param {google.cloud.retail.v2.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail instance */ - CompleteQueryRequest.create = function create(properties) { - return new CompleteQueryRequest(properties); + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); }; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static - * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2.IProductDetail} message ProductDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encode = function encode(message, writer) { + ProductDetail.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); - if (message.languageCodes != null && message.languageCodes.length) - for (var i = 0; i < message.languageCodes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); - if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); - if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); - if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static - * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2.IProductDetail} message ProductDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a ProductDetail message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decode = function decode(reader, length) { + ProductDetail.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductDetail(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = reader.string(); + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); break; case 2: - message.query = reader.string(); - break; - case 7: - message.visitorId = reader.string(); - break; - case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - case 4: - message.deviceType = reader.string(); - break; - case 6: - message.dataset = reader.string(); - break; - case 5: - message.maxSuggestions = reader.int32(); + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -11969,173 +12218,128 @@ }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + ProductDetail.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryRequest message. + * Verifies a ProductDetail message. * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryRequest.verify = function verify(message) { + ProductDetail.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { - if (!Array.isArray(message.languageCodes)) - return "languageCodes: array expected"; - for (var i = 0; i < message.languageCodes.length; ++i) - if (!$util.isString(message.languageCodes[i])) - return "languageCodes: string[] expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - if (!$util.isString(message.deviceType)) - return "deviceType: string expected"; - if (message.dataset != null && message.hasOwnProperty("dataset")) - if (!$util.isString(message.dataset)) - return "dataset: string expected"; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - if (!$util.isInteger(message.maxSuggestions)) - return "maxSuggestions: integer expected"; return null; }; /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2.ProductDetail} ProductDetail */ - CompleteQueryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryRequest) + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductDetail) return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.languageCodes) { - if (!Array.isArray(object.languageCodes)) - throw TypeError(".google.cloud.retail.v2.CompleteQueryRequest.languageCodes: array expected"); - message.languageCodes = []; - for (var i = 0; i < object.languageCodes.length; ++i) - message.languageCodes[i] = String(object.languageCodes[i]); + var message = new $root.google.cloud.retail.v2.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); } - if (object.deviceType != null) - message.deviceType = String(object.deviceType); - if (object.dataset != null) - message.dataset = String(object.dataset); - if (object.maxSuggestions != null) - message.maxSuggestions = object.maxSuggestions | 0; return message; }; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @static - * @param {google.cloud.retail.v2.CompleteQueryRequest} message CompleteQueryRequest + * @param {google.cloud.retail.v2.ProductDetail} message ProductDetail * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryRequest.toObject = function toObject(message, options) { + ProductDetail.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.languageCodes = []; if (options.defaults) { - object.catalog = ""; - object.query = ""; - object.deviceType = ""; - object.maxSuggestions = 0; - object.dataset = ""; - object.visitorId = ""; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.languageCodes && message.languageCodes.length) { - object.languageCodes = []; - for (var j = 0; j < message.languageCodes.length; ++j) - object.languageCodes[j] = message.languageCodes[j]; + object.product = null; + object.quantity = null; } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - object.deviceType = message.deviceType; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - object.maxSuggestions = message.maxSuggestions; - if (message.dataset != null && message.hasOwnProperty("dataset")) - object.dataset = message.dataset; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); return object; }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this ProductDetail to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.ProductDetail * @instance * @returns {Object.} JSON object */ - CompleteQueryRequest.prototype.toJSON = function toJSON() { + ProductDetail.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompleteQueryRequest; + return ProductDetail; })(); - v2.CompleteQueryResponse = (function() { + v2.CompletionDetail = (function() { /** - * Properties of a CompleteQueryResponse. + * Properties of a CompletionDetail. * @memberof google.cloud.retail.v2 - * @interface ICompleteQueryResponse - * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults - * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken - * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + * @interface ICompletionDetail + * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken + * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion + * @property {number|null} [selectedPosition] CompletionDetail selectedPosition */ /** - * Constructs a new CompleteQueryResponse. + * Constructs a new CompletionDetail. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompleteQueryResponse. - * @implements ICompleteQueryResponse + * @classdesc Represents a CompletionDetail. + * @implements ICompletionDetail * @constructor - * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompletionDetail=} [properties] Properties to set */ - function CompleteQueryResponse(properties) { - this.completionResults = []; - this.recentSearchResults = []; + function CompletionDetail(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12143,107 +12347,101 @@ } /** - * CompleteQueryResponse completionResults. - * @member {Array.} completionResults - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * CompletionDetail completionAttributionToken. + * @member {string} completionAttributionToken + * @memberof google.cloud.retail.v2.CompletionDetail * @instance */ - CompleteQueryResponse.prototype.completionResults = $util.emptyArray; + CompletionDetail.prototype.completionAttributionToken = ""; /** - * CompleteQueryResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * CompletionDetail selectedSuggestion. + * @member {string} selectedSuggestion + * @memberof google.cloud.retail.v2.CompletionDetail * @instance */ - CompleteQueryResponse.prototype.attributionToken = ""; + CompletionDetail.prototype.selectedSuggestion = ""; /** - * CompleteQueryResponse recentSearchResults. - * @member {Array.} recentSearchResults - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * CompletionDetail selectedPosition. + * @member {number} selectedPosition + * @memberof google.cloud.retail.v2.CompletionDetail * @instance */ - CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + CompletionDetail.prototype.selectedPosition = 0; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new CompletionDetail instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static - * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse instance + * @param {google.cloud.retail.v2.ICompletionDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail instance */ - CompleteQueryResponse.create = function create(properties) { - return new CompleteQueryResponse(properties); + CompletionDetail.create = function create(properties) { + return new CompletionDetail(properties); }; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static - * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2.ICompletionDetail} message CompletionDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encode = function encode(message, writer) { + CompletionDetail.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionResults != null && message.completionResults.length) - for (var i = 0; i < message.completionResults.length; ++i) - $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.recentSearchResults != null && message.recentSearchResults.length) - for (var i = 0; i < message.recentSearchResults.length; ++i) - $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); + if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); + if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); return writer; }; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static - * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2.ICompletionDetail} message CompletionDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes a CompletionDetail message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decode = function decode(reader, length) { + CompletionDetail.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionDetail(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + message.completionAttributionToken = reader.string(); break; case 2: - message.attributionToken = reader.string(); + message.selectedSuggestion = reader.string(); break; case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + message.selectedPosition = reader.int32(); break; default: reader.skipType(tag & 7); @@ -12254,578 +12452,380 @@ }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + CompletionDetail.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryResponse message. - * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompleteQueryResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.completionResults != null && message.hasOwnProperty("completionResults")) { - if (!Array.isArray(message.completionResults)) - return "completionResults: array expected"; - for (var i = 0; i < message.completionResults.length; ++i) { - var error = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); - if (error) - return "completionResults." + error; - } - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { - if (!Array.isArray(message.recentSearchResults)) - return "recentSearchResults: array expected"; - for (var i = 0; i < message.recentSearchResults.length; ++i) { - var error = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); - if (error) - return "recentSearchResults." + error; - } - } + * Verifies a CompletionDetail message. + * @function verify + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + if (!$util.isString(message.completionAttributionToken)) + return "completionAttributionToken: string expected"; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + if (!$util.isString(message.selectedSuggestion)) + return "selectedSuggestion: string expected"; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + if (!$util.isInteger(message.selectedPosition)) + return "selectedPosition: integer expected"; return null; }; /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2.CompletionDetail} CompletionDetail */ - CompleteQueryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse) + CompletionDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompletionDetail) return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); - if (object.completionResults) { - if (!Array.isArray(object.completionResults)) - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: array expected"); - message.completionResults = []; - for (var i = 0; i < object.completionResults.length; ++i) { - if (typeof object.completionResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: object expected"); - message.completionResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); - } - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.recentSearchResults) { - if (!Array.isArray(object.recentSearchResults)) - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: array expected"); - message.recentSearchResults = []; - for (var i = 0; i < object.recentSearchResults.length; ++i) { - if (typeof object.recentSearchResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: object expected"); - message.recentSearchResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); - } - } + var message = new $root.google.cloud.retail.v2.CompletionDetail(); + if (object.completionAttributionToken != null) + message.completionAttributionToken = String(object.completionAttributionToken); + if (object.selectedSuggestion != null) + message.selectedSuggestion = String(object.selectedSuggestion); + if (object.selectedPosition != null) + message.selectedPosition = object.selectedPosition | 0; return message; }; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse} message CompleteQueryResponse + * @param {google.cloud.retail.v2.CompletionDetail} message CompletionDetail * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryResponse.toObject = function toObject(message, options) { + CompletionDetail.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.completionResults = []; - object.recentSearchResults = []; - } - if (options.defaults) - object.attributionToken = ""; - if (message.completionResults && message.completionResults.length) { - object.completionResults = []; - for (var j = 0; j < message.completionResults.length; ++j) - object.completionResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.recentSearchResults && message.recentSearchResults.length) { - object.recentSearchResults = []; - for (var j = 0; j < message.recentSearchResults.length; ++j) - object.recentSearchResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + if (options.defaults) { + object.completionAttributionToken = ""; + object.selectedSuggestion = ""; + object.selectedPosition = 0; } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + object.completionAttributionToken = message.completionAttributionToken; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + object.selectedSuggestion = message.selectedSuggestion; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + object.selectedPosition = message.selectedPosition; return object; }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this CompletionDetail to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.CompletionDetail * @instance * @returns {Object.} JSON object */ - CompleteQueryResponse.prototype.toJSON = function toJSON() { + CompletionDetail.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - CompleteQueryResponse.CompletionResult = (function() { - - /** - * Properties of a CompletionResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @interface ICompletionResult - * @property {string|null} [suggestion] CompletionResult suggestion - * @property {Object.|null} [attributes] CompletionResult attributes - */ - - /** - * Constructs a new CompletionResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @classdesc Represents a CompletionResult. - * @implements ICompletionResult - * @constructor - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - */ - function CompletionResult(properties) { - this.attributes = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompletionResult suggestion. - * @member {string} suggestion - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.suggestion = ""; - - /** - * CompletionResult attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.attributes = $util.emptyObject; - - /** - * Creates a new CompletionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult instance - */ - CompletionResult.create = function create(properties) { - return new CompletionResult(properties); - }; - - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompletionResult message. - * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompletionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - if (!$util.isString(message.suggestion)) - return "suggestion: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - return null; - }; + return CompletionDetail; + })(); - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult - */ - CompletionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult) - return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(); - if (object.suggestion != null) - message.suggestion = String(object.suggestion); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - return message; - }; + v2.PurchaseTransaction = (function() { - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} message CompletionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompletionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) - object.suggestion = ""; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - object.suggestion = message.suggestion; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - return object; - }; + /** + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2 + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + */ - /** - * Converts this CompletionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @instance - * @returns {Object.} JSON object - */ - CompletionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction + * @constructor + * @param {google.cloud.retail.v2.IPurchaseTransaction=} [properties] Properties to set + */ + function PurchaseTransaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - return CompletionResult; - })(); + /** + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.id = ""; - CompleteQueryResponse.RecentSearchResult = (function() { + /** + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.revenue = 0; - /** - * Properties of a RecentSearchResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @interface IRecentSearchResult - * @property {string|null} [recentSearch] RecentSearchResult recentSearch - */ + /** + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; - /** - * Constructs a new RecentSearchResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @classdesc Represents a RecentSearchResult. - * @implements IRecentSearchResult - * @constructor - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - */ - function RecentSearchResult(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; - /** - * RecentSearchResult recentSearch. - * @member {string} recentSearch - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @instance - */ - RecentSearchResult.prototype.recentSearch = ""; + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance - */ - RecentSearchResult.create = function create(properties) { - return new RecentSearchResult(properties); - }; + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction instance + */ + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); + }; - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); - return writer; - }; + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + return writer; + }; - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurchaseTransaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a RecentSearchResult message. - * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RecentSearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - if (!$util.isString(message.recentSearch)) - return "recentSearch: string expected"; - return null; - }; + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - */ - RecentSearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult) - return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); - if (object.recentSearch != null) - message.recentSearch = String(object.recentSearch); - return message; - }; + /** + * Verifies a PurchaseTransaction message. + * @function verify + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurchaseTransaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RecentSearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.recentSearch = ""; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - object.recentSearch = message.recentSearch; + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurchaseTransaction} PurchaseTransaction + */ + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurchaseTransaction) return object; - }; + var message = new $root.google.cloud.retail.v2.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; - /** - * Converts this RecentSearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @instance - * @returns {Object.} JSON object - */ - RecentSearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2.PurchaseTransaction} message PurchaseTransaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurchaseTransaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; - return RecentSearchResult; - })(); + /** + * Converts this PurchaseTransaction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @instance + * @returns {Object.} JSON object + */ + PurchaseTransaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return CompleteQueryResponse; + return PurchaseTransaction; })(); v2.PredictionService = (function() { @@ -79162,26 +79162,58 @@ */ var api = {}; - api.Http = (function() { + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + return values; + })(); + + api.ResourceDescriptor = (function() { /** - * Properties of a Http. + * Properties of a ResourceDescriptor. * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style */ /** - * Constructs a new Http. + * Constructs a new ResourceDescriptor. * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor * @constructor - * @param {google.api.IHttp=} [properties] Properties to set + * @param {google.api.IResourceDescriptor=} [properties] Properties to set */ - function Http(properties) { - this.rules = []; + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -79189,91 +79221,167 @@ } /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor * @instance */ - Http.prototype.rules = $util.emptyArray; + ResourceDescriptor.prototype.type = ""; /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor * @instance */ - Http.prototype.fullyDecodeReservedExpansion = false; + ResourceDescriptor.prototype.pattern = $util.emptyArray; /** - * Creates a new Http instance using the specified properties. + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. * @function create - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttp=} [properties] Properties to set - * @returns {google.api.Http} Http instance + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance */ - Http.create = function create(properties) { - return new Http(properties); + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); }; /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. * @function encode - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttp} message Http message or plain object to encode + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Http.encode = function encode(message, writer) { + ResourceDescriptor.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttp} message Http message or plain object to encode + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Http.encodeDelimited = function encodeDelimited(message, writer) { + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Http message from the specified reader or buffer. + * Decodes a ResourceDescriptor message from the specified reader or buffer. * @function decode - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http + * @returns {google.api.ResourceDescriptor} ResourceDescriptor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Http.decode = function decode(reader, length) { + ResourceDescriptor.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.type = reader.string(); break; case 2: - message.fullyDecodeReservedExpansion = reader.bool(); + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + case 3: + message.nameField = reader.string(); + break; + case 4: + message.history = reader.int32(); + break; + case 5: + message.plural = reader.string(); + break; + case 6: + message.singular = reader.string(); + break; + case 10: + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -79284,143 +79392,246 @@ }; /** - * Decodes a Http message from the specified reader or buffer, length delimited. + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http + * @returns {google.api.ResourceDescriptor} ResourceDescriptor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Http.decodeDelimited = function decodeDelimited(reader) { + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Http message. + * Verifies a ResourceDescriptor message. * @function verify - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Http.verify = function verify(message) { + ResourceDescriptor.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - if (typeof message.fullyDecodeReservedExpansion !== "boolean") - return "fullyDecodeReservedExpansion: boolean expected"; return null; }; /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static * @param {Object.} object Plain object - * @returns {google.api.Http} Http + * @returns {google.api.ResourceDescriptor} ResourceDescriptor */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) return object; - var message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } } - if (object.fullyDecodeReservedExpansion != null) - message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); return message; }; /** - * Creates a plain object from a Http message. Also converts values to other types if specified. + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.Http} message Http + * @param {google.api.ResourceDescriptor} message ResourceDescriptor * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Http.toObject = function toObject(message, options) { + ResourceDescriptor.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (options.defaults) - object.fullyDecodeReservedExpansion = false; - if (message.rules && message.rules.length) { - object.rules = []; - for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; return object; }; /** - * Converts this Http to JSON. + * Converts this ResourceDescriptor to JSON. * @function toJSON - * @memberof google.api.Http + * @memberof google.api.ResourceDescriptor * @instance * @returns {Object.} JSON object */ - Http.prototype.toJSON = function toJSON() { + ResourceDescriptor.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Http; + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; })(); - api.HttpRule = (function() { + api.ResourceReference = (function() { /** - * Properties of a HttpRule. + * Properties of a ResourceReference. * @memberof google.api - * @interface IHttpRule - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [body] HttpRule body - * @property {string|null} [responseBody] HttpRule responseBody - * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType */ /** - * Constructs a new HttpRule. + * Constructs a new ResourceReference. * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule + * @classdesc Represents a ResourceReference. + * @implements IResourceReference * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set + * @param {google.api.IResourceReference=} [properties] Properties to set */ - function HttpRule(properties) { - this.additionalBindings = []; + function ResourceReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -79428,209 +79639,88 @@ } /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; - - /** - * HttpRule get. - * @member {string|null|undefined} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = null; - - /** - * HttpRule put. - * @member {string|null|undefined} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = null; - - /** - * HttpRule post. - * @member {string|null|undefined} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = null; - - /** - * HttpRule delete. - * @member {string|null|undefined} delete - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype["delete"] = null; - - /** - * HttpRule patch. - * @member {string|null|undefined} patch - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.patch = null; - - /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.custom = null; - - /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.body = ""; - - /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.responseBody = ""; - - /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference * @instance */ - HttpRule.prototype.additionalBindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ResourceReference.prototype.type = ""; /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference * @instance */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); + ResourceReference.prototype.childType = ""; /** - * Creates a new HttpRule instance using the specified properties. + * Creates a new ResourceReference instance using the specified properties. * @function create - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); }; /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. * @function encode - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encode = function encode(message, writer) { + ResourceReference.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && Object.hasOwnProperty.call(message, "get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && Object.hasOwnProperty.call(message, "put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && Object.hasOwnProperty.call(message, "post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additionalBindings != null && message.additionalBindings.length) - for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); return writer; }; /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a HttpRule message from the specified reader or buffer. + * Decodes a ResourceReference message from the specified reader or buffer. * @function decode - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceReference} ResourceReference * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decode = function decode(reader, length) { + ResourceReference.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.selector = reader.string(); + message.type = reader.string(); break; case 2: - message.get = reader.string(); - break; - case 3: - message.put = reader.string(); - break; - case 4: - message.post = reader.string(); - break; - case 5: - message["delete"] = reader.string(); - break; - case 6: - message.patch = reader.string(); - break; - case 8: - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 7: - message.body = reader.string(); - break; - case 12: - message.responseBody = reader.string(); - break; - case 11: - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.childType = reader.string(); break; default: reader.skipType(tag & 7); @@ -79641,240 +79731,118 @@ }; /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceReference} ResourceReference * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { + ResourceReference.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a HttpRule message. + * Verifies a ResourceReference message. * @function verify - * @memberof google.api.HttpRule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpRule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } - } - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - if (!$util.isString(message.responseBody)) - return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { - if (!Array.isArray(message.additionalBindings)) - return "additionalBindings: array expected"; - for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); - if (error) - return "additionalBindings." + error; - } - } - return null; - }; - - /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static - * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule - */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) - return object; - var message = new $root.google.api.HttpRule(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); - } - if (object.body != null) - message.body = String(object.body); - if (object.responseBody != null) - message.responseBody = String(object.responseBody); - if (object.additionalBindings) { - if (!Array.isArray(object.additionalBindings)) - throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); - message.additionalBindings = []; - for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); - } - } + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); return message; }; /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @static - * @param {google.api.HttpRule} message HttpRule + * @param {google.api.ResourceReference} message ResourceReference * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - HttpRule.toObject = function toObject(message, options) { + ResourceReference.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.additionalBindings = []; if (options.defaults) { - object.selector = ""; - object.body = ""; - object.responseBody = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; - } - if (message.additionalBindings && message.additionalBindings.length) { - object.additionalBindings = []; - for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + object.type = ""; + object.childType = ""; } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; return object; }; /** - * Converts this HttpRule to JSON. + * Converts this ResourceReference to JSON. * @function toJSON - * @memberof google.api.HttpRule + * @memberof google.api.ResourceReference * @instance * @returns {Object.} JSON object */ - HttpRule.prototype.toJSON = function toJSON() { + ResourceReference.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return HttpRule; + return ResourceReference; })(); - api.CustomHttpPattern = (function() { + api.Http = (function() { /** - * Properties of a CustomHttpPattern. + * Properties of a Http. * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion */ /** - * Constructs a new CustomHttpPattern. + * Constructs a new Http. * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern + * @classdesc Represents a Http. + * @implements IHttp * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @param {google.api.IHttp=} [properties] Properties to set */ - function CustomHttpPattern(properties) { + function Http(properties) { + this.rules = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -79882,88 +79850,91 @@ } /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http * @instance */ - CustomHttpPattern.prototype.kind = ""; + Http.prototype.rules = $util.emptyArray; /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http * @instance */ - CustomHttpPattern.prototype.path = ""; + Http.prototype.fullyDecodeReservedExpansion = false; /** - * Creates a new CustomHttpPattern instance using the specified properties. + * Creates a new Http instance using the specified properties. * @function create - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); + Http.create = function create(properties) { + return new Http(properties); }; /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. * @function encode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {google.api.IHttp} message Http message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encode = function encode(message, writer) { + Http.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); return writer; }; /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {google.api.IHttp} message Http message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + Http.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. + * Decodes a Http message from the specified reader or buffer. * @function decode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.Http} Http * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decode = function decode(reader, length) { + Http.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.kind = reader.string(); + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); break; case 2: - message.path = reader.string(); + message.fullyDecodeReservedExpansion = reader.bool(); break; default: reader.skipType(tag & 7); @@ -79974,150 +79945,143 @@ }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * Decodes a Http message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.Http} Http * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + Http.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomHttpPattern message. + * Verifies a Http message. * @function verify - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomHttpPattern.verify = function verify(message) { + Http.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; return null; }; /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * Creates a Http message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.Http} Http */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) return object; - var message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); return message; }; /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * Creates a plain object from a Http message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {google.api.Http} message Http * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomHttpPattern.toObject = function toObject(message, options) { + Http.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.kind = ""; - object.path = ""; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; return object; }; /** - * Converts this CustomHttpPattern to JSON. + * Converts this Http to JSON. * @function toJSON - * @memberof google.api.CustomHttpPattern + * @memberof google.api.Http * @instance * @returns {Object.} JSON object */ - CustomHttpPattern.prototype.toJSON = function toJSON() { + Http.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomHttpPattern; - })(); - - /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {number} - * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value - * @property {number} OPTIONAL=1 OPTIONAL value - * @property {number} REQUIRED=2 REQUIRED value - * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value - * @property {number} INPUT_ONLY=4 INPUT_ONLY value - * @property {number} IMMUTABLE=5 IMMUTABLE value - * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value - * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value - */ - api.FieldBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - values[valuesById[3] = "OUTPUT_ONLY"] = 3; - values[valuesById[4] = "INPUT_ONLY"] = 4; - values[valuesById[5] = "IMMUTABLE"] = 5; - values[valuesById[6] = "UNORDERED_LIST"] = 6; - values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; - return values; + return Http; })(); - api.ResourceDescriptor = (function() { + api.HttpRule = (function() { /** - * Properties of a ResourceDescriptor. + * Properties of a HttpRule. * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings */ /** - * Constructs a new ResourceDescriptor. + * Constructs a new HttpRule. * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor + * @classdesc Represents a HttpRule. + * @implements IHttpRule * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @param {google.api.IHttpRule=} [properties] Properties to set */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; + function HttpRule(properties) { + this.additionalBindings = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80125,167 +80089,209 @@ } /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.type = ""; + HttpRule.prototype.selector = ""; /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; + HttpRule.prototype.get = null; /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.nameField = ""; + HttpRule.prototype.put = null; /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.history = 0; + HttpRule.prototype.post = null; /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.plural = ""; + HttpRule.prototype["delete"] = null; /** - * ResourceDescriptor singular. - * @member {string} singular - * @memberof google.api.ResourceDescriptor + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.singular = ""; + HttpRule.prototype.patch = null; /** - * ResourceDescriptor style. - * @member {Array.} style - * @memberof google.api.ResourceDescriptor + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule * @instance */ - ResourceDescriptor.prototype.style = $util.emptyArray; + HttpRule.prototype.custom = null; /** - * Creates a new ResourceDescriptor instance using the specified properties. + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. * @function create - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance */ - ResourceDescriptor.create = function create(properties) { - return new ResourceDescriptor(properties); + HttpRule.create = function create(properties) { + return new HttpRule(properties); }; /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encode - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.encode = function encode(message, writer) { + HttpRule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.pattern != null && message.pattern.length) - for (var i = 0; i < message.pattern.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); - if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); - if (message.history != null && Object.hasOwnProperty.call(message, "history")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); - if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); - if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); - if (message.style != null && message.style.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.style.length; ++i) - writer.int32(message.style[i]); - writer.ldelim(); - } + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; }; /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. + * Decodes a HttpRule message from the specified reader or buffer. * @function decode - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.HttpRule} HttpRule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decode = function decode(reader, length) { + HttpRule.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.string(); + message.selector = reader.string(); break; case 2: - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); + message.get = reader.string(); break; case 3: - message.nameField = reader.string(); + message.put = reader.string(); break; case 4: - message.history = reader.int32(); + message.post = reader.string(); break; case 5: - message.plural = reader.string(); + message["delete"] = reader.string(); break; case 6: - message.singular = reader.string(); + message.patch = reader.string(); break; - case 10: - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); + case 8: + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -80296,246 +80302,240 @@ }; /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * Decodes a HttpRule message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.HttpRule} HttpRule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + HttpRule.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ResourceDescriptor message. + * Verifies a HttpRule message. * @function verify - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceDescriptor.verify = function verify(message) { + HttpRule.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("pattern")) { - if (!Array.isArray(message.pattern)) - return "pattern: array expected"; - for (var i = 0; i < message.pattern.length; ++i) - if (!$util.isString(message.pattern[i])) - return "pattern: string[] expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; } - if (message.nameField != null && message.hasOwnProperty("nameField")) - if (!$util.isString(message.nameField)) - return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) - switch (message.history) { - default: - return "history: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; } - if (message.plural != null && message.hasOwnProperty("plural")) - if (!$util.isString(message.plural)) - return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) - if (!$util.isString(message.singular)) - return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("style")) { - if (!Array.isArray(message.style)) - return "style: array expected"; - for (var i = 0; i < message.style.length; ++i) - switch (message.style[i]) { - default: - return "style: enum value[] expected"; - case 0: - case 1: - break; - } } return null; }; /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static * @param {Object.} object Plain object - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.HttpRule} HttpRule */ - ResourceDescriptor.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceDescriptor) + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) return object; - var message = new $root.google.api.ResourceDescriptor(); - if (object.type != null) - message.type = String(object.type); - if (object.pattern) { - if (!Array.isArray(object.pattern)) - throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); - message.pattern = []; - for (var i = 0; i < object.pattern.length; ++i) - message.pattern[i] = String(object.pattern[i]); - } - if (object.nameField != null) - message.nameField = String(object.nameField); - switch (object.history) { - case "HISTORY_UNSPECIFIED": - case 0: - message.history = 0; - break; - case "ORIGINALLY_SINGLE_PATTERN": - case 1: - message.history = 1; - break; - case "FUTURE_MULTI_PATTERN": - case 2: - message.history = 2; - break; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); } - if (object.plural != null) - message.plural = String(object.plural); - if (object.singular != null) - message.singular = String(object.singular); - if (object.style) { - if (!Array.isArray(object.style)) - throw TypeError(".google.api.ResourceDescriptor.style: array expected"); - message.style = []; - for (var i = 0; i < object.style.length; ++i) - switch (object.style[i]) { - default: - case "STYLE_UNSPECIFIED": - case 0: - message.style[i] = 0; - break; - case "DECLARATIVE_FRIENDLY": - case 1: - message.style[i] = 1; - break; - } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } } return message; }; /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @static - * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {google.api.HttpRule} message HttpRule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceDescriptor.toObject = function toObject(message, options) { + HttpRule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.pattern = []; - object.style = []; - } + if (options.arrays || options.defaults) + object.additionalBindings = []; if (options.defaults) { - object.type = ""; - object.nameField = ""; - object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; - object.plural = ""; - object.singular = ""; + object.selector = ""; + object.body = ""; + object.responseBody = ""; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.pattern && message.pattern.length) { - object.pattern = []; - for (var j = 0; j < message.pattern.length; ++j) - object.pattern[j] = message.pattern[j]; + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; } - if (message.nameField != null && message.hasOwnProperty("nameField")) - object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; - if (message.plural != null && message.hasOwnProperty("plural")) - object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("singular")) - object.singular = message.singular; - if (message.style && message.style.length) { - object.style = []; - for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; return object; }; /** - * Converts this ResourceDescriptor to JSON. + * Converts this HttpRule to JSON. * @function toJSON - * @memberof google.api.ResourceDescriptor + * @memberof google.api.HttpRule * @instance * @returns {Object.} JSON object */ - ResourceDescriptor.prototype.toJSON = function toJSON() { + HttpRule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * History enum. - * @name google.api.ResourceDescriptor.History - * @enum {number} - * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value - * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value - * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value - */ - ResourceDescriptor.History = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; - values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; - return values; - })(); - - /** - * Style enum. - * @name google.api.ResourceDescriptor.Style - * @enum {number} - * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value - * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value - */ - ResourceDescriptor.Style = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; - return values; - })(); - - return ResourceDescriptor; + return HttpRule; })(); - api.ResourceReference = (function() { + api.CustomHttpPattern = (function() { /** - * Properties of a ResourceReference. + * Properties of a CustomHttpPattern. * @memberof google.api - * @interface IResourceReference - * @property {string|null} [type] ResourceReference type - * @property {string|null} [childType] ResourceReference childType + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path */ /** - * Constructs a new ResourceReference. + * Constructs a new CustomHttpPattern. * @memberof google.api - * @classdesc Represents a ResourceReference. - * @implements IResourceReference + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern * @constructor - * @param {google.api.IResourceReference=} [properties] Properties to set + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set */ - function ResourceReference(properties) { + function CustomHttpPattern(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80543,88 +80543,88 @@ } /** - * ResourceReference type. - * @member {string} type - * @memberof google.api.ResourceReference + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern * @instance */ - ResourceReference.prototype.type = ""; + CustomHttpPattern.prototype.kind = ""; /** - * ResourceReference childType. - * @member {string} childType - * @memberof google.api.ResourceReference + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern * @instance */ - ResourceReference.prototype.childType = ""; + CustomHttpPattern.prototype.path = ""; /** - * Creates a new ResourceReference instance using the specified properties. + * Creates a new CustomHttpPattern instance using the specified properties. * @function create - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.IResourceReference=} [properties] Properties to set - * @returns {google.api.ResourceReference} ResourceReference instance + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance */ - ResourceReference.create = function create(properties) { - return new ResourceReference(properties); + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); }; /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. * @function encode - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceReference.encode = function encode(message, writer) { + CustomHttpPattern.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); return writer; }; /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ResourceReference message from the specified reader or buffer. + * Decodes a CustomHttpPattern message from the specified reader or buffer. * @function decode - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceReference} ResourceReference + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceReference.decode = function decode(reader, length) { + CustomHttpPattern.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.string(); + message.kind = reader.string(); break; case 2: - message.childType = reader.string(); + message.path = reader.string(); break; default: reader.skipType(tag & 7); @@ -80635,96 +80635,96 @@ }; /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceReference} ResourceReference + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceReference.decodeDelimited = function decodeDelimited(reader) { + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ResourceReference message. + * Verifies a CustomHttpPattern message. * @function verify - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceReference.verify = function verify(message) { + CustomHttpPattern.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("childType")) - if (!$util.isString(message.childType)) - return "childType: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; return null; }; /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} object Plain object - * @returns {google.api.ResourceReference} ResourceReference + * @returns {google.api.CustomHttpPattern} CustomHttpPattern */ - ResourceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceReference) + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) return object; - var message = new $root.google.api.ResourceReference(); - if (object.type != null) - message.type = String(object.type); - if (object.childType != null) - message.childType = String(object.childType); + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); return message; }; /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.ResourceReference} message ResourceReference + * @param {google.api.CustomHttpPattern} message CustomHttpPattern * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceReference.toObject = function toObject(message, options) { + CustomHttpPattern.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.type = ""; - object.childType = ""; + object.kind = ""; + object.path = ""; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.childType != null && message.hasOwnProperty("childType")) - object.childType = message.childType; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; return object; }; /** - * Converts this ResourceReference to JSON. + * Converts this CustomHttpPattern to JSON. * @function toJSON - * @memberof google.api.ResourceReference + * @memberof google.api.CustomHttpPattern * @instance * @returns {Object.} JSON object */ - ResourceReference.prototype.toJSON = function toJSON() { + CustomHttpPattern.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ResourceReference; + return CustomHttpPattern; })(); api.HttpBody = (function() { @@ -89714,25 +89714,23 @@ return GeneratedCodeInfo; })(); - protobuf.Timestamp = (function() { + protobuf.Empty = (function() { /** - * Properties of a Timestamp. + * Properties of an Empty. * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos + * @interface IEmpty */ /** - * Constructs a new Timestamp. + * Constructs a new Empty. * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp + * @classdesc Represents an Empty. + * @implements IEmpty * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @param {google.protobuf.IEmpty=} [properties] Properties to set */ - function Timestamp(properties) { + function Empty(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -89740,88 +89738,240 @@ } /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty * @instance + * @returns {Object.} JSON object */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask * @instance */ - Timestamp.prototype.nanos = 0; + FieldMask.prototype.paths = $util.emptyArray; /** - * Creates a new Timestamp instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @function create - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); + FieldMask.create = function create(properties) { + return new FieldMask(properties); }; /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. * @function encode - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encode = function encode(message, writer) { + FieldMask.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); return writer; }; /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a FieldMask message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.protobuf.FieldMask} FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decode = function decode(reader, length) { + FieldMask.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -89832,131 +89982,120 @@ }; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a FieldMask message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.protobuf.FieldMask} FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { + FieldMask.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Timestamp message. + * Verifies a FieldMask message. * @function verify - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Timestamp.verify = function verify(message) { + FieldMask.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } return null; }; /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.protobuf.FieldMask} FieldMask */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) return object; - var message = new $root.google.protobuf.Timestamp(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } return message; }; /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.Timestamp} message Timestamp + * @param {google.protobuf.FieldMask} message FieldMask * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Timestamp.toObject = function toObject(message, options) { + FieldMask.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; return object; }; /** - * Converts this Timestamp to JSON. + * Converts this FieldMask to JSON. * @function toJSON - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.FieldMask * @instance * @returns {Object.} JSON object */ - Timestamp.prototype.toJSON = function toJSON() { + FieldMask.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Timestamp; + return FieldMask; })(); - protobuf.Duration = (function() { + protobuf.Timestamp = (function() { /** - * Properties of a Duration. + * Properties of a Timestamp. * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos */ /** - * Constructs a new Duration. + * Constructs a new Timestamp. * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration + * @classdesc Represents a Timestamp. + * @implements ITimestamp * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set + * @param {google.protobuf.ITimestamp=} [properties] Properties to set */ - function Duration(properties) { + function Timestamp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -89964,43 +90103,43 @@ } /** - * Duration seconds. + * Timestamp seconds. * @member {number|Long} seconds - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @instance */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Duration nanos. + * Timestamp nanos. * @member {number} nanos - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @instance */ - Duration.prototype.nanos = 0; + Timestamp.prototype.nanos = 0; /** - * Creates a new Duration instance using the specified properties. + * Creates a new Timestamp instance using the specified properties. * @function create - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance */ - Duration.create = function create(properties) { - return new Duration(properties); + Timestamp.create = function create(properties) { + return new Timestamp(properties); }; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encode - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encode = function encode(message, writer) { + Timestamp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) @@ -90011,33 +90150,33 @@ }; /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decode = function decode(reader, length) { + Timestamp.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -90056,30 +90195,30 @@ }; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes a Timestamp message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decodeDelimited = function decodeDelimited(reader) { + Timestamp.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Duration message. + * Verifies a Timestamp message. * @function verify - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Duration.verify = function verify(message) { + Timestamp.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.seconds != null && message.hasOwnProperty("seconds")) @@ -90092,17 +90231,17 @@ }; /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.Timestamp} Timestamp */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) return object; - var message = new $root.google.protobuf.Duration(); + var message = new $root.google.protobuf.Timestamp(); if (object.seconds != null) if ($util.Long) (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; @@ -90118,15 +90257,15 @@ }; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.Duration} message Duration + * @param {google.protobuf.Timestamp} message Timestamp * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + Timestamp.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -90149,38 +90288,38 @@ }; /** - * Converts this Duration to JSON. + * Converts this Timestamp to JSON. * @function toJSON - * @memberof google.protobuf.Duration + * @memberof google.protobuf.Timestamp * @instance * @returns {Object.} JSON object */ - Duration.prototype.toJSON = function toJSON() { + Timestamp.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Duration; + return Timestamp; })(); - protobuf.FieldMask = (function() { + protobuf.Duration = (function() { /** - * Properties of a FieldMask. + * Properties of a Duration. * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos */ /** - * Constructs a new FieldMask. + * Constructs a new Duration. * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask + * @classdesc Represents a Duration. + * @implements IDuration * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @param {google.protobuf.IDuration=} [properties] Properties to set */ - function FieldMask(properties) { - this.paths = []; + function Duration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -90188,78 +90327,88 @@ } /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration * @instance */ - FieldMask.prototype.paths = $util.emptyArray; + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new FieldMask instance using the specified properties. + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. * @function create - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); + Duration.create = function create(properties) { + return new Duration(properties); }; /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {google.protobuf.IDuration} message Duration message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encode = function encode(message, writer) { + Duration.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (var i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {google.protobuf.IDuration} message Duration message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + Duration.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldMask message from the specified reader or buffer. + * Decodes a Duration message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Duration} Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldMask.decode = function decode(reader, length) { + Duration.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); break; default: reader.skipType(tag & 7); @@ -90270,99 +90419,110 @@ }; /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * Decodes a Duration message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Duration} Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { + Duration.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldMask message. + * Verifies a Duration message. * @function verify - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldMask.verify = function verify(message) { + Duration.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (var i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; return null; }; /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * Creates a Duration message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Duration} Duration */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) return object; - var message = new $root.google.protobuf.FieldMask(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".google.protobuf.FieldMask.paths: array expected"); - message.paths = []; - for (var i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; return message; }; /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * Creates a plain object from a Duration message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.FieldMask} message FieldMask + * @param {google.protobuf.Duration} message Duration * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldMask.toObject = function toObject(message, options) { + Duration.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (var j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; return object; }; /** - * Converts this FieldMask to JSON. + * Converts this Duration to JSON. * @function toJSON - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Duration * @instance * @returns {Object.} JSON object */ - FieldMask.prototype.toJSON = function toJSON() { + Duration.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FieldMask; + return Duration; })(); protobuf.DoubleValue = (function() { @@ -92304,166 +92464,6 @@ return Any; })(); - protobuf.Empty = (function() { - - /** - * Properties of an Empty. - * @memberof google.protobuf - * @interface IEmpty - */ - - /** - * Constructs a new Empty. - * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty - * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set - */ - function Empty(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new Empty instance using the specified properties. - * @function create - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance - */ - Empty.create = function create(properties) { - return new Empty(properties); - }; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Empty message. - * @function verify - * @memberof google.protobuf.Empty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Empty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Empty - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty - */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) - return object; - return new $root.google.protobuf.Empty(); - }; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.Empty} message Empty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Empty.toObject = function toObject() { - return {}; - }; - - /** - * Converts this Empty to JSON. - * @function toJSON - * @memberof google.protobuf.Empty - * @instance - * @returns {Object.} JSON object - */ - Empty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Empty; - })(); - protobuf.Struct = (function() { /** diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 08d47c68824..3017e50607c 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -61,6 +61,190 @@ } } }, + "CatalogService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/catalogs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", + "options": { + "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] + }, + "SetDefaultBranch": { + "requestType": "SetDefaultBranchRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "(google.api.http).body": "*", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "body": "*" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] + }, + "GetDefaultBranch": { + "requestType": "GetDefaultBranchRequest", + "responseType": "GetDefaultBranchResponse", + "options": { + "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCatalogsResponse": { + "fields": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateCatalogRequest": { + "fields": { + "catalog": { + "type": "Catalog", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "SetDefaultBranchRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "branchId": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "note": { + "type": "string", + "id": 3 + } + } + }, + "GetDefaultBranchRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + } + } + }, + "GetDefaultBranchResponse": { + "fields": { + "branch": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "note": { + "type": "string", + "id": 3 + } + } + }, "Audience": { "fields": { "genders": { @@ -289,44 +473,171 @@ } } }, - "GcsSource": { - "fields": { - "inputUris": { - "rule": "repeated", - "type": "string", - "id": 1, + "CompletionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CompleteQuery": { + "requestType": "CompleteQueryRequest", + "responseType": "CompleteQueryResponse", "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + } + } + ] }, - "dataSchema": { - "type": "string", - "id": 2 + "ImportCompletionData": { + "requestType": "ImportCompletionDataRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } + } + ] } } }, - "BigQuerySource": { - "oneofs": { - "partition": { - "oneof": [ - "partitionDate" - ] - } - }, + "CompleteQueryRequest": { "fields": { - "partitionDate": { - "type": "google.type.Date", - "id": 6 - }, - "projectId": { - "type": "string", - "id": 5 - }, - "datasetId": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "query": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "visitorId": { + "type": "string", + "id": 7 + }, + "languageCodes": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "deviceType": { + "type": "string", + "id": 4 + }, + "dataset": { + "type": "string", + "id": 6 + }, + "maxSuggestions": { + "type": "int32", + "id": 5 + } + } + }, + "CompleteQueryResponse": { + "fields": { + "completionResults": { + "rule": "repeated", + "type": "CompletionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "recentSearchResults": { + "rule": "repeated", + "type": "RecentSearchResult", + "id": 3 + } + }, + "nested": { + "CompletionResult": { + "fields": { + "suggestion": { + "type": "string", + "id": 1 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 2 + } + } + }, + "RecentSearchResult": { + "fields": { + "recentSearch": { + "type": "string", + "id": 1 + } + } + } + } + }, + "GcsSource": { + "fields": { + "inputUris": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataSchema": { + "type": "string", + "id": 2 + } + } + }, + "BigQuerySource": { + "oneofs": { + "partition": { + "oneof": [ + "partitionDate" + ] + } + }, + "fields": { + "partitionDate": { + "type": "google.type.Date", + "id": 6 + }, + "projectId": { + "type": "string", + "id": 5 + }, + "datasetId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" } }, "tableId": { @@ -948,353 +1259,42 @@ "type": "string", "id": 1 }, - "selectedSuggestion": { - "type": "string", - "id": 2 - }, - "selectedPosition": { - "type": "int32", - "id": 3 - } - } - }, - "PurchaseTransaction": { - "fields": { - "id": { - "type": "string", - "id": 1 - }, - "revenue": { - "type": "float", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "tax": { - "type": "float", - "id": 3 - }, - "cost": { - "type": "float", - "id": 4 - }, - "currencyCode": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "CatalogService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "ListCatalogs": { - "requestType": "ListCatalogsRequest", - "responseType": "ListCatalogsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=projects/*/locations/*}/catalogs" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "UpdateCatalog": { - "requestType": "UpdateCatalogRequest", - "responseType": "Catalog", - "options": { - "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", - "(google.api.http).body": "catalog", - "(google.api.method_signature)": "catalog,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", - "body": "catalog" - } - }, - { - "(google.api.method_signature)": "catalog,update_mask" - } - ] - }, - "SetDefaultBranch": { - "requestType": "SetDefaultBranchRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", - "(google.api.http).body": "*", - "(google.api.method_signature)": "catalog" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", - "body": "*" - } - }, - { - "(google.api.method_signature)": "catalog" - } - ] - }, - "GetDefaultBranch": { - "requestType": "GetDefaultBranchRequest", - "responseType": "GetDefaultBranchResponse", - "options": { - "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", - "(google.api.method_signature)": "catalog" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" - } - }, - { - "(google.api.method_signature)": "catalog" - } - ] - } - } - }, - "ListCatalogsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListCatalogsResponse": { - "fields": { - "catalogs": { - "rule": "repeated", - "type": "Catalog", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "UpdateCatalogRequest": { - "fields": { - "catalog": { - "type": "Catalog", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "SetDefaultBranchRequest": { - "fields": { - "catalog": { - "type": "string", - "id": 1, - "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" - } - }, - "branchId": { - "type": "string", - "id": 2, - "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" - } - }, - "note": { - "type": "string", - "id": 3 - } - } - }, - "GetDefaultBranchRequest": { - "fields": { - "catalog": { - "type": "string", - "id": 1, - "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" - } - } - } - }, - "GetDefaultBranchResponse": { - "fields": { - "branch": { - "type": "string", - "id": 1, - "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" - } - }, - "setTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "note": { - "type": "string", - "id": 3 - } - } - }, - "CompletionService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "CompleteQuery": { - "requestType": "CompleteQueryRequest", - "responseType": "CompleteQueryResponse", - "options": { - "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" - } - } - ] - }, - "ImportCompletionData": { - "requestType": "ImportCompletionDataRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", - "metadata_type": "google.cloud.retail.v2.ImportMetadata" - } - } - ] - } - } - }, - "CompleteQueryRequest": { - "fields": { - "catalog": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" - } - }, - "query": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "visitorId": { - "type": "string", - "id": 7 - }, - "languageCodes": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "deviceType": { - "type": "string", - "id": 4 - }, - "dataset": { + "selectedSuggestion": { "type": "string", - "id": 6 + "id": 2 }, - "maxSuggestions": { + "selectedPosition": { "type": "int32", - "id": 5 + "id": 3 } } }, - "CompleteQueryResponse": { + "PurchaseTransaction": { "fields": { - "completionResults": { - "rule": "repeated", - "type": "CompletionResult", + "id": { + "type": "string", "id": 1 }, - "attributionToken": { - "type": "string", - "id": 2 + "revenue": { + "type": "float", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "recentSearchResults": { - "rule": "repeated", - "type": "RecentSearchResult", + "tax": { + "type": "float", "id": 3 - } - }, - "nested": { - "CompletionResult": { - "fields": { - "suggestion": { - "type": "string", - "id": 1 - }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", - "id": 2 - } - } }, - "RecentSearchResult": { - "fields": { - "recentSearch": { - "type": "string", - "id": 1 - } + "cost": { + "type": "float", + "id": 4 + }, + "currencyCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" } } } @@ -8020,93 +8020,6 @@ "cc_enable_arenas": true }, "nested": { - "http": { - "type": "HttpRule", - "id": 72295728, - "extend": "google.protobuf.MethodOptions" - }, - "Http": { - "fields": { - "rules": { - "rule": "repeated", - "type": "HttpRule", - "id": 1 - }, - "fullyDecodeReservedExpansion": { - "type": "bool", - "id": 2 - } - } - }, - "HttpRule": { - "oneofs": { - "pattern": { - "oneof": [ - "get", - "put", - "post", - "delete", - "patch", - "custom" - ] - } - }, - "fields": { - "selector": { - "type": "string", - "id": 1 - }, - "get": { - "type": "string", - "id": 2 - }, - "put": { - "type": "string", - "id": 3 - }, - "post": { - "type": "string", - "id": 4 - }, - "delete": { - "type": "string", - "id": 5 - }, - "patch": { - "type": "string", - "id": 6 - }, - "custom": { - "type": "CustomHttpPattern", - "id": 8 - }, - "body": { - "type": "string", - "id": 7 - }, - "responseBody": { - "type": "string", - "id": 12 - }, - "additionalBindings": { - "rule": "repeated", - "type": "HttpRule", - "id": 11 - } - } - }, - "CustomHttpPattern": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "path": { - "type": "string", - "id": 2 - } - } - }, "fieldBehavior": { "rule": "repeated", "type": "google.api.FieldBehavior", @@ -8202,6 +8115,93 @@ } } }, + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, "methodSignature": { "rule": "repeated", "type": "string", @@ -9144,6 +9144,18 @@ } } }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, "Timestamp": { "fields": { "seconds": { @@ -9168,15 +9180,6 @@ } } }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, "DoubleValue": { "fields": { "value": { @@ -9261,9 +9264,6 @@ } } }, - "Empty": { - "fields": {} - }, "Struct": { "fields": { "fields": { From 8f0ae3af61ddeda1ac56fafe8e77940694e3b421 Mon Sep 17 00:00:00 2001 From: nmykhailets <94851929+nmykhailets@users.noreply.github.com> Date: Tue, 8 Mar 2022 17:54:57 +0200 Subject: [PATCH 071/103] chore(samples): interactive tutorials code samples for CRUD products (#149) --- packages/google-cloud-retail/test/gapic_catalog_service_v2.ts | 3 --- .../google-cloud-retail/test/gapic_catalog_service_v2alpha.ts | 3 --- .../google-cloud-retail/test/gapic_catalog_service_v2beta.ts | 3 --- .../google-cloud-retail/test/gapic_completion_service_v2.ts | 1 - .../test/gapic_completion_service_v2alpha.ts | 1 - .../test/gapic_completion_service_v2beta.ts | 1 - .../google-cloud-retail/test/gapic_prediction_service_v2.ts | 1 - .../test/gapic_prediction_service_v2alpha.ts | 1 - .../test/gapic_prediction_service_v2beta.ts | 1 - packages/google-cloud-retail/test/gapic_product_service_v2.ts | 4 ---- .../google-cloud-retail/test/gapic_product_service_v2alpha.ts | 4 ---- .../google-cloud-retail/test/gapic_product_service_v2beta.ts | 4 ---- .../google-cloud-retail/test/gapic_user_event_service_v2.ts | 2 -- .../test/gapic_user_event_service_v2alpha.ts | 2 -- .../test/gapic_user_event_service_v2beta.ts | 2 -- 15 files changed, 33 deletions(-) diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index 9979bd3fda6..010241b8d23 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -334,7 +334,6 @@ describe('v2.CatalogServiceClient', () => { ); request.catalog = {}; request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateCatalog(request), expectedError); @@ -461,7 +460,6 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setDefaultBranch(request), expectedError); @@ -588,7 +586,6 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getDefaultBranch(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 41de9cdeff3..8d0d62be931 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -334,7 +334,6 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.catalog = {}; request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateCatalog(request), expectedError); @@ -461,7 +460,6 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setDefaultBranch(request), expectedError); @@ -588,7 +586,6 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getDefaultBranch(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 93134fb70e7..0d44d0303bf 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -334,7 +334,6 @@ describe('v2beta.CatalogServiceClient', () => { ); request.catalog = {}; request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateCatalog(request), expectedError); @@ -461,7 +460,6 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setDefaultBranch(request), expectedError); @@ -588,7 +586,6 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getDefaultBranch(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index 1a2780ede7a..49773a5009c 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -299,7 +299,6 @@ describe('v2.CompletionServiceClient', () => { new protos.google.cloud.retail.v2.CompleteQueryRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.completeQuery(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index 33c9c6c55c0..e55d2535879 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -304,7 +304,6 @@ describe('v2alpha.CompletionServiceClient', () => { new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.completeQuery(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index 6089c17536f..e3bed3a8a4a 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -307,7 +307,6 @@ describe('v2beta.CompletionServiceClient', () => { new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.completeQuery(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index fbcc6897b1b..5bb6794c5b8 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -264,7 +264,6 @@ describe('v2.PredictionServiceClient', () => { new protos.google.cloud.retail.v2.PredictRequest() ); request.placement = ''; - const expectedHeaderRequestParams = 'placement='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.predict(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index 6e700f7ba38..b8ac848119e 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -269,7 +269,6 @@ describe('v2alpha.PredictionServiceClient', () => { new protos.google.cloud.retail.v2alpha.PredictRequest() ); request.placement = ''; - const expectedHeaderRequestParams = 'placement='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.predict(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index 6ff717d5b4d..a18527b3f52 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -272,7 +272,6 @@ describe('v2beta.PredictionServiceClient', () => { new protos.google.cloud.retail.v2beta.PredictRequest() ); request.placement = ''; - const expectedHeaderRequestParams = 'placement='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.predict(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 546d55048ef..7b44c9e06f3 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -362,7 +362,6 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.CreateProductRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProduct(request), expectedError); @@ -489,7 +488,6 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.GetProductRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProduct(request), expectedError); @@ -620,7 +618,6 @@ describe('v2.ProductServiceClient', () => { ); request.product = {}; request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateProduct(request), expectedError); @@ -747,7 +744,6 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.DeleteProductRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteProduct(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index 65f39f083ec..ecde1a2a1a6 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -362,7 +362,6 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProduct(request), expectedError); @@ -489,7 +488,6 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.GetProductRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProduct(request), expectedError); @@ -620,7 +618,6 @@ describe('v2alpha.ProductServiceClient', () => { ); request.product = {}; request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateProduct(request), expectedError); @@ -747,7 +744,6 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteProduct(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index b446625d2b2..e7d63680517 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -362,7 +362,6 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.CreateProductRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProduct(request), expectedError); @@ -489,7 +488,6 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.GetProductRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProduct(request), expectedError); @@ -620,7 +618,6 @@ describe('v2beta.ProductServiceClient', () => { ); request.product = {}; request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateProduct(request), expectedError); @@ -747,7 +744,6 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteProduct(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index 334b20da5a2..2248cd5bec6 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -299,7 +299,6 @@ describe('v2.UserEventServiceClient', () => { new protos.google.cloud.retail.v2.WriteUserEventRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.writeUserEvent(request), expectedError); @@ -423,7 +422,6 @@ describe('v2.UserEventServiceClient', () => { new protos.google.cloud.retail.v2.CollectUserEventRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.collectUserEvent(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index ac0e91e270d..648be5e755d 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -299,7 +299,6 @@ describe('v2alpha.UserEventServiceClient', () => { new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.writeUserEvent(request), expectedError); @@ -423,7 +422,6 @@ describe('v2alpha.UserEventServiceClient', () => { new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.collectUserEvent(request), expectedError); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index fd1a2966fb2..c460e94e213 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -299,7 +299,6 @@ describe('v2beta.UserEventServiceClient', () => { new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.writeUserEvent(request), expectedError); @@ -423,7 +422,6 @@ describe('v2beta.UserEventServiceClient', () => { new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.collectUserEvent(request), expectedError); From 6c75511dedc5a07a4842c905cf35a65852f326af Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 23 Mar 2022 16:58:17 +0000 Subject: [PATCH 072/103] chore(main): release 1.6.1 (#158) :robot: I have created a release *beep* *boop* --- ### [1.6.1](https://github.com/googleapis/nodejs-retail/compare/v1.6.0...v1.6.1) (2022-03-15) ### Bug Fixes * remove gcloud_project env variable ([#156](https://github.com/googleapis/nodejs-retail/issues/156)) ([16cefb4](https://github.com/googleapis/nodejs-retail/commit/16cefb46e213f094daca8121bb09ec1e5c4da206)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index b206a9bd032..c9c994efa98 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.6.1](https://github.com/googleapis/nodejs-retail/compare/v1.6.0...v1.6.1) (2022-03-15) + + +### Bug Fixes + +* remove gcloud_project env variable ([#156](https://github.com/googleapis/nodejs-retail/issues/156)) ([16cefb4](https://github.com/googleapis/nodejs-retail/commit/16cefb46e213f094daca8121bb09ec1e5c4da206)) + ## [1.6.0](https://github.com/googleapis/nodejs-retail/compare/v1.5.0...v1.6.0) (2022-02-15) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 13dbb5999d4..80897da084e 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.6.0", + "version": "1.6.1", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 77ebaa7428e..909a04fcc73 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.6.0", + "@google-cloud/retail": "^1.6.1", "@google-cloud/bigquery": "^5.9.2", "@google-cloud/storage": "^5.16.1" }, From 8289a919b8002d71fe250c527fd5d793678ccd59 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:01:22 -0700 Subject: [PATCH 073/103] feat: users can skip validation, search personalization, return ids, and more; docs: suggest search users to not send IP, deprecate request_id, and more (#160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: users can self enroll retail search feature on cloud console docs: suggest search users not to send IP and use hashed user id docs: deprecate request_id in ImportProductsRequest docs: deprecate search dynamic_facet_spec and suggest to config on cloud console docs: keep the API doc up-to-date with recent changes feat: add new AddLocalInventories and RemoveLocalInventories APIs feat: users cannot switch to empty default branch unless force override feat: allow search users to skip validation for invalid boost specs feat: support search personalization feat: search returns applied control ids in the response PiperOrigin-RevId: 437355889 Source-Link: https://github.com/googleapis/googleapis/commit/4d0081513142e1e38446d53da72a301119a77847 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b2b798247d46c932737cf689744a827fae7e5313 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJiNzk4MjQ3ZDQ2YzkzMjczN2NmNjg5NzQ0YTgyN2ZhZTdlNTMxMyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: users can self enroll retail search feature on cloud console (v2beta) docs: suggest search users not to send IP and use hashed user id (v2beta) docs: deprecate request_id in ImportProductsRequest (v2beta) docs: deprecate search dynamic_facet_spec and suggest to config on cloud console (v2beta) docs: keep the API doc up-to-date with recent changes (v2beta) feat: add new AddLocalInventories and RemoveLocalInventories APIs (v2beta) feat: users cannot switch to empty default branch unless force override (v2beta) feat: allow search users to skip validation for invalid boost specs (v2beta) feat: support search personalization (v2beta) feat: search returns applied control ids in the response (v2beta) PiperOrigin-RevId: 438326512 Source-Link: https://github.com/googleapis/googleapis/commit/d6abf6387774457c50d8024a66b7ee78728c8841 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bfbcd23aa990e0df8364d478028f61ad7ff5c8c9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmZiY2QyM2FhOTkwZTBkZjgzNjRkNDc4MDI4ZjYxYWQ3ZmY1YzhjOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud/retail/v2/catalog_service.proto | 17 +- .../google/cloud/retail/v2/common.proto | 105 +- .../cloud/retail/v2/completion_service.proto | 47 +- .../cloud/retail/v2/import_config.proto | 54 +- .../cloud/retail/v2/prediction_service.proto | 9 +- .../google/cloud/retail/v2/product.proto | 88 +- .../cloud/retail/v2/product_service.proto | 202 +- .../google/cloud/retail/v2/promotion.proto | 40 + .../google/cloud/retail/v2/purge_config.proto | 1 + .../cloud/retail/v2/search_service.proto | 80 +- .../google/cloud/retail/v2/user_event.proto | 37 +- .../cloud/retail/v2/user_event_service.proto | 8 +- .../google/cloud/retail/v2beta/catalog.proto | 286 +- .../cloud/retail/v2beta/catalog_service.proto | 251 +- .../google/cloud/retail/v2beta/common.proto | 129 +- .../retail/v2beta/completion_service.proto | 50 +- .../google/cloud/retail/v2beta/control.proto | 84 + .../cloud/retail/v2beta/control_service.proto | 184 + .../cloud/retail/v2beta/export_config.proto | 1 - .../cloud/retail/v2beta/import_config.proto | 51 +- .../retail/v2beta/prediction_service.proto | 9 +- .../google/cloud/retail/v2beta/product.proto | 16 +- .../cloud/retail/v2beta/product_service.proto | 201 +- .../cloud/retail/v2beta/promotion.proto | 40 + .../cloud/retail/v2beta/purge_config.proto | 2 - .../cloud/retail/v2beta/search_service.proto | 68 +- .../cloud/retail/v2beta/serving_config.proto | 247 + .../v2beta/serving_config_service.proto | 240 + .../cloud/retail/v2beta/user_event.proto | 16 +- .../retail/v2beta/user_event_service.proto | 9 +- .../google-cloud-retail/protos/protos.d.ts | 34327 +++--- packages/google-cloud-retail/protos/protos.js | 95540 +++++++++------- .../google-cloud-retail/protos/protos.json | 3008 +- .../v2/catalog_service.set_default_branch.js | 9 + .../v2/completion_service.complete_query.js | 20 +- .../v2/prediction_service.predict.js | 9 +- .../product_service.add_local_inventories.js | 99 + .../v2/product_service.import_products.js | 11 - ...roduct_service.remove_local_inventories.js | 85 + .../v2/product_service.set_inventory.js | 18 +- .../generated/v2/search_service.search.js | 33 +- ...ippet_metadata.google.cloud.retail.v2.json | 144 +- .../catalog_service.add_catalog_attribute.js | 65 + .../catalog_service.get_attributes_config.js | 59 + .../catalog_service.get_completion_config.js | 59 + ...atalog_service.remove_catalog_attribute.js | 65 + ...talog_service.replace_catalog_attribute.js | 73 + .../catalog_service.set_default_branch.js | 9 + ...atalog_service.update_attributes_config.js | 67 + ...atalog_service.update_completion_config.js | 75 + .../completion_service.complete_query.js | 23 +- .../v2beta/control_service.create_control.js | 72 + .../v2beta/control_service.delete_control.js | 59 + .../v2beta/control_service.get_control.js | 59 + .../v2beta/control_service.list_controls.js | 79 + .../v2beta/control_service.update_control.js | 66 + .../v2beta/prediction_service.predict.js | 9 +- .../product_service.add_local_inventories.js | 100 + .../v2beta/product_service.import_products.js | 11 - ...roduct_service.remove_local_inventories.js | 85 + .../v2beta/product_service.set_inventory.js | 14 + .../generated/v2beta/search_service.search.js | 25 +- .../serving_config_service.add_control.js | 65 + ...ng_config_service.create_serving_config.js | 72 + ...ng_config_service.delete_serving_config.js | 59 + ...rving_config_service.get_serving_config.js | 59 + ...ing_config_service.list_serving_configs.js | 72 + .../serving_config_service.remove_control.js | 65 + ...ng_config_service.update_serving_config.js | 66 + ...t_metadata.google.cloud.retail.v2beta.json | 1452 +- packages/google-cloud-retail/src/index.ts | 8 + .../src/v2/catalog_service_client.ts | 16 +- .../src/v2/catalog_service_proto_list.json | 1 + .../src/v2/completion_service_client.ts | 35 +- .../src/v2/completion_service_proto_list.json | 1 + .../src/v2/gapic_metadata.json | 20 + .../src/v2/prediction_service_client.ts | 9 +- .../src/v2/prediction_service_proto_list.json | 1 + .../src/v2/product_service_client.ts | 443 +- .../src/v2/product_service_client_config.json | 10 + .../src/v2/product_service_proto_list.json | 1 + .../src/v2/search_service_client.ts | 102 +- .../src/v2/search_service_proto_list.json | 1 + .../src/v2/user_event_service_client.ts | 7 +- .../src/v2/user_event_service_proto_list.json | 1 + .../src/v2beta/catalog_service_client.ts | 1174 +- .../v2beta/catalog_service_client_config.json | 35 + .../v2beta/catalog_service_proto_list.json | 5 + .../src/v2beta/completion_service_client.ts | 298 +- .../v2beta/completion_service_proto_list.json | 5 + .../src/v2beta/control_service_client.ts | 1340 + .../v2beta/control_service_client_config.json | 46 + .../v2beta/control_service_proto_list.json | 20 + .../src/v2beta/gapic_metadata.json | 246 + .../google-cloud-retail/src/v2beta/index.ts | 2 + .../src/v2beta/prediction_service_client.ts | 269 +- .../v2beta/prediction_service_proto_list.json | 5 + .../src/v2beta/product_service_client.ts | 701 +- .../v2beta/product_service_client_config.json | 10 + .../v2beta/product_service_proto_list.json | 5 + .../src/v2beta/search_service_client.ts | 335 +- .../src/v2beta/search_service_proto_list.json | 5 + .../v2beta/serving_config_service_client.ts | 1520 + .../serving_config_service_client_config.json | 54 + .../serving_config_service_proto_list.json | 20 + .../src/v2beta/user_event_service_client.ts | 267 +- .../v2beta/user_event_service_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 2 + .../system-test/fixtures/sample/src/index.ts | 16 + .../test/gapic_catalog_service_v2beta.ts | 1207 + .../test/gapic_completion_service_v2beta.ts | 294 + .../test/gapic_control_service_v2beta.ts | 1443 + .../test/gapic_prediction_service_v2beta.ts | 294 + .../test/gapic_product_service_v2.ts | 391 + .../test/gapic_product_service_v2beta.ts | 677 + .../test/gapic_search_service_v2beta.ts | 286 + .../gapic_serving_config_service_v2beta.ts | 1767 + .../test/gapic_user_event_service_v2beta.ts | 286 + 118 files changed, 94567 insertions(+), 57978 deletions(-) create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/promotion.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/promotion.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js create mode 100644 packages/google-cloud-retail/src/v2beta/control_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/control_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/control_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/serving_config_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json create mode 100644 packages/google-cloud-retail/test/gapic_control_service_v2beta.ts create mode 100644 packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto index 41523ac809d..ec7a23a8d66 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto @@ -91,10 +91,6 @@ service CatalogService { // (if branch is not explicitly set). // * UserEventService will only join events with products from branch // {newBranch}. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -107,10 +103,6 @@ service CatalogService { // Get which branch is currently default branch set by // [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] // method under a specified parent catalog. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse) { option (google.api.http) = { @@ -205,6 +197,10 @@ message SetDefaultBranchRequest { // // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT // error is returned. + // + // If there are no sufficient active products in the targeted branch and + // [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a + // FAILED_PRECONDITION error is returned. string branch_id = 2 [ (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } ]; @@ -216,6 +212,11 @@ message SetDefaultBranchRequest { // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. string note = 3; + + // If set to true, it permits switching to a branch with + // [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even + // if it has no sufficient active products. + bool force = 4; } // Request message to show which branch is currently the default branch. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 9f0e1fc16f1..733b8cca913 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -99,9 +99,8 @@ 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. + // Empty string is not 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. @@ -111,15 +110,16 @@ message CustomAttribute { // 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; - // If true, custom attribute values are searchable by text queries in + // This field will only be used when + // [AttributesConfig.attribute_config_level][] of the + // [Catalog][google.cloud.retail.v2.Catalog] is + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are + // searchable by text queries in // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. @@ -128,8 +128,11 @@ message CustomAttribute { // set. Otherwise, a INVALID_ARGUMENT error is returned. optional bool searchable = 3; - // If true, custom attribute values are indexed, so that it can be filtered, - // faceted or boosted in + // This field will only be used when + // [AttributesConfig.attribute_config_level][] of the + // [Catalog][google.cloud.retail.v2.Catalog] is + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are + // indexed, so that it can be filtered, faceted or boosted in // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. @@ -178,7 +181,10 @@ message FulfillmentInfo { repeated string place_ids = 2; } -// [Product][google.cloud.retail.v2.Product] thumbnail/detail image. +// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and +// Retail Search do not use product images to improve prediction and search +// results. However, product images can be returned in results, and are shown in +// prediction or search previews in the console. message Image { // Required. URI of the image. // @@ -274,7 +280,7 @@ message PriceInfo { // // Google Merchant Center property // [price](https://support.google.com/merchants/answer/6324371). Schema.org - // property [Offer.priceSpecification](https://schema.org/priceSpecification). + // property [Offer.price](https://schema.org/price). float price = 2; // Price of the product without any discount. If zero, by default set to be @@ -364,19 +370,24 @@ message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in // user, such as a user name. // + // Always use a hashed value for this ID. + // // 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. Required for getting - // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results]. - // This field is used to extract location information for personalization. + // 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 + // This should not be set when: + // + // * setting + // [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info]. + // * 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] @@ -409,16 +420,60 @@ message UserInfo { bool direct_user_request = 4; } -// Promotion information. -message Promotion { - // ID of the promotion. For example, "free gift". - // - // The value value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, - // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is - // returned. +// The inventory information at a place (e.g. a store) identified +// by a place ID. +message LocalInventory { + // The place ID for the current set of inventory information. + string place_id = 1; + + // Product price and cost information. // // Google Merchant Center property - // [promotion](https://support.google.com/merchants/answer/7050148). - string promotion_id = 1; + // [price](https://support.google.com/merchants/answer/6324371). + PriceInfo price_info = 2; + + // Additional local inventory attributes, for example, store name, promotion + // tags, etc. + // + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * At most 30 attributes are allowed. + // * The key must be a UTF-8 encoded string with a length limit of 32 + // characters. + // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, + // key0LikeThis or KEY_1_LIKE_THIS. + // * The attribute values must be of the same type (text or number). + // * Only 1 value is allowed for each attribute. + // * For text values, the length limit is 256 UTF-8 characters. + // * The attribute does not support search. The `searchable` field should be + // unset or set to false. + // * The max summed total bytes of custom attribute keys and values per + // product is 5MiB. + map attributes = 3; + + // Input only. Supported fulfillment types. Valid fulfillment type values + // include commonly used types (such as pickup in store and same day + // delivery), and custom types. Customers have to map custom types to their + // display names before rendering UI. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is + // returned. + repeated string fulfillment_types = 4 + [(google.api.field_behavior) = INPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto index f17db9fa311..5e7e9a6c713 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -36,8 +36,7 @@ option ruby_package = "Google::Cloud::Retail::V2"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Please submit a form [here](https://cloud.google.com/contact) to contact -// cloud sales if you are interested in using Retail Search. +// Please enable Retail Search on Cloud Console before using this feature. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,8 +45,7 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -56,11 +54,13 @@ service CompletionService { // Bulk import of processed completion dataset. // - // Request processing may be synchronous. Partial updating is not supported. + // Request processing is asynchronous. Partial updating is not supported. + // + // The operation is successfully finished only after the imported suggestions + // are indexed successfully and ready for serving. The process takes hours. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -90,22 +90,21 @@ message CompleteQueryRequest { // The maximum number of allowed characters is 255. string query = 2 [(google.api.field_behavior) = 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 logs in or out of the website. + // Required field. 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 logs in or 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 = 7; - // The list of languages of the query. This is - // the BCP-47 language code, such as "en-US" or "sr-Latn". - // For more information, see - // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). - // - // The maximum number of allowed characters is 255. - // Only "en-US" is currently supported. + // The language filters applied to the output suggestions. If set, it should + // contain the language of the query. If not set, suggestions are returned + // without considering language restrictions. This is the BCP-47 language + // code, such as "en-US" or "sr-Latn". For more information, see [Tags for + // Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + // number of language codes is 3. repeated string language_codes = 3; // The device type context for completion suggestions. @@ -154,7 +153,11 @@ message CompleteQueryResponse { // The suggestion for the query. string suggestion = 1; - // Additional custom attributes ingested through BigQuery. + // Custom attributes for the suggestion term. + // * For "user-data", the attributes are additional custom attributes + // ingested through BigQuery. + // * For "cloud-retail", the attributes are product attributes generated + // by Cloud Retail. map attributes = 2; } @@ -169,9 +172,9 @@ message CompleteQueryResponse { repeated CompletionResult completion_results = 1; // A unique complete token. This should be included in the - // [SearchRequest][google.cloud.retail.v2.SearchRequest] resulting from this - // completion, which enables accurate attribution of complete model - // performance. + // [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail] + // for search events resulting from this completion, which enables accurate + // attribution of complete model performance. string attribution_token = 2; // Matched recent searches of this user. The maximum number of recent searches diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index 770a93eadb6..74cec22a637 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -63,6 +63,14 @@ message GcsSource { // [UserEvent][google.cloud.retail.v2.UserEvent] per line. // * `user_event_ga360`: Using // https://support.google.com/analytics/answer/3437719. + // + // Supported values for control imports: + // + // * 'control' (default): One JSON [Control][] per line. + // + // Supported values for catalog attribute imports: + // + // * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. string data_schema = 2; } @@ -111,8 +119,19 @@ message BigQuerySource { // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2.UserEvent] per line. - // * `user_event_ga360`: Using + // * `user_event_ga360`: + // The schema is available here: // https://support.google.com/analytics/answer/3437719. + // * `user_event_ga4`: This feature is in private preview. Please contact the + // support team for importing Google Analytics 4 events. + // The schema is available here: + // https://support.google.com/analytics/answer/7029846. + // + // Supported values for auto-completion imports: + // + // * `suggestions` (default): One JSON completion suggestion per line. + // * `denylist`: One JSON deny suggestion per line. + // * `allowlist`: One JSON allow suggestion per line. string data_schema = 4; } @@ -134,9 +153,9 @@ message UserEventInlineSource { 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 Cloud Storage prefix for import errors. This must be an empty, + // existing Cloud Storage directory. Import errors will be written to + // sharded files in this directory, one per line, as a JSON-encoded // `google.rpc.Status` message. string gcs_prefix = 1; } @@ -156,16 +175,14 @@ message ImportProductsRequest { // Calculates diff and replaces the entire product dataset. Existing // products may be deleted if they are not present in the source location. // - // Can only be while using - // [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. + // Can only be set while using + // [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. And the BigQuery + // dataset must be created in the data location "us (multiple regions in + // United States)", otherwise a PERMISSION_DENIED error is thrown. // // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. FULL = 2; } @@ -179,16 +196,8 @@ message ImportProductsRequest { (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } ]; - // Unique identifier provided by client, within the ancestor - // dataset scope. Ensures idempotency and used for request deduplication. - // Server-generated if unspecified. Up to 128 characters long and must match - // the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - // [ImportMetadata][google.cloud.retail.v2.ImportMetadata]. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - string request_id = 6; + // Deprecated. This field has no effect. + string request_id = 6 [deprecated = true]; // Required. The desired input location of the data. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -326,9 +335,8 @@ message ImportMetadata { // Count of entries that encountered errors while processing. int64 failure_count = 4; - // Id of the request / operation. This is parroting back the requestId - // that was passed in the request. - string request_id = 5; + // Deprecated. This field is never set. + string request_id = 5 [deprecated = true]; // Pub/Sub topic for receiving notification. If this field is set, // when the import is finished, a notification will be sent to diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto index da588a03c2a..061db1427b0 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto @@ -97,9 +97,12 @@ message PredictRequest { // * 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`. + // If your filter blocks all prediction results, the API will return generic + // (unfiltered) popular products. If you only want results strictly matching + // the filters, set `strictFiltering` to True in `PredictRequest.params` to + // receive empty results instead. + // Note that the API will never return items with storageStatus of "EXPIRED" + // or "DELETED" regardless of filter choices. string filter = 5; // Use validate only mode for this prediction query. If set to true, a diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 3bec3b06cd1..ea861fb6cfb 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -19,6 +19,7 @@ package google.cloud.retail.v2; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2/common.proto"; +import "google/cloud/retail/v2/promotion.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -119,7 +120,7 @@ message Product { // [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an // INVALID_ARGUMENT error is thrown. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [expiration_date](https://support.google.com/merchants/answer/6324499). google.protobuf.Timestamp expire_time = 16; @@ -156,9 +157,9 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [id](https://support.google.com/merchants/answer/6324405). Schema.org - // Property [Product.sku](https://schema.org/sku). + // property [Product.sku](https://schema.org/sku). string id = 2 [(google.api.field_behavior) = IMMUTABLE]; // Immutable. The type of the product. Default to @@ -180,21 +181,23 @@ message Product { // [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT // error is returned. // - // Google Merchant Center Property + // Corresponding properties: Google Merchant Center property // [item_group_id](https://support.google.com/merchants/answer/6324507). - // Schema.org Property + // 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; // The [id][google.cloud.retail.v2.Product.id] of the collection members when // [type][google.cloud.retail.v2.Product.type] is // [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]. // - // Should not set it for other types. A maximum of 1000 values are allowed. - // Otherwise, an INVALID_ARGUMENT error is return. + // Non-existent product ids are allowed. + // The [type][google.cloud.retail.v2.Product.type] of the members must be + // either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + // INVALID_ARGUMENT error is thrown. Should not set it for other types. A + // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is + // return. repeated string collection_member_ids = 5; // The Global Trade Item Number (GTIN) of the product. @@ -205,13 +208,13 @@ message Product { // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is // returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [gtin](https://support.google.com/merchants/answer/6324461). // Schema.org property - // [Product.isbn](https://schema.org/isbn) or - // [Product.gtin8](https://schema.org/gtin8) or - // [Product.gtin12](https://schema.org/gtin12) or - // [Product.gtin13](https://schema.org/gtin13) or + // [Product.isbn](https://schema.org/isbn), + // [Product.gtin8](https://schema.org/gtin8), + // [Product.gtin12](https://schema.org/gtin12), + // [Product.gtin13](https://schema.org/gtin13), or // [Product.gtin14](https://schema.org/gtin14). // // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. @@ -245,7 +248,7 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [google_product_category][mc_google_product_category]. Schema.org property // [Product.category] (https://schema.org/category). // @@ -258,7 +261,7 @@ message Product { // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: 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]; @@ -269,7 +272,7 @@ message Product { // string with a length limit of 1,000 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [brand](https://support.google.com/merchants/answer/6324351). Schema.org // property [Product.brand](https://schema.org/brand). repeated string brands = 9; @@ -279,13 +282,13 @@ message Product { // 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 + // Corresponding properties: Google Merchant Center property // [description](https://support.google.com/merchants/answer/6324468). - // schema.org property [Product.description](https://schema.org/description). + // Schema.org property [Product.description](https://schema.org/description). string description = 10; // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt]. + // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). // // For product prediction, this field is ignored and the model automatically // detects the text language. The [Product][google.cloud.retail.v2.Product] @@ -319,7 +322,12 @@ message Product { // * The key must be a UTF-8 encoded string with a length limit of 128 // characters. // * For indexable attribute, the key must match the pattern: - // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, key0LikeThis or KEY_1_LIKE_THIS. + // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or + // `KEY_1_LIKE_THIS`. + // * For text attributes, at most 400 values are allowed. Empty values are not + // allowed. Each value must be a non-empty UTF-8 encoded string with a + // length limit of 256 characters. + // * For number attributes, at most 400 values are allowed. map attributes = 12; // Custom tags associated with the product. @@ -333,13 +341,13 @@ message Product { // tag as part of the // [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter]. // - // Google Merchant Center property + // Corresponding properties: 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 + // Corresponding properties: Google Merchant Center property // [price](https://support.google.com/merchants/answer/6324371). PriceInfo price_info = 14; @@ -355,9 +363,9 @@ message Product { // Default to // [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]. // - // Google Merchant Center Property + // Corresponding properties: Google Merchant Center property // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org Property [Offer.availability](https://schema.org/availability). + // Schema.org property [Offer.availability](https://schema.org/availability). Availability availability = 19; // The available quantity of the item. @@ -379,17 +387,17 @@ message Product { // 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 + // Corresponding properties: 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.Highly recommended to put the main image - // to the first. + // Product images for the product. We highly recommend putting the main + // image first. // // A maximum of 300 images are allowed. // - // Google Merchant Center property + // Corresponding properties: 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; @@ -400,7 +408,7 @@ message Product { // The color of the product. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [color](https://support.google.com/merchants/answer/6324487). Schema.org // property [Product.color](https://schema.org/color). ColorInfo color_info = 25; @@ -418,9 +426,9 @@ message Product { // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [size](https://support.google.com/merchants/answer/6324492), - // [size_type](https://support.google.com/merchants/answer/6324497) and + // [size_type](https://support.google.com/merchants/answer/6324497), and // [size_system](https://support.google.com/merchants/answer/6324502). // Schema.org property [Product.size](https://schema.org/size). repeated string sizes = 26; @@ -428,10 +436,10 @@ message Product { // The material of the product. For example, "leather", "wooden". // // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an + // string with a length limit of 200 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [material](https://support.google.com/merchants/answer/6324410). Schema.org // property [Product.material](https://schema.org/material). repeated string materials = 27; @@ -444,7 +452,7 @@ message Product { // encoded string with a length limit of 128 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // - // Google Merchant Center property + // Corresponding properties: Google Merchant Center property // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org // property [Product.pattern](https://schema.org/pattern). repeated string patterns = 28; @@ -452,19 +460,21 @@ message Product { // The condition of the product. Strongly encouraged to use the standard // values: "new", "refurbished", "used". // - // A maximum of 5 values are allowed per + // A maximum of 1 value is allowed per // [Product][google.cloud.retail.v2.Product]. Each value 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 + // Corresponding properties: Google Merchant Center property // [condition](https://support.google.com/merchants/answer/6324469). // Schema.org property // [Offer.itemCondition](https://schema.org/itemCondition). repeated string conditions = 29; // The promotions applied to the product. A maximum of 10 values are allowed - // per [Product][google.cloud.retail.v2.Product]. + // per [Product][google.cloud.retail.v2.Product]. Only + // [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id] + // will be used, other fields will be ignored if set. repeated Promotion promotions = 34; // The timestamp when the product is published by the retailer for the first diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index ca157d896d5..7131983460d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -20,6 +20,7 @@ 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/common.proto"; import "google/cloud/retail/v2/import_config.proto"; import "google/cloud/retail/v2/product.proto"; import "google/longrunning/operations.proto"; @@ -132,7 +133,8 @@ service ProductService { // [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], // then any pre-existing inventory information for this product will be used. // - // If no inventory fields are set in [UpdateProductRequest.set_mask][], + // If no inventory fields are set in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], // then any existing inventory information will be preserved. // // Pre-existing inventory information can only be updated with @@ -142,8 +144,7 @@ service ProductService { // [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -169,8 +170,7 @@ service ProductService { // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -197,8 +197,7 @@ service ProductService { // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -211,6 +210,70 @@ service ProductService { metadata_type: "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" }; } + + // Updates local inventory information for a + // [Product][google.cloud.retail.v2.Product] at a list of places, while + // respecting the last update timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2.Product] to exist before updating + // inventory information. If the request is valid, the update will be enqueued + // and processed downstream. As a consequence, when a response is returned, + // updates are not immediately manifested in the + // [Product][google.cloud.retail.v2.Product] queried by + // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // + // Local inventory information can only be modified using this method. + // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and + // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no + // effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please enable Retail Search on Cloud Console before using this feature. + rpc AddLocalInventories(AddLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.AddLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2.AddLocalInventoriesMetadata" + }; + } + + // Remove local inventory information for a + // [Product][google.cloud.retail.v2.Product] at a list of places at a removal + // timestamp. + // + // This process is asynchronous. If the request is valid, the removal will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, removals are not immediately manifested in the + // [Product][google.cloud.retail.v2.Product] queried by + // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // + // Local inventory information can only be removed using this method. + // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and + // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no + // effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please enable Retail Search on Cloud Console before using this feature. + rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2.RemoveLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" + }; + } } // Request message for [CreateProduct][] method. @@ -448,6 +511,24 @@ message SetInventoryRequest { // provided or default value for // [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time]. // + // The caller can replace place IDs for a subset of fulfillment types in the + // following ways: + // + // * Adds "fulfillment_info" in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask] + // * Specifies only the desired fulfillment types and corresponding place IDs + // to update in [SetInventoryRequest.inventory.fulfillment_info][] + // + // The caller can clear all place IDs from a subset of fulfillment types in + // the following ways: + // + // * Adds "fulfillment_info" in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask] + // * Specifies only the desired fulfillment types to clear in + // [SetInventoryRequest.inventory.fulfillment_info][] + // * Checks that only the desired fulfillment info types have empty + // [SetInventoryRequest.inventory.fulfillment_info.place_ids][] + // // The last update time is recorded for the following inventory fields: // * [Product.price_info][google.cloud.retail.v2.Product.price_info] // * [Product.availability][google.cloud.retail.v2.Product.availability] @@ -459,8 +540,9 @@ message SetInventoryRequest { Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which inventory fields in the provided - // [Product][google.cloud.retail.v2.Product] to update. If not set or set with - // empty paths, all inventory fields will be updated. + // [Product][google.cloud.retail.v2.Product] to update. + // + // At least one field must be provided. // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned and the entire update will be ignored. @@ -566,6 +648,108 @@ message AddFulfillmentPlacesMetadata {} // method. message AddFulfillmentPlacesResponse {} +// Request message for [AddLocalInventories][] method. +message AddLocalInventoriesRequest { + // 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. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of inventory information at difference places. Each place + // is identified by its place ID. At most 3000 inventories are allowed per + // request. + repeated LocalInventory local_inventories = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided list of + // [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The + // field is updated to the provided value. + // + // If a field is set while the place does not have a previous local inventory, + // the local inventory at that store is created. + // + // If a field is set while the value of that field is not provided, the + // original field value, if it exists, is deleted. + // + // If the mask is not set or set with empty paths, all inventory fields will + // be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask add_mask = 4; + + // The time when the inventory updates are issued. Used to prevent + // out-of-order updates on local inventory fields. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2.Product] is not + // found, the local inventory will still be processed and retained for at most + // 1 day and processed once the [Product][google.cloud.retail.v2.Product] is + // created. If set to false, a NOT_FOUND error is returned if the + // [Product][google.cloud.retail.v2.Product] is not found. + bool allow_missing = 6; +} + +// Metadata related to the progress of the AddLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddLocalInventories][] method. +message AddLocalInventoriesMetadata {} + +// Response of the [AddLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [AddLocalInventories][] +// method. +message AddLocalInventoriesResponse {} + +// Request message for [RemoveLocalInventories][] method. +message RemoveLocalInventoriesRequest { + // 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. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of place IDs to have their inventory deleted. + // At most 3000 place IDs are allowed per request. + repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; + + // The time when the inventory deletions are issued. Used to prevent + // out-of-order updates and deletions on local inventory fields. If not + // provided, the internal system time will be used. + google.protobuf.Timestamp remove_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2.Product] is not + // found, the local inventory removal request will still be processed and + // retained for at most 1 day and processed once the + // [Product][google.cloud.retail.v2.Product] is created. If set to false, a + // NOT_FOUND error is returned if the + // [Product][google.cloud.retail.v2.Product] is not found. + bool allow_missing = 3; +} + +// Metadata related to the progress of the RemoveLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveLocalInventories][] method. +message RemoveLocalInventoriesMetadata {} + +// Response of the [RemoveLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [RemoveLocalInventories][] +// method. +message RemoveLocalInventoriesResponse {} + // Request message for [RemoveFulfillmentPlaces][] method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/promotion.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/promotion.proto new file mode 100644 index 00000000000..9ba323475f2 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/promotion.proto @@ -0,0 +1,40 @@ +// Copyright 2021 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; + +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 = "PromotionProto"; +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"; + +// Promotion information. +message Promotion { + // ID of the promotion. For example, "free gift". + // + // The value must be a UTF-8 encoded string with a length limit of 128 + // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, + // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Google Merchant Center property + // [promotion](https://support.google.com/merchants/answer/7050148). + string promotion_id = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto index b87d3177436..6c8d54c7e06 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package google.cloud.retail.v2; 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"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 8bd231332f8..ec8750ae30a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -37,8 +37,7 @@ option ruby_package = "Google::Cloud::Retail::V2"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Please submit a form [here](https://cloud.google.com/contact) to contact -// cloud sales if you are interested in using Retail Search. +// Please enable Retail Search on Cloud Console before using this feature. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -47,8 +46,7 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -103,6 +101,7 @@ message SearchRequest { // * "ratingCount" // * "attributes.key" // * "inventory(place_id,price)" + // * "inventory(place_id,original_price)" // * "inventory(place_id,attributes.key)" string key = 1 [(google.api.field_behavior) = REQUIRED]; @@ -320,6 +319,14 @@ message SearchRequest { // applied and combined in a non-linear way. Maximum number of // specifications is 10. repeated ConditionBoostSpec condition_boost_specs = 1; + + // Whether to skip boostspec validation. If this field is set to true, + // invalid + // [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs] + // will be ignored and valid + // [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs] + // will still be applied. + optional bool skip_boost_spec_validation = 2; } // Specification to determine under which conditions query expansion should @@ -350,6 +357,26 @@ message SearchRequest { bool pin_unexpanded_results = 2; } + // The specification for personalization. + message PersonalizationSpec { + // The personalization mode of each search request. + enum Mode { + // Default value. Defaults to + // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Let CRS decide whether to use personalization. + AUTO = 1; + + // Disable personalization. + DISABLED = 2; + } + + // Defaults to + // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. + Mode mode = 1; + } + // The search mode of each search request. enum SearchMode { // Default value. In this case both product search and faceted search will @@ -380,7 +407,7 @@ message SearchRequest { } // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -402,6 +429,9 @@ message SearchRequest { // identify a visitor on a single device. This unique identifier should not // change if the visitor logs in or out of the website. // + // This should be the same identifier as + // [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id]. + // // 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 = 4 [(google.api.field_behavior) = REQUIRED]; @@ -445,6 +475,9 @@ message SearchRequest { // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; + // The default filter that is applied when a user performs a search without + // checking any filters on the search page. + // // The filter applied to every search request when quality improvement such as // query expansion is needed. For example, if a query does not have enough // results, an expanded query with @@ -471,12 +504,12 @@ message SearchRequest { // is returned. repeated FacetSpec facet_specs = 12; + // Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + // to enable dynamic facets. Do not set this field. + // // The specification for dynamically generated facets. Notice that only // textual facets can be dynamically generated. - // - // This feature requires additional allowlisting. Contact Retail Search - // support team if you are interested in using dynamic facet feature. - DynamicFacetSpec dynamic_facet_spec = 21; + DynamicFacetSpec dynamic_facet_spec = 21 [deprecated = true]; // Boost specification to boost certain products. See more details at this // [user guide](https://cloud.google.com/retail/docs/boosting). @@ -495,12 +528,15 @@ message SearchRequest { // The keys to fetch and rollup the matching // [variant][google.cloud.retail.v2.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2.Product]s attributes. The attributes from - // all the matching [variant][google.cloud.retail.v2.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2.Product]s are merged and de-duplicated. - // Notice that rollup [variant][google.cloud.retail.v2.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2.Product]s attributes will lead to extra - // query latency. Maximum number of keys is 10. + // [Product][google.cloud.retail.v2.Product]s attributes, + // [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or + // [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The + // attributes from all the matching + // [variant][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s or + // [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and + // de-duplicated. Notice that rollup attributes will lead to extra query + // latency. Maximum number of keys is 30. // // For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a // fulfillment type and a fulfillment ID must be provided in the format of @@ -515,6 +551,7 @@ message SearchRequest { // * discount // * variantId // * inventory(place_id,price) + // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the // [Product.inventories.attributes][] map. // * attributes.key, where key is any key in the @@ -577,6 +614,9 @@ message SearchRequest { // The search mode of the search request. If not specified, a single search // request triggers both product search and faceted search. SearchMode search_mode = 31; + + // The specification for personalization. + PersonalizationSpec personalization_spec = 32; } // Response message for @@ -733,4 +773,14 @@ message SearchResponse { // [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token] // will be set in the response. string redirect_uri = 10; + + // The fully qualified resource name of applied + // [controls](https://cloud.google.com/retail/docs/serving-control-rules). + repeated string applied_controls = 12; + + // The invalid + // [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs] + // that are not applied during serving. + repeated SearchRequest.BoostSpec.ConditionBoostSpec + invalid_condition_boost_specs = 14; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto index c0023cf2d03..8e21f8aa0cb 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto @@ -39,7 +39,6 @@ message UserEvent { // * `add-to-cart`: Products being added to cart. // * `category-page-view`: Special pages such as sale or promotion pages // viewed. - // * `completion`: Completion query result showed/clicked. // * `detail-page-view`: Products detail page viewed. // * `home-page-view`: Homepage viewed. // * `promotion-offered`: Promotion is offered to a user. @@ -117,6 +116,7 @@ message UserEvent { // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` + // * `search` // // 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 browsing the @@ -127,22 +127,35 @@ message UserEvent { // desired. The end user may have not finished browsing the whole page yet. repeated ProductDetail product_details = 6; - // The main completion details related to the event. + // The main auto-completion details related to the event. // - // In a `completion` event, this field represents the completions returned to - // the end user and the clicked completion by the end user. In a `search` - // event, it represents the search event happens after clicking completion. + // This field should be set for `search` event when autocomplete function is + // enabled and the user clicks a suggestion for search. CompletionDetail completion_detail = 22; // 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. + // If you provide custom attributes for ingested user events, also include + // them in the user events that you associate with prediction requests. Custom + // attribute formatting must be consistent between imported events and events + // provided with prediction requests. This lets the Retail API use + // those custom attributes when training models and serving predictions, which + // helps improve recommendation quality. + // + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * The key must be a UTF-8 encoded string with a length limit of 5,000 + // characters. + // * For text attributes, 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. + // * For number attributes, at most 400 values are allowed. + // + // For product recommendations, an example of extra user information is + // traffic_channel, which is how a user arrives at the site. Users can arrive + // at the site by coming to the site directly, coming through Google + // search, or in other ways. map attributes = 7; // The ID or name of the associated shopping cart. This ID is used diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto index 2d48a511d8c..4446906a21a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; +import "google/api/resource.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"; @@ -94,13 +95,14 @@ service UserEventService { }; } - // Triggers a user event rejoin operation with latest product catalog. Events + // Starts 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 + // serving. This method can be used to start 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. + // correct events joined with the wrong product catalog. A rejoin operation + // can take hours or days to complete. rpc RejoinUserEvents(RejoinUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto index ffec074fe4d..e6d768f5f56 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/common.proto"; @@ -85,6 +84,285 @@ message ProductLevelConfig { string merchant_center_product_id_field = 2; } +// Catalog level attribute config for an attribute. For example, if customers +// want to enable/disable facet for a specific attribute. +message CatalogAttribute { + // The type of an attribute. + enum AttributeType { + // The type of the attribute is unknown. + // + // Used when type cannot be derived from attribute that is not + // [in_use][google.cloud.retail.v2beta.CatalogAttribute.in_use]. + UNKNOWN = 0; + + // Textual attribute. + TEXTUAL = 1; + + // Numerical attribute. + NUMERICAL = 2; + } + + // The status of the indexable option of a catalog attribute. + enum IndexableOption { + // Value used when unset. Defaults to + // [INDEXABLE_ENABLED][google.cloud.retail.v2beta.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED]. + INDEXABLE_OPTION_UNSPECIFIED = 0; + + // Indexable option enabled for an attribute. + INDEXABLE_ENABLED = 1; + + // Indexable option disabled for an attribute. + INDEXABLE_DISABLED = 2; + } + + // The status of the dynamic facetable option of a catalog attribute. + enum DynamicFacetableOption { + // Value used when unset. Defaults to + // [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED]. + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; + + // Dynamic facetable option enabled for an attribute. + DYNAMIC_FACETABLE_ENABLED = 1; + + // Dynamic facetable option disabled for an attribute. + DYNAMIC_FACETABLE_DISABLED = 2; + } + + // The status of the searchable option of a catalog attribute. + enum SearchableOption { + // Value used when unset. Defaults to + // [SEARCHABLE_DISABLED][google.cloud.retail.v2beta.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED]. + SEARCHABLE_OPTION_UNSPECIFIED = 0; + + // Searchable option enabled for an attribute. + SEARCHABLE_ENABLED = 1; + + // Searchable option disabled for an attribute. + SEARCHABLE_DISABLED = 2; + } + + // Required. Attribute name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Indicates whether this attribute has been used by any + // products. `True` if at least one + // [Product][google.cloud.retail.v2beta.Product] is using this attribute in + // [Product.attributes][google.cloud.retail.v2beta.Product.attributes]. + // Otherwise, this field is `False`. + // + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] can be + // pre-loaded by using [AddCatalogAttribute][], [ImportCatalogAttributes][], + // or [UpdateAttributesConfig][] APIs. This field is `False` for pre-loaded + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s. + // + // Only [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s that + // are not in use by products can be deleted. + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s that are + // in use by products cannot be deleted; however, their configuration + // properties will reset to default values upon removal request. + // + // After catalog changes, it takes about 10 minutes for this field to update. + bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of this attribute. This is derived from the attribute + // in [Product.attributes][google.cloud.retail.v2beta.Product.attributes]. + AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values + // are indexed so that it can be filtered, faceted, or boosted in + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. + IndexableOption indexable_option = 5; + + // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic + // facet. Could only be DYNAMIC_FACETABLE_DISABLED if + // [CatalogAttribute.indexable_option][google.cloud.retail.v2beta.CatalogAttribute.indexable_option] + // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. + DynamicFacetableOption dynamic_facetable_option = 6; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values + // are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. + // + // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values + // will not be searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], as + // there are no text values associated to numerical attributes. + SearchableOption searchable_option = 7; +} + +// Catalog level attribute config. +message AttributesConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/AttributesConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }; + + // Required. Immutable. The fully qualified resource name of the attribute + // config. Format: "projects/*/locations/*/catalogs/*/attributesConfig" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Enable attribute(s) config at catalog level. + // For example, indexable, dynamic_facetable, or searchable for each + // attribute. + // + // The key is catalog attribute's name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + // + // The maximum number of catalog attributes allowed in a request is 1000. + map catalog_attributes = 2; + + // Output only. The + // [AttributeConfigLevel][google.cloud.retail.v2beta.AttributeConfigLevel] + // used for this catalog. + AttributeConfigLevel attribute_config_level = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Catalog level autocomplete config for customers to customize autocomplete +// feature's settings. +message CompletionConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/CompletionConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }; + + // Required. Immutable. Fully qualified name + // projects/*/locations/*/catalogs/*/completionConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Specifies the matching order for autocomplete suggestions, e.g., a query + // consisting of 'sh' with 'out-of-order' specified would suggest "women's + // shoes", whereas a query of 'red s' with 'exact-prefix' specified would + // suggest "red shoes". Currently supported values: + // + // * 'out-of-order' + // * 'exact-prefix' + // + // Default value: 'exact-prefix'. + string matching_order = 2; + + // The maximum number of autocomplete suggestions returned per term. The + // maximum allowed max suggestions is 20. Default value is 20. If left unset + // or set to 0, then will fallback to default value. + int32 max_suggestions = 3; + + // The minimum number of characters needed to be typed in order to get + // suggestions. Default value is 2. If left unset or set to 0, then will + // fallback to default value. + int32 min_prefix_length = 4; + + // If set to true, the auto learning function is enabled. Auto learning uses + // user data to generate suggestions using ML techniques. Default value is + // false. Only after enabling auto learning can users use `cloud-retail` + // data in + // [CompleteQueryRequest][google.cloud.retail.v2beta.CompleteQueryRequest]. + bool auto_learning = 11; + + // Output only. The input config for the import of the source data that + // contains the autocomplete phrases uploaded by the customer. + CompletionDataInputConfig suggestions_input_config = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest suggestion terms + // list import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_suggestions_import_operation = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The input config for the import of the source data that + // contains the / autocomplete denylist phrases uploaded by the customer. + CompletionDataInputConfig denylist_input_config = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. LRO corresponding to the latest denylist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_denylist_import_operation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The input config for the import of the source data that + // contains the autocomplete allowlist phrases uploaded by the customer. + CompletionDataInputConfig allowlist_input_config = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. LRO corresponding to the latest allowlist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_allowlist_import_operation = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a link between a Merchant Center account and a branch. +// Once a link is established, products from the linked merchant center account +// will be streamed to the linked branch. +message MerchantCenterLink { + // Required. The linked [Merchant center account + // id](https://developers.google.com/shopping-content/guides/accountstatuses). + // The account must be a standalone account or a sub-account of a MCA. + int64 merchant_center_account_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // The branch id (e.g. 0/1/2) within this catalog that products from + // merchant_center_account_id are streamed to. When updating this field, an + // empty value will use the currently configured default branch. However, + // changing the default branch later on won't change the linked branch here. + // + // A single branch id can only have one linked merchant center account id. + string branch_id = 2; + + // String representing the destination to import for, all if left empty. + // List of possible values can be found here. + // [https://support.google.com/merchants/answer/7501026] + // List of allowed string values: + // "Shopping_ads", "Buy_on_google_listings", "Display_ads", "Local_inventory + // _ads", "Free_listings", "Free_local_listings" + // NOTE: The string values are case sensitive. + repeated string destinations = 3; + + // Region code of offers to accept. 2-letter Uppercase ISO 3166-1 alpha-2 + // code. List of values can be found + // [here](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) + // under the `region` tag. If left blank no region filtering will be + // performed. + // + // Example value: `US`. + string region_code = 4; + + // Language of the title/description and other string attributes. Use language + // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + // ISO 639-1. + // + // This specifies the language of offers in Merchant Center that will be + // accepted. If empty no language filtering will be performed. + // + // Example value: `en`. + string language_code = 5; +} + +// Configures Merchant Center linking. +// Links contained in the config will be used to sync data from a Merchant +// Center account to a Cloud Retail branch. +message MerchantCenterLinkingConfig { + // Links between Merchant Center accounts and branches. + repeated MerchantCenterLink links = 1; +} + // The catalog configuration. message Catalog { option (google.api.resource) = { @@ -110,4 +388,10 @@ message Catalog { // Required. The product level configuration. ProductLevelConfig product_level_config = 4 [(google.api.field_behavior) = REQUIRED]; + + // The Merchant Center linking configuration. + // Once a link is added, the data stream from Merchant Center to Cloud Retail + // will be enabled automatically. The requester must have access to the + // merchant center account in order to make changes to this field. + MerchantCenterLinkingConfig merchant_center_linking_config = 6; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto index 5f2892858e8..7e27c916b1e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto @@ -21,8 +21,6 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/catalog.proto"; -import "google/cloud/retail/v2beta/import_config.proto"; -import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -93,10 +91,6 @@ service CatalogService { // (if branch is not explicitly set). // * UserEventService will only join events with products from branch // {newBranch}. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -109,10 +103,6 @@ service CatalogService { // Get which branch is currently default branch set by // [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] // method under a specified parent catalog. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse) { option (google.api.http) = { @@ -120,6 +110,97 @@ service CatalogService { }; option (google.api.method_signature) = "catalog"; } + + // Gets a [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig]. + rpc GetCompletionConfig(GetCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/catalogs/*/completionConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the + // [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig]s. + rpc UpdateCompletionConfig(UpdateCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + patch: "/v2beta/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}" + body: "completion_config" + }; + option (google.api.method_signature) = "completion_config,update_mask"; + } + + // Gets an [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. + rpc GetAttributesConfig(GetAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/catalogs/*/attributesConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. + // + // The catalog attributes in the request will be updated in the catalog, or + // inserted if they do not exist. Existing catalog attributes not included in + // the request will remain unchanged. Attributes that are assigned to + // products, but do not exist at the catalog level, are always included in the + // response. The product attribute is assigned default values for missing + // catalog attribute fields, e.g., searchable and dynamic facetable options. + rpc UpdateAttributesConfig(UpdateAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + patch: "/v2beta/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}" + body: "attributes_config" + }; + option (google.api.method_signature) = "attributes_config,update_mask"; + } + + // Adds the specified + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to the + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to + // add already exists, an ALREADY_EXISTS error is returned. + rpc AddCatalogAttribute(AddCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute" + body: "*" + }; + } + + // Removes the specified + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] from the + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to + // remove does not exist, a NOT_FOUND error is returned. + rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute" + body: "*" + }; + } + + // Replaces the specified + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] in the + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] by updating + // the catalog attribute with the same + // [CatalogAttribute.key][google.cloud.retail.v2beta.CatalogAttribute.key]. + // + // If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to + // replace does not exist, a NOT_FOUND error is returned. + rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute" + body: "*" + }; + } } // Request for @@ -207,6 +288,10 @@ message SetDefaultBranchRequest { // // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT // error is returned. + // + // If there are no sufficient active products in the targeted branch and + // [force][google.cloud.retail.v2beta.SetDefaultBranchRequest.force] is not + // set, a FAILED_PRECONDITION error is returned. string branch_id = 2 [ (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } ]; @@ -218,6 +303,11 @@ message SetDefaultBranchRequest { // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. string note = 3; + + // If set to true, it permits switching to a branch with + // [branch_id][google.cloud.retail.v2beta.SetDefaultBranchRequest.branch_id] + // even if it has no sufficient active products. + bool force = 4; } // Request message to show which branch is currently the default branch. @@ -245,3 +335,144 @@ message GetDefaultBranchResponse { // field, when this branch was set as default. string note = 3; } + +// Request for +// [CatalogService.GetCompletionConfig][google.cloud.retail.v2beta.CatalogService.GetCompletionConfig] +// method. +message GetCompletionConfigRequest { + // Required. Full CompletionConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/CompletionConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig] +// method. +message UpdateCompletionConfigRequest { + // Required. The + // [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig] to update. + // + // If the caller does not have permission to update the + // [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig], then a + // PERMISSION_DENIED error is returned. + // + // If the [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig] to + // update does not exist, a NOT_FOUND error is returned. + CompletionConfig completion_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig] to update. + // The following are the only supported fields: + // + // * [CompletionConfig.matching_order][google.cloud.retail.v2beta.CompletionConfig.matching_order] + // * [CompletionConfig.max_suggestions][google.cloud.retail.v2beta.CompletionConfig.max_suggestions] + // * [CompletionConfig.min_prefix_length][google.cloud.retail.v2beta.CompletionConfig.min_prefix_length] + // * [CompletionConfig.auto_learning][google.cloud.retail.v2beta.CompletionConfig.auto_learning] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.GetAttributesConfig][google.cloud.retail.v2beta.CatalogService.GetAttributesConfig] +// method. +message GetAttributesConfigRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig] +// method. +message UpdateAttributesConfigRequest { + // Required. The + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] to update. + AttributesConfig attributes_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] to update. + // The following is the only supported field: + // + // * [AttributesConfig.catalog_attributes][google.cloud.retail.v2beta.AttributesConfig.catalog_attributes] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute] +// method. +message AddCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to add. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute] +// method. +message RemoveCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The attribute name key of the + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to remove. + string key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute] +// method. +message ReplaceCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The updated + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to update. + // The following are NOT supported: + // + // * [CatalogAttribute.key][google.cloud.retail.v2beta.CatalogAttribute.key] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index 27208c8618a..ada7dd1508d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; @@ -29,6 +28,21 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2beta"; option ruby_package = "Google::Cloud::Retail::V2beta"; +// At which level we offer configuration for attributes. +enum AttributeConfigLevel { + // Value used when unset. Defaults to + // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2beta.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; + + // At this level, we honor the attribute configurations set in + // [Product.attributes][google.cloud.retail.v2beta.Product.attributes]. + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; + + // At this level, we honor the attribute configurations set in + // [CatalogConfig.attribute_configs][]. + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; +} + // The type of solution. enum SolutionType { // Default value. @@ -41,6 +55,21 @@ enum SolutionType { SOLUTION_TYPE_SEARCH = 2; } +// The use case of Cloud Retail Search. +enum SearchSolutionUseCase { + // The value when it's unspecified. Defaults to + // [SEARCH][]. + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; + + // Search use case. Expects the traffic has a non-empty + // [query][google.cloud.retail.v2beta.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_SEARCH = 1; + + // Browse use case. Expects the traffic has an empty + // [query][google.cloud.retail.v2beta.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_BROWSE = 2; +} + // Metadata that is used to define a condition that triggers an action. // A valid condition must specify at least one of 'query_terms' or // 'products_filter'. If multiple fields are specified, the condition is met if @@ -343,6 +372,9 @@ message CustomAttribute { // The textual values of this custom attribute. For example, `["yellow", // "green"]` when the key is "color". // + // Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is + // returned. + // // Exactly one of [text][google.cloud.retail.v2beta.CustomAttribute.text] or // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. @@ -356,7 +388,11 @@ message CustomAttribute { // set. Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; - // If true, custom attribute values are searchable by text queries in + // This field will only be used when + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2beta.Catalog] is + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are + // searchable by text queries in // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. // // This field is ignored in a @@ -366,8 +402,11 @@ message CustomAttribute { // set. Otherwise, a INVALID_ARGUMENT error is returned. optional bool searchable = 3; - // If true, custom attribute values are indexed, so that it can be filtered, - // faceted or boosted in + // This field will only be used when + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2beta.Catalog] is + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are + // indexed, so that it can be filtered, faceted or boosted in // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. // // This field is ignored in a @@ -418,7 +457,10 @@ message FulfillmentInfo { repeated string place_ids = 2; } -// [Product][google.cloud.retail.v2beta.Product] thumbnail/detail image. +// [Product][google.cloud.retail.v2beta.Product] image. Recommendations AI and +// Retail Search do not use product images to improve prediction and search +// results. However, product images can be returned in results, and are shown in +// prediction or search previews in the console. message Image { // Required. URI of the image. // @@ -609,19 +651,24 @@ message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in // user, such as a user name. // + // Always use a hashed value for this ID. + // // 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. Required for getting - // [SearchResponse.sponsored_results][google.cloud.retail.v2beta.SearchResponse.sponsored_results]. - // This field is used to extract location information for personalization. + // 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 + // This should not be set when: + // + // * setting + // [SearchRequest.user_info][google.cloud.retail.v2beta.SearchRequest.user_info]. + // * using the JavaScript tag in // [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent] // or if // [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request] @@ -654,16 +701,60 @@ message UserInfo { bool direct_user_request = 4; } -// Promotion information. -message Promotion { - // ID of the promotion. For example, "free gift". - // - // The value value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, - // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is - // returned. +// The inventory information at a place (e.g. a store) identified +// by a place ID. +message LocalInventory { + // The place ID for the current set of inventory information. + string place_id = 1; + + // Product price and cost information. // // Google Merchant Center property - // [promotion](https://support.google.com/merchants/answer/7050148). - string promotion_id = 1; + // [price](https://support.google.com/merchants/answer/6324371). + PriceInfo price_info = 2; + + // Additional local inventory attributes, for example, store name, promotion + // tags, etc. + // + // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + // error is returned: + // + // * At most 30 attributes are allowed. + // * The key must be a UTF-8 encoded string with a length limit of 32 + // characters. + // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, + // key0LikeThis or KEY_1_LIKE_THIS. + // * The attribute values must be of the same type (text or number). + // * Only 1 value is allowed for each attribute. + // * For text values, the length limit is 256 UTF-8 characters. + // * The attribute does not support search. The `searchable` field should be + // unset or set to false. + // * The max summed total bytes of custom attribute keys and values per + // product is 5MiB. + map attributes = 3; + + // Input only. Supported fulfillment types. Valid fulfillment type values + // include commonly used types (such as pickup in store and same day + // delivery), and custom types. Customers have to map custom types to their + // display names before rendering UI. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is + // returned. + repeated string fulfillment_types = 4 + [(google.api.field_behavior) = INPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto index b7de4ce72d9..6a1f2907681 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto @@ -36,8 +36,7 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Please submit a form [here](https://cloud.google.com/contact) to contact -// cloud sales if you are interested in using Retail Search. +// Please enable Retail Search on Cloud Console before using this feature. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,8 +45,7 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -56,11 +54,13 @@ service CompletionService { // Bulk import of processed completion dataset. // - // Request processing may be synchronous. Partial updating is not supported. + // Request processing is asynchronous. Partial updating is not supported. + // + // The operation is successfully finished only after the imported suggestions + // are indexed successfully and ready for serving. The process takes hours. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -90,22 +90,21 @@ message CompleteQueryRequest { // The maximum number of allowed characters is 255. string query = 2 [(google.api.field_behavior) = 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 logs in or out of the website. + // Required field. 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 logs in or 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 = 7; - // The list of languages of the query. This is - // the BCP-47 language code, such as "en-US" or "sr-Latn". - // For more information, see - // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). - // - // The maximum number of allowed characters is 255. - // Only "en-US" is currently supported. + // The language filters applied to the output suggestions. If set, it should + // contain the language of the query. If not set, suggestions are returned + // without considering language restrictions. This is the BCP-47 language + // code, such as "en-US" or "sr-Latn". For more information, see [Tags for + // Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + // number of language codes is 3. repeated string language_codes = 3; // The device type context for completion suggestions. @@ -140,7 +139,8 @@ message CompleteQueryRequest { string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback - // to the configured value [CompletionConfig.max_suggestions][]. + // to the configured value + // [CompletionConfig.max_suggestions][google.cloud.retail.v2beta.CompletionConfig.max_suggestions]. // // The maximum allowed max suggestions is 20. If it is set higher, it will be // capped by 20. @@ -154,7 +154,11 @@ message CompleteQueryResponse { // The suggestion for the query. string suggestion = 1; - // Additional custom attributes ingested through BigQuery. + // Custom attributes for the suggestion term. + // * For "user-data", the attributes are additional custom attributes + // ingested through BigQuery. + // * For "cloud-retail", the attributes are product attributes generated + // by Cloud Retail. map attributes = 2; } @@ -169,9 +173,9 @@ message CompleteQueryResponse { repeated CompletionResult completion_results = 1; // A unique complete token. This should be included in the - // [SearchRequest][google.cloud.retail.v2beta.SearchRequest] resulting from - // this completion, which enables accurate attribution of complete model - // performance. + // [UserEvent.completion_detail][google.cloud.retail.v2beta.UserEvent.completion_detail] + // for search events resulting from this completion, which enables accurate + // attribution of complete model performance. string attribution_token = 2; // Matched recent searches of this user. The maximum number of recent searches diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto new file mode 100644 index 00000000000..e55622272a4 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto @@ -0,0 +1,84 @@ +// Copyright 2021 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.v2beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2beta/common.proto"; +import "google/cloud/retail/v2beta/search_service.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ControlProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Configures dynamic serving time metadata that is used to pre and post +// process search/recommendation model results. +message Control { + option (google.api.resource) = { + type: "retail.googleapis.com/Control" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }; + + // The behavior/type of the control + // + // A behavior/type must be specified on creation. Type cannot be changed once + // specified (e.g. A Rule control will always be a Rule control.). An + // INVALID_ARGUMENT will be returned if either condition is violated. + oneof control { + // A facet specification to perform faceted search. + SearchRequest.FacetSpec facet_spec = 3; + + // A rule control - a condition-action pair. + // Enacts a set action when the condition is triggered. + // For example: Boost "gShoe" when query full matches "Running Shoes". + Rule rule = 4; + } + + // Immutable. Fully qualified name + // projects/*/locations/global/catalogs/*/controls/* + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable control display name. Used in Retail UI. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is thrown. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. List of serving configuration ids that that are associated + // with this control. Note the association is managed via the ServingConfig, + // this is an output only denormalizeed view. Assumed to be in the same + // catalog. + repeated string associated_serving_config_ids = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The solution types that the serving config is used + // for. Currently we support setting only one type of solution at creation + // time. + // + // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. + // If no solution type is provided at creation time, will default to + // SOLUTION_TYPE_SEARCH. + repeated SolutionType solution_types = 6 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto new file mode 100644 index 00000000000..922c46f2fb6 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto @@ -0,0 +1,184 @@ +// Copyright 2021 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.v2beta; + +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/v2beta/control.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ControlServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Service for modifying Control. +service ControlService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Control. + // + // If the [Control][google.cloud.retail.v2beta.Control] to create already + // exists, an ALREADY_EXISTS error is returned. + rpc CreateControl(CreateControlRequest) returns (Control) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls" + body: "control" + }; + option (google.api.method_signature) = "parent,control,control_id"; + } + + // Deletes a Control. + // + // If the [Control][google.cloud.retail.v2beta.Control] to delete does not + // exist, a NOT_FOUND error is returned. + rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a Control. + // + // [Control][google.cloud.retail.v2beta.Control] cannot be set to a different + // oneof field, if so an INVALID_ARGUMENT is returned. If the + // [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a + // NOT_FOUND error is returned. + rpc UpdateControl(UpdateControlRequest) returns (Control) { + option (google.api.http) = { + patch: "/v2beta/{control.name=projects/*/locations/*/catalogs/*/controls/*}" + body: "control" + }; + option (google.api.method_signature) = "control,update_mask"; + } + + // Gets a Control. + rpc GetControl(GetControlRequest) returns (Control) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all Controls linked to this catalog. + rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for CreateControl method. +message CreateControlRequest { + // Required. Full resource name of parent catalog. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The Control to create. + Control control = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the Control, which will become the final + // component of the Control's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string control_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateControl method. +message UpdateControlRequest { + // Required. The Control to update. + Control control = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [Control][google.cloud.retail.v2beta.Control] to update. The following are + // NOT supported: + // + // * [Control.name][google.cloud.retail.v2beta.Control.name] + // + // If not set or empty, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteControl method. +message DeleteControlRequest { + // Required. The resource name of the Control to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for GetControl method. +message GetControlRequest { + // Required. The resource name of the Control to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for ListControls method. +message ListControlsRequest { + // Required. The catalog resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 50. Max allowed value is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListControls` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2beta.ListControlsRequest.filter] is unset. + // * List controls that are used in a single ServingConfig: + // 'serving_config = "boosted_home_page_cvr"' + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListControls method. +message ListControlsResponse { + // All the Controls for a given catalog. + repeated Control controls = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto index 0324d0edbe4..249f50119d4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index f2e27174d73..c1390ab0d1c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/product.proto"; @@ -72,7 +71,8 @@ message GcsSource { // // Supported values for catalog attribute imports: // - // * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + // * 'catalog_attribute' (default): One CSV + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] per line. string data_schema = 2; } @@ -121,8 +121,19 @@ message BigQuerySource { // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2beta.UserEvent] per line. - // * `user_event_ga360`: Using + // * `user_event_ga360`: + // The schema is available here: // https://support.google.com/analytics/answer/3437719. + // * `user_event_ga4`: This feature is in private preview. Please contact the + // support team for importing Google Analytics 4 events. + // The schema is available here: + // https://support.google.com/analytics/answer/7029846. + // + // Supported values for auto-completion imports: + // + // * `suggestions` (default): One JSON completion suggestion per line. + // * `denylist`: One JSON deny suggestion per line. + // * `allowlist`: One JSON allow suggestion per line. string data_schema = 4; } @@ -144,9 +155,9 @@ message UserEventInlineSource { 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 Cloud Storage prefix for import errors. This must be an empty, + // existing Cloud Storage directory. Import errors will be written to + // sharded files in this directory, one per line, as a JSON-encoded // `google.rpc.Status` message. string gcs_prefix = 1; } @@ -166,16 +177,15 @@ message ImportProductsRequest { // Calculates diff and replaces the entire product dataset. Existing // products may be deleted if they are not present in the source location. // - // Can only be while using - // [BigQuerySource][google.cloud.retail.v2beta.BigQuerySource]. + // Can only be set while using + // [BigQuerySource][google.cloud.retail.v2beta.BigQuerySource]. And the + // BigQuery dataset must be created in the data location "us (multiple + // regions in United States)", otherwise a PERMISSION_DENIED error is + // thrown. // // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. FULL = 2; } @@ -189,16 +199,8 @@ message ImportProductsRequest { (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } ]; - // Unique identifier provided by client, within the ancestor - // dataset scope. Ensures idempotency and used for request deduplication. - // Server-generated if unspecified. Up to 128 characters long and must match - // the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - // [ImportMetadata][google.cloud.retail.v2beta.ImportMetadata]. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - string request_id = 6; + // Deprecated. This field has no effect. + string request_id = 6 [deprecated = true]; // Required. The desired input location of the data. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -336,9 +338,8 @@ message ImportMetadata { // Count of entries that encountered errors while processing. int64 failure_count = 4; - // Id of the request / operation. This is parroting back the requestId - // that was passed in the request. - string request_id = 5; + // Deprecated. This field is never set. + string request_id = 5 [deprecated = true]; // Pub/Sub topic for receiving notification. If this field is set, // when the import is finished, a notification will be sent to diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto index 37d364c8c12..c5ec1871580 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto @@ -97,9 +97,12 @@ message PredictRequest { // * 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`. + // If your filter blocks all prediction results, the API will return generic + // (unfiltered) popular products. If you only want results strictly matching + // the filters, set `strictFiltering` to True in `PredictRequest.params` to + // receive empty results instead. + // Note that the API will never return items with storageStatus of "EXPIRED" + // or "DELETED" regardless of filter choices. string filter = 5; // Use validate only mode for this prediction query. If set to true, a diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 0899d387264..4e6dfec8239 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -16,10 +16,10 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/common.proto"; +import "google/cloud/retail/v2beta/promotion.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -331,8 +331,8 @@ message Product { // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or // `KEY_1_LIKE_THIS`. // * For text attributes, 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. + // allowed. Each value must be a non-empty UTF-8 encoded string with a + // length limit of 256 characters. // * For number attributes, at most 400 values are allowed. map attributes = 12; @@ -398,8 +398,8 @@ message Product { // property [Offer.url](https://schema.org/url). string uri = 22; - // Product images for the product.Highly recommended to put the main image - // to the first. + // Product images for the product. We highly recommend putting the main + // image first. // // A maximum of 300 images are allowed. // @@ -442,7 +442,7 @@ message Product { // The material of the product. For example, "leather", "wooden". // // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an + // string with a length limit of 200 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // // Corresponding properties: Google Merchant Center property @@ -478,7 +478,9 @@ message Product { repeated string conditions = 29; // The promotions applied to the product. A maximum of 10 values are allowed - // per [Product][google.cloud.retail.v2beta.Product]. + // per [Product][google.cloud.retail.v2beta.Product]. Only + // [Promotion.promotion_id][google.cloud.retail.v2beta.Promotion.promotion_id] + // will be used, other fields will be ignored if set. repeated Promotion promotions = 34; // The timestamp when the product is published by the retailer for the first diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index beb380e7404..0ad73436d3e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -21,10 +21,8 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2beta/common.proto"; -import "google/cloud/retail/v2beta/export_config.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/product.proto"; -import "google/cloud/retail/v2beta/purge_config.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; @@ -136,7 +134,8 @@ service ProductService { // [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], // then any pre-existing inventory information for this product will be used. // - // If no inventory fields are set in [UpdateProductRequest.set_mask][], + // If no inventory fields are set in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], // then any existing inventory information will be preserved. // // Pre-existing inventory information can only be updated with @@ -146,8 +145,7 @@ service ProductService { // [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -173,8 +171,7 @@ service ProductService { // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -201,8 +198,7 @@ service ProductService { // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -215,6 +211,72 @@ service ProductService { metadata_type: "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" }; } + + // Updates local inventory information for a + // [Product][google.cloud.retail.v2beta.Product] at a list of places, while + // respecting the last update timestamps of each inventory field. + // + // This process is asynchronous and does not require the + // [Product][google.cloud.retail.v2beta.Product] to exist before updating + // inventory information. If the request is valid, the update will be enqueued + // and processed downstream. As a consequence, when a response is returned, + // updates are not immediately manifested in the + // [Product][google.cloud.retail.v2beta.Product] queried by + // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // + // Local inventory information can only be modified using this method. + // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // has no effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please enable Retail Search on Cloud Console before using this feature. + rpc AddLocalInventories(AddLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.AddLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2beta.AddLocalInventoriesMetadata" + }; + } + + // Remove local inventory information for a + // [Product][google.cloud.retail.v2beta.Product] at a list of places at a + // removal timestamp. + // + // This process is asynchronous. If the request is valid, the removal will be + // enqueued and processed downstream. As a consequence, when a response is + // returned, removals are not immediately manifested in the + // [Product][google.cloud.retail.v2beta.Product] queried by + // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // + // Local inventory information can only be removed using this method. + // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // and + // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // has no effect on local inventories. + // + // This feature is only available for users who have Retail Search enabled. + // Please enable Retail Search on Cloud Console before using this feature. + rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories" + body: "*" + }; + option (google.api.method_signature) = "product"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.RemoveLocalInventoriesResponse" + metadata_type: "google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata" + }; + } } // Request message for [CreateProduct][] method. @@ -455,6 +517,24 @@ message SetInventoryRequest { // provided or default value for // [SetInventoryRequest.set_time][google.cloud.retail.v2beta.SetInventoryRequest.set_time]. // + // The caller can replace place IDs for a subset of fulfillment types in the + // following ways: + // + // * Adds "fulfillment_info" in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask] + // * Specifies only the desired fulfillment types and corresponding place IDs + // to update in [SetInventoryRequest.inventory.fulfillment_info][] + // + // The caller can clear all place IDs from a subset of fulfillment types in + // the following ways: + // + // * Adds "fulfillment_info" in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask] + // * Specifies only the desired fulfillment types to clear in + // [SetInventoryRequest.inventory.fulfillment_info][] + // * Checks that only the desired fulfillment info types have empty + // [SetInventoryRequest.inventory.fulfillment_info.place_ids][] + // // The last update time is recorded for the following inventory fields: // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] // * [Product.availability][google.cloud.retail.v2beta.Product.availability] @@ -574,6 +654,109 @@ message AddFulfillmentPlacesMetadata {} // method. message AddFulfillmentPlacesResponse {} +// Request message for [AddLocalInventories][] method. +message AddLocalInventoriesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of inventory information at difference places. Each place + // is identified by its place ID. At most 3000 inventories are allowed per + // request. + repeated LocalInventory local_inventories = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which inventory fields in the provided list of + // [LocalInventory][google.cloud.retail.v2beta.LocalInventory] to update. The + // field is updated to the provided value. + // + // If a field is set while the place does not have a previous local inventory, + // the local inventory at that store is created. + // + // If a field is set while the value of that field is not provided, the + // original field value, if it exists, is deleted. + // + // If the mask is not set or set with empty paths, all inventory fields will + // be updated. + // + // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + // is returned and the entire update will be ignored. + google.protobuf.FieldMask add_mask = 4; + + // The time when the inventory updates are issued. Used to prevent + // out-of-order updates on local inventory fields. If not provided, the + // internal system time will be used. + google.protobuf.Timestamp add_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + // not found, the local inventory will still be processed and retained for at + // most 1 day and processed once the + // [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + // a NOT_FOUND error is returned if the + // [Product][google.cloud.retail.v2beta.Product] is not found. + bool allow_missing = 6; +} + +// Metadata related to the progress of the AddLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [AddLocalInventories][] method. +message AddLocalInventoriesMetadata {} + +// Response of the [AddLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [AddLocalInventories][] +// method. +message AddLocalInventoriesResponse {} + +// Request message for [RemoveLocalInventories][] method. +message RemoveLocalInventoriesRequest { + // Required. Full resource name of + // [Product][google.cloud.retail.v2beta.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.v2beta.Product], regardless of whether or not + // it exists, a PERMISSION_DENIED error is returned. + string product = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; + + // Required. A list of place IDs to have their inventory deleted. + // At most 3000 place IDs are allowed per request. + repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; + + // The time when the inventory deletions are issued. Used to prevent + // out-of-order updates and deletions on local inventory fields. If not + // provided, the internal system time will be used. + google.protobuf.Timestamp remove_time = 5; + + // If set to true, and the [Product][google.cloud.retail.v2beta.Product] is + // not found, the local inventory removal request will still be processed and + // retained for at most 1 day and processed once the + // [Product][google.cloud.retail.v2beta.Product] is created. If set to false, + // a NOT_FOUND error is returned if the + // [Product][google.cloud.retail.v2beta.Product] is not found. + bool allow_missing = 3; +} + +// Metadata related to the progress of the RemoveLocalInventories operation. +// Currently empty because there is no meaningful metadata populated from the +// [RemoveLocalInventories][] method. +message RemoveLocalInventoriesMetadata {} + +// Response of the [RemoveLocalInventories][] API. Currently empty because +// there is no meaningful response populated from the [RemoveLocalInventories][] +// method. +message RemoveLocalInventoriesResponse {} + // Request message for [RemoveFulfillmentPlaces][] method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/promotion.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/promotion.proto new file mode 100644 index 00000000000..5346f14d363 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/promotion.proto @@ -0,0 +1,40 @@ +// Copyright 2021 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.v2beta; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "PromotionProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Promotion information. +message Promotion { + // ID of the promotion. For example, "free gift". + // + // The value must be a UTF-8 encoded string with a length limit of 128 + // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, + // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Google Merchant Center property + // [promotion](https://support.google.com/merchants/answer/7050148). + string promotion_id = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto index 1474fe8d6dd..5ab09aa348b 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto @@ -16,10 +16,8 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index d38f1eb4a57..b8b2156a840 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -24,8 +24,6 @@ import "google/cloud/retail/v2beta/common.proto"; import "google/cloud/retail/v2beta/product.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Beta"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; @@ -39,8 +37,7 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Please submit a form [here](https://cloud.google.com/contact) to contact -// cloud sales if you are interested in using Retail Search. +// Please enable Retail Search on Cloud Console before using this feature. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -49,8 +46,7 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -325,6 +321,14 @@ message SearchRequest { // applied and combined in a non-linear way. Maximum number of // specifications is 10. repeated ConditionBoostSpec condition_boost_specs = 1; + + // Whether to skip boostspec validation. If this field is set to true, + // invalid + // [BoostSpec.condition_boost_specs][google.cloud.retail.v2beta.SearchRequest.BoostSpec.condition_boost_specs] + // will be ignored and valid + // [BoostSpec.condition_boost_specs][google.cloud.retail.v2beta.SearchRequest.BoostSpec.condition_boost_specs] + // will still be applied. + optional bool skip_boost_spec_validation = 2; } // Specification to determine under which conditions query expansion should @@ -355,6 +359,26 @@ message SearchRequest { bool pin_unexpanded_results = 2; } + // The specification for personalization. + message PersonalizationSpec { + // The personalization mode of each search request. + enum Mode { + // Default value. Defaults to + // [Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Let CRS decide whether to use personalization. + AUTO = 1; + + // Disable personalization. + DISABLED = 2; + } + + // Defaults to + // [Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode.AUTO]. + Mode mode = 1; + } + // The search mode of each search request. enum SearchMode { // Default value. In this case both product search and faceted search will @@ -385,7 +409,7 @@ message SearchRequest { } // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -453,6 +477,9 @@ message SearchRequest { // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; + // The default filter that is applied when a user performs a search without + // checking any filters on the search page. + // // The filter applied to every search request when quality improvement such as // query expansion is needed. For example, if a query does not have enough // results, an expanded query with @@ -479,12 +506,12 @@ message SearchRequest { // is returned. repeated FacetSpec facet_specs = 12; + // Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + // to enable dynamic facets. Do not set this field. + // // The specification for dynamically generated facets. Notice that only // textual facets can be dynamically generated. - // - // This feature requires additional allowlisting. Contact Retail Search - // support team if you are interested in using dynamic facet feature. - DynamicFacetSpec dynamic_facet_spec = 21; + DynamicFacetSpec dynamic_facet_spec = 21 [deprecated = true]; // Boost specification to boost certain products. See more details at this // [user guide](https://cloud.google.com/retail/docs/boosting). @@ -506,11 +533,13 @@ message SearchRequest { // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] // [Product][google.cloud.retail.v2beta.Product]s attributes, // [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo] or - // [LocalInventory][]s attributes. The attributes from all the matching + // [LocalInventory][google.cloud.retail.v2beta.LocalInventory]s attributes. + // The attributes from all the matching // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2beta.Product]s or [LocalInventory][]s are - // merged and de-duplicated. Notice that rollup attributes will lead to extra - // query latency. Maximum number of keys is 30. + // [Product][google.cloud.retail.v2beta.Product]s or + // [LocalInventory][google.cloud.retail.v2beta.LocalInventory]s are merged and + // de-duplicated. Notice that rollup attributes will lead to extra query + // latency. Maximum number of keys is 30. // // For [FulfillmentInfo][google.cloud.retail.v2beta.FulfillmentInfo], a // fulfillment type and a fulfillment ID must be provided in the format of @@ -588,6 +617,9 @@ message SearchRequest { // The search mode of the search request. If not specified, a single search // request triggers both product search and faceted search. SearchMode search_mode = 31; + + // The specification for personalization. + PersonalizationSpec personalization_spec = 32; } // Response message for @@ -750,4 +782,10 @@ message SearchResponse { // The fully qualified resource name of applied // [controls](https://cloud.google.com/retail/docs/serving-control-rules). repeated string applied_controls = 12; + + // The invalid + // [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2beta.SearchRequest.BoostSpec.condition_boost_specs] + // that are not applied during serving. + repeated SearchRequest.BoostSpec.ConditionBoostSpec + invalid_condition_boost_specs = 14; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto new file mode 100644 index 00000000000..20112e61570 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto @@ -0,0 +1,247 @@ +// Copyright 2021 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.v2beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2beta/common.proto"; +import "google/cloud/retail/v2beta/search_service.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ServingConfigProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Configures metadata that is used to generate serving time results (e.g. +// search results or recommendation predictions). +// The ServingConfig is passed in the search and predict request and together +// with the Catalog.default_branch, generates results. +message ServingConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/ServingConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" + }; + + // Immutable. Fully qualified name + // projects/*/locations/global/catalogs/*/servingConfig/* + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable serving config display name. Used in Retail + // UI. + // + // 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]; + + // The id of the model to use at serving time. + // Currently only RecommendationModels are supported: + // https://cloud.google.com/retail/recommendations-ai/docs/create-models + // Can be changed but only to a compatible model (e.g. + // others-you-may-like CTR to others-you-may-like CVR). + // + // Required when + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string model_id = 3; + + // How much price ranking we want in serving results. + // Price reranking causes product items with a similar + // recommendation probability to be ordered by price, with the + // highest-priced items first. This setting could result in a decrease in + // click-through and conversion rates. + // Allowed values are: + // + // * 'no-price-reranking' + // * 'low-price-raranking' + // * 'medium-price-reranking' + // * 'high-price-reranking' + // + // If not specified, we choose default based on model type. Default value: + // 'no-price-reranking'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string price_reranking_level = 4; + + // Facet specifications for faceted search. If empty, no facets are returned. + // The ids refer to the ids of [Control][google.cloud.retail.v2beta.Control] + // resources with only the Facet control set. These controls are assumed to be + // in the same [Catalog][google.cloud.retail.v2beta.Catalog] as the + // [ServingConfig][google.cloud.retail.v2beta.ServingConfig]. + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string facet_control_ids = 5; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + + // Condition boost specifications. If a product matches multiple conditions + // in the specifications, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 100. + // + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2beta.ServingConfig.boost_control_ids] + // and [SearchRequest.boost_spec] are set, the boost conditions from both + // places are evaluated. If a search request matches multiple boost + // conditions, the final boost score is equal to the sum of the boost scores + // from all matched boost conditions. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string boost_control_ids = 7; + + // Condition filter specifications. If a product matches multiple conditions + // in the specifications, filters from these specifications are all + // applied and combined via the AND operator. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string filter_control_ids = 9; + + // Condition redirect specifications. Only the first triggered redirect action + // is applied, even if multiple apply. Maximum number of specifications is + // 1000. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string redirect_control_ids = 10; + + // Condition synonyms specifications. If multiple syonyms conditions match, + // all matching synonyms control in the list will execute. Order of controls + // in the list will not matter. Maximum number of specifications is + // 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string twoway_synonyms_control_ids = 18; + + // Condition oneway synonyms specifications. If multiple oneway synonyms + // conditions match, all matching oneway synonyms controls in the list will + // execute. Order of controls in the list will not matter. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string oneway_synonyms_control_ids = 12; + + // Condition do not associate specifications. If multiple do not associate + // conditions match, all matching do not associate controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string do_not_associate_control_ids = 13; + + // Condition replacement specifications. + // - Applied according to the order in the list. + // - A previously replaced term can not be re-replaced. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string replacement_control_ids = 14; + + // Condition ignore specifications. If multiple ignore + // conditions match, all matching ignore controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string ignore_control_ids = 15; + + // How much diversity to use in recommendation model results e.g. + // 'medium-diversity' or 'high-diversity'. Currently supported values: + // + // * 'no-diversity' + // * 'low-diversity' + // * 'medium-diversity' + // * 'high-diversity' + // * 'auto-diversity' + // + // If not specified, we choose default based on recommendation model + // type. Default value: 'no-diversity'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string diversity_level = 8; + + // Whether to add additional category filters on the 'similar-items' model. + // If not specified, we enable it by default. + // Allowed values are: + // + // * 'no-category-match': No additional filtering of original results from + // the model and the customer's filters. + // * 'relaxed-category-match': Only keep results with categories that match + // at least one item categories in the PredictRequests's context item. + // * If customer also sends filters in the PredictRequest, then the results + // will satisfy both conditions (user given and category match). + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string enable_category_filter_level = 16; + + // Required. Immutable. Specifies the solution types that a serving config can + // be associated with. Currently we support setting only one type of solution. + repeated SolutionType solution_types = 19 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto new file mode 100644 index 00000000000..e56c28accc0 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto @@ -0,0 +1,240 @@ +// Copyright 2021 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.v2beta; + +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/v2beta/serving_config.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ServingConfigServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Service for modifying ServingConfig. +service ServingConfigService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a ServingConfig. + // + // A maximum of 100 [ServingConfig][google.cloud.retail.v2beta.ServingConfig]s + // are allowed in a [Catalog][google.cloud.retail.v2beta.Catalog], otherwise + // a FAILED_PRECONDITION error is returned. + rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + body: "serving_config" + }; + option (google.api.method_signature) = + "parent,serving_config,serving_config_id"; + } + + // Deletes a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc DeleteServingConfig(DeleteServingConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a ServingConfig. + rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + patch: "/v2beta/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + body: "serving_config" + }; + option (google.api.method_signature) = "serving_config,update_mask"; + } + + // Gets a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all ServingConfigs linked to this catalog. + rpc ListServingConfigs(ListServingConfigsRequest) + returns (ListServingConfigsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Enables a Control on the specified ServingConfig. + // The control is added in the last position of the list of controls + // it belongs to (e.g. if it's a facet spec control it will be applied + // in the last position of servingConfig.facetSpecIds) + // Returns a ALREADY_EXISTS error if the control has already been applied. + // Returns a FAILED_PRECONDITION error if the addition could exceed maximum + // number of control allowed for that type of control. + rpc AddControl(AddControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } + + // Disables a Control on the specified ServingConfig. + // The control is removed from the ServingConfig. + // Returns a NOT_FOUND error if the Control is not enabled for the + // ServingConfig. + rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } +} + +// Request for CreateServingConfig method. +message CreateServingConfigRequest { + // Required. Full resource name of parent. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The ServingConfig to create. + ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the ServingConfig, which will become the final + // component of the ServingConfig's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateServingConfig method. +message UpdateServingConfigRequest { + // Required. The ServingConfig to update. + ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [ServingConfig][google.cloud.retail.v2beta.ServingConfig] to update. The + // following are NOT supported: + // + // * [ServingConfig.name][google.cloud.retail.v2beta.ServingConfig.name] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteServingConfig method. +message DeleteServingConfigRequest { + // Required. The resource name of the ServingConfig to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for GetServingConfig method. +message GetServingConfigRequest { + // Required. The resource name of the ServingConfig to get. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for ListServingConfigs method. +message ListServingConfigsRequest { + // Required. The catalog resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 100. If a value greater than 100 is provided, at most 100 results are + // returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListServingConfigs` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListServingConfigs method. +message ListServingConfigsResponse { + // All the ServingConfigs for a given catalog. + repeated ServingConfig serving_configs = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} + +// Request for AddControl method. +message AddControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config - if id is not found a NOT_FOUND error is returned. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for RemoveControl method. +message RemoveControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index 637697ef9ed..e21758012ee 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/retail/v2beta/common.proto"; import "google/cloud/retail/v2beta/product.proto"; @@ -136,6 +135,13 @@ message UserEvent { // Extra user event features to include in the recommendation model. // + // If you provide custom attributes for ingested user events, also include + // them in the user events that you associate with prediction requests. Custom + // attribute formatting must be consistent between imported events and events + // provided with prediction requests. This lets the Retail API use + // those custom attributes when training models and serving predictions, which + // helps improve recommendation quality. + // // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT // error is returned: // @@ -146,10 +152,10 @@ message UserEvent { // 256 characters. // * For number attributes, at most 400 values are allowed. // - // 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. + // For product recommendations, an example of extra user information is + // traffic_channel, which is how a user arrives at the site. Users can arrive + // at the site by coming to the site directly, coming through Google + // search, or in other ways. map attributes = 7; // The ID or name of the associated shopping cart. This ID is used diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto index c2da08739a8..ab7a0b3514a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto @@ -20,7 +20,7 @@ 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/v2beta/export_config.proto"; +import "google/api/resource.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/purge_config.proto"; import "google/cloud/retail/v2beta/user_event.proto"; @@ -95,13 +95,14 @@ service UserEventService { }; } - // Triggers a user event rejoin operation with latest product catalog. Events + // Starts 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 + // serving. This method can be used to start 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. + // correct events joined with the wrong product catalog. A rejoin operation + // can take hours or days to complete. rpc RejoinUserEvents(RejoinUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 87780c6ce97..20740410363 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -637,6 +637,9 @@ export namespace google { /** SetDefaultBranchRequest note */ note?: (string|null); + + /** SetDefaultBranchRequest force */ + force?: (boolean|null); } /** Represents a SetDefaultBranchRequest. */ @@ -657,6 +660,9 @@ export namespace google { /** SetDefaultBranchRequest note. */ public note: string; + /** SetDefaultBranchRequest force. */ + public force: boolean; + /** * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set @@ -1973,91 +1979,109 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a Promotion. */ - interface IPromotion { + /** Properties of a LocalInventory. */ + interface ILocalInventory { - /** Promotion promotionId */ - promotionId?: (string|null); + /** LocalInventory placeId */ + placeId?: (string|null); + + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** LocalInventory fulfillmentTypes */ + fulfillmentTypes?: (string[]|null); } - /** Represents a Promotion. */ - class Promotion implements IPromotion { + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { /** - * Constructs a new Promotion. + * Constructs a new LocalInventory. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPromotion); + constructor(properties?: google.cloud.retail.v2.ILocalInventory); - /** Promotion promotionId. */ - public promotionId: string; + /** LocalInventory placeId. */ + public placeId: string; + + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** LocalInventory fulfillmentTypes. */ + public fulfillmentTypes: string[]; /** - * Creates a new Promotion instance using the specified properties. + * Creates a new LocalInventory instance using the specified properties. * @param [properties] Properties to set - * @returns Promotion instance + * @returns LocalInventory instance */ - public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; + public static create(properties?: google.cloud.retail.v2.ILocalInventory): google.cloud.retail.v2.LocalInventory; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Promotion + * @returns LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.LocalInventory; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Promotion + * @returns LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.LocalInventory; /** - * Verifies a Promotion message. + * Verifies a LocalInventory message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Promotion + * @returns LocalInventory */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.LocalInventory; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. - * @param message Promotion + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @param message LocalInventory * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Promotion to JSON. + * Converts this LocalInventory to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -4490,6 +4514,96 @@ export namespace google { } } + /** Properties of a Promotion. */ + interface IPromotion { + + /** Promotion promotionId */ + promotionId?: (string|null); + } + + /** Represents a Promotion. */ + class Promotion implements IPromotion { + + /** + * Constructs a new Promotion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPromotion); + + /** Promotion promotionId. */ + public promotionId: string; + + /** + * Creates a new Promotion instance using the specified properties. + * @param [properties] Properties to set + * @returns Promotion instance + */ + public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; + + /** + * Verifies a Promotion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Promotion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Promotion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a UserEvent. */ interface IUserEvent { @@ -5535,6 +5649,34 @@ export namespace google { * @returns Promise */ public removeFulfillmentPlaces(request: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest): Promise; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addLocalInventories(request: google.cloud.retail.v2.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2.ProductService.AddLocalInventoriesCallback): void; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @returns Promise + */ + public addLocalInventories(request: google.cloud.retail.v2.IAddLocalInventoriesRequest): Promise; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeLocalInventories(request: google.cloud.retail.v2.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2.ProductService.RemoveLocalInventoriesCallback): void; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @returns Promise + */ + public removeLocalInventories(request: google.cloud.retail.v2.IRemoveLocalInventoriesRequest): Promise; } namespace ProductService { @@ -5601,6 +5743,20 @@ export namespace google { * @param [response] Operation */ type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#addLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#removeLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } /** Properties of a CreateProductRequest. */ @@ -6755,20189 +6911,25687 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a RemoveFulfillmentPlacesRequest. */ - interface IRemoveFulfillmentPlacesRequest { + /** Properties of an AddLocalInventoriesRequest. */ + interface IAddLocalInventoriesRequest { - /** RemoveFulfillmentPlacesRequest product */ + /** AddLocalInventoriesRequest product */ product?: (string|null); - /** RemoveFulfillmentPlacesRequest type */ - type?: (string|null); + /** AddLocalInventoriesRequest localInventories */ + localInventories?: (google.cloud.retail.v2.ILocalInventory[]|null); - /** RemoveFulfillmentPlacesRequest placeIds */ - placeIds?: (string[]|null); + /** AddLocalInventoriesRequest addMask */ + addMask?: (google.protobuf.IFieldMask|null); - /** RemoveFulfillmentPlacesRequest removeTime */ - removeTime?: (google.protobuf.ITimestamp|null); + /** AddLocalInventoriesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); - /** RemoveFulfillmentPlacesRequest allowMissing */ + /** AddLocalInventoriesRequest allowMissing */ allowMissing?: (boolean|null); } - /** Represents a RemoveFulfillmentPlacesRequest. */ - class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { + /** Represents an AddLocalInventoriesRequest. */ + class AddLocalInventoriesRequest implements IAddLocalInventoriesRequest { /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new AddLocalInventoriesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest); + constructor(properties?: google.cloud.retail.v2.IAddLocalInventoriesRequest); - /** RemoveFulfillmentPlacesRequest product. */ + /** AddLocalInventoriesRequest product. */ public product: string; - /** RemoveFulfillmentPlacesRequest type. */ - public type: string; + /** AddLocalInventoriesRequest localInventories. */ + public localInventories: google.cloud.retail.v2.ILocalInventory[]; - /** RemoveFulfillmentPlacesRequest placeIds. */ - public placeIds: string[]; + /** AddLocalInventoriesRequest addMask. */ + public addMask?: (google.protobuf.IFieldMask|null); - /** RemoveFulfillmentPlacesRequest removeTime. */ - public removeTime?: (google.protobuf.ITimestamp|null); + /** AddLocalInventoriesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); - /** RemoveFulfillmentPlacesRequest allowMissing. */ + /** AddLocalInventoriesRequest allowMissing. */ public allowMissing: boolean; /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new AddLocalInventoriesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns RemoveFulfillmentPlacesRequest instance + * @returns AddLocalInventoriesRequest instance */ - public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; + public static create(properties?: google.cloud.retail.v2.IAddLocalInventoriesRequest): google.cloud.retail.v2.AddLocalInventoriesRequest; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. - * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. - * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesRequest + * @returns AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddLocalInventoriesRequest; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesRequest + * @returns AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddLocalInventoriesRequest; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies an AddLocalInventoriesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RemoveFulfillmentPlacesRequest + * @returns AddLocalInventoriesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddLocalInventoriesRequest; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesRequest + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message AddLocalInventoriesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this AddLocalInventoriesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RemoveFulfillmentPlacesMetadata. */ - interface IRemoveFulfillmentPlacesMetadata { + /** Properties of an AddLocalInventoriesMetadata. */ + interface IAddLocalInventoriesMetadata { } - /** Represents a RemoveFulfillmentPlacesMetadata. */ - class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { + /** Represents an AddLocalInventoriesMetadata. */ + class AddLocalInventoriesMetadata implements IAddLocalInventoriesMetadata { /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new AddLocalInventoriesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata); + constructor(properties?: google.cloud.retail.v2.IAddLocalInventoriesMetadata); /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns RemoveFulfillmentPlacesMetadata instance + * @returns AddLocalInventoriesMetadata instance */ - public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; + public static create(properties?: google.cloud.retail.v2.IAddLocalInventoriesMetadata): google.cloud.retail.v2.AddLocalInventoriesMetadata; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. - * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. - * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesMetadata + * @returns AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddLocalInventoriesMetadata; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesMetadata + * @returns AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddLocalInventoriesMetadata; /** - * Verifies a RemoveFulfillmentPlacesMetadata message. + * Verifies an AddLocalInventoriesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RemoveFulfillmentPlacesMetadata + * @returns AddLocalInventoriesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddLocalInventoriesMetadata; /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesMetadata + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message AddLocalInventoriesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * Converts this AddLocalInventoriesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RemoveFulfillmentPlacesResponse. */ - interface IRemoveFulfillmentPlacesResponse { + /** Properties of an AddLocalInventoriesResponse. */ + interface IAddLocalInventoriesResponse { } - /** Represents a RemoveFulfillmentPlacesResponse. */ - class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { + /** Represents an AddLocalInventoriesResponse. */ + class AddLocalInventoriesResponse implements IAddLocalInventoriesResponse { /** - * Constructs a new RemoveFulfillmentPlacesResponse. + * Constructs a new AddLocalInventoriesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse); + constructor(properties?: google.cloud.retail.v2.IAddLocalInventoriesResponse); /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * Creates a new AddLocalInventoriesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns RemoveFulfillmentPlacesResponse instance + * @returns AddLocalInventoriesResponse instance */ - public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; + public static create(properties?: google.cloud.retail.v2.IAddLocalInventoriesResponse): google.cloud.retail.v2.AddLocalInventoriesResponse; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesResponse + * @returns AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddLocalInventoriesResponse; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesResponse + * @returns AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddLocalInventoriesResponse; /** - * Verifies a RemoveFulfillmentPlacesResponse message. + * Verifies an AddLocalInventoriesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RemoveFulfillmentPlacesResponse + * @returns AddLocalInventoriesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddLocalInventoriesResponse; /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesResponse + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message AddLocalInventoriesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. + * Converts this AddLocalInventoriesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { + /** Properties of a RemoveLocalInventoriesRequest. */ + interface IRemoveLocalInventoriesRequest { + + /** RemoveLocalInventoriesRequest product */ + product?: (string|null); + + /** RemoveLocalInventoriesRequest placeIds */ + placeIds?: (string[]|null); + + /** RemoveLocalInventoriesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { + /** Represents a RemoveLocalInventoriesRequest. */ + class RemoveLocalInventoriesRequest implements IRemoveLocalInventoriesRequest { /** - * Constructs a new PurgeMetadata. + * Constructs a new RemoveLocalInventoriesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); + constructor(properties?: google.cloud.retail.v2.IRemoveLocalInventoriesRequest); + + /** RemoveLocalInventoriesRequest product. */ + public product: string; + + /** RemoveLocalInventoriesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveLocalInventoriesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeMetadata instance + * @returns RemoveLocalInventoriesRequest instance */ - public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; + public static create(properties?: google.cloud.retail.v2.IRemoveLocalInventoriesRequest): google.cloud.retail.v2.RemoveLocalInventoriesRequest; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeMetadata + * @returns RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveLocalInventoriesRequest; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeMetadata + * @returns RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveLocalInventoriesRequest; /** - * Verifies a PurgeMetadata message. + * Verifies a RemoveLocalInventoriesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeMetadata + * @returns RemoveLocalInventoriesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveLocalInventoriesRequest; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeMetadata to JSON. + * Converts this RemoveLocalInventoriesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { - - /** PurgeUserEventsRequest parent */ - parent?: (string|null); - - /** PurgeUserEventsRequest filter */ - filter?: (string|null); - - /** PurgeUserEventsRequest force */ - force?: (boolean|null); + /** Properties of a RemoveLocalInventoriesMetadata. */ + interface IRemoveLocalInventoriesMetadata { } - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + /** Represents a RemoveLocalInventoriesMetadata. */ + class RemoveLocalInventoriesMetadata implements IRemoveLocalInventoriesMetadata { /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new RemoveLocalInventoriesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); - - /** PurgeUserEventsRequest parent. */ - public parent: string; - - /** PurgeUserEventsRequest filter. */ - public filter: string; - - /** PurgeUserEventsRequest force. */ - public force: boolean; + constructor(properties?: google.cloud.retail.v2.IRemoveLocalInventoriesMetadata); /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance + * @returns RemoveLocalInventoriesMetadata instance */ - public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; + public static create(properties?: google.cloud.retail.v2.IRemoveLocalInventoriesMetadata): google.cloud.retail.v2.RemoveLocalInventoriesMetadata; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest + * @returns RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveLocalInventoriesMetadata; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest + * @returns RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveLocalInventoriesMetadata; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a RemoveLocalInventoriesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsRequest + * @returns RemoveLocalInventoriesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveLocalInventoriesMetadata; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this RemoveLocalInventoriesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { - - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); + /** Properties of a RemoveLocalInventoriesResponse. */ + interface IRemoveLocalInventoriesResponse { } - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** Represents a RemoveLocalInventoriesResponse. */ + class RemoveLocalInventoriesResponse implements IRemoveLocalInventoriesResponse { /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new RemoveLocalInventoriesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); - - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + constructor(properties?: google.cloud.retail.v2.IRemoveLocalInventoriesResponse); /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance + * @returns RemoveLocalInventoriesResponse instance */ - public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; + public static create(properties?: google.cloud.retail.v2.IRemoveLocalInventoriesResponse): google.cloud.retail.v2.RemoveLocalInventoriesResponse; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse + * @returns RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveLocalInventoriesResponse; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse + * @returns RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveLocalInventoriesResponse; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a RemoveLocalInventoriesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsResponse + * @returns RemoveLocalInventoriesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveLocalInventoriesResponse; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this RemoveLocalInventoriesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a SearchService */ - class SearchService extends $protobuf.rpc.Service { - - /** - * Constructs a new SearchService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SearchService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; - - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SearchResponse - */ - public search(request: google.cloud.retail.v2.ISearchRequest, callback: google.cloud.retail.v2.SearchService.SearchCallback): void; - - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @returns Promise - */ - public search(request: google.cloud.retail.v2.ISearchRequest): Promise; - } - - namespace SearchService { - - /** - * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. - * @param error Error, if any - * @param [response] SearchResponse - */ - type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2.SearchResponse) => void; - } - - /** Properties of a SearchRequest. */ - interface ISearchRequest { - - /** SearchRequest placement */ - placement?: (string|null); - - /** SearchRequest branch */ - branch?: (string|null); - - /** SearchRequest query */ - query?: (string|null); - - /** SearchRequest visitorId */ - visitorId?: (string|null); - - /** SearchRequest userInfo */ - userInfo?: (google.cloud.retail.v2.IUserInfo|null); - - /** SearchRequest pageSize */ - pageSize?: (number|null); - - /** SearchRequest pageToken */ - pageToken?: (string|null); - - /** SearchRequest offset */ - offset?: (number|null); - - /** SearchRequest filter */ - filter?: (string|null); - - /** SearchRequest canonicalFilter */ - canonicalFilter?: (string|null); - - /** SearchRequest orderBy */ - orderBy?: (string|null); - - /** SearchRequest facetSpecs */ - facetSpecs?: (google.cloud.retail.v2.SearchRequest.IFacetSpec[]|null); - - /** SearchRequest dynamicFacetSpec */ - dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + /** Properties of a RemoveFulfillmentPlacesRequest. */ + interface IRemoveFulfillmentPlacesRequest { - /** SearchRequest boostSpec */ - boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + /** RemoveFulfillmentPlacesRequest product */ + product?: (string|null); - /** SearchRequest queryExpansionSpec */ - queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + /** RemoveFulfillmentPlacesRequest type */ + type?: (string|null); - /** SearchRequest variantRollupKeys */ - variantRollupKeys?: (string[]|null); + /** RemoveFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); - /** SearchRequest pageCategories */ - pageCategories?: (string[]|null); + /** RemoveFulfillmentPlacesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); - /** SearchRequest searchMode */ - searchMode?: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode|null); + /** RemoveFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a SearchRequest. */ - class SearchRequest implements ISearchRequest { + /** Represents a RemoveFulfillmentPlacesRequest. */ + class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { /** - * Constructs a new SearchRequest. + * Constructs a new RemoveFulfillmentPlacesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ISearchRequest); - - /** SearchRequest placement. */ - public placement: string; - - /** SearchRequest branch. */ - public branch: string; - - /** SearchRequest query. */ - public query: string; - - /** SearchRequest visitorId. */ - public visitorId: string; - - /** SearchRequest userInfo. */ - public userInfo?: (google.cloud.retail.v2.IUserInfo|null); - - /** SearchRequest pageSize. */ - public pageSize: number; - - /** SearchRequest pageToken. */ - public pageToken: string; - - /** SearchRequest offset. */ - public offset: number; - - /** SearchRequest filter. */ - public filter: string; - - /** SearchRequest canonicalFilter. */ - public canonicalFilter: string; - - /** SearchRequest orderBy. */ - public orderBy: string; - - /** SearchRequest facetSpecs. */ - public facetSpecs: google.cloud.retail.v2.SearchRequest.IFacetSpec[]; - - /** SearchRequest dynamicFacetSpec. */ - public dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest); - /** SearchRequest boostSpec. */ - public boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + /** RemoveFulfillmentPlacesRequest product. */ + public product: string; - /** SearchRequest queryExpansionSpec. */ - public queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + /** RemoveFulfillmentPlacesRequest type. */ + public type: string; - /** SearchRequest variantRollupKeys. */ - public variantRollupKeys: string[]; + /** RemoveFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; - /** SearchRequest pageCategories. */ - public pageCategories: string[]; + /** RemoveFulfillmentPlacesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); - /** SearchRequest searchMode. */ - public searchMode: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode); + /** RemoveFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns SearchRequest instance + * @returns RemoveFulfillmentPlacesRequest instance */ - public static create(properties?: google.cloud.retail.v2.ISearchRequest): google.cloud.retail.v2.SearchRequest; + public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchRequest + * @returns RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchRequest + * @returns RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Verifies a SearchRequest message. + * Verifies a RemoveFulfillmentPlacesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchRequest + * @returns RemoveFulfillmentPlacesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesRequest; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. - * @param message SearchRequest + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchRequest to JSON. + * Converts this RemoveFulfillmentPlacesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchRequest { - - /** Properties of a FacetSpec. */ - interface IFacetSpec { - - /** FacetSpec facetKey */ - facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); + /** Properties of a RemoveFulfillmentPlacesMetadata. */ + interface IRemoveFulfillmentPlacesMetadata { + } - /** FacetSpec limit */ - limit?: (number|null); + /** Represents a RemoveFulfillmentPlacesMetadata. */ + class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { - /** FacetSpec excludedFilterKeys */ - excludedFilterKeys?: (string[]|null); + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata); - /** FacetSpec enableDynamicPosition */ - enableDynamicPosition?: (boolean|null); - } + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; - /** Represents a FacetSpec. */ - class FacetSpec implements IFacetSpec { + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new FacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec); + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** FacetSpec facetKey. */ - public facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; - /** FacetSpec limit. */ - public limit: number; + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; - /** FacetSpec excludedFilterKeys. */ - public excludedFilterKeys: string[]; + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** FacetSpec enableDynamicPosition. */ - public enableDynamicPosition: boolean; + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata; - /** - * Creates a new FacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetSpec instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec): google.cloud.retail.v2.SearchRequest.FacetSpec; + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of a RemoveFulfillmentPlacesResponse. */ + interface IRemoveFulfillmentPlacesResponse { + } - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec; + /** Represents a RemoveFulfillmentPlacesResponse. */ + class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec; + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse); - /** - * Verifies a FacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec; + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @param message FacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this FacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; - namespace FacetSpec { + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; - /** Properties of a FacetKey. */ - interface IFacetKey { + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** FacetKey key */ - key?: (string|null); + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveFulfillmentPlacesResponse; - /** FacetKey intervals */ - intervals?: (google.cloud.retail.v2.IInterval[]|null); + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** FacetKey restrictedValues */ - restrictedValues?: (string[]|null); + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** FacetKey prefixes */ - prefixes?: (string[]|null); + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } - /** FacetKey contains */ - contains?: (string[]|null); + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { - /** FacetKey orderBy */ - orderBy?: (string|null); + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); - /** FacetKey query */ - query?: (string|null); - } + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; - /** Represents a FacetKey. */ - class FacetKey implements IFacetKey { + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new FacetKey. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey); + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** FacetKey key. */ - public key: string; + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; - /** FacetKey intervals. */ - public intervals: google.cloud.retail.v2.IInterval[]; + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; - /** FacetKey restrictedValues. */ - public restrictedValues: string[]; + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** FacetKey prefixes. */ - public prefixes: string[]; + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; - /** FacetKey contains. */ - public contains: string[]; + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** FacetKey orderBy. */ - public orderBy: string; + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** FacetKey query. */ - public query: string; + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { - /** - * Creates a new FacetKey instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetKey instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** PurgeUserEventsRequest parent */ + parent?: (string|null); - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** PurgeUserEventsRequest filter */ + filter?: (string|null); - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); - /** - * Verifies a FacetKey message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** PurgeUserEventsRequest parent. */ + public parent: string; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetKey - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** PurgeUserEventsRequest filter. */ + public filter: string; - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @param message FacetKey - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** PurgeUserEventsRequest force. */ + public force: boolean; - /** - * Converts this FacetKey to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; - /** Properties of a DynamicFacetSpec. */ - interface IDynamicFacetSpec { + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** DynamicFacetSpec mode */ - mode?: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null); - } + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a DynamicFacetSpec. */ - class DynamicFacetSpec implements IDynamicFacetSpec { + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; - /** - * Constructs a new DynamicFacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec); + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; - /** DynamicFacetSpec mode. */ - public mode: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode); + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns DynamicFacetSpec instance - */ + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { + + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2.ISearchRequest, callback: google.cloud.retail.v2.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2.ISearchRequest): Promise; + } + + namespace SearchService { + + /** + * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse + */ + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2.SearchResponse) => void; + } + + /** Properties of a SearchRequest. */ + interface ISearchRequest { + + /** SearchRequest placement */ + placement?: (string|null); + + /** SearchRequest branch */ + branch?: (string|null); + + /** SearchRequest query */ + query?: (string|null); + + /** SearchRequest visitorId */ + visitorId?: (string|null); + + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** SearchRequest pageSize */ + pageSize?: (number|null); + + /** SearchRequest pageToken */ + pageToken?: (string|null); + + /** SearchRequest offset */ + offset?: (number|null); + + /** SearchRequest filter */ + filter?: (string|null); + + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); + + /** SearchRequest orderBy */ + orderBy?: (string|null); + + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2.SearchRequest.IFacetSpec[]|null); + + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode|null); + + /** SearchRequest personalizationSpec */ + personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + } + + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { + + /** + * Constructs a new SearchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ISearchRequest); + + /** SearchRequest placement. */ + public placement: string; + + /** SearchRequest branch. */ + public branch: string; + + /** SearchRequest query. */ + public query: string; + + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; + + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; + + /** SearchRequest orderBy. */ + public orderBy: string; + + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2.SearchRequest.IFacetSpec[]; + + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; + + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode); + + /** SearchRequest personalizationSpec. */ + public personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** + * Creates a new SearchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchRequest instance + */ + public static create(properties?: google.cloud.retail.v2.ISearchRequest): google.cloud.retail.v2.SearchRequest; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest; + + /** + * Verifies a SearchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SearchRequest { + + /** Properties of a FacetSpec. */ + interface IFacetSpec { + + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit */ + limit?: (number|null); + + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); + + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } + + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { + + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec); + + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit. */ + public limit: number; + + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; + + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec): google.cloud.retail.v2.SearchRequest.FacetSpec; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec; + + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FacetSpec { + + /** Properties of a FacetKey. */ + interface IFacetKey { + + /** FacetKey key */ + key?: (string|null); + + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2.IInterval[]|null); + + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2.IInterval[]; + + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; + + /** FacetKey prefixes. */ + public prefixes: string[]; + + /** FacetKey contains. */ + public contains: string[]; + + /** FacetKey orderBy. */ + public orderBy: string; + + /** FacetKey query. */ + public query: string; + + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { + + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null); + } + + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { + + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec); + + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode); + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ public static create(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DynamicFacetSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } + + /** Properties of a BoostSpec. */ + interface IBoostSpec { + + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + + /** BoostSpec skipBoostSpecValidation */ + skipBoostSpecValidation?: (boolean|null); + } + + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { + + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec); + + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; + + /** BoostSpec skipBoostSpecValidation. */ + public skipBoostSpecValidation?: (boolean|null); + + /** BoostSpec _skipBoostSpecValidation. */ + public _skipBoostSpecValidation?: "skipBoostSpecValidation"; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec; + + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BoostSpec { + + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { + + /** ConditionBoostSpec condition */ + condition?: (string|null); + + /** ConditionBoostSpec boost */ + boost?: (number|null); + } + + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { + + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec); + + /** ConditionBoostSpec condition. */ + public condition: string; + + /** ConditionBoostSpec boost. */ + public boost: number; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { + + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null); + + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); + } + + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { + + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec); + + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition); + + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace QueryExpansionSpec { + + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } + + /** Properties of a PersonalizationSpec. */ + interface IPersonalizationSpec { + + /** PersonalizationSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|null); + } + + /** Represents a PersonalizationSpec. */ + class PersonalizationSpec implements IPersonalizationSpec { + + /** + * Constructs a new PersonalizationSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec); + + /** PersonalizationSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode); + + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns PersonalizationSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + + /** + * Verifies a PersonalizationSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PersonalizationSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @param message PersonalizationSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.PersonalizationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PersonalizationSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PersonalizationSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + AUTO = 1, + DISABLED = 2 + } + } + + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } + } + + /** Properties of a SearchResponse. */ + interface ISearchResponse { + + /** SearchResponse results */ + results?: (google.cloud.retail.v2.SearchResponse.ISearchResult[]|null); + + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2.SearchResponse.IFacet[]|null); + + /** SearchResponse totalSize */ + totalSize?: (number|null); + + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); + + /** SearchResponse attributionToken */ + attributionToken?: (string|null); + + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); + + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri */ + redirectUri?: (string|null); + + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); + + /** SearchResponse invalidConditionBoostSpecs */ + invalidConditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } + + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { + + /** + * Constructs a new SearchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ISearchResponse); + + /** SearchResponse results. */ + public results: google.cloud.retail.v2.SearchResponse.ISearchResult[]; + + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2.SearchResponse.IFacet[]; + + /** SearchResponse totalSize. */ + public totalSize: number; + + /** SearchResponse correctedQuery. */ + public correctedQuery: string; + + /** SearchResponse attributionToken. */ + public attributionToken: string; + + /** SearchResponse nextPageToken. */ + public nextPageToken: string; + + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri. */ + public redirectUri: string; + + /** SearchResponse appliedControls. */ + public appliedControls: string[]; + + /** SearchResponse invalidConditionBoostSpecs. */ + public invalidConditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; + + /** + * Creates a new SearchResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResponse instance + */ + public static create(properties?: google.cloud.retail.v2.ISearchResponse): google.cloud.retail.v2.SearchResponse; + + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse; + + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse; + + /** + * Verifies a SearchResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SearchResponse { + + /** Properties of a SearchResult. */ + interface ISearchResult { + + /** SearchResult id */ + id?: (string|null); + + /** SearchResult product */ + product?: (google.cloud.retail.v2.IProduct|null); + + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); + + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { + + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult); + + /** SearchResult id. */ + public id: string; + + /** SearchResult product. */ + public product?: (google.cloud.retail.v2.IProduct|null); + + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; + + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult): google.cloud.retail.v2.SearchResponse.SearchResult; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.SearchResult; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.SearchResult; + + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.SearchResult; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Facet. */ + interface IFacet { + + /** Facet key */ + key?: (string|null); + + /** Facet values */ + values?: (google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]|null); + + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } + + /** Represents a Facet. */ + class Facet implements IFacet { + + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.IFacet); + + /** Facet key. */ + public key: string; + + /** Facet values. */ + public values: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]; + + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; + + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.IFacet): google.cloud.retail.v2.SearchResponse.Facet; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet; + + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Facet { + + /** Properties of a FacetValue. */ + interface IFacetValue { + + /** FacetValue value */ + value?: (string|null); + + /** FacetValue interval */ + interval?: (google.cloud.retail.v2.IInterval|null); + + /** FacetValue count */ + count?: (number|Long|string|null); + } + + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { + + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue); + + /** FacetValue value. */ + public value?: (string|null); + + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2.IInterval|null); + + /** FacetValue count. */ + public count: (number|Long|string); + + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); + + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { + + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); + + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); + } + + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { + + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo); + + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; + + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { + + /** + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent + */ + public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest, callback: google.cloud.retail.v2.UserEventService.WriteUserEventCallback): void; + + /** + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise + */ + public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest): Promise; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody + */ + public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest, callback: google.cloud.retail.v2.UserEventService.CollectUserEventCallback): void; + + /** + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise + */ + public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest): Promise; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback): void; + + /** + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise + */ + public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest): Promise; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.ImportUserEventsCallback): void; + + /** + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise + */ + public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest): Promise; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback): void; + + /** + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise + */ + public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest): Promise; + } + + namespace UserEventService { + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent + */ + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2.UserEvent) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody + */ + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation + */ + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { + + /** WriteUserEventRequest parent */ + parent?: (string|null); + + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2.IUserEvent|null); + } + + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { + + /** + * Constructs a new WriteUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IWriteUserEventRequest); + + /** WriteUserEventRequest parent. */ + public parent: string; + + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IWriteUserEventRequest): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Verifies a WriteUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.WriteUserEventRequest; + + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WriteUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { + + /** CollectUserEventRequest parent */ + parent?: (string|null); + + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); + } + + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { + + /** + * Constructs a new CollectUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICollectUserEventRequest); + + /** CollectUserEventRequest parent. */ + public parent: string; + + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2.ICollectUserEventRequest): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Verifies a CollectUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectUserEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CollectUserEventRequest; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectUserEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { + + /** RejoinUserEventsRequest parent */ + parent?: (string|null); + + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null); + } + + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + + /** + * Constructs a new RejoinUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest); + + /** RejoinUserEventsRequest parent. */ + public parent: string; + + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope); + + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Verifies a RejoinUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsRequest; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace RejoinUserEventsRequest { + + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + + /** + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); + + /** + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsResponse; + + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { + } + + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + + /** + * Constructs a new RejoinUserEventsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata); + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Verifies a RejoinUserEventsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsMetadata; + + /** + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RejoinUserEventsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace v2alpha. */ + namespace v2alpha { + + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { + + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); + } + + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { + + /** + * Constructs a new ProductLevelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductLevelConfig); + + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; + + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductLevelConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductLevelConfig): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Verifies a ProductLevelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductLevelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductLevelConfig; + + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductLevelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MerchantCenterLink. */ + interface IMerchantCenterLink { + + /** MerchantCenterLink merchantCenterAccountId */ + merchantCenterAccountId?: (number|Long|string|null); + + /** MerchantCenterLink branchId */ + branchId?: (string|null); + + /** MerchantCenterLink destinations */ + destinations?: (string[]|null); + + /** MerchantCenterLink regionCode */ + regionCode?: (string|null); + + /** MerchantCenterLink languageCode */ + languageCode?: (string|null); + } + + /** Represents a MerchantCenterLink. */ + class MerchantCenterLink implements IMerchantCenterLink { + + /** + * Constructs a new MerchantCenterLink. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink); + + /** MerchantCenterLink merchantCenterAccountId. */ + public merchantCenterAccountId: (number|Long|string); + + /** MerchantCenterLink branchId. */ + public branchId: string; + + /** MerchantCenterLink destinations. */ + public destinations: string[]; + + /** MerchantCenterLink regionCode. */ + public regionCode: string; + + /** MerchantCenterLink languageCode. */ + public languageCode: string; + + /** + * Creates a new MerchantCenterLink instance using the specified properties. + * @param [properties] Properties to set + * @returns MerchantCenterLink instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink): google.cloud.retail.v2alpha.MerchantCenterLink; + + /** + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MerchantCenterLink message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MerchantCenterLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLink; + + /** + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MerchantCenterLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLink; + + /** + * Verifies a MerchantCenterLink message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MerchantCenterLink + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLink; + + /** + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. + * @param message MerchantCenterLink + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MerchantCenterLink to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MerchantCenterLinkingConfig. */ + interface IMerchantCenterLinkingConfig { + + /** MerchantCenterLinkingConfig links */ + links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); + } + + /** Represents a MerchantCenterLinkingConfig. */ + class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { + + /** + * Constructs a new MerchantCenterLinkingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); + + /** MerchantCenterLinkingConfig links. */ + public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; + + /** + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MerchantCenterLinkingConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Verifies a MerchantCenterLinkingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MerchantCenterLinkingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + + /** + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @param message MerchantCenterLinkingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MerchantCenterLinkingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig */ + merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + } + + /** Represents a Catalog. */ + class Catalog implements ICatalog { + + /** + * Constructs a new Catalog. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig. */ + public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + + /** + * Creates a new Catalog instance using the specified properties. + * @param [properties] Properties to set + * @returns Catalog instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Catalog message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + + /** + * Verifies a Catalog message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Catalog + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Catalog to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** SolutionType enum. */ + enum SolutionType { + SOLUTION_TYPE_UNSPECIFIED = 0, + SOLUTION_TYPE_RECOMMENDATION = 1, + SOLUTION_TYPE_SEARCH = 2 + } + + /** Properties of a Condition. */ + interface ICondition { + + /** Condition queryTerms */ + queryTerms?: (google.cloud.retail.v2alpha.Condition.IQueryTerm[]|null); + + /** Condition activeTimeRange */ + activeTimeRange?: (google.cloud.retail.v2alpha.Condition.ITimeRange[]|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { + + /** + * Constructs a new Condition. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICondition); + + /** Condition queryTerms. */ + public queryTerms: google.cloud.retail.v2alpha.Condition.IQueryTerm[]; + + /** Condition activeTimeRange. */ + public activeTimeRange: google.cloud.retail.v2alpha.Condition.ITimeRange[]; + + /** + * Creates a new Condition instance using the specified properties. + * @param [properties] Properties to set + * @returns Condition instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICondition): google.cloud.retail.v2alpha.Condition; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition; + + /** + * Verifies a Condition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Condition + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Condition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Condition { + + /** Properties of a QueryTerm. */ + interface IQueryTerm { + + /** QueryTerm value */ + value?: (string|null); + + /** QueryTerm fullMatch */ + fullMatch?: (boolean|null); + } + + /** Represents a QueryTerm. */ + class QueryTerm implements IQueryTerm { + + /** + * Constructs a new QueryTerm. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm); + + /** QueryTerm value. */ + public value: string; + + /** QueryTerm fullMatch. */ + public fullMatch: boolean; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTerm instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Verifies a QueryTerm message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTerm + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.QueryTerm; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @param message QueryTerm + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTerm to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TimeRange. */ + interface ITimeRange { + + /** TimeRange startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TimeRange. */ + class TimeRange implements ITimeRange { + + /** + * Constructs a new TimeRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange); + + /** TimeRange startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TimeRange instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeRange instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Verifies a TimeRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.TimeRange; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @param message TimeRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Rule. */ + interface IRule { + + /** Rule boostAction */ + boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + + /** Rule redirectAction */ + redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction */ + onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction */ + doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction */ + replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + + /** Rule ignoreAction */ + ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + + /** Rule filterAction */ + filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction */ + twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + + /** Rule condition */ + condition?: (google.cloud.retail.v2alpha.ICondition|null); + } + + /** Represents a Rule. */ + class Rule implements IRule { + + /** + * Constructs a new Rule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRule); + + /** Rule boostAction. */ + public boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + + /** Rule redirectAction. */ + public redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction. */ + public onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction. */ + public doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction. */ + public replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + + /** Rule ignoreAction. */ + public ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + + /** Rule filterAction. */ + public filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction. */ + public twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + + /** Rule condition. */ + public condition?: (google.cloud.retail.v2alpha.ICondition|null); + + /** Rule action. */ + public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + + /** + * Creates a new Rule instance using the specified properties. + * @param [properties] Properties to set + * @returns Rule instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRule): google.cloud.retail.v2alpha.Rule; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule; + + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule; + + /** + * Verifies a Rule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @param message Rule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Rule { + + /** Properties of a BoostAction. */ + interface IBoostAction { + + /** BoostAction boost */ + boost?: (number|null); + + /** BoostAction productsFilter */ + productsFilter?: (string|null); + } + + /** Represents a BoostAction. */ + class BoostAction implements IBoostAction { + + /** + * Constructs a new BoostAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction); + + /** BoostAction boost. */ + public boost: number; + + /** BoostAction productsFilter. */ + public productsFilter: string; + + /** + * Creates a new BoostAction instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Verifies a BoostAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.BoostAction; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @param message BoostAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FilterAction. */ + interface IFilterAction { + + /** FilterAction filter */ + filter?: (string|null); + } + + /** Represents a FilterAction. */ + class FilterAction implements IFilterAction { + + /** + * Constructs a new FilterAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction); + + /** FilterAction filter. */ + public filter: string; + + /** + * Creates a new FilterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns FilterAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Verifies a FilterAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FilterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @param message FilterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FilterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RedirectAction. */ + interface IRedirectAction { + + /** RedirectAction redirectUri */ + redirectUri?: (string|null); + } + + /** Represents a RedirectAction. */ + class RedirectAction implements IRedirectAction { + + /** + * Constructs a new RedirectAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction); + + /** RedirectAction redirectUri. */ + public redirectUri: string; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RedirectAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Verifies a RedirectAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RedirectAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @param message RedirectAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RedirectAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TwowaySynonymsAction. */ + interface ITwowaySynonymsAction { + + /** TwowaySynonymsAction synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a TwowaySynonymsAction. */ + class TwowaySynonymsAction implements ITwowaySynonymsAction { + + /** + * Constructs a new TwowaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction); + + /** TwowaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns TwowaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Verifies a TwowaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TwowaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @param message TwowaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TwowaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OnewaySynonymsAction. */ + interface IOnewaySynonymsAction { + + /** OnewaySynonymsAction queryTerms */ + queryTerms?: (string[]|null); + + /** OnewaySynonymsAction synonyms */ + synonyms?: (string[]|null); + + /** OnewaySynonymsAction onewayTerms */ + onewayTerms?: (string[]|null); + } + + /** Represents an OnewaySynonymsAction. */ + class OnewaySynonymsAction implements IOnewaySynonymsAction { + + /** + * Constructs a new OnewaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction); + + /** OnewaySynonymsAction queryTerms. */ + public queryTerms: string[]; + + /** OnewaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** OnewaySynonymsAction onewayTerms. */ + public onewayTerms: string[]; + + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OnewaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Verifies an OnewaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnewaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @param message OnewaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DoNotAssociateAction. */ + interface IDoNotAssociateAction { + + /** DoNotAssociateAction queryTerms */ + queryTerms?: (string[]|null); + + /** DoNotAssociateAction doNotAssociateTerms */ + doNotAssociateTerms?: (string[]|null); + + /** DoNotAssociateAction terms */ + terms?: (string[]|null); + } + + /** Represents a DoNotAssociateAction. */ + class DoNotAssociateAction implements IDoNotAssociateAction { + + /** + * Constructs a new DoNotAssociateAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction); + + /** DoNotAssociateAction queryTerms. */ + public queryTerms: string[]; + + /** DoNotAssociateAction doNotAssociateTerms. */ + public doNotAssociateTerms: string[]; + + /** DoNotAssociateAction terms. */ + public terms: string[]; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DoNotAssociateAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Verifies a DoNotAssociateAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoNotAssociateAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @param message DoNotAssociateAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReplacementAction. */ + interface IReplacementAction { + + /** ReplacementAction queryTerms */ + queryTerms?: (string[]|null); + + /** ReplacementAction replacementTerm */ + replacementTerm?: (string|null); + + /** ReplacementAction term */ + term?: (string|null); + } + + /** Represents a ReplacementAction. */ + class ReplacementAction implements IReplacementAction { + + /** + * Constructs a new ReplacementAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IReplacementAction); + + /** ReplacementAction queryTerms. */ + public queryTerms: string[]; + + /** ReplacementAction replacementTerm. */ + public replacementTerm: string; + + /** ReplacementAction term. */ + public term: string; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplacementAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IReplacementAction): google.cloud.retail.v2alpha.Rule.ReplacementAction; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.ReplacementAction; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.ReplacementAction; + + /** + * Verifies a ReplacementAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplacementAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.ReplacementAction; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @param message ReplacementAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplacementAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an IgnoreAction. */ + interface IIgnoreAction { + + /** IgnoreAction ignoreTerms */ + ignoreTerms?: (string[]|null); + } + + /** Represents an IgnoreAction. */ + class IgnoreAction implements IIgnoreAction { + + /** + * Constructs a new IgnoreAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IIgnoreAction); + + /** IgnoreAction ignoreTerms. */ + public ignoreTerms: string[]; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @param [properties] Properties to set + * @returns IgnoreAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IIgnoreAction): google.cloud.retail.v2alpha.Rule.IgnoreAction; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.IgnoreAction; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.IgnoreAction; + + /** + * Verifies an IgnoreAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IgnoreAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.IgnoreAction; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @param message IgnoreAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IgnoreAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Audience. */ + interface IAudience { + + /** Audience genders */ + genders?: (string[]|null); + + /** Audience ageGroups */ + ageGroups?: (string[]|null); + } + + /** Represents an Audience. */ + class Audience implements IAudience { + + /** + * Constructs a new Audience. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAudience); + + /** Audience genders. */ + public genders: string[]; + + /** Audience ageGroups. */ + public ageGroups: string[]; + + /** + * Creates a new Audience instance using the specified properties. + * @param [properties] Properties to set + * @returns Audience instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAudience): google.cloud.retail.v2alpha.Audience; + + /** + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Audience message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Audience; + + /** + * Decodes an Audience message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Audience; + + /** + * Verifies an Audience message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Audience + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Audience; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Audience to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ColorInfo. */ + interface IColorInfo { + + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); + + /** ColorInfo colors */ + colors?: (string[]|null); + } + + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { + + /** + * Constructs a new ColorInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IColorInfo); + + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; + + /** ColorInfo colors. */ + public colors: string[]; + + /** + * Creates a new ColorInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ColorInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IColorInfo): google.cloud.retail.v2alpha.ColorInfo; + + /** + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ColorInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ColorInfo; + + /** + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ColorInfo; + + /** + * Verifies a ColorInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ColorInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ColorInfo; + + /** + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ColorInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + + /** CustomAttribute searchable */ + searchable?: (boolean|null); + + /** CustomAttribute indexable */ + indexable?: (boolean|null); + } + + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { + + /** + * Constructs a new CustomAttribute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); + + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomAttribute instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICustomAttribute): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Verifies a CustomAttribute message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomAttribute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CustomAttribute; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomAttribute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { + + /** FulfillmentInfo type */ + type?: (string|null); + + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); + } + + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { + + /** + * Constructs a new FulfillmentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IFulfillmentInfo); + + /** FulfillmentInfo type. */ + public type: string; + + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillmentInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IFulfillmentInfo): google.cloud.retail.v2alpha.FulfillmentInfo; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.FulfillmentInfo; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.FulfillmentInfo; + + /** + * Verifies a FulfillmentInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillmentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.FulfillmentInfo; + + /** + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillmentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image uri */ + uri?: (string|null); + + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IImage); + + /** Image uri. */ + public uri: string; + + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IImage): google.cloud.retail.v2alpha.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Image message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Image; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Image; + + /** + * Verifies an Image message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Image + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Image; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Interval. */ + interface IInterval { - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** Interval minimum */ + minimum?: (number|null); - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + /** Interval maximum */ + maximum?: (number|null); - /** - * Verifies a DynamicFacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); + } - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DynamicFacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IInterval); + + /** Interval minimum. */ + public minimum?: (number|null); + + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); + + /** Interval maximum. */ + public maximum?: (number|null); + + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); + + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); + + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); + + /** + * Creates a new Interval instance using the specified properties. + * @param [properties] Properties to set + * @returns Interval instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IInterval): google.cloud.retail.v2alpha.Interval; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Interval; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Interval; + + /** + * Verifies an Interval message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Interval + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Interval; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Interval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PriceInfo. */ + interface IPriceInfo { + + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { + + /** + * Constructs a new PriceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null); + + /** + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPriceInfo): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo; + + /** + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo; - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @param message DynamicFacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this DynamicFacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - namespace DynamicFacetSpec { + namespace PriceInfo { - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - DISABLED = 1, - ENABLED = 2 - } - } + /** Properties of a PriceRange. */ + interface IPriceRange { - /** Properties of a BoostSpec. */ - interface IBoostSpec { + /** PriceRange price */ + price?: (google.cloud.retail.v2alpha.IInterval|null); - /** BoostSpec conditionBoostSpecs */ - conditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2alpha.IInterval|null); } - /** Represents a BoostSpec. */ - class BoostSpec implements IBoostSpec { + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { /** - * Constructs a new BoostSpec. + * Constructs a new PriceRange. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec); + constructor(properties?: google.cloud.retail.v2alpha.PriceInfo.IPriceRange); - /** BoostSpec conditionBoostSpecs. */ - public conditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; + /** PriceRange price. */ + public price?: (google.cloud.retail.v2alpha.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2alpha.IInterval|null); /** - * Creates a new BoostSpec instance using the specified properties. + * Creates a new PriceRange instance using the specified properties. * @param [properties] Properties to set - * @returns BoostSpec instance + * @returns PriceRange instance */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static create(properties?: google.cloud.retail.v2alpha.PriceInfo.IPriceRange): google.cloud.retail.v2alpha.PriceInfo.PriceRange; /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BoostSpec message from the specified reader or buffer. + * Decodes a PriceRange message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BoostSpec + * @returns PriceRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo.PriceRange; /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * Decodes a PriceRange message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BoostSpec + * @returns PriceRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo.PriceRange; /** - * Verifies a BoostSpec message. + * Verifies a PriceRange message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BoostSpec + * @returns PriceRange */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo.PriceRange; /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @param message BoostSpec + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BoostSpec to JSON. + * Converts this PriceRange to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - namespace BoostSpec { + /** Properties of a Rating. */ + interface IRating { - /** Properties of a ConditionBoostSpec. */ - interface IConditionBoostSpec { + /** Rating ratingCount */ + ratingCount?: (number|null); - /** ConditionBoostSpec condition */ - condition?: (string|null); + /** Rating averageRating */ + averageRating?: (number|null); - /** ConditionBoostSpec boost */ - boost?: (number|null); - } + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } - /** Represents a ConditionBoostSpec. */ - class ConditionBoostSpec implements IConditionBoostSpec { + /** Represents a Rating. */ + class Rating implements IRating { - /** - * Constructs a new ConditionBoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec); + /** + * Constructs a new Rating. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRating); - /** ConditionBoostSpec condition. */ - public condition: string; + /** Rating ratingCount. */ + public ratingCount: number; - /** ConditionBoostSpec boost. */ - public boost: number; + /** Rating averageRating. */ + public averageRating: number; - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns ConditionBoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new Rating instance using the specified properties. + * @param [properties] Properties to set + * @returns Rating instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRating): google.cloud.retail.v2alpha.Rating; - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRating, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rating; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rating; + + /** + * Verifies a Rating message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rating + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rating; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rating to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + /** UserInfo ipAddress */ + ipAddress?: (string|null); - /** - * Verifies a ConditionBoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** UserInfo userAgent */ + userAgent?: (string|null); - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConditionBoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @param message ConditionBoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { - /** - * Converts this ConditionBoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserInfo); - /** Properties of a QueryExpansionSpec. */ - interface IQueryExpansionSpec { + /** UserInfo userId. */ + public userId: string; - /** QueryExpansionSpec condition */ - condition?: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null); + /** UserInfo ipAddress. */ + public ipAddress: string; - /** QueryExpansionSpec pinUnexpandedResults */ - pinUnexpandedResults?: (boolean|null); - } + /** UserInfo userAgent. */ + public userAgent: string; - /** Represents a QueryExpansionSpec. */ - class QueryExpansionSpec implements IQueryExpansionSpec { + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; - /** - * Constructs a new QueryExpansionSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec); + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserInfo): google.cloud.retail.v2alpha.UserInfo; - /** QueryExpansionSpec condition. */ - public condition: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition); + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** QueryExpansionSpec pinUnexpandedResults. */ - public pinUnexpandedResults: boolean; + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionSpec instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserInfo; - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserInfo; - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserInfo; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Verifies a QueryExpansionSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + /** Properties of a Promotion. */ + interface IPromotion { - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @param message QueryExpansionSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Promotion promotionId */ + promotionId?: (string|null); + } - /** - * Converts this QueryExpansionSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Represents a Promotion. */ + class Promotion implements IPromotion { - namespace QueryExpansionSpec { + /** + * Constructs a new Promotion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPromotion); - /** Condition enum. */ - enum Condition { - CONDITION_UNSPECIFIED = 0, - DISABLED = 1, - AUTO = 3 - } - } + /** Promotion promotionId. */ + public promotionId: string; - /** SearchMode enum. */ - enum SearchMode { - SEARCH_MODE_UNSPECIFIED = 0, - PRODUCT_SEARCH_ONLY = 1, - FACETED_SEARCH_ONLY = 2 - } - } + /** + * Creates a new Promotion instance using the specified properties. + * @param [properties] Properties to set + * @returns Promotion instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPromotion): google.cloud.retail.v2alpha.Promotion; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Promotion; - /** Properties of a SearchResponse. */ - interface ISearchResponse { + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Promotion; - /** SearchResponse results */ - results?: (google.cloud.retail.v2.SearchResponse.ISearchResult[]|null); + /** + * Verifies a Promotion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchResponse facets */ - facets?: (google.cloud.retail.v2.SearchResponse.IFacet[]|null); + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Promotion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Promotion; - /** SearchResponse totalSize */ - totalSize?: (number|null); + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResponse correctedQuery */ - correctedQuery?: (string|null); + /** + * Converts this Promotion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** SearchResponse attributionToken */ - attributionToken?: (string|null); + /** Properties of a LocalInventory. */ + interface ILocalInventory { - /** SearchResponse nextPageToken */ - nextPageToken?: (string|null); + /** LocalInventory placeId */ + placeId?: (string|null); - /** SearchResponse queryExpansionInfo */ - queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - /** SearchResponse redirectUri */ - redirectUri?: (string|null); + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); } - /** Represents a SearchResponse. */ - class SearchResponse implements ISearchResponse { + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { /** - * Constructs a new SearchResponse. + * Constructs a new LocalInventory. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ISearchResponse); - - /** SearchResponse results. */ - public results: google.cloud.retail.v2.SearchResponse.ISearchResult[]; - - /** SearchResponse facets. */ - public facets: google.cloud.retail.v2.SearchResponse.IFacet[]; - - /** SearchResponse totalSize. */ - public totalSize: number; - - /** SearchResponse correctedQuery. */ - public correctedQuery: string; - - /** SearchResponse attributionToken. */ - public attributionToken: string; + constructor(properties?: google.cloud.retail.v2alpha.ILocalInventory); - /** SearchResponse nextPageToken. */ - public nextPageToken: string; + /** LocalInventory placeId. */ + public placeId: string; - /** SearchResponse queryExpansionInfo. */ - public queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - /** SearchResponse redirectUri. */ - public redirectUri: string; + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new LocalInventory instance using the specified properties. * @param [properties] Properties to set - * @returns SearchResponse instance + * @returns LocalInventory instance */ - public static create(properties?: google.cloud.retail.v2.ISearchResponse): google.cloud.retail.v2.SearchResponse; + public static create(properties?: google.cloud.retail.v2alpha.ILocalInventory): google.cloud.retail.v2alpha.LocalInventory; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchResponse + * @returns LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.LocalInventory; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchResponse + * @returns LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.LocalInventory; /** - * Verifies a SearchResponse message. + * Verifies a LocalInventory message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchResponse + * @returns LocalInventory */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.LocalInventory; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. - * @param message SearchResponse + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @param message LocalInventory * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchResponse to JSON. + * Converts this LocalInventory to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchResponse { - - /** Properties of a SearchResult. */ - interface ISearchResult { - - /** SearchResult id */ - id?: (string|null); - - /** SearchResult product */ - product?: (google.cloud.retail.v2.IProduct|null); - - /** SearchResult matchingVariantCount */ - matchingVariantCount?: (number|null); - - /** SearchResult matchingVariantFields */ - matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); - - /** SearchResult variantRollupValues */ - variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); - } - - /** Represents a SearchResult. */ - class SearchResult implements ISearchResult { + /** Properties of a GcsSource. */ + interface IGcsSource { - /** - * Constructs a new SearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult); + /** GcsSource inputUris */ + inputUris?: (string[]|null); - /** SearchResult id. */ - public id: string; + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } - /** SearchResult product. */ - public product?: (google.cloud.retail.v2.IProduct|null); + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { - /** SearchResult matchingVariantCount. */ - public matchingVariantCount: number; + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGcsSource); - /** SearchResult matchingVariantFields. */ - public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + /** GcsSource inputUris. */ + public inputUris: string[]; - /** SearchResult variantRollupValues. */ - public variantRollupValues: { [k: string]: google.protobuf.IValue }; + /** GcsSource dataSchema. */ + public dataSchema: string; - /** - * Creates a new SearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns SearchResult instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult): google.cloud.retail.v2.SearchResponse.SearchResult; + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGcsSource): google.cloud.retail.v2alpha.GcsSource; - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.SearchResult; + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GcsSource; - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.SearchResult; + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GcsSource; - /** - * Verifies a SearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.SearchResult; + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GcsSource; - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @param message SearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this SearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of a Facet. */ - interface IFacet { + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { - /** Facet key */ - key?: (string|null); + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); - /** Facet values */ - values?: (google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]|null); + /** BigQuerySource projectId */ + projectId?: (string|null); - /** Facet dynamicFacet */ - dynamicFacet?: (boolean|null); - } + /** BigQuerySource datasetId */ + datasetId?: (string|null); - /** Represents a Facet. */ - class Facet implements IFacet { + /** BigQuerySource tableId */ + tableId?: (string|null); - /** - * Constructs a new Facet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.IFacet); + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); - /** Facet key. */ - public key: string; + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); + } - /** Facet values. */ - public values: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]; + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { - /** Facet dynamicFacet. */ - public dynamicFacet: boolean; + /** + * Constructs a new BigQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IBigQuerySource); - /** - * Creates a new Facet instance using the specified properties. - * @param [properties] Properties to set - * @returns Facet instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.IFacet): google.cloud.retail.v2.SearchResponse.Facet; + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** BigQuerySource projectId. */ + public projectId: string; - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** BigQuerySource datasetId. */ + public datasetId: string; - /** - * Decodes a Facet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet; + /** BigQuerySource tableId. */ + public tableId: string; - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet; + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; - /** - * Verifies a Facet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** BigQuerySource dataSchema. */ + public dataSchema: string; - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Facet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet; + /** BigQuerySource partition. */ + public partition?: "partitionDate"; - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @param message Facet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new BigQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQuerySource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IBigQuerySource): google.cloud.retail.v2alpha.BigQuerySource; - /** - * Converts this Facet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; - namespace Facet { + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a FacetValue. */ - interface IFacetValue { + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.BigQuerySource; - /** FacetValue value */ - value?: (string|null); + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.BigQuerySource; - /** FacetValue interval */ - interval?: (google.cloud.retail.v2.IInterval|null); + /** + * Verifies a BigQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** FacetValue count */ - count?: (number|Long|string|null); - } + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.BigQuerySource; - /** Represents a FacetValue. */ - class FacetValue implements IFacetValue { + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Constructs a new FacetValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue); + /** + * Converts this BigQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** FacetValue value. */ - public value?: (string|null); + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { - /** FacetValue interval. */ - public interval?: (google.cloud.retail.v2.IInterval|null); + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2alpha.IProduct[]|null); + } - /** FacetValue count. */ - public count: (number|Long|string); + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { - /** FacetValue facetValue. */ - public facetValue?: ("value"|"interval"); + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductInlineSource); - /** - * Creates a new FacetValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetValue instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2alpha.IProduct[]; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductInlineSource): google.cloud.retail.v2alpha.ProductInlineSource; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInlineSource; - /** - * Verifies a FacetValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInlineSource; - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @param message FacetValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInlineSource; - /** - * Converts this FacetValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Properties of a QueryExpansionInfo. */ - interface IQueryExpansionInfo { + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** QueryExpansionInfo expandedQuery */ - expandedQuery?: (boolean|null); + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { - /** QueryExpansionInfo pinnedResultCount */ - pinnedResultCount?: (number|Long|string|null); - } + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2alpha.IUserEvent[]|null); + } - /** Represents a QueryExpansionInfo. */ - class QueryExpansionInfo implements IQueryExpansionInfo { + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { - /** - * Constructs a new QueryExpansionInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo); + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource); - /** QueryExpansionInfo expandedQuery. */ - public expandedQuery: boolean; + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2alpha.IUserEvent[]; - /** QueryExpansionInfo pinnedResultCount. */ - public pinnedResultCount: (number|Long|string); + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource): google.cloud.retail.v2alpha.UserEventInlineSource; - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionInfo instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInlineSource; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInlineSource; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Verifies a QueryExpansionInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInlineSource; - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @param message QueryExpansionInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Converts this QueryExpansionInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); } - /** Represents a UserEventService */ - class UserEventService extends $protobuf.rpc.Service { + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { /** - * Constructs a new UserEventService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; /** - * Creates new UserEventService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + public static create(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and UserEvent + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest, callback: google.cloud.retail.v2.UserEventService.WriteUserEventCallback): void; + public static encode(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @returns Promise + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public writeUserEvent(request: google.cloud.retail.v2.IWriteUserEventRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and HttpBody + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest, callback: google.cloud.retail.v2.UserEventService.CollectUserEventCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @returns Promise + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public collectUserEvent(request: google.cloud.retail.v2.ICollectUserEventRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @returns Promise + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig */ - public purgeUserEvents(request: google.cloud.retail.v2.IPurgeUserEventsRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportErrorsConfig; /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object */ - public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.ImportUserEventsCallback): void; + public static toObject(message: google.cloud.retail.v2alpha.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @returns Promise + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object */ - public importUserEvents(request: google.cloud.retail.v2.IImportUserEventsRequest): Promise; + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { + + /** ImportProductsRequest parent */ + parent?: (string|null); + + /** ImportProductsRequest requestId */ + requestId?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null); + + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set */ - public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest, callback: google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback): void; + constructor(properties?: google.cloud.retail.v2alpha.IImportProductsRequest); + + /** ImportProductsRequest parent. */ + public parent: string; + + /** ImportProductsRequest requestId. */ + public requestId: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode); + + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @returns Promise + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance */ - public rejoinUserEvents(request: google.cloud.retail.v2.IRejoinUserEventsRequest): Promise; - } + public static create(properties?: google.cloud.retail.v2alpha.IImportProductsRequest): google.cloud.retail.v2alpha.ImportProductsRequest; - namespace UserEventService { + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. - * @param error Error, if any - * @param [response] UserEvent + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsRequest; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2.UserEvent) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsRequest; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. - * @param error Error, if any - * @param [response] HttpBody + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest */ - type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsRequest; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object */ - type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.retail.v2alpha.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Converts this ImportProductsRequest to JSON. + * @returns JSON object */ - type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a WriteUserEventRequest. */ - interface IWriteUserEventRequest { + namespace ImportProductsRequest { - /** WriteUserEventRequest parent */ + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } + } + + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ parent?: (string|null); - /** WriteUserEventRequest userEvent */ - userEvent?: (google.cloud.retail.v2.IUserEvent|null); + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); } - /** Represents a WriteUserEventRequest. */ - class WriteUserEventRequest implements IWriteUserEventRequest { + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { /** - * Constructs a new WriteUserEventRequest. + * Constructs a new ImportUserEventsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IWriteUserEventRequest); + constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest); - /** WriteUserEventRequest parent. */ + /** ImportUserEventsRequest parent. */ public parent: string; - /** WriteUserEventRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2.IUserEvent|null); + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); /** - * Creates a new WriteUserEventRequest instance using the specified properties. + * Creates a new ImportUserEventsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns WriteUserEventRequest instance + * @returns ImportUserEventsRequest instance */ - public static create(properties?: google.cloud.retail.v2.IWriteUserEventRequest): google.cloud.retail.v2.WriteUserEventRequest; + public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns WriteUserEventRequest + * @returns ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.WriteUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns WriteUserEventRequest + * @returns ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.WriteUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Verifies a WriteUserEventRequest message. + * Verifies an ImportUserEventsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns WriteUserEventRequest + * @returns ImportUserEventsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.WriteUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsRequest; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. - * @param message WriteUserEventRequest + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this ImportUserEventsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CollectUserEventRequest. */ - interface ICollectUserEventRequest { + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { - /** CollectUserEventRequest parent */ + /** ImportCompletionDataRequest parent */ parent?: (string|null); - /** CollectUserEventRequest userEvent */ - userEvent?: (string|null); - - /** CollectUserEventRequest uri */ - uri?: (string|null); + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); - /** CollectUserEventRequest ets */ - ets?: (number|Long|string|null); + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a CollectUserEventRequest. */ - class CollectUserEventRequest implements ICollectUserEventRequest { + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { /** - * Constructs a new CollectUserEventRequest. + * Constructs a new ImportCompletionDataRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICollectUserEventRequest); + constructor(properties?: google.cloud.retail.v2alpha.IImportCompletionDataRequest); - /** CollectUserEventRequest parent. */ + /** ImportCompletionDataRequest parent. */ public parent: string; - /** CollectUserEventRequest userEvent. */ - public userEvent: string; - - /** CollectUserEventRequest uri. */ - public uri: string; + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); - /** CollectUserEventRequest ets. */ - public ets: (number|Long|string); + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new CollectUserEventRequest instance using the specified properties. + * Creates a new ImportCompletionDataRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CollectUserEventRequest instance + * @returns ImportCompletionDataRequest instance */ - public static create(properties?: google.cloud.retail.v2.ICollectUserEventRequest): google.cloud.retail.v2.CollectUserEventRequest; + public static create(properties?: google.cloud.retail.v2alpha.IImportCompletionDataRequest): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CollectUserEventRequest + * @returns ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CollectUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CollectUserEventRequest + * @returns ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CollectUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Verifies a CollectUserEventRequest message. + * Verifies an ImportCompletionDataRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CollectUserEventRequest + * @returns ImportCompletionDataRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CollectUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportCompletionDataRequest; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @param message CollectUserEventRequest + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CollectUserEventRequest to JSON. + * Converts this ImportCompletionDataRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsRequest. */ - interface IRejoinUserEventsRequest { + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { - /** RejoinUserEventsRequest parent */ - parent?: (string|null); + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); - /** RejoinUserEventsRequest userEventRejoinScope */ - userEventRejoinScope?: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null); + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); } - /** Represents a RejoinUserEventsRequest. */ - class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { /** - * Constructs a new RejoinUserEventsRequest. + * Constructs a new ProductInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest); + constructor(properties?: google.cloud.retail.v2alpha.IProductInputConfig); - /** RejoinUserEventsRequest parent. */ - public parent: string; + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); - /** RejoinUserEventsRequest userEventRejoinScope. */ - public userEventRejoinScope: (google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope); + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. + * Creates a new ProductInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsRequest instance + * @returns ProductInputConfig instance */ - public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsRequest): google.cloud.retail.v2.RejoinUserEventsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IProductInputConfig): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsRequest + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsRequest + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Verifies a RejoinUserEventsRequest message. + * Verifies a ProductInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsRequest + * @returns ProductInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInputConfig; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. - * @param message RejoinUserEventsRequest + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsRequest to JSON. + * Converts this ProductInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace RejoinUserEventsRequest { + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { - /** UserEventRejoinScope enum. */ - enum UserEventRejoinScope { - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, - JOINED_EVENTS = 1, - UNJOINED_EVENTS = 2 - } - } + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); - /** Properties of a RejoinUserEventsResponse. */ - interface IRejoinUserEventsResponse { + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); - /** RejoinUserEventsResponse rejoinedUserEventsCount */ - rejoinedUserEventsCount?: (number|Long|string|null); + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); } - /** Represents a RejoinUserEventsResponse. */ - class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { /** - * Constructs a new RejoinUserEventsResponse. + * Constructs a new UserEventInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse); + constructor(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig); - /** RejoinUserEventsResponse rejoinedUserEventsCount. */ - public rejoinedUserEventsCount: (number|Long|string); + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. + * Creates a new UserEventInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsResponse instance + * @returns UserEventInputConfig instance */ - public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsResponse): google.cloud.retail.v2.RejoinUserEventsResponse; + public static create(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsResponse + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsResponse + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Verifies a RejoinUserEventsResponse message. + * Verifies a UserEventInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsResponse + * @returns UserEventInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInputConfig; /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. - * @param message RejoinUserEventsResponse + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this UserEventInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsMetadata. */ - interface IRejoinUserEventsMetadata { + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { + + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); } - /** Represents a RejoinUserEventsMetadata. */ - class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { /** - * Constructs a new RejoinUserEventsMetadata. + * Constructs a new CompletionDataInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata); + constructor(properties?: google.cloud.retail.v2alpha.ICompletionDataInputConfig); + + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsMetadata instance + * @returns CompletionDataInputConfig instance */ - public static create(properties?: google.cloud.retail.v2.IRejoinUserEventsMetadata): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static create(properties?: google.cloud.retail.v2alpha.ICompletionDataInputConfig): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsMetadata + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsMetadata + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Verifies a RejoinUserEventsMetadata message. + * Verifies a CompletionDataInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsMetadata + * @returns CompletionDataInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RejoinUserEventsMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionDataInputConfig; /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. - * @param message RejoinUserEventsMetadata + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsMetadata to JSON. + * Converts this CompletionDataInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - /** Namespace v2alpha. */ - namespace v2alpha { + /** Properties of an ImportMetadata. */ + interface IImportMetadata { - /** Properties of a ProductLevelConfig. */ - interface IProductLevelConfig { + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** ProductLevelConfig ingestionProductType */ - ingestionProductType?: (string|null); + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); - /** ProductLevelConfig merchantCenterProductIdField */ - merchantCenterProductIdField?: (string|null); + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a ProductLevelConfig. */ - class ProductLevelConfig implements IProductLevelConfig { + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { /** - * Constructs a new ProductLevelConfig. + * Constructs a new ImportMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProductLevelConfig); + constructor(properties?: google.cloud.retail.v2alpha.IImportMetadata); - /** ProductLevelConfig ingestionProductType. */ - public ingestionProductType: string; + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** ProductLevelConfig merchantCenterProductIdField. */ - public merchantCenterProductIdField: string; + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** ImportMetadata requestId. */ + public requestId: string; + + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new ProductLevelConfig instance using the specified properties. + * Creates a new ImportMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ProductLevelConfig instance + * @returns ImportMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProductLevelConfig): google.cloud.retail.v2alpha.ProductLevelConfig; + public static create(properties?: google.cloud.retail.v2alpha.IImportMetadata): google.cloud.retail.v2alpha.ImportMetadata; /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductLevelConfig + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductLevelConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportMetadata; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductLevelConfig + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductLevelConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportMetadata; /** - * Verifies a ProductLevelConfig message. + * Verifies an ImportMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductLevelConfig + * @returns ImportMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductLevelConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportMetadata; /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. - * @param message ProductLevelConfig + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductLevelConfig to JSON. + * Converts this ImportMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a MerchantCenterLink. */ - interface IMerchantCenterLink { - - /** MerchantCenterLink merchantCenterAccountId */ - merchantCenterAccountId?: (number|Long|string|null); - - /** MerchantCenterLink branchId */ - branchId?: (string|null); - - /** MerchantCenterLink destinations */ - destinations?: (string[]|null); + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { - /** MerchantCenterLink regionCode */ - regionCode?: (string|null); + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** MerchantCenterLink languageCode */ - languageCode?: (string|null); + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); } - /** Represents a MerchantCenterLink. */ - class MerchantCenterLink implements IMerchantCenterLink { + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { /** - * Constructs a new MerchantCenterLink. + * Constructs a new ImportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink); - - /** MerchantCenterLink merchantCenterAccountId. */ - public merchantCenterAccountId: (number|Long|string); - - /** MerchantCenterLink branchId. */ - public branchId: string; - - /** MerchantCenterLink destinations. */ - public destinations: string[]; + constructor(properties?: google.cloud.retail.v2alpha.IImportProductsResponse); - /** MerchantCenterLink regionCode. */ - public regionCode: string; + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** MerchantCenterLink languageCode. */ - public languageCode: string; + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); /** - * Creates a new MerchantCenterLink instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns MerchantCenterLink instance + * @returns ImportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink): google.cloud.retail.v2alpha.MerchantCenterLink; + public static create(properties?: google.cloud.retail.v2alpha.IImportProductsResponse): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. - * @param message MerchantCenterLink message or plain object to encode + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. - * @param message MerchantCenterLink message or plain object to encode + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a MerchantCenterLink message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns MerchantCenterLink + * @returns ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLink; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns MerchantCenterLink + * @returns ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLink; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Verifies a MerchantCenterLink message. + * Verifies an ImportProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns MerchantCenterLink + * @returns ImportProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLink; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsResponse; /** - * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. - * @param message MerchantCenterLink + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this MerchantCenterLink to JSON. + * Converts this ImportProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a MerchantCenterLinkingConfig. */ - interface IMerchantCenterLinkingConfig { + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { - /** MerchantCenterLinkingConfig links */ - links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); } - /** Represents a MerchantCenterLinkingConfig. */ - class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { /** - * Constructs a new MerchantCenterLinkingConfig. + * Constructs a new ImportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); + constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse); - /** MerchantCenterLinkingConfig links. */ - public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); /** - * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns MerchantCenterLinkingConfig instance + * @returns ImportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @param message MerchantCenterLinkingConfig message or plain object to encode + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @param message MerchantCenterLinkingConfig message or plain object to encode + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns MerchantCenterLinkingConfig + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns MerchantCenterLinkingConfig + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Verifies a MerchantCenterLinkingConfig message. + * Verifies an ImportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns MerchantCenterLinkingConfig + * @returns ImportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsResponse; /** - * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. - * @param message MerchantCenterLinkingConfig + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this MerchantCenterLinkingConfig to JSON. + * Converts this ImportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Catalog. */ - interface ICatalog { - - /** Catalog name */ - name?: (string|null); - - /** Catalog displayName */ - displayName?: (string|null); + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); - /** Catalog merchantCenterLinkingConfig */ - merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); } - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { /** - * Constructs a new Catalog. + * Constructs a new UserEventImportSummary. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICatalog); - - /** Catalog name. */ - public name: string; - - /** Catalog displayName. */ - public displayName: string; + constructor(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary); - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); - /** Catalog merchantCenterLinkingConfig. */ - public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); /** - * Creates a new Catalog instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @param [properties] Properties to set - * @returns Catalog instance + * @returns UserEventImportSummary instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + public static create(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Catalog + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Catalog + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Verifies a Catalog message. + * Verifies a UserEventImportSummary message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Catalog + * @returns UserEventImportSummary */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventImportSummary; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Catalog to JSON. + * Converts this UserEventImportSummary to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** SolutionType enum. */ - enum SolutionType { - SOLUTION_TYPE_UNSPECIFIED = 0, - SOLUTION_TYPE_RECOMMENDATION = 1, - SOLUTION_TYPE_SEARCH = 2 - } - - /** Properties of a Condition. */ - interface ICondition { - - /** Condition queryTerms */ - queryTerms?: (google.cloud.retail.v2alpha.Condition.IQueryTerm[]|null); + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { - /** Condition activeTimeRange */ - activeTimeRange?: (google.cloud.retail.v2alpha.Condition.ITimeRange[]|null); + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); } - /** Represents a Condition. */ - class Condition implements ICondition { + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { /** - * Constructs a new Condition. + * Constructs a new ImportCompletionDataResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICondition); - - /** Condition queryTerms. */ - public queryTerms: google.cloud.retail.v2alpha.Condition.IQueryTerm[]; + constructor(properties?: google.cloud.retail.v2alpha.IImportCompletionDataResponse); - /** Condition activeTimeRange. */ - public activeTimeRange: google.cloud.retail.v2alpha.Condition.ITimeRange[]; + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; /** - * Creates a new Condition instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Condition instance + * @returns ImportCompletionDataResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICondition): google.cloud.retail.v2alpha.Condition; + public static create(properties?: google.cloud.retail.v2alpha.IImportCompletionDataResponse): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. - * @param message Condition message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. - * @param message Condition message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Condition message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Condition + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Decodes a Condition message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Condition + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Verifies a Condition message. + * Verifies an ImportCompletionDataResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Condition + * @returns ImportCompletionDataResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportCompletionDataResponse; /** - * Creates a plain object from a Condition message. Also converts values to other types if specified. - * @param message Condition + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Condition to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Condition { + /** Properties of a Product. */ + interface IProduct { - /** Properties of a QueryTerm. */ - interface IQueryTerm { + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); - /** QueryTerm value */ - value?: (string|null); + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); - /** QueryTerm fullMatch */ - fullMatch?: (boolean|null); - } + /** Product name */ + name?: (string|null); - /** Represents a QueryTerm. */ - class QueryTerm implements IQueryTerm { + /** Product id */ + id?: (string|null); - /** - * Constructs a new QueryTerm. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm); + /** Product type */ + type?: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type|null); - /** QueryTerm value. */ - public value: string; + /** Product primaryProductId */ + primaryProductId?: (string|null); - /** QueryTerm fullMatch. */ - public fullMatch: boolean; + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); - /** - * Creates a new QueryTerm instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryTerm instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm): google.cloud.retail.v2alpha.Condition.QueryTerm; + /** Product gtin */ + gtin?: (string|null); - /** - * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @param message QueryTerm message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product categories */ + categories?: (string[]|null); - /** - * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @param message QueryTerm message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product title */ + title?: (string|null); - /** - * Decodes a QueryTerm message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.QueryTerm; + /** Product brands */ + brands?: (string[]|null); - /** - * Decodes a QueryTerm message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.QueryTerm; + /** Product description */ + description?: (string|null); - /** - * Verifies a QueryTerm message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Product languageCode */ + languageCode?: (string|null); - /** - * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryTerm - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.QueryTerm; + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** Product rating */ + rating?: (google.cloud.retail.v2alpha.IRating|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2alpha.IFulfillmentInfo[]|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2alpha.IImage[]|null); + + /** Product audience */ + audience?: (google.cloud.retail.v2alpha.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2alpha.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); - /** - * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. - * @param message QueryTerm - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Product promotions */ + promotions?: (google.cloud.retail.v2alpha.IPromotion[]|null); - /** - * Converts this QueryTerm to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); - /** Properties of a TimeRange. */ - interface ITimeRange { + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); - /** TimeRange startTime */ - startTime?: (google.protobuf.ITimestamp|null); + /** Product variants */ + variants?: (google.cloud.retail.v2alpha.IProduct[]|null); + } - /** TimeRange endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } + /** Represents a Product. */ + class Product implements IProduct { - /** Represents a TimeRange. */ - class TimeRange implements ITimeRange { + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProduct); - /** - * Constructs a new TimeRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange); + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); - /** TimeRange startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); - /** TimeRange endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); + /** Product name. */ + public name: string; - /** - * Creates a new TimeRange instance using the specified properties. - * @param [properties] Properties to set - * @returns TimeRange instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange): google.cloud.retail.v2alpha.Condition.TimeRange; + /** Product id. */ + public id: string; - /** - * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @param message TimeRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product type. */ + public type: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type); - /** - * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @param message TimeRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product primaryProductId. */ + public primaryProductId: string; - /** - * Decodes a TimeRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.TimeRange; + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; - /** - * Decodes a TimeRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.TimeRange; + /** Product gtin. */ + public gtin: string; - /** - * Verifies a TimeRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Product categories. */ + public categories: string[]; - /** - * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TimeRange - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.TimeRange; + /** Product title. */ + public title: string; - /** - * Creates a plain object from a TimeRange message. Also converts values to other types if specified. - * @param message TimeRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Product brands. */ + public brands: string[]; - /** - * Converts this TimeRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** Product description. */ + public description: string; - /** Properties of a Rule. */ - interface IRule { + /** Product languageCode. */ + public languageCode: string; - /** Rule boostAction */ - boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; - /** Rule redirectAction */ - redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + /** Product tags. */ + public tags: string[]; - /** Rule onewaySynonymsAction */ - onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - /** Rule doNotAssociateAction */ - doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + /** Product rating. */ + public rating?: (google.cloud.retail.v2alpha.IRating|null); - /** Rule replacementAction */ - replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); - /** Rule ignoreAction */ - ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + /** Product availability. */ + public availability: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability); - /** Rule filterAction */ - filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); - /** Rule twowaySynonymsAction */ - twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2alpha.IFulfillmentInfo[]; - /** Rule condition */ - condition?: (google.cloud.retail.v2alpha.ICondition|null); - } + /** Product uri. */ + public uri: string; - /** Represents a Rule. */ - class Rule implements IRule { + /** Product images. */ + public images: google.cloud.retail.v2alpha.IImage[]; - /** - * Constructs a new Rule. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IRule); + /** Product audience. */ + public audience?: (google.cloud.retail.v2alpha.IAudience|null); - /** Rule boostAction. */ - public boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2alpha.IColorInfo|null); - /** Rule redirectAction. */ - public redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + /** Product sizes. */ + public sizes: string[]; - /** Rule onewaySynonymsAction. */ - public onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + /** Product materials. */ + public materials: string[]; - /** Rule doNotAssociateAction. */ - public doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + /** Product patterns. */ + public patterns: string[]; - /** Rule replacementAction. */ - public replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + /** Product conditions. */ + public conditions: string[]; - /** Rule ignoreAction. */ - public ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + /** Product promotions. */ + public promotions: google.cloud.retail.v2alpha.IPromotion[]; - /** Rule filterAction. */ - public filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); - /** Rule twowaySynonymsAction. */ - public twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); - /** Rule condition. */ - public condition?: (google.cloud.retail.v2alpha.ICondition|null); + /** Product variants. */ + public variants: google.cloud.retail.v2alpha.IProduct[]; - /** Rule action. */ - public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); /** - * Creates a new Rule instance using the specified properties. + * Creates a new Product instance using the specified properties. * @param [properties] Properties to set - * @returns Rule instance + * @returns Product instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRule): google.cloud.retail.v2alpha.Rule; + public static create(properties?: google.cloud.retail.v2alpha.IProduct): google.cloud.retail.v2alpha.Product; /** - * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. - * @param message Rule message or plain object to encode + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. - * @param message Rule message or plain object to encode + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rule message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rule + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Product; /** - * Decodes a Rule message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rule + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Product; /** - * Verifies a Rule message. + * Verifies a Product message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rule + * @returns Product */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Product; /** - * Creates a plain object from a Rule message. Also converts values to other types if specified. - * @param message Rule + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rule to JSON. + * Converts this Product to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Rule { - - /** Properties of a BoostAction. */ - interface IBoostAction { + namespace Product { - /** BoostAction boost */ - boost?: (number|null); + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } - /** BoostAction productsFilter */ - productsFilter?: (string|null); + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 } + } - /** Represents a BoostAction. */ - class BoostAction implements IBoostAction { + /** Properties of a UserEvent. */ + interface IUserEvent { - /** - * Constructs a new BoostAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction); + /** UserEvent eventType */ + eventType?: (string|null); - /** BoostAction boost. */ - public boost: number; + /** UserEvent visitorId */ + visitorId?: (string|null); - /** BoostAction productsFilter. */ - public productsFilter: string; + /** UserEvent sessionId */ + sessionId?: (string|null); - /** - * Creates a new BoostAction instance using the specified properties. - * @param [properties] Properties to set - * @returns BoostAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction): google.cloud.retail.v2alpha.Rule.BoostAction; + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); - /** - * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. - * @param message BoostAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); - /** - * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. - * @param message BoostAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent attributionToken */ + attributionToken?: (string|null); - /** - * Decodes a BoostAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoostAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.BoostAction; + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2alpha.IProductDetail[]|null); - /** - * Decodes a BoostAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoostAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.BoostAction; + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2alpha.ICompletionDetail|null); - /** - * Verifies a BoostAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); - /** - * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoostAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.BoostAction; + /** UserEvent cartId */ + cartId?: (string|null); - /** - * Creates a plain object from a BoostAction message. Also converts values to other types if specified. - * @param message BoostAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); - /** - * Converts this BoostAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** UserEvent searchQuery */ + searchQuery?: (string|null); - /** Properties of a FilterAction. */ - interface IFilterAction { + /** UserEvent filter */ + filter?: (string|null); - /** FilterAction filter */ - filter?: (string|null); - } + /** UserEvent orderBy */ + orderBy?: (string|null); - /** Represents a FilterAction. */ - class FilterAction implements IFilterAction { + /** UserEvent offset */ + offset?: (number|null); - /** - * Constructs a new FilterAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction); + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); - /** FilterAction filter. */ - public filter: string; + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - /** - * Creates a new FilterAction instance using the specified properties. - * @param [properties] Properties to set - * @returns FilterAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction): google.cloud.retail.v2alpha.Rule.FilterAction; + /** UserEvent uri */ + uri?: (string|null); - /** - * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @param message FilterAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent referrerUri */ + referrerUri?: (string|null); - /** - * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @param message FilterAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } - /** - * Decodes a FilterAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FilterAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.FilterAction; + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { + + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUserEvent); + + /** UserEvent eventType. */ + public eventType: string; + + /** UserEvent visitorId. */ + public visitorId: string; + + /** UserEvent sessionId. */ + public sessionId: string; + + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); + + /** UserEvent experimentIds. */ + public experimentIds: string[]; + + /** UserEvent attributionToken. */ + public attributionToken: string; + + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2alpha.IProductDetail[]; + + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2alpha.ICompletionDetail|null); + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent filter. */ + public filter: string; + + /** UserEvent orderBy. */ + public orderBy: string; + + /** UserEvent offset. */ + public offset: number; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; - /** - * Decodes a FilterAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FilterAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.FilterAction; + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - /** - * Verifies a FilterAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** UserEvent uri. */ + public uri: string; - /** - * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FilterAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.FilterAction; + /** UserEvent referrerUri. */ + public referrerUri: string; - /** - * Creates a plain object from a FilterAction message. Also converts values to other types if specified. - * @param message FilterAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** UserEvent pageViewId. */ + public pageViewId: string; - /** - * Converts this FilterAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUserEvent): google.cloud.retail.v2alpha.UserEvent; - /** Properties of a RedirectAction. */ - interface IRedirectAction { + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; - /** RedirectAction redirectUri */ - redirectUri?: (string|null); - } + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a RedirectAction. */ - class RedirectAction implements IRedirectAction { + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEvent; - /** - * Constructs a new RedirectAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction); + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEvent; - /** RedirectAction redirectUri. */ - public redirectUri: string; + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a new RedirectAction instance using the specified properties. - * @param [properties] Properties to set - * @returns RedirectAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction): google.cloud.retail.v2alpha.Rule.RedirectAction; + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEvent; - /** - * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @param message RedirectAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @param message RedirectAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Decodes a RedirectAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.RedirectAction; + /** Properties of a ProductDetail. */ + interface IProductDetail { - /** - * Decodes a RedirectAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.RedirectAction; + /** ProductDetail product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); - /** - * Verifies a RedirectAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); + } - /** - * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RedirectAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.RedirectAction; + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { - /** - * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. - * @param message RedirectAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Constructs a new ProductDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IProductDetail); - /** - * Converts this RedirectAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); - /** Properties of a TwowaySynonymsAction. */ - interface ITwowaySynonymsAction { + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); - /** TwowaySynonymsAction synonyms */ - synonyms?: (string[]|null); - } + /** + * Creates a new ProductDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductDetail instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IProductDetail): google.cloud.retail.v2alpha.ProductDetail; - /** Represents a TwowaySynonymsAction. */ - class TwowaySynonymsAction implements ITwowaySynonymsAction { + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new TwowaySynonymsAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction); + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** TwowaySynonymsAction synonyms. */ - public synonyms: string[]; + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductDetail; - /** - * Creates a new TwowaySynonymsAction instance using the specified properties. - * @param [properties] Properties to set - * @returns TwowaySynonymsAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductDetail; + + /** + * Verifies a ProductDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. - * @param message TwowaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductDetail; - /** - * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. - * @param message TwowaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + /** + * Converts this ProductDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { - /** - * Verifies a TwowaySynonymsAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); - /** - * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TwowaySynonymsAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction; + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); - /** - * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. - * @param message TwowaySynonymsAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); + } - /** - * Converts this TwowaySynonymsAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { - /** Properties of an OnewaySynonymsAction. */ - interface IOnewaySynonymsAction { + /** + * Constructs a new CompletionDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICompletionDetail); - /** OnewaySynonymsAction queryTerms */ - queryTerms?: (string[]|null); + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; - /** OnewaySynonymsAction synonyms */ - synonyms?: (string[]|null); + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; - /** OnewaySynonymsAction onewayTerms */ - onewayTerms?: (string[]|null); - } + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; - /** Represents an OnewaySynonymsAction. */ - class OnewaySynonymsAction implements IOnewaySynonymsAction { + /** + * Creates a new CompletionDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDetail instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICompletionDetail): google.cloud.retail.v2alpha.CompletionDetail; - /** - * Constructs a new OnewaySynonymsAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction); + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** OnewaySynonymsAction queryTerms. */ - public queryTerms: string[]; + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** OnewaySynonymsAction synonyms. */ - public synonyms: string[]; + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionDetail; - /** OnewaySynonymsAction onewayTerms. */ - public onewayTerms: string[]; + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionDetail; - /** - * Creates a new OnewaySynonymsAction instance using the specified properties. - * @param [properties] Properties to set - * @returns OnewaySynonymsAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + /** + * Verifies a CompletionDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. - * @param message OnewaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionDetail; - /** - * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. - * @param message OnewaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + /** + * Converts this CompletionDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { - /** - * Verifies an OnewaySynonymsAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** PurchaseTransaction id */ + id?: (string|null); - /** - * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OnewaySynonymsAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction; + /** PurchaseTransaction revenue */ + revenue?: (number|null); - /** - * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. - * @param message OnewaySynonymsAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** PurchaseTransaction tax */ + tax?: (number|null); - /** - * Converts this OnewaySynonymsAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** PurchaseTransaction cost */ + cost?: (number|null); - /** Properties of a DoNotAssociateAction. */ - interface IDoNotAssociateAction { + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); + } - /** DoNotAssociateAction queryTerms */ - queryTerms?: (string[]|null); + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { - /** DoNotAssociateAction doNotAssociateTerms */ - doNotAssociateTerms?: (string[]|null); + /** + * Constructs a new PurchaseTransaction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction); - /** DoNotAssociateAction terms */ - terms?: (string[]|null); - } + /** PurchaseTransaction id. */ + public id: string; - /** Represents a DoNotAssociateAction. */ - class DoNotAssociateAction implements IDoNotAssociateAction { + /** PurchaseTransaction revenue. */ + public revenue: number; - /** - * Constructs a new DoNotAssociateAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction); + /** PurchaseTransaction tax. */ + public tax: number; - /** DoNotAssociateAction queryTerms. */ - public queryTerms: string[]; + /** PurchaseTransaction cost. */ + public cost: number; - /** DoNotAssociateAction doNotAssociateTerms. */ - public doNotAssociateTerms: string[]; + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; - /** DoNotAssociateAction terms. */ - public terms: string[]; + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @param [properties] Properties to set + * @returns PurchaseTransaction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction): google.cloud.retail.v2alpha.PurchaseTransaction; - /** - * Creates a new DoNotAssociateAction instance using the specified properties. - * @param [properties] Properties to set - * @returns DoNotAssociateAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. - * @param message DoNotAssociateAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. - * @param message DoNotAssociateAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurchaseTransaction; - /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DoNotAssociateAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurchaseTransaction; - /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DoNotAssociateAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + /** + * Verifies a PurchaseTransaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Verifies a DoNotAssociateAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurchaseTransaction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurchaseTransaction; - /** - * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DoNotAssociateAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.DoNotAssociateAction; + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. - * @param message DoNotAssociateAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Converts this PurchaseTransaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Converts this DoNotAssociateAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { - /** Properties of a ReplacementAction. */ - interface IReplacementAction { + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** ReplacementAction queryTerms */ - queryTerms?: (string[]|null); + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; - /** ReplacementAction replacementTerm */ - replacementTerm?: (string|null); + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest, callback: google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback): void; - /** ReplacementAction term */ - term?: (string|null); - } + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest): Promise; - /** Represents a ReplacementAction. */ - class ReplacementAction implements IReplacementAction { + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback): void; - /** - * Constructs a new ReplacementAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IReplacementAction); + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest): Promise; - /** ReplacementAction queryTerms. */ - public queryTerms: string[]; + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public setDefaultBranch(request: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, callback: google.cloud.retail.v2alpha.CatalogService.SetDefaultBranchCallback): void; - /** ReplacementAction replacementTerm. */ - public replacementTerm: string; + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise + */ + public setDefaultBranch(request: google.cloud.retail.v2alpha.ISetDefaultBranchRequest): Promise; - /** ReplacementAction term. */ - public term: string; + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + */ + public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, callback: google.cloud.retail.v2alpha.CatalogService.GetDefaultBranchCallback): void; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise + */ + public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): Promise; + } - /** - * Creates a new ReplacementAction instance using the specified properties. - * @param [properties] Properties to set - * @returns ReplacementAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IReplacementAction): google.cloud.retail.v2alpha.Rule.ReplacementAction; + namespace CatalogService { - /** - * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. - * @param message ReplacementAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; - /** - * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. - * @param message ReplacementAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; - /** - * Decodes a ReplacementAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.ReplacementAction; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - /** - * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.ReplacementAction; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.GetDefaultBranchResponse) => void; + } - /** - * Verifies a ReplacementAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { - /** - * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReplacementAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.ReplacementAction; + /** ListCatalogsRequest parent */ + parent?: (string|null); - /** - * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. - * @param message ReplacementAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); - /** - * Converts this ReplacementAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } - /** Properties of an IgnoreAction. */ - interface IIgnoreAction { + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { - /** IgnoreAction ignoreTerms */ - ignoreTerms?: (string[]|null); - } + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); - /** Represents an IgnoreAction. */ - class IgnoreAction implements IIgnoreAction { + /** ListCatalogsRequest parent. */ + public parent: string; - /** - * Constructs a new IgnoreAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IIgnoreAction); + /** ListCatalogsRequest pageSize. */ + public pageSize: number; - /** IgnoreAction ignoreTerms. */ - public ignoreTerms: string[]; + /** ListCatalogsRequest pageToken. */ + public pageToken: string; - /** - * Creates a new IgnoreAction instance using the specified properties. - * @param [properties] Properties to set - * @returns IgnoreAction instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IIgnoreAction): google.cloud.retail.v2alpha.Rule.IgnoreAction; + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCatalogsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest): google.cloud.retail.v2alpha.ListCatalogsRequest; - /** - * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. - * @param message IgnoreAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. - * @param message IgnoreAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes an IgnoreAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.IgnoreAction; + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsRequest; - /** - * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.IgnoreAction; + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsRequest; - /** - * Verifies an IgnoreAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a ListCatalogsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns IgnoreAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.IgnoreAction; + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCatalogsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsRequest; - /** - * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. - * @param message IgnoreAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this IgnoreAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this ListCatalogsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of an Audience. */ - interface IAudience { + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { - /** Audience genders */ - genders?: (string[]|null); + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2alpha.ICatalog[]|null); - /** Audience ageGroups */ - ageGroups?: (string[]|null); + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents an Audience. */ - class Audience implements IAudience { + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { /** - * Constructs a new Audience. + * Constructs a new ListCatalogsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IAudience); + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse); - /** Audience genders. */ - public genders: string[]; + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2alpha.ICatalog[]; - /** Audience ageGroups. */ - public ageGroups: string[]; + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new Audience instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Audience instance + * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IAudience): google.cloud.retail.v2alpha.Audience; + public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Audience message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Audience + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Audience; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Decodes an Audience message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Audience + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Audience; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Verifies an Audience message. + * Verifies a ListCatalogsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Audience + * @returns ListCatalogsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Audience; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsResponse; /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @param message Audience + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Audience to JSON. + * Converts this ListCatalogsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ColorInfo. */ - interface IColorInfo { + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { - /** ColorInfo colorFamilies */ - colorFamilies?: (string[]|null); + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2alpha.ICatalog|null); - /** ColorInfo colors */ - colors?: (string[]|null); + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { /** - * Constructs a new ColorInfo. + * Constructs a new UpdateCatalogRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IColorInfo); + constructor(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest); - /** ColorInfo colorFamilies. */ - public colorFamilies: string[]; + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2alpha.ICatalog|null); - /** ColorInfo colors. */ - public colors: string[]; + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ColorInfo instance + * @returns UpdateCatalogRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IColorInfo): google.cloud.retail.v2alpha.ColorInfo; + public static create(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest): google.cloud.retail.v2alpha.UpdateCatalogRequest; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ColorInfo + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ColorInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateCatalogRequest; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ColorInfo + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ColorInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateCatalogRequest; /** - * Verifies a ColorInfo message. + * Verifies an UpdateCatalogRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ColorInfo + * @returns UpdateCatalogRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ColorInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateCatalogRequest; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @param message ColorInfo + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ColorInfo to JSON. + * Converts this UpdateCatalogRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { - - /** CustomAttribute text */ - text?: (string[]|null); + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); - /** CustomAttribute searchable */ - searchable?: (boolean|null); + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); - /** CustomAttribute indexable */ - indexable?: (boolean|null); + /** SetDefaultBranchRequest note */ + note?: (string|null); } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { /** - * Constructs a new CustomAttribute. + * Constructs a new SetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICustomAttribute); - - /** CustomAttribute text. */ - public text: string[]; - - /** CustomAttribute numbers. */ - public numbers: number[]; - - /** CustomAttribute searchable. */ - public searchable?: (boolean|null); + constructor(properties?: google.cloud.retail.v2alpha.ISetDefaultBranchRequest); - /** CustomAttribute indexable. */ - public indexable?: (boolean|null); + /** SetDefaultBranchRequest catalog. */ + public catalog: string; - /** CustomAttribute _searchable. */ - public _searchable?: "searchable"; + /** SetDefaultBranchRequest branchId. */ + public branchId: string; - /** CustomAttribute _indexable. */ - public _indexable?: "indexable"; + /** SetDefaultBranchRequest note. */ + public note: string; /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns SetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICustomAttribute): google.cloud.retail.v2alpha.CustomAttribute; + public static create(properties?: google.cloud.retail.v2alpha.ISetDefaultBranchRequest): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Verifies a CustomAttribute message. + * Verifies a SetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns SetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetDefaultBranchRequest; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FulfillmentInfo. */ - interface IFulfillmentInfo { - - /** FulfillmentInfo type */ - type?: (string|null); + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { - /** FulfillmentInfo placeIds */ - placeIds?: (string[]|null); + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); } - /** Represents a FulfillmentInfo. */ - class FulfillmentInfo implements IFulfillmentInfo { + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { /** - * Constructs a new FulfillmentInfo. + * Constructs a new GetDefaultBranchRequest. * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IFulfillmentInfo); - - /** FulfillmentInfo type. */ - public type: string; + */ + constructor(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchRequest); - /** FulfillmentInfo placeIds. */ - public placeIds: string[]; + /** GetDefaultBranchRequest catalog. */ + public catalog: string; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns FulfillmentInfo instance + * @returns GetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IFulfillmentInfo): google.cloud.retail.v2alpha.FulfillmentInfo; + public static create(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FulfillmentInfo + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.FulfillmentInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FulfillmentInfo + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.FulfillmentInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Verifies a FulfillmentInfo message. + * Verifies a GetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FulfillmentInfo + * @returns GetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.FulfillmentInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetDefaultBranchRequest; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. - * @param message FulfillmentInfo + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Image. */ - interface IImage { + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { - /** Image uri */ - uri?: (string|null); + /** GetDefaultBranchResponse branch */ + branch?: (string|null); - /** Image height */ - height?: (number|null); + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); - /** Image width */ - width?: (number|null); + /** GetDefaultBranchResponse note */ + note?: (string|null); } - /** Represents an Image. */ - class Image implements IImage { + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { /** - * Constructs a new Image. + * Constructs a new GetDefaultBranchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImage); + constructor(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchResponse); - /** Image uri. */ - public uri: string; + /** GetDefaultBranchResponse branch. */ + public branch: string; - /** Image height. */ - public height: number; + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); - /** Image width. */ - public width: number; + /** GetDefaultBranchResponse note. */ + public note: string; /** - * Creates a new Image instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns GetDefaultBranchResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImage): google.cloud.retail.v2alpha.Image; + public static create(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchResponse): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Verifies an Image message. + * Verifies a GetDefaultBranchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns GetDefaultBranchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetDefaultBranchResponse; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Interval. */ - interface IInterval { + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { - /** Interval minimum */ - minimum?: (number|null); + /** + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** Interval exclusiveMinimum */ - exclusiveMinimum?: (number|null); + /** + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; - /** Interval maximum */ - maximum?: (number|null); + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse + */ + public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest, callback: google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback): void; - /** Interval exclusiveMaximum */ - exclusiveMaximum?: (number|null); + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise + */ + public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest): Promise; + + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest, callback: google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback): void; + + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise + */ + public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest): Promise; } - /** Represents an Interval. */ - class Interval implements IInterval { + namespace CompletionService { /** - * Constructs a new Interval. + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse + */ + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompleteQueryResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { + + /** CompleteQueryRequest catalog */ + catalog?: (string|null); + + /** CompleteQueryRequest query */ + query?: (string|null); + + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); + } + + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { + + /** + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IInterval); + constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest); - /** Interval minimum. */ - public minimum?: (number|null); + /** CompleteQueryRequest catalog. */ + public catalog: string; - /** Interval exclusiveMinimum. */ - public exclusiveMinimum?: (number|null); + /** CompleteQueryRequest query. */ + public query: string; - /** Interval maximum. */ - public maximum?: (number|null); + /** CompleteQueryRequest visitorId. */ + public visitorId: string; - /** Interval exclusiveMaximum. */ - public exclusiveMaximum?: (number|null); + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; + + /** CompleteQueryRequest deviceType. */ + public deviceType: string; - /** Interval min. */ - public min?: ("minimum"|"exclusiveMinimum"); + /** CompleteQueryRequest dataset. */ + public dataset: string; - /** Interval max. */ - public max?: ("maximum"|"exclusiveMaximum"); + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new Interval instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Interval instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IInterval): google.cloud.retail.v2alpha.Interval; + public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Interval + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Interval; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Interval + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Interval; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Verifies an Interval message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Interval + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Interval; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @param message Interval + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Interval to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PriceInfo. */ - interface IPriceInfo { - - /** PriceInfo currencyCode */ - currencyCode?: (string|null); - - /** PriceInfo price */ - price?: (number|null); - - /** PriceInfo originalPrice */ - originalPrice?: (number|null); - - /** PriceInfo cost */ - cost?: (number|null); + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { - /** PriceInfo priceEffectiveTime */ - priceEffectiveTime?: (google.protobuf.ITimestamp|null); + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]|null); - /** PriceInfo priceExpireTime */ - priceExpireTime?: (google.protobuf.ITimestamp|null); + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); - /** PriceInfo priceRange */ - priceRange?: (google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null); + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents a PriceInfo. */ - class PriceInfo implements IPriceInfo { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new PriceInfo. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPriceInfo); - - /** PriceInfo currencyCode. */ - public currencyCode: string; - - /** PriceInfo price. */ - public price: number; - - /** PriceInfo originalPrice. */ - public originalPrice: number; - - /** PriceInfo cost. */ - public cost: number; + constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse); - /** PriceInfo priceEffectiveTime. */ - public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]; - /** PriceInfo priceExpireTime. */ - public priceExpireTime?: (google.protobuf.ITimestamp|null); + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; - /** PriceInfo priceRange. */ - public priceRange?: (google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null); + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PriceInfo instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPriceInfo): google.cloud.retail.v2alpha.PriceInfo; + public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceInfo + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceInfo + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Verifies a PriceInfo message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceInfo + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @param message PriceInfo + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceInfo to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PriceInfo { + namespace CompleteQueryResponse { - /** Properties of a PriceRange. */ - interface IPriceRange { + /** Properties of a CompletionResult. */ + interface ICompletionResult { + + /** CompletionResult suggestion */ + suggestion?: (string|null); + + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + } + + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { + + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult); + + /** CompletionResult suggestion. */ + public suggestion: string; + + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** PriceRange price */ - price?: (google.cloud.retail.v2alpha.IInterval|null); + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { - /** PriceRange originalPrice */ - originalPrice?: (google.cloud.retail.v2alpha.IInterval|null); + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); } - /** Represents a PriceRange. */ - class PriceRange implements IPriceRange { + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { /** - * Constructs a new PriceRange. + * Constructs a new RecentSearchResult. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.PriceInfo.IPriceRange); - - /** PriceRange price. */ - public price?: (google.cloud.retail.v2alpha.IInterval|null); + constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult); - /** PriceRange originalPrice. */ - public originalPrice?: (google.cloud.retail.v2alpha.IInterval|null); + /** RecentSearchResult recentSearch. */ + public recentSearch: string; /** - * Creates a new PriceRange instance using the specified properties. + * Creates a new RecentSearchResult instance using the specified properties. * @param [properties] Properties to set - * @returns PriceRange instance + * @returns RecentSearchResult instance */ - public static create(properties?: google.cloud.retail.v2alpha.PriceInfo.IPriceRange): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceRange message from the specified reader or buffer. + * Decodes a RecentSearchResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceRange + * @returns RecentSearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceRange + * @returns RecentSearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Verifies a PriceRange message. + * Verifies a RecentSearchResult message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceRange + * @returns RecentSearchResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PriceInfo.PriceRange; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @param message PriceRange + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceRange to JSON. + * Converts this RecentSearchResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } } - /** Properties of a Rating. */ - interface IRating { - - /** Rating ratingCount */ - ratingCount?: (number|null); - - /** Rating averageRating */ - averageRating?: (number|null); + /** Properties of an ExportErrorsConfig. */ + interface IExportErrorsConfig { - /** Rating ratingHistogram */ - ratingHistogram?: (number[]|null); + /** ExportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); } - /** Represents a Rating. */ - class Rating implements IRating { + /** Represents an ExportErrorsConfig. */ + class ExportErrorsConfig implements IExportErrorsConfig { /** - * Constructs a new Rating. + * Constructs a new ExportErrorsConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRating); - - /** Rating ratingCount. */ - public ratingCount: number; + constructor(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig); - /** Rating averageRating. */ - public averageRating: number; + /** ExportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); - /** Rating ratingHistogram. */ - public ratingHistogram: number[]; + /** ExportErrorsConfig destination. */ + public destination?: "gcsPrefix"; /** - * Creates a new Rating instance using the specified properties. + * Creates a new ExportErrorsConfig instance using the specified properties. * @param [properties] Properties to set - * @returns Rating instance + * @returns ExportErrorsConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRating): google.cloud.retail.v2alpha.Rating; + public static create(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes an ExportErrorsConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rating + * @returns ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rating; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rating + * @returns ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rating; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Verifies a Rating message. + * Verifies an ExportErrorsConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rating + * @returns ExportErrorsConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rating; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportErrorsConfig; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. - * @param message Rating + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @param message ExportErrorsConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rating to JSON. + * Converts this ExportErrorsConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserInfo. */ - interface IUserInfo { + /** Properties of an ExportMetadata. */ + interface IExportMetadata { - /** UserInfo userId */ - userId?: (string|null); + /** ExportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** UserInfo ipAddress */ - ipAddress?: (string|null); + /** ExportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } - /** UserInfo userAgent */ - userAgent?: (string|null); + /** Represents an ExportMetadata. */ + class ExportMetadata implements IExportMetadata { + + /** + * Constructs a new ExportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IExportMetadata); + + /** ExportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IExportMetadata): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Verifies an ExportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @param message ExportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportProductsResponse. */ + interface IExportProductsResponse { + + /** ExportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** UserInfo directUserRequest */ - directUserRequest?: (boolean|null); + /** ExportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); } - /** Represents a UserInfo. */ - class UserInfo implements IUserInfo { + /** Represents an ExportProductsResponse. */ + class ExportProductsResponse implements IExportProductsResponse { /** - * Constructs a new UserInfo. + * Constructs a new ExportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserInfo); - - /** UserInfo userId. */ - public userId: string; - - /** UserInfo ipAddress. */ - public ipAddress: string; + constructor(properties?: google.cloud.retail.v2alpha.IExportProductsResponse); - /** UserInfo userAgent. */ - public userAgent: string; + /** ExportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** UserInfo directUserRequest. */ - public directUserRequest: boolean; + /** ExportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new ExportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UserInfo instance + * @returns ExportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserInfo): google.cloud.retail.v2alpha.UserInfo; + public static create(properties?: google.cloud.retail.v2alpha.IExportProductsResponse): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an ExportProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserInfo + * @returns ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserInfo + * @returns ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Verifies a UserInfo message. + * Verifies an ExportProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserInfo + * @returns ExportProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportProductsResponse; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. - * @param message UserInfo + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @param message ExportProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserInfo to JSON. + * Converts this ExportProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Promotion. */ - interface IPromotion { + /** Properties of an ExportUserEventsResponse. */ + interface IExportUserEventsResponse { - /** Promotion promotionId */ - promotionId?: (string|null); + /** ExportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); } - /** Represents a Promotion. */ - class Promotion implements IPromotion { + /** Represents an ExportUserEventsResponse. */ + class ExportUserEventsResponse implements IExportUserEventsResponse { /** - * Constructs a new Promotion. + * Constructs a new ExportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPromotion); + constructor(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse); - /** Promotion promotionId. */ - public promotionId: string; + /** ExportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); /** - * Creates a new Promotion instance using the specified properties. + * Creates a new ExportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Promotion instance + * @returns ExportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPromotion): google.cloud.retail.v2alpha.Promotion; + public static create(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Promotion + * @returns ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Promotion; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Promotion + * @returns ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Promotion; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Verifies a Promotion message. + * Verifies an ExportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Promotion + * @returns ExportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Promotion; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. - * @param message Promotion + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @param message ExportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Promotion to JSON. + * Converts this ExportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a LocalInventory. */ - interface ILocalInventory { + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { - /** LocalInventory placeId */ - placeId?: (string|null); + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** LocalInventory priceInfo */ - priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; - /** LocalInventory attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; } - /** Represents a LocalInventory. */ - class LocalInventory implements ILocalInventory { + namespace PredictionService { /** - * Constructs a new LocalInventory. + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ILocalInventory); + constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); - /** LocalInventory placeId. */ - public placeId: string; + /** PredictRequest placement. */ + public placement: string; - /** LocalInventory priceInfo. */ - public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); - /** LocalInventory attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; /** - * Creates a new LocalInventory instance using the specified properties. + * Creates a new PredictRequest instance using the specified properties. * @param [properties] Properties to set - * @returns LocalInventory instance + * @returns PredictRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ILocalInventory): google.cloud.retail.v2alpha.LocalInventory; + public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; /** - * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. - * @param message LocalInventory message or plain object to encode + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. - * @param message LocalInventory message or plain object to encode + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a LocalInventory message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns LocalInventory + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.LocalInventory; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; /** - * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns LocalInventory + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.LocalInventory; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; /** - * Verifies a LocalInventory message. + * Verifies a PredictRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns LocalInventory + * @returns PredictRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.LocalInventory; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; /** - * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. - * @param message LocalInventory + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this LocalInventory to JSON. + * Converts this PredictRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { + /** Properties of a PredictResponse. */ + interface IPredictResponse { - /** GcsSource inputUris */ - inputUris?: (string[]|null); + /** PredictResponse results */ + results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { /** - * Constructs a new GcsSource. + * Constructs a new PredictResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IGcsSource); + constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); - /** GcsSource inputUris. */ - public inputUris: string[]; + /** PredictResponse results. */ + public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; - /** GcsSource dataSchema. */ - public dataSchema: string; + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new PredictResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns PredictResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGcsSource): google.cloud.retail.v2alpha.GcsSource; + public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; /** - * Verifies a GcsSource message. + * Verifies a PredictResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns PredictResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this PredictResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { - - /** BigQuerySource partitionDate */ - partitionDate?: (google.type.IDate|null); - - /** BigQuerySource projectId */ - projectId?: (string|null); - - /** BigQuerySource datasetId */ - datasetId?: (string|null); - - /** BigQuerySource tableId */ - tableId?: (string|null); + namespace PredictResponse { - /** BigQuerySource gcsStagingDir */ - gcsStagingDir?: (string|null); + /** Properties of a PredictionResult. */ + interface IPredictionResult { - /** BigQuerySource dataSchema */ - dataSchema?: (string|null); - } + /** PredictionResult id */ + id?: (string|null); - /** Represents a BigQuerySource. */ - class BigQuerySource implements IBigQuerySource { + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } - /** - * Constructs a new BigQuerySource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IBigQuerySource); + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { - /** BigQuerySource partitionDate. */ - public partitionDate?: (google.type.IDate|null); + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); - /** BigQuerySource projectId. */ - public projectId: string; + /** PredictionResult id. */ + public id: string; - /** BigQuerySource datasetId. */ - public datasetId: string; + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; - /** BigQuerySource tableId. */ - public tableId: string; + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - /** BigQuerySource gcsStagingDir. */ - public gcsStagingDir: string; + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** BigQuerySource dataSchema. */ - public dataSchema: string; + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** BigQuerySource partition. */ - public partition?: "partitionDate"; + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - /** - * Creates a new BigQuerySource instance using the specified properties. - * @param [properties] Properties to set - * @returns BigQuerySource instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IBigQuerySource): google.cloud.retail.v2alpha.BigQuerySource; + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; - /** - * Decodes a BigQuerySource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BigQuerySource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.BigQuerySource; + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BigQuerySource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.BigQuerySource; + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { /** - * Verifies a BigQuerySource message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static verify(message: { [k: string]: any }): (string|null); + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BigQuerySource + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.BigQuerySource; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. - * @param message BigQuerySource - * @param [options] Conversion options - * @returns Plain object + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - public static toObject(message: google.cloud.retail.v2alpha.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; /** - * Converts this BigQuerySource to JSON. - * @returns JSON object + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a ProductInlineSource. */ - interface IProductInlineSource { - - /** ProductInlineSource products */ - products?: (google.cloud.retail.v2alpha.IProduct[]|null); - } - - /** Represents a ProductInlineSource. */ - class ProductInlineSource implements IProductInlineSource { + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; /** - * Constructs a new ProductInlineSource. - * @param [properties] Properties to set + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - constructor(properties?: google.cloud.retail.v2alpha.IProductInlineSource); - - /** ProductInlineSource products. */ - public products: google.cloud.retail.v2alpha.IProduct[]; + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; /** - * Creates a new ProductInlineSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductInlineSource instance + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise */ - public static create(properties?: google.cloud.retail.v2alpha.IProductInlineSource): google.cloud.retail.v2alpha.ProductInlineSource; + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProductsResponse */ - public static encode(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ListProductsCallback): void; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest): Promise; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInlineSource; + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInlineSource; + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; /** - * Verifies a ProductInlineSource message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty */ - public static verify(message: { [k: string]: any }): (string|null); + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductInlineSource + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInlineSource; + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @param message ProductInlineSource - * @param [options] Conversion options - * @returns Plain object + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static toObject(message: google.cloud.retail.v2alpha.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; /** - * Converts this ProductInlineSource to JSON. - * @returns JSON object + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a UserEventInlineSource. */ - interface IUserEventInlineSource { - - /** UserEventInlineSource userEvents */ - userEvents?: (google.cloud.retail.v2alpha.IUserEvent[]|null); - } - - /** Represents a UserEventInlineSource. */ - class UserEventInlineSource implements IUserEventInlineSource { + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; /** - * Constructs a new UserEventInlineSource. - * @param [properties] Properties to set + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource); - - /** UserEventInlineSource userEvents. */ - public userEvents: google.cloud.retail.v2alpha.IUserEvent[]; + public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest, callback: google.cloud.retail.v2alpha.ProductService.SetInventoryCallback): void; /** - * Creates a new UserEventInlineSource instance using the specified properties. - * @param [properties] Properties to set - * @returns UserEventInlineSource instance + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @returns Promise */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEventInlineSource): google.cloud.retail.v2alpha.UserEventInlineSource; + public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest): Promise; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static encode(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback): void; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): Promise; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInlineSource; + public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback): void; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInlineSource; + public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; /** - * Verifies a UserEventInlineSource message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static verify(message: { [k: string]: any }): (string|null); + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback): void; /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UserEventInlineSource + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInlineSource; + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): Promise; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @param message UserEventInlineSource - * @param [options] Conversion options - * @returns Plain object + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static toObject(message: google.cloud.retail.v2alpha.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback): void; /** - * Converts this UserEventInlineSource to JSON. - * @returns JSON object + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of an ImportErrorsConfig. */ - interface IImportErrorsConfig { - - /** ImportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): Promise; } - /** Represents an ImportErrorsConfig. */ - class ImportErrorsConfig implements IImportErrorsConfig { + namespace ProductService { /** - * Constructs a new ImportErrorsConfig. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product */ - constructor(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig); - - /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; - /** ImportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; /** - * Creates a new ImportErrorsConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportErrorsConfig instance + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * @param error Error, if any + * @param [response] ListProductsResponse */ - public static create(properties?: google.cloud.retail.v2alpha.IImportErrorsConfig): google.cloud.retail.v2alpha.ImportErrorsConfig; + type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListProductsResponse) => void; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product */ - public static encode(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportErrorsConfig; + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * @param error Error, if any + * @param [response] Operation */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportErrorsConfig; + type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Verifies an ImportErrorsConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation */ - public static verify(message: { [k: string]: any }): (string|null); + type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportErrorsConfig + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportErrorsConfig; + type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @param message ImportErrorsConfig - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @param error Error, if any + * @param [response] Operation */ - public static toObject(message: google.cloud.retail.v2alpha.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Converts this ImportErrorsConfig to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of an ImportProductsRequest. */ - interface IImportProductsRequest { + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { - /** ImportProductsRequest parent */ + /** CreateProductRequest parent */ parent?: (string|null); - /** ImportProductsRequest requestId */ - requestId?: (string|null); - - /** ImportProductsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - - /** ImportProductsRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - - /** ImportProductsRequest reconciliationMode */ - reconciliationMode?: (google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null); + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); - /** ImportProductsRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** CreateProductRequest productId */ + productId?: (string|null); } - /** Represents an ImportProductsRequest. */ - class ImportProductsRequest implements IImportProductsRequest { + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { /** - * Constructs a new ImportProductsRequest. + * Constructs a new CreateProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportProductsRequest); + constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); - /** ImportProductsRequest parent. */ + /** CreateProductRequest parent. */ public parent: string; - /** ImportProductsRequest requestId. */ - public requestId: string; - - /** ImportProductsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2alpha.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - - /** ImportProductsRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** ImportProductsRequest reconciliationMode. */ - public reconciliationMode: (google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode); + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); - /** ImportProductsRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** CreateProductRequest productId. */ + public productId: string; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new CreateProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsRequest instance + * @returns CreateProductRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportProductsRequest): google.cloud.retail.v2alpha.ImportProductsRequest; + public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsRequest + * @returns CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsRequest + * @returns CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; /** - * Verifies an ImportProductsRequest message. + * Verifies a CreateProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsRequest + * @returns CreateProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @param message ImportProductsRequest + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this CreateProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ImportProductsRequest { - - /** ReconciliationMode enum. */ - enum ReconciliationMode { - RECONCILIATION_MODE_UNSPECIFIED = 0, - INCREMENTAL = 1, - FULL = 2 - } - } - - /** Properties of an ImportUserEventsRequest. */ - interface IImportUserEventsRequest { - - /** ImportUserEventsRequest parent */ - parent?: (string|null); - - /** ImportUserEventsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { - /** ImportUserEventsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** GetProductRequest name */ + name?: (string|null); } - /** Represents an ImportUserEventsRequest. */ - class ImportUserEventsRequest implements IImportUserEventsRequest { + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new GetProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest); - - /** ImportUserEventsRequest parent. */ - public parent: string; - - /** ImportUserEventsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2alpha.IUserEventInputConfig|null); + constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); - /** ImportUserEventsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** GetProductRequest name. */ + public name: string; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new GetProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsRequest instance + * @returns GetProductRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsRequest): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a GetProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsRequest + * @returns GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsRequest + * @returns GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a GetProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsRequest + * @returns GetProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @param message ImportUserEventsRequest + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this GetProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportCompletionDataRequest. */ - interface IImportCompletionDataRequest { + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { - /** ImportCompletionDataRequest parent */ - parent?: (string|null); + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); - /** ImportCompletionDataRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); - /** ImportCompletionDataRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** UpdateProductRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents an ImportCompletionDataRequest. */ - class ImportCompletionDataRequest implements IImportCompletionDataRequest { + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new UpdateProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportCompletionDataRequest); + constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); - /** ImportCompletionDataRequest parent. */ - public parent: string; + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); - /** ImportCompletionDataRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** ImportCompletionDataRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** UpdateProductRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new UpdateProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportCompletionDataRequest instance + * @returns UpdateProductRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportCompletionDataRequest): google.cloud.retail.v2alpha.ImportCompletionDataRequest; + public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes an UpdateProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportCompletionDataRequest + * @returns UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportCompletionDataRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataRequest + * @returns UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportCompletionDataRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies an UpdateProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportCompletionDataRequest + * @returns UpdateProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportCompletionDataRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. - * @param message ImportCompletionDataRequest + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this UpdateProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInputConfig. */ - interface IProductInputConfig { - - /** ProductInputConfig productInlineSource */ - productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); - - /** ProductInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { - /** ProductInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** DeleteProductRequest name */ + name?: (string|null); } - /** Represents a ProductInputConfig. */ - class ProductInputConfig implements IProductInputConfig { + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { /** - * Constructs a new ProductInputConfig. + * Constructs a new DeleteProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProductInputConfig); - - /** ProductInputConfig productInlineSource. */ - public productInlineSource?: (google.cloud.retail.v2alpha.IProductInlineSource|null); - - /** ProductInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); - - /** ProductInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); - /** ProductInputConfig source. */ - public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + /** DeleteProductRequest name. */ + public name: string; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new DeleteProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInputConfig instance + * @returns DeleteProductRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProductInputConfig): google.cloud.retail.v2alpha.ProductInputConfig; + public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInputConfig + * @returns DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInputConfig + * @returns DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; /** - * Verifies a ProductInputConfig message. + * Verifies a DeleteProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInputConfig + * @returns DeleteProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @param message ProductInputConfig + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInputConfig to JSON. + * Converts this DeleteProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInputConfig. */ - interface IUserEventInputConfig { + /** Properties of a ListProductsRequest. */ + interface IListProductsRequest { - /** UserEventInputConfig userEventInlineSource */ - userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + /** ListProductsRequest parent */ + parent?: (string|null); - /** UserEventInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** ListProductsRequest pageSize */ + pageSize?: (number|null); - /** UserEventInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** ListProductsRequest pageToken */ + pageToken?: (string|null); + + /** ListProductsRequest filter */ + filter?: (string|null); + + /** ListProductsRequest readMask */ + readMask?: (google.protobuf.IFieldMask|null); + + /** ListProductsRequest requireTotalSize */ + requireTotalSize?: (boolean|null); } - /** Represents a UserEventInputConfig. */ - class UserEventInputConfig implements IUserEventInputConfig { + /** Represents a ListProductsRequest. */ + class ListProductsRequest implements IListProductsRequest { /** - * Constructs a new UserEventInputConfig. + * Constructs a new ListProductsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig); + constructor(properties?: google.cloud.retail.v2alpha.IListProductsRequest); + + /** ListProductsRequest parent. */ + public parent: string; - /** UserEventInputConfig userEventInlineSource. */ - public userEventInlineSource?: (google.cloud.retail.v2alpha.IUserEventInlineSource|null); + /** ListProductsRequest pageSize. */ + public pageSize: number; - /** UserEventInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2alpha.IGcsSource|null); + /** ListProductsRequest pageToken. */ + public pageToken: string; - /** UserEventInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** ListProductsRequest filter. */ + public filter: string; - /** UserEventInputConfig source. */ - public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + /** ListProductsRequest readMask. */ + public readMask?: (google.protobuf.IFieldMask|null); + + /** ListProductsRequest requireTotalSize. */ + public requireTotalSize: boolean; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ListProductsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInputConfig instance + * @returns ListProductsRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEventInputConfig): google.cloud.retail.v2alpha.UserEventInputConfig; + public static create(properties?: google.cloud.retail.v2alpha.IListProductsRequest): google.cloud.retail.v2alpha.ListProductsRequest; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a ListProductsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInputConfig + * @returns ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListProductsRequest; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInputConfig + * @returns ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListProductsRequest; /** - * Verifies a UserEventInputConfig message. + * Verifies a ListProductsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInputConfig + * @returns ListProductsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListProductsRequest; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @param message UserEventInputConfig + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @param message ListProductsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this ListProductsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompletionDataInputConfig. */ - interface ICompletionDataInputConfig { + /** Properties of a ListProductsResponse. */ + interface IListProductsResponse { - /** CompletionDataInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** ListProductsResponse products */ + products?: (google.cloud.retail.v2alpha.IProduct[]|null); + + /** ListProductsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListProductsResponse totalSize */ + totalSize?: (number|null); } - /** Represents a CompletionDataInputConfig. */ - class CompletionDataInputConfig implements ICompletionDataInputConfig { + /** Represents a ListProductsResponse. */ + class ListProductsResponse implements IListProductsResponse { /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new ListProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICompletionDataInputConfig); + constructor(properties?: google.cloud.retail.v2alpha.IListProductsResponse); - /** CompletionDataInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2alpha.IBigQuerySource|null); + /** ListProductsResponse products. */ + public products: google.cloud.retail.v2alpha.IProduct[]; - /** CompletionDataInputConfig source. */ - public source?: "bigQuerySource"; + /** ListProductsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListProductsResponse totalSize. */ + public totalSize: number; /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * Creates a new ListProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDataInputConfig instance + * @returns ListProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICompletionDataInputConfig): google.cloud.retail.v2alpha.CompletionDataInputConfig; + public static create(properties?: google.cloud.retail.v2alpha.IListProductsResponse): google.cloud.retail.v2alpha.ListProductsResponse; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a ListProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDataInputConfig + * @returns ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionDataInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListProductsResponse; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDataInputConfig + * @returns ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionDataInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListProductsResponse; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a ListProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDataInputConfig + * @returns ListProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionDataInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListProductsResponse; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. - * @param message CompletionDataInputConfig + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @param message ListProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this ListProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportMetadata. */ - interface IImportMetadata { - - /** ImportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** ImportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** Properties of a SetInventoryRequest. */ + interface ISetInventoryRequest { - /** ImportMetadata successCount */ - successCount?: (number|Long|string|null); + /** SetInventoryRequest inventory */ + inventory?: (google.cloud.retail.v2alpha.IProduct|null); - /** ImportMetadata failureCount */ - failureCount?: (number|Long|string|null); + /** SetInventoryRequest setMask */ + setMask?: (google.protobuf.IFieldMask|null); - /** ImportMetadata requestId */ - requestId?: (string|null); + /** SetInventoryRequest setTime */ + setTime?: (google.protobuf.ITimestamp|null); - /** ImportMetadata notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** SetInventoryRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents an ImportMetadata. */ - class ImportMetadata implements IImportMetadata { + /** Represents a SetInventoryRequest. */ + class SetInventoryRequest implements ISetInventoryRequest { /** - * Constructs a new ImportMetadata. + * Constructs a new SetInventoryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportMetadata); - - /** ImportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** ImportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryRequest); - /** ImportMetadata successCount. */ - public successCount: (number|Long|string); + /** SetInventoryRequest inventory. */ + public inventory?: (google.cloud.retail.v2alpha.IProduct|null); - /** ImportMetadata failureCount. */ - public failureCount: (number|Long|string); + /** SetInventoryRequest setMask. */ + public setMask?: (google.protobuf.IFieldMask|null); - /** ImportMetadata requestId. */ - public requestId: string; + /** SetInventoryRequest setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); - /** ImportMetadata notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** SetInventoryRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new SetInventoryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportMetadata instance + * @returns SetInventoryRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportMetadata): google.cloud.retail.v2alpha.ImportMetadata; + public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryRequest): google.cloud.retail.v2alpha.SetInventoryRequest; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportMetadata + * @returns SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryRequest; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportMetadata + * @returns SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryRequest; /** - * Verifies an ImportMetadata message. + * Verifies a SetInventoryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportMetadata + * @returns SetInventoryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryRequest; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. - * @param message ImportMetadata + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @param message SetInventoryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportMetadata to JSON. + * Converts this SetInventoryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportProductsResponse. */ - interface IImportProductsResponse { - - /** ImportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - - /** ImportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + /** Properties of a SetInventoryMetadata. */ + interface ISetInventoryMetadata { } - /** Represents an ImportProductsResponse. */ - class ImportProductsResponse implements IImportProductsResponse { + /** Represents a SetInventoryMetadata. */ + class SetInventoryMetadata implements ISetInventoryMetadata { /** - * Constructs a new ImportProductsResponse. + * Constructs a new SetInventoryMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportProductsResponse); - - /** ImportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; - - /** ImportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); + constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryMetadata); /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsResponse instance + * @returns SetInventoryMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportProductsResponse): google.cloud.retail.v2alpha.ImportProductsResponse; + public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryMetadata): google.cloud.retail.v2alpha.SetInventoryMetadata; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsResponse + * @returns SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportProductsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryMetadata; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsResponse + * @returns SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportProductsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryMetadata; /** - * Verifies an ImportProductsResponse message. + * Verifies a SetInventoryMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsResponse + * @returns SetInventoryMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportProductsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryMetadata; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @param message ImportProductsResponse + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @param message SetInventoryMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this SetInventoryMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportUserEventsResponse. */ - interface IImportUserEventsResponse { - - /** ImportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - - /** ImportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - - /** ImportUserEventsResponse importSummary */ - importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); + /** Properties of a SetInventoryResponse. */ + interface ISetInventoryResponse { } - /** Represents an ImportUserEventsResponse. */ - class ImportUserEventsResponse implements IImportUserEventsResponse { + /** Represents a SetInventoryResponse. */ + class SetInventoryResponse implements ISetInventoryResponse { /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new SetInventoryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse); - - /** ImportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; - - /** ImportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IImportErrorsConfig|null); - - /** ImportUserEventsResponse importSummary. */ - public importSummary?: (google.cloud.retail.v2alpha.IUserEventImportSummary|null); + constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryResponse); /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsResponse instance + * @returns SetInventoryResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportUserEventsResponse): google.cloud.retail.v2alpha.ImportUserEventsResponse; + public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryResponse): google.cloud.retail.v2alpha.SetInventoryResponse; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsResponse + * @returns SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryResponse; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsResponse + * @returns SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryResponse; /** - * Verifies an ImportUserEventsResponse message. + * Verifies a SetInventoryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsResponse + * @returns SetInventoryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryResponse; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. - * @param message ImportUserEventsResponse + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @param message SetInventoryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this SetInventoryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventImportSummary. */ - interface IUserEventImportSummary { + /** Properties of an AddFulfillmentPlacesRequest. */ + interface IAddFulfillmentPlacesRequest { - /** UserEventImportSummary joinedEventsCount */ - joinedEventsCount?: (number|Long|string|null); + /** AddFulfillmentPlacesRequest product */ + product?: (string|null); - /** UserEventImportSummary unjoinedEventsCount */ - unjoinedEventsCount?: (number|Long|string|null); + /** AddFulfillmentPlacesRequest type */ + type?: (string|null); + + /** AddFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); + + /** AddFulfillmentPlacesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a UserEventImportSummary. */ - class UserEventImportSummary implements IUserEventImportSummary { + /** Represents an AddFulfillmentPlacesRequest. */ + class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { /** - * Constructs a new UserEventImportSummary. + * Constructs a new AddFulfillmentPlacesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary); + constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest); - /** UserEventImportSummary joinedEventsCount. */ - public joinedEventsCount: (number|Long|string); + /** AddFulfillmentPlacesRequest product. */ + public product: string; - /** UserEventImportSummary unjoinedEventsCount. */ - public unjoinedEventsCount: (number|Long|string); + /** AddFulfillmentPlacesRequest type. */ + public type: string; + + /** AddFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** AddFulfillmentPlacesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventImportSummary instance + * @returns AddFulfillmentPlacesRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEventImportSummary): google.cloud.retail.v2alpha.UserEventImportSummary; + public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventImportSummary + * @returns AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEventImportSummary; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventImportSummary + * @returns AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEventImportSummary; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; /** - * Verifies a UserEventImportSummary message. + * Verifies an AddFulfillmentPlacesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventImportSummary + * @returns AddFulfillmentPlacesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEventImportSummary; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @param message UserEventImportSummary + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportCompletionDataResponse. */ - interface IImportCompletionDataResponse { - - /** ImportCompletionDataResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** Properties of an AddFulfillmentPlacesMetadata. */ + interface IAddFulfillmentPlacesMetadata { } - /** Represents an ImportCompletionDataResponse. */ - class ImportCompletionDataResponse implements IImportCompletionDataResponse { + /** Represents an AddFulfillmentPlacesMetadata. */ + class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { /** - * Constructs a new ImportCompletionDataResponse. + * Constructs a new AddFulfillmentPlacesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IImportCompletionDataResponse); - - /** ImportCompletionDataResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata); /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ImportCompletionDataResponse instance + * @returns AddFulfillmentPlacesMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IImportCompletionDataResponse): google.cloud.retail.v2alpha.ImportCompletionDataResponse; + public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; - /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode + /** + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportCompletionDataResponse + * @returns AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ImportCompletionDataResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataResponse + * @returns AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ImportCompletionDataResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; /** - * Verifies an ImportCompletionDataResponse message. + * Verifies an AddFulfillmentPlacesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportCompletionDataResponse + * @returns AddFulfillmentPlacesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ImportCompletionDataResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. - * @param message ImportCompletionDataResponse + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportCompletionDataResponse to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Product. */ - interface IProduct { - - /** Product expireTime */ - expireTime?: (google.protobuf.ITimestamp|null); - - /** Product ttl */ - ttl?: (google.protobuf.IDuration|null); - - /** Product name */ - name?: (string|null); - - /** Product id */ - id?: (string|null); - - /** Product type */ - type?: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type|null); - - /** Product primaryProductId */ - primaryProductId?: (string|null); - - /** Product collectionMemberIds */ - collectionMemberIds?: (string[]|null); - - /** Product gtin */ - gtin?: (string|null); - - /** Product categories */ - categories?: (string[]|null); - - /** Product title */ - title?: (string|null); - - /** Product brands */ - brands?: (string[]|null); - - /** Product description */ - description?: (string|null); - - /** Product languageCode */ - languageCode?: (string|null); - - /** Product attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); - - /** Product tags */ - tags?: (string[]|null); - - /** Product priceInfo */ - priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - - /** Product rating */ - rating?: (google.cloud.retail.v2alpha.IRating|null); - - /** Product availableTime */ - availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability */ - availability?: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability|null); - - /** Product availableQuantity */ - availableQuantity?: (google.protobuf.IInt32Value|null); - - /** Product fulfillmentInfo */ - fulfillmentInfo?: (google.cloud.retail.v2alpha.IFulfillmentInfo[]|null); - - /** Product uri */ - uri?: (string|null); - - /** Product images */ - images?: (google.cloud.retail.v2alpha.IImage[]|null); - - /** Product audience */ - audience?: (google.cloud.retail.v2alpha.IAudience|null); - - /** Product colorInfo */ - colorInfo?: (google.cloud.retail.v2alpha.IColorInfo|null); - - /** Product sizes */ - sizes?: (string[]|null); - - /** Product materials */ - materials?: (string[]|null); - - /** Product patterns */ - patterns?: (string[]|null); - - /** Product conditions */ - conditions?: (string[]|null); - - /** Product promotions */ - promotions?: (google.cloud.retail.v2alpha.IPromotion[]|null); - - /** Product publishTime */ - publishTime?: (google.protobuf.ITimestamp|null); - - /** Product retrievableFields */ - retrievableFields?: (google.protobuf.IFieldMask|null); - - /** Product variants */ - variants?: (google.cloud.retail.v2alpha.IProduct[]|null); + /** Properties of an AddFulfillmentPlacesResponse. */ + interface IAddFulfillmentPlacesResponse { } - /** Represents a Product. */ - class Product implements IProduct { + /** Represents an AddFulfillmentPlacesResponse. */ + class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { /** - * Constructs a new Product. + * Constructs a new AddFulfillmentPlacesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProduct); - - /** Product expireTime. */ - public expireTime?: (google.protobuf.ITimestamp|null); - - /** Product ttl. */ - public ttl?: (google.protobuf.IDuration|null); - - /** Product name. */ - public name: string; - - /** Product id. */ - public id: string; - - /** Product type. */ - public type: (google.cloud.retail.v2alpha.Product.Type|keyof typeof google.cloud.retail.v2alpha.Product.Type); - - /** Product primaryProductId. */ - public primaryProductId: string; - - /** Product collectionMemberIds. */ - public collectionMemberIds: string[]; - - /** Product gtin. */ - public gtin: string; - - /** Product categories. */ - public categories: string[]; - - /** Product title. */ - public title: string; - - /** Product brands. */ - public brands: string[]; - - /** Product description. */ - public description: string; - - /** Product languageCode. */ - public languageCode: string; - - /** Product attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; - - /** Product tags. */ - public tags: string[]; - - /** Product priceInfo. */ - public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - - /** Product rating. */ - public rating?: (google.cloud.retail.v2alpha.IRating|null); - - /** Product availableTime. */ - public availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability. */ - public availability: (google.cloud.retail.v2alpha.Product.Availability|keyof typeof google.cloud.retail.v2alpha.Product.Availability); - - /** Product availableQuantity. */ - public availableQuantity?: (google.protobuf.IInt32Value|null); - - /** Product fulfillmentInfo. */ - public fulfillmentInfo: google.cloud.retail.v2alpha.IFulfillmentInfo[]; - - /** Product uri. */ - public uri: string; - - /** Product images. */ - public images: google.cloud.retail.v2alpha.IImage[]; - - /** Product audience. */ - public audience?: (google.cloud.retail.v2alpha.IAudience|null); - - /** Product colorInfo. */ - public colorInfo?: (google.cloud.retail.v2alpha.IColorInfo|null); - - /** Product sizes. */ - public sizes: string[]; - - /** Product materials. */ - public materials: string[]; - - /** Product patterns. */ - public patterns: string[]; - - /** Product conditions. */ - public conditions: string[]; - - /** Product promotions. */ - public promotions: google.cloud.retail.v2alpha.IPromotion[]; - - /** Product publishTime. */ - public publishTime?: (google.protobuf.ITimestamp|null); - - /** Product retrievableFields. */ - public retrievableFields?: (google.protobuf.IFieldMask|null); - - /** Product variants. */ - public variants: google.cloud.retail.v2alpha.IProduct[]; - - /** Product expiration. */ - public expiration?: ("expireTime"|"ttl"); + constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse); /** - * Creates a new Product instance using the specified properties. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Product instance + * @returns AddFulfillmentPlacesResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProduct): google.cloud.retail.v2alpha.Product; + public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. - * @param message Product message or plain object to encode + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. - * @param message Product message or plain object to encode + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Product + * @returns AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Product; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Product + * @returns AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Product; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; /** - * Verifies a Product message. + * Verifies an AddFulfillmentPlacesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Product + * @returns AddFulfillmentPlacesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Product; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Product to JSON. + * Converts this AddFulfillmentPlacesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Product { - - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - VARIANT = 2, - COLLECTION = 3 - } + /** Properties of an AddLocalInventoriesRequest. */ + interface IAddLocalInventoriesRequest { - /** Availability enum. */ - enum Availability { - AVAILABILITY_UNSPECIFIED = 0, - IN_STOCK = 1, - OUT_OF_STOCK = 2, - PREORDER = 3, - BACKORDER = 4 - } - } + /** AddLocalInventoriesRequest product */ + product?: (string|null); - /** Properties of a UserEvent. */ - interface IUserEvent { + /** AddLocalInventoriesRequest localInventories */ + localInventories?: (google.cloud.retail.v2alpha.ILocalInventory[]|null); - /** UserEvent eventType */ - eventType?: (string|null); + /** AddLocalInventoriesRequest addMask */ + addMask?: (google.protobuf.IFieldMask|null); - /** UserEvent visitorId */ - visitorId?: (string|null); + /** AddLocalInventoriesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); - /** UserEvent sessionId */ - sessionId?: (string|null); + /** AddLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); + } - /** UserEvent eventTime */ - eventTime?: (google.protobuf.ITimestamp|null); + /** Represents an AddLocalInventoriesRequest. */ + class AddLocalInventoriesRequest implements IAddLocalInventoriesRequest { - /** UserEvent experimentIds */ - experimentIds?: (string[]|null); + /** + * Constructs a new AddLocalInventoriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest); - /** UserEvent attributionToken */ - attributionToken?: (string|null); + /** AddLocalInventoriesRequest product. */ + public product: string; - /** UserEvent productDetails */ - productDetails?: (google.cloud.retail.v2alpha.IProductDetail[]|null); + /** AddLocalInventoriesRequest localInventories. */ + public localInventories: google.cloud.retail.v2alpha.ILocalInventory[]; - /** UserEvent completionDetail */ - completionDetail?: (google.cloud.retail.v2alpha.ICompletionDetail|null); + /** AddLocalInventoriesRequest addMask. */ + public addMask?: (google.protobuf.IFieldMask|null); - /** UserEvent attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + /** AddLocalInventoriesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); - /** UserEvent cartId */ - cartId?: (string|null); + /** AddLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; - /** UserEvent purchaseTransaction */ - purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; - /** UserEvent searchQuery */ - searchQuery?: (string|null); + /** + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent filter */ - filter?: (string|null); + /** + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent orderBy */ - orderBy?: (string|null); + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; - /** UserEvent offset */ - offset?: (number|null); + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; - /** UserEvent pageCategories */ - pageCategories?: (string[]|null); + /** + * Verifies an AddLocalInventoriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEvent userInfo */ - userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + /** + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; - /** UserEvent uri */ - uri?: (string|null); + /** + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message AddLocalInventoriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** UserEvent referrerUri */ - referrerUri?: (string|null); + /** + * Converts this AddLocalInventoriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** UserEvent pageViewId */ - pageViewId?: (string|null); + /** Properties of an AddLocalInventoriesMetadata. */ + interface IAddLocalInventoriesMetadata { } - /** Represents a UserEvent. */ - class UserEvent implements IUserEvent { + /** Represents an AddLocalInventoriesMetadata. */ + class AddLocalInventoriesMetadata implements IAddLocalInventoriesMetadata { /** - * Constructs a new UserEvent. + * Constructs a new AddLocalInventoriesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUserEvent); - - /** UserEvent eventType. */ - public eventType: string; - - /** UserEvent visitorId. */ - public visitorId: string; - - /** UserEvent sessionId. */ - public sessionId: string; - - /** UserEvent eventTime. */ - public eventTime?: (google.protobuf.ITimestamp|null); - - /** UserEvent experimentIds. */ - public experimentIds: string[]; - - /** UserEvent attributionToken. */ - public attributionToken: string; - - /** UserEvent productDetails. */ - public productDetails: google.cloud.retail.v2alpha.IProductDetail[]; - - /** UserEvent completionDetail. */ - public completionDetail?: (google.cloud.retail.v2alpha.ICompletionDetail|null); + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata); - /** UserEvent attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns AddLocalInventoriesMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; - /** UserEvent cartId. */ - public cartId: string; + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent purchaseTransaction. */ - public purchaseTransaction?: (google.cloud.retail.v2alpha.IPurchaseTransaction|null); + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent searchQuery. */ - public searchQuery: string; + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; - /** UserEvent filter. */ - public filter: string; + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; - /** UserEvent orderBy. */ - public orderBy: string; + /** + * Verifies an AddLocalInventoriesMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEvent offset. */ - public offset: number; + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddLocalInventoriesMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; - /** UserEvent pageCategories. */ - public pageCategories: string[]; + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message AddLocalInventoriesMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** UserEvent userInfo. */ - public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** UserEvent uri. */ - public uri: string; + /** Properties of an AddLocalInventoriesResponse. */ + interface IAddLocalInventoriesResponse { + } - /** UserEvent referrerUri. */ - public referrerUri: string; + /** Represents an AddLocalInventoriesResponse. */ + class AddLocalInventoriesResponse implements IAddLocalInventoriesResponse { - /** UserEvent pageViewId. */ - public pageViewId: string; + /** + * Constructs a new AddLocalInventoriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse); /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new AddLocalInventoriesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UserEvent instance + * @returns AddLocalInventoriesResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUserEvent): google.cloud.retail.v2alpha.UserEvent; + public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEvent + * @returns AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UserEvent; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEvent + * @returns AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UserEvent; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; /** - * Verifies a UserEvent message. + * Verifies an AddLocalInventoriesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEvent + * @returns AddLocalInventoriesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UserEvent; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @param message UserEvent + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message AddLocalInventoriesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEvent to JSON. + * Converts this AddLocalInventoriesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductDetail. */ - interface IProductDetail { + /** Properties of a RemoveLocalInventoriesRequest. */ + interface IRemoveLocalInventoriesRequest { - /** ProductDetail product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** RemoveLocalInventoriesRequest product */ + product?: (string|null); - /** ProductDetail quantity */ - quantity?: (google.protobuf.IInt32Value|null); + /** RemoveLocalInventoriesRequest placeIds */ + placeIds?: (string[]|null); + + /** RemoveLocalInventoriesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a ProductDetail. */ - class ProductDetail implements IProductDetail { + /** Represents a RemoveLocalInventoriesRequest. */ + class RemoveLocalInventoriesRequest implements IRemoveLocalInventoriesRequest { /** - * Constructs a new ProductDetail. + * Constructs a new RemoveLocalInventoriesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IProductDetail); + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest); - /** ProductDetail product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** RemoveLocalInventoriesRequest product. */ + public product: string; - /** ProductDetail quantity. */ - public quantity?: (google.protobuf.IInt32Value|null); + /** RemoveLocalInventoriesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveLocalInventoriesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveLocalInventoriesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductDetail instance + * @returns RemoveLocalInventoriesRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IProductDetail): google.cloud.retail.v2alpha.ProductDetail; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductDetail + * @returns RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ProductDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductDetail + * @returns RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ProductDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; /** - * Verifies a ProductDetail message. + * Verifies a RemoveLocalInventoriesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductDetail + * @returns RemoveLocalInventoriesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ProductDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @param message ProductDetail + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductDetail to JSON. + * Converts this RemoveLocalInventoriesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompletionDetail. */ - interface ICompletionDetail { - - /** CompletionDetail completionAttributionToken */ - completionAttributionToken?: (string|null); - - /** CompletionDetail selectedSuggestion */ - selectedSuggestion?: (string|null); - - /** CompletionDetail selectedPosition */ - selectedPosition?: (number|null); + /** Properties of a RemoveLocalInventoriesMetadata. */ + interface IRemoveLocalInventoriesMetadata { } - /** Represents a CompletionDetail. */ - class CompletionDetail implements ICompletionDetail { + /** Represents a RemoveLocalInventoriesMetadata. */ + class RemoveLocalInventoriesMetadata implements IRemoveLocalInventoriesMetadata { /** - * Constructs a new CompletionDetail. + * Constructs a new RemoveLocalInventoriesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICompletionDetail); - - /** CompletionDetail completionAttributionToken. */ - public completionAttributionToken: string; - - /** CompletionDetail selectedSuggestion. */ - public selectedSuggestion: string; - - /** CompletionDetail selectedPosition. */ - public selectedPosition: number; + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata); /** - * Creates a new CompletionDetail instance using the specified properties. + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDetail instance + * @returns RemoveLocalInventoriesMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICompletionDetail): google.cloud.retail.v2alpha.CompletionDetail; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDetail message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDetail + * @returns RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDetail + * @returns RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; /** - * Verifies a CompletionDetail message. + * Verifies a RemoveLocalInventoriesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDetail + * @returns RemoveLocalInventoriesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. - * @param message CompletionDetail + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDetail to JSON. + * Converts this RemoveLocalInventoriesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurchaseTransaction. */ - interface IPurchaseTransaction { - - /** PurchaseTransaction id */ - id?: (string|null); - - /** PurchaseTransaction revenue */ - revenue?: (number|null); - - /** PurchaseTransaction tax */ - tax?: (number|null); - - /** PurchaseTransaction cost */ - cost?: (number|null); - - /** PurchaseTransaction currencyCode */ - currencyCode?: (string|null); + /** Properties of a RemoveLocalInventoriesResponse. */ + interface IRemoveLocalInventoriesResponse { } - /** Represents a PurchaseTransaction. */ - class PurchaseTransaction implements IPurchaseTransaction { + /** Represents a RemoveLocalInventoriesResponse. */ + class RemoveLocalInventoriesResponse implements IRemoveLocalInventoriesResponse { /** - * Constructs a new PurchaseTransaction. + * Constructs a new RemoveLocalInventoriesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction); - - /** PurchaseTransaction id. */ - public id: string; - - /** PurchaseTransaction revenue. */ - public revenue: number; - - /** PurchaseTransaction tax. */ - public tax: number; - - /** PurchaseTransaction cost. */ - public cost: number; - - /** PurchaseTransaction currencyCode. */ - public currencyCode: string; + constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse); /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurchaseTransaction instance + * @returns RemoveLocalInventoriesResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurchaseTransaction): google.cloud.retail.v2alpha.PurchaseTransaction; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurchaseTransaction + * @returns RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurchaseTransaction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurchaseTransaction + * @returns RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurchaseTransaction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; /** - * Verifies a PurchaseTransaction message. + * Verifies a RemoveLocalInventoriesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurchaseTransaction + * @returns RemoveLocalInventoriesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurchaseTransaction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @param message PurchaseTransaction + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this RemoveLocalInventoriesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { + /** Properties of a RemoveFulfillmentPlacesRequest. */ + interface IRemoveFulfillmentPlacesRequest { - /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** RemoveFulfillmentPlacesRequest product */ + product?: (string|null); - /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + /** RemoveFulfillmentPlacesRequest type */ + type?: (string|null); - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse - */ - public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest, callback: google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback): void; + /** RemoveFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise - */ - public listCatalogs(request: google.cloud.retail.v2alpha.IListCatalogsRequest): Promise; + /** RemoveFulfillmentPlacesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents a RemoveFulfillmentPlacesRequest. */ + class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog + * Constructs a new RemoveFulfillmentPlacesRequest. + * @param [properties] Properties to set */ - public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback): void; + constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest); + + /** RemoveFulfillmentPlacesRequest product. */ + public product: string; + + /** RemoveFulfillmentPlacesRequest type. */ + public type: string; + + /** RemoveFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** RemoveFulfillmentPlacesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); + + /** RemoveFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveFulfillmentPlacesRequest instance */ - public updateCatalog(request: google.cloud.retail.v2alpha.IUpdateCatalogRequest): Promise; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public setDefaultBranch(request: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, callback: google.cloud.retail.v2alpha.CatalogService.SetDefaultBranchCallback): void; + public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @returns Promise + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public setDefaultBranch(request: google.cloud.retail.v2alpha.ISetDefaultBranchRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, callback: google.cloud.retail.v2alpha.CatalogService.GetDefaultBranchCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @returns Promise + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): Promise; - } - - namespace CatalogService { + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse + * Verifies a RemoveFulfillmentPlacesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveFulfillmentPlacesRequest */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. - * @param error Error, if any - * @param [response] Empty + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesRequest + * @param [options] Conversion options + * @returns Plain object */ - type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. - * @param error Error, if any - * @param [response] GetDefaultBranchResponse + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @returns JSON object */ - type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.GetDefaultBranchResponse) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { - - /** ListCatalogsRequest parent */ - parent?: (string|null); - - /** ListCatalogsRequest pageSize */ - pageSize?: (number|null); - - /** ListCatalogsRequest pageToken */ - pageToken?: (string|null); + /** Properties of a RemoveFulfillmentPlacesMetadata. */ + interface IRemoveFulfillmentPlacesMetadata { } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents a RemoveFulfillmentPlacesMetadata. */ + class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new RemoveFulfillmentPlacesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); - - /** ListCatalogsRequest parent. */ - public parent: string; - - /** ListCatalogsRequest pageSize. */ - public pageSize: number; - - /** ListCatalogsRequest pageToken. */ - public pageToken: string; + constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata); /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns RemoveFulfillmentPlacesMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; /** - * Verifies a ListCatalogsRequest message. + * Verifies a RemoveFulfillmentPlacesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns RemoveFulfillmentPlacesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this RemoveFulfillmentPlacesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { - - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2alpha.ICatalog[]|null); - - /** ListCatalogsResponse nextPageToken */ - nextPageToken?: (string|null); + /** Properties of a RemoveFulfillmentPlacesResponse. */ + interface IRemoveFulfillmentPlacesResponse { } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { + /** Represents a RemoveFulfillmentPlacesResponse. */ + class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { /** - * Constructs a new ListCatalogsResponse. + * Constructs a new RemoveFulfillmentPlacesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse); - - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2alpha.ICatalog[]; - - /** ListCatalogsResponse nextPageToken. */ - public nextPageToken: string; + constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse); /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance + * @returns RemoveFulfillmentPlacesResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IListCatalogsResponse): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; /** - * Verifies a ListCatalogsResponse message. + * Verifies a RemoveFulfillmentPlacesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns RemoveFulfillmentPlacesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this RemoveFulfillmentPlacesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { - - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2alpha.ICatalog|null); - - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new PurgeMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest); - - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2alpha.ICatalog|null); - - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + constructor(properties?: google.cloud.retail.v2alpha.IPurgeMetadata); /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new PurgeMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns PurgeMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUpdateCatalogRequest): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2alpha.IPurgeMetadata): google.cloud.retail.v2alpha.PurgeMetadata; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a PurgeMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeMetadata; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeMetadata; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a PurgeMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns PurgeMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this PurgeMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetDefaultBranchRequest. */ - interface ISetDefaultBranchRequest { + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { - /** SetDefaultBranchRequest catalog */ - catalog?: (string|null); + /** PurgeUserEventsRequest parent */ + parent?: (string|null); - /** SetDefaultBranchRequest branchId */ - branchId?: (string|null); + /** PurgeUserEventsRequest filter */ + filter?: (string|null); - /** SetDefaultBranchRequest note */ - note?: (string|null); + /** PurgeUserEventsRequest force */ + force?: (boolean|null); } - /** Represents a SetDefaultBranchRequest. */ - class SetDefaultBranchRequest implements ISetDefaultBranchRequest { + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { /** - * Constructs a new SetDefaultBranchRequest. + * Constructs a new PurgeUserEventsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISetDefaultBranchRequest); + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest); - /** SetDefaultBranchRequest catalog. */ - public catalog: string; + /** PurgeUserEventsRequest parent. */ + public parent: string; - /** SetDefaultBranchRequest branchId. */ - public branchId: string; + /** PurgeUserEventsRequest filter. */ + public filter: string; - /** SetDefaultBranchRequest note. */ - public note: string; + /** PurgeUserEventsRequest force. */ + public force: boolean; /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. + * Creates a new PurgeUserEventsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns SetDefaultBranchRequest instance + * @returns PurgeUserEventsRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISetDefaultBranchRequest): google.cloud.retail.v2alpha.SetDefaultBranchRequest; + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): google.cloud.retail.v2alpha.PurgeUserEventsRequest; /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetDefaultBranchRequest + * @returns PurgeUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetDefaultBranchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsRequest; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetDefaultBranchRequest + * @returns PurgeUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetDefaultBranchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsRequest; /** - * Verifies a SetDefaultBranchRequest message. + * Verifies a PurgeUserEventsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetDefaultBranchRequest + * @returns PurgeUserEventsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetDefaultBranchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsRequest; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message SetDefaultBranchRequest + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetDefaultBranchRequest to JSON. + * Converts this PurgeUserEventsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetDefaultBranchRequest. */ - interface IGetDefaultBranchRequest { + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { - /** GetDefaultBranchRequest catalog */ - catalog?: (string|null); + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); } - /** Represents a GetDefaultBranchRequest. */ - class GetDefaultBranchRequest implements IGetDefaultBranchRequest { + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { /** - * Constructs a new GetDefaultBranchRequest. + * Constructs a new PurgeUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchRequest); + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); - /** GetDefaultBranchRequest catalog. */ - public catalog: string; + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. + * Creates a new PurgeUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchRequest instance + * @returns PurgeUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): google.cloud.retail.v2alpha.GetDefaultBranchRequest; + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetDefaultBranchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetDefaultBranchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Verifies a GetDefaultBranchRequest message. + * Verifies a PurgeUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchRequest + * @returns PurgeUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetDefaultBranchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message GetDefaultBranchRequest + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { + + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2alpha.ISearchRequest, callback: google.cloud.retail.v2alpha.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2alpha.ISearchRequest): Promise; + } + + namespace SearchService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse + */ + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.SearchResponse) => void; + } + + /** Properties of a SearchRequest. */ + interface ISearchRequest { + + /** SearchRequest placement */ + placement?: (string|null); + + /** SearchRequest branch */ + branch?: (string|null); + + /** SearchRequest query */ + query?: (string|null); + + /** SearchRequest visitorId */ + visitorId?: (string|null); + + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** SearchRequest pageSize */ + pageSize?: (number|null); + + /** SearchRequest pageToken */ + pageToken?: (string|null); + + /** SearchRequest offset */ + offset?: (number|null); + + /** SearchRequest filter */ + filter?: (string|null); + + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); + + /** SearchRequest orderBy */ + orderBy?: (string|null); + + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]|null); + + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest relevanceThreshold */ + relevanceThreshold?: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null); + + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode|null); + } + + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { + + /** + * Constructs a new SearchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISearchRequest); + + /** SearchRequest placement. */ + public placement: string; + + /** SearchRequest branch. */ + public branch: string; + + /** SearchRequest query. */ + public query: string; + + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; - /** - * Converts this GetDefaultBranchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; - /** Properties of a GetDefaultBranchResponse. */ - interface IGetDefaultBranchResponse { + /** SearchRequest orderBy. */ + public orderBy: string; - /** GetDefaultBranchResponse branch */ - branch?: (string|null); + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]; - /** GetDefaultBranchResponse setTime */ - setTime?: (google.protobuf.ITimestamp|null); + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - /** GetDefaultBranchResponse note */ - note?: (string|null); - } + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); - /** Represents a GetDefaultBranchResponse. */ - class GetDefaultBranchResponse implements IGetDefaultBranchResponse { + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); - /** - * Constructs a new GetDefaultBranchResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchResponse); + /** SearchRequest relevanceThreshold. */ + public relevanceThreshold: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold); - /** GetDefaultBranchResponse branch. */ - public branch: string; + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; - /** GetDefaultBranchResponse setTime. */ - public setTime?: (google.protobuf.ITimestamp|null); + /** SearchRequest pageCategories. */ + public pageCategories: string[]; - /** GetDefaultBranchResponse note. */ - public note: string; + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode); /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. + * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchResponse instance + * @returns SearchRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGetDefaultBranchResponse): google.cloud.retail.v2alpha.GetDefaultBranchResponse; + public static create(properties?: google.cloud.retail.v2alpha.ISearchRequest): google.cloud.retail.v2alpha.SearchRequest; /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchResponse + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetDefaultBranchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchResponse + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetDefaultBranchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest; /** - * Verifies a GetDefaultBranchResponse message. + * Verifies a SearchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchResponse + * @returns SearchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetDefaultBranchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest; /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. - * @param message GetDefaultBranchResponse + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetDefaultBranchResponse to JSON. + * Converts this SearchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CompletionService */ - class CompletionService extends $protobuf.rpc.Service { + namespace SearchRequest { + + /** Properties of a FacetSpec. */ + interface IFacetSpec { + + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit */ + limit?: (number|null); + + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); + + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } + + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { + + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec); + + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); + + /** FacetSpec limit. */ + public limit: number; + + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; + + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FacetSpec { + + /** Properties of a FacetKey. */ + interface IFacetKey { + + /** FacetKey key */ + key?: (string|null); + + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2alpha.IInterval[]|null); + + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2alpha.IInterval[]; + + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; + + /** FacetKey prefixes. */ + public prefixes: string[]; + + /** FacetKey contains. */ + public contains: string[]; + + /** FacetKey orderBy. */ + public orderBy: string; - /** - * Constructs a new CompletionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** FacetKey query. */ + public query: string; - /** - * Creates new CompletionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse - */ - public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest, callback: google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback): void; + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @returns Promise - */ - public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest): Promise; + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest, callback: google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback): void; + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @returns Promise - */ - public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest): Promise; - } + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - namespace CompletionService { + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. - * @param error Error, if any - * @param [response] CompleteQueryResponse - */ - type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompleteQueryResponse) => void; + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Properties of a CompleteQueryRequest. */ - interface ICompleteQueryRequest { + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** CompleteQueryRequest catalog */ - catalog?: (string|null); + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { - /** CompleteQueryRequest query */ - query?: (string|null); + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null); + } - /** CompleteQueryRequest visitorId */ - visitorId?: (string|null); + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { - /** CompleteQueryRequest languageCodes */ - languageCodes?: (string[]|null); + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec); - /** CompleteQueryRequest deviceType */ - deviceType?: (string|null); + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode); - /** CompleteQueryRequest dataset */ - dataset?: (string|null); + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; - /** CompleteQueryRequest maxSuggestions */ - maxSuggestions?: (number|null); - } + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a CompleteQueryRequest. */ - class CompleteQueryRequest implements ICompleteQueryRequest { + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new CompleteQueryRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest); + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; - /** CompleteQueryRequest catalog. */ - public catalog: string; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; - /** CompleteQueryRequest query. */ - public query: string; + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** CompleteQueryRequest visitorId. */ - public visitorId: string; + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; - /** CompleteQueryRequest languageCodes. */ - public languageCodes: string[]; + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** CompleteQueryRequest deviceType. */ - public deviceType: string; + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** CompleteQueryRequest dataset. */ - public dataset: string; + namespace DynamicFacetSpec { - /** CompleteQueryRequest maxSuggestions. */ - public maxSuggestions: number; + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } - /** - * Creates a new CompleteQueryRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CompleteQueryRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest): google.cloud.retail.v2alpha.CompleteQueryRequest; + /** Properties of a BoostSpec. */ + interface IBoostSpec { + + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } - /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { - /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec); - /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompleteQueryRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryRequest; + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]; - /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompleteQueryRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryRequest; + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; - /** - * Verifies a CompleteQueryRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompleteQueryRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryRequest; + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. - * @param message CompleteQueryRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; - /** - * Converts this CompleteQueryRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; - /** Properties of a CompleteQueryResponse. */ - interface ICompleteQueryResponse { + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** CompleteQueryResponse completionResults */ - completionResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]|null); + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; - /** CompleteQueryResponse attributionToken */ - attributionToken?: (string|null); + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** CompleteQueryResponse recentSearchResults */ - recentSearchResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]|null); - } + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Represents a CompleteQueryResponse. */ - class CompleteQueryResponse implements ICompleteQueryResponse { + namespace BoostSpec { - /** - * Constructs a new CompleteQueryResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse); + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { - /** CompleteQueryResponse completionResults. */ - public completionResults: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]; + /** ConditionBoostSpec condition */ + condition?: (string|null); - /** CompleteQueryResponse attributionToken. */ - public attributionToken: string; + /** ConditionBoostSpec boost */ + boost?: (number|null); + } - /** CompleteQueryResponse recentSearchResults. */ - public recentSearchResults: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]; + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { - /** - * Creates a new CompleteQueryResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns CompleteQueryResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse): google.cloud.retail.v2alpha.CompleteQueryResponse; + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec); - /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** ConditionBoostSpec condition. */ + public condition: string; - /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** ConditionBoostSpec boost. */ + public boost: number; - /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompleteQueryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse; + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; - /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompleteQueryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse; + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a CompleteQueryResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompleteQueryResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse; + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; - /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. - * @param message CompleteQueryResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this CompleteQueryResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; - namespace CompleteQueryResponse { + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Properties of a CompletionResult. */ - interface ICompletionResult { + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** CompletionResult suggestion */ - suggestion?: (string|null); + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { - /** CompletionResult attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null); + + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); } - /** Represents a CompletionResult. */ - class CompletionResult implements ICompletionResult { + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { /** - * Constructs a new CompletionResult. + * Constructs a new QueryExpansionSpec. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult); + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec); - /** CompletionResult suggestion. */ - public suggestion: string; + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition); - /** CompletionResult attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; /** - * Creates a new CompletionResult instance using the specified properties. + * Creates a new QueryExpansionSpec instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionResult instance + * @returns QueryExpansionSpec instance */ - public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionResult message from the specified reader or buffer. + * Decodes a QueryExpansionSpec message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionResult + * @returns QueryExpansionSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionResult + * @returns QueryExpansionSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; /** - * Verifies a CompletionResult message. + * Verifies a QueryExpansionSpec message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionResult + * @returns QueryExpansionSpec */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @param message CompletionResult + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionResult to JSON. + * Converts this QueryExpansionSpec to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RecentSearchResult. */ - interface IRecentSearchResult { + namespace QueryExpansionSpec { - /** RecentSearchResult recentSearch */ - recentSearch?: (string|null); + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } } - /** Represents a RecentSearchResult. */ - class RecentSearchResult implements IRecentSearchResult { + /** RelevanceThreshold enum. */ + enum RelevanceThreshold { + RELEVANCE_THRESHOLD_UNSPECIFIED = 0, + HIGH = 1, + MEDIUM = 2, + LOW = 3, + LOWEST = 4 + } - /** - * Constructs a new RecentSearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult); + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } + } - /** RecentSearchResult recentSearch. */ - public recentSearch: string; + /** Properties of a SearchResponse. */ + interface ISearchResponse { - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns RecentSearchResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** SearchResponse results */ + results?: (google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null); - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2alpha.SearchResponse.IFacet[]|null); - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchResponse totalSize */ + totalSize?: (number|null); - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** SearchResponse attributionToken */ + attributionToken?: (string|null); - /** - * Verifies a RecentSearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RecentSearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @param message RecentSearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** SearchResponse redirectUri */ + redirectUri?: (string|null); - /** - * Converts this RecentSearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); } - /** Properties of an ExportErrorsConfig. */ - interface IExportErrorsConfig { + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { - /** ExportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); - } + /** + * Constructs a new SearchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISearchResponse); + + /** SearchResponse results. */ + public results: google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]; + + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2alpha.SearchResponse.IFacet[]; + + /** SearchResponse totalSize. */ + public totalSize: number; + + /** SearchResponse correctedQuery. */ + public correctedQuery: string; - /** Represents an ExportErrorsConfig. */ - class ExportErrorsConfig implements IExportErrorsConfig { + /** SearchResponse attributionToken. */ + public attributionToken: string; - /** - * Constructs a new ExportErrorsConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig); + /** SearchResponse nextPageToken. */ + public nextPageToken: string; - /** ExportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); - /** ExportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** SearchResponse redirectUri. */ + public redirectUri: string; + + /** SearchResponse appliedControls. */ + public appliedControls: string[]; /** - * Creates a new ExportErrorsConfig instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ExportErrorsConfig instance + * @returns SearchResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static create(properties?: google.cloud.retail.v2alpha.ISearchResponse): google.cloud.retail.v2alpha.SearchResponse; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. - * @param message ExportErrorsConfig message or plain object to encode + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. - * @param message ExportErrorsConfig message or plain object to encode + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ExportErrorsConfig + * @returns SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ExportErrorsConfig + * @returns SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse; /** - * Verifies an ExportErrorsConfig message. + * Verifies a SearchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ExportErrorsConfig + * @returns SearchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. - * @param message ExportErrorsConfig + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ExportErrorsConfig to JSON. + * Converts this SearchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ExportMetadata. */ - interface IExportMetadata { + namespace SearchResponse { - /** ExportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** Properties of a SearchResult. */ + interface ISearchResult { - /** ExportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - } + /** SearchResult id */ + id?: (string|null); - /** Represents an ExportMetadata. */ - class ExportMetadata implements IExportMetadata { + /** SearchResult product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); - /** - * Constructs a new ExportMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IExportMetadata); + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); - /** ExportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); - /** ExportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } - /** - * Creates a new ExportMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportMetadata instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IExportMetadata): google.cloud.retail.v2alpha.ExportMetadata; + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { - /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. - * @param message ExportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult); - /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. - * @param message ExportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchResult id. */ + public id: string; - /** - * Decodes an ExportMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportMetadata; + /** SearchResult product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); - /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportMetadata; + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; - /** - * Verifies an ExportMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; - /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportMetadata; + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; - /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. - * @param message ExportMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult): google.cloud.retail.v2alpha.SearchResponse.SearchResult; - /** - * Converts this ExportMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of an ExportProductsResponse. */ - interface IExportProductsResponse { + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** ExportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.SearchResult; - /** ExportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); - } + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.SearchResult; - /** Represents an ExportProductsResponse. */ - class ExportProductsResponse implements IExportProductsResponse { + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Constructs a new ExportProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IExportProductsResponse); + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ExportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** Properties of a Facet. */ + interface IFacet { - /** ExportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** Facet key */ + key?: (string|null); - /** - * Creates a new ExportProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportProductsResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IExportProductsResponse): google.cloud.retail.v2alpha.ExportProductsResponse; + /** Facet values */ + values?: (google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]|null); - /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. - * @param message ExportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } - /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. - * @param message ExportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a Facet. */ + class Facet implements IFacet { - /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportProductsResponse; + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet); - /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportProductsResponse; + /** Facet key. */ + public key: string; - /** - * Verifies an ExportProductsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Facet values. */ + public values: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]; - /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportProductsResponse; + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; - /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. - * @param message ExportProductsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet): google.cloud.retail.v2alpha.SearchResponse.Facet; - /** - * Converts this ExportProductsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of an ExportUserEventsResponse. */ - interface IExportUserEventsResponse { + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; - /** ExportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet; - /** ExportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); - } + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet; - /** Represents an ExportUserEventsResponse. */ - class ExportUserEventsResponse implements IExportUserEventsResponse { + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Constructs a new ExportUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse); + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet; - /** ExportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** ExportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a new ExportUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportUserEventsResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse): google.cloud.retail.v2alpha.ExportUserEventsResponse; + namespace Facet { - /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of a FacetValue. */ + interface IFacetValue { - /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetValue value */ + value?: (string|null); - /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; + /** FacetValue interval */ + interval?: (google.cloud.retail.v2alpha.IInterval|null); - /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; + /** FacetValue count */ + count?: (number|Long|string|null); + } - /** - * Verifies an ExportUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { - /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportUserEventsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue); - /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. - * @param message ExportUserEventsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** FacetValue value. */ + public value?: (string|null); - /** - * Converts this ExportUserEventsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2alpha.IInterval|null); - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { + /** FacetValue count. */ + public count: (number|Long|string); - /** - * Constructs a new PredictionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); - /** - * Creates new PredictionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse - */ - public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @returns Promise - */ - public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; - } + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; - namespace PredictionService { + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; - /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. - * @param error Error, if any - * @param [response] PredictResponse - */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; - } + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; - /** Properties of a PredictRequest. */ - interface IPredictRequest { + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** PredictRequest placement */ - placement?: (string|null); + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** PredictRequest pageSize */ - pageSize?: (number|null); + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** PredictRequest pageToken */ - pageToken?: (string|null); + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { - /** PredictRequest filter */ - filter?: (string|null); + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); + } - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); - } + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo); - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; - /** - * Constructs a new PredictRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); - /** PredictRequest placement. */ - public placement: string; + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; - /** PredictRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** PredictRequest pageSize. */ - public pageSize: number; + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** PredictRequest pageToken. */ - public pageToken: string; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; - /** PredictRequest filter. */ - public filter: string; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; - /** PredictRequest validateOnly. */ - public validateOnly: boolean; + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** PredictRequest params. */ - public params: { [k: string]: google.protobuf.IValue }; + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; - /** PredictRequest labels. */ - public labels: { [k: string]: string }; + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a new PredictRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a UserEventService */ + class UserEventService extends $protobuf.rpc.Service { /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Constructs a new UserEventService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Decodes a PredictRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Creates new UserEventService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UserEvent */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; + public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback): void; /** - * Verifies a PredictRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls WriteUserEvent. + * @param request WriteUserEventRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest): Promise; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictRequest + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and HttpBody */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; + public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback): void; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @param message PredictRequest - * @param [options] Conversion options - * @returns Plain object + * Calls CollectUserEvent. + * @param request CollectUserEventRequest message or plain object + * @returns Promise */ - public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest): Promise; /** - * Converts this PredictRequest to JSON. - * @returns JSON object + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a PredictResponse. */ - interface IPredictResponse { - - /** PredictResponse results */ - results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); - - /** PredictResponse attributionToken */ - attributionToken?: (string|null); - - /** PredictResponse missingIds */ - missingIds?: (string[]|null); - - /** PredictResponse validateOnly */ - validateOnly?: (boolean|null); - } - - /** Represents a PredictResponse. */ - class PredictResponse implements IPredictResponse { + public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback): void; /** - * Constructs a new PredictResponse. - * @param [properties] Properties to set + * Calls PurgeUserEvents. + * @param request PurgeUserEventsRequest message or plain object + * @returns Promise */ - constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); - - /** PredictResponse results. */ - public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; - - /** PredictResponse attributionToken. */ - public attributionToken: string; - - /** PredictResponse missingIds. */ - public missingIds: string[]; - - /** PredictResponse validateOnly. */ - public validateOnly: boolean; + public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): Promise; /** - * Creates a new PredictResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictResponse instance + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; + public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback): void; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ImportUserEvents. + * @param request ImportUserEventsRequest message or plain object + * @returns Promise */ - public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest): Promise; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback): void; /** - * Decodes a PredictResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls RejoinUserEvents. + * @param request RejoinUserEventsRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; + public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): Promise; + } + + namespace UserEventService { /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * @param error Error, if any + * @param [response] UserEvent */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; + type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.UserEvent) => void; /** - * Verifies a PredictResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * @param error Error, if any + * @param [response] HttpBody */ - public static verify(message: { [k: string]: any }): (string|null); + type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictResponse + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * @param error Error, if any + * @param [response] Operation */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; + type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. - * @param message PredictResponse - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * @param error Error, if any + * @param [response] Operation */ - public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Converts this PredictResponse to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - namespace PredictResponse { - - /** Properties of a PredictionResult. */ - interface IPredictionResult { - - /** PredictionResult id */ - id?: (string|null); - - /** PredictionResult metadata */ - metadata?: ({ [k: string]: google.protobuf.IValue }|null); - } - - /** Represents a PredictionResult. */ - class PredictionResult implements IPredictionResult { - - /** - * Constructs a new PredictionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); - - /** PredictionResult id. */ - public id: string; - - /** PredictionResult metadata. */ - public metadata: { [k: string]: google.protobuf.IValue }; + /** Properties of a WriteUserEventRequest. */ + interface IWriteUserEventRequest { - /** - * Creates a new PredictionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictionResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + /** WriteUserEventRequest parent */ + parent?: (string|null); - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** WriteUserEventRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + } - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a WriteUserEventRequest. */ + class WriteUserEventRequest implements IWriteUserEventRequest { - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + /** + * Constructs a new WriteUserEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest); - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + /** WriteUserEventRequest parent. */ + public parent: string; - /** - * Verifies a PredictionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** WriteUserEventRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WriteUserEventRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest): google.cloud.retail.v2alpha.WriteUserEventRequest; - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @param message PredictionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this PredictionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @param message WriteUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a ProductService */ - class ProductService extends $protobuf.rpc.Service { + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.WriteUserEventRequest; /** - * Constructs a new ProductService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.WriteUserEventRequest; /** - * Creates new ProductService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Verifies a WriteUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WriteUserEventRequest */ - public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.WriteUserEventRequest; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @param message WriteUserEventRequest + * @param [options] Conversion options + * @returns Plain object */ - public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; + public static toObject(message: google.cloud.retail.v2alpha.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Converts this WriteUserEventRequest to JSON. + * @returns JSON object */ - public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectUserEventRequest. */ + interface ICollectUserEventRequest { + + /** CollectUserEventRequest parent */ + parent?: (string|null); + + /** CollectUserEventRequest userEvent */ + userEvent?: (string|null); + + /** CollectUserEventRequest uri */ + uri?: (string|null); + + /** CollectUserEventRequest ets */ + ets?: (number|Long|string|null); + } + + /** Represents a CollectUserEventRequest. */ + class CollectUserEventRequest implements ICollectUserEventRequest { /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise + * Constructs a new CollectUserEventRequest. + * @param [properties] Properties to set */ - public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; + constructor(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest); + + /** CollectUserEventRequest parent. */ + public parent: string; + + /** CollectUserEventRequest userEvent. */ + public userEvent: string; + + /** CollectUserEventRequest uri. */ + public uri: string; + + /** CollectUserEventRequest ets. */ + public ets: (number|Long|string); /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsResponse + * Creates a new CollectUserEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectUserEventRequest instance */ - public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ListProductsCallback): void; + public static create(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest): google.cloud.retail.v2alpha.CollectUserEventRequest; /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @returns Promise + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest): Promise; + public static encode(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @param message CollectUserEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CollectUserEventRequest; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CollectUserEventRequest; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise + * Verifies a CollectUserEventRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectUserEventRequest */ - public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CollectUserEventRequest; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @returns Promise + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @param message CollectUserEventRequest + * @param [options] Conversion options + * @returns Plain object */ - public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; + public static toObject(message: google.cloud.retail.v2alpha.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls SetInventory. - * @param request SetInventoryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Converts this CollectUserEventRequest to JSON. + * @returns JSON object */ - public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest, callback: google.cloud.retail.v2alpha.ProductService.SetInventoryCallback): void; + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RejoinUserEventsRequest. */ + interface IRejoinUserEventsRequest { + + /** RejoinUserEventsRequest parent */ + parent?: (string|null); + + /** RejoinUserEventsRequest userEventRejoinScope */ + userEventRejoinScope?: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null); + } + + /** Represents a RejoinUserEventsRequest. */ + class RejoinUserEventsRequest implements IRejoinUserEventsRequest { /** - * Calls SetInventory. - * @param request SetInventoryRequest message or plain object - * @returns Promise + * Constructs a new RejoinUserEventsRequest. + * @param [properties] Properties to set */ - public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest): Promise; + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest); + + /** RejoinUserEventsRequest parent. */ + public parent: string; + + /** RejoinUserEventsRequest userEventRejoinScope. */ + public userEventRejoinScope: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope); /** - * Calls AddFulfillmentPlaces. - * @param request AddFulfillmentPlacesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsRequest instance */ - public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback): void; + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls AddFulfillmentPlaces. - * @param request AddFulfillmentPlacesRequest message or plain object - * @returns Promise + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * @param message RejoinUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls RemoveFulfillmentPlaces. - * @param request RemoveFulfillmentPlacesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsRequest; /** - * Calls RemoveFulfillmentPlaces. - * @param request RemoveFulfillmentPlacesRequest message or plain object - * @returns Promise + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsRequest; /** - * Calls AddLocalInventories. - * @param request AddLocalInventoriesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Verifies a RejoinUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls AddLocalInventories. - * @param request AddLocalInventoriesRequest message or plain object - * @returns Promise + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsRequest */ - public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsRequest; /** - * Calls RemoveLocalInventories. - * @param request RemoveLocalInventoriesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @param message RejoinUserEventsRequest + * @param [options] Conversion options + * @returns Plain object */ - public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback): void; + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls RemoveLocalInventories. - * @param request RemoveLocalInventoriesRequest message or plain object - * @returns Promise + * Converts this RejoinUserEventsRequest to JSON. + * @returns JSON object */ - public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): Promise; + public toJSON(): { [k: string]: any }; } - namespace ProductService { + namespace RejoinUserEventsRequest { - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. - * @param error Error, if any - * @param [response] Product - */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + /** UserEventRejoinScope enum. */ + enum UserEventRejoinScope { + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, + JOINED_EVENTS = 1, + UNJOINED_EVENTS = 2 + } + } + + /** Properties of a RejoinUserEventsResponse. */ + interface IRejoinUserEventsResponse { + + /** RejoinUserEventsResponse rejoinedUserEventsCount */ + rejoinedUserEventsCount?: (number|Long|string|null); + } + + /** Represents a RejoinUserEventsResponse. */ + class RejoinUserEventsResponse implements IRejoinUserEventsResponse { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. - * @param error Error, if any - * @param [response] Product + * Constructs a new RejoinUserEventsResponse. + * @param [properties] Properties to set */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse); + + /** RejoinUserEventsResponse rejoinedUserEventsCount. */ + public rejoinedUserEventsCount: (number|Long|string); /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. - * @param error Error, if any - * @param [response] ListProductsResponse + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RejoinUserEventsResponse instance */ - type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListProductsResponse) => void; + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse): google.cloud.retail.v2alpha.RejoinUserEventsResponse; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. - * @param error Error, if any - * @param [response] Product + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. - * @param error Error, if any - * @param [response] Empty + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. + * @param message RejoinUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. - * @param error Error, if any - * @param [response] Operation + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsResponse; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. - * @param error Error, if any - * @param [response] Operation + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsResponse; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. - * @param error Error, if any - * @param [response] Operation + * Verifies a RejoinUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. - * @param error Error, if any - * @param [response] Operation + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RejoinUserEventsResponse */ - type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsResponse; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. - * @param error Error, if any - * @param [response] Operation + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @param message RejoinUserEventsResponse + * @param [options] Conversion options + * @returns Plain object */ - type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. - * @param error Error, if any - * @param [response] Operation + * Converts this RejoinUserEventsResponse to JSON. + * @returns JSON object */ - type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { - - /** CreateProductRequest parent */ - parent?: (string|null); - - /** CreateProductRequest product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); - - /** CreateProductRequest productId */ - productId?: (string|null); + /** Properties of a RejoinUserEventsMetadata. */ + interface IRejoinUserEventsMetadata { } - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { + /** Represents a RejoinUserEventsMetadata. */ + class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { /** - * Constructs a new CreateProductRequest. + * Constructs a new RejoinUserEventsMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); - - /** CreateProductRequest parent. */ - public parent: string; - - /** CreateProductRequest product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); - - /** CreateProductRequest productId. */ - public productId: string; + constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata); /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new RejoinUserEventsMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns CreateProductRequest instance + * @returns RejoinUserEventsMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. + * @param message RejoinUserEventsMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateProductRequest + * @returns RejoinUserEventsMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateProductRequest + * @returns RejoinUserEventsMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; /** - * Verifies a CreateProductRequest message. + * Verifies a RejoinUserEventsMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateProductRequest + * @returns RejoinUserEventsMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. + * @param message RejoinUserEventsMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateProductRequest to JSON. + * Converts this RejoinUserEventsMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } + + /** Namespace v2beta. */ + namespace v2beta { - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { + /** Properties of a ProductLevelConfig. */ + interface IProductLevelConfig { - /** GetProductRequest name */ - name?: (string|null); + /** ProductLevelConfig ingestionProductType */ + ingestionProductType?: (string|null); + + /** ProductLevelConfig merchantCenterProductIdField */ + merchantCenterProductIdField?: (string|null); } - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { + /** Represents a ProductLevelConfig. */ + class ProductLevelConfig implements IProductLevelConfig { /** - * Constructs a new GetProductRequest. + * Constructs a new ProductLevelConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); + constructor(properties?: google.cloud.retail.v2beta.IProductLevelConfig); - /** GetProductRequest name. */ - public name: string; + /** ProductLevelConfig ingestionProductType. */ + public ingestionProductType: string; + + /** ProductLevelConfig merchantCenterProductIdField. */ + public merchantCenterProductIdField: string; /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates a new ProductLevelConfig instance using the specified properties. * @param [properties] Properties to set - * @returns GetProductRequest instance + * @returns ProductLevelConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; + public static create(properties?: google.cloud.retail.v2beta.IProductLevelConfig): google.cloud.retail.v2beta.ProductLevelConfig; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. + * @param message ProductLevelConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a ProductLevelConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetProductRequest + * @returns ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductLevelConfig; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetProductRequest + * @returns ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductLevelConfig; /** - * Verifies a GetProductRequest message. + * Verifies a ProductLevelConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetProductRequest + * @returns ProductLevelConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductLevelConfig; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @param message ProductLevelConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetProductRequest to JSON. + * Converts this ProductLevelConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { + /** Properties of a CatalogAttribute. */ + interface ICatalogAttribute { - /** UpdateProductRequest product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** CatalogAttribute key */ + key?: (string|null); - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** CatalogAttribute inUse */ + inUse?: (boolean|null); - /** UpdateProductRequest allowMissing */ - allowMissing?: (boolean|null); + /** CatalogAttribute type */ + type?: (google.cloud.retail.v2beta.CatalogAttribute.AttributeType|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.AttributeType|null); + + /** CatalogAttribute indexableOption */ + indexableOption?: (google.cloud.retail.v2beta.CatalogAttribute.IndexableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.IndexableOption|null); + + /** CatalogAttribute dynamicFacetableOption */ + dynamicFacetableOption?: (google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption|null); + + /** CatalogAttribute searchableOption */ + searchableOption?: (google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|null); } - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { + /** Represents a CatalogAttribute. */ + class CatalogAttribute implements ICatalogAttribute { /** - * Constructs a new UpdateProductRequest. + * Constructs a new CatalogAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); + constructor(properties?: google.cloud.retail.v2beta.ICatalogAttribute); - /** UpdateProductRequest product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** CatalogAttribute key. */ + public key: string; - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** CatalogAttribute inUse. */ + public inUse: boolean; - /** UpdateProductRequest allowMissing. */ - public allowMissing: boolean; + /** CatalogAttribute type. */ + public type: (google.cloud.retail.v2beta.CatalogAttribute.AttributeType|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.AttributeType); + + /** CatalogAttribute indexableOption. */ + public indexableOption: (google.cloud.retail.v2beta.CatalogAttribute.IndexableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.IndexableOption); + + /** CatalogAttribute dynamicFacetableOption. */ + public dynamicFacetableOption: (google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption); + + /** CatalogAttribute searchableOption. */ + public searchableOption: (google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.SearchableOption); /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new CatalogAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateProductRequest instance + * @returns CatalogAttribute instance */ - public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; + public static create(properties?: google.cloud.retail.v2beta.ICatalogAttribute): google.cloud.retail.v2beta.CatalogAttribute; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified CatalogAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CatalogAttribute.verify|verify} messages. + * @param message CatalogAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICatalogAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified CatalogAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CatalogAttribute.verify|verify} messages. + * @param message CatalogAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICatalogAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a CatalogAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateProductRequest + * @returns CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CatalogAttribute; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CatalogAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest + * @returns CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CatalogAttribute; /** - * Verifies an UpdateProductRequest message. + * Verifies a CatalogAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CatalogAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateProductRequest + * @returns CatalogAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CatalogAttribute; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest + * Creates a plain object from a CatalogAttribute message. Also converts values to other types if specified. + * @param message CatalogAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CatalogAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this CatalogAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { + namespace CatalogAttribute { - /** DeleteProductRequest name */ + /** AttributeType enum. */ + enum AttributeType { + UNKNOWN = 0, + TEXTUAL = 1, + NUMERICAL = 2 + } + + /** IndexableOption enum. */ + enum IndexableOption { + INDEXABLE_OPTION_UNSPECIFIED = 0, + INDEXABLE_ENABLED = 1, + INDEXABLE_DISABLED = 2 + } + + /** DynamicFacetableOption enum. */ + enum DynamicFacetableOption { + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0, + DYNAMIC_FACETABLE_ENABLED = 1, + DYNAMIC_FACETABLE_DISABLED = 2 + } + + /** SearchableOption enum. */ + enum SearchableOption { + SEARCHABLE_OPTION_UNSPECIFIED = 0, + SEARCHABLE_ENABLED = 1, + SEARCHABLE_DISABLED = 2 + } + } + + /** Properties of an AttributesConfig. */ + interface IAttributesConfig { + + /** AttributesConfig name */ name?: (string|null); + + /** AttributesConfig catalogAttributes */ + catalogAttributes?: ({ [k: string]: google.cloud.retail.v2beta.ICatalogAttribute }|null); + + /** AttributesConfig attributeConfigLevel */ + attributeConfigLevel?: (google.cloud.retail.v2beta.AttributeConfigLevel|keyof typeof google.cloud.retail.v2beta.AttributeConfigLevel|null); } - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { + /** Represents an AttributesConfig. */ + class AttributesConfig implements IAttributesConfig { /** - * Constructs a new DeleteProductRequest. + * Constructs a new AttributesConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); + constructor(properties?: google.cloud.retail.v2beta.IAttributesConfig); - /** DeleteProductRequest name. */ + /** AttributesConfig name. */ public name: string; + /** AttributesConfig catalogAttributes. */ + public catalogAttributes: { [k: string]: google.cloud.retail.v2beta.ICatalogAttribute }; + + /** AttributesConfig attributeConfigLevel. */ + public attributeConfigLevel: (google.cloud.retail.v2beta.AttributeConfigLevel|keyof typeof google.cloud.retail.v2beta.AttributeConfigLevel); + /** - * Creates a new DeleteProductRequest instance using the specified properties. + * Creates a new AttributesConfig instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProductRequest instance + * @returns AttributesConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; + public static create(properties?: google.cloud.retail.v2beta.IAttributesConfig): google.cloud.retail.v2beta.AttributesConfig; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified AttributesConfig message. Does not implicitly {@link google.cloud.retail.v2beta.AttributesConfig.verify|verify} messages. + * @param message AttributesConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAttributesConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified AttributesConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AttributesConfig.verify|verify} messages. + * @param message AttributesConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAttributesConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes an AttributesConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProductRequest + * @returns AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AttributesConfig; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes an AttributesConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest + * @returns AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AttributesConfig; /** - * Verifies a DeleteProductRequest message. + * Verifies an AttributesConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AttributesConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProductRequest + * @returns AttributesConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AttributesConfig; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest + * Creates a plain object from an AttributesConfig message. Also converts values to other types if specified. + * @param message AttributesConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AttributesConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this AttributesConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListProductsRequest. */ - interface IListProductsRequest { + /** Properties of a CompletionConfig. */ + interface ICompletionConfig { - /** ListProductsRequest parent */ - parent?: (string|null); + /** CompletionConfig name */ + name?: (string|null); - /** ListProductsRequest pageSize */ - pageSize?: (number|null); + /** CompletionConfig matchingOrder */ + matchingOrder?: (string|null); - /** ListProductsRequest pageToken */ - pageToken?: (string|null); + /** CompletionConfig maxSuggestions */ + maxSuggestions?: (number|null); - /** ListProductsRequest filter */ - filter?: (string|null); + /** CompletionConfig minPrefixLength */ + minPrefixLength?: (number|null); - /** ListProductsRequest readMask */ - readMask?: (google.protobuf.IFieldMask|null); + /** CompletionConfig autoLearning */ + autoLearning?: (boolean|null); - /** ListProductsRequest requireTotalSize */ - requireTotalSize?: (boolean|null); + /** CompletionConfig suggestionsInputConfig */ + suggestionsInputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** CompletionConfig lastSuggestionsImportOperation */ + lastSuggestionsImportOperation?: (string|null); + + /** CompletionConfig denylistInputConfig */ + denylistInputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** CompletionConfig lastDenylistImportOperation */ + lastDenylistImportOperation?: (string|null); + + /** CompletionConfig allowlistInputConfig */ + allowlistInputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** CompletionConfig lastAllowlistImportOperation */ + lastAllowlistImportOperation?: (string|null); } - /** Represents a ListProductsRequest. */ - class ListProductsRequest implements IListProductsRequest { + /** Represents a CompletionConfig. */ + class CompletionConfig implements ICompletionConfig { /** - * Constructs a new ListProductsRequest. + * Constructs a new CompletionConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IListProductsRequest); + constructor(properties?: google.cloud.retail.v2beta.ICompletionConfig); - /** ListProductsRequest parent. */ - public parent: string; + /** CompletionConfig name. */ + public name: string; - /** ListProductsRequest pageSize. */ - public pageSize: number; + /** CompletionConfig matchingOrder. */ + public matchingOrder: string; - /** ListProductsRequest pageToken. */ - public pageToken: string; + /** CompletionConfig maxSuggestions. */ + public maxSuggestions: number; - /** ListProductsRequest filter. */ - public filter: string; + /** CompletionConfig minPrefixLength. */ + public minPrefixLength: number; - /** ListProductsRequest readMask. */ - public readMask?: (google.protobuf.IFieldMask|null); + /** CompletionConfig autoLearning. */ + public autoLearning: boolean; - /** ListProductsRequest requireTotalSize. */ - public requireTotalSize: boolean; + /** CompletionConfig suggestionsInputConfig. */ + public suggestionsInputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** CompletionConfig lastSuggestionsImportOperation. */ + public lastSuggestionsImportOperation: string; + + /** CompletionConfig denylistInputConfig. */ + public denylistInputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** CompletionConfig lastDenylistImportOperation. */ + public lastDenylistImportOperation: string; + + /** CompletionConfig allowlistInputConfig. */ + public allowlistInputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** CompletionConfig lastAllowlistImportOperation. */ + public lastAllowlistImportOperation: string; /** - * Creates a new ListProductsRequest instance using the specified properties. + * Creates a new CompletionConfig instance using the specified properties. * @param [properties] Properties to set - * @returns ListProductsRequest instance + * @returns CompletionConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IListProductsRequest): google.cloud.retail.v2alpha.ListProductsRequest; + public static create(properties?: google.cloud.retail.v2beta.ICompletionConfig): google.cloud.retail.v2beta.CompletionConfig; /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode + * Encodes the specified CompletionConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionConfig.verify|verify} messages. + * @param message CompletionConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICompletionConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode + * Encodes the specified CompletionConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionConfig.verify|verify} messages. + * @param message CompletionConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListProductsRequest message from the specified reader or buffer. + * Decodes a CompletionConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListProductsRequest + * @returns CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionConfig; /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompletionConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListProductsRequest + * @returns CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionConfig; /** - * Verifies a ListProductsRequest message. + * Verifies a CompletionConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListProductsRequest + * @returns CompletionConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionConfig; /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @param message ListProductsRequest + * Creates a plain object from a CompletionConfig message. Also converts values to other types if specified. + * @param message CompletionConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CompletionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListProductsRequest to JSON. + * Converts this CompletionConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListProductsResponse. */ - interface IListProductsResponse { + /** Properties of a MerchantCenterLink. */ + interface IMerchantCenterLink { - /** ListProductsResponse products */ - products?: (google.cloud.retail.v2alpha.IProduct[]|null); + /** MerchantCenterLink merchantCenterAccountId */ + merchantCenterAccountId?: (number|Long|string|null); - /** ListProductsResponse nextPageToken */ - nextPageToken?: (string|null); + /** MerchantCenterLink branchId */ + branchId?: (string|null); - /** ListProductsResponse totalSize */ - totalSize?: (number|null); + /** MerchantCenterLink destinations */ + destinations?: (string[]|null); + + /** MerchantCenterLink regionCode */ + regionCode?: (string|null); + + /** MerchantCenterLink languageCode */ + languageCode?: (string|null); } - /** Represents a ListProductsResponse. */ - class ListProductsResponse implements IListProductsResponse { + /** Represents a MerchantCenterLink. */ + class MerchantCenterLink implements IMerchantCenterLink { /** - * Constructs a new ListProductsResponse. + * Constructs a new MerchantCenterLink. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IListProductsResponse); + constructor(properties?: google.cloud.retail.v2beta.IMerchantCenterLink); - /** ListProductsResponse products. */ - public products: google.cloud.retail.v2alpha.IProduct[]; + /** MerchantCenterLink merchantCenterAccountId. */ + public merchantCenterAccountId: (number|Long|string); - /** ListProductsResponse nextPageToken. */ - public nextPageToken: string; + /** MerchantCenterLink branchId. */ + public branchId: string; - /** ListProductsResponse totalSize. */ - public totalSize: number; + /** MerchantCenterLink destinations. */ + public destinations: string[]; + + /** MerchantCenterLink regionCode. */ + public regionCode: string; + + /** MerchantCenterLink languageCode. */ + public languageCode: string; /** - * Creates a new ListProductsResponse instance using the specified properties. + * Creates a new MerchantCenterLink instance using the specified properties. * @param [properties] Properties to set - * @returns ListProductsResponse instance + * @returns MerchantCenterLink instance */ - public static create(properties?: google.cloud.retail.v2alpha.IListProductsResponse): google.cloud.retail.v2alpha.ListProductsResponse; + public static create(properties?: google.cloud.retail.v2beta.IMerchantCenterLink): google.cloud.retail.v2beta.MerchantCenterLink; /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListProductsResponse message from the specified reader or buffer. + * Decodes a MerchantCenterLink message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListProductsResponse + * @returns MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListProductsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.MerchantCenterLink; /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListProductsResponse + * @returns MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListProductsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.MerchantCenterLink; /** - * Verifies a ListProductsResponse message. + * Verifies a MerchantCenterLink message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListProductsResponse + * @returns MerchantCenterLink */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListProductsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.MerchantCenterLink; /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @param message ListProductsResponse + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. + * @param message MerchantCenterLink * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.MerchantCenterLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListProductsResponse to JSON. + * Converts this MerchantCenterLink to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetInventoryRequest. */ - interface ISetInventoryRequest { - - /** SetInventoryRequest inventory */ - inventory?: (google.cloud.retail.v2alpha.IProduct|null); - - /** SetInventoryRequest setMask */ - setMask?: (google.protobuf.IFieldMask|null); - - /** SetInventoryRequest setTime */ - setTime?: (google.protobuf.ITimestamp|null); + /** Properties of a MerchantCenterLinkingConfig. */ + interface IMerchantCenterLinkingConfig { - /** SetInventoryRequest allowMissing */ - allowMissing?: (boolean|null); + /** MerchantCenterLinkingConfig links */ + links?: (google.cloud.retail.v2beta.IMerchantCenterLink[]|null); } - /** Represents a SetInventoryRequest. */ - class SetInventoryRequest implements ISetInventoryRequest { + /** Represents a MerchantCenterLinkingConfig. */ + class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { /** - * Constructs a new SetInventoryRequest. + * Constructs a new MerchantCenterLinkingConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryRequest); - - /** SetInventoryRequest inventory. */ - public inventory?: (google.cloud.retail.v2alpha.IProduct|null); - - /** SetInventoryRequest setMask. */ - public setMask?: (google.protobuf.IFieldMask|null); - - /** SetInventoryRequest setTime. */ - public setTime?: (google.protobuf.ITimestamp|null); + constructor(properties?: google.cloud.retail.v2beta.IMerchantCenterLinkingConfig); - /** SetInventoryRequest allowMissing. */ - public allowMissing: boolean; + /** MerchantCenterLinkingConfig links. */ + public links: google.cloud.retail.v2beta.IMerchantCenterLink[]; /** - * Creates a new SetInventoryRequest instance using the specified properties. + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. * @param [properties] Properties to set - * @returns SetInventoryRequest instance + * @returns MerchantCenterLinkingConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryRequest): google.cloud.retail.v2alpha.SetInventoryRequest; + public static create(properties?: google.cloud.retail.v2beta.IMerchantCenterLinkingConfig): google.cloud.retail.v2beta.MerchantCenterLinkingConfig; /** - * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. - * @param message SetInventoryRequest message or plain object to encode + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. - * @param message SetInventoryRequest message or plain object to encode + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer. + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetInventoryRequest + * @returns MerchantCenterLinkingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.MerchantCenterLinkingConfig; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetInventoryRequest + * @returns MerchantCenterLinkingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.MerchantCenterLinkingConfig; /** - * Verifies a SetInventoryRequest message. + * Verifies a MerchantCenterLinkingConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetInventoryRequest + * @returns MerchantCenterLinkingConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.MerchantCenterLinkingConfig; /** - * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. - * @param message SetInventoryRequest + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @param message MerchantCenterLinkingConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetInventoryRequest to JSON. + * Converts this MerchantCenterLinkingConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetInventoryMetadata. */ - interface ISetInventoryMetadata { + /** Properties of a Catalog. */ + interface ICatalog { + + /** Catalog name */ + name?: (string|null); + + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig */ + merchantCenterLinkingConfig?: (google.cloud.retail.v2beta.IMerchantCenterLinkingConfig|null); } - /** Represents a SetInventoryMetadata. */ - class SetInventoryMetadata implements ISetInventoryMetadata { + /** Represents a Catalog. */ + class Catalog implements ICatalog { /** - * Constructs a new SetInventoryMetadata. + * Constructs a new Catalog. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryMetadata); + constructor(properties?: google.cloud.retail.v2beta.ICatalog); + + /** Catalog name. */ + public name: string; + + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + + /** Catalog merchantCenterLinkingConfig. */ + public merchantCenterLinkingConfig?: (google.cloud.retail.v2beta.IMerchantCenterLinkingConfig|null); /** - * Creates a new SetInventoryMetadata instance using the specified properties. + * Creates a new Catalog instance using the specified properties. * @param [properties] Properties to set - * @returns SetInventoryMetadata instance + * @returns Catalog instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryMetadata): google.cloud.retail.v2alpha.SetInventoryMetadata; + public static create(properties?: google.cloud.retail.v2beta.ICatalog): google.cloud.retail.v2beta.Catalog; /** - * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. - * @param message SetInventoryMetadata message or plain object to encode + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. - * @param message SetInventoryMetadata message or plain object to encode + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetInventoryMetadata + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Catalog; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetInventoryMetadata + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Catalog; /** - * Verifies a SetInventoryMetadata message. + * Verifies a Catalog message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetInventoryMetadata + * @returns Catalog */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Catalog; /** - * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. - * @param message SetInventoryMetadata + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetInventoryMetadata to JSON. + * Converts this Catalog to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetInventoryResponse. */ - interface ISetInventoryResponse { + /** AttributeConfigLevel enum. */ + enum AttributeConfigLevel { + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0, + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1, + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2 } - /** Represents a SetInventoryResponse. */ - class SetInventoryResponse implements ISetInventoryResponse { + /** SolutionType enum. */ + enum SolutionType { + SOLUTION_TYPE_UNSPECIFIED = 0, + SOLUTION_TYPE_RECOMMENDATION = 1, + SOLUTION_TYPE_SEARCH = 2 + } + + /** SearchSolutionUseCase enum. */ + enum SearchSolutionUseCase { + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0, + SEARCH_SOLUTION_USE_CASE_SEARCH = 1, + SEARCH_SOLUTION_USE_CASE_BROWSE = 2 + } + + /** Properties of a Condition. */ + interface ICondition { + + /** Condition queryTerms */ + queryTerms?: (google.cloud.retail.v2beta.Condition.IQueryTerm[]|null); + + /** Condition activeTimeRange */ + activeTimeRange?: (google.cloud.retail.v2beta.Condition.ITimeRange[]|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { /** - * Constructs a new SetInventoryResponse. + * Constructs a new Condition. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISetInventoryResponse); + constructor(properties?: google.cloud.retail.v2beta.ICondition); + + /** Condition queryTerms. */ + public queryTerms: google.cloud.retail.v2beta.Condition.IQueryTerm[]; + + /** Condition activeTimeRange. */ + public activeTimeRange: google.cloud.retail.v2beta.Condition.ITimeRange[]; /** - * Creates a new SetInventoryResponse instance using the specified properties. + * Creates a new Condition instance using the specified properties. * @param [properties] Properties to set - * @returns SetInventoryResponse instance + * @returns Condition instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISetInventoryResponse): google.cloud.retail.v2alpha.SetInventoryResponse; + public static create(properties?: google.cloud.retail.v2beta.ICondition): google.cloud.retail.v2beta.Condition; /** - * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. - * @param message SetInventoryResponse message or plain object to encode + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. - * @param message SetInventoryResponse message or plain object to encode + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer. + * Decodes a Condition message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetInventoryResponse + * @returns Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SetInventoryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * Decodes a Condition message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetInventoryResponse + * @returns Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SetInventoryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition; /** - * Verifies a SetInventoryResponse message. + * Verifies a Condition message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a Condition message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetInventoryResponse + * @returns Condition */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SetInventoryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition; /** - * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. - * @param message SetInventoryResponse + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetInventoryResponse to JSON. + * Converts this Condition to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AddFulfillmentPlacesRequest. */ - interface IAddFulfillmentPlacesRequest { + namespace Condition { - /** AddFulfillmentPlacesRequest product */ - product?: (string|null); + /** Properties of a QueryTerm. */ + interface IQueryTerm { - /** AddFulfillmentPlacesRequest type */ - type?: (string|null); + /** QueryTerm value */ + value?: (string|null); + + /** QueryTerm fullMatch */ + fullMatch?: (boolean|null); + } + + /** Represents a QueryTerm. */ + class QueryTerm implements IQueryTerm { + + /** + * Constructs a new QueryTerm. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Condition.IQueryTerm); + + /** QueryTerm value. */ + public value: string; + + /** QueryTerm fullMatch. */ + public fullMatch: boolean; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTerm instance + */ + public static create(properties?: google.cloud.retail.v2beta.Condition.IQueryTerm): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Verifies a QueryTerm message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTerm + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition.QueryTerm; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @param message QueryTerm + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTerm to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TimeRange. */ + interface ITimeRange { + + /** TimeRange startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TimeRange. */ + class TimeRange implements ITimeRange { + + /** + * Constructs a new TimeRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Condition.ITimeRange); + + /** TimeRange startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TimeRange instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeRange instance + */ + public static create(properties?: google.cloud.retail.v2beta.Condition.ITimeRange): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Verifies a TimeRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition.TimeRange; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @param message TimeRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Rule. */ + interface IRule { + + /** Rule boostAction */ + boostAction?: (google.cloud.retail.v2beta.Rule.IBoostAction|null); + + /** Rule redirectAction */ + redirectAction?: (google.cloud.retail.v2beta.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction */ + onewaySynonymsAction?: (google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction */ + doNotAssociateAction?: (google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction */ + replacementAction?: (google.cloud.retail.v2beta.Rule.IReplacementAction|null); + + /** Rule ignoreAction */ + ignoreAction?: (google.cloud.retail.v2beta.Rule.IIgnoreAction|null); - /** AddFulfillmentPlacesRequest placeIds */ - placeIds?: (string[]|null); + /** Rule filterAction */ + filterAction?: (google.cloud.retail.v2beta.Rule.IFilterAction|null); - /** AddFulfillmentPlacesRequest addTime */ - addTime?: (google.protobuf.ITimestamp|null); + /** Rule twowaySynonymsAction */ + twowaySynonymsAction?: (google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null); - /** AddFulfillmentPlacesRequest allowMissing */ - allowMissing?: (boolean|null); + /** Rule condition */ + condition?: (google.cloud.retail.v2beta.ICondition|null); } - /** Represents an AddFulfillmentPlacesRequest. */ - class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { + /** Represents a Rule. */ + class Rule implements IRule { /** - * Constructs a new AddFulfillmentPlacesRequest. + * Constructs a new Rule. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest); + constructor(properties?: google.cloud.retail.v2beta.IRule); - /** AddFulfillmentPlacesRequest product. */ - public product: string; + /** Rule boostAction. */ + public boostAction?: (google.cloud.retail.v2beta.Rule.IBoostAction|null); - /** AddFulfillmentPlacesRequest type. */ - public type: string; + /** Rule redirectAction. */ + public redirectAction?: (google.cloud.retail.v2beta.Rule.IRedirectAction|null); - /** AddFulfillmentPlacesRequest placeIds. */ - public placeIds: string[]; + /** Rule onewaySynonymsAction. */ + public onewaySynonymsAction?: (google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null); - /** AddFulfillmentPlacesRequest addTime. */ - public addTime?: (google.protobuf.ITimestamp|null); + /** Rule doNotAssociateAction. */ + public doNotAssociateAction?: (google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null); - /** AddFulfillmentPlacesRequest allowMissing. */ - public allowMissing: boolean; + /** Rule replacementAction. */ + public replacementAction?: (google.cloud.retail.v2beta.Rule.IReplacementAction|null); + + /** Rule ignoreAction. */ + public ignoreAction?: (google.cloud.retail.v2beta.Rule.IIgnoreAction|null); + + /** Rule filterAction. */ + public filterAction?: (google.cloud.retail.v2beta.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction. */ + public twowaySynonymsAction?: (google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null); + + /** Rule condition. */ + public condition?: (google.cloud.retail.v2beta.ICondition|null); + + /** Rule action. */ + public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); /** - * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * Creates a new Rule instance using the specified properties. * @param [properties] Properties to set - * @returns AddFulfillmentPlacesRequest instance + * @returns Rule instance */ - public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + public static create(properties?: google.cloud.retail.v2beta.IRule): google.cloud.retail.v2beta.Rule; /** - * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. - * @param message AddFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IRule, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. - * @param message AddFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IRule, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a Rule message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AddFulfillmentPlacesRequest + * @returns Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a Rule message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AddFulfillmentPlacesRequest + * @returns Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule; /** - * Verifies an AddFulfillmentPlacesRequest message. + * Verifies a Rule message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Rule message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AddFulfillmentPlacesRequest + * @returns Rule */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule; /** - * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. - * @param message AddFulfillmentPlacesRequest + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @param message Rule * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AddFulfillmentPlacesRequest to JSON. + * Converts this Rule to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AddFulfillmentPlacesMetadata. */ - interface IAddFulfillmentPlacesMetadata { - } + namespace Rule { - /** Represents an AddFulfillmentPlacesMetadata. */ - class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { + /** Properties of a BoostAction. */ + interface IBoostAction { - /** - * Constructs a new AddFulfillmentPlacesMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata); + /** BoostAction boost */ + boost?: (number|null); - /** - * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns AddFulfillmentPlacesMetadata instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + /** BoostAction productsFilter */ + productsFilter?: (string|null); + } - /** - * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. - * @param message AddFulfillmentPlacesMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a BoostAction. */ + class BoostAction implements IBoostAction { - /** - * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. - * @param message AddFulfillmentPlacesMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new BoostAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IBoostAction); - /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddFulfillmentPlacesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + /** BoostAction boost. */ + public boost: number; - /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddFulfillmentPlacesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + /** BoostAction productsFilter. */ + public productsFilter: string; - /** - * Verifies an AddFulfillmentPlacesMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a new BoostAction instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IBoostAction): google.cloud.retail.v2beta.Rule.BoostAction; - /** - * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddFulfillmentPlacesMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata; + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. - * @param message AddFulfillmentPlacesMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Verifies a BoostAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.BoostAction; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @param message BoostAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FilterAction. */ + interface IFilterAction { - /** - * Converts this AddFulfillmentPlacesMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** FilterAction filter */ + filter?: (string|null); + } - /** Properties of an AddFulfillmentPlacesResponse. */ - interface IAddFulfillmentPlacesResponse { - } + /** Represents a FilterAction. */ + class FilterAction implements IFilterAction { - /** Represents an AddFulfillmentPlacesResponse. */ - class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { + /** + * Constructs a new FilterAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IFilterAction); - /** - * Constructs a new AddFulfillmentPlacesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse); + /** FilterAction filter. */ + public filter: string; - /** - * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AddFulfillmentPlacesResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + /** + * Creates a new FilterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns FilterAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IFilterAction): google.cloud.retail.v2beta.Rule.FilterAction; - /** - * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. - * @param message AddFulfillmentPlacesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. - * @param message AddFulfillmentPlacesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.FilterAction; - /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.FilterAction; - /** - * Verifies an AddFulfillmentPlacesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a FilterAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddFulfillmentPlacesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse; + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FilterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.FilterAction; - /** - * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @param message AddFulfillmentPlacesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @param message FilterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this AddFulfillmentPlacesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this FilterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of an AddLocalInventoriesRequest. */ - interface IAddLocalInventoriesRequest { + /** Properties of a RedirectAction. */ + interface IRedirectAction { - /** AddLocalInventoriesRequest product */ - product?: (string|null); + /** RedirectAction redirectUri */ + redirectUri?: (string|null); + } - /** AddLocalInventoriesRequest localInventories */ - localInventories?: (google.cloud.retail.v2alpha.ILocalInventory[]|null); + /** Represents a RedirectAction. */ + class RedirectAction implements IRedirectAction { - /** AddLocalInventoriesRequest addMask */ - addMask?: (google.protobuf.IFieldMask|null); + /** + * Constructs a new RedirectAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IRedirectAction); - /** AddLocalInventoriesRequest addTime */ - addTime?: (google.protobuf.ITimestamp|null); + /** RedirectAction redirectUri. */ + public redirectUri: string; - /** AddLocalInventoriesRequest allowMissing */ - allowMissing?: (boolean|null); - } + /** + * Creates a new RedirectAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RedirectAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IRedirectAction): google.cloud.retail.v2beta.Rule.RedirectAction; - /** Represents an AddLocalInventoriesRequest. */ - class AddLocalInventoriesRequest implements IAddLocalInventoriesRequest { + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new AddLocalInventoriesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest); + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** AddLocalInventoriesRequest product. */ - public product: string; + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.RedirectAction; - /** AddLocalInventoriesRequest localInventories. */ - public localInventories: google.cloud.retail.v2alpha.ILocalInventory[]; + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.RedirectAction; - /** AddLocalInventoriesRequest addMask. */ - public addMask?: (google.protobuf.IFieldMask|null); + /** + * Verifies a RedirectAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** AddLocalInventoriesRequest addTime. */ - public addTime?: (google.protobuf.ITimestamp|null); + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RedirectAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.RedirectAction; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @param message RedirectAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RedirectAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** AddLocalInventoriesRequest allowMissing. */ - public allowMissing: boolean; + /** Properties of a TwowaySynonymsAction. */ + interface ITwowaySynonymsAction { - /** - * Creates a new AddLocalInventoriesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AddLocalInventoriesRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + /** TwowaySynonymsAction synonyms */ + synonyms?: (string[]|null); + } - /** - * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. - * @param message AddLocalInventoriesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a TwowaySynonymsAction. */ + class TwowaySynonymsAction implements ITwowaySynonymsAction { - /** - * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. - * @param message AddLocalInventoriesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new TwowaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction); - /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddLocalInventoriesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + /** TwowaySynonymsAction synonyms. */ + public synonyms: string[]; - /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddLocalInventoriesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns TwowaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; - /** - * Verifies an AddLocalInventoriesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddLocalInventoriesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesRequest; + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. - * @param message AddLocalInventoriesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; - /** - * Converts this AddLocalInventoriesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; - /** Properties of an AddLocalInventoriesMetadata. */ - interface IAddLocalInventoriesMetadata { - } + /** + * Verifies a TwowaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Represents an AddLocalInventoriesMetadata. */ - class AddLocalInventoriesMetadata implements IAddLocalInventoriesMetadata { + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TwowaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; - /** - * Constructs a new AddLocalInventoriesMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata); + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @param message TwowaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a new AddLocalInventoriesMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns AddLocalInventoriesMetadata instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + /** + * Converts this TwowaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. - * @param message AddLocalInventoriesMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of an OnewaySynonymsAction. */ + interface IOnewaySynonymsAction { - /** - * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. - * @param message AddLocalInventoriesMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** OnewaySynonymsAction queryTerms */ + queryTerms?: (string[]|null); - /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddLocalInventoriesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + /** OnewaySynonymsAction synonyms */ + synonyms?: (string[]|null); - /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddLocalInventoriesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + /** OnewaySynonymsAction onewayTerms */ + onewayTerms?: (string[]|null); + } - /** - * Verifies an AddLocalInventoriesMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Represents an OnewaySynonymsAction. */ + class OnewaySynonymsAction implements IOnewaySynonymsAction { - /** - * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddLocalInventoriesMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesMetadata; + /** + * Constructs a new OnewaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction); - /** - * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. - * @param message AddLocalInventoriesMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** OnewaySynonymsAction queryTerms. */ + public queryTerms: string[]; - /** - * Converts this AddLocalInventoriesMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** OnewaySynonymsAction synonyms. */ + public synonyms: string[]; - /** Properties of an AddLocalInventoriesResponse. */ - interface IAddLocalInventoriesResponse { - } + /** OnewaySynonymsAction onewayTerms. */ + public onewayTerms: string[]; - /** Represents an AddLocalInventoriesResponse. */ - class AddLocalInventoriesResponse implements IAddLocalInventoriesResponse { + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OnewaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; - /** - * Constructs a new AddLocalInventoriesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse); + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new AddLocalInventoriesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AddLocalInventoriesResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. - * @param message AddLocalInventoriesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; - /** - * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. - * @param message AddLocalInventoriesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; - /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddLocalInventoriesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + /** + * Verifies an OnewaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddLocalInventoriesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnewaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; - /** - * Verifies an AddLocalInventoriesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @param message OnewaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddLocalInventoriesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddLocalInventoriesResponse; + /** + * Converts this OnewaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. - * @param message AddLocalInventoriesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.AddLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Properties of a DoNotAssociateAction. */ + interface IDoNotAssociateAction { - /** - * Converts this AddLocalInventoriesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** DoNotAssociateAction queryTerms */ + queryTerms?: (string[]|null); - /** Properties of a RemoveLocalInventoriesRequest. */ - interface IRemoveLocalInventoriesRequest { + /** DoNotAssociateAction doNotAssociateTerms */ + doNotAssociateTerms?: (string[]|null); - /** RemoveLocalInventoriesRequest product */ - product?: (string|null); + /** DoNotAssociateAction terms */ + terms?: (string[]|null); + } - /** RemoveLocalInventoriesRequest placeIds */ - placeIds?: (string[]|null); + /** Represents a DoNotAssociateAction. */ + class DoNotAssociateAction implements IDoNotAssociateAction { - /** RemoveLocalInventoriesRequest removeTime */ - removeTime?: (google.protobuf.ITimestamp|null); + /** + * Constructs a new DoNotAssociateAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction); - /** RemoveLocalInventoriesRequest allowMissing */ - allowMissing?: (boolean|null); - } + /** DoNotAssociateAction queryTerms. */ + public queryTerms: string[]; - /** Represents a RemoveLocalInventoriesRequest. */ - class RemoveLocalInventoriesRequest implements IRemoveLocalInventoriesRequest { + /** DoNotAssociateAction doNotAssociateTerms. */ + public doNotAssociateTerms: string[]; - /** - * Constructs a new RemoveLocalInventoriesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest); + /** DoNotAssociateAction terms. */ + public terms: string[]; - /** RemoveLocalInventoriesRequest product. */ - public product: string; + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DoNotAssociateAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; - /** RemoveLocalInventoriesRequest placeIds. */ - public placeIds: string[]; + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** RemoveLocalInventoriesRequest removeTime. */ - public removeTime?: (google.protobuf.ITimestamp|null); + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** RemoveLocalInventoriesRequest allowMissing. */ - public allowMissing: boolean; + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; - /** - * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns RemoveLocalInventoriesRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; - /** - * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. - * @param message RemoveLocalInventoriesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a DoNotAssociateAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. - * @param message RemoveLocalInventoriesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoNotAssociateAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; - /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveLocalInventoriesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @param message DoNotAssociateAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveLocalInventoriesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + /** + * Converts this DoNotAssociateAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Verifies a RemoveLocalInventoriesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Properties of a ReplacementAction. */ + interface IReplacementAction { - /** - * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveLocalInventoriesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest; + /** ReplacementAction queryTerms */ + queryTerms?: (string[]|null); - /** - * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. - * @param message RemoveLocalInventoriesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ReplacementAction replacementTerm */ + replacementTerm?: (string|null); - /** - * Converts this RemoveLocalInventoriesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** ReplacementAction term */ + term?: (string|null); + } - /** Properties of a RemoveLocalInventoriesMetadata. */ - interface IRemoveLocalInventoriesMetadata { - } + /** Represents a ReplacementAction. */ + class ReplacementAction implements IReplacementAction { - /** Represents a RemoveLocalInventoriesMetadata. */ - class RemoveLocalInventoriesMetadata implements IRemoveLocalInventoriesMetadata { + /** + * Constructs a new ReplacementAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IReplacementAction); - /** - * Constructs a new RemoveLocalInventoriesMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata); + /** ReplacementAction queryTerms. */ + public queryTerms: string[]; - /** - * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns RemoveLocalInventoriesMetadata instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + /** ReplacementAction replacementTerm. */ + public replacementTerm: string; - /** - * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. - * @param message RemoveLocalInventoriesMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** ReplacementAction term. */ + public term: string; - /** - * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. - * @param message RemoveLocalInventoriesMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new ReplacementAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplacementAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IReplacementAction): google.cloud.retail.v2beta.Rule.ReplacementAction; - /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveLocalInventoriesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveLocalInventoriesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a RemoveLocalInventoriesMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.ReplacementAction; - /** - * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveLocalInventoriesMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata; + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.ReplacementAction; - /** - * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. - * @param message RemoveLocalInventoriesMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a ReplacementAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this RemoveLocalInventoriesMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplacementAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.ReplacementAction; - /** Properties of a RemoveLocalInventoriesResponse. */ - interface IRemoveLocalInventoriesResponse { - } + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @param message ReplacementAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Represents a RemoveLocalInventoriesResponse. */ - class RemoveLocalInventoriesResponse implements IRemoveLocalInventoriesResponse { + /** + * Converts this ReplacementAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Constructs a new RemoveLocalInventoriesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse); + /** Properties of an IgnoreAction. */ + interface IIgnoreAction { - /** - * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns RemoveLocalInventoriesResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + /** IgnoreAction ignoreTerms */ + ignoreTerms?: (string[]|null); + } - /** - * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. - * @param message RemoveLocalInventoriesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents an IgnoreAction. */ + class IgnoreAction implements IIgnoreAction { - /** - * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. - * @param message RemoveLocalInventoriesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new IgnoreAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Rule.IIgnoreAction); - /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveLocalInventoriesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + /** IgnoreAction ignoreTerms. */ + public ignoreTerms: string[]; - /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveLocalInventoriesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + /** + * Creates a new IgnoreAction instance using the specified properties. + * @param [properties] Properties to set + * @returns IgnoreAction instance + */ + public static create(properties?: google.cloud.retail.v2beta.Rule.IIgnoreAction): google.cloud.retail.v2beta.Rule.IgnoreAction; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a RemoveLocalInventoriesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveLocalInventoriesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse; + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.IgnoreAction; - /** - * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. - * @param message RemoveLocalInventoriesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.IgnoreAction; - /** - * Converts this RemoveLocalInventoriesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Verifies an IgnoreAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of a RemoveFulfillmentPlacesRequest. */ - interface IRemoveFulfillmentPlacesRequest { + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IgnoreAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.IgnoreAction; - /** RemoveFulfillmentPlacesRequest product */ - product?: (string|null); + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @param message IgnoreAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** RemoveFulfillmentPlacesRequest type */ - type?: (string|null); + /** + * Converts this IgnoreAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** RemoveFulfillmentPlacesRequest placeIds */ - placeIds?: (string[]|null); + /** Properties of an Audience. */ + interface IAudience { - /** RemoveFulfillmentPlacesRequest removeTime */ - removeTime?: (google.protobuf.ITimestamp|null); + /** Audience genders */ + genders?: (string[]|null); - /** RemoveFulfillmentPlacesRequest allowMissing */ - allowMissing?: (boolean|null); + /** Audience ageGroups */ + ageGroups?: (string[]|null); } - /** Represents a RemoveFulfillmentPlacesRequest. */ - class RemoveFulfillmentPlacesRequest implements IRemoveFulfillmentPlacesRequest { + /** Represents an Audience. */ + class Audience implements IAudience { /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new Audience. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest); - - /** RemoveFulfillmentPlacesRequest product. */ - public product: string; - - /** RemoveFulfillmentPlacesRequest type. */ - public type: string; - - /** RemoveFulfillmentPlacesRequest placeIds. */ - public placeIds: string[]; + constructor(properties?: google.cloud.retail.v2beta.IAudience); - /** RemoveFulfillmentPlacesRequest removeTime. */ - public removeTime?: (google.protobuf.ITimestamp|null); + /** Audience genders. */ + public genders: string[]; - /** RemoveFulfillmentPlacesRequest allowMissing. */ - public allowMissing: boolean; + /** Audience ageGroups. */ + public ageGroups: string[]; /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @param [properties] Properties to set - * @returns RemoveFulfillmentPlacesRequest instance + * @returns Audience instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + public static create(properties?: google.cloud.retail.v2beta.IAudience): google.cloud.retail.v2beta.Audience; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. - * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. - * @param message RemoveFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesRequest + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Audience; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesRequest + * @returns Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Audience; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies an Audience message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RemoveFulfillmentPlacesRequest + * @returns Audience */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Audience; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesRequest + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this Audience to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RemoveFulfillmentPlacesMetadata. */ - interface IRemoveFulfillmentPlacesMetadata { + /** Properties of a ColorInfo. */ + interface IColorInfo { + + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); + + /** ColorInfo colors */ + colors?: (string[]|null); } - /** Represents a RemoveFulfillmentPlacesMetadata. */ - class RemoveFulfillmentPlacesMetadata implements IRemoveFulfillmentPlacesMetadata { + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new ColorInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata); + constructor(properties?: google.cloud.retail.v2beta.IColorInfo); + + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; + + /** ColorInfo colors. */ + public colors: string[]; /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @param [properties] Properties to set - * @returns RemoveFulfillmentPlacesMetadata instance + * @returns ColorInfo instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + public static create(properties?: google.cloud.retail.v2beta.IColorInfo): google.cloud.retail.v2beta.ColorInfo; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. - * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. - * @param message RemoveFulfillmentPlacesMetadata message or plain object to encode + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesMetadata + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ColorInfo; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesMetadata + * @returns ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ColorInfo; /** - * Verifies a RemoveFulfillmentPlacesMetadata message. + * Verifies a ColorInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RemoveFulfillmentPlacesMetadata + * @returns ColorInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ColorInfo; /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesMetadata + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * Converts this ColorInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RemoveFulfillmentPlacesResponse. */ - interface IRemoveFulfillmentPlacesResponse { + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + + /** CustomAttribute searchable */ + searchable?: (boolean|null); + + /** CustomAttribute indexable */ + indexable?: (boolean|null); } - /** Represents a RemoveFulfillmentPlacesResponse. */ - class RemoveFulfillmentPlacesResponse implements IRemoveFulfillmentPlacesResponse { + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { /** - * Constructs a new RemoveFulfillmentPlacesResponse. + * Constructs a new CustomAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse); + constructor(properties?: google.cloud.retail.v2beta.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); + + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * Creates a new CustomAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns RemoveFulfillmentPlacesResponse instance + * @returns CustomAttribute instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + public static create(properties?: google.cloud.retail.v2beta.ICustomAttribute): google.cloud.retail.v2beta.CustomAttribute; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @param message RemoveFulfillmentPlacesResponse message or plain object to encode + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesResponse + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CustomAttribute; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesResponse + * @returns CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CustomAttribute; /** - * Verifies a RemoveFulfillmentPlacesResponse message. + * Verifies a CustomAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RemoveFulfillmentPlacesResponse + * @returns CustomAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CustomAttribute; /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesResponse + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. + * Converts this CustomAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { + + /** FulfillmentInfo type */ + type?: (string|null); + + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); } - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { /** - * Constructs a new PurgeMetadata. + * Constructs a new FulfillmentInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeMetadata); + constructor(properties?: google.cloud.retail.v2beta.IFulfillmentInfo); + + /** FulfillmentInfo type. */ + public type: string; + + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeMetadata instance + * @returns FulfillmentInfo instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeMetadata): google.cloud.retail.v2alpha.PurgeMetadata; + public static create(properties?: google.cloud.retail.v2beta.IFulfillmentInfo): google.cloud.retail.v2beta.FulfillmentInfo; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeMetadata + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.FulfillmentInfo; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeMetadata + * @returns FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.FulfillmentInfo; /** - * Verifies a PurgeMetadata message. + * Verifies a FulfillmentInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeMetadata + * @returns FulfillmentInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.FulfillmentInfo; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeMetadata to JSON. + * Converts this FulfillmentInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { + /** Properties of an Image. */ + interface IImage { - /** PurgeUserEventsRequest parent */ - parent?: (string|null); + /** Image uri */ + uri?: (string|null); - /** PurgeUserEventsRequest filter */ - filter?: (string|null); + /** Image height */ + height?: (number|null); - /** PurgeUserEventsRequest force */ - force?: (boolean|null); + /** Image width */ + width?: (number|null); } - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + /** Represents an Image. */ + class Image implements IImage { /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new Image. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest); + constructor(properties?: google.cloud.retail.v2beta.IImage); - /** PurgeUserEventsRequest parent. */ - public parent: string; + /** Image uri. */ + public uri: string; - /** PurgeUserEventsRequest filter. */ - public filter: string; + /** Image height. */ + public height: number; - /** PurgeUserEventsRequest force. */ - public force: boolean; + /** Image width. */ + public width: number; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new Image instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance + * @returns Image instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static create(properties?: google.cloud.retail.v2beta.IImage): google.cloud.retail.v2beta.Image; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest + * @returns Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Image; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest + * @returns Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Image; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies an Image message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsRequest + * @returns Image */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Image; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this Image to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { + /** Properties of an Interval. */ + interface IInterval { + + /** Interval minimum */ + minimum?: (number|null); + + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); + + /** Interval maximum */ + maximum?: (number|null); + + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); + } + + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IInterval); + + /** Interval minimum. */ + public minimum?: (number|null); + + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); - } + /** Interval maximum. */ + public maximum?: (number|null); - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); - /** - * Constructs a new PurgeUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new Interval instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance + * @returns Interval instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static create(properties?: google.cloud.retail.v2beta.IInterval): google.cloud.retail.v2beta.Interval; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse + * @returns Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Interval; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse + * @returns Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Interval; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies an Interval message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsResponse + * @returns Interval */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Interval; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this Interval to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a SearchService */ - class SearchService extends $protobuf.rpc.Service { - - /** - * Constructs a new SearchService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SearchService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; - - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SearchResponse - */ - public search(request: google.cloud.retail.v2alpha.ISearchRequest, callback: google.cloud.retail.v2alpha.SearchService.SearchCallback): void; - - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @returns Promise - */ - public search(request: google.cloud.retail.v2alpha.ISearchRequest): Promise; - } - - namespace SearchService { - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. - * @param error Error, if any - * @param [response] SearchResponse - */ - type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.SearchResponse) => void; - } - - /** Properties of a SearchRequest. */ - interface ISearchRequest { - - /** SearchRequest placement */ - placement?: (string|null); - - /** SearchRequest branch */ - branch?: (string|null); - - /** SearchRequest query */ - query?: (string|null); - - /** SearchRequest visitorId */ - visitorId?: (string|null); - - /** SearchRequest userInfo */ - userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - - /** SearchRequest pageSize */ - pageSize?: (number|null); - - /** SearchRequest pageToken */ - pageToken?: (string|null); - - /** SearchRequest offset */ - offset?: (number|null); - - /** SearchRequest filter */ - filter?: (string|null); - - /** SearchRequest canonicalFilter */ - canonicalFilter?: (string|null); - - /** SearchRequest orderBy */ - orderBy?: (string|null); - - /** SearchRequest facetSpecs */ - facetSpecs?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]|null); + /** Properties of a PriceInfo. */ + interface IPriceInfo { - /** SearchRequest dynamicFacetSpec */ - dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); + /** PriceInfo currencyCode */ + currencyCode?: (string|null); - /** SearchRequest boostSpec */ - boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); + /** PriceInfo price */ + price?: (number|null); - /** SearchRequest queryExpansionSpec */ - queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); + /** PriceInfo originalPrice */ + originalPrice?: (number|null); - /** SearchRequest relevanceThreshold */ - relevanceThreshold?: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null); + /** PriceInfo cost */ + cost?: (number|null); - /** SearchRequest variantRollupKeys */ - variantRollupKeys?: (string[]|null); + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); - /** SearchRequest pageCategories */ - pageCategories?: (string[]|null); + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); - /** SearchRequest searchMode */ - searchMode?: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode|null); + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2beta.PriceInfo.IPriceRange|null); } - /** Represents a SearchRequest. */ - class SearchRequest implements ISearchRequest { + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { /** - * Constructs a new SearchRequest. + * Constructs a new PriceInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISearchRequest); - - /** SearchRequest placement. */ - public placement: string; - - /** SearchRequest branch. */ - public branch: string; - - /** SearchRequest query. */ - public query: string; - - /** SearchRequest visitorId. */ - public visitorId: string; - - /** SearchRequest userInfo. */ - public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - - /** SearchRequest pageSize. */ - public pageSize: number; - - /** SearchRequest pageToken. */ - public pageToken: string; - - /** SearchRequest offset. */ - public offset: number; - - /** SearchRequest filter. */ - public filter: string; - - /** SearchRequest canonicalFilter. */ - public canonicalFilter: string; - - /** SearchRequest orderBy. */ - public orderBy: string; - - /** SearchRequest facetSpecs. */ - public facetSpecs: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]; + constructor(properties?: google.cloud.retail.v2beta.IPriceInfo); - /** SearchRequest dynamicFacetSpec. */ - public dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); + /** PriceInfo currencyCode. */ + public currencyCode: string; - /** SearchRequest boostSpec. */ - public boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); + /** PriceInfo price. */ + public price: number; - /** SearchRequest queryExpansionSpec. */ - public queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); + /** PriceInfo originalPrice. */ + public originalPrice: number; - /** SearchRequest relevanceThreshold. */ - public relevanceThreshold: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold); + /** PriceInfo cost. */ + public cost: number; - /** SearchRequest variantRollupKeys. */ - public variantRollupKeys: string[]; + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); - /** SearchRequest pageCategories. */ - public pageCategories: string[]; + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); - /** SearchRequest searchMode. */ - public searchMode: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode); + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2beta.PriceInfo.IPriceRange|null); /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new PriceInfo instance using the specified properties. * @param [properties] Properties to set - * @returns SearchRequest instance + * @returns PriceInfo instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISearchRequest): google.cloud.retail.v2alpha.SearchRequest; + public static create(properties?: google.cloud.retail.v2beta.IPriceInfo): google.cloud.retail.v2beta.PriceInfo; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchRequest + * @returns PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchRequest + * @returns PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo; /** - * Verifies a SearchRequest message. + * Verifies a PriceInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest; - - /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. - * @param message SearchRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SearchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - namespace SearchRequest { - - /** Properties of a FacetSpec. */ - interface IFacetSpec { - - /** FacetSpec facetKey */ - facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); - - /** FacetSpec limit */ - limit?: (number|null); - - /** FacetSpec excludedFilterKeys */ - excludedFilterKeys?: (string[]|null); - - /** FacetSpec enableDynamicPosition */ - enableDynamicPosition?: (boolean|null); - } - - /** Represents a FacetSpec. */ - class FacetSpec implements IFacetSpec { - - /** - * Constructs a new FacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec); - - /** FacetSpec facetKey. */ - public facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); - - /** FacetSpec limit. */ - public limit: number; - - /** FacetSpec excludedFilterKeys. */ - public excludedFilterKeys: string[]; - - /** FacetSpec enableDynamicPosition. */ - public enableDynamicPosition: boolean; - - /** - * Creates a new FacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Verifies a FacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @param message FacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - namespace FacetSpec { - - /** Properties of a FacetKey. */ - interface IFacetKey { - - /** FacetKey key */ - key?: (string|null); - - /** FacetKey intervals */ - intervals?: (google.cloud.retail.v2alpha.IInterval[]|null); - - /** FacetKey restrictedValues */ - restrictedValues?: (string[]|null); - - /** FacetKey prefixes */ - prefixes?: (string[]|null); - - /** FacetKey contains */ - contains?: (string[]|null); - - /** FacetKey orderBy */ - orderBy?: (string|null); - - /** FacetKey query */ - query?: (string|null); - } - - /** Represents a FacetKey. */ - class FacetKey implements IFacetKey { - - /** - * Constructs a new FacetKey. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey); - - /** FacetKey key. */ - public key: string; - - /** FacetKey intervals. */ - public intervals: google.cloud.retail.v2alpha.IInterval[]; - - /** FacetKey restrictedValues. */ - public restrictedValues: string[]; - - /** FacetKey prefixes. */ - public prefixes: string[]; - - /** FacetKey contains. */ - public contains: string[]; - - /** FacetKey orderBy. */ - public orderBy: string; - - /** FacetKey query. */ - public query: string; - - /** - * Creates a new FacetKey instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetKey instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo; - /** - * Verifies a FacetKey message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetKey - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @param message FacetKey - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + namespace PriceInfo { - /** - * Converts this FacetKey to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** Properties of a PriceRange. */ + interface IPriceRange { - /** Properties of a DynamicFacetSpec. */ - interface IDynamicFacetSpec { + /** PriceRange price */ + price?: (google.cloud.retail.v2beta.IInterval|null); - /** DynamicFacetSpec mode */ - mode?: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null); + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2beta.IInterval|null); } - /** Represents a DynamicFacetSpec. */ - class DynamicFacetSpec implements IDynamicFacetSpec { + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { /** - * Constructs a new DynamicFacetSpec. + * Constructs a new PriceRange. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec); + constructor(properties?: google.cloud.retail.v2beta.PriceInfo.IPriceRange); - /** DynamicFacetSpec mode. */ - public mode: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode); + /** PriceRange price. */ + public price?: (google.cloud.retail.v2beta.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2beta.IInterval|null); /** - * Creates a new DynamicFacetSpec instance using the specified properties. + * Creates a new PriceRange instance using the specified properties. * @param [properties] Properties to set - * @returns DynamicFacetSpec instance + * @returns PriceRange instance */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + public static create(properties?: google.cloud.retail.v2beta.PriceInfo.IPriceRange): google.cloud.retail.v2beta.PriceInfo.PriceRange; /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * Decodes a PriceRange message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DynamicFacetSpec + * @returns PriceRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo.PriceRange; /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * Decodes a PriceRange message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DynamicFacetSpec + * @returns PriceRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo.PriceRange; /** - * Verifies a DynamicFacetSpec message. + * Verifies a PriceRange message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DynamicFacetSpec + * @returns PriceRange */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo.PriceRange; /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @param message DynamicFacetSpec + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DynamicFacetSpec to JSON. + * Converts this PriceRange to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - namespace DynamicFacetSpec { + /** Properties of a Rating. */ + interface IRating { - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - DISABLED = 1, - ENABLED = 2 - } - } + /** Rating ratingCount */ + ratingCount?: (number|null); - /** Properties of a BoostSpec. */ - interface IBoostSpec { + /** Rating averageRating */ + averageRating?: (number|null); - /** BoostSpec conditionBoostSpecs */ - conditionBoostSpecs?: (google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); - } + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } - /** Represents a BoostSpec. */ - class BoostSpec implements IBoostSpec { + /** Represents a Rating. */ + class Rating implements IRating { - /** - * Constructs a new BoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec); + /** + * Constructs a new Rating. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRating); - /** BoostSpec conditionBoostSpecs. */ - public conditionBoostSpecs: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]; + /** Rating ratingCount. */ + public ratingCount: number; + + /** Rating averageRating. */ + public averageRating: number; + + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; + + /** + * Creates a new Rating instance using the specified properties. + * @param [properties] Properties to set + * @returns Rating instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRating): google.cloud.retail.v2beta.Rating; + + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rating; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rating; + + /** + * Verifies a Rating message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rating + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rating; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rating to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); + + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { + + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserInfo); - /** - * Creates a new BoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns BoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** UserInfo userId. */ + public userId: string; - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserInfo ipAddress. */ + public ipAddress: string; - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserInfo userAgent. */ + public userAgent: string; - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserInfo): google.cloud.retail.v2beta.UserInfo; - /** - * Verifies a BoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @param message BoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserInfo; - /** - * Converts this BoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserInfo; - namespace BoostSpec { + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of a ConditionBoostSpec. */ - interface IConditionBoostSpec { + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserInfo; - /** ConditionBoostSpec condition */ - condition?: (string|null); + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** ConditionBoostSpec boost */ - boost?: (number|null); - } + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Represents a ConditionBoostSpec. */ - class ConditionBoostSpec implements IConditionBoostSpec { + /** Properties of a LocalInventory. */ + interface ILocalInventory { - /** - * Constructs a new ConditionBoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec); + /** LocalInventory placeId */ + placeId?: (string|null); - /** ConditionBoostSpec condition. */ - public condition: string; + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); - /** ConditionBoostSpec boost. */ - public boost: number; + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns ConditionBoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** LocalInventory fulfillmentTypes */ + fulfillmentTypes?: (string[]|null); + } - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new LocalInventory. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ILocalInventory); - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** LocalInventory placeId. */ + public placeId: string; - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); - /** - * Verifies a ConditionBoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConditionBoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** LocalInventory fulfillmentTypes. */ + public fulfillmentTypes: string[]; - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @param message ConditionBoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new LocalInventory instance using the specified properties. + * @param [properties] Properties to set + * @returns LocalInventory instance + */ + public static create(properties?: google.cloud.retail.v2beta.ILocalInventory): google.cloud.retail.v2beta.LocalInventory; - /** - * Converts this ConditionBoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2beta.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a QueryExpansionSpec. */ - interface IQueryExpansionSpec { + /** + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; - /** QueryExpansionSpec condition */ - condition?: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null); + /** + * Decodes a LocalInventory message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.LocalInventory; - /** QueryExpansionSpec pinUnexpandedResults */ - pinUnexpandedResults?: (boolean|null); - } + /** + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.LocalInventory; - /** Represents a QueryExpansionSpec. */ - class QueryExpansionSpec implements IQueryExpansionSpec { + /** + * Verifies a LocalInventory message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Constructs a new QueryExpansionSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec); + /** + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocalInventory + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.LocalInventory; - /** QueryExpansionSpec condition. */ - public condition: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition); + /** + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @param message LocalInventory + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** QueryExpansionSpec pinUnexpandedResults. */ - public pinUnexpandedResults: boolean; + /** + * Converts this LocalInventory to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** Properties of a GcsSource. */ + interface IGcsSource { - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** GcsSource inputUris */ + inputUris?: (string[]|null); - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGcsSource); - /** - * Verifies a QueryExpansionSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** GcsSource inputUris. */ + public inputUris: string[]; - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** GcsSource dataSchema. */ + public dataSchema: string; - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @param message QueryExpansionSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGcsSource): google.cloud.retail.v2beta.GcsSource; - /** - * Converts this QueryExpansionSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - namespace QueryExpansionSpec { + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** Condition enum. */ - enum Condition { - CONDITION_UNSPECIFIED = 0, - DISABLED = 1, - AUTO = 3 - } - } + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GcsSource; - /** RelevanceThreshold enum. */ - enum RelevanceThreshold { - RELEVANCE_THRESHOLD_UNSPECIFIED = 0, - HIGH = 1, - MEDIUM = 2, - LOW = 3, - LOWEST = 4 - } + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GcsSource; - /** SearchMode enum. */ - enum SearchMode { - SEARCH_MODE_UNSPECIFIED = 0, - PRODUCT_SEARCH_ONLY = 1, - FACETED_SEARCH_ONLY = 2 - } - } + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of a SearchResponse. */ - interface ISearchResponse { + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GcsSource; - /** SearchResponse results */ - results?: (google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null); + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResponse facets */ - facets?: (google.cloud.retail.v2alpha.SearchResponse.IFacet[]|null); + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** SearchResponse totalSize */ - totalSize?: (number|null); + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { - /** SearchResponse correctedQuery */ - correctedQuery?: (string|null); + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); - /** SearchResponse attributionToken */ - attributionToken?: (string|null); + /** BigQuerySource projectId */ + projectId?: (string|null); - /** SearchResponse nextPageToken */ - nextPageToken?: (string|null); + /** BigQuerySource datasetId */ + datasetId?: (string|null); - /** SearchResponse queryExpansionInfo */ - queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + /** BigQuerySource tableId */ + tableId?: (string|null); - /** SearchResponse redirectUri */ - redirectUri?: (string|null); + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); - /** SearchResponse appliedControls */ - appliedControls?: (string[]|null); + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); } - /** Represents a SearchResponse. */ - class SearchResponse implements ISearchResponse { + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { /** - * Constructs a new SearchResponse. + * Constructs a new BigQuerySource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISearchResponse); - - /** SearchResponse results. */ - public results: google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]; - - /** SearchResponse facets. */ - public facets: google.cloud.retail.v2alpha.SearchResponse.IFacet[]; + constructor(properties?: google.cloud.retail.v2beta.IBigQuerySource); - /** SearchResponse totalSize. */ - public totalSize: number; + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); - /** SearchResponse correctedQuery. */ - public correctedQuery: string; + /** BigQuerySource projectId. */ + public projectId: string; - /** SearchResponse attributionToken. */ - public attributionToken: string; + /** BigQuerySource datasetId. */ + public datasetId: string; - /** SearchResponse nextPageToken. */ - public nextPageToken: string; + /** BigQuerySource tableId. */ + public tableId: string; - /** SearchResponse queryExpansionInfo. */ - public queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; - /** SearchResponse redirectUri. */ - public redirectUri: string; + /** BigQuerySource dataSchema. */ + public dataSchema: string; - /** SearchResponse appliedControls. */ - public appliedControls: string[]; + /** BigQuerySource partition. */ + public partition?: "partitionDate"; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new BigQuerySource instance using the specified properties. * @param [properties] Properties to set - * @returns SearchResponse instance + * @returns BigQuerySource instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISearchResponse): google.cloud.retail.v2alpha.SearchResponse; + public static create(properties?: google.cloud.retail.v2beta.IBigQuerySource): google.cloud.retail.v2beta.BigQuerySource; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchResponse + * @returns BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BigQuerySource; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchResponse + * @returns BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BigQuerySource; /** - * Verifies a SearchResponse message. + * Verifies a BigQuerySource message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchResponse + * @returns BigQuerySource */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BigQuerySource; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. - * @param message SearchResponse + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchResponse to JSON. + * Converts this BigQuerySource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchResponse { + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { - /** Properties of a SearchResult. */ - interface ISearchResult { + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2beta.IProduct[]|null); + } - /** SearchResult id */ - id?: (string|null); + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { - /** SearchResult product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductInlineSource); - /** SearchResult matchingVariantCount */ - matchingVariantCount?: (number|null); + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2beta.IProduct[]; - /** SearchResult matchingVariantFields */ - matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductInlineSource): google.cloud.retail.v2beta.ProductInlineSource; - /** SearchResult variantRollupValues */ - variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); - } + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a SearchResult. */ - class SearchResult implements ISearchResult { + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new SearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult); + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInlineSource; - /** SearchResult id. */ - public id: string; + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInlineSource; - /** SearchResult product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchResult matchingVariantCount. */ - public matchingVariantCount: number; + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInlineSource; - /** SearchResult matchingVariantFields. */ - public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResult variantRollupValues. */ - public variantRollupValues: { [k: string]: google.protobuf.IValue }; + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a new SearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns SearchResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2beta.IUserEvent[]|null); + } - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEventInlineSource); - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2beta.IUserEvent[]; - /** - * Verifies a SearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEventInlineSource): google.cloud.retail.v2beta.UserEventInlineSource; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @param message SearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInlineSource; - /** - * Converts this SearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInlineSource; - /** Properties of a Facet. */ - interface IFacet { + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Facet key */ - key?: (string|null); + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInlineSource; - /** Facet values */ - values?: (google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]|null); + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Facet dynamicFacet */ - dynamicFacet?: (boolean|null); - } + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Represents a Facet. */ - class Facet implements IFacet { + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { - /** - * Constructs a new Facet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet); + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } - /** Facet key. */ - public key: string; + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { - /** Facet values. */ - public values: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]; + /** + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportErrorsConfig); - /** Facet dynamicFacet. */ - public dynamicFacet: boolean; + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); - /** - * Creates a new Facet instance using the specified properties. - * @param [properties] Properties to set - * @returns Facet instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportErrorsConfig): google.cloud.retail.v2beta.ImportErrorsConfig; - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a Facet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportErrorsConfig; - /** - * Verifies a Facet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportErrorsConfig; - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Facet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @param message Facet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportErrorsConfig; - /** - * Converts this Facet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - namespace Facet { + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of a FacetValue. */ - interface IFacetValue { + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { - /** FacetValue value */ - value?: (string|null); + /** ImportProductsRequest parent */ + parent?: (string|null); - /** FacetValue interval */ - interval?: (google.cloud.retail.v2alpha.IInterval|null); + /** ImportProductsRequest requestId */ + requestId?: (string|null); - /** FacetValue count */ - count?: (number|Long|string|null); - } + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); - /** Represents a FacetValue. */ - class FacetValue implements IFacetValue { + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - /** - * Constructs a new FacetValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue); + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); - /** FacetValue value. */ - public value?: (string|null); + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|null); - /** FacetValue interval. */ - public interval?: (google.cloud.retail.v2alpha.IInterval|null); + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } - /** FacetValue count. */ - public count: (number|Long|string); + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { - /** FacetValue facetValue. */ - public facetValue?: ("value"|"interval"); + /** + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportProductsRequest); - /** - * Creates a new FacetValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetValue instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** ImportProductsRequest parent. */ + public parent: string; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** ImportProductsRequest requestId. */ + public requestId: string; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** - * Verifies a FacetValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode); - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @param message FacetValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IImportProductsRequest): google.cloud.retail.v2beta.ImportProductsRequest; - /** - * Converts this FacetValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a QueryExpansionInfo. */ - interface IQueryExpansionInfo { + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** QueryExpansionInfo expandedQuery */ - expandedQuery?: (boolean|null); + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsRequest; - /** QueryExpansionInfo pinnedResultCount */ - pinnedResultCount?: (number|Long|string|null); - } + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsRequest; - /** Represents a QueryExpansionInfo. */ - class QueryExpansionInfo implements IQueryExpansionInfo { + /** + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Constructs a new QueryExpansionInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo); + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsRequest; - /** QueryExpansionInfo expandedQuery. */ - public expandedQuery: boolean; + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** QueryExpansionInfo pinnedResultCount. */ - public pinnedResultCount: (number|Long|string); + /** + * Converts this ImportProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionInfo instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + namespace ImportProductsRequest { - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } + } - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** ImportUserEventsRequest parent */ + parent?: (string|null); - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); - /** - * Verifies a QueryExpansionInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + } - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { + + /** + * Constructs a new ImportUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest); - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @param message QueryExpansionInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ImportUserEventsRequest parent. */ + public parent: string; - /** - * Converts this QueryExpansionInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); - /** Represents a UserEventService */ - class UserEventService extends $protobuf.rpc.Service { + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); /** - * Constructs a new UserEventService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest): google.cloud.retail.v2beta.ImportUserEventsRequest; /** - * Creates new UserEventService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): UserEventService; + public static encode(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and UserEvent + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback): void; + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls WriteUserEvent. - * @param request WriteUserEventRequest message or plain object - * @returns Promise + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public writeUserEvent(request: google.cloud.retail.v2alpha.IWriteUserEventRequest): Promise; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsRequest; /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @param callback Node-style callback called with the error, if any, and HttpBody + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest, callback: google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback): void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsRequest; /** - * Calls CollectUserEvent. - * @param request CollectUserEventRequest message or plain object - * @returns Promise + * Verifies an ImportUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public collectUserEvent(request: google.cloud.retail.v2alpha.ICollectUserEventRequest): Promise; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsRequest */ - public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback): void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsRequest; /** - * Calls PurgeUserEvents. - * @param request PurgeUserEventsRequest message or plain object - * @returns Promise + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest + * @param [options] Conversion options + * @returns Plain object */ - public purgeUserEvents(request: google.cloud.retail.v2alpha.IPurgeUserEventsRequest): Promise; + public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Converts this ImportUserEventsRequest to JSON. + * @returns JSON object */ - public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback): void; + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { + + /** ImportCompletionDataRequest parent */ + parent?: (string|null); + + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { /** - * Calls ImportUserEvents. - * @param request ImportUserEventsRequest message or plain object - * @returns Promise + * Constructs a new ImportCompletionDataRequest. + * @param [properties] Properties to set */ - public importUserEvents(request: google.cloud.retail.v2alpha.IImportUserEventsRequest): Promise; + constructor(properties?: google.cloud.retail.v2beta.IImportCompletionDataRequest); + + /** ImportCompletionDataRequest parent. */ + public parent: string; + + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataRequest instance */ - public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, callback: google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback): void; + public static create(properties?: google.cloud.retail.v2beta.IImportCompletionDataRequest): google.cloud.retail.v2beta.ImportCompletionDataRequest; /** - * Calls RejoinUserEvents. - * @param request RejoinUserEventsRequest message or plain object - * @returns Promise + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public rejoinUserEvents(request: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): Promise; - } + public static encode(message: google.cloud.retail.v2beta.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; - namespace UserEventService { + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. - * @param error Error, if any - * @param [response] UserEvent + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.UserEvent) => void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportCompletionDataRequest; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. - * @param error Error, if any - * @param [response] HttpBody + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportCompletionDataRequest; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Verifies an ImportCompletionDataRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataRequest */ - type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportCompletionDataRequest; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. - * @param error Error, if any - * @param [response] Operation + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest + * @param [options] Conversion options + * @returns Plain object */ - type RejoinUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.retail.v2beta.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCompletionDataRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a WriteUserEventRequest. */ - interface IWriteUserEventRequest { + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { - /** WriteUserEventRequest parent */ - parent?: (string|null); + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); - /** WriteUserEventRequest userEvent */ - userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); } - /** Represents a WriteUserEventRequest. */ - class WriteUserEventRequest implements IWriteUserEventRequest { + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { /** - * Constructs a new WriteUserEventRequest. + * Constructs a new ProductInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest); + constructor(properties?: google.cloud.retail.v2beta.IProductInputConfig); - /** WriteUserEventRequest parent. */ - public parent: string; + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); - /** WriteUserEventRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new WriteUserEventRequest instance using the specified properties. + * Creates a new ProductInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns WriteUserEventRequest instance + * @returns ProductInputConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IWriteUserEventRequest): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static create(properties?: google.cloud.retail.v2beta.IProductInputConfig): google.cloud.retail.v2beta.ProductInputConfig; /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. - * @param message WriteUserEventRequest message or plain object to encode + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IWriteUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns WriteUserEventRequest + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInputConfig; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns WriteUserEventRequest + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInputConfig; /** - * Verifies a WriteUserEventRequest message. + * Verifies a ProductInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns WriteUserEventRequest + * @returns ProductInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.WriteUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInputConfig; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. - * @param message WriteUserEventRequest + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.WriteUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this ProductInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CollectUserEventRequest. */ - interface ICollectUserEventRequest { - - /** CollectUserEventRequest parent */ - parent?: (string|null); + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { - /** CollectUserEventRequest userEvent */ - userEvent?: (string|null); + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); - /** CollectUserEventRequest uri */ - uri?: (string|null); + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); - /** CollectUserEventRequest ets */ - ets?: (number|Long|string|null); + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); } - /** Represents a CollectUserEventRequest. */ - class CollectUserEventRequest implements ICollectUserEventRequest { + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { /** - * Constructs a new CollectUserEventRequest. + * Constructs a new UserEventInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest); + constructor(properties?: google.cloud.retail.v2beta.IUserEventInputConfig); - /** CollectUserEventRequest parent. */ - public parent: string; + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); - /** CollectUserEventRequest userEvent. */ - public userEvent: string; + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); - /** CollectUserEventRequest uri. */ - public uri: string; + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); - /** CollectUserEventRequest ets. */ - public ets: (number|Long|string); + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); /** - * Creates a new CollectUserEventRequest instance using the specified properties. + * Creates a new UserEventInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns CollectUserEventRequest instance + * @returns UserEventInputConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICollectUserEventRequest): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static create(properties?: google.cloud.retail.v2beta.IUserEventInputConfig): google.cloud.retail.v2beta.UserEventInputConfig; /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. - * @param message CollectUserEventRequest message or plain object to encode + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICollectUserEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CollectUserEventRequest + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInputConfig; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CollectUserEventRequest + * @returns UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInputConfig; /** - * Verifies a CollectUserEventRequest message. + * Verifies a UserEventInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CollectUserEventRequest + * @returns UserEventInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CollectUserEventRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInputConfig; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @param message CollectUserEventRequest + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CollectUserEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CollectUserEventRequest to JSON. + * Converts this UserEventInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsRequest. */ - interface IRejoinUserEventsRequest { - - /** RejoinUserEventsRequest parent */ - parent?: (string|null); + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { - /** RejoinUserEventsRequest userEventRejoinScope */ - userEventRejoinScope?: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null); + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); } - /** Represents a RejoinUserEventsRequest. */ - class RejoinUserEventsRequest implements IRejoinUserEventsRequest { + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { /** - * Constructs a new RejoinUserEventsRequest. + * Constructs a new CompletionDataInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest); + constructor(properties?: google.cloud.retail.v2beta.ICompletionDataInputConfig); - /** RejoinUserEventsRequest parent. */ - public parent: string; + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); - /** RejoinUserEventsRequest userEventRejoinScope. */ - public userEventRejoinScope: (google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|keyof typeof google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope); + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsRequest instance + * @returns CompletionDataInputConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsRequest): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static create(properties?: google.cloud.retail.v2beta.ICompletionDataInputConfig): google.cloud.retail.v2beta.CompletionDataInputConfig; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. - * @param message RejoinUserEventsRequest message or plain object to encode + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsRequest + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionDataInputConfig; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsRequest + * @returns CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionDataInputConfig; /** - * Verifies a RejoinUserEventsRequest message. + * Verifies a CompletionDataInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsRequest + * @returns CompletionDataInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionDataInputConfig; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. - * @param message RejoinUserEventsRequest + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsRequest to JSON. + * Converts this CompletionDataInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace RejoinUserEventsRequest { + /** Properties of an ImportMetadata. */ + interface IImportMetadata { - /** UserEventRejoinScope enum. */ - enum UserEventRejoinScope { - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0, - JOINED_EVENTS = 1, - UNJOINED_EVENTS = 2 - } - } + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** Properties of a RejoinUserEventsResponse. */ - interface IRejoinUserEventsResponse { + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); - /** RejoinUserEventsResponse rejoinedUserEventsCount */ - rejoinedUserEventsCount?: (number|Long|string|null); + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); } - /** Represents a RejoinUserEventsResponse. */ - class RejoinUserEventsResponse implements IRejoinUserEventsResponse { + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { /** - * Constructs a new RejoinUserEventsResponse. + * Constructs a new ImportMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse); + constructor(properties?: google.cloud.retail.v2beta.IImportMetadata); + + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** ImportMetadata requestId. */ + public requestId: string; - /** RejoinUserEventsResponse rejoinedUserEventsCount. */ - public rejoinedUserEventsCount: (number|Long|string); + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. + * Creates a new ImportMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsResponse instance + * @returns ImportMetadata instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsResponse): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static create(properties?: google.cloud.retail.v2beta.IImportMetadata): google.cloud.retail.v2beta.ImportMetadata; /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. - * @param message RejoinUserEventsResponse message or plain object to encode + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsResponse + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportMetadata; /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsResponse + * @returns ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportMetadata; /** - * Verifies a RejoinUserEventsResponse message. + * Verifies an ImportMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsResponse + * @returns ImportMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportMetadata; /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. - * @param message RejoinUserEventsResponse + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this ImportMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a RejoinUserEventsMetadata. */ - interface IRejoinUserEventsMetadata { + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { + + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); } - /** Represents a RejoinUserEventsMetadata. */ - class RejoinUserEventsMetadata implements IRejoinUserEventsMetadata { + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { /** - * Constructs a new RejoinUserEventsMetadata. + * Constructs a new ImportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata); + constructor(properties?: google.cloud.retail.v2beta.IImportProductsResponse); + + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns RejoinUserEventsMetadata instance + * @returns ImportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static create(properties?: google.cloud.retail.v2beta.IImportProductsResponse): google.cloud.retail.v2beta.ImportProductsResponse; /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. - * @param message RejoinUserEventsMetadata message or plain object to encode + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRejoinUserEventsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RejoinUserEventsMetadata + * @returns ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsResponse; /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RejoinUserEventsMetadata + * @returns ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsResponse; /** - * Verifies a RejoinUserEventsMetadata message. + * Verifies an ImportProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RejoinUserEventsMetadata + * @returns ImportProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RejoinUserEventsMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsResponse; /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. - * @param message RejoinUserEventsMetadata + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.RejoinUserEventsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RejoinUserEventsMetadata to JSON. + * Converts this ImportProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - } - /** Namespace v2beta. */ - namespace v2beta { + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { - /** Properties of a ProductLevelConfig. */ - interface IProductLevelConfig { + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** ProductLevelConfig ingestionProductType */ - ingestionProductType?: (string|null); + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - /** ProductLevelConfig merchantCenterProductIdField */ - merchantCenterProductIdField?: (string|null); + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); } - /** Represents a ProductLevelConfig. */ - class ProductLevelConfig implements IProductLevelConfig { + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { /** - * Constructs a new ProductLevelConfig. + * Constructs a new ImportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductLevelConfig); + constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse); - /** ProductLevelConfig ingestionProductType. */ - public ingestionProductType: string; + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** ProductLevelConfig merchantCenterProductIdField. */ - public merchantCenterProductIdField: string; + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); /** - * Creates a new ProductLevelConfig instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ProductLevelConfig instance + * @returns ImportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductLevelConfig): google.cloud.retail.v2beta.ProductLevelConfig; + public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse): google.cloud.retail.v2beta.ImportUserEventsResponse; /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. - * @param message ProductLevelConfig message or plain object to encode + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductLevelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductLevelConfig + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductLevelConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsResponse; /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductLevelConfig + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductLevelConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsResponse; /** - * Verifies a ProductLevelConfig message. + * Verifies an ImportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductLevelConfig + * @returns ImportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductLevelConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsResponse; /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. - * @param message ProductLevelConfig + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductLevelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductLevelConfig to JSON. + * Converts this ImportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Catalog. */ - interface ICatalog { - - /** Catalog name */ - name?: (string|null); + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { - /** Catalog displayName */ - displayName?: (string|null); + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); } - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { /** - * Constructs a new Catalog. + * Constructs a new UserEventImportSummary. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICatalog); - - /** Catalog name. */ - public name: string; + constructor(properties?: google.cloud.retail.v2beta.IUserEventImportSummary); - /** Catalog displayName. */ - public displayName: string; + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2beta.IProductLevelConfig|null); + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); /** - * Creates a new Catalog instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @param [properties] Properties to set - * @returns Catalog instance + * @returns UserEventImportSummary instance */ - public static create(properties?: google.cloud.retail.v2beta.ICatalog): google.cloud.retail.v2beta.Catalog; + public static create(properties?: google.cloud.retail.v2beta.IUserEventImportSummary): google.cloud.retail.v2beta.UserEventImportSummary; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Catalog + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Catalog; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventImportSummary; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Catalog + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Catalog; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventImportSummary; /** - * Verifies a Catalog message. + * Verifies a UserEventImportSummary message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Catalog + * @returns UserEventImportSummary */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Catalog; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventImportSummary; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Catalog to JSON. + * Converts this UserEventImportSummary to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** SolutionType enum. */ - enum SolutionType { - SOLUTION_TYPE_UNSPECIFIED = 0, - SOLUTION_TYPE_RECOMMENDATION = 1, - SOLUTION_TYPE_SEARCH = 2 - } - - /** Properties of a Condition. */ - interface ICondition { - - /** Condition queryTerms */ - queryTerms?: (google.cloud.retail.v2beta.Condition.IQueryTerm[]|null); + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { - /** Condition activeTimeRange */ - activeTimeRange?: (google.cloud.retail.v2beta.Condition.ITimeRange[]|null); + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); } - /** Represents a Condition. */ - class Condition implements ICondition { + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { /** - * Constructs a new Condition. + * Constructs a new ImportCompletionDataResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICondition); - - /** Condition queryTerms. */ - public queryTerms: google.cloud.retail.v2beta.Condition.IQueryTerm[]; + constructor(properties?: google.cloud.retail.v2beta.IImportCompletionDataResponse); - /** Condition activeTimeRange. */ - public activeTimeRange: google.cloud.retail.v2beta.Condition.ITimeRange[]; + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; /** - * Creates a new Condition instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Condition instance + * @returns ImportCompletionDataResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.ICondition): google.cloud.retail.v2beta.Condition; + public static create(properties?: google.cloud.retail.v2beta.IImportCompletionDataResponse): google.cloud.retail.v2beta.ImportCompletionDataResponse; /** - * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. - * @param message Condition message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. - * @param message Condition message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Condition message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Condition + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportCompletionDataResponse; /** - * Decodes a Condition message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Condition + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportCompletionDataResponse; /** - * Verifies a Condition message. + * Verifies an ImportCompletionDataResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Condition + * @returns ImportCompletionDataResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportCompletionDataResponse; /** - * Creates a plain object from a Condition message. Also converts values to other types if specified. - * @param message Condition + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Condition to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Condition { + /** Properties of a Product. */ + interface IProduct { - /** Properties of a QueryTerm. */ - interface IQueryTerm { + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); - /** QueryTerm value */ - value?: (string|null); + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); - /** QueryTerm fullMatch */ - fullMatch?: (boolean|null); - } + /** Product name */ + name?: (string|null); - /** Represents a QueryTerm. */ - class QueryTerm implements IQueryTerm { + /** Product id */ + id?: (string|null); - /** - * Constructs a new QueryTerm. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Condition.IQueryTerm); + /** Product type */ + type?: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type|null); - /** QueryTerm value. */ - public value: string; + /** Product primaryProductId */ + primaryProductId?: (string|null); - /** QueryTerm fullMatch. */ - public fullMatch: boolean; + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); - /** - * Creates a new QueryTerm instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryTerm instance - */ - public static create(properties?: google.cloud.retail.v2beta.Condition.IQueryTerm): google.cloud.retail.v2beta.Condition.QueryTerm; + /** Product gtin */ + gtin?: (string|null); - /** - * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. - * @param message QueryTerm message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product categories */ + categories?: (string[]|null); - /** - * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. - * @param message QueryTerm message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product title */ + title?: (string|null); - /** - * Decodes a QueryTerm message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition.QueryTerm; + /** Product brands */ + brands?: (string[]|null); - /** - * Decodes a QueryTerm message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition.QueryTerm; + /** Product description */ + description?: (string|null); - /** - * Verifies a QueryTerm message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Product languageCode */ + languageCode?: (string|null); - /** - * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryTerm - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition.QueryTerm; + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); - /** - * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. - * @param message QueryTerm - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + + /** Product rating */ + rating?: (google.cloud.retail.v2beta.IRating|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2beta.IFulfillmentInfo[]|null); + + /** Product uri */ + uri?: (string|null); + + /** Product images */ + images?: (google.cloud.retail.v2beta.IImage[]|null); + + /** Product audience */ + audience?: (google.cloud.retail.v2beta.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2beta.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); - /** - * Converts this QueryTerm to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Product promotions */ + promotions?: (google.cloud.retail.v2beta.IPromotion[]|null); - /** Properties of a TimeRange. */ - interface ITimeRange { + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); - /** TimeRange startTime */ - startTime?: (google.protobuf.ITimestamp|null); + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); - /** TimeRange endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } + /** Product variants */ + variants?: (google.cloud.retail.v2beta.IProduct[]|null); + } - /** Represents a TimeRange. */ - class TimeRange implements ITimeRange { + /** Represents a Product. */ + class Product implements IProduct { - /** - * Constructs a new TimeRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Condition.ITimeRange); + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProduct); - /** TimeRange startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); - /** TimeRange endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); - /** - * Creates a new TimeRange instance using the specified properties. - * @param [properties] Properties to set - * @returns TimeRange instance - */ - public static create(properties?: google.cloud.retail.v2beta.Condition.ITimeRange): google.cloud.retail.v2beta.Condition.TimeRange; + /** Product name. */ + public name: string; - /** - * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. - * @param message TimeRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product id. */ + public id: string; - /** - * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. - * @param message TimeRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; + /** Product type. */ + public type: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type); - /** - * Decodes a TimeRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Condition.TimeRange; + /** Product primaryProductId. */ + public primaryProductId: string; - /** - * Decodes a TimeRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Condition.TimeRange; + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; - /** - * Verifies a TimeRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Product gtin. */ + public gtin: string; - /** - * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TimeRange - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Condition.TimeRange; + /** Product categories. */ + public categories: string[]; - /** - * Creates a plain object from a TimeRange message. Also converts values to other types if specified. - * @param message TimeRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Product title. */ + public title: string; - /** - * Converts this TimeRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** Product brands. */ + public brands: string[]; - /** Properties of a Rule. */ - interface IRule { + /** Product description. */ + public description: string; - /** Rule boostAction */ - boostAction?: (google.cloud.retail.v2beta.Rule.IBoostAction|null); + /** Product languageCode. */ + public languageCode: string; - /** Rule redirectAction */ - redirectAction?: (google.cloud.retail.v2beta.Rule.IRedirectAction|null); + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; - /** Rule onewaySynonymsAction */ - onewaySynonymsAction?: (google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null); + /** Product tags. */ + public tags: string[]; - /** Rule doNotAssociateAction */ - doNotAssociateAction?: (google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null); + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); - /** Rule replacementAction */ - replacementAction?: (google.cloud.retail.v2beta.Rule.IReplacementAction|null); + /** Product rating. */ + public rating?: (google.cloud.retail.v2beta.IRating|null); - /** Rule ignoreAction */ - ignoreAction?: (google.cloud.retail.v2beta.Rule.IIgnoreAction|null); + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); - /** Rule filterAction */ - filterAction?: (google.cloud.retail.v2beta.Rule.IFilterAction|null); + /** Product availability. */ + public availability: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability); - /** Rule twowaySynonymsAction */ - twowaySynonymsAction?: (google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null); + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); - /** Rule condition */ - condition?: (google.cloud.retail.v2beta.ICondition|null); - } + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2beta.IFulfillmentInfo[]; - /** Represents a Rule. */ - class Rule implements IRule { + /** Product uri. */ + public uri: string; - /** - * Constructs a new Rule. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IRule); + /** Product images. */ + public images: google.cloud.retail.v2beta.IImage[]; - /** Rule boostAction. */ - public boostAction?: (google.cloud.retail.v2beta.Rule.IBoostAction|null); + /** Product audience. */ + public audience?: (google.cloud.retail.v2beta.IAudience|null); - /** Rule redirectAction. */ - public redirectAction?: (google.cloud.retail.v2beta.Rule.IRedirectAction|null); + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2beta.IColorInfo|null); - /** Rule onewaySynonymsAction. */ - public onewaySynonymsAction?: (google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null); + /** Product sizes. */ + public sizes: string[]; - /** Rule doNotAssociateAction. */ - public doNotAssociateAction?: (google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null); + /** Product materials. */ + public materials: string[]; - /** Rule replacementAction. */ - public replacementAction?: (google.cloud.retail.v2beta.Rule.IReplacementAction|null); + /** Product patterns. */ + public patterns: string[]; - /** Rule ignoreAction. */ - public ignoreAction?: (google.cloud.retail.v2beta.Rule.IIgnoreAction|null); + /** Product conditions. */ + public conditions: string[]; - /** Rule filterAction. */ - public filterAction?: (google.cloud.retail.v2beta.Rule.IFilterAction|null); + /** Product promotions. */ + public promotions: google.cloud.retail.v2beta.IPromotion[]; - /** Rule twowaySynonymsAction. */ - public twowaySynonymsAction?: (google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null); + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); - /** Rule condition. */ - public condition?: (google.cloud.retail.v2beta.ICondition|null); + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); - /** Rule action. */ - public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + /** Product variants. */ + public variants: google.cloud.retail.v2beta.IProduct[]; + + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); /** - * Creates a new Rule instance using the specified properties. + * Creates a new Product instance using the specified properties. * @param [properties] Properties to set - * @returns Rule instance + * @returns Product instance */ - public static create(properties?: google.cloud.retail.v2beta.IRule): google.cloud.retail.v2beta.Rule; + public static create(properties?: google.cloud.retail.v2beta.IProduct): google.cloud.retail.v2beta.Product; /** - * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. - * @param message Rule message or plain object to encode + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. - * @param message Rule message or plain object to encode + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rule message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rule + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Product; /** - * Decodes a Rule message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rule + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Product; /** - * Verifies a Rule message. + * Verifies a Product message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rule + * @returns Product */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Product; /** - * Creates a plain object from a Rule message. Also converts values to other types if specified. - * @param message Rule + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rule to JSON. + * Converts this Product to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Rule { - - /** Properties of a BoostAction. */ - interface IBoostAction { - - /** BoostAction boost */ - boost?: (number|null); - - /** BoostAction productsFilter */ - productsFilter?: (string|null); - } - - /** Represents a BoostAction. */ - class BoostAction implements IBoostAction { - - /** - * Constructs a new BoostAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IBoostAction); - - /** BoostAction boost. */ - public boost: number; - - /** BoostAction productsFilter. */ - public productsFilter: string; - - /** - * Creates a new BoostAction instance using the specified properties. - * @param [properties] Properties to set - * @returns BoostAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IBoostAction): google.cloud.retail.v2beta.Rule.BoostAction; - - /** - * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. - * @param message BoostAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. - * @param message BoostAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoostAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoostAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.BoostAction; - - /** - * Decodes a BoostAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoostAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.BoostAction; - - /** - * Verifies a BoostAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoostAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.BoostAction; - - /** - * Creates a plain object from a BoostAction message. Also converts values to other types if specified. - * @param message BoostAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + namespace Product { - /** - * Converts this BoostAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 } - /** Properties of a FilterAction. */ - interface IFilterAction { - - /** FilterAction filter */ - filter?: (string|null); + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 } + } - /** Represents a FilterAction. */ - class FilterAction implements IFilterAction { - - /** - * Constructs a new FilterAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IFilterAction); - - /** FilterAction filter. */ - public filter: string; - - /** - * Creates a new FilterAction instance using the specified properties. - * @param [properties] Properties to set - * @returns FilterAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IFilterAction): google.cloud.retail.v2beta.Rule.FilterAction; - - /** - * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. - * @param message FilterAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. - * @param message FilterAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FilterAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FilterAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.FilterAction; - - /** - * Decodes a FilterAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FilterAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.FilterAction; - - /** - * Verifies a FilterAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Properties of a Promotion. */ + interface IPromotion { - /** - * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FilterAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.FilterAction; + /** Promotion promotionId */ + promotionId?: (string|null); + } - /** - * Creates a plain object from a FilterAction message. Also converts values to other types if specified. - * @param message FilterAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Represents a Promotion. */ + class Promotion implements IPromotion { - /** - * Converts this FilterAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Constructs a new Promotion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPromotion); - /** Properties of a RedirectAction. */ - interface IRedirectAction { + /** Promotion promotionId. */ + public promotionId: string; - /** RedirectAction redirectUri */ - redirectUri?: (string|null); - } + /** + * Creates a new Promotion instance using the specified properties. + * @param [properties] Properties to set + * @returns Promotion instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPromotion): google.cloud.retail.v2beta.Promotion; - /** Represents a RedirectAction. */ - class RedirectAction implements IRedirectAction { + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new RedirectAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IRedirectAction); + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; - /** RedirectAction redirectUri. */ - public redirectUri: string; + /** + * Decodes a Promotion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Promotion; - /** - * Creates a new RedirectAction instance using the specified properties. - * @param [properties] Properties to set - * @returns RedirectAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IRedirectAction): google.cloud.retail.v2beta.Rule.RedirectAction; + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Promotion; - /** - * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. - * @param message RedirectAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a Promotion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. - * @param message RedirectAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Promotion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Promotion; - /** - * Decodes a RedirectAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.RedirectAction; + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes a RedirectAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.RedirectAction; + /** + * Converts this Promotion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Verifies a RedirectAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Properties of a UserEvent. */ + interface IUserEvent { - /** - * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RedirectAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.RedirectAction; + /** UserEvent eventType */ + eventType?: (string|null); - /** - * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. - * @param message RedirectAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** UserEvent visitorId */ + visitorId?: (string|null); - /** - * Converts this RedirectAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** UserEvent sessionId */ + sessionId?: (string|null); - /** Properties of a TwowaySynonymsAction. */ - interface ITwowaySynonymsAction { + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); - /** TwowaySynonymsAction synonyms */ - synonyms?: (string[]|null); - } + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); - /** Represents a TwowaySynonymsAction. */ - class TwowaySynonymsAction implements ITwowaySynonymsAction { + /** UserEvent attributionToken */ + attributionToken?: (string|null); - /** - * Constructs a new TwowaySynonymsAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction); + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2beta.IProductDetail[]|null); - /** TwowaySynonymsAction synonyms. */ - public synonyms: string[]; + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2beta.ICompletionDetail|null); - /** - * Creates a new TwowaySynonymsAction instance using the specified properties. - * @param [properties] Properties to set - * @returns TwowaySynonymsAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); - /** - * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. - * @param message TwowaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent cartId */ + cartId?: (string|null); - /** - * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. - * @param message TwowaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + /** UserEvent searchQuery */ + searchQuery?: (string|null); - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + /** UserEvent filter */ + filter?: (string|null); - /** - * Verifies a TwowaySynonymsAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** UserEvent orderBy */ + orderBy?: (string|null); - /** - * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TwowaySynonymsAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.TwowaySynonymsAction; + /** UserEvent offset */ + offset?: (number|null); - /** - * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. - * @param message TwowaySynonymsAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); - /** - * Converts this TwowaySynonymsAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); - /** Properties of an OnewaySynonymsAction. */ - interface IOnewaySynonymsAction { + /** UserEvent uri */ + uri?: (string|null); - /** OnewaySynonymsAction queryTerms */ - queryTerms?: (string[]|null); + /** UserEvent referrerUri */ + referrerUri?: (string|null); - /** OnewaySynonymsAction synonyms */ - synonyms?: (string[]|null); + /** UserEvent pageViewId */ + pageViewId?: (string|null); + } - /** OnewaySynonymsAction onewayTerms */ - onewayTerms?: (string[]|null); - } + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { - /** Represents an OnewaySynonymsAction. */ - class OnewaySynonymsAction implements IOnewaySynonymsAction { + /** + * Constructs a new UserEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUserEvent); - /** - * Constructs a new OnewaySynonymsAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction); + /** UserEvent eventType. */ + public eventType: string; - /** OnewaySynonymsAction queryTerms. */ - public queryTerms: string[]; + /** UserEvent visitorId. */ + public visitorId: string; - /** OnewaySynonymsAction synonyms. */ - public synonyms: string[]; + /** UserEvent sessionId. */ + public sessionId: string; - /** OnewaySynonymsAction onewayTerms. */ - public onewayTerms: string[]; + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); - /** - * Creates a new OnewaySynonymsAction instance using the specified properties. - * @param [properties] Properties to set - * @returns OnewaySynonymsAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + /** UserEvent experimentIds. */ + public experimentIds: string[]; - /** - * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. - * @param message OnewaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent attributionToken. */ + public attributionToken: string; - /** - * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. - * @param message OnewaySynonymsAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2beta.IProductDetail[]; - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2beta.ICompletionDetail|null); - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; - /** - * Verifies an OnewaySynonymsAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** UserEvent cartId. */ + public cartId: string; - /** - * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OnewaySynonymsAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.OnewaySynonymsAction; + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); - /** - * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. - * @param message OnewaySynonymsAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** UserEvent searchQuery. */ + public searchQuery: string; - /** - * Converts this OnewaySynonymsAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** UserEvent filter. */ + public filter: string; - /** Properties of a DoNotAssociateAction. */ - interface IDoNotAssociateAction { + /** UserEvent orderBy. */ + public orderBy: string; - /** DoNotAssociateAction queryTerms */ - queryTerms?: (string[]|null); + /** UserEvent offset. */ + public offset: number; - /** DoNotAssociateAction doNotAssociateTerms */ - doNotAssociateTerms?: (string[]|null); + /** UserEvent pageCategories. */ + public pageCategories: string[]; - /** DoNotAssociateAction terms */ - terms?: (string[]|null); - } + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); - /** Represents a DoNotAssociateAction. */ - class DoNotAssociateAction implements IDoNotAssociateAction { + /** UserEvent uri. */ + public uri: string; - /** - * Constructs a new DoNotAssociateAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction); + /** UserEvent referrerUri. */ + public referrerUri: string; - /** DoNotAssociateAction queryTerms. */ - public queryTerms: string[]; + /** UserEvent pageViewId. */ + public pageViewId: string; - /** DoNotAssociateAction doNotAssociateTerms. */ - public doNotAssociateTerms: string[]; + /** + * Creates a new UserEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEvent instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUserEvent): google.cloud.retail.v2beta.UserEvent; - /** DoNotAssociateAction terms. */ - public terms: string[]; + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new DoNotAssociateAction instance using the specified properties. - * @param [properties] Properties to set - * @returns DoNotAssociateAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. - * @param message DoNotAssociateAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEvent; - /** - * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. - * @param message DoNotAssociateAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEvent; - /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DoNotAssociateAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + /** + * Verifies a UserEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DoNotAssociateAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEvent; - /** - * Verifies a DoNotAssociateAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DoNotAssociateAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.DoNotAssociateAction; + /** + * Converts this UserEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. - * @param message DoNotAssociateAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Properties of a ProductDetail. */ + interface IProductDetail { - /** - * Converts this DoNotAssociateAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** ProductDetail product */ + product?: (google.cloud.retail.v2beta.IProduct|null); - /** Properties of a ReplacementAction. */ - interface IReplacementAction { + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); + } - /** ReplacementAction queryTerms */ - queryTerms?: (string[]|null); + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { - /** ReplacementAction replacementTerm */ - replacementTerm?: (string|null); + /** + * Constructs a new ProductDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IProductDetail); - /** ReplacementAction term */ - term?: (string|null); - } + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); - /** Represents a ReplacementAction. */ - class ReplacementAction implements IReplacementAction { + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); - /** - * Constructs a new ReplacementAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IReplacementAction); + /** + * Creates a new ProductDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductDetail instance + */ + public static create(properties?: google.cloud.retail.v2beta.IProductDetail): google.cloud.retail.v2beta.ProductDetail; - /** ReplacementAction queryTerms. */ - public queryTerms: string[]; + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** ReplacementAction replacementTerm. */ - public replacementTerm: string; + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** ReplacementAction term. */ - public term: string; + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductDetail; - /** - * Creates a new ReplacementAction instance using the specified properties. - * @param [properties] Properties to set - * @returns ReplacementAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IReplacementAction): google.cloud.retail.v2beta.Rule.ReplacementAction; + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductDetail; - /** - * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. - * @param message ReplacementAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a ProductDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. - * @param message ReplacementAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductDetail; - /** - * Decodes a ReplacementAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.ReplacementAction; + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.ReplacementAction; + /** + * Converts this ProductDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Verifies a ReplacementAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { - /** - * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReplacementAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.ReplacementAction; + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); - /** - * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. - * @param message ReplacementAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); - /** - * Converts this ReplacementAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); + } - /** Properties of an IgnoreAction. */ - interface IIgnoreAction { + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { - /** IgnoreAction ignoreTerms */ - ignoreTerms?: (string[]|null); - } + /** + * Constructs a new CompletionDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICompletionDetail); - /** Represents an IgnoreAction. */ - class IgnoreAction implements IIgnoreAction { + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; - /** - * Constructs a new IgnoreAction. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.Rule.IIgnoreAction); + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; - /** IgnoreAction ignoreTerms. */ - public ignoreTerms: string[]; + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; - /** - * Creates a new IgnoreAction instance using the specified properties. - * @param [properties] Properties to set - * @returns IgnoreAction instance - */ - public static create(properties?: google.cloud.retail.v2beta.Rule.IIgnoreAction): google.cloud.retail.v2beta.Rule.IgnoreAction; + /** + * Creates a new CompletionDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDetail instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICompletionDetail): google.cloud.retail.v2beta.CompletionDetail; - /** - * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. - * @param message IgnoreAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. - * @param message IgnoreAction message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes an IgnoreAction message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rule.IgnoreAction; + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionDetail; - /** - * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rule.IgnoreAction; + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionDetail; - /** - * Verifies an IgnoreAction message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a CompletionDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns IgnoreAction - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rule.IgnoreAction; + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionDetail; - /** - * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. - * @param message IgnoreAction - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this IgnoreAction to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this CompletionDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of an Audience. */ - interface IAudience { + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { - /** Audience genders */ - genders?: (string[]|null); + /** PurchaseTransaction id */ + id?: (string|null); - /** Audience ageGroups */ - ageGroups?: (string[]|null); + /** PurchaseTransaction revenue */ + revenue?: (number|null); + + /** PurchaseTransaction tax */ + tax?: (number|null); + + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); } - /** Represents an Audience. */ - class Audience implements IAudience { + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { /** - * Constructs a new Audience. + * Constructs a new PurchaseTransaction. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IAudience); + constructor(properties?: google.cloud.retail.v2beta.IPurchaseTransaction); - /** Audience genders. */ - public genders: string[]; + /** PurchaseTransaction id. */ + public id: string; - /** Audience ageGroups. */ - public ageGroups: string[]; + /** PurchaseTransaction revenue. */ + public revenue: number; + + /** PurchaseTransaction tax. */ + public tax: number; + + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; /** - * Creates a new Audience instance using the specified properties. + * Creates a new PurchaseTransaction instance using the specified properties. * @param [properties] Properties to set - * @returns Audience instance + * @returns PurchaseTransaction instance */ - public static create(properties?: google.cloud.retail.v2beta.IAudience): google.cloud.retail.v2beta.Audience; + public static create(properties?: google.cloud.retail.v2beta.IPurchaseTransaction): google.cloud.retail.v2beta.PurchaseTransaction; /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Audience message from the specified reader or buffer. + * Decodes a PurchaseTransaction message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Audience + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Audience; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurchaseTransaction; /** - * Decodes an Audience message from the specified reader or buffer, length delimited. + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Audience + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Audience; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Verifies a PurchaseTransaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurchaseTransaction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurchaseTransaction; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurchaseTransaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { + + /** + * Constructs a new CatalogService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse + */ + public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest, callback: google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback): void; + + /** + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @returns Promise + */ + public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest): Promise; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog + */ + public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback): void; + + /** + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @returns Promise + */ + public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest): Promise; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public setDefaultBranch(request: google.cloud.retail.v2beta.ISetDefaultBranchRequest, callback: google.cloud.retail.v2beta.CatalogService.SetDefaultBranchCallback): void; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise + */ + public setDefaultBranch(request: google.cloud.retail.v2beta.ISetDefaultBranchRequest): Promise; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + */ + public getDefaultBranch(request: google.cloud.retail.v2beta.IGetDefaultBranchRequest, callback: google.cloud.retail.v2beta.CatalogService.GetDefaultBranchCallback): void; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise + */ + public getDefaultBranch(request: google.cloud.retail.v2beta.IGetDefaultBranchRequest): Promise; + + /** + * Calls GetCompletionConfig. + * @param request GetCompletionConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompletionConfig + */ + public getCompletionConfig(request: google.cloud.retail.v2beta.IGetCompletionConfigRequest, callback: google.cloud.retail.v2beta.CatalogService.GetCompletionConfigCallback): void; + + /** + * Calls GetCompletionConfig. + * @param request GetCompletionConfigRequest message or plain object + * @returns Promise + */ + public getCompletionConfig(request: google.cloud.retail.v2beta.IGetCompletionConfigRequest): Promise; + + /** + * Calls UpdateCompletionConfig. + * @param request UpdateCompletionConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompletionConfig + */ + public updateCompletionConfig(request: google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfigCallback): void; + + /** + * Calls UpdateCompletionConfig. + * @param request UpdateCompletionConfigRequest message or plain object + * @returns Promise + */ + public updateCompletionConfig(request: google.cloud.retail.v2beta.IUpdateCompletionConfigRequest): Promise; + + /** + * Calls GetAttributesConfig. + * @param request GetAttributesConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public getAttributesConfig(request: google.cloud.retail.v2beta.IGetAttributesConfigRequest, callback: google.cloud.retail.v2beta.CatalogService.GetAttributesConfigCallback): void; + + /** + * Calls GetAttributesConfig. + * @param request GetAttributesConfigRequest message or plain object + * @returns Promise + */ + public getAttributesConfig(request: google.cloud.retail.v2beta.IGetAttributesConfigRequest): Promise; + + /** + * Calls UpdateAttributesConfig. + * @param request UpdateAttributesConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public updateAttributesConfig(request: google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfigCallback): void; /** - * Verifies an Audience message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls UpdateAttributesConfig. + * @param request UpdateAttributesConfigRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public updateAttributesConfig(request: google.cloud.retail.v2beta.IUpdateAttributesConfigRequest): Promise; /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Audience + * Calls AddCatalogAttribute. + * @param request AddCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Audience; + public addCatalogAttribute(request: google.cloud.retail.v2beta.IAddCatalogAttributeRequest, callback: google.cloud.retail.v2beta.CatalogService.AddCatalogAttributeCallback): void; /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @param message Audience - * @param [options] Conversion options - * @returns Plain object + * Calls AddCatalogAttribute. + * @param request AddCatalogAttributeRequest message or plain object + * @returns Promise */ - public static toObject(message: google.cloud.retail.v2beta.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public addCatalogAttribute(request: google.cloud.retail.v2beta.IAddCatalogAttributeRequest): Promise; /** - * Converts this Audience to JSON. - * @returns JSON object + * Calls RemoveCatalogAttribute. + * @param request RemoveCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig */ - public toJSON(): { [k: string]: any }; - } + public removeCatalogAttribute(request: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, callback: google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttributeCallback): void; - /** Properties of a ColorInfo. */ - interface IColorInfo { + /** + * Calls RemoveCatalogAttribute. + * @param request RemoveCatalogAttributeRequest message or plain object + * @returns Promise + */ + public removeCatalogAttribute(request: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest): Promise; - /** ColorInfo colorFamilies */ - colorFamilies?: (string[]|null); + /** + * Calls ReplaceCatalogAttribute. + * @param request ReplaceCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public replaceCatalogAttribute(request: google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, callback: google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttributeCallback): void; - /** ColorInfo colors */ - colors?: (string[]|null); + /** + * Calls ReplaceCatalogAttribute. + * @param request ReplaceCatalogAttributeRequest message or plain object + * @returns Promise + */ + public replaceCatalogAttribute(request: google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest): Promise; } - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { + namespace CatalogService { /** - * Constructs a new ColorInfo. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse */ - constructor(properties?: google.cloud.retail.v2beta.IColorInfo); - - /** ColorInfo colorFamilies. */ - public colorFamilies: string[]; + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListCatalogsResponse) => void; - /** ColorInfo colors. */ - public colors: string[]; + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Catalog) => void; /** - * Creates a new ColorInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns ColorInfo instance + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty */ - public static create(properties?: google.cloud.retail.v2beta.IColorInfo): google.cloud.retail.v2beta.ColorInfo; + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse */ - public static encode(message: google.cloud.retail.v2beta.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.GetDefaultBranchResponse) => void; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getCompletionConfig}. + * @param error Error, if any + * @param [response] CompletionConfig */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + type GetCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompletionConfig) => void; /** - * Decodes a ColorInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCompletionConfig}. + * @param error Error, if any + * @param [response] CompletionConfig */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ColorInfo; + type UpdateCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompletionConfig) => void; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getAttributesConfig}. + * @param error Error, if any + * @param [response] AttributesConfig */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ColorInfo; + type GetAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Verifies a ColorInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateAttributesConfig}. + * @param error Error, if any + * @param [response] AttributesConfig */ - public static verify(message: { [k: string]: any }): (string|null); + type UpdateAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ColorInfo + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#addCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ColorInfo; + type AddCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @param message ColorInfo - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#removeCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig */ - public static toObject(message: google.cloud.retail.v2beta.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type RemoveCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Converts this ColorInfo to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#replaceCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig */ - public toJSON(): { [k: string]: any }; + type ReplaceCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { - - /** CustomAttribute text */ - text?: (string[]|null); + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** ListCatalogsRequest parent */ + parent?: (string|null); - /** CustomAttribute searchable */ - searchable?: (boolean|null); + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); - /** CustomAttribute indexable */ - indexable?: (boolean|null); + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { /** - * Constructs a new CustomAttribute. + * Constructs a new ListCatalogsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICustomAttribute); - - /** CustomAttribute text. */ - public text: string[]; - - /** CustomAttribute numbers. */ - public numbers: number[]; - - /** CustomAttribute searchable. */ - public searchable?: (boolean|null); + constructor(properties?: google.cloud.retail.v2beta.IListCatalogsRequest); - /** CustomAttribute indexable. */ - public indexable?: (boolean|null); + /** ListCatalogsRequest parent. */ + public parent: string; - /** CustomAttribute _searchable. */ - public _searchable?: "searchable"; + /** ListCatalogsRequest pageSize. */ + public pageSize: number; - /** CustomAttribute _indexable. */ - public _indexable?: "indexable"; + /** ListCatalogsRequest pageToken. */ + public pageToken: string; /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new ListCatalogsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns ListCatalogsRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.ICustomAttribute): google.cloud.retail.v2beta.CustomAttribute; + public static create(properties?: google.cloud.retail.v2beta.IListCatalogsRequest): google.cloud.retail.v2beta.ListCatalogsRequest; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsRequest; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsRequest; /** - * Verifies a CustomAttribute message. + * Verifies a ListCatalogsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns ListCatalogsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsRequest; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this ListCatalogsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FulfillmentInfo. */ - interface IFulfillmentInfo { + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { - /** FulfillmentInfo type */ - type?: (string|null); + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2beta.ICatalog[]|null); - /** FulfillmentInfo placeIds */ - placeIds?: (string[]|null); + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a FulfillmentInfo. */ - class FulfillmentInfo implements IFulfillmentInfo { + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { /** - * Constructs a new FulfillmentInfo. + * Constructs a new ListCatalogsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IFulfillmentInfo); + constructor(properties?: google.cloud.retail.v2beta.IListCatalogsResponse); - /** FulfillmentInfo type. */ - public type: string; + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2beta.ICatalog[]; - /** FulfillmentInfo placeIds. */ - public placeIds: string[]; + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns FulfillmentInfo instance + * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IFulfillmentInfo): google.cloud.retail.v2beta.FulfillmentInfo; + public static create(properties?: google.cloud.retail.v2beta.IListCatalogsResponse): google.cloud.retail.v2beta.ListCatalogsResponse; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FulfillmentInfo + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.FulfillmentInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsResponse; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FulfillmentInfo + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.FulfillmentInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsResponse; /** - * Verifies a FulfillmentInfo message. + * Verifies a ListCatalogsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FulfillmentInfo + * @returns ListCatalogsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.FulfillmentInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsResponse; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. - * @param message FulfillmentInfo + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this ListCatalogsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Image. */ - interface IImage { - - /** Image uri */ - uri?: (string|null); + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { - /** Image height */ - height?: (number|null); + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2beta.ICatalog|null); - /** Image width */ - width?: (number|null); + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents an Image. */ - class Image implements IImage { + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { /** - * Constructs a new Image. + * Constructs a new UpdateCatalogRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImage); - - /** Image uri. */ - public uri: string; + constructor(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest); - /** Image height. */ - public height: number; + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2beta.ICatalog|null); - /** Image width. */ - public width: number; + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new Image instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns UpdateCatalogRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IImage): google.cloud.retail.v2beta.Image; + public static create(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest): google.cloud.retail.v2beta.UpdateCatalogRequest; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateCatalogRequest; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateCatalogRequest; /** - * Verifies an Image message. + * Verifies an UpdateCatalogRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns UpdateCatalogRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateCatalogRequest; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this UpdateCatalogRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Interval. */ - interface IInterval { + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { - /** Interval minimum */ - minimum?: (number|null); + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); - /** Interval exclusiveMinimum */ - exclusiveMinimum?: (number|null); + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); - /** Interval maximum */ - maximum?: (number|null); + /** SetDefaultBranchRequest note */ + note?: (string|null); - /** Interval exclusiveMaximum */ - exclusiveMaximum?: (number|null); + /** SetDefaultBranchRequest force */ + force?: (boolean|null); } - /** Represents an Interval. */ - class Interval implements IInterval { + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { /** - * Constructs a new Interval. + * Constructs a new SetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IInterval); - - /** Interval minimum. */ - public minimum?: (number|null); - - /** Interval exclusiveMinimum. */ - public exclusiveMinimum?: (number|null); + constructor(properties?: google.cloud.retail.v2beta.ISetDefaultBranchRequest); - /** Interval maximum. */ - public maximum?: (number|null); + /** SetDefaultBranchRequest catalog. */ + public catalog: string; - /** Interval exclusiveMaximum. */ - public exclusiveMaximum?: (number|null); + /** SetDefaultBranchRequest branchId. */ + public branchId: string; - /** Interval min. */ - public min?: ("minimum"|"exclusiveMinimum"); + /** SetDefaultBranchRequest note. */ + public note: string; - /** Interval max. */ - public max?: ("maximum"|"exclusiveMaximum"); + /** SetDefaultBranchRequest force. */ + public force: boolean; /** - * Creates a new Interval instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Interval instance + * @returns SetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IInterval): google.cloud.retail.v2beta.Interval; + public static create(properties?: google.cloud.retail.v2beta.ISetDefaultBranchRequest): google.cloud.retail.v2beta.SetDefaultBranchRequest; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Interval + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Interval; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetDefaultBranchRequest; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Interval + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Interval; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetDefaultBranchRequest; /** - * Verifies an Interval message. + * Verifies a SetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Interval + * @returns SetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Interval; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetDefaultBranchRequest; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @param message Interval + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Interval to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PriceInfo. */ - interface IPriceInfo { - - /** PriceInfo currencyCode */ - currencyCode?: (string|null); - - /** PriceInfo price */ - price?: (number|null); - - /** PriceInfo originalPrice */ - originalPrice?: (number|null); - - /** PriceInfo cost */ - cost?: (number|null); - - /** PriceInfo priceEffectiveTime */ - priceEffectiveTime?: (google.protobuf.ITimestamp|null); - - /** PriceInfo priceExpireTime */ - priceExpireTime?: (google.protobuf.ITimestamp|null); + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { - /** PriceInfo priceRange */ - priceRange?: (google.cloud.retail.v2beta.PriceInfo.IPriceRange|null); + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); } - /** Represents a PriceInfo. */ - class PriceInfo implements IPriceInfo { + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { /** - * Constructs a new PriceInfo. + * Constructs a new GetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPriceInfo); - - /** PriceInfo currencyCode. */ - public currencyCode: string; - - /** PriceInfo price. */ - public price: number; - - /** PriceInfo originalPrice. */ - public originalPrice: number; - - /** PriceInfo cost. */ - public cost: number; - - /** PriceInfo priceEffectiveTime. */ - public priceEffectiveTime?: (google.protobuf.ITimestamp|null); - - /** PriceInfo priceExpireTime. */ - public priceExpireTime?: (google.protobuf.ITimestamp|null); + constructor(properties?: google.cloud.retail.v2beta.IGetDefaultBranchRequest); - /** PriceInfo priceRange. */ - public priceRange?: (google.cloud.retail.v2beta.PriceInfo.IPriceRange|null); + /** GetDefaultBranchRequest catalog. */ + public catalog: string; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PriceInfo instance + * @returns GetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IPriceInfo): google.cloud.retail.v2beta.PriceInfo; + public static create(properties?: google.cloud.retail.v2beta.IGetDefaultBranchRequest): google.cloud.retail.v2beta.GetDefaultBranchRequest; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceInfo + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetDefaultBranchRequest; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceInfo + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetDefaultBranchRequest; /** - * Verifies a PriceInfo message. + * Verifies a GetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceInfo + * @returns GetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetDefaultBranchRequest; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @param message PriceInfo + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceInfo to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PriceInfo { - - /** Properties of a PriceRange. */ - interface IPriceRange { - - /** PriceRange price */ - price?: (google.cloud.retail.v2beta.IInterval|null); - - /** PriceRange originalPrice */ - originalPrice?: (google.cloud.retail.v2beta.IInterval|null); - } - - /** Represents a PriceRange. */ - class PriceRange implements IPriceRange { - - /** - * Constructs a new PriceRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.PriceInfo.IPriceRange); - - /** PriceRange price. */ - public price?: (google.cloud.retail.v2beta.IInterval|null); - - /** PriceRange originalPrice. */ - public originalPrice?: (google.cloud.retail.v2beta.IInterval|null); - - /** - * Creates a new PriceRange instance using the specified properties. - * @param [properties] Properties to set - * @returns PriceRange instance - */ - public static create(properties?: google.cloud.retail.v2beta.PriceInfo.IPriceRange): google.cloud.retail.v2beta.PriceInfo.PriceRange; - - /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PriceRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PriceInfo.PriceRange; - - /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PriceInfo.PriceRange; - - /** - * Verifies a PriceRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PriceRange - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PriceInfo.PriceRange; - - /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @param message PriceRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PriceRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } - - /** Properties of a Rating. */ - interface IRating { + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { - /** Rating ratingCount */ - ratingCount?: (number|null); + /** GetDefaultBranchResponse branch */ + branch?: (string|null); - /** Rating averageRating */ - averageRating?: (number|null); + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); - /** Rating ratingHistogram */ - ratingHistogram?: (number[]|null); + /** GetDefaultBranchResponse note */ + note?: (string|null); } - /** Represents a Rating. */ - class Rating implements IRating { + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { /** - * Constructs a new Rating. + * Constructs a new GetDefaultBranchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IRating); + constructor(properties?: google.cloud.retail.v2beta.IGetDefaultBranchResponse); - /** Rating ratingCount. */ - public ratingCount: number; + /** GetDefaultBranchResponse branch. */ + public branch: string; - /** Rating averageRating. */ - public averageRating: number; + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); - /** Rating ratingHistogram. */ - public ratingHistogram: number[]; + /** GetDefaultBranchResponse note. */ + public note: string; /** - * Creates a new Rating instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Rating instance + * @returns GetDefaultBranchResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IRating): google.cloud.retail.v2beta.Rating; + public static create(properties?: google.cloud.retail.v2beta.IGetDefaultBranchResponse): google.cloud.retail.v2beta.GetDefaultBranchResponse; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rating + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Rating; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetDefaultBranchResponse; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rating + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Rating; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetDefaultBranchResponse; /** - * Verifies a Rating message. + * Verifies a GetDefaultBranchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rating + * @returns GetDefaultBranchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Rating; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetDefaultBranchResponse; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. - * @param message Rating + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rating to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserInfo. */ - interface IUserInfo { - - /** UserInfo userId */ - userId?: (string|null); - - /** UserInfo ipAddress */ - ipAddress?: (string|null); - - /** UserInfo userAgent */ - userAgent?: (string|null); + /** Properties of a GetCompletionConfigRequest. */ + interface IGetCompletionConfigRequest { - /** UserInfo directUserRequest */ - directUserRequest?: (boolean|null); + /** GetCompletionConfigRequest name */ + name?: (string|null); } - /** Represents a UserInfo. */ - class UserInfo implements IUserInfo { + /** Represents a GetCompletionConfigRequest. */ + class GetCompletionConfigRequest implements IGetCompletionConfigRequest { /** - * Constructs a new UserInfo. + * Constructs a new GetCompletionConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserInfo); - - /** UserInfo userId. */ - public userId: string; - - /** UserInfo ipAddress. */ - public ipAddress: string; - - /** UserInfo userAgent. */ - public userAgent: string; + constructor(properties?: google.cloud.retail.v2beta.IGetCompletionConfigRequest); - /** UserInfo directUserRequest. */ - public directUserRequest: boolean; + /** GetCompletionConfigRequest name. */ + public name: string; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new GetCompletionConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserInfo instance + * @returns GetCompletionConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserInfo): google.cloud.retail.v2beta.UserInfo; + public static create(properties?: google.cloud.retail.v2beta.IGetCompletionConfigRequest): google.cloud.retail.v2beta.GetCompletionConfigRequest; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified GetCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetCompletionConfigRequest.verify|verify} messages. + * @param message GetCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IGetCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified GetCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetCompletionConfigRequest.verify|verify} messages. + * @param message GetCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserInfo + * @returns GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetCompletionConfigRequest; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserInfo + * @returns GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetCompletionConfigRequest; /** - * Verifies a UserInfo message. + * Verifies a GetCompletionConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates a GetCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserInfo + * @returns GetCompletionConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetCompletionConfigRequest; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. - * @param message UserInfo + * Creates a plain object from a GetCompletionConfigRequest message. Also converts values to other types if specified. + * @param message GetCompletionConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.GetCompletionConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserInfo to JSON. + * Converts this GetCompletionConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Promotion. */ - interface IPromotion { + /** Properties of an UpdateCompletionConfigRequest. */ + interface IUpdateCompletionConfigRequest { - /** Promotion promotionId */ - promotionId?: (string|null); + /** UpdateCompletionConfigRequest completionConfig */ + completionConfig?: (google.cloud.retail.v2beta.ICompletionConfig|null); + + /** UpdateCompletionConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a Promotion. */ - class Promotion implements IPromotion { + /** Represents an UpdateCompletionConfigRequest. */ + class UpdateCompletionConfigRequest implements IUpdateCompletionConfigRequest { /** - * Constructs a new Promotion. + * Constructs a new UpdateCompletionConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPromotion); + constructor(properties?: google.cloud.retail.v2beta.IUpdateCompletionConfigRequest); - /** Promotion promotionId. */ - public promotionId: string; + /** UpdateCompletionConfigRequest completionConfig. */ + public completionConfig?: (google.cloud.retail.v2beta.ICompletionConfig|null); + + /** UpdateCompletionConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new Promotion instance using the specified properties. + * Creates a new UpdateCompletionConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Promotion instance + * @returns UpdateCompletionConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IPromotion): google.cloud.retail.v2beta.Promotion; + public static create(properties?: google.cloud.retail.v2beta.IUpdateCompletionConfigRequest): google.cloud.retail.v2beta.UpdateCompletionConfigRequest; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified UpdateCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCompletionConfigRequest.verify|verify} messages. + * @param message UpdateCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified UpdateCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCompletionConfigRequest.verify|verify} messages. + * @param message UpdateCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Promotion + * @returns UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Promotion; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateCompletionConfigRequest; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Promotion + * @returns UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Promotion; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateCompletionConfigRequest; /** - * Verifies a Promotion message. + * Verifies an UpdateCompletionConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Promotion + * @returns UpdateCompletionConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Promotion; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateCompletionConfigRequest; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. - * @param message Promotion + * Creates a plain object from an UpdateCompletionConfigRequest message. Also converts values to other types if specified. + * @param message UpdateCompletionConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UpdateCompletionConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Promotion to JSON. + * Converts this UpdateCompletionConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource inputUris */ - inputUris?: (string[]|null); + /** Properties of a GetAttributesConfigRequest. */ + interface IGetAttributesConfigRequest { - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** GetAttributesConfigRequest name */ + name?: (string|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents a GetAttributesConfigRequest. */ + class GetAttributesConfigRequest implements IGetAttributesConfigRequest { /** - * Constructs a new GcsSource. + * Constructs a new GetAttributesConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IGcsSource); - - /** GcsSource inputUris. */ - public inputUris: string[]; + constructor(properties?: google.cloud.retail.v2beta.IGetAttributesConfigRequest); - /** GcsSource dataSchema. */ - public dataSchema: string; + /** GetAttributesConfigRequest name. */ + public name: string; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new GetAttributesConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns GetAttributesConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IGcsSource): google.cloud.retail.v2beta.GcsSource; + public static create(properties?: google.cloud.retail.v2beta.IGetAttributesConfigRequest): google.cloud.retail.v2beta.GetAttributesConfigRequest; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified GetAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetAttributesConfigRequest.verify|verify} messages. + * @param message GetAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IGetAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified GetAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetAttributesConfigRequest.verify|verify} messages. + * @param message GetAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetAttributesConfigRequest; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetAttributesConfigRequest; /** - * Verifies a GcsSource message. + * Verifies a GetAttributesConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a GetAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns GetAttributesConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetAttributesConfigRequest; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from a GetAttributesConfigRequest message. Also converts values to other types if specified. + * @param message GetAttributesConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.GetAttributesConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this GetAttributesConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { - - /** BigQuerySource partitionDate */ - partitionDate?: (google.type.IDate|null); - - /** BigQuerySource projectId */ - projectId?: (string|null); - - /** BigQuerySource datasetId */ - datasetId?: (string|null); - - /** BigQuerySource tableId */ - tableId?: (string|null); + /** Properties of an UpdateAttributesConfigRequest. */ + interface IUpdateAttributesConfigRequest { - /** BigQuerySource gcsStagingDir */ - gcsStagingDir?: (string|null); + /** UpdateAttributesConfigRequest attributesConfig */ + attributesConfig?: (google.cloud.retail.v2beta.IAttributesConfig|null); - /** BigQuerySource dataSchema */ - dataSchema?: (string|null); + /** UpdateAttributesConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a BigQuerySource. */ - class BigQuerySource implements IBigQuerySource { + /** Represents an UpdateAttributesConfigRequest. */ + class UpdateAttributesConfigRequest implements IUpdateAttributesConfigRequest { /** - * Constructs a new BigQuerySource. + * Constructs a new UpdateAttributesConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IBigQuerySource); - - /** BigQuerySource partitionDate. */ - public partitionDate?: (google.type.IDate|null); - - /** BigQuerySource projectId. */ - public projectId: string; - - /** BigQuerySource datasetId. */ - public datasetId: string; - - /** BigQuerySource tableId. */ - public tableId: string; - - /** BigQuerySource gcsStagingDir. */ - public gcsStagingDir: string; + constructor(properties?: google.cloud.retail.v2beta.IUpdateAttributesConfigRequest); - /** BigQuerySource dataSchema. */ - public dataSchema: string; + /** UpdateAttributesConfigRequest attributesConfig. */ + public attributesConfig?: (google.cloud.retail.v2beta.IAttributesConfig|null); - /** BigQuerySource partition. */ - public partition?: "partitionDate"; + /** UpdateAttributesConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new UpdateAttributesConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns BigQuerySource instance + * @returns UpdateAttributesConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IBigQuerySource): google.cloud.retail.v2beta.BigQuerySource; + public static create(properties?: google.cloud.retail.v2beta.IUpdateAttributesConfigRequest): google.cloud.retail.v2beta.UpdateAttributesConfigRequest; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified UpdateAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateAttributesConfigRequest.verify|verify} messages. + * @param message UpdateAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified UpdateAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateAttributesConfigRequest.verify|verify} messages. + * @param message UpdateAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BigQuerySource + * @returns UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BigQuerySource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateAttributesConfigRequest; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BigQuerySource + * @returns UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BigQuerySource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateAttributesConfigRequest; /** - * Verifies a BigQuerySource message. + * Verifies an UpdateAttributesConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BigQuerySource + * @returns UpdateAttributesConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BigQuerySource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateAttributesConfigRequest; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. - * @param message BigQuerySource + * Creates a plain object from an UpdateAttributesConfigRequest message. Also converts values to other types if specified. + * @param message UpdateAttributesConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UpdateAttributesConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BigQuerySource to JSON. + * Converts this UpdateAttributesConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInlineSource. */ - interface IProductInlineSource { + /** Properties of an AddCatalogAttributeRequest. */ + interface IAddCatalogAttributeRequest { - /** ProductInlineSource products */ - products?: (google.cloud.retail.v2beta.IProduct[]|null); + /** AddCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); + + /** AddCatalogAttributeRequest catalogAttribute */ + catalogAttribute?: (google.cloud.retail.v2beta.ICatalogAttribute|null); } - /** Represents a ProductInlineSource. */ - class ProductInlineSource implements IProductInlineSource { + /** Represents an AddCatalogAttributeRequest. */ + class AddCatalogAttributeRequest implements IAddCatalogAttributeRequest { /** - * Constructs a new ProductInlineSource. + * Constructs a new AddCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductInlineSource); + constructor(properties?: google.cloud.retail.v2beta.IAddCatalogAttributeRequest); - /** ProductInlineSource products. */ - public products: google.cloud.retail.v2beta.IProduct[]; + /** AddCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; + + /** AddCatalogAttributeRequest catalogAttribute. */ + public catalogAttribute?: (google.cloud.retail.v2beta.ICatalogAttribute|null); /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new AddCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInlineSource instance + * @returns AddCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductInlineSource): google.cloud.retail.v2beta.ProductInlineSource; + public static create(properties?: google.cloud.retail.v2beta.IAddCatalogAttributeRequest): google.cloud.retail.v2beta.AddCatalogAttributeRequest; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified AddCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddCatalogAttributeRequest.verify|verify} messages. + * @param message AddCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified AddCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddCatalogAttributeRequest.verify|verify} messages. + * @param message AddCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInlineSource + * @returns AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddCatalogAttributeRequest; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInlineSource + * @returns AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddCatalogAttributeRequest; /** - * Verifies a ProductInlineSource message. + * Verifies an AddCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates an AddCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInlineSource + * @returns AddCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddCatalogAttributeRequest; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @param message ProductInlineSource + * Creates a plain object from an AddCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message AddCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInlineSource to JSON. + * Converts this AddCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a UserEventInlineSource. */ - interface IUserEventInlineSource { + /** Properties of a RemoveCatalogAttributeRequest. */ + interface IRemoveCatalogAttributeRequest { - /** UserEventInlineSource userEvents */ - userEvents?: (google.cloud.retail.v2beta.IUserEvent[]|null); + /** RemoveCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); + + /** RemoveCatalogAttributeRequest key */ + key?: (string|null); } - /** Represents a UserEventInlineSource. */ - class UserEventInlineSource implements IUserEventInlineSource { + /** Represents a RemoveCatalogAttributeRequest. */ + class RemoveCatalogAttributeRequest implements IRemoveCatalogAttributeRequest { /** - * Constructs a new UserEventInlineSource. + * Constructs a new RemoveCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserEventInlineSource); + constructor(properties?: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest); - /** UserEventInlineSource userEvents. */ - public userEvents: google.cloud.retail.v2beta.IUserEvent[]; + /** RemoveCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; + + /** RemoveCatalogAttributeRequest key. */ + public key: string; /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new RemoveCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInlineSource instance + * @returns RemoveCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserEventInlineSource): google.cloud.retail.v2beta.UserEventInlineSource; + public static create(properties?: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest): google.cloud.retail.v2beta.RemoveCatalogAttributeRequest; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified RemoveCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveCatalogAttributeRequest.verify|verify} messages. + * @param message RemoveCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified RemoveCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveCatalogAttributeRequest.verify|verify} messages. + * @param message RemoveCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInlineSource + * @returns RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveCatalogAttributeRequest; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInlineSource + * @returns RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveCatalogAttributeRequest; /** - * Verifies a UserEventInlineSource message. + * Verifies a RemoveCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInlineSource + * @returns RemoveCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveCatalogAttributeRequest; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @param message UserEventInlineSource + * Creates a plain object from a RemoveCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message RemoveCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.RemoveCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this RemoveCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportErrorsConfig. */ - interface IImportErrorsConfig { + /** Properties of a ReplaceCatalogAttributeRequest. */ + interface IReplaceCatalogAttributeRequest { - /** ImportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); + /** ReplaceCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); + + /** ReplaceCatalogAttributeRequest catalogAttribute */ + catalogAttribute?: (google.cloud.retail.v2beta.ICatalogAttribute|null); + + /** ReplaceCatalogAttributeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents an ImportErrorsConfig. */ - class ImportErrorsConfig implements IImportErrorsConfig { + /** Represents a ReplaceCatalogAttributeRequest. */ + class ReplaceCatalogAttributeRequest implements IReplaceCatalogAttributeRequest { /** - * Constructs a new ImportErrorsConfig. + * Constructs a new ReplaceCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportErrorsConfig); + constructor(properties?: google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest); - /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + /** ReplaceCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** ImportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** ReplaceCatalogAttributeRequest catalogAttribute. */ + public catalogAttribute?: (google.cloud.retail.v2beta.ICatalogAttribute|null); + + /** ReplaceCatalogAttributeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new ReplaceCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportErrorsConfig instance + * @returns ReplaceCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportErrorsConfig): google.cloud.retail.v2beta.ImportErrorsConfig; + public static create(properties?: google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest): google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified ReplaceCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @param message ReplaceCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified ReplaceCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @param message ReplaceCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportErrorsConfig + * @returns ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportErrorsConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportErrorsConfig + * @returns ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportErrorsConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest; /** - * Verifies an ImportErrorsConfig message. + * Verifies a ReplaceCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ReplaceCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportErrorsConfig + * @returns ReplaceCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportErrorsConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @param message ImportErrorsConfig + * Creates a plain object from a ReplaceCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message ReplaceCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this ReplaceCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportProductsRequest. */ - interface IImportProductsRequest { + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { - /** ImportProductsRequest parent */ - parent?: (string|null); + /** + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** ImportProductsRequest requestId */ - requestId?: (string|null); + /** + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; - /** ImportProductsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse + */ + public completeQuery(request: google.cloud.retail.v2beta.ICompleteQueryRequest, callback: google.cloud.retail.v2beta.CompletionService.CompleteQueryCallback): void; - /** ImportProductsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise + */ + public completeQuery(request: google.cloud.retail.v2beta.ICompleteQueryRequest): Promise; - /** ImportProductsRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importCompletionData(request: google.cloud.retail.v2beta.IImportCompletionDataRequest, callback: google.cloud.retail.v2beta.CompletionService.ImportCompletionDataCallback): void; - /** ImportProductsRequest reconciliationMode */ - reconciliationMode?: (google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|null); + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise + */ + public importCompletionData(request: google.cloud.retail.v2beta.IImportCompletionDataRequest): Promise; + } - /** ImportProductsRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + namespace CompletionService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse + */ + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompleteQueryResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Represents an ImportProductsRequest. */ - class ImportProductsRequest implements IImportProductsRequest { + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { + + /** CompleteQueryRequest catalog */ + catalog?: (string|null); + + /** CompleteQueryRequest query */ + query?: (string|null); + + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); + } + + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { /** - * Constructs a new ImportProductsRequest. + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportProductsRequest); + constructor(properties?: google.cloud.retail.v2beta.ICompleteQueryRequest); - /** ImportProductsRequest parent. */ - public parent: string; + /** CompleteQueryRequest catalog. */ + public catalog: string; - /** ImportProductsRequest requestId. */ - public requestId: string; + /** CompleteQueryRequest query. */ + public query: string; - /** ImportProductsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2beta.IProductInputConfig|null); + /** CompleteQueryRequest visitorId. */ + public visitorId: string; - /** ImportProductsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; - /** ImportProductsRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** CompleteQueryRequest deviceType. */ + public deviceType: string; - /** ImportProductsRequest reconciliationMode. */ - public reconciliationMode: (google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode); + /** CompleteQueryRequest dataset. */ + public dataset: string; - /** ImportProductsRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsRequest instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportProductsRequest): google.cloud.retail.v2beta.ImportProductsRequest; + public static create(properties?: google.cloud.retail.v2beta.ICompleteQueryRequest): google.cloud.retail.v2beta.CompleteQueryRequest; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryRequest; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsRequest + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryRequest; /** - * Verifies an ImportProductsRequest message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsRequest + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryRequest; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @param message ImportProductsRequest + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ImportProductsRequest { - - /** ReconciliationMode enum. */ - enum ReconciliationMode { - RECONCILIATION_MODE_UNSPECIFIED = 0, - INCREMENTAL = 1, - FULL = 2 - } - } - - /** Properties of an ImportUserEventsRequest. */ - interface IImportUserEventsRequest { + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { - /** ImportUserEventsRequest parent */ - parent?: (string|null); + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult[]|null); - /** ImportUserEventsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); - /** ImportUserEventsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents an ImportUserEventsRequest. */ - class ImportUserEventsRequest implements IImportUserEventsRequest { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest); + constructor(properties?: google.cloud.retail.v2beta.ICompleteQueryResponse); - /** ImportUserEventsRequest parent. */ - public parent: string; + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult[]; - /** ImportUserEventsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2beta.IUserEventInputConfig|null); + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; - /** ImportUserEventsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsRequest instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsRequest): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static create(properties?: google.cloud.retail.v2beta.ICompleteQueryResponse): google.cloud.retail.v2beta.CompleteQueryResponse; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsRequest + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsRequest + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsRequest + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @param message ImportUserEventsRequest + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImportCompletionDataRequest. */ - interface IImportCompletionDataRequest { + namespace CompleteQueryResponse { - /** ImportCompletionDataRequest parent */ - parent?: (string|null); + /** Properties of a CompletionResult. */ + interface ICompletionResult { - /** ImportCompletionDataRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + /** CompletionResult suggestion */ + suggestion?: (string|null); - /** ImportCompletionDataRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + } + + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { + + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult); + + /** CompletionResult suggestion. */ + public suggestion: string; + + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { + + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); + } + + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { + + /** + * Constructs a new RecentSearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult); + + /** RecentSearchResult recentSearch. */ + public recentSearch: string; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentSearchResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Verifies a RecentSearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentSearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentSearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } - /** Represents an ImportCompletionDataRequest. */ - class ImportCompletionDataRequest implements IImportCompletionDataRequest { + /** Properties of a Control. */ + interface IControl { + + /** Control facetSpec */ + facetSpec?: (google.cloud.retail.v2beta.SearchRequest.IFacetSpec|null); + + /** Control rule */ + rule?: (google.cloud.retail.v2beta.IRule|null); + + /** Control name */ + name?: (string|null); + + /** Control displayName */ + displayName?: (string|null); + + /** Control associatedServingConfigIds */ + associatedServingConfigIds?: (string[]|null); + + /** Control solutionTypes */ + solutionTypes?: (google.cloud.retail.v2beta.SolutionType[]|null); + } + + /** Represents a Control. */ + class Control implements IControl { /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new Control. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IImportCompletionDataRequest); + constructor(properties?: google.cloud.retail.v2beta.IControl); - /** ImportCompletionDataRequest parent. */ - public parent: string; + /** Control facetSpec. */ + public facetSpec?: (google.cloud.retail.v2beta.SearchRequest.IFacetSpec|null); - /** ImportCompletionDataRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2beta.ICompletionDataInputConfig|null); + /** Control rule. */ + public rule?: (google.cloud.retail.v2beta.IRule|null); - /** ImportCompletionDataRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** Control name. */ + public name: string; + + /** Control displayName. */ + public displayName: string; + + /** Control associatedServingConfigIds. */ + public associatedServingConfigIds: string[]; + + /** Control solutionTypes. */ + public solutionTypes: google.cloud.retail.v2beta.SolutionType[]; + + /** Control control. */ + public control?: ("facetSpec"|"rule"); /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new Control instance using the specified properties. * @param [properties] Properties to set - * @returns ImportCompletionDataRequest instance + * @returns Control instance */ - public static create(properties?: google.cloud.retail.v2beta.IImportCompletionDataRequest): google.cloud.retail.v2beta.ImportCompletionDataRequest; + public static create(properties?: google.cloud.retail.v2beta.IControl): google.cloud.retail.v2beta.Control; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified Control message. Does not implicitly {@link google.cloud.retail.v2beta.Control.verify|verify} messages. + * @param message Control message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IControl, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified Control message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Control.verify|verify} messages. + * @param message Control message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IControl, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes a Control message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportCompletionDataRequest + * @returns Control * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportCompletionDataRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Control; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes a Control message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataRequest + * @returns Control * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportCompletionDataRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Control; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies a Control message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Control message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportCompletionDataRequest + * @returns Control */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportCompletionDataRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Control; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. - * @param message ImportCompletionDataRequest + * Creates a plain object from a Control message. Also converts values to other types if specified. + * @param message Control * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.Control, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this Control to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ProductInputConfig. */ - interface IProductInputConfig { + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { - /** ProductInputConfig productInlineSource */ - productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** ProductInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; - /** ProductInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2beta.ISearchRequest, callback: google.cloud.retail.v2beta.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2beta.ISearchRequest): Promise; } - /** Represents a ProductInputConfig. */ - class ProductInputConfig implements IProductInputConfig { + namespace SearchService { /** - * Constructs a new ProductInputConfig. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse */ - constructor(properties?: google.cloud.retail.v2beta.IProductInputConfig); + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.SearchResponse) => void; + } - /** ProductInputConfig productInlineSource. */ - public productInlineSource?: (google.cloud.retail.v2beta.IProductInlineSource|null); + /** Properties of a SearchRequest. */ + interface ISearchRequest { - /** ProductInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** SearchRequest placement */ + placement?: (string|null); - /** ProductInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** SearchRequest branch */ + branch?: (string|null); - /** ProductInputConfig source. */ - public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + /** SearchRequest query */ + query?: (string|null); - /** - * Creates a new ProductInputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductInputConfig instance - */ - public static create(properties?: google.cloud.retail.v2beta.IProductInputConfig): google.cloud.retail.v2beta.ProductInputConfig; + /** SearchRequest visitorId */ + visitorId?: (string|null); - /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); - /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchRequest pageSize */ + pageSize?: (number|null); - /** - * Decodes a ProductInputConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductInputConfig; + /** SearchRequest pageToken */ + pageToken?: (string|null); - /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductInputConfig; + /** SearchRequest offset */ + offset?: (number|null); - /** - * Verifies a ProductInputConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** SearchRequest filter */ + filter?: (string|null); - /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductInputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductInputConfig; + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); - /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @param message ProductInputConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** SearchRequest orderBy */ + orderBy?: (string|null); - /** - * Converts this ProductInputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2beta.SearchRequest.IFacetSpec[]|null); - /** Properties of a UserEventInputConfig. */ - interface IUserEventInputConfig { + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); - /** UserEventInputConfig userEventInlineSource */ - userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null); - /** UserEventInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null); - /** UserEventInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2beta.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SearchMode|null); + + /** SearchRequest personalizationSpec */ + personalizationSpec?: (google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null); } - /** Represents a UserEventInputConfig. */ - class UserEventInputConfig implements IUserEventInputConfig { + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { /** - * Constructs a new UserEventInputConfig. + * Constructs a new SearchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUserEventInputConfig); + constructor(properties?: google.cloud.retail.v2beta.ISearchRequest); - /** UserEventInputConfig userEventInlineSource. */ - public userEventInlineSource?: (google.cloud.retail.v2beta.IUserEventInlineSource|null); + /** SearchRequest placement. */ + public placement: string; - /** UserEventInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2beta.IGcsSource|null); + /** SearchRequest branch. */ + public branch: string; - /** UserEventInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** SearchRequest query. */ + public query: string; - /** UserEventInputConfig source. */ - public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; + + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; + + /** SearchRequest orderBy. */ + public orderBy: string; + + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2beta.SearchRequest.IFacetSpec[]; + + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; + + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2beta.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SearchMode); + + /** SearchRequest personalizationSpec. */ + public personalizationSpec?: (google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null); /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInputConfig instance + * @returns SearchRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IUserEventInputConfig): google.cloud.retail.v2beta.UserEventInputConfig; + public static create(properties?: google.cloud.retail.v2beta.ISearchRequest): google.cloud.retail.v2beta.SearchRequest; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInputConfig + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInputConfig + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest; /** - * Verifies a UserEventInputConfig message. + * Verifies a SearchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInputConfig + * @returns SearchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @param message UserEventInputConfig + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this SearchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompletionDataInputConfig. */ - interface ICompletionDataInputConfig { + namespace SearchRequest { - /** CompletionDataInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); - } + /** Properties of a FacetSpec. */ + interface IFacetSpec { - /** Represents a CompletionDataInputConfig. */ - class CompletionDataInputConfig implements ICompletionDataInputConfig { + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null); - /** - * Constructs a new CompletionDataInputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.ICompletionDataInputConfig); + /** FacetSpec limit */ + limit?: (number|null); - /** CompletionDataInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2beta.IBigQuerySource|null); + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); - /** CompletionDataInputConfig source. */ - public source?: "bigQuerySource"; + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } - /** - * Creates a new CompletionDataInputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns CompletionDataInputConfig instance - */ - public static create(properties?: google.cloud.retail.v2beta.ICompletionDataInputConfig): google.cloud.retail.v2beta.CompletionDataInputConfig; + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { - /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IFacetSpec); - /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null); - /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompletionDataInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionDataInputConfig; + /** FacetSpec limit. */ + public limit: number; - /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompletionDataInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionDataInputConfig; + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; - /** - * Verifies a CompletionDataInputConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; - /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompletionDataInputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionDataInputConfig; + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IFacetSpec): google.cloud.retail.v2beta.SearchRequest.FacetSpec; - /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. - * @param message CompletionDataInputConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FacetSpec { + + /** Properties of a FacetKey. */ + interface IFacetKey { + + /** FacetKey key */ + key?: (string|null); + + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2beta.IInterval[]|null); + + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2beta.IInterval[]; - /** - * Converts this CompletionDataInputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; - /** Properties of an ImportMetadata. */ - interface IImportMetadata { + /** FacetKey prefixes. */ + public prefixes: string[]; - /** ImportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** FacetKey contains. */ + public contains: string[]; - /** ImportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** FacetKey orderBy. */ + public orderBy: string; - /** ImportMetadata successCount */ - successCount?: (number|Long|string|null); + /** FacetKey query. */ + public query: string; - /** ImportMetadata failureCount */ - failureCount?: (number|Long|string|null); + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; - /** ImportMetadata requestId */ - requestId?: (string|null); + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - /** ImportMetadata notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); - } + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents an ImportMetadata. */ - class ImportMetadata implements IImportMetadata { + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; - /** - * Constructs a new ImportMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IImportMetadata); + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; - /** ImportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** ImportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; - /** ImportMetadata successCount. */ - public successCount: (number|Long|string); + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** ImportMetadata failureCount. */ - public failureCount: (number|Long|string); + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** ImportMetadata requestId. */ - public requestId: string; + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { - /** ImportMetadata notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|null); + } - /** - * Creates a new ImportMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportMetadata instance - */ - public static create(properties?: google.cloud.retail.v2beta.IImportMetadata): google.cloud.retail.v2beta.ImportMetadata; + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { - /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec); - /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode); - /** - * Decodes an ImportMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportMetadata; + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; - /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportMetadata; + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies an ImportMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportMetadata; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; - /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. - * @param message ImportMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; - /** - * Converts this ImportMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of an ImportProductsResponse. */ - interface IImportProductsResponse { + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; - /** ImportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ImportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); - } + namespace DynamicFacetSpec { - /** Represents an ImportProductsResponse. */ - class ImportProductsResponse implements IImportProductsResponse { + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } - /** - * Constructs a new ImportProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IImportProductsResponse); + /** Properties of a BoostSpec. */ + interface IBoostSpec { - /** ImportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); - /** ImportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** BoostSpec skipBoostSpecValidation */ + skipBoostSpecValidation?: (boolean|null); + } - /** - * Creates a new ImportProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductsResponse instance - */ - public static create(properties?: google.cloud.retail.v2beta.IImportProductsResponse): google.cloud.retail.v2beta.ImportProductsResponse; + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { - /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IBoostSpec); - /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]; - /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportProductsResponse; + /** BoostSpec skipBoostSpecValidation. */ + public skipBoostSpecValidation?: (boolean|null); - /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportProductsResponse; + /** BoostSpec _skipBoostSpecValidation. */ + public _skipBoostSpecValidation?: "skipBoostSpecValidation"; - /** - * Verifies an ImportProductsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IBoostSpec): google.cloud.retail.v2beta.SearchRequest.BoostSpec; - /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportProductsResponse; + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @param message ImportProductsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this ImportProductsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.BoostSpec; - /** Properties of an ImportUserEventsResponse. */ - interface IImportUserEventsResponse { + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.BoostSpec; - /** ImportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** ImportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.BoostSpec; - /** ImportUserEventsResponse importSummary */ - importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); - } + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Represents an ImportUserEventsResponse. */ - class ImportUserEventsResponse implements IImportUserEventsResponse { + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Constructs a new ImportUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse); + namespace BoostSpec { - /** ImportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { - /** ImportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IImportErrorsConfig|null); + /** ConditionBoostSpec condition */ + condition?: (string|null); - /** ImportUserEventsResponse importSummary. */ - public importSummary?: (google.cloud.retail.v2beta.IUserEventImportSummary|null); + /** ConditionBoostSpec boost */ + boost?: (number|null); + } - /** - * Creates a new ImportUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportUserEventsResponse instance - */ - public static create(properties?: google.cloud.retail.v2beta.IImportUserEventsResponse): google.cloud.retail.v2beta.ImportUserEventsResponse; + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { - /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec); - /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** ConditionBoostSpec condition. */ + public condition: string; - /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportUserEventsResponse; + /** ConditionBoostSpec boost. */ + public boost: number; - /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportUserEventsResponse; + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; - /** - * Verifies an ImportUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportUserEventsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportUserEventsResponse; + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. - * @param message ImportUserEventsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; - /** - * Converts this ImportUserEventsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; - /** Properties of a UserEventImportSummary. */ - interface IUserEventImportSummary { + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEventImportSummary joinedEventsCount */ - joinedEventsCount?: (number|Long|string|null); + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; - /** UserEventImportSummary unjoinedEventsCount */ - unjoinedEventsCount?: (number|Long|string|null); - } + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Represents a UserEventImportSummary. */ - class UserEventImportSummary implements IUserEventImportSummary { + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** - * Constructs a new UserEventImportSummary. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IUserEventImportSummary); + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { - /** UserEventImportSummary joinedEventsCount. */ - public joinedEventsCount: (number|Long|string); + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null); - /** UserEventImportSummary unjoinedEventsCount. */ - public unjoinedEventsCount: (number|Long|string); + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); + } - /** - * Creates a new UserEventImportSummary instance using the specified properties. - * @param [properties] Properties to set - * @returns UserEventImportSummary instance - */ - public static create(properties?: google.cloud.retail.v2beta.IUserEventImportSummary): google.cloud.retail.v2beta.UserEventImportSummary; + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { - /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec); - /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition); - /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UserEventImportSummary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEventImportSummary; + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; - /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UserEventImportSummary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEventImportSummary; + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; - /** - * Verifies a UserEventImportSummary message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UserEventImportSummary - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEventImportSummary; + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @param message UserEventImportSummary - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; - /** - * Converts this UserEventImportSummary to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; - /** Properties of an ImportCompletionDataResponse. */ - interface IImportCompletionDataResponse { + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** ImportCompletionDataResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - } + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; - /** Represents an ImportCompletionDataResponse. */ - class ImportCompletionDataResponse implements IImportCompletionDataResponse { + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Constructs a new ImportCompletionDataResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IImportCompletionDataResponse); + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ImportCompletionDataResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + namespace QueryExpansionSpec { - /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportCompletionDataResponse instance - */ - public static create(properties?: google.cloud.retail.v2beta.IImportCompletionDataResponse): google.cloud.retail.v2beta.ImportCompletionDataResponse; + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } - /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of a PersonalizationSpec. */ + interface IPersonalizationSpec { - /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** PersonalizationSpec mode */ + mode?: (google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode|null); + } - /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportCompletionDataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ImportCompletionDataResponse; + /** Represents a PersonalizationSpec. */ + class PersonalizationSpec implements IPersonalizationSpec { - /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ImportCompletionDataResponse; + /** + * Constructs a new PersonalizationSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec); - /** - * Verifies an ImportCompletionDataResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** PersonalizationSpec mode. */ + public mode: (google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode); - /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportCompletionDataResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ImportCompletionDataResponse; + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns PersonalizationSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec): google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec; - /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. - * @param message ImportCompletionDataResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this ImportCompletionDataResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a Product. */ - interface IProduct { + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec; - /** Product expireTime */ - expireTime?: (google.protobuf.ITimestamp|null); + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec; - /** Product ttl */ - ttl?: (google.protobuf.IDuration|null); + /** + * Verifies a PersonalizationSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Product name */ - name?: (string|null); + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PersonalizationSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec; - /** Product id */ - id?: (string|null); + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @param message PersonalizationSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Product type */ - type?: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type|null); + /** + * Converts this PersonalizationSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Product primaryProductId */ - primaryProductId?: (string|null); + namespace PersonalizationSpec { - /** Product collectionMemberIds */ - collectionMemberIds?: (string[]|null); + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + AUTO = 1, + DISABLED = 2 + } + } - /** Product gtin */ - gtin?: (string|null); + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } + } - /** Product categories */ - categories?: (string[]|null); + /** Properties of a SearchResponse. */ + interface ISearchResponse { - /** Product title */ - title?: (string|null); + /** SearchResponse results */ + results?: (google.cloud.retail.v2beta.SearchResponse.ISearchResult[]|null); - /** Product brands */ - brands?: (string[]|null); + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2beta.SearchResponse.IFacet[]|null); - /** Product description */ - description?: (string|null); + /** SearchResponse totalSize */ + totalSize?: (number|null); - /** Product languageCode */ - languageCode?: (string|null); + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); - /** Product attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + /** SearchResponse attributionToken */ + attributionToken?: (string|null); - /** Product tags */ - tags?: (string[]|null); + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); - /** Product priceInfo */ - priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null); - /** Product rating */ - rating?: (google.cloud.retail.v2beta.IRating|null); + /** SearchResponse redirectUri */ + redirectUri?: (string|null); - /** Product availableTime */ - availableTime?: (google.protobuf.ITimestamp|null); + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); - /** Product availability */ - availability?: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability|null); + /** SearchResponse invalidConditionBoostSpecs */ + invalidConditionBoostSpecs?: (google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } - /** Product availableQuantity */ - availableQuantity?: (google.protobuf.IInt32Value|null); + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { - /** Product fulfillmentInfo */ - fulfillmentInfo?: (google.cloud.retail.v2beta.IFulfillmentInfo[]|null); + /** + * Constructs a new SearchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ISearchResponse); - /** Product uri */ - uri?: (string|null); + /** SearchResponse results. */ + public results: google.cloud.retail.v2beta.SearchResponse.ISearchResult[]; - /** Product images */ - images?: (google.cloud.retail.v2beta.IImage[]|null); + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2beta.SearchResponse.IFacet[]; - /** Product audience */ - audience?: (google.cloud.retail.v2beta.IAudience|null); + /** SearchResponse totalSize. */ + public totalSize: number; - /** Product colorInfo */ - colorInfo?: (google.cloud.retail.v2beta.IColorInfo|null); + /** SearchResponse correctedQuery. */ + public correctedQuery: string; - /** Product sizes */ - sizes?: (string[]|null); + /** SearchResponse attributionToken. */ + public attributionToken: string; - /** Product materials */ - materials?: (string[]|null); + /** SearchResponse nextPageToken. */ + public nextPageToken: string; - /** Product patterns */ - patterns?: (string[]|null); + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null); - /** Product conditions */ - conditions?: (string[]|null); + /** SearchResponse redirectUri. */ + public redirectUri: string; - /** Product promotions */ - promotions?: (google.cloud.retail.v2beta.IPromotion[]|null); + /** SearchResponse appliedControls. */ + public appliedControls: string[]; - /** Product publishTime */ - publishTime?: (google.protobuf.ITimestamp|null); + /** SearchResponse invalidConditionBoostSpecs. */ + public invalidConditionBoostSpecs: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]; - /** Product retrievableFields */ - retrievableFields?: (google.protobuf.IFieldMask|null); + /** + * Creates a new SearchResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.ISearchResponse): google.cloud.retail.v2beta.SearchResponse; - /** Product variants */ - variants?: (google.cloud.retail.v2beta.IProduct[]|null); - } + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a Product. */ - class Product implements IProduct { + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse; /** - * Constructs a new Product. - * @param [properties] Properties to set + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - constructor(properties?: google.cloud.retail.v2beta.IProduct); - - /** Product expireTime. */ - public expireTime?: (google.protobuf.ITimestamp|null); + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse; - /** Product ttl. */ - public ttl?: (google.protobuf.IDuration|null); + /** + * Verifies a SearchResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Product name. */ - public name: string; + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse; - /** Product id. */ - public id: string; + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Product type. */ - public type: (google.cloud.retail.v2beta.Product.Type|keyof typeof google.cloud.retail.v2beta.Product.Type); + /** + * Converts this SearchResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Product primaryProductId. */ - public primaryProductId: string; + namespace SearchResponse { - /** Product collectionMemberIds. */ - public collectionMemberIds: string[]; + /** Properties of a SearchResult. */ + interface ISearchResult { - /** Product gtin. */ - public gtin: string; + /** SearchResult id */ + id?: (string|null); - /** Product categories. */ - public categories: string[]; + /** SearchResult product */ + product?: (google.cloud.retail.v2beta.IProduct|null); - /** Product title. */ - public title: string; + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); - /** Product brands. */ - public brands: string[]; + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); - /** Product description. */ - public description: string; + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } - /** Product languageCode. */ - public languageCode: string; + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { - /** Product attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.ISearchResult); - /** Product tags. */ - public tags: string[]; + /** SearchResult id. */ + public id: string; - /** Product priceInfo. */ - public priceInfo?: (google.cloud.retail.v2beta.IPriceInfo|null); + /** SearchResult product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); - /** Product rating. */ - public rating?: (google.cloud.retail.v2beta.IRating|null); + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; - /** Product availableTime. */ - public availableTime?: (google.protobuf.ITimestamp|null); + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; - /** Product availability. */ - public availability: (google.cloud.retail.v2beta.Product.Availability|keyof typeof google.cloud.retail.v2beta.Product.Availability); + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; - /** Product availableQuantity. */ - public availableQuantity?: (google.protobuf.IInt32Value|null); + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.ISearchResult): google.cloud.retail.v2beta.SearchResponse.SearchResult; - /** Product fulfillmentInfo. */ - public fulfillmentInfo: google.cloud.retail.v2beta.IFulfillmentInfo[]; + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product uri. */ - public uri: string; + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** Product images. */ - public images: google.cloud.retail.v2beta.IImage[]; + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.SearchResult; - /** Product audience. */ - public audience?: (google.cloud.retail.v2beta.IAudience|null); + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.SearchResult; - /** Product colorInfo. */ - public colorInfo?: (google.cloud.retail.v2beta.IColorInfo|null); + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Product sizes. */ - public sizes: string[]; + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.SearchResult; - /** Product materials. */ - public materials: string[]; + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Product patterns. */ - public patterns: string[]; + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Product conditions. */ - public conditions: string[]; + /** Properties of a Facet. */ + interface IFacet { - /** Product promotions. */ - public promotions: google.cloud.retail.v2beta.IPromotion[]; + /** Facet key */ + key?: (string|null); - /** Product publishTime. */ - public publishTime?: (google.protobuf.ITimestamp|null); + /** Facet values */ + values?: (google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue[]|null); - /** Product retrievableFields. */ - public retrievableFields?: (google.protobuf.IFieldMask|null); + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } - /** Product variants. */ - public variants: google.cloud.retail.v2beta.IProduct[]; + /** Represents a Facet. */ + class Facet implements IFacet { - /** Product expiration. */ - public expiration?: ("expireTime"|"ttl"); + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.IFacet); - /** - * Creates a new Product instance using the specified properties. - * @param [properties] Properties to set - * @returns Product instance - */ - public static create(properties?: google.cloud.retail.v2beta.IProduct): google.cloud.retail.v2beta.Product; + /** Facet key. */ + public key: string; - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + /** Facet values. */ + public values: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue[]; - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; - /** - * Decodes a Product message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Product; + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.IFacet): google.cloud.retail.v2beta.SearchResponse.Facet; - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Product; + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a Product message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Product - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Product; + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.Facet; - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.Facet; - /** - * Converts this Product to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - namespace Product { + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.Facet; - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - VARIANT = 2, - COLLECTION = 3 - } + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Availability enum. */ - enum Availability { - AVAILABILITY_UNSPECIFIED = 0, - IN_STOCK = 1, - OUT_OF_STOCK = 2, - PREORDER = 3, - BACKORDER = 4 + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - } - /** Properties of a UserEvent. */ - interface IUserEvent { + namespace Facet { - /** UserEvent eventType */ - eventType?: (string|null); + /** Properties of a FacetValue. */ + interface IFacetValue { - /** UserEvent visitorId */ - visitorId?: (string|null); + /** FacetValue value */ + value?: (string|null); - /** UserEvent sessionId */ - sessionId?: (string|null); + /** FacetValue interval */ + interval?: (google.cloud.retail.v2beta.IInterval|null); - /** UserEvent eventTime */ - eventTime?: (google.protobuf.ITimestamp|null); + /** FacetValue count */ + count?: (number|Long|string|null); + } - /** UserEvent experimentIds */ - experimentIds?: (string[]|null); + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { - /** UserEvent attributionToken */ - attributionToken?: (string|null); + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue); - /** UserEvent productDetails */ - productDetails?: (google.cloud.retail.v2beta.IProductDetail[]|null); + /** FacetValue value. */ + public value?: (string|null); - /** UserEvent completionDetail */ - completionDetail?: (google.cloud.retail.v2beta.ICompletionDetail|null); + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2beta.IInterval|null); - /** UserEvent attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + /** FacetValue count. */ + public count: (number|Long|string); - /** UserEvent cartId */ - cartId?: (string|null); + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); - /** UserEvent purchaseTransaction */ - purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; - /** UserEvent searchQuery */ - searchQuery?: (string|null); + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent filter */ - filter?: (string|null); + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent orderBy */ - orderBy?: (string|null); + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; - /** UserEvent offset */ - offset?: (number|null); + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; - /** UserEvent pageCategories */ - pageCategories?: (string[]|null); + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEvent userInfo */ - userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; - /** UserEvent uri */ - uri?: (string|null); + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** UserEvent referrerUri */ - referrerUri?: (string|null); + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** UserEvent pageViewId */ - pageViewId?: (string|null); - } + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { - /** Represents a UserEvent. */ - class UserEvent implements IUserEvent { + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); - /** - * Constructs a new UserEvent. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IUserEvent); + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); + } + + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { + + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo); - /** UserEvent eventType. */ - public eventType: string; + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; - /** UserEvent visitorId. */ - public visitorId: string; + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); - /** UserEvent sessionId. */ - public sessionId: string; + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** UserEvent eventTime. */ - public eventTime?: (google.protobuf.ITimestamp|null); + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent experimentIds. */ - public experimentIds: string[]; + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; - /** UserEvent attributionToken. */ - public attributionToken: string; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** UserEvent productDetails. */ - public productDetails: google.cloud.retail.v2beta.IProductDetail[]; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** UserEvent completionDetail. */ - public completionDetail?: (google.cloud.retail.v2beta.ICompletionDetail|null); + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** UserEvent attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; - /** UserEvent cartId. */ - public cartId: string; + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** UserEvent purchaseTransaction. */ - public purchaseTransaction?: (google.cloud.retail.v2beta.IPurchaseTransaction|null); + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } - /** UserEvent searchQuery. */ - public searchQuery: string; + /** Represents a ControlService */ + class ControlService extends $protobuf.rpc.Service { - /** UserEvent filter. */ - public filter: string; + /** + * Constructs a new ControlService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** UserEvent orderBy. */ - public orderBy: string; + /** + * Creates new ControlService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ControlService; - /** UserEvent offset. */ - public offset: number; + /** + * Calls CreateControl. + * @param request CreateControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control + */ + public createControl(request: google.cloud.retail.v2beta.ICreateControlRequest, callback: google.cloud.retail.v2beta.ControlService.CreateControlCallback): void; - /** UserEvent pageCategories. */ - public pageCategories: string[]; + /** + * Calls CreateControl. + * @param request CreateControlRequest message or plain object + * @returns Promise + */ + public createControl(request: google.cloud.retail.v2beta.ICreateControlRequest): Promise; - /** UserEvent userInfo. */ - public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); + /** + * Calls DeleteControl. + * @param request DeleteControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteControl(request: google.cloud.retail.v2beta.IDeleteControlRequest, callback: google.cloud.retail.v2beta.ControlService.DeleteControlCallback): void; - /** UserEvent uri. */ - public uri: string; + /** + * Calls DeleteControl. + * @param request DeleteControlRequest message or plain object + * @returns Promise + */ + public deleteControl(request: google.cloud.retail.v2beta.IDeleteControlRequest): Promise; - /** UserEvent referrerUri. */ - public referrerUri: string; + /** + * Calls UpdateControl. + * @param request UpdateControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control + */ + public updateControl(request: google.cloud.retail.v2beta.IUpdateControlRequest, callback: google.cloud.retail.v2beta.ControlService.UpdateControlCallback): void; - /** UserEvent pageViewId. */ - public pageViewId: string; + /** + * Calls UpdateControl. + * @param request UpdateControlRequest message or plain object + * @returns Promise + */ + public updateControl(request: google.cloud.retail.v2beta.IUpdateControlRequest): Promise; /** - * Creates a new UserEvent instance using the specified properties. - * @param [properties] Properties to set - * @returns UserEvent instance + * Calls GetControl. + * @param request GetControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control */ - public static create(properties?: google.cloud.retail.v2beta.IUserEvent): google.cloud.retail.v2beta.UserEvent; + public getControl(request: google.cloud.retail.v2beta.IGetControlRequest, callback: google.cloud.retail.v2beta.ControlService.GetControlCallback): void; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls GetControl. + * @param request GetControlRequest message or plain object + * @returns Promise */ - public static encode(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public getControl(request: google.cloud.retail.v2beta.IGetControlRequest): Promise; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListControls. + * @param request ListControlsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListControlsResponse */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public listControls(request: google.cloud.retail.v2beta.IListControlsRequest, callback: google.cloud.retail.v2beta.ControlService.ListControlsCallback): void; /** - * Decodes a UserEvent message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UserEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ListControls. + * @param request ListControlsRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UserEvent; + public listControls(request: google.cloud.retail.v2beta.IListControlsRequest): Promise; + } + + namespace ControlService { /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UserEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#createControl}. + * @param error Error, if any + * @param [response] Control */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UserEvent; + type CreateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Control) => void; /** - * Verifies a UserEvent message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#deleteControl}. + * @param error Error, if any + * @param [response] Empty */ - public static verify(message: { [k: string]: any }): (string|null); + type DeleteControlCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UserEvent + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#updateControl}. + * @param error Error, if any + * @param [response] Control */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UserEvent; + type UpdateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Control) => void; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @param message UserEvent - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#getControl}. + * @param error Error, if any + * @param [response] Control */ - public static toObject(message: google.cloud.retail.v2beta.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type GetControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Control) => void; /** - * Converts this UserEvent to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#listControls}. + * @param error Error, if any + * @param [response] ListControlsResponse */ - public toJSON(): { [k: string]: any }; + type ListControlsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListControlsResponse) => void; } - /** Properties of a ProductDetail. */ - interface IProductDetail { + /** Properties of a CreateControlRequest. */ + interface ICreateControlRequest { - /** ProductDetail product */ - product?: (google.cloud.retail.v2beta.IProduct|null); + /** CreateControlRequest parent */ + parent?: (string|null); - /** ProductDetail quantity */ - quantity?: (google.protobuf.IInt32Value|null); + /** CreateControlRequest control */ + control?: (google.cloud.retail.v2beta.IControl|null); + + /** CreateControlRequest controlId */ + controlId?: (string|null); } - /** Represents a ProductDetail. */ - class ProductDetail implements IProductDetail { + /** Represents a CreateControlRequest. */ + class CreateControlRequest implements ICreateControlRequest { /** - * Constructs a new ProductDetail. + * Constructs a new CreateControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IProductDetail); + constructor(properties?: google.cloud.retail.v2beta.ICreateControlRequest); - /** ProductDetail product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); + /** CreateControlRequest parent. */ + public parent: string; - /** ProductDetail quantity. */ - public quantity?: (google.protobuf.IInt32Value|null); + /** CreateControlRequest control. */ + public control?: (google.cloud.retail.v2beta.IControl|null); + + /** CreateControlRequest controlId. */ + public controlId: string; /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new CreateControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductDetail instance + * @returns CreateControlRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IProductDetail): google.cloud.retail.v2beta.ProductDetail; + public static create(properties?: google.cloud.retail.v2beta.ICreateControlRequest): google.cloud.retail.v2beta.CreateControlRequest; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified CreateControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateControlRequest.verify|verify} messages. + * @param message CreateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICreateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified CreateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateControlRequest.verify|verify} messages. + * @param message CreateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a CreateControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductDetail + * @returns CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ProductDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateControlRequest; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a CreateControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductDetail + * @returns CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ProductDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateControlRequest; /** - * Verifies a ProductDetail message. + * Verifies a CreateControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a CreateControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductDetail + * @returns CreateControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ProductDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateControlRequest; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @param message ProductDetail + * Creates a plain object from a CreateControlRequest message. Also converts values to other types if specified. + * @param message CreateControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CreateControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductDetail to JSON. + * Converts this CreateControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompletionDetail. */ - interface ICompletionDetail { - - /** CompletionDetail completionAttributionToken */ - completionAttributionToken?: (string|null); + /** Properties of an UpdateControlRequest. */ + interface IUpdateControlRequest { - /** CompletionDetail selectedSuggestion */ - selectedSuggestion?: (string|null); + /** UpdateControlRequest control */ + control?: (google.cloud.retail.v2beta.IControl|null); - /** CompletionDetail selectedPosition */ - selectedPosition?: (number|null); + /** UpdateControlRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a CompletionDetail. */ - class CompletionDetail implements ICompletionDetail { + /** Represents an UpdateControlRequest. */ + class UpdateControlRequest implements IUpdateControlRequest { /** - * Constructs a new CompletionDetail. + * Constructs a new UpdateControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICompletionDetail); - - /** CompletionDetail completionAttributionToken. */ - public completionAttributionToken: string; + constructor(properties?: google.cloud.retail.v2beta.IUpdateControlRequest); - /** CompletionDetail selectedSuggestion. */ - public selectedSuggestion: string; + /** UpdateControlRequest control. */ + public control?: (google.cloud.retail.v2beta.IControl|null); - /** CompletionDetail selectedPosition. */ - public selectedPosition: number; + /** UpdateControlRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new CompletionDetail instance using the specified properties. + * Creates a new UpdateControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDetail instance + * @returns UpdateControlRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.ICompletionDetail): google.cloud.retail.v2beta.CompletionDetail; + public static create(properties?: google.cloud.retail.v2beta.IUpdateControlRequest): google.cloud.retail.v2beta.UpdateControlRequest; /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified UpdateControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateControlRequest.verify|verify} messages. + * @param message UpdateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUpdateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified UpdateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateControlRequest.verify|verify} messages. + * @param message UpdateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDetail message from the specified reader or buffer. + * Decodes an UpdateControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDetail + * @returns UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompletionDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateControlRequest; /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * Decodes an UpdateControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDetail + * @returns UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompletionDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateControlRequest; /** - * Verifies a CompletionDetail message. + * Verifies an UpdateControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDetail + * @returns UpdateControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompletionDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateControlRequest; /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. - * @param message CompletionDetail + * Creates a plain object from an UpdateControlRequest message. Also converts values to other types if specified. + * @param message UpdateControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UpdateControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDetail to JSON. + * Converts this UpdateControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurchaseTransaction. */ - interface IPurchaseTransaction { - - /** PurchaseTransaction id */ - id?: (string|null); - - /** PurchaseTransaction revenue */ - revenue?: (number|null); - - /** PurchaseTransaction tax */ - tax?: (number|null); - - /** PurchaseTransaction cost */ - cost?: (number|null); + /** Properties of a DeleteControlRequest. */ + interface IDeleteControlRequest { - /** PurchaseTransaction currencyCode */ - currencyCode?: (string|null); + /** DeleteControlRequest name */ + name?: (string|null); } - /** Represents a PurchaseTransaction. */ - class PurchaseTransaction implements IPurchaseTransaction { + /** Represents a DeleteControlRequest. */ + class DeleteControlRequest implements IDeleteControlRequest { /** - * Constructs a new PurchaseTransaction. + * Constructs a new DeleteControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPurchaseTransaction); - - /** PurchaseTransaction id. */ - public id: string; - - /** PurchaseTransaction revenue. */ - public revenue: number; + constructor(properties?: google.cloud.retail.v2beta.IDeleteControlRequest); - /** PurchaseTransaction tax. */ - public tax: number; - - /** PurchaseTransaction cost. */ - public cost: number; - - /** PurchaseTransaction currencyCode. */ - public currencyCode: string; + /** DeleteControlRequest name. */ + public name: string; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new DeleteControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PurchaseTransaction instance + * @returns DeleteControlRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IPurchaseTransaction): google.cloud.retail.v2beta.PurchaseTransaction; + public static create(properties?: google.cloud.retail.v2beta.IDeleteControlRequest): google.cloud.retail.v2beta.DeleteControlRequest; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified DeleteControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteControlRequest.verify|verify} messages. + * @param message DeleteControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IDeleteControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified DeleteControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteControlRequest.verify|verify} messages. + * @param message DeleteControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a DeleteControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurchaseTransaction + * @returns DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurchaseTransaction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteControlRequest; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a DeleteControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurchaseTransaction + * @returns DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurchaseTransaction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteControlRequest; /** - * Verifies a PurchaseTransaction message. + * Verifies a DeleteControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurchaseTransaction + * @returns DeleteControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurchaseTransaction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteControlRequest; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @param message PurchaseTransaction + * Creates a plain object from a DeleteControlRequest message. Also converts values to other types if specified. + * @param message DeleteControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.DeleteControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this DeleteControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { - - /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** Properties of a GetControlRequest. */ + interface IGetControlRequest { - /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + /** GetControlRequest name */ + name?: (string|null); + } - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse - */ - public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest, callback: google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback): void; + /** Represents a GetControlRequest. */ + class GetControlRequest implements IGetControlRequest { /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise + * Constructs a new GetControlRequest. + * @param [properties] Properties to set */ - public listCatalogs(request: google.cloud.retail.v2beta.IListCatalogsRequest): Promise; + constructor(properties?: google.cloud.retail.v2beta.IGetControlRequest); - /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog - */ - public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest, callback: google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback): void; + /** GetControlRequest name. */ + public name: string; /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise + * Creates a new GetControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetControlRequest instance */ - public updateCatalog(request: google.cloud.retail.v2beta.IUpdateCatalogRequest): Promise; + public static create(properties?: google.cloud.retail.v2beta.IGetControlRequest): google.cloud.retail.v2beta.GetControlRequest; /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Encodes the specified GetControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetControlRequest.verify|verify} messages. + * @param message GetControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public setDefaultBranch(request: google.cloud.retail.v2beta.ISetDefaultBranchRequest, callback: google.cloud.retail.v2beta.CatalogService.SetDefaultBranchCallback): void; + public static encode(message: google.cloud.retail.v2beta.IGetControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @returns Promise + * Encodes the specified GetControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetControlRequest.verify|verify} messages. + * @param message GetControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public setDefaultBranch(request: google.cloud.retail.v2beta.ISetDefaultBranchRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * Decodes a GetControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2beta.IGetDefaultBranchRequest, callback: google.cloud.retail.v2beta.CatalogService.GetDefaultBranchCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetControlRequest; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @returns Promise + * Decodes a GetControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2beta.IGetDefaultBranchRequest): Promise; - } - - namespace CatalogService { + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetControlRequest; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse + * Verifies a GetControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListCatalogsResponse) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog + * Creates a GetControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetControlRequest */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Catalog) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetControlRequest; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. - * @param error Error, if any - * @param [response] Empty + * Creates a plain object from a GetControlRequest message. Also converts values to other types if specified. + * @param message GetControlRequest + * @param [options] Conversion options + * @returns Plain object */ - type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static toObject(message: google.cloud.retail.v2beta.GetControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. - * @param error Error, if any - * @param [response] GetDefaultBranchResponse + * Converts this GetControlRequest to JSON. + * @returns JSON object */ - type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.GetDefaultBranchResponse) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { + /** Properties of a ListControlsRequest. */ + interface IListControlsRequest { - /** ListCatalogsRequest parent */ + /** ListControlsRequest parent */ parent?: (string|null); - /** ListCatalogsRequest pageSize */ + /** ListControlsRequest pageSize */ pageSize?: (number|null); - /** ListCatalogsRequest pageToken */ + /** ListControlsRequest pageToken */ pageToken?: (string|null); + + /** ListControlsRequest filter */ + filter?: (string|null); } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents a ListControlsRequest. */ + class ListControlsRequest implements IListControlsRequest { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new ListControlsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IListCatalogsRequest); + constructor(properties?: google.cloud.retail.v2beta.IListControlsRequest); - /** ListCatalogsRequest parent. */ + /** ListControlsRequest parent. */ public parent: string; - /** ListCatalogsRequest pageSize. */ + /** ListControlsRequest pageSize. */ public pageSize: number; - /** ListCatalogsRequest pageToken. */ + /** ListControlsRequest pageToken. */ public pageToken: string; + /** ListControlsRequest filter. */ + public filter: string; + /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new ListControlsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns ListControlsRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IListCatalogsRequest): google.cloud.retail.v2beta.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2beta.IListControlsRequest): google.cloud.retail.v2beta.ListControlsRequest; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ListControlsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsRequest.verify|verify} messages. + * @param message ListControlsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IListControlsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified ListControlsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsRequest.verify|verify} messages. + * @param message ListControlsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListControlsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a ListControlsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListControlsRequest; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListControlsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListControlsRequest; /** - * Verifies a ListCatalogsRequest message. + * Verifies a ListControlsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListControlsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns ListControlsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListControlsRequest; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from a ListControlsRequest message. Also converts values to other types if specified. + * @param message ListControlsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ListControlsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ListControlsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { + /** Properties of a ListControlsResponse. */ + interface IListControlsResponse { - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2beta.ICatalog[]|null); + /** ListControlsResponse controls */ + controls?: (google.cloud.retail.v2beta.IControl[]|null); - /** ListCatalogsResponse nextPageToken */ + /** ListControlsResponse nextPageToken */ nextPageToken?: (string|null); } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { + /** Represents a ListControlsResponse. */ + class ListControlsResponse implements IListControlsResponse { /** - * Constructs a new ListCatalogsResponse. + * Constructs a new ListControlsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IListCatalogsResponse); + constructor(properties?: google.cloud.retail.v2beta.IListControlsResponse); - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2beta.ICatalog[]; + /** ListControlsResponse controls. */ + public controls: google.cloud.retail.v2beta.IControl[]; - /** ListCatalogsResponse nextPageToken. */ + /** ListControlsResponse nextPageToken. */ public nextPageToken: string; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new ListControlsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance + * @returns ListControlsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IListCatalogsResponse): google.cloud.retail.v2beta.ListCatalogsResponse; + public static create(properties?: google.cloud.retail.v2beta.IListControlsResponse): google.cloud.retail.v2beta.ListControlsResponse; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ListControlsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsResponse.verify|verify} messages. + * @param message ListControlsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IListControlsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified ListControlsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsResponse.verify|verify} messages. + * @param message ListControlsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListControlsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a ListControlsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns ListControlsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListControlsResponse; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListControlsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns ListControlsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListControlsResponse; /** - * Verifies a ListCatalogsResponse message. + * Verifies a ListControlsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListControlsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns ListControlsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListControlsResponse; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from a ListControlsResponse message. Also converts values to other types if specified. + * @param message ListControlsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ListControlsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this ListControlsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { - - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2beta.ICatalog|null); + /** Properties of an ExportErrorsConfig. */ + interface IExportErrorsConfig { - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** ExportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Represents an ExportErrorsConfig. */ + class ExportErrorsConfig implements IExportErrorsConfig { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new ExportErrorsConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest); + constructor(properties?: google.cloud.retail.v2beta.IExportErrorsConfig); - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2beta.ICatalog|null); + /** ExportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** ExportErrorsConfig destination. */ + public destination?: "gcsPrefix"; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new ExportErrorsConfig instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns ExportErrorsConfig instance */ - public static create(properties?: google.cloud.retail.v2beta.IUpdateCatalogRequest): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2beta.IExportErrorsConfig): google.cloud.retail.v2beta.ExportErrorsConfig; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes an ExportErrorsConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportErrorsConfig; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportErrorsConfig; /** - * Verifies an UpdateCatalogRequest message. + * Verifies an ExportErrorsConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns ExportErrorsConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportErrorsConfig; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @param message ExportErrorsConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this ExportErrorsConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetDefaultBranchRequest. */ - interface ISetDefaultBranchRequest { - - /** SetDefaultBranchRequest catalog */ - catalog?: (string|null); + /** Properties of an ExportMetadata. */ + interface IExportMetadata { - /** SetDefaultBranchRequest branchId */ - branchId?: (string|null); + /** ExportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** SetDefaultBranchRequest note */ - note?: (string|null); + /** ExportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); } - /** Represents a SetDefaultBranchRequest. */ - class SetDefaultBranchRequest implements ISetDefaultBranchRequest { + /** Represents an ExportMetadata. */ + class ExportMetadata implements IExportMetadata { /** - * Constructs a new SetDefaultBranchRequest. + * Constructs a new ExportMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ISetDefaultBranchRequest); - - /** SetDefaultBranchRequest catalog. */ - public catalog: string; + constructor(properties?: google.cloud.retail.v2beta.IExportMetadata); - /** SetDefaultBranchRequest branchId. */ - public branchId: string; + /** ExportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** SetDefaultBranchRequest note. */ - public note: string; + /** ExportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. + * Creates a new ExportMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns SetDefaultBranchRequest instance + * @returns ExportMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.ISetDefaultBranchRequest): google.cloud.retail.v2beta.SetDefaultBranchRequest; + public static create(properties?: google.cloud.retail.v2beta.IExportMetadata): google.cloud.retail.v2beta.ExportMetadata; /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * Decodes an ExportMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetDefaultBranchRequest + * @returns ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetDefaultBranchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportMetadata; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetDefaultBranchRequest + * @returns ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetDefaultBranchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportMetadata; /** - * Verifies a SetDefaultBranchRequest message. + * Verifies an ExportMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetDefaultBranchRequest + * @returns ExportMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetDefaultBranchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportMetadata; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message SetDefaultBranchRequest + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @param message ExportMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetDefaultBranchRequest to JSON. + * Converts this ExportMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetDefaultBranchRequest. */ - interface IGetDefaultBranchRequest { + /** Properties of an ExportProductsResponse. */ + interface IExportProductsResponse { - /** GetDefaultBranchRequest catalog */ - catalog?: (string|null); + /** ExportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); } - /** Represents a GetDefaultBranchRequest. */ - class GetDefaultBranchRequest implements IGetDefaultBranchRequest { + /** Represents an ExportProductsResponse. */ + class ExportProductsResponse implements IExportProductsResponse { /** - * Constructs a new GetDefaultBranchRequest. + * Constructs a new ExportProductsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IGetDefaultBranchRequest); + constructor(properties?: google.cloud.retail.v2beta.IExportProductsResponse); - /** GetDefaultBranchRequest catalog. */ - public catalog: string; + /** ExportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. + * Creates a new ExportProductsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchRequest instance + * @returns ExportProductsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IGetDefaultBranchRequest): google.cloud.retail.v2beta.GetDefaultBranchRequest; + public static create(properties?: google.cloud.retail.v2beta.IExportProductsResponse): google.cloud.retail.v2beta.ExportProductsResponse; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * Decodes an ExportProductsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchRequest + * @returns ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetDefaultBranchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportProductsResponse; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchRequest + * @returns ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetDefaultBranchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportProductsResponse; /** - * Verifies a GetDefaultBranchRequest message. + * Verifies an ExportProductsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchRequest + * @returns ExportProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetDefaultBranchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportProductsResponse; /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message GetDefaultBranchRequest + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @param message ExportProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetDefaultBranchRequest to JSON. + * Converts this ExportProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetDefaultBranchResponse. */ - interface IGetDefaultBranchResponse { - - /** GetDefaultBranchResponse branch */ - branch?: (string|null); + /** Properties of an ExportUserEventsResponse. */ + interface IExportUserEventsResponse { - /** GetDefaultBranchResponse setTime */ - setTime?: (google.protobuf.ITimestamp|null); + /** ExportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); - /** GetDefaultBranchResponse note */ - note?: (string|null); + /** ExportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); } - /** Represents a GetDefaultBranchResponse. */ - class GetDefaultBranchResponse implements IGetDefaultBranchResponse { + /** Represents an ExportUserEventsResponse. */ + class ExportUserEventsResponse implements IExportUserEventsResponse { /** - * Constructs a new GetDefaultBranchResponse. + * Constructs a new ExportUserEventsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IGetDefaultBranchResponse); - - /** GetDefaultBranchResponse branch. */ - public branch: string; + constructor(properties?: google.cloud.retail.v2beta.IExportUserEventsResponse); - /** GetDefaultBranchResponse setTime. */ - public setTime?: (google.protobuf.ITimestamp|null); + /** ExportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; - /** GetDefaultBranchResponse note. */ - public note: string; + /** ExportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. + * Creates a new ExportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchResponse instance + * @returns ExportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IGetDefaultBranchResponse): google.cloud.retail.v2beta.GetDefaultBranchResponse; + public static create(properties?: google.cloud.retail.v2beta.IExportUserEventsResponse): google.cloud.retail.v2beta.ExportUserEventsResponse; /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchResponse + * @returns ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetDefaultBranchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportUserEventsResponse; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchResponse + * @returns ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetDefaultBranchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportUserEventsResponse; /** - * Verifies a GetDefaultBranchResponse message. + * Verifies an ExportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchResponse + * @returns ExportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetDefaultBranchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportUserEventsResponse; /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. - * @param message GetDefaultBranchResponse + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @param message ExportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetDefaultBranchResponse to JSON. + * Converts this ExportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a CompletionService */ - class CompletionService extends $protobuf.rpc.Service { + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { /** - * Constructs a new CompletionService service. + * Constructs a new PredictionService service. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited @@ -26945,2602 +32599,2338 @@ export namespace google { constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates new CompletionService service using the specified rpc implementation. + * Creates new PredictionService service using the specified rpc implementation. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; - - /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse - */ - public completeQuery(request: google.cloud.retail.v2beta.ICompleteQueryRequest, callback: google.cloud.retail.v2beta.CompletionService.CompleteQueryCallback): void; - - /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @returns Promise - */ - public completeQuery(request: google.cloud.retail.v2beta.ICompleteQueryRequest): Promise; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse */ - public importCompletionData(request: google.cloud.retail.v2beta.IImportCompletionDataRequest, callback: google.cloud.retail.v2beta.CompletionService.ImportCompletionDataCallback): void; + public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object + * Calls Predict. + * @param request PredictRequest message or plain object * @returns Promise */ - public importCompletionData(request: google.cloud.retail.v2beta.IImportCompletionDataRequest): Promise; + public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; } - namespace CompletionService { - - /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. - * @param error Error, if any - * @param [response] CompleteQueryResponse - */ - type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompleteQueryResponse) => void; + namespace PredictionService { /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. * @param error Error, if any - * @param [response] Operation + * @param [response] PredictResponse */ - type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; } - /** Properties of a CompleteQueryRequest. */ - interface ICompleteQueryRequest { + /** Properties of a PredictRequest. */ + interface IPredictRequest { - /** CompleteQueryRequest catalog */ - catalog?: (string|null); + /** PredictRequest placement */ + placement?: (string|null); - /** CompleteQueryRequest query */ - query?: (string|null); + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); - /** CompleteQueryRequest visitorId */ - visitorId?: (string|null); + /** PredictRequest pageSize */ + pageSize?: (number|null); - /** CompleteQueryRequest languageCodes */ - languageCodes?: (string[]|null); + /** PredictRequest pageToken */ + pageToken?: (string|null); - /** CompleteQueryRequest deviceType */ - deviceType?: (string|null); + /** PredictRequest filter */ + filter?: (string|null); - /** CompleteQueryRequest dataset */ - dataset?: (string|null); + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); - /** CompleteQueryRequest maxSuggestions */ - maxSuggestions?: (number|null); + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); } - /** Represents a CompleteQueryRequest. */ - class CompleteQueryRequest implements ICompleteQueryRequest { + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { /** - * Constructs a new CompleteQueryRequest. + * Constructs a new PredictRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICompleteQueryRequest); + constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); - /** CompleteQueryRequest catalog. */ - public catalog: string; + /** PredictRequest placement. */ + public placement: string; - /** CompleteQueryRequest query. */ - public query: string; + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); - /** CompleteQueryRequest visitorId. */ - public visitorId: string; + /** PredictRequest pageSize. */ + public pageSize: number; - /** CompleteQueryRequest languageCodes. */ - public languageCodes: string[]; + /** PredictRequest pageToken. */ + public pageToken: string; - /** CompleteQueryRequest deviceType. */ - public deviceType: string; + /** PredictRequest filter. */ + public filter: string; - /** CompleteQueryRequest dataset. */ - public dataset: string; + /** PredictRequest validateOnly. */ + public validateOnly: boolean; - /** CompleteQueryRequest maxSuggestions. */ - public maxSuggestions: number; + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new PredictRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryRequest instance + * @returns PredictRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.ICompleteQueryRequest): google.cloud.retail.v2beta.CompleteQueryRequest; + public static create(properties?: google.cloud.retail.v2beta.IPredictRequest): google.cloud.retail.v2beta.PredictRequest; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryRequest + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictRequest; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryRequest + * @returns PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictRequest; /** - * Verifies a CompleteQueryRequest message. + * Verifies a PredictRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryRequest + * @returns PredictRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictRequest; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. - * @param message CompleteQueryRequest + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this PredictRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompleteQueryResponse. */ - interface ICompleteQueryResponse { + /** Properties of a PredictResponse. */ + interface IPredictResponse { - /** CompleteQueryResponse completionResults */ - completionResults?: (google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult[]|null); + /** PredictResponse results */ + results?: (google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]|null); - /** CompleteQueryResponse attributionToken */ + /** PredictResponse attributionToken */ attributionToken?: (string|null); - /** CompleteQueryResponse recentSearchResults */ - recentSearchResults?: (google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult[]|null); + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); } - /** Represents a CompleteQueryResponse. */ - class CompleteQueryResponse implements ICompleteQueryResponse { + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { /** - * Constructs a new CompleteQueryResponse. + * Constructs a new PredictResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICompleteQueryResponse); + constructor(properties?: google.cloud.retail.v2beta.IPredictResponse); - /** CompleteQueryResponse completionResults. */ - public completionResults: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult[]; + /** PredictResponse results. */ + public results: google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]; - /** CompleteQueryResponse attributionToken. */ + /** PredictResponse attributionToken. */ public attributionToken: string; - /** CompleteQueryResponse recentSearchResults. */ - public recentSearchResults: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult[]; + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new PredictResponse instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryResponse instance + * @returns PredictResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.ICompleteQueryResponse): google.cloud.retail.v2beta.CompleteQueryResponse; + public static create(properties?: google.cloud.retail.v2beta.IPredictResponse): google.cloud.retail.v2beta.PredictResponse; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryResponse + * @returns PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryResponse + * @returns PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse; /** - * Verifies a CompleteQueryResponse message. + * Verifies a PredictResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryResponse + * @returns PredictResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. - * @param message CompleteQueryResponse + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this PredictResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CompleteQueryResponse { + namespace PredictResponse { - /** Properties of a CompletionResult. */ - interface ICompletionResult { + /** Properties of a PredictionResult. */ + interface IPredictionResult { - /** CompletionResult suggestion */ - suggestion?: (string|null); + /** PredictionResult id */ + id?: (string|null); - /** CompletionResult attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2beta.ICustomAttribute }|null); + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); } - /** Represents a CompletionResult. */ - class CompletionResult implements ICompletionResult { - - /** - * Constructs a new CompletionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult); - - /** CompletionResult suggestion. */ - public suggestion: string; - - /** CompletionResult attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2beta.ICustomAttribute }; + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { /** - * Creates a new CompletionResult instance using the specified properties. + * Constructs a new PredictionResult. * @param [properties] Properties to set - * @returns CompletionResult instance - */ - public static create(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; - - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; - - /** - * Verifies a CompletionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompletionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @param message CompletionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CompletionResult to JSON. - * @returns JSON object */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a RecentSearchResult. */ - interface IRecentSearchResult { - - /** RecentSearchResult recentSearch */ - recentSearch?: (string|null); - } - - /** Represents a RecentSearchResult. */ - class RecentSearchResult implements IRecentSearchResult { + constructor(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult); - /** - * Constructs a new RecentSearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult); + /** PredictionResult id. */ + public id: string; - /** RecentSearchResult recentSearch. */ - public recentSearch: string; + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; /** - * Creates a new RecentSearchResult instance using the specified properties. + * Creates a new PredictionResult instance using the specified properties. * @param [properties] Properties to set - * @returns RecentSearchResult instance + * @returns PredictionResult instance */ - public static create(properties?: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + public static create(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult): google.cloud.retail.v2beta.PredictResponse.PredictionResult; /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RecentSearchResult message from the specified reader or buffer. + * Decodes a PredictionResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RecentSearchResult + * @returns PredictionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse.PredictionResult; /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RecentSearchResult + * @returns PredictionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse.PredictionResult; /** - * Verifies a RecentSearchResult message. + * Verifies a PredictionResult message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RecentSearchResult + * @returns PredictionResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse.PredictionResult; /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @param message RecentSearchResult + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RecentSearchResult to JSON. + * Converts this PredictionResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } } - /** Properties of an ExportErrorsConfig. */ - interface IExportErrorsConfig { + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { - /** ExportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); - } + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** Represents an ExportErrorsConfig. */ - class ExportErrorsConfig implements IExportErrorsConfig { + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; /** - * Constructs a new ExportErrorsConfig. - * @param [properties] Properties to set + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - constructor(properties?: google.cloud.retail.v2beta.IExportErrorsConfig); + public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest, callback: google.cloud.retail.v2beta.ProductService.CreateProductCallback): void; - /** ExportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest): Promise; - /** ExportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest, callback: google.cloud.retail.v2beta.ProductService.GetProductCallback): void; /** - * Creates a new ExportErrorsConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportErrorsConfig instance + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise */ - public static create(properties?: google.cloud.retail.v2beta.IExportErrorsConfig): google.cloud.retail.v2beta.ExportErrorsConfig; + public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest): Promise; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. - * @param message ExportErrorsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProductsResponse */ - public static encode(message: google.cloud.retail.v2beta.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public listProducts(request: google.cloud.retail.v2beta.IListProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ListProductsCallback): void; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. - * @param message ExportErrorsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public listProducts(request: google.cloud.retail.v2beta.IListProductsRequest): Promise; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportErrorsConfig; + public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest, callback: google.cloud.retail.v2beta.ProductService.UpdateProductCallback): void; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportErrorsConfig; + public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest): Promise; /** - * Verifies an ExportErrorsConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty */ - public static verify(message: { [k: string]: any }): (string|null); + public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest, callback: google.cloud.retail.v2beta.ProductService.DeleteProductCallback): void; /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportErrorsConfig + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportErrorsConfig; + public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest): Promise; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. - * @param message ExportErrorsConfig - * @param [options] Conversion options - * @returns Plain object + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static toObject(message: google.cloud.retail.v2beta.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ImportProductsCallback): void; /** - * Converts this ExportErrorsConfig to JSON. - * @returns JSON object + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of an ExportMetadata. */ - interface IExportMetadata { - - /** ExportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** ExportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents an ExportMetadata. */ - class ExportMetadata implements IExportMetadata { + public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest): Promise; /** - * Constructs a new ExportMetadata. - * @param [properties] Properties to set + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - constructor(properties?: google.cloud.retail.v2beta.IExportMetadata); - - /** ExportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** ExportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + public setInventory(request: google.cloud.retail.v2beta.ISetInventoryRequest, callback: google.cloud.retail.v2beta.ProductService.SetInventoryCallback): void; /** - * Creates a new ExportMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportMetadata instance + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @returns Promise */ - public static create(properties?: google.cloud.retail.v2beta.IExportMetadata): google.cloud.retail.v2beta.ExportMetadata; + public setInventory(request: google.cloud.retail.v2beta.ISetInventoryRequest): Promise; /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. - * @param message ExportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static encode(message: google.cloud.retail.v2beta.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public addFulfillmentPlaces(request: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2beta.ProductService.AddFulfillmentPlacesCallback): void; /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. - * @param message ExportMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public addFulfillmentPlaces(request: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest): Promise; /** - * Decodes an ExportMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportMetadata; + public removeFulfillmentPlaces(request: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlacesCallback): void; /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportMetadata; + public removeFulfillmentPlaces(request: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest): Promise; /** - * Verifies an ExportMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static verify(message: { [k: string]: any }): (string|null); + public addLocalInventories(request: google.cloud.retail.v2beta.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2beta.ProductService.AddLocalInventoriesCallback): void; /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportMetadata + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportMetadata; + public addLocalInventories(request: google.cloud.retail.v2beta.IAddLocalInventoriesRequest): Promise; /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. - * @param message ExportMetadata - * @param [options] Conversion options - * @returns Plain object + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static toObject(message: google.cloud.retail.v2beta.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public removeLocalInventories(request: google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2beta.ProductService.RemoveLocalInventoriesCallback): void; /** - * Converts this ExportMetadata to JSON. - * @returns JSON object + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of an ExportProductsResponse. */ - interface IExportProductsResponse { - - /** ExportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - - /** ExportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + public removeLocalInventories(request: google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest): Promise; } - /** Represents an ExportProductsResponse. */ - class ExportProductsResponse implements IExportProductsResponse { + namespace ProductService { /** - * Constructs a new ExportProductsResponse. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product */ - constructor(properties?: google.cloud.retail.v2beta.IExportProductsResponse); - - /** ExportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; - - /** ExportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; /** - * Creates a new ExportProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportProductsResponse instance + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product */ - public static create(properties?: google.cloud.retail.v2beta.IExportProductsResponse): google.cloud.retail.v2beta.ExportProductsResponse; + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. - * @param message ExportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. + * @param error Error, if any + * @param [response] ListProductsResponse */ - public static encode(message: google.cloud.retail.v2beta.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListProductsResponse) => void; /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. - * @param message ExportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportProductsResponse; + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. + * @param error Error, if any + * @param [response] Operation */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportProductsResponse; + type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Verifies an ExportProductsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation */ - public static verify(message: { [k: string]: any }): (string|null); + type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportProductsResponse + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportProductsResponse; + type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. - * @param message ExportProductsResponse - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addLocalInventories}. + * @param error Error, if any + * @param [response] Operation */ - public static toObject(message: google.cloud.retail.v2beta.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Converts this ExportProductsResponse to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeLocalInventories}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of an ExportUserEventsResponse. */ - interface IExportUserEventsResponse { + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { - /** ExportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** CreateProductRequest parent */ + parent?: (string|null); - /** ExportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2beta.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); } - /** Represents an ExportUserEventsResponse. */ - class ExportUserEventsResponse implements IExportUserEventsResponse { + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { /** - * Constructs a new ExportUserEventsResponse. + * Constructs a new CreateProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IExportUserEventsResponse); + constructor(properties?: google.cloud.retail.v2beta.ICreateProductRequest); - /** ExportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** CreateProductRequest parent. */ + public parent: string; - /** ExportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; /** - * Creates a new ExportUserEventsResponse instance using the specified properties. + * Creates a new CreateProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ExportUserEventsResponse instance + * @returns CreateProductRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IExportUserEventsResponse): google.cloud.retail.v2beta.ExportUserEventsResponse; + public static create(properties?: google.cloud.retail.v2beta.ICreateProductRequest): google.cloud.retail.v2beta.CreateProductRequest; /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ExportUserEventsResponse + * @returns CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ExportUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateProductRequest; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ExportUserEventsResponse + * @returns CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ExportUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateProductRequest; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a CreateProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ExportUserEventsResponse + * @returns CreateProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ExportUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateProductRequest; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. - * @param message ExportUserEventsResponse + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this CreateProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { - - /** - * Constructs a new PredictionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new PredictionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; - - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse - */ - public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; - - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @returns Promise - */ - public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; - } - - namespace PredictionService { - - /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. - * @param error Error, if any - * @param [response] PredictResponse - */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; - } - - /** Properties of a PredictRequest. */ - interface IPredictRequest { - - /** PredictRequest placement */ - placement?: (string|null); - - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); - - /** PredictRequest pageSize */ - pageSize?: (number|null); - - /** PredictRequest pageToken */ - pageToken?: (string|null); - - /** PredictRequest filter */ - filter?: (string|null); - - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); - - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); + /** GetProductRequest name */ + name?: (string|null); } - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { /** - * Constructs a new PredictRequest. + * Constructs a new GetProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); - - /** PredictRequest placement. */ - public placement: string; - - /** PredictRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); - - /** PredictRequest pageSize. */ - public pageSize: number; - - /** PredictRequest pageToken. */ - public pageToken: string; - - /** PredictRequest filter. */ - public filter: string; - - /** PredictRequest validateOnly. */ - public validateOnly: boolean; - - /** PredictRequest params. */ - public params: { [k: string]: google.protobuf.IValue }; + constructor(properties?: google.cloud.retail.v2beta.IGetProductRequest); - /** PredictRequest labels. */ - public labels: { [k: string]: string }; + /** GetProductRequest name. */ + public name: string; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new GetProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PredictRequest instance + * @returns GetProductRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IPredictRequest): google.cloud.retail.v2beta.PredictRequest; + public static create(properties?: google.cloud.retail.v2beta.IGetProductRequest): google.cloud.retail.v2beta.GetProductRequest; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a GetProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictRequest + * @returns GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetProductRequest; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictRequest + * @returns GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetProductRequest; /** - * Verifies a PredictRequest message. + * Verifies a GetProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictRequest + * @returns GetProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetProductRequest; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @param message PredictRequest + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictRequest to JSON. + * Converts this GetProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PredictResponse. */ - interface IPredictResponse { - - /** PredictResponse results */ - results?: (google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]|null); + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { - /** PredictResponse attributionToken */ - attributionToken?: (string|null); + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2beta.IProduct|null); - /** PredictResponse missingIds */ - missingIds?: (string[]|null); + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); - /** PredictResponse validateOnly */ - validateOnly?: (boolean|null); + /** UpdateProductRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a PredictResponse. */ - class PredictResponse implements IPredictResponse { + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { /** - * Constructs a new PredictResponse. + * Constructs a new UpdateProductRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPredictResponse); - - /** PredictResponse results. */ - public results: google.cloud.retail.v2beta.PredictResponse.IPredictionResult[]; + constructor(properties?: google.cloud.retail.v2beta.IUpdateProductRequest); - /** PredictResponse attributionToken. */ - public attributionToken: string; + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2beta.IProduct|null); - /** PredictResponse missingIds. */ - public missingIds: string[]; + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** PredictResponse validateOnly. */ - public validateOnly: boolean; + /** UpdateProductRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new UpdateProductRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PredictResponse instance + * @returns UpdateProductRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IPredictResponse): google.cloud.retail.v2beta.PredictResponse; + public static create(properties?: google.cloud.retail.v2beta.IUpdateProductRequest): google.cloud.retail.v2beta.UpdateProductRequest; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes an UpdateProductRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictResponse + * @returns UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateProductRequest; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictResponse + * @returns UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateProductRequest; /** - * Verifies a PredictResponse message. + * Verifies an UpdateProductRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictResponse + * @returns UpdateProductRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateProductRequest; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. - * @param message PredictResponse + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictResponse to JSON. + * Converts this UpdateProductRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace PredictResponse { - - /** Properties of a PredictionResult. */ - interface IPredictionResult { - - /** PredictionResult id */ - id?: (string|null); - - /** PredictionResult metadata */ - metadata?: ({ [k: string]: google.protobuf.IValue }|null); - } - - /** Represents a PredictionResult. */ - class PredictionResult implements IPredictionResult { - - /** - * Constructs a new PredictionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult); - - /** PredictionResult id. */ - public id: string; - - /** PredictionResult metadata. */ - public metadata: { [k: string]: google.protobuf.IValue }; - - /** - * Creates a new PredictionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictionResult instance - */ - public static create(properties?: google.cloud.retail.v2beta.PredictResponse.IPredictionResult): google.cloud.retail.v2beta.PredictResponse.PredictionResult; - - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PredictResponse.PredictionResult; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PredictResponse.PredictionResult; - - /** - * Verifies a PredictionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PredictResponse.PredictionResult; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @param message PredictionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { - /** - * Converts this PredictionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** DeleteProductRequest name */ + name?: (string|null); } - /** Represents a ProductService */ - class ProductService extends $protobuf.rpc.Service { + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { /** - * Constructs a new ProductService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.retail.v2beta.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; /** - * Creates new ProductService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + public static create(properties?: google.cloud.retail.v2beta.IDeleteProductRequest): google.cloud.retail.v2beta.DeleteProductRequest; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest, callback: google.cloud.retail.v2beta.ProductService.CreateProductCallback): void; + public static encode(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public createProduct(request: google.cloud.retail.v2beta.ICreateProductRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest, callback: google.cloud.retail.v2beta.ProductService.GetProductCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteProductRequest; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getProduct(request: google.cloud.retail.v2beta.IGetProductRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteProductRequest; /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsResponse + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public listProducts(request: google.cloud.retail.v2beta.IListProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ListProductsCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @returns Promise + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest */ - public listProducts(request: google.cloud.retail.v2beta.IListProductsRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteProductRequest; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object */ - public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest, callback: google.cloud.retail.v2beta.ProductService.UpdateProductCallback): void; + public static toObject(message: google.cloud.retail.v2beta.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise + * Converts this DeleteProductRequest to JSON. + * @returns JSON object */ - public updateProduct(request: google.cloud.retail.v2beta.IUpdateProductRequest): Promise; + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProductsRequest. */ + interface IListProductsRequest { + + /** ListProductsRequest parent */ + parent?: (string|null); + + /** ListProductsRequest pageSize */ + pageSize?: (number|null); + + /** ListProductsRequest pageToken */ + pageToken?: (string|null); + + /** ListProductsRequest filter */ + filter?: (string|null); + + /** ListProductsRequest readMask */ + readMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a ListProductsRequest. */ + class ListProductsRequest implements IListProductsRequest { /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Constructs a new ListProductsRequest. + * @param [properties] Properties to set */ - public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest, callback: google.cloud.retail.v2beta.ProductService.DeleteProductCallback): void; + constructor(properties?: google.cloud.retail.v2beta.IListProductsRequest); + + /** ListProductsRequest parent. */ + public parent: string; + + /** ListProductsRequest pageSize. */ + public pageSize: number; + + /** ListProductsRequest pageToken. */ + public pageToken: string; + + /** ListProductsRequest filter. */ + public filter: string; + + /** ListProductsRequest readMask. */ + public readMask?: (google.protobuf.IFieldMask|null); /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise + * Creates a new ListProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProductsRequest instance */ - public deleteProduct(request: google.cloud.retail.v2beta.IDeleteProductRequest): Promise; + public static create(properties?: google.cloud.retail.v2beta.IListProductsRequest): google.cloud.retail.v2beta.ListProductsRequest; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest, callback: google.cloud.retail.v2beta.ProductService.ImportProductsCallback): void; + public static encode(message: google.cloud.retail.v2beta.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @returns Promise + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * @param message ListProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public importProducts(request: google.cloud.retail.v2beta.IImportProductsRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls SetInventory. - * @param request SetInventoryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Decodes a ListProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public setInventory(request: google.cloud.retail.v2beta.ISetInventoryRequest, callback: google.cloud.retail.v2beta.ProductService.SetInventoryCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListProductsRequest; /** - * Calls SetInventory. - * @param request SetInventoryRequest message or plain object - * @returns Promise + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public setInventory(request: google.cloud.retail.v2beta.ISetInventoryRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListProductsRequest; /** - * Calls AddFulfillmentPlaces. - * @param request AddFulfillmentPlacesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Verifies a ListProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public addFulfillmentPlaces(request: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2beta.ProductService.AddFulfillmentPlacesCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls AddFulfillmentPlaces. - * @param request AddFulfillmentPlacesRequest message or plain object - * @returns Promise + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProductsRequest */ - public addFulfillmentPlaces(request: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListProductsRequest; /** - * Calls RemoveFulfillmentPlaces. - * @param request RemoveFulfillmentPlacesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @param message ListProductsRequest + * @param [options] Conversion options + * @returns Plain object */ - public removeFulfillmentPlaces(request: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlacesCallback): void; + public static toObject(message: google.cloud.retail.v2beta.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls RemoveFulfillmentPlaces. - * @param request RemoveFulfillmentPlacesRequest message or plain object - * @returns Promise + * Converts this ListProductsRequest to JSON. + * @returns JSON object */ - public removeFulfillmentPlaces(request: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest): Promise; + public toJSON(): { [k: string]: any }; } - namespace ProductService { + /** Properties of a ListProductsResponse. */ + interface IListProductsResponse { + + /** ListProductsResponse products */ + products?: (google.cloud.retail.v2beta.IProduct[]|null); + + /** ListProductsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProductsResponse. */ + class ListProductsResponse implements IListProductsResponse { /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. - * @param error Error, if any - * @param [response] Product + * Constructs a new ListProductsResponse. + * @param [properties] Properties to set */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + constructor(properties?: google.cloud.retail.v2beta.IListProductsResponse); + + /** ListProductsResponse products. */ + public products: google.cloud.retail.v2beta.IProduct[]; + + /** ListProductsResponse nextPageToken. */ + public nextPageToken: string; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. - * @param error Error, if any - * @param [response] Product + * Creates a new ListProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProductsResponse instance */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + public static create(properties?: google.cloud.retail.v2beta.IListProductsResponse): google.cloud.retail.v2beta.ListProductsResponse; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. - * @param error Error, if any - * @param [response] ListProductsResponse + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListProductsResponse) => void; + public static encode(message: google.cloud.retail.v2beta.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. - * @param error Error, if any - * @param [response] Product + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * @param message ListProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. - * @param error Error, if any - * @param [response] Empty + * Decodes a ListProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListProductsResponse; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. - * @param error Error, if any - * @param [response] Operation + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListProductsResponse; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. - * @param error Error, if any - * @param [response] Operation + * Verifies a ListProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. - * @param error Error, if any - * @param [response] Operation + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListProductsResponse; + + /** + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @param message ListProductsResponse + * @param [options] Conversion options + * @returns Plain object */ - type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.retail.v2beta.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. - * @param error Error, if any - * @param [response] Operation + * Converts this ListProductsResponse to JSON. + * @returns JSON object */ - type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { + /** Properties of a SetInventoryRequest. */ + interface ISetInventoryRequest { - /** CreateProductRequest parent */ - parent?: (string|null); + /** SetInventoryRequest inventory */ + inventory?: (google.cloud.retail.v2beta.IProduct|null); - /** CreateProductRequest product */ - product?: (google.cloud.retail.v2beta.IProduct|null); + /** SetInventoryRequest setMask */ + setMask?: (google.protobuf.IFieldMask|null); - /** CreateProductRequest productId */ - productId?: (string|null); + /** SetInventoryRequest setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { + /** Represents a SetInventoryRequest. */ + class SetInventoryRequest implements ISetInventoryRequest { /** - * Constructs a new CreateProductRequest. + * Constructs a new SetInventoryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ICreateProductRequest); + constructor(properties?: google.cloud.retail.v2beta.ISetInventoryRequest); - /** CreateProductRequest parent. */ - public parent: string; + /** SetInventoryRequest inventory. */ + public inventory?: (google.cloud.retail.v2beta.IProduct|null); - /** CreateProductRequest product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); + /** SetInventoryRequest setMask. */ + public setMask?: (google.protobuf.IFieldMask|null); - /** CreateProductRequest productId. */ - public productId: string; + /** SetInventoryRequest setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** SetInventoryRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new SetInventoryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CreateProductRequest instance + * @returns SetInventoryRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.ICreateProductRequest): google.cloud.retail.v2beta.CreateProductRequest; + public static create(properties?: google.cloud.retail.v2beta.ISetInventoryRequest): google.cloud.retail.v2beta.SetInventoryRequest; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * @param message SetInventoryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateProductRequest + * @returns SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryRequest; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateProductRequest + * @returns SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryRequest; /** - * Verifies a CreateProductRequest message. + * Verifies a SetInventoryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateProductRequest + * @returns SetInventoryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryRequest; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @param message SetInventoryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateProductRequest to JSON. + * Converts this SetInventoryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { - - /** GetProductRequest name */ - name?: (string|null); + /** Properties of a SetInventoryMetadata. */ + interface ISetInventoryMetadata { } - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { + /** Represents a SetInventoryMetadata. */ + class SetInventoryMetadata implements ISetInventoryMetadata { /** - * Constructs a new GetProductRequest. + * Constructs a new SetInventoryMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IGetProductRequest); - - /** GetProductRequest name. */ - public name: string; + constructor(properties?: google.cloud.retail.v2beta.ISetInventoryMetadata); /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns GetProductRequest instance + * @returns SetInventoryMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.IGetProductRequest): google.cloud.retail.v2beta.GetProductRequest; + public static create(properties?: google.cloud.retail.v2beta.ISetInventoryMetadata): google.cloud.retail.v2beta.SetInventoryMetadata; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * @param message SetInventoryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetProductRequest + * @returns SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryMetadata; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetProductRequest + * @returns SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryMetadata; /** - * Verifies a GetProductRequest message. + * Verifies a SetInventoryMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetProductRequest + * @returns SetInventoryMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryMetadata; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @param message SetInventoryMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetProductRequest to JSON. + * Converts this SetInventoryMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { - - /** UpdateProductRequest product */ - product?: (google.cloud.retail.v2beta.IProduct|null); - - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - - /** UpdateProductRequest allowMissing */ - allowMissing?: (boolean|null); + /** Properties of a SetInventoryResponse. */ + interface ISetInventoryResponse { } - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { + /** Represents a SetInventoryResponse. */ + class SetInventoryResponse implements ISetInventoryResponse { /** - * Constructs a new UpdateProductRequest. + * Constructs a new SetInventoryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IUpdateProductRequest); - - /** UpdateProductRequest product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); - - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** UpdateProductRequest allowMissing. */ - public allowMissing: boolean; + constructor(properties?: google.cloud.retail.v2beta.ISetInventoryResponse); /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateProductRequest instance + * @returns SetInventoryResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IUpdateProductRequest): google.cloud.retail.v2beta.UpdateProductRequest; + public static create(properties?: google.cloud.retail.v2beta.ISetInventoryResponse): google.cloud.retail.v2beta.SetInventoryResponse; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * @param message SetInventoryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateProductRequest + * @returns SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryResponse; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest + * @returns SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryResponse; /** - * Verifies an UpdateProductRequest message. + * Verifies a SetInventoryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateProductRequest + * @returns SetInventoryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryResponse; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @param message SetInventoryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this SetInventoryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { + /** Properties of an AddFulfillmentPlacesRequest. */ + interface IAddFulfillmentPlacesRequest { + + /** AddFulfillmentPlacesRequest product */ + product?: (string|null); + + /** AddFulfillmentPlacesRequest type */ + type?: (string|null); + + /** AddFulfillmentPlacesRequest placeIds */ + placeIds?: (string[]|null); + + /** AddFulfillmentPlacesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); - /** DeleteProductRequest name */ - name?: (string|null); + /** AddFulfillmentPlacesRequest allowMissing */ + allowMissing?: (boolean|null); } - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { + /** Represents an AddFulfillmentPlacesRequest. */ + class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { /** - * Constructs a new DeleteProductRequest. + * Constructs a new AddFulfillmentPlacesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IDeleteProductRequest); + constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest); - /** DeleteProductRequest name. */ - public name: string; + /** AddFulfillmentPlacesRequest product. */ + public product: string; + + /** AddFulfillmentPlacesRequest type. */ + public type: string; + + /** AddFulfillmentPlacesRequest placeIds. */ + public placeIds: string[]; + + /** AddFulfillmentPlacesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddFulfillmentPlacesRequest allowMissing. */ + public allowMissing: boolean; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteProductRequest instance + * @returns AddFulfillmentPlacesRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IDeleteProductRequest): google.cloud.retail.v2beta.DeleteProductRequest; + public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * @param message AddFulfillmentPlacesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteProductRequest + * @returns AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest + * @returns AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; /** - * Verifies a DeleteProductRequest message. + * Verifies an AddFulfillmentPlacesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteProductRequest + * @returns AddFulfillmentPlacesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListProductsRequest. */ - interface IListProductsRequest { - - /** ListProductsRequest parent */ - parent?: (string|null); - - /** ListProductsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsRequest pageToken */ - pageToken?: (string|null); - - /** ListProductsRequest filter */ - filter?: (string|null); - - /** ListProductsRequest readMask */ - readMask?: (google.protobuf.IFieldMask|null); + /** Properties of an AddFulfillmentPlacesMetadata. */ + interface IAddFulfillmentPlacesMetadata { } - /** Represents a ListProductsRequest. */ - class ListProductsRequest implements IListProductsRequest { + /** Represents an AddFulfillmentPlacesMetadata. */ + class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { /** - * Constructs a new ListProductsRequest. + * Constructs a new AddFulfillmentPlacesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IListProductsRequest); - - /** ListProductsRequest parent. */ - public parent: string; - - /** ListProductsRequest pageSize. */ - public pageSize: number; - - /** ListProductsRequest pageToken. */ - public pageToken: string; - - /** ListProductsRequest filter. */ - public filter: string; - - /** ListProductsRequest readMask. */ - public readMask?: (google.protobuf.IFieldMask|null); + constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata); /** - * Creates a new ListProductsRequest instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ListProductsRequest instance + * @returns AddFulfillmentPlacesMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.IListProductsRequest): google.cloud.retail.v2beta.ListProductsRequest; + public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @param message AddFulfillmentPlacesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListProductsRequest message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListProductsRequest + * @returns AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListProductsRequest + * @returns AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; /** - * Verifies a ListProductsRequest message. + * Verifies an AddFulfillmentPlacesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListProductsRequest + * @returns AddFulfillmentPlacesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @param message ListProductsRequest + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListProductsRequest to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListProductsResponse. */ - interface IListProductsResponse { - - /** ListProductsResponse products */ - products?: (google.cloud.retail.v2beta.IProduct[]|null); - - /** ListProductsResponse nextPageToken */ - nextPageToken?: (string|null); + /** Properties of an AddFulfillmentPlacesResponse. */ + interface IAddFulfillmentPlacesResponse { } - /** Represents a ListProductsResponse. */ - class ListProductsResponse implements IListProductsResponse { + /** Represents an AddFulfillmentPlacesResponse. */ + class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { /** - * Constructs a new ListProductsResponse. + * Constructs a new AddFulfillmentPlacesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IListProductsResponse); - - /** ListProductsResponse products. */ - public products: google.cloud.retail.v2beta.IProduct[]; - - /** ListProductsResponse nextPageToken. */ - public nextPageToken: string; + constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse); /** - * Creates a new ListProductsResponse instance using the specified properties. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ListProductsResponse instance + * @returns AddFulfillmentPlacesResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IListProductsResponse): google.cloud.retail.v2beta.ListProductsResponse; + public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * @param message AddFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListProductsResponse message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListProductsResponse + * @returns AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListProductsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListProductsResponse + * @returns AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListProductsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; /** - * Verifies a ListProductsResponse message. + * Verifies an AddFulfillmentPlacesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListProductsResponse + * @returns AddFulfillmentPlacesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListProductsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @param message ListProductsResponse + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message AddFulfillmentPlacesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListProductsResponse to JSON. + * Converts this AddFulfillmentPlacesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetInventoryRequest. */ - interface ISetInventoryRequest { + /** Properties of an AddLocalInventoriesRequest. */ + interface IAddLocalInventoriesRequest { - /** SetInventoryRequest inventory */ - inventory?: (google.cloud.retail.v2beta.IProduct|null); + /** AddLocalInventoriesRequest product */ + product?: (string|null); - /** SetInventoryRequest setMask */ - setMask?: (google.protobuf.IFieldMask|null); + /** AddLocalInventoriesRequest localInventories */ + localInventories?: (google.cloud.retail.v2beta.ILocalInventory[]|null); - /** SetInventoryRequest setTime */ - setTime?: (google.protobuf.ITimestamp|null); + /** AddLocalInventoriesRequest addMask */ + addMask?: (google.protobuf.IFieldMask|null); - /** SetInventoryRequest allowMissing */ + /** AddLocalInventoriesRequest addTime */ + addTime?: (google.protobuf.ITimestamp|null); + + /** AddLocalInventoriesRequest allowMissing */ allowMissing?: (boolean|null); } - /** Represents a SetInventoryRequest. */ - class SetInventoryRequest implements ISetInventoryRequest { + /** Represents an AddLocalInventoriesRequest. */ + class AddLocalInventoriesRequest implements IAddLocalInventoriesRequest { /** - * Constructs a new SetInventoryRequest. + * Constructs a new AddLocalInventoriesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ISetInventoryRequest); + constructor(properties?: google.cloud.retail.v2beta.IAddLocalInventoriesRequest); - /** SetInventoryRequest inventory. */ - public inventory?: (google.cloud.retail.v2beta.IProduct|null); + /** AddLocalInventoriesRequest product. */ + public product: string; - /** SetInventoryRequest setMask. */ - public setMask?: (google.protobuf.IFieldMask|null); + /** AddLocalInventoriesRequest localInventories. */ + public localInventories: google.cloud.retail.v2beta.ILocalInventory[]; - /** SetInventoryRequest setTime. */ - public setTime?: (google.protobuf.ITimestamp|null); + /** AddLocalInventoriesRequest addMask. */ + public addMask?: (google.protobuf.IFieldMask|null); - /** SetInventoryRequest allowMissing. */ + /** AddLocalInventoriesRequest addTime. */ + public addTime?: (google.protobuf.ITimestamp|null); + + /** AddLocalInventoriesRequest allowMissing. */ public allowMissing: boolean; /** - * Creates a new SetInventoryRequest instance using the specified properties. + * Creates a new AddLocalInventoriesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns SetInventoryRequest instance + * @returns AddLocalInventoriesRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.ISetInventoryRequest): google.cloud.retail.v2beta.SetInventoryRequest; + public static create(properties?: google.cloud.retail.v2beta.IAddLocalInventoriesRequest): google.cloud.retail.v2beta.AddLocalInventoriesRequest; /** - * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. - * @param message SetInventoryRequest message or plain object to encode + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. - * @param message SetInventoryRequest message or plain object to encode + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesRequest.verify|verify} messages. + * @param message AddLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetInventoryRequest + * @returns AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddLocalInventoriesRequest; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetInventoryRequest + * @returns AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddLocalInventoriesRequest; /** - * Verifies a SetInventoryRequest message. + * Verifies an AddLocalInventoriesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetInventoryRequest + * @returns AddLocalInventoriesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddLocalInventoriesRequest; /** - * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. - * @param message SetInventoryRequest + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message AddLocalInventoriesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.SetInventoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetInventoryRequest to JSON. + * Converts this AddLocalInventoriesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetInventoryMetadata. */ - interface ISetInventoryMetadata { + /** Properties of an AddLocalInventoriesMetadata. */ + interface IAddLocalInventoriesMetadata { } - /** Represents a SetInventoryMetadata. */ - class SetInventoryMetadata implements ISetInventoryMetadata { + /** Represents an AddLocalInventoriesMetadata. */ + class AddLocalInventoriesMetadata implements IAddLocalInventoriesMetadata { /** - * Constructs a new SetInventoryMetadata. + * Constructs a new AddLocalInventoriesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ISetInventoryMetadata); + constructor(properties?: google.cloud.retail.v2beta.IAddLocalInventoriesMetadata); /** - * Creates a new SetInventoryMetadata instance using the specified properties. + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns SetInventoryMetadata instance + * @returns AddLocalInventoriesMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.ISetInventoryMetadata): google.cloud.retail.v2beta.SetInventoryMetadata; + public static create(properties?: google.cloud.retail.v2beta.IAddLocalInventoriesMetadata): google.cloud.retail.v2beta.AddLocalInventoriesMetadata; /** - * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. - * @param message SetInventoryMetadata message or plain object to encode + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. - * @param message SetInventoryMetadata message or plain object to encode + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesMetadata.verify|verify} messages. + * @param message AddLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetInventoryMetadata + * @returns AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddLocalInventoriesMetadata; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetInventoryMetadata + * @returns AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddLocalInventoriesMetadata; /** - * Verifies a SetInventoryMetadata message. + * Verifies an AddLocalInventoriesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetInventoryMetadata + * @returns AddLocalInventoriesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddLocalInventoriesMetadata; /** - * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. - * @param message SetInventoryMetadata + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message AddLocalInventoriesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.SetInventoryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetInventoryMetadata to JSON. + * Converts this AddLocalInventoriesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SetInventoryResponse. */ - interface ISetInventoryResponse { + /** Properties of an AddLocalInventoriesResponse. */ + interface IAddLocalInventoriesResponse { } - /** Represents a SetInventoryResponse. */ - class SetInventoryResponse implements ISetInventoryResponse { + /** Represents an AddLocalInventoriesResponse. */ + class AddLocalInventoriesResponse implements IAddLocalInventoriesResponse { /** - * Constructs a new SetInventoryResponse. + * Constructs a new AddLocalInventoriesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.ISetInventoryResponse); + constructor(properties?: google.cloud.retail.v2beta.IAddLocalInventoriesResponse); /** - * Creates a new SetInventoryResponse instance using the specified properties. + * Creates a new AddLocalInventoriesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns SetInventoryResponse instance + * @returns AddLocalInventoriesResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.ISetInventoryResponse): google.cloud.retail.v2beta.SetInventoryResponse; + public static create(properties?: google.cloud.retail.v2beta.IAddLocalInventoriesResponse): google.cloud.retail.v2beta.AddLocalInventoriesResponse; /** - * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. - * @param message SetInventoryResponse message or plain object to encode + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. - * @param message SetInventoryResponse message or plain object to encode + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesResponse.verify|verify} messages. + * @param message AddLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ISetInventoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SetInventoryResponse + * @returns AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SetInventoryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddLocalInventoriesResponse; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SetInventoryResponse + * @returns AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SetInventoryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddLocalInventoriesResponse; /** - * Verifies a SetInventoryResponse message. + * Verifies an AddLocalInventoriesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SetInventoryResponse + * @returns AddLocalInventoriesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SetInventoryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddLocalInventoriesResponse; /** - * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. - * @param message SetInventoryResponse + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message AddLocalInventoriesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.SetInventoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.AddLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SetInventoryResponse to JSON. + * Converts this AddLocalInventoriesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AddFulfillmentPlacesRequest. */ - interface IAddFulfillmentPlacesRequest { + /** Properties of a RemoveLocalInventoriesRequest. */ + interface IRemoveLocalInventoriesRequest { - /** AddFulfillmentPlacesRequest product */ + /** RemoveLocalInventoriesRequest product */ product?: (string|null); - /** AddFulfillmentPlacesRequest type */ - type?: (string|null); - - /** AddFulfillmentPlacesRequest placeIds */ + /** RemoveLocalInventoriesRequest placeIds */ placeIds?: (string[]|null); - /** AddFulfillmentPlacesRequest addTime */ - addTime?: (google.protobuf.ITimestamp|null); + /** RemoveLocalInventoriesRequest removeTime */ + removeTime?: (google.protobuf.ITimestamp|null); - /** AddFulfillmentPlacesRequest allowMissing */ + /** RemoveLocalInventoriesRequest allowMissing */ allowMissing?: (boolean|null); } - /** Represents an AddFulfillmentPlacesRequest. */ - class AddFulfillmentPlacesRequest implements IAddFulfillmentPlacesRequest { + /** Represents a RemoveLocalInventoriesRequest. */ + class RemoveLocalInventoriesRequest implements IRemoveLocalInventoriesRequest { /** - * Constructs a new AddFulfillmentPlacesRequest. + * Constructs a new RemoveLocalInventoriesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest); + constructor(properties?: google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest); - /** AddFulfillmentPlacesRequest product. */ + /** RemoveLocalInventoriesRequest product. */ public product: string; - /** AddFulfillmentPlacesRequest type. */ - public type: string; - - /** AddFulfillmentPlacesRequest placeIds. */ + /** RemoveLocalInventoriesRequest placeIds. */ public placeIds: string[]; - /** AddFulfillmentPlacesRequest addTime. */ - public addTime?: (google.protobuf.ITimestamp|null); + /** RemoveLocalInventoriesRequest removeTime. */ + public removeTime?: (google.protobuf.ITimestamp|null); - /** AddFulfillmentPlacesRequest allowMissing. */ + /** RemoveLocalInventoriesRequest allowMissing. */ public allowMissing: boolean; /** - * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns AddFulfillmentPlacesRequest instance + * @returns RemoveLocalInventoriesRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + public static create(properties?: google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest): google.cloud.retail.v2beta.RemoveLocalInventoriesRequest; /** - * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. - * @param message AddFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. - * @param message AddFulfillmentPlacesRequest message or plain object to encode + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesRequest.verify|verify} messages. + * @param message RemoveLocalInventoriesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AddFulfillmentPlacesRequest + * @returns RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveLocalInventoriesRequest; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AddFulfillmentPlacesRequest + * @returns RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveLocalInventoriesRequest; /** - * Verifies an AddFulfillmentPlacesRequest message. + * Verifies a RemoveLocalInventoriesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AddFulfillmentPlacesRequest + * @returns RemoveLocalInventoriesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveLocalInventoriesRequest; /** - * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. - * @param message AddFulfillmentPlacesRequest + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.RemoveLocalInventoriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AddFulfillmentPlacesRequest to JSON. + * Converts this RemoveLocalInventoriesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AddFulfillmentPlacesMetadata. */ - interface IAddFulfillmentPlacesMetadata { + /** Properties of a RemoveLocalInventoriesMetadata. */ + interface IRemoveLocalInventoriesMetadata { } - /** Represents an AddFulfillmentPlacesMetadata. */ - class AddFulfillmentPlacesMetadata implements IAddFulfillmentPlacesMetadata { + /** Represents a RemoveLocalInventoriesMetadata. */ + class RemoveLocalInventoriesMetadata implements IRemoveLocalInventoriesMetadata { /** - * Constructs a new AddFulfillmentPlacesMetadata. + * Constructs a new RemoveLocalInventoriesMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata); + constructor(properties?: google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata); /** - * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns AddFulfillmentPlacesMetadata instance + * @returns RemoveLocalInventoriesMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + public static create(properties?: google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata): google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata; /** - * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. - * @param message AddFulfillmentPlacesMetadata message or plain object to encode + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. - * @param message AddFulfillmentPlacesMetadata message or plain object to encode + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @param message RemoveLocalInventoriesMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AddFulfillmentPlacesMetadata + * @returns RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AddFulfillmentPlacesMetadata + * @returns RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata; /** - * Verifies an AddFulfillmentPlacesMetadata message. + * Verifies a RemoveLocalInventoriesMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AddFulfillmentPlacesMetadata + * @returns RemoveLocalInventoriesMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata; /** - * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. - * @param message AddFulfillmentPlacesMetadata + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AddFulfillmentPlacesMetadata to JSON. + * Converts this RemoveLocalInventoriesMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AddFulfillmentPlacesResponse. */ - interface IAddFulfillmentPlacesResponse { + /** Properties of a RemoveLocalInventoriesResponse. */ + interface IRemoveLocalInventoriesResponse { } - /** Represents an AddFulfillmentPlacesResponse. */ - class AddFulfillmentPlacesResponse implements IAddFulfillmentPlacesResponse { + /** Represents a RemoveLocalInventoriesResponse. */ + class RemoveLocalInventoriesResponse implements IRemoveLocalInventoriesResponse { /** - * Constructs a new AddFulfillmentPlacesResponse. + * Constructs a new RemoveLocalInventoriesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse); + constructor(properties?: google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse); /** - * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns AddFulfillmentPlacesResponse instance + * @returns RemoveLocalInventoriesResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + public static create(properties?: google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse): google.cloud.retail.v2beta.RemoveLocalInventoriesResponse; /** - * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. - * @param message AddFulfillmentPlacesResponse message or plain object to encode + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. - * @param message AddFulfillmentPlacesResponse message or plain object to encode + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesResponse.verify|verify} messages. + * @param message RemoveLocalInventoriesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AddFulfillmentPlacesResponse + * @returns RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveLocalInventoriesResponse; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AddFulfillmentPlacesResponse + * @returns RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveLocalInventoriesResponse; /** - * Verifies an AddFulfillmentPlacesResponse message. + * Verifies a RemoveLocalInventoriesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AddFulfillmentPlacesResponse + * @returns RemoveLocalInventoriesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddFulfillmentPlacesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveLocalInventoriesResponse; /** - * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @param message AddFulfillmentPlacesResponse + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @param message RemoveLocalInventoriesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.AddFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.RemoveLocalInventoriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AddFulfillmentPlacesResponse to JSON. + * Converts this RemoveLocalInventoriesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -29765,1783 +35155,1468 @@ export namespace google { public static create(properties?: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @param message RemoveFulfillmentPlacesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @param message RemoveFulfillmentPlacesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; - - /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; - - /** - * Verifies a RemoveFulfillmentPlacesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveFulfillmentPlacesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; - - /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @param message RemoveFulfillmentPlacesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { - } - - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { - - /** - * Constructs a new PurgeMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IPurgeMetadata); - - /** - * Creates a new PurgeMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeMetadata instance - */ - public static create(properties?: google.cloud.retail.v2beta.IPurgeMetadata): google.cloud.retail.v2beta.PurgeMetadata; - - /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PurgeMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeMetadata; - - /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeMetadata; - - /** - * Verifies a PurgeMetadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeMetadata; - - /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PurgeMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { - - /** PurgeUserEventsRequest parent */ - parent?: (string|null); - - /** PurgeUserEventsRequest filter */ - filter?: (string|null); - - /** PurgeUserEventsRequest force */ - force?: (boolean|null); - } - - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { - - /** - * Constructs a new PurgeUserEventsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest); - - /** PurgeUserEventsRequest parent. */ - public parent: string; - - /** PurgeUserEventsRequest filter. */ - public filter: string; - - /** PurgeUserEventsRequest force. */ - public force: boolean; - - /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance - */ - public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest): google.cloud.retail.v2beta.PurgeUserEventsRequest; - - /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @param message RemoveFulfillmentPlacesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest + * @returns RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest + * @returns RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a RemoveFulfillmentPlacesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsRequest + * @returns RemoveFulfillmentPlacesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @param message RemoveFulfillmentPlacesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this RemoveFulfillmentPlacesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { - - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { } - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new PurgeMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse); - - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + constructor(properties?: google.cloud.retail.v2beta.IPurgeMetadata); /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new PurgeMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance + * @returns PurgeMetadata instance */ - public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse): google.cloud.retail.v2beta.PurgeUserEventsResponse; + public static create(properties?: google.cloud.retail.v2beta.IPurgeMetadata): google.cloud.retail.v2beta.PurgeMetadata; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a PurgeMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse + * @returns PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeMetadata; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse + * @returns PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeMetadata; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a PurgeMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeUserEventsResponse + * @returns PurgeMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeMetadata; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this PurgeMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a SearchService */ - class SearchService extends $protobuf.rpc.Service { - - /** - * Constructs a new SearchService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { - /** - * Creates new SearchService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + /** PurgeUserEventsRequest parent */ + parent?: (string|null); - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SearchResponse - */ - public search(request: google.cloud.retail.v2beta.ISearchRequest, callback: google.cloud.retail.v2beta.SearchService.SearchCallback): void; + /** PurgeUserEventsRequest filter */ + filter?: (string|null); - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @returns Promise - */ - public search(request: google.cloud.retail.v2beta.ISearchRequest): Promise; + /** PurgeUserEventsRequest force */ + force?: (boolean|null); } - namespace SearchService { + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { /** - * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. - * @param error Error, if any - * @param [response] SearchResponse + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set */ - type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.SearchResponse) => void; - } - - /** Properties of a SearchRequest. */ - interface ISearchRequest { - - /** SearchRequest placement */ - placement?: (string|null); - - /** SearchRequest branch */ - branch?: (string|null); - - /** SearchRequest query */ - query?: (string|null); - - /** SearchRequest visitorId */ - visitorId?: (string|null); - - /** SearchRequest userInfo */ - userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); - - /** SearchRequest pageSize */ - pageSize?: (number|null); - - /** SearchRequest pageToken */ - pageToken?: (string|null); - - /** SearchRequest offset */ - offset?: (number|null); - - /** SearchRequest filter */ - filter?: (string|null); - - /** SearchRequest canonicalFilter */ - canonicalFilter?: (string|null); - - /** SearchRequest orderBy */ - orderBy?: (string|null); - - /** SearchRequest facetSpecs */ - facetSpecs?: (google.cloud.retail.v2beta.SearchRequest.IFacetSpec[]|null); - - /** SearchRequest dynamicFacetSpec */ - dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); - - /** SearchRequest boostSpec */ - boostSpec?: (google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null); - - /** SearchRequest queryExpansionSpec */ - queryExpansionSpec?: (google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null); - - /** SearchRequest variantRollupKeys */ - variantRollupKeys?: (string[]|null); + constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest); - /** SearchRequest pageCategories */ - pageCategories?: (string[]|null); + /** PurgeUserEventsRequest parent. */ + public parent: string; - /** SearchRequest searchMode */ - searchMode?: (google.cloud.retail.v2beta.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SearchMode|null); - } + /** PurgeUserEventsRequest filter. */ + public filter: string; - /** Represents a SearchRequest. */ - class SearchRequest implements ISearchRequest { + /** PurgeUserEventsRequest force. */ + public force: boolean; /** - * Constructs a new SearchRequest. + * Creates a new PurgeUserEventsRequest instance using the specified properties. * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance */ - constructor(properties?: google.cloud.retail.v2beta.ISearchRequest); - - /** SearchRequest placement. */ - public placement: string; - - /** SearchRequest branch. */ - public branch: string; - - /** SearchRequest query. */ - public query: string; - - /** SearchRequest visitorId. */ - public visitorId: string; - - /** SearchRequest userInfo. */ - public userInfo?: (google.cloud.retail.v2beta.IUserInfo|null); - - /** SearchRequest pageSize. */ - public pageSize: number; + public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsRequest): google.cloud.retail.v2beta.PurgeUserEventsRequest; - /** SearchRequest pageToken. */ - public pageToken: string; + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchRequest offset. */ - public offset: number; + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchRequest filter. */ - public filter: string; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsRequest; - /** SearchRequest canonicalFilter. */ - public canonicalFilter: string; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsRequest; - /** SearchRequest orderBy. */ - public orderBy: string; + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchRequest facetSpecs. */ - public facetSpecs: google.cloud.retail.v2beta.SearchRequest.IFacetSpec[]; + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsRequest; - /** SearchRequest dynamicFacetSpec. */ - public dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchRequest boostSpec. */ - public boostSpec?: (google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null); + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** SearchRequest queryExpansionSpec. */ - public queryExpansionSpec?: (google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null); + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { - /** SearchRequest variantRollupKeys. */ - public variantRollupKeys: string[]; + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } - /** SearchRequest pageCategories. */ - public pageCategories: string[]; + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { - /** SearchRequest searchMode. */ - public searchMode: (google.cloud.retail.v2beta.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SearchMode); + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new PurgeUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns SearchRequest instance + * @returns PurgeUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2beta.ISearchRequest): google.cloud.retail.v2beta.SearchRequest; + public static create(properties?: google.cloud.retail.v2beta.IPurgeUserEventsResponse): google.cloud.retail.v2beta.PurgeUserEventsResponse; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PurgeUserEventsResponse; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PurgeUserEventsResponse; /** - * Verifies a SearchRequest message. + * Verifies a PurgeUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchRequest + * @returns PurgeUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PurgeUserEventsResponse; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. - * @param message SearchRequest + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchRequest to JSON. + * Converts this PurgeUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchRequest { + /** Properties of a ServingConfig. */ + interface IServingConfig { - /** Properties of a FacetSpec. */ - interface IFacetSpec { + /** ServingConfig name */ + name?: (string|null); - /** FacetSpec facetKey */ - facetKey?: (google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null); + /** ServingConfig displayName */ + displayName?: (string|null); - /** FacetSpec limit */ - limit?: (number|null); + /** ServingConfig modelId */ + modelId?: (string|null); - /** FacetSpec excludedFilterKeys */ - excludedFilterKeys?: (string[]|null); + /** ServingConfig priceRerankingLevel */ + priceRerankingLevel?: (string|null); - /** FacetSpec enableDynamicPosition */ - enableDynamicPosition?: (boolean|null); - } + /** ServingConfig facetControlIds */ + facetControlIds?: (string[]|null); - /** Represents a FacetSpec. */ - class FacetSpec implements IFacetSpec { + /** ServingConfig dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); - /** - * Constructs a new FacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IFacetSpec); + /** ServingConfig boostControlIds */ + boostControlIds?: (string[]|null); - /** FacetSpec facetKey. */ - public facetKey?: (google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null); + /** ServingConfig filterControlIds */ + filterControlIds?: (string[]|null); - /** FacetSpec limit. */ - public limit: number; + /** ServingConfig redirectControlIds */ + redirectControlIds?: (string[]|null); - /** FacetSpec excludedFilterKeys. */ - public excludedFilterKeys: string[]; + /** ServingConfig twowaySynonymsControlIds */ + twowaySynonymsControlIds?: (string[]|null); - /** FacetSpec enableDynamicPosition. */ - public enableDynamicPosition: boolean; + /** ServingConfig onewaySynonymsControlIds */ + onewaySynonymsControlIds?: (string[]|null); - /** - * Creates a new FacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetSpec instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IFacetSpec): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + /** ServingConfig doNotAssociateControlIds */ + doNotAssociateControlIds?: (string[]|null); - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** ServingConfig replacementControlIds */ + replacementControlIds?: (string[]|null); - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** ServingConfig ignoreControlIds */ + ignoreControlIds?: (string[]|null); - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + /** ServingConfig diversityLevel */ + diversityLevel?: (string|null); - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + /** ServingConfig enableCategoryFilterLevel */ + enableCategoryFilterLevel?: (string|null); - /** - * Verifies a FacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** ServingConfig solutionTypes */ + solutionTypes?: (google.cloud.retail.v2beta.SolutionType[]|null); + } - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.FacetSpec; + /** Represents a ServingConfig. */ + class ServingConfig implements IServingConfig { - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @param message FacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Constructs a new ServingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IServingConfig); - /** - * Converts this FacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** ServingConfig name. */ + public name: string; - namespace FacetSpec { + /** ServingConfig displayName. */ + public displayName: string; - /** Properties of a FacetKey. */ - interface IFacetKey { + /** ServingConfig modelId. */ + public modelId: string; - /** FacetKey key */ - key?: (string|null); + /** ServingConfig priceRerankingLevel. */ + public priceRerankingLevel: string; - /** FacetKey intervals */ - intervals?: (google.cloud.retail.v2beta.IInterval[]|null); + /** ServingConfig facetControlIds. */ + public facetControlIds: string[]; - /** FacetKey restrictedValues */ - restrictedValues?: (string[]|null); + /** ServingConfig dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null); - /** FacetKey prefixes */ - prefixes?: (string[]|null); + /** ServingConfig boostControlIds. */ + public boostControlIds: string[]; - /** FacetKey contains */ - contains?: (string[]|null); + /** ServingConfig filterControlIds. */ + public filterControlIds: string[]; - /** FacetKey orderBy */ - orderBy?: (string|null); + /** ServingConfig redirectControlIds. */ + public redirectControlIds: string[]; - /** FacetKey query */ - query?: (string|null); - } + /** ServingConfig twowaySynonymsControlIds. */ + public twowaySynonymsControlIds: string[]; - /** Represents a FacetKey. */ - class FacetKey implements IFacetKey { + /** ServingConfig onewaySynonymsControlIds. */ + public onewaySynonymsControlIds: string[]; - /** - * Constructs a new FacetKey. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey); + /** ServingConfig doNotAssociateControlIds. */ + public doNotAssociateControlIds: string[]; - /** FacetKey key. */ - public key: string; + /** ServingConfig replacementControlIds. */ + public replacementControlIds: string[]; - /** FacetKey intervals. */ - public intervals: google.cloud.retail.v2beta.IInterval[]; + /** ServingConfig ignoreControlIds. */ + public ignoreControlIds: string[]; + + /** ServingConfig diversityLevel. */ + public diversityLevel: string; + + /** ServingConfig enableCategoryFilterLevel. */ + public enableCategoryFilterLevel: string; + + /** ServingConfig solutionTypes. */ + public solutionTypes: google.cloud.retail.v2beta.SolutionType[]; + + /** + * Creates a new ServingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServingConfig instance + */ + public static create(properties?: google.cloud.retail.v2beta.IServingConfig): google.cloud.retail.v2beta.ServingConfig; - /** FacetKey restrictedValues. */ - public restrictedValues: string[]; + /** + * Encodes the specified ServingConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ServingConfig.verify|verify} messages. + * @param message ServingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IServingConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** FacetKey prefixes. */ - public prefixes: string[]; + /** + * Encodes the specified ServingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ServingConfig.verify|verify} messages. + * @param message ServingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IServingConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** FacetKey contains. */ - public contains: string[]; + /** + * Decodes a ServingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ServingConfig; - /** FacetKey orderBy. */ - public orderBy: string; + /** + * Decodes a ServingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ServingConfig; - /** FacetKey query. */ - public query: string; + /** + * Verifies a ServingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a new FacetKey instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetKey instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + /** + * Creates a ServingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ServingConfig; - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a plain object from a ServingConfig message. Also converts values to other types if specified. + * @param message ServingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ServingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Converts this ServingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + /** Represents a ServingConfigService */ + class ServingConfigService extends $protobuf.rpc.Service { - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + /** + * Constructs a new ServingConfigService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** - * Verifies a FacetKey message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates new ServingConfigService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ServingConfigService; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetKey - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey; + /** + * Calls CreateServingConfig. + * @param request CreateServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public createServingConfig(request: google.cloud.retail.v2beta.ICreateServingConfigRequest, callback: google.cloud.retail.v2beta.ServingConfigService.CreateServingConfigCallback): void; - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @param message FacetKey - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Calls CreateServingConfig. + * @param request CreateServingConfigRequest message or plain object + * @returns Promise + */ + public createServingConfig(request: google.cloud.retail.v2beta.ICreateServingConfigRequest): Promise; - /** - * Converts this FacetKey to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Calls DeleteServingConfig. + * @param request DeleteServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteServingConfig(request: google.cloud.retail.v2beta.IDeleteServingConfigRequest, callback: google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfigCallback): void; - /** Properties of a DynamicFacetSpec. */ - interface IDynamicFacetSpec { + /** + * Calls DeleteServingConfig. + * @param request DeleteServingConfigRequest message or plain object + * @returns Promise + */ + public deleteServingConfig(request: google.cloud.retail.v2beta.IDeleteServingConfigRequest): Promise; - /** DynamicFacetSpec mode */ - mode?: (google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|null); - } + /** + * Calls UpdateServingConfig. + * @param request UpdateServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public updateServingConfig(request: google.cloud.retail.v2beta.IUpdateServingConfigRequest, callback: google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfigCallback): void; - /** Represents a DynamicFacetSpec. */ - class DynamicFacetSpec implements IDynamicFacetSpec { + /** + * Calls UpdateServingConfig. + * @param request UpdateServingConfigRequest message or plain object + * @returns Promise + */ + public updateServingConfig(request: google.cloud.retail.v2beta.IUpdateServingConfigRequest): Promise; - /** - * Constructs a new DynamicFacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec); + /** + * Calls GetServingConfig. + * @param request GetServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public getServingConfig(request: google.cloud.retail.v2beta.IGetServingConfigRequest, callback: google.cloud.retail.v2beta.ServingConfigService.GetServingConfigCallback): void; - /** DynamicFacetSpec mode. */ - public mode: (google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode); + /** + * Calls GetServingConfig. + * @param request GetServingConfigRequest message or plain object + * @returns Promise + */ + public getServingConfig(request: google.cloud.retail.v2beta.IGetServingConfigRequest): Promise; - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns DynamicFacetSpec instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + /** + * Calls ListServingConfigs. + * @param request ListServingConfigsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListServingConfigsResponse + */ + public listServingConfigs(request: google.cloud.retail.v2beta.IListServingConfigsRequest, callback: google.cloud.retail.v2beta.ServingConfigService.ListServingConfigsCallback): void; - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Calls ListServingConfigs. + * @param request ListServingConfigsRequest message or plain object + * @returns Promise + */ + public listServingConfigs(request: google.cloud.retail.v2beta.IListServingConfigsRequest): Promise; - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Calls AddControl. + * @param request AddControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public addControl(request: google.cloud.retail.v2beta.IAddControlRequest, callback: google.cloud.retail.v2beta.ServingConfigService.AddControlCallback): void; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + /** + * Calls AddControl. + * @param request AddControlRequest message or plain object + * @returns Promise + */ + public addControl(request: google.cloud.retail.v2beta.IAddControlRequest): Promise; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + /** + * Calls RemoveControl. + * @param request RemoveControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public removeControl(request: google.cloud.retail.v2beta.IRemoveControlRequest, callback: google.cloud.retail.v2beta.ServingConfigService.RemoveControlCallback): void; - /** - * Verifies a DynamicFacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Calls RemoveControl. + * @param request RemoveControlRequest message or plain object + * @returns Promise + */ + public removeControl(request: google.cloud.retail.v2beta.IRemoveControlRequest): Promise; + } - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DynamicFacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec; + namespace ServingConfigService { - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @param message DynamicFacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#createServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type CreateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; - /** - * Converts this DynamicFacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#deleteServingConfig}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteServingConfigCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - namespace DynamicFacetSpec { + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#updateServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type UpdateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - DISABLED = 1, - ENABLED = 2 - } - } + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#getServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type GetServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; - /** Properties of a BoostSpec. */ - interface IBoostSpec { + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#listServingConfigs}. + * @param error Error, if any + * @param [response] ListServingConfigsResponse + */ + type ListServingConfigsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListServingConfigsResponse) => void; - /** BoostSpec conditionBoostSpecs */ - conditionBoostSpecs?: (google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); - } + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#addControl}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type AddControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; - /** Represents a BoostSpec. */ - class BoostSpec implements IBoostSpec { + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#removeControl}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type RemoveControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; + } - /** - * Constructs a new BoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IBoostSpec); + /** Properties of a CreateServingConfigRequest. */ + interface ICreateServingConfigRequest { - /** BoostSpec conditionBoostSpecs. */ - public conditionBoostSpecs: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec[]; + /** CreateServingConfigRequest parent */ + parent?: (string|null); - /** - * Creates a new BoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns BoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IBoostSpec): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + /** CreateServingConfigRequest servingConfig */ + servingConfig?: (google.cloud.retail.v2beta.IServingConfig|null); - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** CreateServingConfigRequest servingConfigId */ + servingConfigId?: (string|null); + } - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a CreateServingConfigRequest. */ + class CreateServingConfigRequest implements ICreateServingConfigRequest { - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + /** + * Constructs a new CreateServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICreateServingConfigRequest); - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + /** CreateServingConfigRequest parent. */ + public parent: string; - /** - * Verifies a BoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** CreateServingConfigRequest servingConfig. */ + public servingConfig?: (google.cloud.retail.v2beta.IServingConfig|null); - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.BoostSpec; + /** CreateServingConfigRequest servingConfigId. */ + public servingConfigId: string; - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @param message BoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a new CreateServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICreateServingConfigRequest): google.cloud.retail.v2beta.CreateServingConfigRequest; - /** - * Converts this BoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified CreateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateServingConfigRequest.verify|verify} messages. + * @param message CreateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICreateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - namespace BoostSpec { + /** + * Encodes the specified CreateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateServingConfigRequest.verify|verify} messages. + * @param message CreateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a ConditionBoostSpec. */ - interface IConditionBoostSpec { + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateServingConfigRequest; - /** ConditionBoostSpec condition */ - condition?: (string|null); + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateServingConfigRequest; - /** ConditionBoostSpec boost */ - boost?: (number|null); - } + /** + * Verifies a CreateServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Represents a ConditionBoostSpec. */ - class ConditionBoostSpec implements IConditionBoostSpec { + /** + * Creates a CreateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateServingConfigRequest; - /** - * Constructs a new ConditionBoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec); + /** + * Creates a plain object from a CreateServingConfigRequest message. Also converts values to other types if specified. + * @param message CreateServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CreateServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** ConditionBoostSpec condition. */ - public condition: string; + /** + * Converts this CreateServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** ConditionBoostSpec boost. */ - public boost: number; + /** Properties of an UpdateServingConfigRequest. */ + interface IUpdateServingConfigRequest { - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns ConditionBoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + /** UpdateServingConfigRequest servingConfig */ + servingConfig?: (google.cloud.retail.v2beta.IServingConfig|null); - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** UpdateServingConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents an UpdateServingConfigRequest. */ + class UpdateServingConfigRequest implements IUpdateServingConfigRequest { - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + /** + * Constructs a new UpdateServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUpdateServingConfigRequest); - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + /** UpdateServingConfigRequest servingConfig. */ + public servingConfig?: (google.cloud.retail.v2beta.IServingConfig|null); - /** - * Verifies a ConditionBoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** UpdateServingConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConditionBoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec; + /** + * Creates a new UpdateServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUpdateServingConfigRequest): google.cloud.retail.v2beta.UpdateServingConfigRequest; - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @param message ConditionBoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified UpdateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateServingConfigRequest.verify|verify} messages. + * @param message UpdateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUpdateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this ConditionBoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Encodes the specified UpdateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateServingConfigRequest.verify|verify} messages. + * @param message UpdateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a QueryExpansionSpec. */ - interface IQueryExpansionSpec { + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateServingConfigRequest; - /** QueryExpansionSpec condition */ - condition?: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null); + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateServingConfigRequest; + + /** + * Verifies an UpdateServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateServingConfigRequest; - /** QueryExpansionSpec pinUnexpandedResults */ - pinUnexpandedResults?: (boolean|null); - } + /** + * Creates a plain object from an UpdateServingConfigRequest message. Also converts values to other types if specified. + * @param message UpdateServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UpdateServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Represents a QueryExpansionSpec. */ - class QueryExpansionSpec implements IQueryExpansionSpec { + /** + * Converts this UpdateServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Constructs a new QueryExpansionSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec); + /** Properties of a DeleteServingConfigRequest. */ + interface IDeleteServingConfigRequest { - /** QueryExpansionSpec condition. */ - public condition: (google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition); + /** DeleteServingConfigRequest name */ + name?: (string|null); + } - /** QueryExpansionSpec pinUnexpandedResults. */ - public pinUnexpandedResults: boolean; + /** Represents a DeleteServingConfigRequest. */ + class DeleteServingConfigRequest implements IDeleteServingConfigRequest { - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionSpec instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + /** + * Constructs a new DeleteServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IDeleteServingConfigRequest); - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** DeleteServingConfigRequest name. */ + public name: string; - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new DeleteServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IDeleteServingConfigRequest): google.cloud.retail.v2beta.DeleteServingConfigRequest; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + /** + * Encodes the specified DeleteServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteServingConfigRequest.verify|verify} messages. + * @param message DeleteServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IDeleteServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + /** + * Encodes the specified DeleteServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteServingConfigRequest.verify|verify} messages. + * @param message DeleteServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a QueryExpansionSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteServingConfigRequest; - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec; + /** + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteServingConfigRequest; - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @param message QueryExpansionSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a DeleteServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this QueryExpansionSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a DeleteServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteServingConfigRequest; - namespace QueryExpansionSpec { + /** + * Creates a plain object from a DeleteServingConfigRequest message. Also converts values to other types if specified. + * @param message DeleteServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.DeleteServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Condition enum. */ - enum Condition { - CONDITION_UNSPECIFIED = 0, - DISABLED = 1, - AUTO = 3 - } - } + /** + * Converts this DeleteServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** SearchMode enum. */ - enum SearchMode { - SEARCH_MODE_UNSPECIFIED = 0, - PRODUCT_SEARCH_ONLY = 1, - FACETED_SEARCH_ONLY = 2 - } + /** Properties of a GetServingConfigRequest. */ + interface IGetServingConfigRequest { + + /** GetServingConfigRequest name */ + name?: (string|null); } - /** Properties of a SearchResponse. */ - interface ISearchResponse { + /** Represents a GetServingConfigRequest. */ + class GetServingConfigRequest implements IGetServingConfigRequest { - /** SearchResponse results */ - results?: (google.cloud.retail.v2beta.SearchResponse.ISearchResult[]|null); + /** + * Constructs a new GetServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IGetServingConfigRequest); - /** SearchResponse facets */ - facets?: (google.cloud.retail.v2beta.SearchResponse.IFacet[]|null); + /** GetServingConfigRequest name. */ + public name: string; - /** SearchResponse totalSize */ - totalSize?: (number|null); + /** + * Creates a new GetServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IGetServingConfigRequest): google.cloud.retail.v2beta.GetServingConfigRequest; - /** SearchResponse correctedQuery */ - correctedQuery?: (string|null); + /** + * Encodes the specified GetServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetServingConfigRequest.verify|verify} messages. + * @param message GetServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IGetServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchResponse attributionToken */ - attributionToken?: (string|null); + /** + * Encodes the specified GetServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetServingConfigRequest.verify|verify} messages. + * @param message GetServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IGetServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchResponse nextPageToken */ - nextPageToken?: (string|null); + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.GetServingConfigRequest; - /** SearchResponse queryExpansionInfo */ - queryExpansionInfo?: (google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null); + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.GetServingConfigRequest; - /** SearchResponse redirectUri */ - redirectUri?: (string|null); + /** + * Verifies a GetServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchResponse appliedControls */ - appliedControls?: (string[]|null); - } + /** + * Creates a GetServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.GetServingConfigRequest; - /** Represents a SearchResponse. */ - class SearchResponse implements ISearchResponse { + /** + * Creates a plain object from a GetServingConfigRequest message. Also converts values to other types if specified. + * @param message GetServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.GetServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Constructs a new SearchResponse. - * @param [properties] Properties to set + * Converts this GetServingConfigRequest to JSON. + * @returns JSON object */ - constructor(properties?: google.cloud.retail.v2beta.ISearchResponse); + public toJSON(): { [k: string]: any }; + } - /** SearchResponse results. */ - public results: google.cloud.retail.v2beta.SearchResponse.ISearchResult[]; + /** Properties of a ListServingConfigsRequest. */ + interface IListServingConfigsRequest { - /** SearchResponse facets. */ - public facets: google.cloud.retail.v2beta.SearchResponse.IFacet[]; + /** ListServingConfigsRequest parent */ + parent?: (string|null); - /** SearchResponse totalSize. */ - public totalSize: number; + /** ListServingConfigsRequest pageSize */ + pageSize?: (number|null); - /** SearchResponse correctedQuery. */ - public correctedQuery: string; + /** ListServingConfigsRequest pageToken */ + pageToken?: (string|null); + } - /** SearchResponse attributionToken. */ - public attributionToken: string; + /** Represents a ListServingConfigsRequest. */ + class ListServingConfigsRequest implements IListServingConfigsRequest { - /** SearchResponse nextPageToken. */ - public nextPageToken: string; + /** + * Constructs a new ListServingConfigsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListServingConfigsRequest); - /** SearchResponse queryExpansionInfo. */ - public queryExpansionInfo?: (google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null); + /** ListServingConfigsRequest parent. */ + public parent: string; - /** SearchResponse redirectUri. */ - public redirectUri: string; + /** ListServingConfigsRequest pageSize. */ + public pageSize: number; - /** SearchResponse appliedControls. */ - public appliedControls: string[]; + /** ListServingConfigsRequest pageToken. */ + public pageToken: string; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new ListServingConfigsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns SearchResponse instance + * @returns ListServingConfigsRequest instance */ - public static create(properties?: google.cloud.retail.v2beta.ISearchResponse): google.cloud.retail.v2beta.SearchResponse; + public static create(properties?: google.cloud.retail.v2beta.IListServingConfigsRequest): google.cloud.retail.v2beta.ListServingConfigsRequest; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified ListServingConfigsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsRequest.verify|verify} messages. + * @param message ListServingConfigsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2beta.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2beta.IListServingConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified ListServingConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsRequest.verify|verify} messages. + * @param message ListServingConfigsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2beta.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2beta.IListServingConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a ListServingConfigsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchResponse + * @returns ListServingConfigsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListServingConfigsRequest; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a ListServingConfigsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchResponse + * @returns ListServingConfigsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListServingConfigsRequest; /** - * Verifies a SearchResponse message. + * Verifies a ListServingConfigsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListServingConfigsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchResponse + * @returns ListServingConfigsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListServingConfigsRequest; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. - * @param message SearchResponse + * Creates a plain object from a ListServingConfigsRequest message. Also converts values to other types if specified. + * @param message ListServingConfigsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2beta.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2beta.ListServingConfigsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchResponse to JSON. + * Converts this ListServingConfigsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchResponse { - - /** Properties of a SearchResult. */ - interface ISearchResult { - - /** SearchResult id */ - id?: (string|null); - - /** SearchResult product */ - product?: (google.cloud.retail.v2beta.IProduct|null); - - /** SearchResult matchingVariantCount */ - matchingVariantCount?: (number|null); - - /** SearchResult matchingVariantFields */ - matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); - - /** SearchResult variantRollupValues */ - variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); - } - - /** Represents a SearchResult. */ - class SearchResult implements ISearchResult { - - /** - * Constructs a new SearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchResponse.ISearchResult); - - /** SearchResult id. */ - public id: string; - - /** SearchResult product. */ - public product?: (google.cloud.retail.v2beta.IProduct|null); - - /** SearchResult matchingVariantCount. */ - public matchingVariantCount: number; - - /** SearchResult matchingVariantFields. */ - public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; - - /** SearchResult variantRollupValues. */ - public variantRollupValues: { [k: string]: google.protobuf.IValue }; - - /** - * Creates a new SearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns SearchResult instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchResponse.ISearchResult): google.cloud.retail.v2beta.SearchResponse.SearchResult; - - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.SearchResult; - - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.SearchResult; - - /** - * Verifies a SearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.SearchResult; - - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @param message SearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a Facet. */ - interface IFacet { - - /** Facet key */ - key?: (string|null); - - /** Facet values */ - values?: (google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue[]|null); - - /** Facet dynamicFacet */ - dynamicFacet?: (boolean|null); - } - - /** Represents a Facet. */ - class Facet implements IFacet { - - /** - * Constructs a new Facet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchResponse.IFacet); - - /** Facet key. */ - public key: string; + /** Properties of a ListServingConfigsResponse. */ + interface IListServingConfigsResponse { - /** Facet values. */ - public values: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue[]; + /** ListServingConfigsResponse servingConfigs */ + servingConfigs?: (google.cloud.retail.v2beta.IServingConfig[]|null); - /** Facet dynamicFacet. */ - public dynamicFacet: boolean; + /** ListServingConfigsResponse nextPageToken */ + nextPageToken?: (string|null); + } - /** - * Creates a new Facet instance using the specified properties. - * @param [properties] Properties to set - * @returns Facet instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchResponse.IFacet): google.cloud.retail.v2beta.SearchResponse.Facet; + /** Represents a ListServingConfigsResponse. */ + class ListServingConfigsResponse implements IListServingConfigsResponse { - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new ListServingConfigsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListServingConfigsResponse); - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** ListServingConfigsResponse servingConfigs. */ + public servingConfigs: google.cloud.retail.v2beta.IServingConfig[]; - /** - * Decodes a Facet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.Facet; + /** ListServingConfigsResponse nextPageToken. */ + public nextPageToken: string; - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.Facet; + /** + * Creates a new ListServingConfigsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServingConfigsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListServingConfigsResponse): google.cloud.retail.v2beta.ListServingConfigsResponse; - /** - * Verifies a Facet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified ListServingConfigsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsResponse.verify|verify} messages. + * @param message ListServingConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListServingConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Facet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.Facet; + /** + * Encodes the specified ListServingConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsResponse.verify|verify} messages. + * @param message ListServingConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListServingConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @param message Facet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListServingConfigsResponse; - /** - * Converts this Facet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListServingConfigsResponse; - namespace Facet { + /** + * Verifies a ListServingConfigsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of a FacetValue. */ - interface IFacetValue { + /** + * Creates a ListServingConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServingConfigsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListServingConfigsResponse; - /** FacetValue value */ - value?: (string|null); + /** + * Creates a plain object from a ListServingConfigsResponse message. Also converts values to other types if specified. + * @param message ListServingConfigsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListServingConfigsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** FacetValue interval */ - interval?: (google.cloud.retail.v2beta.IInterval|null); + /** + * Converts this ListServingConfigsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** FacetValue count */ - count?: (number|Long|string|null); - } + /** Properties of an AddControlRequest. */ + interface IAddControlRequest { - /** Represents a FacetValue. */ - class FacetValue implements IFacetValue { + /** AddControlRequest servingConfig */ + servingConfig?: (string|null); - /** - * Constructs a new FacetValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue); + /** AddControlRequest controlId */ + controlId?: (string|null); + } - /** FacetValue value. */ - public value?: (string|null); + /** Represents an AddControlRequest. */ + class AddControlRequest implements IAddControlRequest { - /** FacetValue interval. */ - public interval?: (google.cloud.retail.v2beta.IInterval|null); + /** + * Constructs a new AddControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IAddControlRequest); - /** FacetValue count. */ - public count: (number|Long|string); + /** AddControlRequest servingConfig. */ + public servingConfig: string; - /** FacetValue facetValue. */ - public facetValue?: ("value"|"interval"); + /** AddControlRequest controlId. */ + public controlId: string; - /** - * Creates a new FacetValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetValue instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + /** + * Creates a new AddControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IAddControlRequest): google.cloud.retail.v2beta.AddControlRequest; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddControlRequest.verify|verify} messages. + * @param message AddControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IAddControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddControlRequest.verify|verify} messages. + * @param message AddControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IAddControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + /** + * Decodes an AddControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.AddControlRequest; - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + /** + * Decodes an AddControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.AddControlRequest; - /** - * Verifies a FacetValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies an AddControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue; + /** + * Creates an AddControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.AddControlRequest; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @param message FacetValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from an AddControlRequest message. Also converts values to other types if specified. + * @param message AddControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.AddControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this FacetValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Converts this AddControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of a QueryExpansionInfo. */ - interface IQueryExpansionInfo { + /** Properties of a RemoveControlRequest. */ + interface IRemoveControlRequest { - /** QueryExpansionInfo expandedQuery */ - expandedQuery?: (boolean|null); + /** RemoveControlRequest servingConfig */ + servingConfig?: (string|null); - /** QueryExpansionInfo pinnedResultCount */ - pinnedResultCount?: (number|Long|string|null); - } + /** RemoveControlRequest controlId */ + controlId?: (string|null); + } - /** Represents a QueryExpansionInfo. */ - class QueryExpansionInfo implements IQueryExpansionInfo { + /** Represents a RemoveControlRequest. */ + class RemoveControlRequest implements IRemoveControlRequest { - /** - * Constructs a new QueryExpansionInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo); + /** + * Constructs a new RemoveControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IRemoveControlRequest); - /** QueryExpansionInfo expandedQuery. */ - public expandedQuery: boolean; + /** RemoveControlRequest servingConfig. */ + public servingConfig: string; - /** QueryExpansionInfo pinnedResultCount. */ - public pinnedResultCount: (number|Long|string); + /** RemoveControlRequest controlId. */ + public controlId: string; - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionInfo instance - */ - public static create(properties?: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; + /** + * Creates a new RemoveControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IRemoveControlRequest): google.cloud.retail.v2beta.RemoveControlRequest; - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified RemoveControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveControlRequest.verify|verify} messages. + * @param message RemoveControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IRemoveControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified RemoveControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveControlRequest.verify|verify} messages. + * @param message RemoveControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IRemoveControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.RemoveControlRequest; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.RemoveControlRequest; - /** - * Verifies a QueryExpansionInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a RemoveControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo; + /** + * Creates a RemoveControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.RemoveControlRequest; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @param message QueryExpansionInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a RemoveControlRequest message. Also converts values to other types if specified. + * @param message RemoveControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.RemoveControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this QueryExpansionInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this RemoveControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } /** Represents a UserEventService */ diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index f4ea68b17ad..b4e3120af83 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -1372,6 +1372,7 @@ * @property {string|null} [catalog] SetDefaultBranchRequest catalog * @property {string|null} [branchId] SetDefaultBranchRequest branchId * @property {string|null} [note] SetDefaultBranchRequest note + * @property {boolean|null} [force] SetDefaultBranchRequest force */ /** @@ -1413,6 +1414,14 @@ */ SetDefaultBranchRequest.prototype.note = ""; + /** + * SetDefaultBranchRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.force = false; + /** * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create @@ -1443,6 +1452,8 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); if (message.note != null && Object.hasOwnProperty.call(message, "note")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); return writer; }; @@ -1486,6 +1497,9 @@ case 3: message.note = reader.string(); break; + case 4: + message.force = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -1530,6 +1544,9 @@ if (message.note != null && message.hasOwnProperty("note")) if (!$util.isString(message.note)) return "note: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; @@ -1551,6 +1568,8 @@ message.branchId = String(object.branchId); if (object.note != null) message.note = String(object.note); + if (object.force != null) + message.force = Boolean(object.force); return message; }; @@ -1571,6 +1590,7 @@ object.catalog = ""; object.branchId = ""; object.note = ""; + object.force = false; } if (message.catalog != null && message.hasOwnProperty("catalog")) object.catalog = message.catalog; @@ -1578,6 +1598,8 @@ object.branchId = message.branchId; if (message.note != null && message.hasOwnProperty("note")) object.note = message.note; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; @@ -4653,24 +4675,29 @@ return UserInfo; })(); - v2.Promotion = (function() { + v2.LocalInventory = (function() { /** - * Properties of a Promotion. + * Properties of a LocalInventory. * @memberof google.cloud.retail.v2 - * @interface IPromotion - * @property {string|null} [promotionId] Promotion promotionId + * @interface ILocalInventory + * @property {string|null} [placeId] LocalInventory placeId + * @property {google.cloud.retail.v2.IPriceInfo|null} [priceInfo] LocalInventory priceInfo + * @property {Object.|null} [attributes] LocalInventory attributes + * @property {Array.|null} [fulfillmentTypes] LocalInventory fulfillmentTypes */ /** - * Constructs a new Promotion. + * Constructs a new LocalInventory. * @memberof google.cloud.retail.v2 - * @classdesc Represents a Promotion. - * @implements IPromotion + * @classdesc Represents a LocalInventory. + * @implements ILocalInventory * @constructor - * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + * @param {google.cloud.retail.v2.ILocalInventory=} [properties] Properties to set */ - function Promotion(properties) { + function LocalInventory(properties) { + this.attributes = {}; + this.fulfillmentTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4678,75 +4705,139 @@ } /** - * Promotion promotionId. - * @member {string} promotionId - * @memberof google.cloud.retail.v2.Promotion + * LocalInventory placeId. + * @member {string} placeId + * @memberof google.cloud.retail.v2.LocalInventory * @instance */ - Promotion.prototype.promotionId = ""; + LocalInventory.prototype.placeId = ""; /** - * Creates a new Promotion instance using the specified properties. + * LocalInventory priceInfo. + * @member {google.cloud.retail.v2.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2.LocalInventory + * @instance + */ + LocalInventory.prototype.priceInfo = null; + + /** + * LocalInventory attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.LocalInventory + * @instance + */ + LocalInventory.prototype.attributes = $util.emptyObject; + + /** + * LocalInventory fulfillmentTypes. + * @member {Array.} fulfillmentTypes + * @memberof google.cloud.retail.v2.LocalInventory + * @instance + */ + LocalInventory.prototype.fulfillmentTypes = $util.emptyArray; + + /** + * Creates a new LocalInventory instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static - * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Promotion} Promotion instance + * @param {google.cloud.retail.v2.ILocalInventory=} [properties] Properties to set + * @returns {google.cloud.retail.v2.LocalInventory} LocalInventory instance */ - Promotion.create = function create(properties) { - return new Promotion(properties); + LocalInventory.create = function create(properties) { + return new LocalInventory(properties); }; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static - * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encode = function encode(message, writer) { + LocalInventory.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.fulfillmentTypes != null && message.fulfillmentTypes.length) + for (var i = 0; i < message.fulfillmentTypes.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fulfillmentTypes[i]); return writer; }; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static - * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encodeDelimited = function encodeDelimited(message, writer) { + LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Promotion} Promotion + * @returns {google.cloud.retail.v2.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decode = function decode(reader, length) { + LocalInventory.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Promotion(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.LocalInventory(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.promotionId = reader.string(); + message.placeId = reader.string(); + break; + case 2: + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); + break; + case 3: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 4: + if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) + message.fulfillmentTypes = []; + message.fulfillmentTypes.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -4757,87 +4848,150 @@ }; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Promotion} Promotion + * @returns {google.cloud.retail.v2.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decodeDelimited = function decodeDelimited(reader) { + LocalInventory.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Promotion message. + * Verifies a LocalInventory message. * @function verify - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Promotion.verify = function verify(message) { + LocalInventory.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - if (!$util.isString(message.promotionId)) - return "promotionId: string expected"; + if (message.placeId != null && message.hasOwnProperty("placeId")) + if (!$util.isString(message.placeId)) + return "placeId: string expected"; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.fulfillmentTypes != null && message.hasOwnProperty("fulfillmentTypes")) { + if (!Array.isArray(message.fulfillmentTypes)) + return "fulfillmentTypes: array expected"; + for (var i = 0; i < message.fulfillmentTypes.length; ++i) + if (!$util.isString(message.fulfillmentTypes[i])) + return "fulfillmentTypes: string[] expected"; + } return null; }; /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Promotion} Promotion + * @returns {google.cloud.retail.v2.LocalInventory} LocalInventory */ - Promotion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Promotion) + LocalInventory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.LocalInventory) return object; - var message = new $root.google.cloud.retail.v2.Promotion(); - if (object.promotionId != null) - message.promotionId = String(object.promotionId); + var message = new $root.google.cloud.retail.v2.LocalInventory(); + if (object.placeId != null) + message.placeId = String(object.placeId); + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2.LocalInventory.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.fromObject(object.priceInfo); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.LocalInventory.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.LocalInventory.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.fulfillmentTypes) { + if (!Array.isArray(object.fulfillmentTypes)) + throw TypeError(".google.cloud.retail.v2.LocalInventory.fulfillmentTypes: array expected"); + message.fulfillmentTypes = []; + for (var i = 0; i < object.fulfillmentTypes.length; ++i) + message.fulfillmentTypes[i] = String(object.fulfillmentTypes[i]); + } return message; }; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @static - * @param {google.cloud.retail.v2.Promotion} message Promotion + * @param {google.cloud.retail.v2.LocalInventory} message LocalInventory * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Promotion.toObject = function toObject(message, options) { + LocalInventory.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.promotionId = ""; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - object.promotionId = message.promotionId; + if (options.arrays || options.defaults) + object.fulfillmentTypes = []; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.placeId = ""; + object.priceInfo = null; + } + if (message.placeId != null && message.hasOwnProperty("placeId")) + object.placeId = message.placeId; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2.PriceInfo.toObject(message.priceInfo, options); + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.fulfillmentTypes && message.fulfillmentTypes.length) { + object.fulfillmentTypes = []; + for (var j = 0; j < message.fulfillmentTypes.length; ++j) + object.fulfillmentTypes[j] = message.fulfillmentTypes[j]; + } return object; }; /** - * Converts this Promotion to JSON. + * Converts this LocalInventory to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Promotion + * @memberof google.cloud.retail.v2.LocalInventory * @instance * @returns {Object.} JSON object */ - Promotion.prototype.toJSON = function toJSON() { + LocalInventory.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Promotion; + return LocalInventory; })(); v2.CompletionService = (function() { @@ -11376,6 +11530,193 @@ return Product; })(); + v2.Promotion = (function() { + + /** + * Properties of a Promotion. + * @memberof google.cloud.retail.v2 + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId + */ + + /** + * Constructs a new Promotion. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a Promotion. + * @implements IPromotion + * @constructor + * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + */ + function Promotion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2.Promotion + * @instance + */ + Promotion.prototype.promotionId = ""; + + /** + * Creates a new Promotion instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Promotion} Promotion instance + */ + Promotion.create = function create(properties) { + return new Promotion(properties); + }; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + return writer; + }; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Promotion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.promotionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Promotion message. + * @function verify + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Promotion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; + return null; + }; + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Promotion} Promotion + */ + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Promotion) + return object; + var message = new $root.google.cloud.retail.v2.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); + return message; + }; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {google.cloud.retail.v2.Promotion} message Promotion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Promotion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; + return object; + }; + + /** + * Converts this Promotion to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Promotion + * @instance + * @returns {Object.} JSON object + */ + Promotion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Promotion; + })(); + v2.UserEvent = (function() { /** @@ -14195,6 +14536,72 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#addLocalInventories}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService#removeLocalInventories}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return ProductService; })(); @@ -16770,29 +17177,29 @@ return AddFulfillmentPlacesResponse; })(); - v2.RemoveFulfillmentPlacesRequest = (function() { + v2.AddLocalInventoriesRequest = (function() { /** - * Properties of a RemoveFulfillmentPlacesRequest. + * Properties of an AddLocalInventoriesRequest. * @memberof google.cloud.retail.v2 - * @interface IRemoveFulfillmentPlacesRequest - * @property {string|null} [product] RemoveFulfillmentPlacesRequest product - * @property {string|null} [type] RemoveFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing */ /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new AddLocalInventoriesRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveFulfillmentPlacesRequest. - * @implements IRemoveFulfillmentPlacesRequest + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest * @constructor - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest=} [properties] Properties to set */ - function RemoveFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16800,111 +17207,111 @@ } /** - * RemoveFulfillmentPlacesRequest product. + * AddLocalInventoriesRequest product. * @member {string} product - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.product = ""; + AddLocalInventoriesRequest.prototype.product = ""; /** - * RemoveFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.type = ""; + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; /** - * RemoveFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + AddLocalInventoriesRequest.prototype.addMask = null; /** - * RemoveFulfillmentPlacesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * AddLocalInventoriesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + AddLocalInventoriesRequest.prototype.addTime = null; /** - * RemoveFulfillmentPlacesRequest allowMissing. + * AddLocalInventoriesRequest allowMissing. * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + AddLocalInventoriesRequest.prototype.allowMissing = false; /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new AddLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance */ - RemoveFulfillmentPlacesRequest.create = function create(properties) { - return new RemoveFulfillmentPlacesRequest(properties); + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + AddLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.product != null && Object.hasOwnProperty.call(message, "product")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + AddLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -16912,17 +17319,17 @@ message.product = reader.string(); break; case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2.LocalInventory.decode(reader, reader.uint32())); break; case 4: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; case 5: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: message.allowMissing = reader.bool(); break; default: @@ -16934,49 +17341,53 @@ }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies an AddLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesRequest.verify = function verify(message) { + AddLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.product != null && message.hasOwnProperty("product")) if (!$util.isString(message.product)) return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); if (error) - return "removeTime." + error; + return "addMask." + error; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; } if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) if (typeof message.allowMissing !== "boolean") @@ -16985,32 +17396,38 @@ }; /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest */ - RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest) + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesRequest) return object; - var message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + var message = new $root.google.cloud.retail.v2.AddLocalInventoriesRequest(); if (object.product != null) message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2.LocalInventory.fromObject(object.localInventories[i]); + } } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); } if (object.allowMissing != null) message.allowMissing = Boolean(object.allowMissing); @@ -17018,73 +17435,73 @@ }; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {google.cloud.retail.v2.AddLocalInventoriesRequest} message AddLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + AddLocalInventoriesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.placeIds = []; + object.localInventories = []; if (options.defaults) { object.product = ""; - object.type = ""; - object.removeTime = null; + object.addMask = null; + object.addTime = null; object.allowMissing = false; } if (message.product != null && message.hasOwnProperty("product")) object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2.LocalInventory.toObject(message.localInventories[j], options); } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) object.allowMissing = message.allowMissing; return object; }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this AddLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesRequest; + return AddLocalInventoriesRequest; })(); - v2.RemoveFulfillmentPlacesMetadata = (function() { + v2.AddLocalInventoriesMetadata = (function() { /** - * Properties of a RemoveFulfillmentPlacesMetadata. + * Properties of an AddLocalInventoriesMetadata. * @memberof google.cloud.retail.v2 - * @interface IRemoveFulfillmentPlacesMetadata + * @interface IAddLocalInventoriesMetadata */ /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new AddLocalInventoriesMetadata. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveFulfillmentPlacesMetadata. - * @implements IRemoveFulfillmentPlacesMetadata + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata * @constructor - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata=} [properties] Properties to set */ - function RemoveFulfillmentPlacesMetadata(properties) { + function AddLocalInventoriesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17092,60 +17509,60 @@ } /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance */ - RemoveFulfillmentPlacesMetadata.create = function create(properties) { - return new RemoveFulfillmentPlacesMetadata(properties); + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + AddLocalInventoriesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + AddLocalInventoriesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -17158,93 +17575,93 @@ }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesMetadata message. + * Verifies an AddLocalInventoriesMetadata message. * @function verify - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + AddLocalInventoriesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata */ - RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata) + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesMetadata) return object; - return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); + return new $root.google.cloud.retail.v2.AddLocalInventoriesMetadata(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + AddLocalInventoriesMetadata.toObject = function toObject() { return {}; }; /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * Converts this AddLocalInventoriesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesMetadata; + return AddLocalInventoriesMetadata; })(); - v2.RemoveFulfillmentPlacesResponse = (function() { + v2.AddLocalInventoriesResponse = (function() { /** - * Properties of a RemoveFulfillmentPlacesResponse. + * Properties of an AddLocalInventoriesResponse. * @memberof google.cloud.retail.v2 - * @interface IRemoveFulfillmentPlacesResponse + * @interface IAddLocalInventoriesResponse */ /** - * Constructs a new RemoveFulfillmentPlacesResponse. + * Constructs a new AddLocalInventoriesResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveFulfillmentPlacesResponse. - * @implements IRemoveFulfillmentPlacesResponse + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse * @constructor - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse=} [properties] Properties to set */ - function RemoveFulfillmentPlacesResponse(properties) { + function AddLocalInventoriesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17252,60 +17669,60 @@ } /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * Creates a new AddLocalInventoriesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance */ - RemoveFulfillmentPlacesResponse.create = function create(properties) { - return new RemoveFulfillmentPlacesResponse(properties); + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + AddLocalInventoriesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + AddLocalInventoriesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -17318,93 +17735,98 @@ }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesResponse message. + * Verifies an AddLocalInventoriesResponse message. * @function verify - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesResponse.verify = function verify(message) { + AddLocalInventoriesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse */ - RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse) + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesResponse) return object; - return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); + return new $root.google.cloud.retail.v2.AddLocalInventoriesResponse(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {google.cloud.retail.v2.AddLocalInventoriesResponse} message AddLocalInventoriesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesResponse.toObject = function toObject() { + AddLocalInventoriesResponse.toObject = function toObject() { return {}; }; /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. + * Converts this AddLocalInventoriesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesResponse; + return AddLocalInventoriesResponse; })(); - v2.PurgeMetadata = (function() { + v2.RemoveLocalInventoriesRequest = (function() { /** - * Properties of a PurgeMetadata. + * Properties of a RemoveLocalInventoriesRequest. * @memberof google.cloud.retail.v2 - * @interface IPurgeMetadata + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing */ /** - * Constructs a new PurgeMetadata. + * Constructs a new RemoveLocalInventoriesRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest * @constructor - * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function RemoveLocalInventoriesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17412,63 +17834,118 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.product = ""; + + /** + * RemoveLocalInventoriesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveLocalInventoriesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.removeTime = null; + + /** + * RemoveLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); }; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encode = function encode(message, writer) { + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decode = function decode(reader, length) { + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 5: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -17478,96 +17955,149 @@ }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeMetadata message. + * Verifies a RemoveLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeMetadata.verify = function verify(message) { + RemoveLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest) return object; - return new $root.google.cloud.retail.v2.PurgeMetadata(); + var message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.RemoveLocalInventoriesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2.RemoveLocalInventoriesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata + * @param {google.cloud.retail.v2.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeMetadata.toObject = function toObject() { - return {}; + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.allowMissing = false; + object.removeTime = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + return object; }; /** - * Converts this PurgeMetadata to JSON. + * Converts this RemoveLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurgeMetadata + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - PurgeMetadata.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeMetadata; + return RemoveLocalInventoriesRequest; })(); - v2.PurgeUserEventsRequest = (function() { + v2.RemoveLocalInventoriesMetadata = (function() { /** - * Properties of a PurgeUserEventsRequest. + * Properties of a RemoveLocalInventoriesMetadata. * @memberof google.cloud.retail.v2 - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force + * @interface IRemoveLocalInventoriesMetadata */ /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new RemoveLocalInventoriesMetadata. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata * @constructor - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata=} [properties] Properties to set */ - function PurgeUserEventsRequest(properties) { + function RemoveLocalInventoriesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17575,102 +18105,63 @@ } /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.parent = ""; - - /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.filter = ""; - - /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.force = false; - - /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; - case 3: - message.force = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -17680,124 +18171,93 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a RemoveLocalInventoriesMetadata message. * @function verify - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + RemoveLocalInventoriesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata) return object; - var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); - return message; + return new $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata(); }; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; - return object; + RemoveLocalInventoriesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this RemoveLocalInventoriesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + return RemoveLocalInventoriesMetadata; })(); - v2.PurgeUserEventsResponse = (function() { + v2.RemoveLocalInventoriesResponse = (function() { /** - * Properties of a PurgeUserEventsResponse. + * Properties of a RemoveLocalInventoriesResponse. * @memberof google.cloud.retail.v2 - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * @interface IRemoveLocalInventoriesResponse */ /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new RemoveLocalInventoriesResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse * @constructor - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function RemoveLocalInventoriesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17805,76 +18265,63 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @instance - */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); }; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encode = function encode(message, writer) { + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); return writer; }; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; default: reader.skipType(tag & 7); break; @@ -17884,209 +18331,99 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a RemoveLocalInventoriesResponse message. * @function verify - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsResponse.verify = function verify(message) { + RemoveLocalInventoriesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; return null; }; /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse) return object; - var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); - return message; + return new $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse(); }; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {google.cloud.retail.v2.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; - return object; + RemoveLocalInventoriesResponse.toObject = function toObject() { + return {}; }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this RemoveLocalInventoriesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse * @instance * @returns {Object.} JSON object */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsResponse; - })(); - - v2.SearchService = (function() { - - /** - * Constructs a new SearchService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a SearchService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SearchService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; - - /** - * Creates new SearchService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.SearchService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. - */ - SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. - * @memberof google.cloud.retail.v2.SearchService - * @typedef SearchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.SearchResponse} [response] SearchResponse - */ - - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2.SearchService - * @instance - * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object - * @param {google.cloud.retail.v2.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SearchService.prototype.search = function search(request, callback) { - return this.rpcCall(search, $root.google.cloud.retail.v2.SearchRequest, $root.google.cloud.retail.v2.SearchResponse, request, callback); - }, "name", { value: "Search" }); - - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2.SearchService - * @instance - * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SearchService; + return RemoveLocalInventoriesResponse; })(); - v2.SearchRequest = (function() { + v2.RemoveFulfillmentPlacesRequest = (function() { /** - * Properties of a SearchRequest. + * Properties of a RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2 - * @interface ISearchRequest - * @property {string|null} [placement] SearchRequest placement - * @property {string|null} [branch] SearchRequest branch - * @property {string|null} [query] SearchRequest query - * @property {string|null} [visitorId] SearchRequest visitorId - * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] SearchRequest userInfo - * @property {number|null} [pageSize] SearchRequest pageSize - * @property {string|null} [pageToken] SearchRequest pageToken - * @property {number|null} [offset] SearchRequest offset - * @property {string|null} [filter] SearchRequest filter - * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter - * @property {string|null} [orderBy] SearchRequest orderBy - * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs - * @property {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec - * @property {google.cloud.retail.v2.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec - * @property {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec - * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys - * @property {Array.|null} [pageCategories] SearchRequest pageCategories - * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new SearchRequest. + * Constructs a new RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SearchRequest. - * @implements ISearchRequest + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set */ - function SearchRequest(properties) { - this.facetSpecs = []; - this.variantRollupKeys = []; - this.pageCategories = []; + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18094,306 +18431,355 @@ } /** - * SearchRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2.SearchRequest + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - SearchRequest.prototype.placement = ""; + RemoveFulfillmentPlacesRequest.prototype.product = ""; /** - * SearchRequest branch. - * @member {string} branch - * @memberof google.cloud.retail.v2.SearchRequest + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - SearchRequest.prototype.branch = ""; + RemoveFulfillmentPlacesRequest.prototype.type = ""; /** - * SearchRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2.SearchRequest + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - SearchRequest.prototype.query = ""; + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * SearchRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2.SearchRequest + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - SearchRequest.prototype.visitorId = ""; + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; /** - * SearchRequest userInfo. - * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2.SearchRequest + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance */ - SearchRequest.prototype.userInfo = null; + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; /** - * SearchRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance */ - SearchRequest.prototype.pageSize = 0; + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); + }; /** - * SearchRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - SearchRequest.prototype.pageToken = ""; + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; /** - * SearchRequest offset. - * @member {number} offset - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - SearchRequest.prototype.offset = 0; + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * SearchRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.prototype.filter = ""; + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * SearchRequest canonicalFilter. - * @member {string} canonicalFilter - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.prototype.canonicalFilter = ""; + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * SearchRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Verifies a RemoveFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.prototype.orderBy = ""; + RemoveFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; /** - * SearchRequest facetSpecs. - * @member {Array.} facetSpecs - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest */ - SearchRequest.prototype.facetSpecs = $util.emptyArray; + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; /** - * SearchRequest dynamicFacetSpec. - * @member {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchRequest.prototype.dynamicFacetSpec = null; + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; /** - * SearchRequest boostSpec. - * @member {google.cloud.retail.v2.SearchRequest.IBoostSpec|null|undefined} boostSpec - * @memberof google.cloud.retail.v2.SearchRequest + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest * @instance + * @returns {Object.} JSON object */ - SearchRequest.prototype.boostSpec = null; + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * SearchRequest queryExpansionSpec. - * @member {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.queryExpansionSpec = null; + return RemoveFulfillmentPlacesRequest; + })(); - /** - * SearchRequest variantRollupKeys. - * @member {Array.} variantRollupKeys - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + v2.RemoveFulfillmentPlacesMetadata = (function() { /** - * SearchRequest pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Properties of a RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesMetadata */ - SearchRequest.prototype.pageCategories = $util.emptyArray; /** - * SearchRequest searchMode. - * @member {google.cloud.retail.v2.SearchRequest.SearchMode} searchMode - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set */ - SearchRequest.prototype.searchMode = 0; + function RemoveFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance */ - SearchRequest.create = function create(properties) { - return new SearchRequest(properties); + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encode = function encode(message, writer) { + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); - if (message.facetSpecs != null && message.facetSpecs.length) - for (var i = 0; i < message.facetSpecs.length; ++i) - $root.google.cloud.retail.v2.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) - $root.google.cloud.retail.v2.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) - $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.variantRollupKeys != null && message.variantRollupKeys.length) - for (var i = 0; i < message.variantRollupKeys.length; ++i) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); - if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) - $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); - if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); - if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); return writer; }; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decode = function decode(reader, length) { + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); - break; - case 4: - message.visitorId = reader.string(); - break; - case 5: - message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: - message.filter = reader.string(); - break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 31: - message.searchMode = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -18403,1900 +18789,936 @@ }; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchRequest message. + * Verifies a RemoveFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.verify = function verify(message) { + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - if (!$util.isString(message.canonicalFilter)) - return "canonicalFilter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { - if (!Array.isArray(message.facetSpecs)) - return "facetSpecs: array expected"; - for (var i = 0; i < message.facetSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); - if (error) - return "facetSpecs." + error; - } - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); - if (error) - return "dynamicFacetSpec." + error; - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.verify(message.boostSpec); - if (error) - return "boostSpec." + error; - } - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); - if (error) - return "queryExpansionSpec." + error; - } - if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { - if (!Array.isArray(message.variantRollupKeys)) - return "variantRollupKeys: array expected"; - for (var i = 0; i < message.variantRollupKeys.length; ++i) - if (!$util.isString(message.variantRollupKeys[i])) - return "variantRollupKeys: string[] expected"; - } - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; - } - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - switch (message.searchMode) { - default: - return "searchMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } return null; }; /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata */ - SearchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.branch != null) - message.branch = String(object.branch); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.filter != null) - message.filter = String(object.filter); - if (object.canonicalFilter != null) - message.canonicalFilter = String(object.canonicalFilter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.facetSpecs) { - if (!Array.isArray(object.facetSpecs)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: array expected"); - message.facetSpecs = []; - for (var i = 0; i < object.facetSpecs.length; ++i) { - if (typeof object.facetSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: object expected"); - message.facetSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); - } - } - if (object.dynamicFacetSpec != null) { - if (typeof object.dynamicFacetSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.dynamicFacetSpec: object expected"); - message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); - } - if (object.boostSpec != null) { - if (typeof object.boostSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.boostSpec: object expected"); - message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.fromObject(object.boostSpec); - } - if (object.queryExpansionSpec != null) { - if (typeof object.queryExpansionSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.queryExpansionSpec: object expected"); - message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); - } - if (object.variantRollupKeys) { - if (!Array.isArray(object.variantRollupKeys)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.variantRollupKeys: array expected"); - message.variantRollupKeys = []; - for (var i = 0; i < object.variantRollupKeys.length; ++i) - message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); - } - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - switch (object.searchMode) { - case "SEARCH_MODE_UNSPECIFIED": - case 0: - message.searchMode = 0; - break; - case "PRODUCT_SEARCH_ONLY": - case 1: - message.searchMode = 1; - break; - case "FACETED_SEARCH_ONLY": - case 2: - message.searchMode = 2; - break; - } - return message; + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2.SearchRequest} message SearchRequest + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.facetSpecs = []; - object.variantRollupKeys = []; - object.pageCategories = []; - } - if (options.defaults) { - object.placement = ""; - object.branch = ""; - object.query = ""; - object.visitorId = ""; - object.userInfo = null; - object.pageSize = 0; - object.pageToken = ""; - object.offset = 0; - object.filter = ""; - object.orderBy = ""; - object.boostSpec = null; - object.queryExpansionSpec = null; - object.dynamicFacetSpec = null; - object.canonicalFilter = ""; - object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.facetSpecs && message.facetSpecs.length) { - object.facetSpecs = []; - for (var j = 0; j < message.facetSpecs.length; ++j) - object.facetSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) - object.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.toObject(message.boostSpec, options); - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) - object.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); - if (message.variantRollupKeys && message.variantRollupKeys.length) { - object.variantRollupKeys = []; - for (var j = 0; j < message.variantRollupKeys.length; ++j) - object.variantRollupKeys[j] = message.variantRollupKeys[j]; - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) - object.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; - } - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - object.canonicalFilter = message.canonicalFilter; - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; - return object; + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this SearchRequest to JSON. + * Converts this RemoveFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - SearchRequest.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchRequest.FacetSpec = (function() { + return RemoveFulfillmentPlacesMetadata; + })(); - /** - * Properties of a FacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IFacetSpec - * @property {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey - * @property {number|null} [limit] FacetSpec limit - * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys - * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition - */ + v2.RemoveFulfillmentPlacesResponse = (function() { - /** - * Constructs a new FacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a FacetSpec. - * @implements IFacetSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set - */ - function FacetSpec(properties) { - this.excludedFilterKeys = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesResponse + */ - /** - * FacetSpec facetKey. - * @member {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.facetKey = null; + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FacetSpec limit. - * @member {number} limit - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.limit = 0; + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + */ + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); + }; - /** - * FacetSpec excludedFilterKeys. - * @member {Array.} excludedFilterKeys - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * FacetSpec enableDynamicPosition. - * @member {boolean} enableDynamicPosition - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.enableDynamicPosition = false; + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new FacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec instance - */ - FacetSpec.create = function create(properties) { - return new FacetSpec(properties); - }; + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) - $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); - if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); - if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); - return writer; - }; + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + */ + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); + }; - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; - /** - * Verifies a FacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.facetKey != null && message.hasOwnProperty("facetKey")) { - var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); - if (error) - return "facetKey." + error; - } - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit)) - return "limit: integer expected"; - if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { - if (!Array.isArray(message.excludedFilterKeys)) - return "excludedFilterKeys: array expected"; - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - if (!$util.isString(message.excludedFilterKeys[i])) - return "excludedFilterKeys: string[] expected"; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - if (typeof message.enableDynamicPosition !== "boolean") - return "enableDynamicPosition: boolean expected"; - return null; - }; + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec - */ - FacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); - if (object.facetKey != null) { - if (typeof object.facetKey !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.facetKey: object expected"); - message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); - } - if (object.limit != null) - message.limit = object.limit | 0; - if (object.excludedFilterKeys) { - if (!Array.isArray(object.excludedFilterKeys)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); - message.excludedFilterKeys = []; - for (var i = 0; i < object.excludedFilterKeys.length; ++i) - message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); - } - if (object.enableDynamicPosition != null) - message.enableDynamicPosition = Boolean(object.enableDynamicPosition); - return message; - }; + return RemoveFulfillmentPlacesResponse; + })(); - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec} message FacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.excludedFilterKeys = []; - if (options.defaults) { - object.facetKey = null; - object.limit = 0; - object.enableDynamicPosition = false; - } - if (message.facetKey != null && message.hasOwnProperty("facetKey")) - object.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = message.limit; - if (message.excludedFilterKeys && message.excludedFilterKeys.length) { - object.excludedFilterKeys = []; - for (var j = 0; j < message.excludedFilterKeys.length; ++j) - object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - object.enableDynamicPosition = message.enableDynamicPosition; - return object; - }; + v2.PurgeMetadata = (function() { - /** - * Converts this FacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @instance - * @returns {Object.} JSON object - */ - FacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @interface IPurgeMetadata + */ - FacetSpec.FacetKey = (function() { + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Properties of a FacetKey. - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @interface IFacetKey - * @property {string|null} [key] FacetKey key - * @property {Array.|null} [intervals] FacetKey intervals - * @property {Array.|null} [restrictedValues] FacetKey restrictedValues - * @property {Array.|null} [prefixes] FacetKey prefixes - * @property {Array.|null} [contains] FacetKey contains - * @property {string|null} [orderBy] FacetKey orderBy - * @property {string|null} [query] FacetKey query - */ + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; - /** - * Constructs a new FacetKey. - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @classdesc Represents a FacetKey. - * @implements IFacetKey - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - */ - function FacetKey(properties) { - this.intervals = []; - this.restrictedValues = []; - this.prefixes = []; - this.contains = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * FacetKey key. - * @member {string} key - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.key = ""; + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * FacetKey intervals. - * @member {Array.} intervals - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.intervals = $util.emptyArray; + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * FacetKey restrictedValues. - * @member {Array.} restrictedValues - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.restrictedValues = $util.emptyArray; + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * FacetKey prefixes. - * @member {Array.} prefixes - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.prefixes = $util.emptyArray; + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * FacetKey contains. - * @member {Array.} contains - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.contains = $util.emptyArray; + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2.PurgeMetadata(); + }; - /** - * FacetKey orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.orderBy = ""; + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; - /** - * FacetKey query. - * @member {string} query - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.query = ""; + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new FacetKey instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey instance - */ - FacetKey.create = function create(properties) { - return new FacetKey(properties); - }; + return PurgeMetadata; + })(); - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.intervals != null && message.intervals.length) - for (var i = 0; i < message.intervals.length; ++i) - $root.google.cloud.retail.v2.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.restrictedValues != null && message.restrictedValues.length) - for (var i = 0; i < message.restrictedValues.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); - if (message.prefixes != null && message.prefixes.length) - for (var i = 0; i < message.prefixes.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); - if (message.contains != null && message.contains.length) - for (var i = 0; i < message.contains.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); - return writer; - }; + v2.PurgeUserEventsRequest = (function() { - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; - /** - * Verifies a FacetKey message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.intervals != null && message.hasOwnProperty("intervals")) { - if (!Array.isArray(message.intervals)) - return "intervals: array expected"; - for (var i = 0; i < message.intervals.length; ++i) { - var error = $root.google.cloud.retail.v2.Interval.verify(message.intervals[i]); - if (error) - return "intervals." + error; - } - } - if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { - if (!Array.isArray(message.restrictedValues)) - return "restrictedValues: array expected"; - for (var i = 0; i < message.restrictedValues.length; ++i) - if (!$util.isString(message.restrictedValues[i])) - return "restrictedValues: string[] expected"; - } - if (message.prefixes != null && message.hasOwnProperty("prefixes")) { - if (!Array.isArray(message.prefixes)) - return "prefixes: array expected"; - for (var i = 0; i < message.prefixes.length; ++i) - if (!$util.isString(message.prefixes[i])) - return "prefixes: string[] expected"; - } - if (message.contains != null && message.hasOwnProperty("contains")) { - if (!Array.isArray(message.contains)) - return "contains: array expected"; - for (var i = 0; i < message.contains.length; ++i) - if (!$util.isString(message.contains[i])) - return "contains: string[] expected"; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - return null; - }; + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey - */ - FacetKey.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); - if (object.key != null) - message.key = String(object.key); - if (object.intervals) { - if (!Array.isArray(object.intervals)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); - message.intervals = []; - for (var i = 0; i < object.intervals.length; ++i) { - if (typeof object.intervals[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); - message.intervals[i] = $root.google.cloud.retail.v2.Interval.fromObject(object.intervals[i]); - } - } - if (object.restrictedValues) { - if (!Array.isArray(object.restrictedValues)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); - message.restrictedValues = []; - for (var i = 0; i < object.restrictedValues.length; ++i) - message.restrictedValues[i] = String(object.restrictedValues[i]); - } - if (object.prefixes) { - if (!Array.isArray(object.prefixes)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); - message.prefixes = []; - for (var i = 0; i < object.prefixes.length; ++i) - message.prefixes[i] = String(object.prefixes[i]); - } - if (object.contains) { - if (!Array.isArray(object.contains)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.contains: array expected"); - message.contains = []; - for (var i = 0; i < object.contains.length; ++i) - message.contains[i] = String(object.contains[i]); - } - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.query != null) - message.query = String(object.query); - return message; - }; - - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} message FacetKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.intervals = []; - object.restrictedValues = []; - object.prefixes = []; - object.contains = []; - } - if (options.defaults) { - object.key = ""; - object.orderBy = ""; - object.query = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.intervals && message.intervals.length) { - object.intervals = []; - for (var j = 0; j < message.intervals.length; ++j) - object.intervals[j] = $root.google.cloud.retail.v2.Interval.toObject(message.intervals[j], options); - } - if (message.restrictedValues && message.restrictedValues.length) { - object.restrictedValues = []; - for (var j = 0; j < message.restrictedValues.length; ++j) - object.restrictedValues[j] = message.restrictedValues[j]; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.prefixes && message.prefixes.length) { - object.prefixes = []; - for (var j = 0; j < message.prefixes.length; ++j) - object.prefixes[j] = message.prefixes[j]; - } - if (message.contains && message.contains.length) { - object.contains = []; - for (var j = 0; j < message.contains.length; ++j) - object.contains[j] = message.contains[j]; - } - return object; - }; - - /** - * Converts this FacetKey to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - * @returns {Object.} JSON object - */ - FacetKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FacetKey; - })(); - - return FacetSpec; - })(); - - SearchRequest.DynamicFacetSpec = (function() { - - /** - * Properties of a DynamicFacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IDynamicFacetSpec - * @property {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode - */ - - /** - * Constructs a new DynamicFacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a DynamicFacetSpec. - * @implements IDynamicFacetSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - */ - function DynamicFacetSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DynamicFacetSpec mode. - * @member {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode} mode - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @instance - */ - DynamicFacetSpec.prototype.mode = 0; - - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance - */ - DynamicFacetSpec.create = function create(properties) { - return new DynamicFacetSpec(properties); - }; - - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; - - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; - /** - * Verifies a DynamicFacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DynamicFacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - */ - DynamicFacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "DISABLED": + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - message.mode = 1; + message.parent = reader.string(); break; - case "ENABLED": case 2: - message.mode = 2; + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DynamicFacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) return object; - }; + var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; - /** - * Converts this DynamicFacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec - * @instance - * @returns {Object.} JSON object - */ - DynamicFacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; - /** - * Mode enum. - * @name google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} ENABLED=2 ENABLED value - */ - DynamicFacetSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[2] = "ENABLED"] = 2; - return values; - })(); + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return DynamicFacetSpec; - })(); + return PurgeUserEventsRequest; + })(); - SearchRequest.BoostSpec = (function() { + v2.PurgeUserEventsResponse = (function() { - /** - * Properties of a BoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IBoostSpec - * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs - */ + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ - /** - * Constructs a new BoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a BoostSpec. - * @implements IBoostSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set - */ - function BoostSpec(properties) { - this.conditionBoostSpecs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * BoostSpec conditionBoostSpecs. - * @member {Array.} conditionBoostSpecs - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @instance - */ - BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a new BoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec instance - */ - BoostSpec.create = function create(properties) { - return new BoostSpec(properties); - }; + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) - $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a BoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { - if (!Array.isArray(message.conditionBoostSpecs)) - return "conditionBoostSpecs: array expected"; - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); - if (error) - return "conditionBoostSpecs." + error; - } - } - return null; - }; + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec - */ - BoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); - if (object.conditionBoostSpecs) { - if (!Array.isArray(object.conditionBoostSpecs)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); - message.conditionBoostSpecs = []; - for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { - if (typeof object.conditionBoostSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); - message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); - } - } - return message; - }; + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} message BoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.conditionBoostSpecs = []; - if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { - object.conditionBoostSpecs = []; - for (var j = 0; j < message.conditionBoostSpecs.length; ++j) - object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); - } + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) return object; - }; + var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; - /** - * Converts this BoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @instance - * @returns {Object.} JSON object - */ - BoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; - BoostSpec.ConditionBoostSpec = (function() { + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a ConditionBoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @interface IConditionBoostSpec - * @property {string|null} [condition] ConditionBoostSpec condition - * @property {number|null} [boost] ConditionBoostSpec boost - */ + return PurgeUserEventsResponse; + })(); - /** - * Constructs a new ConditionBoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @classdesc Represents a ConditionBoostSpec. - * @implements IConditionBoostSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - */ - function ConditionBoostSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2.SearchService = (function() { - /** - * ConditionBoostSpec condition. - * @member {string} condition - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.condition = ""; + /** + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * ConditionBoostSpec boost. - * @member {number} boost - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.boost = 0; + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance - */ - ConditionBoostSpec.create = function create(properties) { - return new ConditionBoostSpec(properties); - }; + /** + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); - return writer; - }; + /** + * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. + * @memberof google.cloud.retail.v2.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.SearchResponse} [response] SearchResponse + */ - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConditionBoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConditionBoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - if (!$util.isString(message.condition)) - return "condition: string expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - return null; - }; - - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - */ - ConditionBoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); - if (object.condition != null) - message.condition = String(object.condition); - if (object.boost != null) - message.boost = Number(object.boost); - return message; - }; - - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConditionBoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = ""; - object.boost = 0; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = message.condition; - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - return object; - }; - - /** - * Converts this ConditionBoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - * @returns {Object.} JSON object - */ - ConditionBoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConditionBoostSpec; - })(); - - return BoostSpec; - })(); - - SearchRequest.QueryExpansionSpec = (function() { - - /** - * Properties of a QueryExpansionSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IQueryExpansionSpec - * @property {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition - * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults - */ - - /** - * Constructs a new QueryExpansionSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a QueryExpansionSpec. - * @implements IQueryExpansionSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - */ - function QueryExpansionSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryExpansionSpec condition. - * @member {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition} condition - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.condition = 0; - - /** - * QueryExpansionSpec pinUnexpandedResults. - * @member {boolean} pinUnexpandedResults - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.pinUnexpandedResults = false; - - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance - */ - QueryExpansionSpec.create = function create(properties) { - return new QueryExpansionSpec(properties); - }; - - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); - if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); - return writer; - }; - - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryExpansionSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - switch (message.condition) { - default: - return "condition: enum value expected"; - case 0: - case 1: - case 3: - break; - } - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - if (typeof message.pinUnexpandedResults !== "boolean") - return "pinUnexpandedResults: boolean expected"; - return null; - }; - - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - */ - QueryExpansionSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); - switch (object.condition) { - case "CONDITION_UNSPECIFIED": - case 0: - message.condition = 0; - break; - case "DISABLED": - case 1: - message.condition = 1; - break; - case "AUTO": - case 3: - message.condition = 3; - break; - } - if (object.pinUnexpandedResults != null) - message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); - return message; - }; - - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; - object.pinUnexpandedResults = false; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - object.pinUnexpandedResults = message.pinUnexpandedResults; - return object; - }; - - /** - * Converts this QueryExpansionSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Condition enum. - * @name google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition - * @enum {number} - * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} AUTO=3 AUTO value - */ - QueryExpansionSpec.Condition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[3] = "AUTO"] = 3; - return values; - })(); - - return QueryExpansionSpec; - })(); + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2.SearchService + * @instance + * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2.SearchRequest, $root.google.cloud.retail.v2.SearchResponse, request, callback); + }, "name", { value: "Search" }); /** - * SearchMode enum. - * @name google.cloud.retail.v2.SearchRequest.SearchMode - * @enum {number} - * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value - * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value - * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2.SearchService + * @instance + * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - SearchRequest.SearchMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; - values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; - return values; - })(); - return SearchRequest; + return SearchService; })(); - v2.SearchResponse = (function() { + v2.SearchRequest = (function() { /** - * Properties of a SearchResponse. + * Properties of a SearchRequest. * @memberof google.cloud.retail.v2 - * @interface ISearchResponse - * @property {Array.|null} [results] SearchResponse results - * @property {Array.|null} [facets] SearchResponse facets - * @property {number|null} [totalSize] SearchResponse totalSize - * @property {string|null} [correctedQuery] SearchResponse correctedQuery - * @property {string|null} [attributionToken] SearchResponse attributionToken - * @property {string|null} [nextPageToken] SearchResponse nextPageToken - * @property {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo - * @property {string|null} [redirectUri] SearchResponse redirectUri + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + * @property {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec */ /** - * Constructs a new SearchResponse. + * Constructs a new SearchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SearchResponse. - * @implements ISearchResponse + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest * @constructor - * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set */ - function SearchResponse(properties) { - this.results = []; - this.facets = []; + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20304,172 +19726,318 @@ } /** - * SearchResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.results = $util.emptyArray; + SearchRequest.prototype.placement = ""; /** - * SearchResponse facets. - * @member {Array.} facets - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.facets = $util.emptyArray; + SearchRequest.prototype.branch = ""; /** - * SearchResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.totalSize = 0; + SearchRequest.prototype.query = ""; /** - * SearchResponse correctedQuery. - * @member {string} correctedQuery - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.correctedQuery = ""; + SearchRequest.prototype.visitorId = ""; /** - * SearchResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest userInfo. + * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.attributionToken = ""; + SearchRequest.prototype.userInfo = null; /** - * SearchResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.nextPageToken = ""; + SearchRequest.prototype.pageSize = 0; /** - * SearchResponse queryExpansionInfo. - * @member {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.queryExpansionInfo = null; + SearchRequest.prototype.pageToken = ""; /** - * SearchResponse redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2.SearchResponse + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2.SearchRequest * @instance */ - SearchResponse.prototype.redirectUri = ""; + SearchRequest.prototype.offset = 0; /** - * Creates a new SearchResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchResponse - * @static - * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse instance + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.SearchRequest + * @instance */ - SearchResponse.create = function create(properties) { - return new SearchResponse(properties); - }; + SearchRequest.prototype.filter = ""; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchResponse - * @static - * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2.SearchRequest + * @instance */ - SearchResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.facets != null && message.facets.length) - for (var i = 0; i < message.facets.length; ++i) - $root.google.cloud.retail.v2.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); - if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); - if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) - $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + SearchRequest.prototype.canonicalFilter = ""; + + /** + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.orderBy = ""; + + /** + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.facetSpecs = $util.emptyArray; + + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; + + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; + + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; + + /** + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + + /** + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + + /** + * SearchRequest personalizationSpec. + * @member {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.personalizationSpec = null; + + /** + * Creates a new SearchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest instance + */ + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); + }; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); + if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) + $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); return writer; }; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @static - * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decode = function decode(reader, length) { + SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); + message.placement = reader.string(); break; case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); + message.branch = reader.string(); break; case 3: - message.totalSize = reader.int32(); + message.query = reader.string(); break; case 4: - message.correctedQuery = reader.string(); + message.visitorId = reader.string(); break; case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); break; case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); break; case 10: - message.redirectUri = reader.string(); + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 31: + message.searchMode = reader.int32(); + break; + case 32: + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -20480,208 +20048,339 @@ }; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decodeDelimited = function decodeDelimited(reader) { + SearchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchResponse message. + * Verifies a SearchRequest message. * @function verify - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.verify = function verify(message) { + SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchResponse.SearchResult.verify(message.results[i]); - if (error) - return "results." + error; - } + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; } - if (message.facets != null && message.hasOwnProperty("facets")) { - if (!Array.isArray(message.facets)) - return "facets: array expected"; - for (var i = 0; i < message.facets.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchResponse.Facet.verify(message.facets[i]); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); if (error) - return "facets." + error; + return "facetSpecs." + error; } } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - if (!$util.isString(message.correctedQuery)) - return "correctedQuery: string expected"; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { - var error = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); if (error) - return "queryExpansionInfo." + error; + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); + if (error) + return "personalizationSpec." + error; } - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; return null; }; /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest */ - SearchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse) + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest) return object; - var message = new $root.google.cloud.retail.v2.SearchResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.fromObject(object.results[i]); - } + var message = new $root.google.cloud.retail.v2.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); } - if (object.facets) { - if (!Array.isArray(object.facets)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: array expected"); - message.facets = []; - for (var i = 0; i < object.facets.length; ++i) { - if (typeof object.facets[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: object expected"); - message.facets[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.fromObject(object.facets[i]); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); } } - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; - if (object.correctedQuery != null) - message.correctedQuery = String(object.correctedQuery); - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.queryExpansionInfo != null) { - if (typeof object.queryExpansionInfo !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.queryExpansionInfo: object expected"); - message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } + if (object.personalizationSpec != null) { + if (typeof object.personalizationSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.personalizationSpec: object expected"); + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); } - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); return message; }; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @static - * @param {google.cloud.retail.v2.SearchResponse} message SearchResponse + * @param {google.cloud.retail.v2.SearchRequest} message SearchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchResponse.toObject = function toObject(message, options) { + SearchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { - object.results = []; - object.facets = []; + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; } if (options.defaults) { - object.totalSize = 0; - object.correctedQuery = ""; - object.attributionToken = ""; - object.nextPageToken = ""; - object.queryExpansionInfo = null; - object.redirectUri = ""; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.toObject(message.results[j], options); - } - if (message.facets && message.facets.length) { - object.facets = []; - for (var j = 0; j < message.facets.length; ++j) - object.facets[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.toObject(message.facets[j], options); + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; + object.personalizationSpec = null; } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - object.correctedQuery = message.correctedQuery; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) - object.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) + object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); return object; }; /** - * Converts this SearchResponse to JSON. + * Converts this SearchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.SearchRequest * @instance * @returns {Object.} JSON object */ - SearchResponse.prototype.toJSON = function toJSON() { + SearchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchResponse.SearchResult = (function() { + SearchRequest.FacetSpec = (function() { /** - * Properties of a SearchResult. - * @memberof google.cloud.retail.v2.SearchResponse - * @interface ISearchResult - * @property {string|null} [id] SearchResult id - * @property {google.cloud.retail.v2.IProduct|null} [product] SearchResult product - * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount - * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields - * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition */ /** - * Constructs a new SearchResult. - * @memberof google.cloud.retail.v2.SearchResponse - * @classdesc Represents a SearchResult. - * @implements ISearchResult + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec * @constructor - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set */ - function SearchResult(properties) { - this.matchingVariantFields = {}; - this.variantRollupValues = {}; + function FacetSpec(properties) { + this.excludedFilterKeys = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20689,171 +20388,117 @@ } /** - * SearchResult id. - * @member {string} id - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.id = ""; - - /** - * SearchResult product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * FacetSpec facetKey. + * @member {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @instance */ - SearchResult.prototype.product = null; + FacetSpec.prototype.facetKey = null; /** - * SearchResult matchingVariantCount. - * @member {number} matchingVariantCount - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @instance */ - SearchResult.prototype.matchingVariantCount = 0; + FacetSpec.prototype.limit = 0; /** - * SearchResult matchingVariantFields. - * @member {Object.} matchingVariantFields - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @instance */ - SearchResult.prototype.matchingVariantFields = $util.emptyObject; + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; /** - * SearchResult variantRollupValues. - * @member {Object.} variantRollupValues - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @instance */ - SearchResult.prototype.variantRollupValues = $util.emptyObject; + FacetSpec.prototype.enableDynamicPosition = false; /** - * Creates a new SearchResult instance using the specified properties. + * Creates a new FacetSpec instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult instance + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec instance */ - SearchResult.create = function create(properties) { - return new SearchResult(properties); + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); }; /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResult.encode = function encode(message, writer) { + FacetSpec.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); - if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) - for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) - for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); return writer; }; /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchResult message from the specified reader or buffer. + * Decodes a FacetSpec message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResult.decode = function decode(reader, length) { + FacetSpec.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.string(); + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); break; case 2: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + message.limit = reader.int32(); break; case 3: - message.matchingVariantCount = reader.int32(); + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); break; case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.variantRollupValues[key] = value; + message.enableDynamicPosition = reader.bool(); break; default: reader.skipType(tag & 7); @@ -20864,553 +20509,323 @@ }; /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResult.decodeDelimited = function decodeDelimited(reader) { + FacetSpec.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchResult message. + * Verifies a FacetSpec message. * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResult.verify = function verify(message) { + FacetSpec.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); if (error) - return "product." + error; - } - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - if (!$util.isInteger(message.matchingVariantCount)) - return "matchingVariantCount: integer expected"; - if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { - if (!$util.isObject(message.matchingVariantFields)) - return "matchingVariantFields: object expected"; - var key = Object.keys(message.matchingVariantFields); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); - if (error) - return "matchingVariantFields." + error; - } + return "facetKey." + error; } - if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { - if (!$util.isObject(message.variantRollupValues)) - return "variantRollupValues: object expected"; - var key = Object.keys(message.variantRollupValues); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); - if (error) - return "variantRollupValues." + error; - } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; return null; }; /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec */ - SearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.SearchResult) + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec) return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(); - if (object.id != null) - message.id = String(object.id); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); - } - if (object.matchingVariantCount != null) - message.matchingVariantCount = object.matchingVariantCount | 0; - if (object.matchingVariantFields) { - if (typeof object.matchingVariantFields !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields = {}; - for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { - if (typeof object.matchingVariantFields[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); - } + var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); } - if (object.variantRollupValues) { - if (typeof object.variantRollupValues !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues = {}; - for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { - if (typeof object.variantRollupValues[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); - } + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); return message; }; /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.SearchResult} message SearchResult + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec} message FacetSpec * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchResult.toObject = function toObject(message, options) { + FacetSpec.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.matchingVariantFields = {}; - object.variantRollupValues = {}; - } + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; if (options.defaults) { - object.id = ""; - object.product = null; - object.matchingVariantCount = 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - object.matchingVariantCount = message.matchingVariantCount; - var keys2; - if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { - object.matchingVariantFields = {}; - for (var j = 0; j < keys2.length; ++j) - object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; } - if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { - object.variantRollupValues = {}; - for (var j = 0; j < keys2.length; ++j) - object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; return object; }; /** - * Converts this SearchResult to JSON. + * Converts this FacetSpec to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec * @instance * @returns {Object.} JSON object */ - SearchResult.prototype.toJSON = function toJSON() { + FacetSpec.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SearchResult; - })(); - - SearchResponse.Facet = (function() { + FacetSpec.FacetKey = (function() { - /** - * Properties of a Facet. - * @memberof google.cloud.retail.v2.SearchResponse - * @interface IFacet - * @property {string|null} [key] Facet key - * @property {Array.|null} [values] Facet values - * @property {boolean|null} [dynamicFacet] Facet dynamicFacet - */ + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ - /** - * Constructs a new Facet. - * @memberof google.cloud.retail.v2.SearchResponse - * @classdesc Represents a Facet. - * @implements IFacet - * @constructor - * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set - */ - function Facet(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Facet key. - * @member {string} key - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - */ - Facet.prototype.key = ""; + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; - /** - * Facet values. - * @member {Array.} values - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - */ - Facet.prototype.values = $util.emptyArray; + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; - /** - * Facet dynamicFacet. - * @member {boolean} dynamicFacet - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - */ - Facet.prototype.dynamicFacet = false; - - /** - * Creates a new Facet instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet instance - */ - Facet.create = function create(properties) { - return new Facet(properties); - }; - - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); - return writer; - }; - - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Facet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Facet message. - * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Facet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - if (typeof message.dynamicFacet !== "boolean") - return "dynamicFacet: boolean expected"; - return null; - }; - - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet - */ - Facet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet) - return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); - if (object.key != null) - message.key = String(object.key); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: object expected"); - message.values[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); - } - } - if (object.dynamicFacet != null) - message.dynamicFacet = Boolean(object.dynamicFacet); - return message; - }; - - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet} message Facet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Facet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (options.defaults) { - object.key = ""; - object.dynamicFacet = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - object.dynamicFacet = message.dynamicFacet; - return object; - }; - - /** - * Converts this Facet to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - * @returns {Object.} JSON object - */ - Facet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - Facet.FacetValue = (function() { - - /** - * Properties of a FacetValue. - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @interface IFacetValue - * @property {string|null} [value] FacetValue value - * @property {google.cloud.retail.v2.IInterval|null} [interval] FacetValue interval - * @property {number|Long|null} [count] FacetValue count - */ - - /** - * Constructs a new FacetValue. - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @classdesc Represents a FacetValue. - * @implements IFacetValue - * @constructor - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - */ - function FacetValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; /** - * FacetValue value. - * @member {string|null|undefined} value - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @instance */ - FacetValue.prototype.value = null; + FacetKey.prototype.prefixes = $util.emptyArray; /** - * FacetValue interval. - * @member {google.cloud.retail.v2.IInterval|null|undefined} interval - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @instance */ - FacetValue.prototype.interval = null; + FacetKey.prototype.contains = $util.emptyArray; /** - * FacetValue count. - * @member {number|Long} count - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @instance */ - FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + FacetKey.prototype.orderBy = ""; /** - * FacetValue facetValue. - * @member {"value"|"interval"|undefined} facetValue - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @instance */ - Object.defineProperty(FacetValue.prototype, "facetValue", { - get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), - set: $util.oneOfSetter($oneOfFields) - }); + FacetKey.prototype.query = ""; /** - * Creates a new FacetValue instance using the specified properties. + * Creates a new FacetKey instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue instance + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey instance */ - FacetValue.create = function create(properties) { - return new FacetValue(properties); + FacetKey.create = function create(properties) { + return new FacetKey(properties); }; /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FacetValue.encode = function encode(message, writer) { + FacetKey.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) - $root.google.cloud.retail.v2.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); return writer; }; /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FacetValue message from the specified reader or buffer. + * Decodes a FacetKey message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FacetValue.decode = function decode(reader, length) { + FacetKey.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.value = reader.string(); + message.key = reader.string(); break; case 2: - message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); break; case 3: - message.count = reader.int64(); + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); break; default: reader.skipType(tag & 7); @@ -21421,158 +20836,214 @@ }; /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * Decodes a FacetKey message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FacetValue.decodeDelimited = function decodeDelimited(reader) { + FacetKey.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FacetValue message. + * Verifies a FacetKey message. * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FacetValue.verify = function verify(message) { + FacetKey.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.value != null && message.hasOwnProperty("value")) { - properties.facetValue = 1; - if (!$util.isString(message.value)) - return "value: string expected"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - if (properties.facetValue === 1) - return "facetValue: multiple values"; - properties.facetValue = 1; - { - var error = $root.google.cloud.retail.v2.Interval.verify(message.interval); + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.intervals[i]); if (error) - return "interval." + error; + return "intervals." + error; } } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; return null; }; /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey */ - FacetValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue) + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey) return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); - if (object.value != null) - message.value = String(object.value); - if (object.interval != null) { - if (typeof object.interval !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval: object expected"); - message.interval = $root.google.cloud.retail.v2.Interval.fromObject(object.interval); + var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2.Interval.fromObject(object.intervals[i]); + } } - if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); return message; }; /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} message FacetValue + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} message FacetKey * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FacetValue.toObject = function toObject(message, options) { + FacetKey.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) { - object.value = message.value; - if (options.oneofs) - object.facetValue = "value"; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; } - if (message.interval != null && message.hasOwnProperty("interval")) { - object.interval = $root.google.cloud.retail.v2.Interval.toObject(message.interval, options); - if (options.oneofs) - object.facetValue = "interval"; + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; } - if (message.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; return object; }; /** - * Converts this FacetValue to JSON. + * Converts this FacetKey to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey * @instance * @returns {Object.} JSON object */ - FacetValue.prototype.toJSON = function toJSON() { + FacetKey.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FacetValue; + return FacetKey; })(); - return Facet; + return FacetSpec; })(); - SearchResponse.QueryExpansionInfo = (function() { + SearchRequest.DynamicFacetSpec = (function() { /** - * Properties of a QueryExpansionInfo. - * @memberof google.cloud.retail.v2.SearchResponse - * @interface IQueryExpansionInfo - * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery - * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode */ /** - * Constructs a new QueryExpansionInfo. - * @memberof google.cloud.retail.v2.SearchResponse - * @classdesc Represents a QueryExpansionInfo. - * @implements IQueryExpansionInfo + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec * @constructor - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set */ - function QueryExpansionInfo(properties) { + function DynamicFacetSpec(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21580,88 +21051,75 @@ } /** - * QueryExpansionInfo expandedQuery. - * @member {boolean} expandedQuery - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.expandedQuery = false; - - /** - * QueryExpansionInfo pinnedResultCount. - * @member {number|Long} pinnedResultCount - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @instance */ - QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DynamicFacetSpec.prototype.mode = 0; /** - * Creates a new QueryExpansionInfo instance using the specified properties. + * Creates a new DynamicFacetSpec instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance */ - QueryExpansionInfo.create = function create(properties) { - return new QueryExpansionInfo(properties); + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); }; /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - QueryExpansionInfo.encode = function encode(message, writer) { + DynamicFacetSpec.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); - if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); return writer; }; /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * Decodes a DynamicFacetSpec message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryExpansionInfo.decode = function decode(reader, length) { + DynamicFacetSpec.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); + message.mode = reader.int32(); break; default: reader.skipType(tag & 7); @@ -21672,551 +21130,1097 @@ }; /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a QueryExpansionInfo message. + * Verifies a DynamicFacetSpec message. * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - QueryExpansionInfo.verify = function verify(message) { + DynamicFacetSpec.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - if (typeof message.expandedQuery !== "boolean") - return "expandedQuery: boolean expected"; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) - return "pinnedResultCount: integer|Long expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec */ - QueryExpansionInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo) + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec) return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); - if (object.expandedQuery != null) - message.expandedQuery = Boolean(object.expandedQuery); - if (object.pinnedResultCount != null) - if ($util.Long) - (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; - else if (typeof object.pinnedResultCount === "string") - message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); - else if (typeof object.pinnedResultCount === "number") - message.pinnedResultCount = object.pinnedResultCount; - else if (typeof object.pinnedResultCount === "object") - message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } return message; }; /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @static - * @param {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - QueryExpansionInfo.toObject = function toObject(message, options) { + DynamicFacetSpec.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.expandedQuery = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pinnedResultCount = options.longs === String ? "0" : 0; - } - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - object.expandedQuery = message.expandedQuery; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (typeof message.pinnedResultCount === "number") - object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; - else - object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; return object; }; /** - * Converts this QueryExpansionInfo to JSON. + * Converts this DynamicFacetSpec to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec * @instance * @returns {Object.} JSON object */ - QueryExpansionInfo.prototype.toJSON = function toJSON() { + DynamicFacetSpec.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return QueryExpansionInfo; - })(); + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); - return SearchResponse; - })(); + return DynamicFacetSpec; + })(); - v2.UserEventService = (function() { + SearchRequest.BoostSpec = (function() { - /** - * Constructs a new UserEventService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function UserEventService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + * @property {boolean|null} [skipBoostSpecValidation] BoostSpec skipBoostSpecValidation + */ - (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates new UserEventService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.UserEventService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. - */ - UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef WriteUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.UserEvent} [response] UserEvent - */ + /** + * BoostSpec skipBoostSpecValidation. + * @member {boolean|null|undefined} skipBoostSpecValidation + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.skipBoostSpecValidation = null; - /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { - return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2.WriteUserEventRequest, $root.google.cloud.retail.v2.UserEvent, request, callback); - }, "name", { value: "WriteUserEvent" }); + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * BoostSpec _skipBoostSpecValidation. + * @member {"skipBoostSpecValidation"|undefined} _skipBoostSpecValidation + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + Object.defineProperty(BoostSpec.prototype, "_skipBoostSpecValidation", { + get: $util.oneOfGetter($oneOfFields = ["skipBoostSpecValidation"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef CollectUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.api.HttpBody} [response] HttpBody - */ + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; - /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { - return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); - }, "name", { value: "CollectUserEvent" }); + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.skipBoostSpecValidation != null && Object.hasOwnProperty.call(message, "skipBoostSpecValidation")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.skipBoostSpecValidation); + return writer; + }; - /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef PurgeUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + case 2: + message.skipBoostSpecValidation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { - return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "PurgeUserEvents" }); + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + properties._skipBoostSpecValidation = 1; + if (typeof message.skipBoostSpecValidation !== "boolean") + return "skipBoostSpecValidation: boolean expected"; + } + return null; + }; - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef ImportUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + if (object.skipBoostSpecValidation != null) + message.skipBoostSpecValidation = Boolean(object.skipBoostSpecValidation); + return message; + }; - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { - return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportUserEvents" }); + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + object.skipBoostSpecValidation = message.skipBoostSpecValidation; + if (options.oneofs) + object._skipBoostSpecValidation = "skipBoostSpecValidation"; + } + return object; + }; - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. - * @memberof google.cloud.retail.v2.UserEventService - * @typedef RejoinUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ + BoostSpec.ConditionBoostSpec = (function() { - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @param {google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { - return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RejoinUserEvents" }); + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2.UserEventService - * @instance - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - return UserEventService; - })(); + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; - v2.WriteUserEventRequest = (function() { + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; - /** - * Properties of a WriteUserEventRequest. - * @memberof google.cloud.retail.v2 - * @interface IWriteUserEventRequest - * @property {string|null} [parent] WriteUserEventRequest parent - * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent - */ + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; - /** - * Constructs a new WriteUserEventRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a WriteUserEventRequest. - * @implements IWriteUserEventRequest - * @constructor - * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set - */ - function WriteUserEventRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; - /** - * WriteUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.parent = ""; + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * WriteUserEventRequest userEvent. - * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.userEvent = null; + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new WriteUserEventRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest instance - */ - WriteUserEventRequest.create = function create(properties) { - return new WriteUserEventRequest(properties); - }; + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteUserEventRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; - /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; - /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WriteUserEventRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; - /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a WriteUserEventRequest message. - * @function verify - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WriteUserEventRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } - return null; - }; + return ConditionBoostSpec; + })(); - /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest - */ - WriteUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.WriteUserEventRequest) - return object; - var message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2.WriteUserEventRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); - } - return message; - }; + return BoostSpec; + })(); - /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @static - * @param {google.cloud.retail.v2.WriteUserEventRequest} message WriteUserEventRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WriteUserEventRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); - return object; - }; + SearchRequest.QueryExpansionSpec = (function() { - /** - * Converts this WriteUserEventRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.WriteUserEventRequest - * @instance - * @returns {Object.} JSON object - */ - WriteUserEventRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults + */ - return WriteUserEventRequest; + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; + + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); + return writer; + }; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.int32(); + break; + case 2: + message.pinUnexpandedResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; + } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; + return object; + }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Condition enum. + * @name google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; + })(); + + SearchRequest.PersonalizationSpec = (function() { + + /** + * Properties of a PersonalizationSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IPersonalizationSpec + * @property {google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|null} [mode] PersonalizationSpec mode + */ + + /** + * Constructs a new PersonalizationSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a PersonalizationSpec. + * @implements IPersonalizationSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + */ + function PersonalizationSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PersonalizationSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @instance + */ + PersonalizationSpec.prototype.mode = 0; + + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec instance + */ + PersonalizationSpec.create = function create(properties) { + return new PersonalizationSpec(properties); + }; + + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PersonalizationSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersonalizationSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec + */ + PersonalizationSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "AUTO": + case 1: + message.mode = 1; + break; + case "DISABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} message PersonalizationSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersonalizationSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this PersonalizationSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @instance + * @returns {Object.} JSON object + */ + PersonalizationSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} AUTO=1 AUTO value + * @property {number} DISABLED=2 DISABLED value + */ + PersonalizationSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); + + return PersonalizationSpec; + })(); + + /** + * SearchMode enum. + * @name google.cloud.retail.v2.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + */ + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); + + return SearchRequest; })(); - v2.CollectUserEventRequest = (function() { + v2.SearchResponse = (function() { /** - * Properties of a CollectUserEventRequest. + * Properties of a SearchResponse. * @memberof google.cloud.retail.v2 - * @interface ICollectUserEventRequest - * @property {string|null} [parent] CollectUserEventRequest parent - * @property {string|null} [userEvent] CollectUserEventRequest userEvent - * @property {string|null} [uri] CollectUserEventRequest uri - * @property {number|Long|null} [ets] CollectUserEventRequest ets + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * @property {Array.|null} [invalidConditionBoostSpecs] SearchResponse invalidConditionBoostSpecs */ /** - * Constructs a new CollectUserEventRequest. + * Constructs a new SearchResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CollectUserEventRequest. - * @implements ICollectUserEventRequest + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse * @constructor - * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set */ - function CollectUserEventRequest(properties) { + function SearchResponse(properties) { + this.results = []; + this.facets = []; + this.appliedControls = []; + this.invalidConditionBoostSpecs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22224,354 +22228,204 @@ } /** - * CollectUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - CollectUserEventRequest.prototype.parent = ""; + SearchResponse.prototype.results = $util.emptyArray; /** - * CollectUserEventRequest userEvent. - * @member {string} userEvent - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - CollectUserEventRequest.prototype.userEvent = ""; + SearchResponse.prototype.facets = $util.emptyArray; /** - * CollectUserEventRequest uri. - * @member {string} uri - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - CollectUserEventRequest.prototype.uri = ""; + SearchResponse.prototype.totalSize = 0; /** - * CollectUserEventRequest ets. - * @member {number|Long} ets - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + SearchResponse.prototype.correctedQuery = ""; /** - * Creates a new CollectUserEventRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest instance + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.SearchResponse + * @instance */ - CollectUserEventRequest.create = function create(properties) { - return new CollectUserEventRequest(properties); - }; + SearchResponse.prototype.attributionToken = ""; /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.SearchResponse + * @instance */ - CollectUserEventRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); - if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); - return writer; - }; - - /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CollectUserEventRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CollectUserEventRequest message. - * @function verify - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CollectUserEventRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - if (!$util.isString(message.userEvent)) - return "userEvent: string expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.ets != null && message.hasOwnProperty("ets")) - if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) - return "ets: integer|Long expected"; - return null; - }; - - /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest - */ - CollectUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CollectUserEventRequest) - return object; - var message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) - message.userEvent = String(object.userEvent); - if (object.uri != null) - message.uri = String(object.uri); - if (object.ets != null) - if ($util.Long) - (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; - else if (typeof object.ets === "string") - message.ets = parseInt(object.ets, 10); - else if (typeof object.ets === "number") - message.ets = object.ets; - else if (typeof object.ets === "object") - message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2.CollectUserEventRequest} message CollectUserEventRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CollectUserEventRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = ""; - object.uri = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.ets = options.longs === String ? "0" : 0; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = message.userEvent; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.ets != null && message.hasOwnProperty("ets")) - if (typeof message.ets === "number") - object.ets = options.longs === String ? String(message.ets) : message.ets; - else - object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; - return object; - }; + SearchResponse.prototype.nextPageToken = ""; /** - * Converts this CollectUserEventRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CollectUserEventRequest + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2.SearchResponse * @instance - * @returns {Object.} JSON object - */ - CollectUserEventRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CollectUserEventRequest; - })(); - - v2.RejoinUserEventsRequest = (function() { - - /** - * Properties of a RejoinUserEventsRequest. - * @memberof google.cloud.retail.v2 - * @interface IRejoinUserEventsRequest - * @property {string|null} [parent] RejoinUserEventsRequest parent - * @property {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope */ + SearchResponse.prototype.queryExpansionInfo = null; /** - * Constructs a new RejoinUserEventsRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a RejoinUserEventsRequest. - * @implements IRejoinUserEventsRequest - * @constructor - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2.SearchResponse + * @instance */ - function RejoinUserEventsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + SearchResponse.prototype.redirectUri = ""; /** - * RejoinUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - RejoinUserEventsRequest.prototype.parent = ""; + SearchResponse.prototype.appliedControls = $util.emptyArray; /** - * RejoinUserEventsRequest userEventRejoinScope. - * @member {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * SearchResponse invalidConditionBoostSpecs. + * @member {Array.} invalidConditionBoostSpecs + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + SearchResponse.prototype.invalidConditionBoostSpecs = $util.emptyArray; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest instance + * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse instance */ - RejoinUserEventsRequest.create = function create(properties) { - return new RejoinUserEventsRequest(properties); + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); }; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsRequest.encode = function encode(message, writer) { + SearchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + if (message.invalidConditionBoostSpecs != null && message.invalidConditionBoostSpecs.length) + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.invalidConditionBoostSpecs[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); return writer; }; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsRequest.decode = function decode(reader, length) { + SearchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); break; case 2: - message.userEventRejoinScope = reader.int32(); + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + case 3: + message.totalSize = reader.int32(); + break; + case 4: + message.correctedQuery = reader.string(); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + message.nextPageToken = reader.string(); + break; + case 7: + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + case 10: + message.redirectUri = reader.string(); + break; + case 12: + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; + case 14: + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -22582,1366 +22436,1660 @@ }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + SearchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsRequest message. + * Verifies a SearchResponse message. * @function verify - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsRequest.verify = function verify(message) { + SearchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - switch (message.userEventRejoinScope) { - default: - return "userEventRejoinScope: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.SearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.Facet.verify(message.facets[i]); + if (error) + return "facets." + error; + } + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (error) + return "queryExpansionInfo." + error; + } + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; + } + if (message.invalidConditionBoostSpecs != null && message.hasOwnProperty("invalidConditionBoostSpecs")) { + if (!Array.isArray(message.invalidConditionBoostSpecs)) + return "invalidConditionBoostSpecs: array expected"; + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.invalidConditionBoostSpecs[i]); + if (error) + return "invalidConditionBoostSpecs." + error; } + } return null; }; /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse */ - RejoinUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsRequest) + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse) return object; - var message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - switch (object.userEventRejoinScope) { - case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": - case 0: - message.userEventRejoinScope = 0; - break; - case "JOINED_EVENTS": - case 1: - message.userEventRejoinScope = 1; - break; - case "UNJOINED_EVENTS": - case 2: - message.userEventRejoinScope = 2; - break; + var message = new $root.google.cloud.retail.v2.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.fromObject(object.results[i]); + } + } + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.fromObject(object.facets[i]); + } + } + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); + } + if (object.invalidConditionBoostSpecs) { + if (!Array.isArray(object.invalidConditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.invalidConditionBoostSpecs: array expected"); + message.invalidConditionBoostSpecs = []; + for (var i = 0; i < object.invalidConditionBoostSpecs.length; ++i) { + if (typeof object.invalidConditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.invalidConditionBoostSpecs: object expected"); + message.invalidConditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.invalidConditionBoostSpecs[i]); + } } return message; }; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {google.cloud.retail.v2.SearchResponse} message SearchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsRequest.toObject = function toObject(message, options) { + SearchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + object.appliedControls = []; + object.invalidConditionBoostSpecs = []; + } if (options.defaults) { - object.parent = ""; - object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; - return object; - }; - - /** - * Converts this RejoinUserEventsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.RejoinUserEventsRequest - * @instance - * @returns {Object.} JSON object - */ - RejoinUserEventsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * UserEventRejoinScope enum. - * @name google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope - * @enum {number} - * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value - * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value - * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value - */ - RejoinUserEventsRequest.UserEventRejoinScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "JOINED_EVENTS"] = 1; - values[valuesById[2] = "UNJOINED_EVENTS"] = 2; - return values; - })(); - - return RejoinUserEventsRequest; - })(); - - v2.RejoinUserEventsResponse = (function() { - - /** - * Properties of a RejoinUserEventsResponse. - * @memberof google.cloud.retail.v2 - * @interface IRejoinUserEventsResponse - * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount - */ - - /** - * Constructs a new RejoinUserEventsResponse. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a RejoinUserEventsResponse. - * @implements IRejoinUserEventsResponse - * @constructor - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set - */ - function RejoinUserEventsResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RejoinUserEventsResponse rejoinedUserEventsCount. - * @member {number|Long} rejoinedUserEventsCount - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @instance - */ - RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse instance - */ - RejoinUserEventsResponse.create = function create(properties) { - return new RejoinUserEventsResponse(properties); - }; - - /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); - return writer; - }; - - /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.rejoinedUserEventsCount = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; + } + if (message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length) { + object.invalidConditionBoostSpecs = []; + for (var j = 0; j < message.invalidConditionBoostSpecs.length; ++j) + object.invalidConditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.invalidConditionBoostSpecs[j], options); } - return message; - }; - - /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RejoinUserEventsResponse message. - * @function verify - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RejoinUserEventsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) - return "rejoinedUserEventsCount: integer|Long expected"; - return null; - }; - - /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse - */ - RejoinUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsResponse) - return object; - var message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); - if (object.rejoinedUserEventsCount != null) - if ($util.Long) - (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; - else if (typeof object.rejoinedUserEventsCount === "string") - message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); - else if (typeof object.rejoinedUserEventsCount === "number") - message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; - else if (typeof object.rejoinedUserEventsCount === "object") - message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2.RejoinUserEventsResponse} message RejoinUserEventsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RejoinUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (typeof message.rejoinedUserEventsCount === "number") - object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; - else - object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; return object; }; /** - * Converts this RejoinUserEventsResponse to JSON. + * Converts this SearchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @memberof google.cloud.retail.v2.SearchResponse * @instance * @returns {Object.} JSON object */ - RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + SearchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RejoinUserEventsResponse; - })(); - - v2.RejoinUserEventsMetadata = (function() { - - /** - * Properties of a RejoinUserEventsMetadata. - * @memberof google.cloud.retail.v2 - * @interface IRejoinUserEventsMetadata - */ - - /** - * Constructs a new RejoinUserEventsMetadata. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a RejoinUserEventsMetadata. - * @implements IRejoinUserEventsMetadata - * @constructor - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set - */ - function RejoinUserEventsMetadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance - */ - RejoinUserEventsMetadata.create = function create(properties) { - return new RejoinUserEventsMetadata(properties); - }; - - /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; + SearchResponse.SearchResult = (function() { - /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + */ - /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return message; - }; - - /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RejoinUserEventsMetadata message. - * @function verify - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RejoinUserEventsMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata - */ - RejoinUserEventsMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsMetadata) - return object; - return new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); - }; + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; - /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2.RejoinUserEventsMetadata} message RejoinUserEventsMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RejoinUserEventsMetadata.toObject = function toObject() { - return {}; - }; + /** + * SearchResult product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; - /** - * Converts this RejoinUserEventsMetadata to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata - * @instance - * @returns {Object.} JSON object - */ - RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; - return RejoinUserEventsMetadata; - })(); + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; - return v2; - })(); + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; - retail.v2alpha = (function() { + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; - /** - * Namespace v2alpha. - * @memberof google.cloud.retail - * @namespace - */ - var v2alpha = {}; + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; - v2alpha.ProductLevelConfig = (function() { + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Properties of a ProductLevelConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IProductLevelConfig - * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType - * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField - */ - - /** - * Constructs a new ProductLevelConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductLevelConfig. - * @implements IProductLevelConfig - * @constructor - * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set - */ - function ProductLevelConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ProductLevelConfig ingestionProductType. - * @member {string} ingestionProductType - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @instance - */ - ProductLevelConfig.prototype.ingestionProductType = ""; - - /** - * ProductLevelConfig merchantCenterProductIdField. - * @member {string} merchantCenterProductIdField - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @instance - */ - ProductLevelConfig.prototype.merchantCenterProductIdField = ""; - - /** - * Creates a new ProductLevelConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig instance - */ - ProductLevelConfig.create = function create(properties) { - return new ProductLevelConfig(properties); - }; - - /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductLevelConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); - if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); - return writer; - }; + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductLevelConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ingestionProductType = reader.string(); - break; - case 2: - message.merchantCenterProductIdField = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; } - } - return message; - }; - - /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + return null; + }; - /** - * Verifies a ProductLevelConfig message. - * @function verify - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductLevelConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - if (!$util.isString(message.ingestionProductType)) - return "ingestionProductType: string expected"; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - if (!$util.isString(message.merchantCenterProductIdField)) - return "merchantCenterProductIdField: string expected"; - return null; - }; + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } + return message; + }; - /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig - */ - ProductLevelConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductLevelConfig) + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; + } + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } return object; - var message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); - if (object.ingestionProductType != null) - message.ingestionProductType = String(object.ingestionProductType); - if (object.merchantCenterProductIdField != null) - message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); - return message; - }; + }; - /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2alpha.ProductLevelConfig} message ProductLevelConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductLevelConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.ingestionProductType = ""; - object.merchantCenterProductIdField = ""; - } - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - object.ingestionProductType = message.ingestionProductType; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - object.merchantCenterProductIdField = message.merchantCenterProductIdField; - return object; - }; + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this ProductLevelConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductLevelConfig - * @instance - * @returns {Object.} JSON object - */ - ProductLevelConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return SearchResult; + })(); - return ProductLevelConfig; - })(); + SearchResponse.Facet = (function() { - v2alpha.MerchantCenterLink = (function() { + /** + * Properties of a Facet. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet + */ - /** - * Properties of a MerchantCenterLink. - * @memberof google.cloud.retail.v2alpha - * @interface IMerchantCenterLink - * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId - * @property {string|null} [branchId] MerchantCenterLink branchId - * @property {Array.|null} [destinations] MerchantCenterLink destinations - * @property {string|null} [regionCode] MerchantCenterLink regionCode - * @property {string|null} [languageCode] MerchantCenterLink languageCode - */ + /** + * Constructs a new Facet. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set + */ + function Facet(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new MerchantCenterLink. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a MerchantCenterLink. - * @implements IMerchantCenterLink - * @constructor - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set - */ - function MerchantCenterLink(properties) { - this.destinations = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + */ + Facet.prototype.key = ""; - /** - * MerchantCenterLink merchantCenterAccountId. - * @member {number|Long} merchantCenterAccountId - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @instance - */ - MerchantCenterLink.prototype.merchantCenterAccountId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; - /** - * MerchantCenterLink branchId. - * @member {string} branchId - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @instance - */ - MerchantCenterLink.prototype.branchId = ""; + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; - /** - * MerchantCenterLink destinations. - * @member {Array.} destinations - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @instance - */ - MerchantCenterLink.prototype.destinations = $util.emptyArray; - - /** - * MerchantCenterLink regionCode. - * @member {string} regionCode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @instance - */ - MerchantCenterLink.prototype.regionCode = ""; + /** + * Creates a new Facet instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet instance + */ + Facet.create = function create(properties) { + return new Facet(properties); + }; - /** - * MerchantCenterLink languageCode. - * @member {string} languageCode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @instance - */ - MerchantCenterLink.prototype.languageCode = ""; + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); + return writer; + }; - /** - * Creates a new MerchantCenterLink instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink instance - */ - MerchantCenterLink.create = function create(properties) { - return new MerchantCenterLink(properties); - }; + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerchantCenterLink.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.merchantCenterAccountId != null && Object.hasOwnProperty.call(message, "merchantCenterAccountId")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.merchantCenterAccountId); - if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); - if (message.destinations != null && message.destinations.length) - for (var i = 0; i < message.destinations.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); - if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.regionCode); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.languageCode); - return writer; - }; + /** + * Decodes a Facet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerchantCenterLink.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a MerchantCenterLink message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerchantCenterLink.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.merchantCenterAccountId = reader.int64(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - if (!(message.destinations && message.destinations.length)) - message.destinations = []; - message.destinations.push(reader.string()); - break; - case 4: - message.regionCode = reader.string(); - break; - case 5: - message.languageCode = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Verifies a Facet message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Facet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } } - } - return message; - }; - - /** - * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerchantCenterLink.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; + return null; + }; - /** - * Verifies a MerchantCenterLink message. - * @function verify - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MerchantCenterLink.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) - if (!$util.isInteger(message.merchantCenterAccountId) && !(message.merchantCenterAccountId && $util.isInteger(message.merchantCenterAccountId.low) && $util.isInteger(message.merchantCenterAccountId.high))) - return "merchantCenterAccountId: integer|Long expected"; - if (message.branchId != null && message.hasOwnProperty("branchId")) - if (!$util.isString(message.branchId)) - return "branchId: string expected"; - if (message.destinations != null && message.hasOwnProperty("destinations")) { - if (!Array.isArray(message.destinations)) - return "destinations: array expected"; - for (var i = 0; i < message.destinations.length; ++i) - if (!$util.isString(message.destinations[i])) - return "destinations: string[] expected"; - } - if (message.regionCode != null && message.hasOwnProperty("regionCode")) - if (!$util.isString(message.regionCode)) - return "regionCode: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - return null; - }; + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet + */ + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); + return message; + }; - /** - * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink - */ - MerchantCenterLink.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLink) + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet} message Facet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Facet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; return object; - var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); - if (object.merchantCenterAccountId != null) - if ($util.Long) - (message.merchantCenterAccountId = $util.Long.fromValue(object.merchantCenterAccountId)).unsigned = false; - else if (typeof object.merchantCenterAccountId === "string") - message.merchantCenterAccountId = parseInt(object.merchantCenterAccountId, 10); - else if (typeof object.merchantCenterAccountId === "number") - message.merchantCenterAccountId = object.merchantCenterAccountId; - else if (typeof object.merchantCenterAccountId === "object") - message.merchantCenterAccountId = new $util.LongBits(object.merchantCenterAccountId.low >>> 0, object.merchantCenterAccountId.high >>> 0).toNumber(); - if (object.branchId != null) - message.branchId = String(object.branchId); - if (object.destinations) { - if (!Array.isArray(object.destinations)) - throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLink.destinations: array expected"); - message.destinations = []; - for (var i = 0; i < object.destinations.length; ++i) - message.destinations[i] = String(object.destinations[i]); - } - if (object.regionCode != null) - message.regionCode = String(object.regionCode); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; + }; - /** - * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @static - * @param {google.cloud.retail.v2alpha.MerchantCenterLink} message MerchantCenterLink - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MerchantCenterLink.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.destinations = []; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.merchantCenterAccountId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.merchantCenterAccountId = options.longs === String ? "0" : 0; - object.branchId = ""; - object.regionCode = ""; - object.languageCode = ""; - } - if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) - if (typeof message.merchantCenterAccountId === "number") - object.merchantCenterAccountId = options.longs === String ? String(message.merchantCenterAccountId) : message.merchantCenterAccountId; - else - object.merchantCenterAccountId = options.longs === String ? $util.Long.prototype.toString.call(message.merchantCenterAccountId) : options.longs === Number ? new $util.LongBits(message.merchantCenterAccountId.low >>> 0, message.merchantCenterAccountId.high >>> 0).toNumber() : message.merchantCenterAccountId; - if (message.branchId != null && message.hasOwnProperty("branchId")) - object.branchId = message.branchId; - if (message.destinations && message.destinations.length) { - object.destinations = []; - for (var j = 0; j < message.destinations.length; ++j) - object.destinations[j] = message.destinations[j]; - } - if (message.regionCode != null && message.hasOwnProperty("regionCode")) - object.regionCode = message.regionCode; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - return object; - }; + /** + * Converts this Facet to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @instance + * @returns {Object.} JSON object + */ + Facet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this MerchantCenterLink to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink - * @instance - * @returns {Object.} JSON object - */ - MerchantCenterLink.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + Facet.FacetValue = (function() { - return MerchantCenterLink; - })(); + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ - v2alpha.MerchantCenterLinkingConfig = (function() { + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Properties of a MerchantCenterLinkingConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IMerchantCenterLinkingConfig - * @property {Array.|null} [links] MerchantCenterLinkingConfig links - */ + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; - /** - * Constructs a new MerchantCenterLinkingConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a MerchantCenterLinkingConfig. - * @implements IMerchantCenterLinkingConfig - * @constructor - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set - */ - function MerchantCenterLinkingConfig(properties) { - this.links = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * FacetValue interval. + * @member {google.cloud.retail.v2.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; - /** - * MerchantCenterLinkingConfig links. - * @member {Array.} links - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @instance - */ - MerchantCenterLinkingConfig.prototype.links = $util.emptyArray; + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a new MerchantCenterLinkingConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig instance - */ - MerchantCenterLinkingConfig.create = function create(properties) { - return new MerchantCenterLinkingConfig(properties); - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerchantCenterLinkingConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.links != null && message.links.length) - for (var i = 0; i < message.links.length; ++i) - $root.google.cloud.retail.v2alpha.MerchantCenterLink.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerchantCenterLinkingConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; - /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerchantCenterLinkingConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.links && message.links.length)) - message.links = []; - message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; - /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerchantCenterLinkingConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a MerchantCenterLinkingConfig message. - * @function verify - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MerchantCenterLinkingConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.links != null && message.hasOwnProperty("links")) { - if (!Array.isArray(message.links)) - return "links: array expected"; - for (var i = 0; i < message.links.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.MerchantCenterLink.verify(message.links[i]); - if (error) - return "links." + error; - } - } - return null; - }; + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig - */ - MerchantCenterLinkingConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig) - return object; - var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); - if (object.links) { - if (!Array.isArray(object.links)) - throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: array expected"); - message.links = []; - for (var i = 0; i < object.links.length; ++i) { - if (typeof object.links[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: object expected"); - message.links[i] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.fromObject(object.links[i]); - } - } - return message; - }; + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} message MerchantCenterLinkingConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MerchantCenterLinkingConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.links = []; - if (message.links && message.links.length) { - object.links = []; - for (var j = 0; j < message.links.length; ++j) - object.links[j] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.toObject(message.links[j], options); - } - return object; - }; + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; - /** - * Converts this MerchantCenterLinkingConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @instance - * @returns {Object.} JSON object - */ - MerchantCenterLinkingConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; - return MerchantCenterLinkingConfig; - })(); + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; - v2alpha.Catalog = (function() { + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a Catalog. - * @memberof google.cloud.retail.v2alpha - * @interface ICatalog - * @property {string|null} [name] Catalog name - * @property {string|null} [displayName] Catalog displayName - * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig - * @property {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null} [merchantCenterLinkingConfig] Catalog merchantCenterLinkingConfig - */ + return FacetValue; + })(); - /** - * Constructs a new Catalog. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Catalog. - * @implements ICatalog - * @constructor - * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set - */ - function Catalog(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return Facet; + })(); - /** - * Catalog name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - */ - Catalog.prototype.name = ""; + SearchResponse.QueryExpansionInfo = (function() { - /** - * Catalog displayName. - * @member {string} displayName - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - */ - Catalog.prototype.displayName = ""; + /** + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount + */ - /** - * Catalog productLevelConfig. - * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - */ - Catalog.prototype.productLevelConfig = null; + /** + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + */ + function QueryExpansionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Catalog merchantCenterLinkingConfig. - * @member {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null|undefined} merchantCenterLinkingConfig - * @memberof google.cloud.retail.v2alpha.Catalog - * @instance - */ - Catalog.prototype.merchantCenterLinkingConfig = null; + /** + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.expandedQuery = false; - /** - * Creates a new Catalog instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance - */ - Catalog.create = function create(properties) { - return new Catalog(properties); - }; + /** + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Catalog - * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Catalog.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) - $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.merchantCenterLinkingConfig != null && Object.hasOwnProperty.call(message, "merchantCenterLinkingConfig")) - $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.encode(message.merchantCenterLinkingConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + */ + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); + }; - /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); + return writer; + }; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expandedQuery = reader.bool(); + break; + case 2: + message.pinnedResultCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionInfo message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + */ + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + return object; + }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryExpansionInfo; + })(); + + return SearchResponse; + })(); + + v2.UserEventService = (function() { + + /** + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + + /** + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.UserEventService * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + */ + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.UserEvent} [response] UserEvent + */ + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2.WriteUserEventRequest, $root.google.cloud.retail.v2.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); + + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); + + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); + + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); + + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); + + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2.UserEventService + * @instance + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UserEventService; + })(); + + v2.WriteUserEventRequest = (function() { + + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2 + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ + + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; + + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; + + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; + + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a WriteUserEventRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decode = function decode(reader, length) { + WriteUserEventRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.parent = reader.string(); break; case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); - break; - case 6: - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23952,161 +24100,124 @@ }; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decodeDelimited = function decodeDelimited(reader) { + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Catalog message. + * Verifies a WriteUserEventRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Catalog.verify = function verify(message) { + WriteUserEventRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); - if (error) - return "productLevelConfig." + error; - } - if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { - var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); if (error) - return "merchantCenterLinkingConfig." + error; + return "userEvent." + error; } return null; }; /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2.WriteUserEventRequest} WriteUserEventRequest */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.WriteUserEventRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.Catalog(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); - } - if (object.merchantCenterLinkingConfig != null) { - if (typeof object.merchantCenterLinkingConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); + var message = new $root.google.cloud.retail.v2.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); } return message; }; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {google.cloud.retail.v2.WriteUserEventRequest} message WriteUserEventRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Catalog.toObject = function toObject(message, options) { + WriteUserEventRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; - object.merchantCenterLinkingConfig = null; + object.parent = ""; + object.userEvent = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); - if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) - object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); return object; }; /** - * Converts this Catalog to JSON. + * Converts this WriteUserEventRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2.WriteUserEventRequest * @instance * @returns {Object.} JSON object */ - Catalog.prototype.toJSON = function toJSON() { + WriteUserEventRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Catalog; - })(); - - /** - * SolutionType enum. - * @name google.cloud.retail.v2alpha.SolutionType - * @enum {number} - * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value - * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value - * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value - */ - v2alpha.SolutionType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; - values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; - return values; + return WriteUserEventRequest; })(); - v2alpha.Condition = (function() { + v2.CollectUserEventRequest = (function() { /** - * Properties of a Condition. - * @memberof google.cloud.retail.v2alpha - * @interface ICondition - * @property {Array.|null} [queryTerms] Condition queryTerms - * @property {Array.|null} [activeTimeRange] Condition activeTimeRange + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2 + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets */ /** - * Constructs a new Condition. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Condition. - * @implements ICondition + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest * @constructor - * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set */ - function Condition(properties) { - this.queryTerms = []; - this.activeTimeRange = []; + function CollectUserEventRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24114,94 +24225,114 @@ } /** - * Condition queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Condition + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @instance */ - Condition.prototype.queryTerms = $util.emptyArray; + CollectUserEventRequest.prototype.parent = ""; /** - * Condition activeTimeRange. - * @member {Array.} activeTimeRange - * @memberof google.cloud.retail.v2alpha.Condition + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @instance */ - Condition.prototype.activeTimeRange = $util.emptyArray; + CollectUserEventRequest.prototype.userEvent = ""; /** - * Creates a new Condition instance using the specified properties. + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; + + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CollectUserEventRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Condition} Condition instance + * @param {google.cloud.retail.v2.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest instance */ - Condition.create = function create(properties) { - return new Condition(properties); + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); }; /** - * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Condition.encode = function encode(message, writer) { + CollectUserEventRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - $root.google.cloud.retail.v2alpha.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeTimeRange != null && message.activeTimeRange.length) - for (var i = 0; i < message.activeTimeRange.length; ++i) - $root.google.cloud.retail.v2alpha.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); return writer; }; /** - * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CollectUserEventRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {google.cloud.retail.v2.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Condition.encodeDelimited = function encodeDelimited(message, writer) { + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Condition message from the specified reader or buffer. + * Decodes a CollectUserEventRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Condition.decode = function decode(reader, length) { + CollectUserEventRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); + message.parent = reader.string(); + break; + case 2: + message.userEvent = reader.string(); break; case 3: - if (!(message.activeTimeRange && message.activeTimeRange.length)) - message.activeTimeRange = []; - message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); break; default: reader.skipType(tag & 7); @@ -24212,588 +24343,390 @@ }; /** - * Decodes a Condition message from the specified reader or buffer, length delimited. + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Condition.decodeDelimited = function decodeDelimited(reader) { + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Condition message. + * Verifies a CollectUserEventRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Condition.verify = function verify(message) { + CollectUserEventRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.verify(message.queryTerms[i]); - if (error) - return "queryTerms." + error; - } - } - if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { - if (!Array.isArray(message.activeTimeRange)) - return "activeTimeRange: array expected"; - for (var i = 0; i < message.activeTimeRange.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Condition.TimeRange.verify(message.activeTimeRange[i]); - if (error) - return "activeTimeRange." + error; - } - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; return null; }; /** - * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @returns {google.cloud.retail.v2.CollectUserEventRequest} CollectUserEventRequest */ - Condition.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Condition) + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CollectUserEventRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.Condition(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) { - if (typeof object.queryTerms[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: object expected"); - message.queryTerms[i] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.fromObject(object.queryTerms[i]); - } - } - if (object.activeTimeRange) { - if (!Array.isArray(object.activeTimeRange)) - throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: array expected"); - message.activeTimeRange = []; - for (var i = 0; i < object.activeTimeRange.length; ++i) { - if (typeof object.activeTimeRange[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: object expected"); - message.activeTimeRange[i] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.fromObject(object.activeTimeRange[i]); - } - } + var message = new $root.google.cloud.retail.v2.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) + if ($util.Long) + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a Condition message. Also converts values to other types if specified. + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @static - * @param {google.cloud.retail.v2alpha.Condition} message Condition + * @param {google.cloud.retail.v2.CollectUserEventRequest} message CollectUserEventRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Condition.toObject = function toObject(message, options) { + CollectUserEventRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.queryTerms = []; - object.activeTimeRange = []; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.toObject(message.queryTerms[j], options); - } - if (message.activeTimeRange && message.activeTimeRange.length) { - object.activeTimeRange = []; - for (var j = 0; j < message.activeTimeRange.length; ++j) - object.activeTimeRange[j] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.toObject(message.activeTimeRange[j], options); + if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ets = options.longs === String ? "0" : 0; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; + else + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; return object; }; /** - * Converts this Condition to JSON. + * Converts this CollectUserEventRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2.CollectUserEventRequest * @instance * @returns {Object.} JSON object */ - Condition.prototype.toJSON = function toJSON() { + CollectUserEventRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - Condition.QueryTerm = (function() { + return CollectUserEventRequest; + })(); - /** - * Properties of a QueryTerm. - * @memberof google.cloud.retail.v2alpha.Condition - * @interface IQueryTerm - * @property {string|null} [value] QueryTerm value - * @property {boolean|null} [fullMatch] QueryTerm fullMatch - */ + v2.RejoinUserEventsRequest = (function() { - /** - * Constructs a new QueryTerm. - * @memberof google.cloud.retail.v2alpha.Condition - * @classdesc Represents a QueryTerm. - * @implements IQueryTerm - * @constructor - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set - */ - function QueryTerm(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + */ - /** - * QueryTerm value. - * @member {string} value - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @instance - */ - QueryTerm.prototype.value = ""; + /** + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + */ + function RejoinUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * QueryTerm fullMatch. - * @member {boolean} fullMatch - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @instance - */ - QueryTerm.prototype.fullMatch = false; + /** + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.parent = ""; - /** - * Creates a new QueryTerm instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm instance - */ - QueryTerm.create = function create(properties) { - return new QueryTerm(properties); - }; + /** + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; - /** - * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTerm.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); - return writer; - }; + /** + * Creates a new RejoinUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest instance + */ + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); + }; - /** - * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + return writer; + }; - /** - * Decodes a QueryTerm message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTerm.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.fullMatch = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryTerm message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTerm.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryTerm message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryTerm.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) - if (typeof message.fullMatch !== "boolean") - return "fullMatch: boolean expected"; - return null; - }; - - /** - * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm - */ - QueryTerm.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Condition.QueryTerm) - return object; - var message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); - if (object.value != null) - message.value = String(object.value); - if (object.fullMatch != null) - message.fullMatch = Boolean(object.fullMatch); - return message; - }; + /** + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.QueryTerm} message QueryTerm - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryTerm.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.fullMatch = false; + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEventRejoinScope = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) - object.fullMatch = message.fullMatch; - return object; - }; - - /** - * Converts this QueryTerm to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @instance - * @returns {Object.} JSON object - */ - QueryTerm.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryTerm; - })(); - - Condition.TimeRange = (function() { - - /** - * Properties of a TimeRange. - * @memberof google.cloud.retail.v2alpha.Condition - * @interface ITimeRange - * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime - * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime - */ - - /** - * Constructs a new TimeRange. - * @memberof google.cloud.retail.v2alpha.Condition - * @classdesc Represents a TimeRange. - * @implements ITimeRange - * @constructor - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set - */ - function TimeRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; } + return message; + }; - /** - * TimeRange startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @instance - */ - TimeRange.prototype.startTime = null; - - /** - * TimeRange endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @instance - */ - TimeRange.prototype.endTime = null; - - /** - * Creates a new TimeRange instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange instance - */ - TimeRange.create = function create(properties) { - return new TimeRange(properties); - }; - - /** - * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TimeRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TimeRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TimeRange message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TimeRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TimeRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TimeRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TimeRange message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TimeRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - return null; - }; + /** + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange - */ - TimeRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Condition.TimeRange) - return object; - var message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + /** + * Verifies a RejoinUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RejoinUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; } - return message; - }; + return null; + }; - /** - * Creates a plain object from a TimeRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.TimeRange} message TimeRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TimeRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = null; - object.endTime = null; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + /** + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsRequest} RejoinUserEventsRequest + */ + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsRequest) return object; - }; + var message = new $root.google.cloud.retail.v2.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; - /** - * Converts this TimeRange to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @instance - * @returns {Object.} JSON object - */ - TimeRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + return object; + }; - return TimeRange; + /** + * Converts this RejoinUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + */ + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; })(); - return Condition; + return RejoinUserEventsRequest; })(); - v2alpha.Rule = (function() { + v2.RejoinUserEventsResponse = (function() { /** - * Properties of a Rule. - * @memberof google.cloud.retail.v2alpha - * @interface IRule - * @property {google.cloud.retail.v2alpha.Rule.IBoostAction|null} [boostAction] Rule boostAction - * @property {google.cloud.retail.v2alpha.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction - * @property {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction - * @property {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction - * @property {google.cloud.retail.v2alpha.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction - * @property {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction - * @property {google.cloud.retail.v2alpha.Rule.IFilterAction|null} [filterAction] Rule filterAction - * @property {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction - * @property {google.cloud.retail.v2alpha.ICondition|null} [condition] Rule condition + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount */ /** - * Constructs a new Rule. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Rule. - * @implements IRule + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set */ - function Rule(properties) { + function RejoinUserEventsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24801,194 +24734,263 @@ } /** - * Rule boostAction. - * @member {google.cloud.retail.v2alpha.Rule.IBoostAction|null|undefined} boostAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance - */ - Rule.prototype.boostAction = null; - - /** - * Rule redirectAction. - * @member {google.cloud.retail.v2alpha.Rule.IRedirectAction|null|undefined} redirectAction - * @memberof google.cloud.retail.v2alpha.Rule + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @instance */ - Rule.prototype.redirectAction = null; + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Rule onewaySynonymsAction. - * @member {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Creates a new RejoinUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse instance */ - Rule.prototype.onewaySynonymsAction = null; + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); + }; /** - * Rule doNotAssociateAction. - * @member {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Rule.prototype.doNotAssociateAction = null; + RejoinUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); + return writer; + }; /** - * Rule replacementAction. - * @member {google.cloud.retail.v2alpha.Rule.IReplacementAction|null|undefined} replacementAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Rule.prototype.replacementAction = null; + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Rule ignoreAction. - * @member {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null|undefined} ignoreAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.prototype.ignoreAction = null; + RejoinUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rejoinedUserEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Rule filterAction. - * @member {google.cloud.retail.v2alpha.Rule.IFilterAction|null|undefined} filterAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.prototype.filterAction = null; + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Rule twowaySynonymsAction. - * @member {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Verifies a RejoinUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rule.prototype.twowaySynonymsAction = null; + RejoinUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; + return null; + }; /** - * Rule condition. - * @member {google.cloud.retail.v2alpha.ICondition|null|undefined} condition - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RejoinUserEventsResponse} RejoinUserEventsResponse */ - Rule.prototype.condition = null; + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); + return message; + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {google.cloud.retail.v2.RejoinUserEventsResponse} message RejoinUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RejoinUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; + return object; + }; /** - * Rule action. - * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action - * @memberof google.cloud.retail.v2alpha.Rule + * Converts this RejoinUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse * @instance + * @returns {Object.} JSON object */ - Object.defineProperty(Rule.prototype, "action", { - get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), - set: $util.oneOfSetter($oneOfFields) - }); + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RejoinUserEventsResponse; + })(); + + v2.RejoinUserEventsMetadata = (function() { /** - * Creates a new Rule instance using the specified properties. + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRejoinUserEventsMetadata + */ + + /** + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata + * @constructor + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set + */ + function RejoinUserEventsMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RejoinUserEventsMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule} Rule instance + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance */ - Rule.create = function create(properties) { - return new Rule(properties); + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); }; /** - * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rule.encode = function encode(message, writer) { + RejoinUserEventsMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - $root.google.cloud.retail.v2alpha.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) - $root.google.cloud.retail.v2alpha.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) - $root.google.cloud.retail.v2alpha.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) - $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) - $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) - $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) - $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) - $root.google.cloud.retail.v2alpha.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) - $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; /** - * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RejoinUserEventsMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {google.cloud.retail.v2.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rule.encodeDelimited = function encodeDelimited(message, writer) { + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Rule message from the specified reader or buffer. + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.decode = function decode(reader, length) { + RejoinUserEventsMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); - break; - case 3: - message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); - break; - case 6: - message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); - break; - case 7: - message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); - break; - case 8: - message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); - break; - case 9: - message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); - break; - case 10: - message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); - break; - case 11: - message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); - break; - case 1: - message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -24998,1451 +25000,1450 @@ }; /** - * Decodes a Rule message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.decodeDelimited = function decodeDelimited(reader) { + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Rule message. + * Verifies a RejoinUserEventsMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rule.verify = function verify(message) { + RejoinUserEventsMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.boostAction != null && message.hasOwnProperty("boostAction")) { - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.BoostAction.verify(message.boostAction); - if (error) - return "boostAction." + error; - } - } - if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.verify(message.redirectAction); - if (error) - return "redirectAction." + error; - } - } - if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); - if (error) - return "onewaySynonymsAction." + error; - } - } - if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); - if (error) - return "doNotAssociateAction." + error; - } - } - if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.verify(message.replacementAction); - if (error) - return "replacementAction." + error; - } - } - if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.verify(message.ignoreAction); - if (error) - return "ignoreAction." + error; - } - } - if (message.filterAction != null && message.hasOwnProperty("filterAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.FilterAction.verify(message.filterAction); - if (error) - return "filterAction." + error; - } - } - if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); - if (error) - return "twowaySynonymsAction." + error; - } - } - if (message.condition != null && message.hasOwnProperty("condition")) { - var error = $root.google.cloud.retail.v2alpha.Condition.verify(message.condition); - if (error) - return "condition." + error; - } return null; }; /** - * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @returns {google.cloud.retail.v2.RejoinUserEventsMetadata} RejoinUserEventsMetadata */ - Rule.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule) + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RejoinUserEventsMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule(); - if (object.boostAction != null) { - if (typeof object.boostAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.boostAction: object expected"); - message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.fromObject(object.boostAction); - } - if (object.redirectAction != null) { - if (typeof object.redirectAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.redirectAction: object expected"); - message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.fromObject(object.redirectAction); - } - if (object.onewaySynonymsAction != null) { - if (typeof object.onewaySynonymsAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.onewaySynonymsAction: object expected"); - message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); - } - if (object.doNotAssociateAction != null) { - if (typeof object.doNotAssociateAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.doNotAssociateAction: object expected"); - message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); - } - if (object.replacementAction != null) { - if (typeof object.replacementAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.replacementAction: object expected"); - message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.fromObject(object.replacementAction); - } - if (object.ignoreAction != null) { - if (typeof object.ignoreAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.ignoreAction: object expected"); - message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.fromObject(object.ignoreAction); - } - if (object.filterAction != null) { - if (typeof object.filterAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.filterAction: object expected"); - message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.fromObject(object.filterAction); - } - if (object.twowaySynonymsAction != null) { - if (typeof object.twowaySynonymsAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.twowaySynonymsAction: object expected"); - message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); - } - if (object.condition != null) { - if (typeof object.condition !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.condition: object expected"); - message.condition = $root.google.cloud.retail.v2alpha.Condition.fromObject(object.condition); - } - return message; + return new $root.google.cloud.retail.v2.RejoinUserEventsMetadata(); }; /** - * Creates a plain object from a Rule message. Also converts values to other types if specified. + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2alpha.Rule} message Rule + * @param {google.cloud.retail.v2.RejoinUserEventsMetadata} message RejoinUserEventsMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Rule.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.condition = null; - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = $root.google.cloud.retail.v2alpha.Condition.toObject(message.condition, options); - if (message.boostAction != null && message.hasOwnProperty("boostAction")) { - object.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.toObject(message.boostAction, options); - if (options.oneofs) - object.action = "boostAction"; - } - if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { - object.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.toObject(message.redirectAction, options); - if (options.oneofs) - object.action = "redirectAction"; - } - if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { - object.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); - if (options.oneofs) - object.action = "onewaySynonymsAction"; - } - if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { - object.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); - if (options.oneofs) - object.action = "doNotAssociateAction"; - } - if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { - object.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.toObject(message.replacementAction, options); - if (options.oneofs) - object.action = "replacementAction"; - } - if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { - object.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.toObject(message.ignoreAction, options); - if (options.oneofs) - object.action = "ignoreAction"; - } - if (message.filterAction != null && message.hasOwnProperty("filterAction")) { - object.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.toObject(message.filterAction, options); - if (options.oneofs) - object.action = "filterAction"; - } - if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { - object.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); - if (options.oneofs) - object.action = "twowaySynonymsAction"; - } - return object; + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this Rule to JSON. + * Converts this RejoinUserEventsMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata * @instance * @returns {Object.} JSON object */ - Rule.prototype.toJSON = function toJSON() { + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - Rule.BoostAction = (function() { + return RejoinUserEventsMetadata; + })(); - /** - * Properties of a BoostAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IBoostAction - * @property {number|null} [boost] BoostAction boost - * @property {string|null} [productsFilter] BoostAction productsFilter - */ + return v2; + })(); - /** - * Constructs a new BoostAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a BoostAction. - * @implements IBoostAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set - */ - function BoostAction(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + retail.v2alpha = (function() { - /** - * BoostAction boost. - * @member {number} boost - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @instance - */ - BoostAction.prototype.boost = 0; + /** + * Namespace v2alpha. + * @memberof google.cloud.retail + * @namespace + */ + var v2alpha = {}; - /** - * BoostAction productsFilter. - * @member {string} productsFilter - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @instance - */ - BoostAction.prototype.productsFilter = ""; + v2alpha.ProductLevelConfig = (function() { - /** - * Creates a new BoostAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction instance - */ - BoostAction.create = function create(properties) { - return new BoostAction(properties); - }; + /** + * Properties of a ProductLevelConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField + */ - /** - * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); - if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); - return writer; - }; + /** + * Constructs a new ProductLevelConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set + */ + function ProductLevelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.ingestionProductType = ""; - /** - * Decodes a BoostAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.boost = reader.float(); - break; - case 2: - message.productsFilter = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @instance + */ + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; - /** - * Decodes a BoostAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a new ProductLevelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig instance + */ + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); + }; - /** - * Verifies a BoostAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoostAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) - if (!$util.isString(message.productsFilter)) - return "productsFilter: string expected"; - return null; - }; + /** + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); + return writer; + }; - /** - * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction - */ - BoostAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.BoostAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); - if (object.boost != null) - message.boost = Number(object.boost); - if (object.productsFilter != null) - message.productsFilter = String(object.productsFilter); - return message; - }; + /** + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductLevelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductLevelConfig} message ProductLevelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a plain object from a BoostAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.BoostAction} message BoostAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoostAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.boost = 0; - object.productsFilter = ""; + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ingestionProductType = reader.string(); + break; + case 2: + message.merchantCenterProductIdField = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) - object.productsFilter = message.productsFilter; - return object; - }; - - /** - * Converts this BoostAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction - * @instance - * @returns {Object.} JSON object - */ - BoostAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + } + return message; + }; - return BoostAction; - })(); + /** + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - Rule.FilterAction = (function() { + /** + * Verifies a ProductLevelConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductLevelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; + return null; + }; - /** - * Properties of a FilterAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IFilterAction - * @property {string|null} [filter] FilterAction filter - */ + /** + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ProductLevelConfig} ProductLevelConfig + */ + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductLevelConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); + return message; + }; - /** - * Constructs a new FilterAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a FilterAction. - * @implements IFilterAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set - */ - function FilterAction(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {google.cloud.retail.v2alpha.ProductLevelConfig} message ProductLevelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductLevelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; + return object; + }; - /** - * FilterAction filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @instance - */ - FilterAction.prototype.filter = ""; - - /** - * Creates a new FilterAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction instance - */ - FilterAction.create = function create(properties) { - return new FilterAction(properties); - }; + /** + * Converts this ProductLevelConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @instance + * @returns {Object.} JSON object + */ + ProductLevelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilterAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); - return writer; - }; + return ProductLevelConfig; + })(); - /** - * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FilterAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + v2alpha.MerchantCenterLink = (function() { - /** - * Decodes a FilterAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilterAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.filter = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Properties of a MerchantCenterLink. + * @memberof google.cloud.retail.v2alpha + * @interface IMerchantCenterLink + * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId + * @property {string|null} [branchId] MerchantCenterLink branchId + * @property {Array.|null} [destinations] MerchantCenterLink destinations + * @property {string|null} [regionCode] MerchantCenterLink regionCode + * @property {string|null} [languageCode] MerchantCenterLink languageCode + */ - /** - * Decodes a FilterAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FilterAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Constructs a new MerchantCenterLink. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a MerchantCenterLink. + * @implements IMerchantCenterLink + * @constructor + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set + */ + function MerchantCenterLink(properties) { + this.destinations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Verifies a FilterAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FilterAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - return null; - }; + /** + * MerchantCenterLink merchantCenterAccountId. + * @member {number|Long} merchantCenterAccountId + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.merchantCenterAccountId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction - */ - FilterAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.FilterAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); - if (object.filter != null) - message.filter = String(object.filter); - return message; - }; + /** + * MerchantCenterLink branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.branchId = ""; - /** - * Creates a plain object from a FilterAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.FilterAction} message FilterAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FilterAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.filter = ""; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - return object; - }; + /** + * MerchantCenterLink destinations. + * @member {Array.} destinations + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.destinations = $util.emptyArray; - /** - * Converts this FilterAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @instance - * @returns {Object.} JSON object - */ - FilterAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * MerchantCenterLink regionCode. + * @member {string} regionCode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.regionCode = ""; - return FilterAction; - })(); + /** + * MerchantCenterLink languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.languageCode = ""; - Rule.RedirectAction = (function() { + /** + * Creates a new MerchantCenterLink instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink instance + */ + MerchantCenterLink.create = function create(properties) { + return new MerchantCenterLink(properties); + }; - /** - * Properties of a RedirectAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IRedirectAction - * @property {string|null} [redirectUri] RedirectAction redirectUri - */ + /** + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerchantCenterLink.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.merchantCenterAccountId != null && Object.hasOwnProperty.call(message, "merchantCenterAccountId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.merchantCenterAccountId); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.destinations != null && message.destinations.length) + for (var i = 0; i < message.destinations.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.regionCode); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.languageCode); + return writer; + }; - /** - * Constructs a new RedirectAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a RedirectAction. - * @implements IRedirectAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set - */ - function RedirectAction(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerchantCenterLink.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MerchantCenterLink message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerchantCenterLink.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.merchantCenterAccountId = reader.int64(); + break; + case 2: + message.branchId = reader.string(); + break; + case 3: + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + message.destinations.push(reader.string()); + break; + case 4: + message.regionCode = reader.string(); + break; + case 5: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } + return message; + }; - /** - * RedirectAction redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @instance - */ - RedirectAction.prototype.redirectUri = ""; + /** + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerchantCenterLink.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a new RedirectAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction instance - */ - RedirectAction.create = function create(properties) { - return new RedirectAction(properties); - }; + /** + * Verifies a MerchantCenterLink message. + * @function verify + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerchantCenterLink.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (!$util.isInteger(message.merchantCenterAccountId) && !(message.merchantCenterAccountId && $util.isInteger(message.merchantCenterAccountId.low) && $util.isInteger(message.merchantCenterAccountId.high))) + return "merchantCenterAccountId: integer|Long expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + if (!$util.isString(message.destinations[i])) + return "destinations: string[] expected"; + } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + if (!$util.isString(message.regionCode)) + return "regionCode: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; - /** - * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedirectAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); - return writer; - }; + /** + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink + */ + MerchantCenterLink.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLink) + return object; + var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); + if (object.merchantCenterAccountId != null) + if ($util.Long) + (message.merchantCenterAccountId = $util.Long.fromValue(object.merchantCenterAccountId)).unsigned = false; + else if (typeof object.merchantCenterAccountId === "string") + message.merchantCenterAccountId = parseInt(object.merchantCenterAccountId, 10); + else if (typeof object.merchantCenterAccountId === "number") + message.merchantCenterAccountId = object.merchantCenterAccountId; + else if (typeof object.merchantCenterAccountId === "object") + message.merchantCenterAccountId = new $util.LongBits(object.merchantCenterAccountId.low >>> 0, object.merchantCenterAccountId.high >>> 0).toNumber(); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLink.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + message.destinations[i] = String(object.destinations[i]); + } + if (object.regionCode != null) + message.regionCode = String(object.regionCode); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; - /** - * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {google.cloud.retail.v2alpha.MerchantCenterLink} message MerchantCenterLink + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerchantCenterLink.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.destinations = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.merchantCenterAccountId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.merchantCenterAccountId = options.longs === String ? "0" : 0; + object.branchId = ""; + object.regionCode = ""; + object.languageCode = ""; + } + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (typeof message.merchantCenterAccountId === "number") + object.merchantCenterAccountId = options.longs === String ? String(message.merchantCenterAccountId) : message.merchantCenterAccountId; + else + object.merchantCenterAccountId = options.longs === String ? $util.Long.prototype.toString.call(message.merchantCenterAccountId) : options.longs === Number ? new $util.LongBits(message.merchantCenterAccountId.low >>> 0, message.merchantCenterAccountId.high >>> 0).toNumber() : message.merchantCenterAccountId; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = message.destinations[j]; + } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; - /** - * Decodes a RedirectAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedirectAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.redirectUri = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Converts this MerchantCenterLink to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + * @returns {Object.} JSON object + */ + MerchantCenterLink.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a RedirectAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedirectAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return MerchantCenterLink; + })(); - /** - * Verifies a RedirectAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RedirectAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; - return null; - }; + v2alpha.MerchantCenterLinkingConfig = (function() { - /** - * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction - */ - RedirectAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.RedirectAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); - return message; - }; + /** + * Properties of a MerchantCenterLinkingConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IMerchantCenterLinkingConfig + * @property {Array.|null} [links] MerchantCenterLinkingConfig links + */ - /** - * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.RedirectAction} message RedirectAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RedirectAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.redirectUri = ""; - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; - return object; - }; + /** + * Constructs a new MerchantCenterLinkingConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a MerchantCenterLinkingConfig. + * @implements IMerchantCenterLinkingConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set + */ + function MerchantCenterLinkingConfig(properties) { + this.links = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this RedirectAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @instance - * @returns {Object.} JSON object - */ - RedirectAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * MerchantCenterLinkingConfig links. + * @member {Array.} links + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @instance + */ + MerchantCenterLinkingConfig.prototype.links = $util.emptyArray; - return RedirectAction; - })(); + /** + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig instance + */ + MerchantCenterLinkingConfig.create = function create(properties) { + return new MerchantCenterLinkingConfig(properties); + }; - Rule.TwowaySynonymsAction = (function() { + /** + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerchantCenterLinkingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.links != null && message.links.length) + for (var i = 0; i < message.links.length; ++i) + $root.google.cloud.retail.v2alpha.MerchantCenterLink.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Properties of a TwowaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface ITwowaySynonymsAction - * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms - */ + /** + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerchantCenterLinkingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Constructs a new TwowaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a TwowaySynonymsAction. - * @implements ITwowaySynonymsAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set - */ - function TwowaySynonymsAction(properties) { - this.synonyms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerchantCenterLinkingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } } + return message; + }; - /** - * TwowaySynonymsAction synonyms. - * @member {Array.} synonyms - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @instance - */ - TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; - - /** - * Creates a new TwowaySynonymsAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance - */ - TwowaySynonymsAction.create = function create(properties) { - return new TwowaySynonymsAction(properties); - }; - - /** - * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TwowaySynonymsAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.synonyms != null && message.synonyms.length) - for (var i = 0; i < message.synonyms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); - return writer; - }; - - /** - * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerchantCenterLinkingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TwowaySynonymsAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Verifies a MerchantCenterLinkingConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerchantCenterLinkingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.links != null && message.hasOwnProperty("links")) { + if (!Array.isArray(message.links)) + return "links: array expected"; + for (var i = 0; i < message.links.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLink.verify(message.links[i]); + if (error) + return "links." + error; } - return message; - }; - - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return null; + }; - /** - * Verifies a TwowaySynonymsAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TwowaySynonymsAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.synonyms != null && message.hasOwnProperty("synonyms")) { - if (!Array.isArray(message.synonyms)) - return "synonyms: array expected"; - for (var i = 0; i < message.synonyms.length; ++i) - if (!$util.isString(message.synonyms[i])) - return "synonyms: string[] expected"; + /** + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + */ + MerchantCenterLinkingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); + if (object.links) { + if (!Array.isArray(object.links)) + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: array expected"); + message.links = []; + for (var i = 0; i < object.links.length; ++i) { + if (typeof object.links[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: object expected"); + message.links[i] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.fromObject(object.links[i]); } - return null; - }; + } + return message; + }; - /** - * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction - */ - TwowaySynonymsAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); - if (object.synonyms) { - if (!Array.isArray(object.synonyms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.synonyms: array expected"); - message.synonyms = []; - for (var i = 0; i < object.synonyms.length; ++i) - message.synonyms[i] = String(object.synonyms[i]); - } - return message; - }; + /** + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} message MerchantCenterLinkingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerchantCenterLinkingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.links = []; + if (message.links && message.links.length) { + object.links = []; + for (var j = 0; j < message.links.length; ++j) + object.links[j] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.toObject(message.links[j], options); + } + return object; + }; - /** - * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} message TwowaySynonymsAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TwowaySynonymsAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.synonyms = []; - if (message.synonyms && message.synonyms.length) { - object.synonyms = []; - for (var j = 0; j < message.synonyms.length; ++j) - object.synonyms[j] = message.synonyms[j]; - } - return object; - }; + /** + * Converts this MerchantCenterLinkingConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @instance + * @returns {Object.} JSON object + */ + MerchantCenterLinkingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this TwowaySynonymsAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @instance - * @returns {Object.} JSON object - */ - TwowaySynonymsAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return MerchantCenterLinkingConfig; + })(); - return TwowaySynonymsAction; - })(); + v2alpha.Catalog = (function() { - Rule.OnewaySynonymsAction = (function() { + /** + * Properties of a Catalog. + * @memberof google.cloud.retail.v2alpha + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * @property {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null} [merchantCenterLinkingConfig] Catalog merchantCenterLinkingConfig + */ - /** - * Properties of an OnewaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IOnewaySynonymsAction - * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms - * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms - * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms - */ + /** + * Constructs a new Catalog. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Catalog. + * @implements ICatalog + * @constructor + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + */ + function Catalog(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new OnewaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents an OnewaySynonymsAction. - * @implements IOnewaySynonymsAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set - */ - function OnewaySynonymsAction(properties) { - this.queryTerms = []; - this.synonyms = []; - this.onewayTerms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.name = ""; - /** - * OnewaySynonymsAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; + /** + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; - /** - * OnewaySynonymsAction synonyms. - * @member {Array.} synonyms - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; - /** - * OnewaySynonymsAction onewayTerms. - * @member {Array.} onewayTerms - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; + /** + * Catalog merchantCenterLinkingConfig. + * @member {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null|undefined} merchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.merchantCenterLinkingConfig = null; - /** - * Creates a new OnewaySynonymsAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance - */ - OnewaySynonymsAction.create = function create(properties) { - return new OnewaySynonymsAction(properties); - }; + /** + * Creates a new Catalog instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance + */ + Catalog.create = function create(properties) { + return new Catalog(properties); + }; - /** - * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnewaySynonymsAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.onewayTerms != null && message.onewayTerms.length) - for (var i = 0; i < message.onewayTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); - if (message.synonyms != null && message.synonyms.length) - for (var i = 0; i < message.synonyms.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); - return writer; - }; + /** + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.merchantCenterLinkingConfig != null && Object.hasOwnProperty.call(message, "merchantCenterLinkingConfig")) + $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.encode(message.merchantCenterLinkingConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnewaySynonymsAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 4: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - case 2: - if (!(message.onewayTerms && message.onewayTerms.length)) - message.onewayTerms = []; - message.onewayTerms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); + break; + case 6: + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies an OnewaySynonymsAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OnewaySynonymsAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.synonyms != null && message.hasOwnProperty("synonyms")) { - if (!Array.isArray(message.synonyms)) - return "synonyms: array expected"; - for (var i = 0; i < message.synonyms.length; ++i) - if (!$util.isString(message.synonyms[i])) - return "synonyms: string[] expected"; - } - if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { - if (!Array.isArray(message.onewayTerms)) - return "onewayTerms: array expected"; - for (var i = 0; i < message.onewayTerms.length; ++i) - if (!$util.isString(message.onewayTerms[i])) - return "onewayTerms: string[] expected"; - } - return null; - }; + /** + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction - */ - OnewaySynonymsAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.synonyms) { - if (!Array.isArray(object.synonyms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.synonyms: array expected"); - message.synonyms = []; - for (var i = 0; i < object.synonyms.length; ++i) - message.synonyms[i] = String(object.synonyms[i]); - } - if (object.onewayTerms) { - if (!Array.isArray(object.onewayTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.onewayTerms: array expected"); - message.onewayTerms = []; - for (var i = 0; i < object.onewayTerms.length; ++i) - message.onewayTerms[i] = String(object.onewayTerms[i]); - } - return message; - }; + /** + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (error) + return "merchantCenterLinkingConfig." + error; + } + return null; + }; - /** - * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} message OnewaySynonymsAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OnewaySynonymsAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.onewayTerms = []; - object.queryTerms = []; - object.synonyms = []; - } - if (message.onewayTerms && message.onewayTerms.length) { - object.onewayTerms = []; - for (var j = 0; j < message.onewayTerms.length; ++j) - object.onewayTerms[j] = message.onewayTerms[j]; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.synonyms && message.synonyms.length) { - object.synonyms = []; - for (var j = 0; j < message.synonyms.length; ++j) - object.synonyms[j] = message.synonyms[j]; - } + /** + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + */ + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) return object; - }; + var message = new $root.google.cloud.retail.v2alpha.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); + } + if (object.merchantCenterLinkingConfig != null) { + if (typeof object.merchantCenterLinkingConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); + } + return message; + }; - /** - * Converts this OnewaySynonymsAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @instance - * @returns {Object.} JSON object - */ - OnewaySynonymsAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + object.merchantCenterLinkingConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) + object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); + return object; + }; - return OnewaySynonymsAction; - })(); + /** + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + * @returns {Object.} JSON object + */ + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - Rule.DoNotAssociateAction = (function() { + return Catalog; + })(); - /** - * Properties of a DoNotAssociateAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IDoNotAssociateAction - * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms - * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms - * @property {Array.|null} [terms] DoNotAssociateAction terms - */ + /** + * SolutionType enum. + * @name google.cloud.retail.v2alpha.SolutionType + * @enum {number} + * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value + * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value + * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value + */ + v2alpha.SolutionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; + values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; + return values; + })(); - /** - * Constructs a new DoNotAssociateAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a DoNotAssociateAction. - * @implements IDoNotAssociateAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set - */ - function DoNotAssociateAction(properties) { - this.queryTerms = []; - this.doNotAssociateTerms = []; - this.terms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2alpha.Condition = (function() { - /** - * DoNotAssociateAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; + /** + * Properties of a Condition. + * @memberof google.cloud.retail.v2alpha + * @interface ICondition + * @property {Array.|null} [queryTerms] Condition queryTerms + * @property {Array.|null} [activeTimeRange] Condition activeTimeRange + */ - /** - * DoNotAssociateAction doNotAssociateTerms. - * @member {Array.} doNotAssociateTerms - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; + /** + * Constructs a new Condition. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Condition. + * @implements ICondition + * @constructor + * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + */ + function Condition(properties) { + this.queryTerms = []; + this.activeTimeRange = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * DoNotAssociateAction terms. - * @member {Array.} terms - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.terms = $util.emptyArray; + /** + * Condition queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + */ + Condition.prototype.queryTerms = $util.emptyArray; - /** - * Creates a new DoNotAssociateAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction instance - */ - DoNotAssociateAction.create = function create(properties) { - return new DoNotAssociateAction(properties); - }; + /** + * Condition activeTimeRange. + * @member {Array.} activeTimeRange + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + */ + Condition.prototype.activeTimeRange = $util.emptyArray; - /** - * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoNotAssociateAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.terms != null && message.terms.length) - for (var i = 0; i < message.terms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); - if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) - for (var i = 0; i < message.doNotAssociateTerms.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + /** + * Creates a new Condition instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition} Condition instance + */ + Condition.create = function create(properties) { + return new Condition(properties); + }; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + $root.google.cloud.retail.v2alpha.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeTimeRange != null && message.activeTimeRange.length) + for (var i = 0; i < message.activeTimeRange.length; ++i) + $root.google.cloud.retail.v2alpha.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Condition message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Condition.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.verify(message.queryTerms[i]); + if (error) + return "queryTerms." + error; + } + } + if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { + if (!Array.isArray(message.activeTimeRange)) + return "activeTimeRange: array expected"; + for (var i = 0; i < message.activeTimeRange.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Condition.TimeRange.verify(message.activeTimeRange[i]); + if (error) + return "activeTimeRange." + error; + } + } + return null; + }; + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Condition} Condition + */ + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition) + return object; + var message = new $root.google.cloud.retail.v2alpha.Condition(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) { + if (typeof object.queryTerms[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: object expected"); + message.queryTerms[i] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.fromObject(object.queryTerms[i]); + } + } + if (object.activeTimeRange) { + if (!Array.isArray(object.activeTimeRange)) + throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: array expected"); + message.activeTimeRange = []; + for (var i = 0; i < object.activeTimeRange.length; ++i) { + if (typeof object.activeTimeRange[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: object expected"); + message.activeTimeRange[i] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.fromObject(object.activeTimeRange[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {google.cloud.retail.v2alpha.Condition} message Condition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Condition.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.queryTerms = []; + object.activeTimeRange = []; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.toObject(message.queryTerms[j], options); + } + if (message.activeTimeRange && message.activeTimeRange.length) { + object.activeTimeRange = []; + for (var j = 0; j < message.activeTimeRange.length; ++j) + object.activeTimeRange[j] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.toObject(message.activeTimeRange[j], options); + } + return object; + }; + + /** + * Converts this Condition to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + * @returns {Object.} JSON object + */ + Condition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Condition.QueryTerm = (function() { + + /** + * Properties of a QueryTerm. + * @memberof google.cloud.retail.v2alpha.Condition + * @interface IQueryTerm + * @property {string|null} [value] QueryTerm value + * @property {boolean|null} [fullMatch] QueryTerm fullMatch + */ + + /** + * Constructs a new QueryTerm. + * @memberof google.cloud.retail.v2alpha.Condition + * @classdesc Represents a QueryTerm. + * @implements IQueryTerm + * @constructor + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set + */ + function QueryTerm(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTerm value. + * @member {string} value + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.value = ""; + + /** + * QueryTerm fullMatch. + * @member {boolean} fullMatch + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.fullMatch = false; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm instance + */ + QueryTerm.create = function create(properties) { + return new QueryTerm(properties); + }; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); return writer; }; /** - * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * Decodes a QueryTerm message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DoNotAssociateAction.decode = function decode(reader, length) { + QueryTerm.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) - message.doNotAssociateTerms = []; - message.doNotAssociateTerms.push(reader.string()); - break; case 1: - if (!(message.terms && message.terms.length)) - message.terms = []; - message.terms.push(reader.string()); + message.value = reader.string(); + break; + case 2: + message.fullMatch = reader.bool(); break; default: reader.skipType(tag & 7); @@ -26453,163 +26454,117 @@ }; /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + QueryTerm.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DoNotAssociateAction message. + * Verifies a QueryTerm message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DoNotAssociateAction.verify = function verify(message) { + QueryTerm.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { - if (!Array.isArray(message.doNotAssociateTerms)) - return "doNotAssociateTerms: array expected"; - for (var i = 0; i < message.doNotAssociateTerms.length; ++i) - if (!$util.isString(message.doNotAssociateTerms[i])) - return "doNotAssociateTerms: string[] expected"; - } - if (message.terms != null && message.hasOwnProperty("terms")) { - if (!Array.isArray(message.terms)) - return "terms: array expected"; - for (var i = 0; i < message.terms.length; ++i) - if (!$util.isString(message.terms[i])) - return "terms: string[] expected"; - } + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + if (typeof message.fullMatch !== "boolean") + return "fullMatch: boolean expected"; return null; }; /** - * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm */ - DoNotAssociateAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction) + QueryTerm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition.QueryTerm) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.doNotAssociateTerms) { - if (!Array.isArray(object.doNotAssociateTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); - message.doNotAssociateTerms = []; - for (var i = 0; i < object.doNotAssociateTerms.length; ++i) - message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); - } - if (object.terms) { - if (!Array.isArray(object.terms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.terms: array expected"); - message.terms = []; - for (var i = 0; i < object.terms.length; ++i) - message.terms[i] = String(object.terms[i]); - } + var message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); + if (object.value != null) + message.value = String(object.value); + if (object.fullMatch != null) + message.fullMatch = Boolean(object.fullMatch); return message; }; /** - * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static - * @param {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {google.cloud.retail.v2alpha.Condition.QueryTerm} message QueryTerm * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DoNotAssociateAction.toObject = function toObject(message, options) { + QueryTerm.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.terms = []; - object.queryTerms = []; - object.doNotAssociateTerms = []; - } - if (message.terms && message.terms.length) { - object.terms = []; - for (var j = 0; j < message.terms.length; ++j) - object.terms[j] = message.terms[j]; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { - object.doNotAssociateTerms = []; - for (var j = 0; j < message.doNotAssociateTerms.length; ++j) - object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; + if (options.defaults) { + object.value = ""; + object.fullMatch = false; } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + object.fullMatch = message.fullMatch; return object; }; /** - * Converts this DoNotAssociateAction to JSON. + * Converts this QueryTerm to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @instance * @returns {Object.} JSON object */ - DoNotAssociateAction.prototype.toJSON = function toJSON() { + QueryTerm.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DoNotAssociateAction; + return QueryTerm; })(); - Rule.ReplacementAction = (function() { + Condition.TimeRange = (function() { /** - * Properties of a ReplacementAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IReplacementAction - * @property {Array.|null} [queryTerms] ReplacementAction queryTerms - * @property {string|null} [replacementTerm] ReplacementAction replacementTerm - * @property {string|null} [term] ReplacementAction term + * Properties of a TimeRange. + * @memberof google.cloud.retail.v2alpha.Condition + * @interface ITimeRange + * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime */ /** - * Constructs a new ReplacementAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a ReplacementAction. - * @implements IReplacementAction + * Constructs a new TimeRange. + * @memberof google.cloud.retail.v2alpha.Condition + * @classdesc Represents a TimeRange. + * @implements ITimeRange * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set */ - function ReplacementAction(properties) { - this.queryTerms = []; + function TimeRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -26617,325 +26572,88 @@ } /** - * ReplacementAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @instance - */ - ReplacementAction.prototype.queryTerms = $util.emptyArray; - - /** - * ReplacementAction replacementTerm. - * @member {string} replacementTerm - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * TimeRange startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @instance */ - ReplacementAction.prototype.replacementTerm = ""; + TimeRange.prototype.startTime = null; /** - * ReplacementAction term. - * @member {string} term - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * TimeRange endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @instance */ - ReplacementAction.prototype.term = ""; + TimeRange.prototype.endTime = null; /** - * Creates a new ReplacementAction instance using the specified properties. + * Creates a new TimeRange instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction instance + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange instance */ - ReplacementAction.create = function create(properties) { - return new ReplacementAction(properties); + TimeRange.create = function create(properties) { + return new TimeRange(properties); }; /** - * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReplacementAction.encode = function encode(message, writer) { + TimeRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.term != null && Object.hasOwnProperty.call(message, "term")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); - if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + TimeRange.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReplacementAction message from the specified reader or buffer. + * Decodes a TimeRange message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReplacementAction.decode = function decode(reader, length) { + TimeRange.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - message.replacementTerm = reader.string(); - break; case 1: - message.term = reader.string(); - break; - default: - reader.skipType(tag & 7); + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; - } - } - return message; - }; - - /** - * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplacementAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReplacementAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReplacementAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) - if (!$util.isString(message.replacementTerm)) - return "replacementTerm: string expected"; - if (message.term != null && message.hasOwnProperty("term")) - if (!$util.isString(message.term)) - return "term: string expected"; - return null; - }; - - /** - * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction - */ - ReplacementAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.ReplacementAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.ReplacementAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.replacementTerm != null) - message.replacementTerm = String(object.replacementTerm); - if (object.term != null) - message.term = String(object.term); - return message; - }; - - /** - * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ReplacementAction} message ReplacementAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReplacementAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.queryTerms = []; - if (options.defaults) { - object.term = ""; - object.replacementTerm = ""; - } - if (message.term != null && message.hasOwnProperty("term")) - object.term = message.term; - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) - object.replacementTerm = message.replacementTerm; - return object; - }; - - /** - * Converts this ReplacementAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @instance - * @returns {Object.} JSON object - */ - ReplacementAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ReplacementAction; - })(); - - Rule.IgnoreAction = (function() { - - /** - * Properties of an IgnoreAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IIgnoreAction - * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms - */ - - /** - * Constructs a new IgnoreAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents an IgnoreAction. - * @implements IIgnoreAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set - */ - function IgnoreAction(properties) { - this.ignoreTerms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IgnoreAction ignoreTerms. - * @member {Array.} ignoreTerms - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction - * @instance - */ - IgnoreAction.prototype.ignoreTerms = $util.emptyArray; - - /** - * Creates a new IgnoreAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction instance - */ - IgnoreAction.create = function create(properties) { - return new IgnoreAction(properties); - }; - - /** - * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IgnoreAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ignoreTerms != null && message.ignoreTerms.length) - for (var i = 0; i < message.ignoreTerms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); - return writer; - }; - - /** - * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IgnoreAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IgnoreAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.ignoreTerms && message.ignoreTerms.length)) - message.ignoreTerms = []; - message.ignoreTerms.push(reader.string()); + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -26946,125 +26664,137 @@ }; /** - * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * Decodes a TimeRange message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + TimeRange.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IgnoreAction message. + * Verifies a TimeRange message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IgnoreAction.verify = function verify(message) { + TimeRange.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { - if (!Array.isArray(message.ignoreTerms)) - return "ignoreTerms: array expected"; - for (var i = 0; i < message.ignoreTerms.length; ++i) - if (!$util.isString(message.ignoreTerms[i])) - return "ignoreTerms: string[] expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; } return null; }; /** - * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange */ - IgnoreAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.IgnoreAction) + TimeRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition.TimeRange) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); - if (object.ignoreTerms) { - if (!Array.isArray(object.ignoreTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.IgnoreAction.ignoreTerms: array expected"); - message.ignoreTerms = []; - for (var i = 0; i < object.ignoreTerms.length; ++i) - message.ignoreTerms[i] = String(object.ignoreTerms[i]); + var message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } return message; }; /** - * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static - * @param {google.cloud.retail.v2alpha.Rule.IgnoreAction} message IgnoreAction + * @param {google.cloud.retail.v2alpha.Condition.TimeRange} message TimeRange * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IgnoreAction.toObject = function toObject(message, options) { + TimeRange.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.ignoreTerms = []; - if (message.ignoreTerms && message.ignoreTerms.length) { - object.ignoreTerms = []; - for (var j = 0; j < message.ignoreTerms.length; ++j) - object.ignoreTerms[j] = message.ignoreTerms[j]; + if (options.defaults) { + object.startTime = null; + object.endTime = null; } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); return object; }; /** - * Converts this IgnoreAction to JSON. + * Converts this TimeRange to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @instance * @returns {Object.} JSON object */ - IgnoreAction.prototype.toJSON = function toJSON() { + TimeRange.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IgnoreAction; + return TimeRange; })(); - return Rule; + return Condition; })(); - v2alpha.Audience = (function() { + v2alpha.Rule = (function() { /** - * Properties of an Audience. + * Properties of a Rule. * @memberof google.cloud.retail.v2alpha - * @interface IAudience - * @property {Array.|null} [genders] Audience genders - * @property {Array.|null} [ageGroups] Audience ageGroups + * @interface IRule + * @property {google.cloud.retail.v2alpha.Rule.IBoostAction|null} [boostAction] Rule boostAction + * @property {google.cloud.retail.v2alpha.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction + * @property {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction + * @property {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction + * @property {google.cloud.retail.v2alpha.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction + * @property {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction + * @property {google.cloud.retail.v2alpha.Rule.IFilterAction|null} [filterAction] Rule filterAction + * @property {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction + * @property {google.cloud.retail.v2alpha.ICondition|null} [condition] Rule condition */ /** - * Constructs a new Audience. + * Constructs a new Rule. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Audience. - * @implements IAudience + * @classdesc Represents a Rule. + * @implements IRule * @constructor - * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set */ - function Audience(properties) { - this.genders = []; - this.ageGroups = []; + function Rule(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27072,94 +26802,193 @@ } /** - * Audience genders. - * @member {Array.} genders - * @memberof google.cloud.retail.v2alpha.Audience + * Rule boostAction. + * @member {google.cloud.retail.v2alpha.Rule.IBoostAction|null|undefined} boostAction + * @memberof google.cloud.retail.v2alpha.Rule * @instance */ - Audience.prototype.genders = $util.emptyArray; + Rule.prototype.boostAction = null; /** - * Audience ageGroups. - * @member {Array.} ageGroups - * @memberof google.cloud.retail.v2alpha.Audience + * Rule redirectAction. + * @member {google.cloud.retail.v2alpha.Rule.IRedirectAction|null|undefined} redirectAction + * @memberof google.cloud.retail.v2alpha.Rule * @instance */ - Audience.prototype.ageGroups = $util.emptyArray; + Rule.prototype.redirectAction = null; /** - * Creates a new Audience instance using the specified properties. + * Rule onewaySynonymsAction. + * @member {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.onewaySynonymsAction = null; + + /** + * Rule doNotAssociateAction. + * @member {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.doNotAssociateAction = null; + + /** + * Rule replacementAction. + * @member {google.cloud.retail.v2alpha.Rule.IReplacementAction|null|undefined} replacementAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.replacementAction = null; + + /** + * Rule ignoreAction. + * @member {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null|undefined} ignoreAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.ignoreAction = null; + + /** + * Rule filterAction. + * @member {google.cloud.retail.v2alpha.Rule.IFilterAction|null|undefined} filterAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.filterAction = null; + + /** + * Rule twowaySynonymsAction. + * @member {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.twowaySynonymsAction = null; + + /** + * Rule condition. + * @member {google.cloud.retail.v2alpha.ICondition|null|undefined} condition + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.condition = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Rule action. + * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Object.defineProperty(Rule.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Rule instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static - * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Audience} Audience instance + * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule} Rule instance */ - Audience.create = function create(properties) { - return new Audience(properties); + Rule.create = function create(properties) { + return new Rule(properties); }; /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static - * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Audience.encode = function encode(message, writer) { + Rule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.genders != null && message.genders.length) - for (var i = 0; i < message.genders.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); - if (message.ageGroups != null && message.ageGroups.length) - for (var i = 0; i < message.ageGroups.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.cloud.retail.v2alpha.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) + $root.google.cloud.retail.v2alpha.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) + $root.google.cloud.retail.v2alpha.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) + $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) + $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) + $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) + $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) + $root.google.cloud.retail.v2alpha.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) + $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static - * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Audience.encodeDelimited = function encodeDelimited(message, writer) { + Rule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Audience message from the specified reader or buffer. + * Decodes a Rule message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Audience} Audience + * @returns {google.cloud.retail.v2alpha.Rule} Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Audience.decode = function decode(reader, length) { + Rule.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Audience(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); - break; case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); + break; + case 3: + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + case 6: + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + case 7: + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + case 8: + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + case 9: + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + case 10: + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); + break; + case 11: + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + case 1: + message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -27170,1888 +26999,1451 @@ }; /** - * Decodes an Audience message from the specified reader or buffer, length delimited. + * Decodes a Rule message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Audience} Audience + * @returns {google.cloud.retail.v2alpha.Rule} Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Audience.decodeDelimited = function decodeDelimited(reader) { + Rule.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Audience message. + * Verifies a Rule message. * @function verify - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Audience.verify = function verify(message) { + Rule.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.genders != null && message.hasOwnProperty("genders")) { - if (!Array.isArray(message.genders)) - return "genders: array expected"; - for (var i = 0; i < message.genders.length; ++i) - if (!$util.isString(message.genders[i])) - return "genders: string[] expected"; + var properties = {}; + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.BoostAction.verify(message.boostAction); + if (error) + return "boostAction." + error; + } } - if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { - if (!Array.isArray(message.ageGroups)) - return "ageGroups: array expected"; - for (var i = 0; i < message.ageGroups.length; ++i) - if (!$util.isString(message.ageGroups[i])) - return "ageGroups: string[] expected"; + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.verify(message.redirectAction); + if (error) + return "redirectAction." + error; + } + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); + if (error) + return "onewaySynonymsAction." + error; + } + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); + if (error) + return "doNotAssociateAction." + error; + } + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.verify(message.replacementAction); + if (error) + return "replacementAction." + error; + } + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.verify(message.ignoreAction); + if (error) + return "ignoreAction." + error; + } + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.FilterAction.verify(message.filterAction); + if (error) + return "filterAction." + error; + } + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (error) + return "twowaySynonymsAction." + error; + } + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.cloud.retail.v2alpha.Condition.verify(message.condition); + if (error) + return "condition." + error; } return null; }; /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * Creates a Rule message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Audience} Audience + * @returns {google.cloud.retail.v2alpha.Rule} Rule */ - Audience.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Audience) + Rule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule) return object; - var message = new $root.google.cloud.retail.v2alpha.Audience(); - if (object.genders) { - if (!Array.isArray(object.genders)) - throw TypeError(".google.cloud.retail.v2alpha.Audience.genders: array expected"); - message.genders = []; - for (var i = 0; i < object.genders.length; ++i) - message.genders[i] = String(object.genders[i]); + var message = new $root.google.cloud.retail.v2alpha.Rule(); + if (object.boostAction != null) { + if (typeof object.boostAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.boostAction: object expected"); + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.fromObject(object.boostAction); } - if (object.ageGroups) { - if (!Array.isArray(object.ageGroups)) - throw TypeError(".google.cloud.retail.v2alpha.Audience.ageGroups: array expected"); - message.ageGroups = []; - for (var i = 0; i < object.ageGroups.length; ++i) - message.ageGroups[i] = String(object.ageGroups[i]); + if (object.redirectAction != null) { + if (typeof object.redirectAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.redirectAction: object expected"); + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.fromObject(object.redirectAction); + } + if (object.onewaySynonymsAction != null) { + if (typeof object.onewaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.onewaySynonymsAction: object expected"); + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + } + if (object.doNotAssociateAction != null) { + if (typeof object.doNotAssociateAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.doNotAssociateAction: object expected"); + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); + } + if (object.replacementAction != null) { + if (typeof object.replacementAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.replacementAction: object expected"); + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.fromObject(object.replacementAction); + } + if (object.ignoreAction != null) { + if (typeof object.ignoreAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.ignoreAction: object expected"); + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.fromObject(object.ignoreAction); + } + if (object.filterAction != null) { + if (typeof object.filterAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.filterAction: object expected"); + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.fromObject(object.filterAction); + } + if (object.twowaySynonymsAction != null) { + if (typeof object.twowaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.twowaySynonymsAction: object expected"); + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.condition: object expected"); + message.condition = $root.google.cloud.retail.v2alpha.Condition.fromObject(object.condition); } return message; }; /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. + * Creates a plain object from a Rule message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @static - * @param {google.cloud.retail.v2alpha.Audience} message Audience + * @param {google.cloud.retail.v2alpha.Rule} message Rule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Audience.toObject = function toObject(message, options) { + Rule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.genders = []; - object.ageGroups = []; + if (options.defaults) + object.condition = null; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.cloud.retail.v2alpha.Condition.toObject(message.condition, options); + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + object.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.toObject(message.boostAction, options); + if (options.oneofs) + object.action = "boostAction"; } - if (message.genders && message.genders.length) { - object.genders = []; - for (var j = 0; j < message.genders.length; ++j) - object.genders[j] = message.genders[j]; + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + object.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.toObject(message.redirectAction, options); + if (options.oneofs) + object.action = "redirectAction"; } - if (message.ageGroups && message.ageGroups.length) { - object.ageGroups = []; - for (var j = 0; j < message.ageGroups.length; ++j) - object.ageGroups[j] = message.ageGroups[j]; + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + object.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); + if (options.oneofs) + object.action = "onewaySynonymsAction"; + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + object.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); + if (options.oneofs) + object.action = "doNotAssociateAction"; + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + object.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.toObject(message.replacementAction, options); + if (options.oneofs) + object.action = "replacementAction"; + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + object.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.toObject(message.ignoreAction, options); + if (options.oneofs) + object.action = "ignoreAction"; + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + object.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.toObject(message.filterAction, options); + if (options.oneofs) + object.action = "filterAction"; + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + object.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); + if (options.oneofs) + object.action = "twowaySynonymsAction"; } return object; }; /** - * Converts this Audience to JSON. + * Converts this Rule to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Audience + * @memberof google.cloud.retail.v2alpha.Rule * @instance * @returns {Object.} JSON object */ - Audience.prototype.toJSON = function toJSON() { + Rule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Audience; - })(); - - v2alpha.ColorInfo = (function() { + Rule.BoostAction = (function() { - /** - * Properties of a ColorInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IColorInfo - * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies - * @property {Array.|null} [colors] ColorInfo colors - */ + /** + * Properties of a BoostAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IBoostAction + * @property {number|null} [boost] BoostAction boost + * @property {string|null} [productsFilter] BoostAction productsFilter + */ - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set - */ - function ColorInfo(properties) { - this.colorFamilies = []; - this.colors = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new BoostAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a BoostAction. + * @implements IBoostAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set + */ + function BoostAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ColorInfo colorFamilies. - * @member {Array.} colorFamilies - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @instance - */ - ColorInfo.prototype.colorFamilies = $util.emptyArray; + /** + * BoostAction boost. + * @member {number} boost + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @instance + */ + BoostAction.prototype.boost = 0; - /** - * ColorInfo colors. - * @member {Array.} colors - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @instance - */ - ColorInfo.prototype.colors = $util.emptyArray; + /** + * BoostAction productsFilter. + * @member {string} productsFilter + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @instance + */ + BoostAction.prototype.productsFilter = ""; - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; + /** + * Creates a new BoostAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction instance + */ + BoostAction.create = function create(properties) { + return new BoostAction(properties); + }; - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.colorFamilies != null && message.colorFamilies.length) - for (var i = 0; i < message.colorFamilies.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); - return writer; - }; + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); + if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + return writer; + }; - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ColorInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.boost = reader.float(); + break; + case 2: + message.productsFilter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ColorInfo message. - * @function verify - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ColorInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { - if (!Array.isArray(message.colorFamilies)) - return "colorFamilies: array expected"; - for (var i = 0; i < message.colorFamilies.length; ++i) - if (!$util.isString(message.colorFamilies[i])) - return "colorFamilies: string[] expected"; - } - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) - if (!$util.isString(message.colors[i])) - return "colors: string[] expected"; - } - return null; - }; + /** + * Verifies a BoostAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + if (!$util.isString(message.productsFilter)) + return "productsFilter: string expected"; + return null; + }; - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ColorInfo) + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + */ + BoostAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.BoostAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); + if (object.boost != null) + message.boost = Number(object.boost); + if (object.productsFilter != null) + message.productsFilter = String(object.productsFilter); + return message; + }; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.BoostAction} message BoostAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.boost = 0; + object.productsFilter = ""; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + object.productsFilter = message.productsFilter; return object; - var message = new $root.google.cloud.retail.v2alpha.ColorInfo(); - if (object.colorFamilies) { - if (!Array.isArray(object.colorFamilies)) - throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colorFamilies: array expected"); - message.colorFamilies = []; - for (var i = 0; i < object.colorFamilies.length; ++i) - message.colorFamilies[i] = String(object.colorFamilies[i]); - } - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) - message.colors[i] = String(object.colors[i]); - } - return message; - }; + }; - /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.ColorInfo} message ColorInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ColorInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.colorFamilies = []; - object.colors = []; - } - if (message.colorFamilies && message.colorFamilies.length) { - object.colorFamilies = []; - for (var j = 0; j < message.colorFamilies.length; ++j) - object.colorFamilies[j] = message.colorFamilies[j]; - } - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = message.colors[j]; + /** + * Converts this BoostAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @instance + * @returns {Object.} JSON object + */ + BoostAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BoostAction; + })(); + + Rule.FilterAction = (function() { + + /** + * Properties of a FilterAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IFilterAction + * @property {string|null} [filter] FilterAction filter + */ + + /** + * Constructs a new FilterAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a FilterAction. + * @implements IFilterAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set + */ + function FilterAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return object; - }; - /** - * Converts this ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * FilterAction filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @instance + */ + FilterAction.prototype.filter = ""; - return ColorInfo; - })(); + /** + * Creates a new FilterAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction instance + */ + FilterAction.create = function create(properties) { + return new FilterAction(properties); + }; - v2alpha.CustomAttribute = (function() { + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + return writer; + }; - /** - * Properties of a CustomAttribute. - * @memberof google.cloud.retail.v2alpha - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers - * @property {boolean|null} [searchable] CustomAttribute searchable - * @property {boolean|null} [indexable] CustomAttribute indexable - */ + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Constructs a new CustomAttribute. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute - * @constructor - * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set - */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.text = $util.emptyArray; + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.numbers = $util.emptyArray; + /** + * Verifies a FilterAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilterAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; - /** - * CustomAttribute searchable. - * @member {boolean|null|undefined} searchable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.searchable = null; + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + */ + FilterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.FilterAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; - /** - * CustomAttribute indexable. - * @member {boolean|null|undefined} indexable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.indexable = null; + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.FilterAction} message FilterAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilterAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.filter = ""; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Converts this FilterAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @instance + * @returns {Object.} JSON object + */ + FilterAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * CustomAttribute _searchable. - * @member {"searchable"|undefined} _searchable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_searchable", { - get: $util.oneOfGetter($oneOfFields = ["searchable"]), - set: $util.oneOfSetter($oneOfFields) - }); + return FilterAction; + })(); - /** - * CustomAttribute _indexable. - * @member {"indexable"|undefined} _indexable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_indexable", { - get: $util.oneOfGetter($oneOfFields = ["indexable"]), - set: $util.oneOfSetter($oneOfFields) - }); + Rule.RedirectAction = (function() { - /** - * Creates a new CustomAttribute instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance - */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); - }; + /** + * Properties of a RedirectAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IRedirectAction + * @property {string|null} [redirectUri] RedirectAction redirectUri + */ - /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomAttribute.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); + /** + * Constructs a new RedirectAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a RedirectAction. + * @implements IRedirectAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set + */ + function RedirectAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); - if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); - return writer; - }; - - /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - /** - * Decodes a CustomAttribute message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomAttribute.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CustomAttribute message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomAttribute.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - properties._searchable = 1; - if (typeof message.searchable !== "boolean") - return "searchable: boolean expected"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - properties._indexable = 1; - if (typeof message.indexable !== "boolean") - return "indexable: boolean expected"; - } - return null; - }; + /** + * RedirectAction redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @instance + */ + RedirectAction.prototype.redirectUri = ""; - /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute - */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) - return object; - var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); - } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); - } - if (object.searchable != null) - message.searchable = Boolean(object.searchable); - if (object.indexable != null) - message.indexable = Boolean(object.indexable); - return message; - }; + /** + * Creates a new RedirectAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction instance + */ + RedirectAction.create = function create(properties) { + return new RedirectAction(properties); + }; - /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomAttribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - object.searchable = message.searchable; - if (options.oneofs) - object._searchable = "searchable"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - object.indexable = message.indexable; - if (options.oneofs) - object._indexable = "indexable"; - } - return object; - }; + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); + return writer; + }; - /** - * Converts this CustomAttribute to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - * @returns {Object.} JSON object - */ - CustomAttribute.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - return CustomAttribute; - })(); + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redirectUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - v2alpha.FulfillmentInfo = (function() { + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Properties of a FulfillmentInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IFulfillmentInfo - * @property {string|null} [type] FulfillmentInfo type - * @property {Array.|null} [placeIds] FulfillmentInfo placeIds - */ + /** + * Verifies a RedirectAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedirectAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; - /** - * Constructs a new FulfillmentInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a FulfillmentInfo. - * @implements IFulfillmentInfo - * @constructor - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set - */ - function FulfillmentInfo(properties) { - this.placeIds = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction + */ + RedirectAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.RedirectAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; - /** - * FulfillmentInfo type. - * @member {string} type - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @instance - */ - FulfillmentInfo.prototype.type = ""; + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.RedirectAction} message RedirectAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedirectAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.redirectUri = ""; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + return object; + }; - /** - * FulfillmentInfo placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @instance - */ - FulfillmentInfo.prototype.placeIds = $util.emptyArray; + /** + * Converts this RedirectAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @instance + * @returns {Object.} JSON object + */ + RedirectAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new FulfillmentInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo instance - */ - FulfillmentInfo.create = function create(properties) { - return new FulfillmentInfo(properties); - }; + return RedirectAction; + })(); - /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FulfillmentInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); - return writer; - }; + Rule.TwowaySynonymsAction = (function() { - /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a TwowaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface ITwowaySynonymsAction + * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms + */ - /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FulfillmentInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Constructs a new TwowaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a TwowaySynonymsAction. + * @implements ITwowaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set + */ + function TwowaySynonymsAction(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return message; - }; - /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * TwowaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @instance + */ + TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; - /** - * Verifies a FulfillmentInfo message. - * @function verify - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FulfillmentInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - return null; - }; - - /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo - */ - FulfillmentInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.FulfillmentInfo) - return object; - var message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.FulfillmentInfo.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - return message; - }; - - /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @static - * @param {google.cloud.retail.v2alpha.FulfillmentInfo} message FulfillmentInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FulfillmentInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) - object.type = ""; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; - } - return object; - }; - - /** - * Converts this FulfillmentInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo - * @instance - * @returns {Object.} JSON object - */ - FulfillmentInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FulfillmentInfo; - })(); - - v2alpha.Image = (function() { - - /** - * Properties of an Image. - * @memberof google.cloud.retail.v2alpha - * @interface IImage - * @property {string|null} [uri] Image uri - * @property {number|null} [height] Image height - * @property {number|null} [width] Image width - */ - - /** - * Constructs a new Image. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Image. - * @implements IImage - * @constructor - * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set - */ - function Image(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance + */ + TwowaySynonymsAction.create = function create(properties) { + return new TwowaySynonymsAction(properties); + }; - /** - * Image uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.uri = ""; + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); + return writer; + }; - /** - * Image height. - * @member {number} height - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.height = 0; + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Image width. - * @member {number} width - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.width = 0; + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new Image instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Image} Image instance - */ - Image.create = function create(properties) { - return new Image(properties); - }; + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Image.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); - return writer; - }; + /** + * Verifies a TwowaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TwowaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; - /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Image.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction + */ + TwowaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; - /** - * Decodes an Image message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Image} Image - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Image.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} message TwowaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TwowaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; } - } - return message; - }; + return object; + }; - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Image} Image - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Image.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this TwowaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + TwowaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies an Image message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Image.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; - return null; - }; + return TwowaySynonymsAction; + })(); - /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Image} Image - */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Image) - return object; - var message = new $root.google.cloud.retail.v2alpha.Image(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.height != null) - message.height = object.height | 0; - if (object.width != null) - message.width = object.width | 0; - return message; - }; + Rule.OnewaySynonymsAction = (function() { - /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Image - * @static - * @param {google.cloud.retail.v2alpha.Image} message Image - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Image.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.uri = ""; - object.height = 0; - object.width = 0; + /** + * Properties of an OnewaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IOnewaySynonymsAction + * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms + * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms + * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms + */ + + /** + * Constructs a new OnewaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents an OnewaySynonymsAction. + * @implements IOnewaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + */ + function OnewaySynonymsAction(properties) { + this.queryTerms = []; + this.synonyms = []; + this.onewayTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; - return object; - }; - /** - * Converts this Image to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Image - * @instance - * @returns {Object.} JSON object - */ - Image.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * OnewaySynonymsAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; - return Image; - })(); + /** + * OnewaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; - v2alpha.Interval = (function() { + /** + * OnewaySynonymsAction onewayTerms. + * @member {Array.} onewayTerms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; - /** - * Properties of an Interval. - * @memberof google.cloud.retail.v2alpha - * @interface IInterval - * @property {number|null} [minimum] Interval minimum - * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum - * @property {number|null} [maximum] Interval maximum - * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum - */ + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + */ + OnewaySynonymsAction.create = function create(properties) { + return new OnewaySynonymsAction(properties); + }; - /** - * Constructs a new Interval. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Interval. - * @implements IInterval - * @constructor - * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set - */ - function Interval(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.onewayTerms != null && message.onewayTerms.length) + for (var i = 0; i < message.onewayTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + return writer; + }; - /** - * Interval minimum. - * @member {number|null|undefined} minimum - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - */ - Interval.prototype.minimum = null; + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Interval exclusiveMinimum. - * @member {number|null|undefined} exclusiveMinimum - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - */ - Interval.prototype.exclusiveMinimum = null; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 4: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + case 2: + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Interval maximum. - * @member {number|null|undefined} maximum - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - */ - Interval.prototype.maximum = null; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Interval exclusiveMaximum. - * @member {number|null|undefined} exclusiveMaximum - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - */ - Interval.prototype.exclusiveMaximum = null; + /** + * Verifies an OnewaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnewaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { + if (!Array.isArray(message.onewayTerms)) + return "onewayTerms: array expected"; + for (var i = 0; i < message.onewayTerms.length; ++i) + if (!$util.isString(message.onewayTerms[i])) + return "onewayTerms: string[] expected"; + } + return null; + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + */ + OnewaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + if (object.onewayTerms) { + if (!Array.isArray(object.onewayTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.onewayTerms: array expected"); + message.onewayTerms = []; + for (var i = 0; i < object.onewayTerms.length; ++i) + message.onewayTerms[i] = String(object.onewayTerms[i]); + } + return message; + }; - /** - * Interval min. - * @member {"minimum"|"exclusiveMinimum"|undefined} min - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - */ - Object.defineProperty(Interval.prototype, "min", { - get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnewaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.onewayTerms = []; + object.queryTerms = []; + object.synonyms = []; + } + if (message.onewayTerms && message.onewayTerms.length) { + object.onewayTerms = []; + for (var j = 0; j < message.onewayTerms.length; ++j) + object.onewayTerms[j] = message.onewayTerms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; - /** - * Interval max. - * @member {"maximum"|"exclusiveMaximum"|undefined} max - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - */ - Object.defineProperty(Interval.prototype, "max", { - get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Converts this OnewaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + OnewaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new Interval instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Interval} Interval instance - */ - Interval.create = function create(properties) { - return new Interval(properties); - }; + return OnewaySynonymsAction; + })(); - /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Interval.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); - if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); - if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) - writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); - if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) - writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); - return writer; - }; + Rule.DoNotAssociateAction = (function() { - /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Interval.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a DoNotAssociateAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IDoNotAssociateAction + * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms + * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms + * @property {Array.|null} [terms] DoNotAssociateAction terms + */ - /** - * Decodes an Interval message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Interval} Interval - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Interval.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Interval(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.minimum = reader.double(); - break; - case 2: - message.exclusiveMinimum = reader.double(); - break; - case 3: - message.maximum = reader.double(); - break; - case 4: - message.exclusiveMaximum = reader.double(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Constructs a new DoNotAssociateAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a DoNotAssociateAction. + * @implements IDoNotAssociateAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + */ + function DoNotAssociateAction(properties) { + this.queryTerms = []; + this.doNotAssociateTerms = []; + this.terms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return message; - }; - - /** - * Decodes an Interval message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Interval} Interval - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Interval.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - /** - * Verifies an Interval message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Interval.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - properties.min = 1; - if (typeof message.minimum !== "number") - return "minimum: number expected"; - } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - if (properties.min === 1) - return "min: multiple values"; - properties.min = 1; - if (typeof message.exclusiveMinimum !== "number") - return "exclusiveMinimum: number expected"; - } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - properties.max = 1; - if (typeof message.maximum !== "number") - return "maximum: number expected"; - } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - if (properties.max === 1) - return "max: multiple values"; - properties.max = 1; - if (typeof message.exclusiveMaximum !== "number") - return "exclusiveMaximum: number expected"; - } - return null; - }; + /** + * DoNotAssociateAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; - /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Interval} Interval - */ - Interval.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Interval) - return object; - var message = new $root.google.cloud.retail.v2alpha.Interval(); - if (object.minimum != null) - message.minimum = Number(object.minimum); - if (object.exclusiveMinimum != null) - message.exclusiveMinimum = Number(object.exclusiveMinimum); - if (object.maximum != null) - message.maximum = Number(object.maximum); - if (object.exclusiveMaximum != null) - message.exclusiveMaximum = Number(object.exclusiveMaximum); - return message; - }; + /** + * DoNotAssociateAction doNotAssociateTerms. + * @member {Array.} doNotAssociateTerms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; - /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Interval - * @static - * @param {google.cloud.retail.v2alpha.Interval} message Interval - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Interval.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; - if (options.oneofs) - object.min = "minimum"; - } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; - if (options.oneofs) - object.min = "exclusiveMinimum"; - } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; - if (options.oneofs) - object.max = "maximum"; - } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; - if (options.oneofs) - object.max = "exclusiveMaximum"; - } - return object; - }; - - /** - * Converts this Interval to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Interval - * @instance - * @returns {Object.} JSON object - */ - Interval.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Interval; - })(); - - v2alpha.PriceInfo = (function() { - - /** - * Properties of a PriceInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IPriceInfo - * @property {string|null} [currencyCode] PriceInfo currencyCode - * @property {number|null} [price] PriceInfo price - * @property {number|null} [originalPrice] PriceInfo originalPrice - * @property {number|null} [cost] PriceInfo cost - * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime - * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime - * @property {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange - */ - - /** - * Constructs a new PriceInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PriceInfo. - * @implements IPriceInfo - * @constructor - * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set - */ - function PriceInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PriceInfo currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.currencyCode = ""; - - /** - * PriceInfo price. - * @member {number} price - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.price = 0; - - /** - * PriceInfo originalPrice. - * @member {number} originalPrice - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.originalPrice = 0; - - /** - * PriceInfo cost. - * @member {number} cost - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.cost = 0; - - /** - * PriceInfo priceEffectiveTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.priceEffectiveTime = null; - - /** - * PriceInfo priceExpireTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.priceExpireTime = null; - - /** - * PriceInfo priceRange. - * @member {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null|undefined} priceRange - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.priceRange = null; - - /** - * Creates a new PriceInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance - */ - PriceInfo.create = function create(properties) { - return new PriceInfo(properties); - }; - - /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) - $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) - $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) - $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PriceInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.currencyCode = reader.string(); - break; - case 2: - message.price = reader.float(); - break; - case 3: - message.originalPrice = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PriceInfo message. - * @function verify - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PriceInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - if (message.price != null && message.hasOwnProperty("price")) - if (typeof message.price !== "number") - return "price: number expected"; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - if (typeof message.originalPrice !== "number") - return "originalPrice: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); - if (error) - return "priceEffectiveTime." + error; - } - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); - if (error) - return "priceExpireTime." + error; - } - if (message.priceRange != null && message.hasOwnProperty("priceRange")) { - var error = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify(message.priceRange); - if (error) - return "priceRange." + error; - } - return null; - }; - - /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo - */ - PriceInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) - return object; - var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - if (object.price != null) - message.price = Number(object.price); - if (object.originalPrice != null) - message.originalPrice = Number(object.originalPrice); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.priceEffectiveTime != null) { - if (typeof object.priceEffectiveTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceEffectiveTime: object expected"); - message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); - } - if (object.priceExpireTime != null) { - if (typeof object.priceExpireTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceExpireTime: object expected"); - message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); - } - if (object.priceRange != null) { - if (typeof object.priceRange !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceRange: object expected"); - message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.fromObject(object.priceRange); - } - return message; - }; - - /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @static - * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PriceInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.currencyCode = ""; - object.price = 0; - object.originalPrice = 0; - object.cost = 0; - object.priceEffectiveTime = null; - object.priceExpireTime = null; - object.priceRange = null; - } - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - if (message.price != null && message.hasOwnProperty("price")) - object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) - object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) - object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); - if (message.priceRange != null && message.hasOwnProperty("priceRange")) - object.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.toObject(message.priceRange, options); - return object; - }; - - /** - * Converts this PriceInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - * @returns {Object.} JSON object - */ - PriceInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - PriceInfo.PriceRange = (function() { - - /** - * Properties of a PriceRange. - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @interface IPriceRange - * @property {google.cloud.retail.v2alpha.IInterval|null} [price] PriceRange price - * @property {google.cloud.retail.v2alpha.IInterval|null} [originalPrice] PriceRange originalPrice - */ - - /** - * Constructs a new PriceRange. - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @classdesc Represents a PriceRange. - * @implements IPriceRange - * @constructor - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set - */ - function PriceRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PriceRange price. - * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} price - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.price = null; - - /** - * PriceRange originalPrice. - * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} originalPrice - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.originalPrice = null; + /** + * DoNotAssociateAction terms. + * @member {Array.} terms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.terms = $util.emptyArray; /** - * Creates a new PriceRange instance using the specified properties. + * Creates a new DoNotAssociateAction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange instance + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction instance */ - PriceRange.create = function create(properties) { - return new PriceRange(properties); + DoNotAssociateAction.create = function create(properties) { + return new DoNotAssociateAction(properties); }; /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceRange.encode = function encode(message, writer) { + DoNotAssociateAction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - $root.google.cloud.retail.v2alpha.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - $root.google.cloud.retail.v2alpha.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.terms != null && message.terms.length) + for (var i = 0; i < message.terms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); return writer; }; /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PriceRange message from the specified reader or buffer. + * Decodes a DoNotAssociateAction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceRange.decode = function decode(reader, length) { + DoNotAssociateAction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; case 2: - message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + case 1: + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -29062,389 +28454,618 @@ }; /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceRange.decodeDelimited = function decodeDelimited(reader) { + DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PriceRange message. + * Verifies a DoNotAssociateAction message. * @function verify - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PriceRange.verify = function verify(message) { + DoNotAssociateAction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.price != null && message.hasOwnProperty("price")) { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.price); - if (error) - return "price." + error; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; } - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.originalPrice); - if (error) - return "originalPrice." + error; + if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { + if (!Array.isArray(message.doNotAssociateTerms)) + return "doNotAssociateTerms: array expected"; + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + if (!$util.isString(message.doNotAssociateTerms[i])) + return "doNotAssociateTerms: string[] expected"; + } + if (message.terms != null && message.hasOwnProperty("terms")) { + if (!Array.isArray(message.terms)) + return "terms: array expected"; + for (var i = 0; i < message.terms.length; ++i) + if (!$util.isString(message.terms[i])) + return "terms: string[] expected"; } return null; }; /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction */ - PriceRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange) + DoNotAssociateAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction) return object; - var message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); - if (object.price != null) { - if (typeof object.price !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.price: object expected"); - message.price = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.price); + var message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); } - if (object.originalPrice != null) { - if (typeof object.originalPrice !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.originalPrice: object expected"); - message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.originalPrice); + if (object.doNotAssociateTerms) { + if (!Array.isArray(object.doNotAssociateTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); + message.doNotAssociateTerms = []; + for (var i = 0; i < object.doNotAssociateTerms.length; ++i) + message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); + } + if (object.terms) { + if (!Array.isArray(object.terms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.terms: array expected"); + message.terms = []; + for (var i = 0; i < object.terms.length; ++i) + message.terms[i] = String(object.terms[i]); } return message; }; /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.PriceRange} message PriceRange + * @param {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} message DoNotAssociateAction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PriceRange.toObject = function toObject(message, options) { + DoNotAssociateAction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.price = null; - object.originalPrice = null; + if (options.arrays || options.defaults) { + object.terms = []; + object.queryTerms = []; + object.doNotAssociateTerms = []; + } + if (message.terms && message.terms.length) { + object.terms = []; + for (var j = 0; j < message.terms.length; ++j) + object.terms[j] = message.terms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { + object.doNotAssociateTerms = []; + for (var j = 0; j < message.doNotAssociateTerms.length; ++j) + object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; } - if (message.price != null && message.hasOwnProperty("price")) - object.price = $root.google.cloud.retail.v2alpha.Interval.toObject(message.price, options); - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = $root.google.cloud.retail.v2alpha.Interval.toObject(message.originalPrice, options); return object; }; /** - * Converts this PriceRange to JSON. + * Converts this DoNotAssociateAction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction * @instance * @returns {Object.} JSON object */ - PriceRange.prototype.toJSON = function toJSON() { + DoNotAssociateAction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PriceRange; + return DoNotAssociateAction; })(); - return PriceInfo; - })(); - - v2alpha.Rating = (function() { + Rule.ReplacementAction = (function() { - /** - * Properties of a Rating. - * @memberof google.cloud.retail.v2alpha - * @interface IRating - * @property {number|null} [ratingCount] Rating ratingCount - * @property {number|null} [averageRating] Rating averageRating - * @property {Array.|null} [ratingHistogram] Rating ratingHistogram - */ + /** + * Properties of a ReplacementAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IReplacementAction + * @property {Array.|null} [queryTerms] ReplacementAction queryTerms + * @property {string|null} [replacementTerm] ReplacementAction replacementTerm + * @property {string|null} [term] ReplacementAction term + */ - /** - * Constructs a new Rating. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Rating. - * @implements IRating - * @constructor - * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set - */ - function Rating(properties) { - this.ratingHistogram = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new ReplacementAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a ReplacementAction. + * @implements IReplacementAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + */ + function ReplacementAction(properties) { + this.queryTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Rating ratingCount. - * @member {number} ratingCount - * @memberof google.cloud.retail.v2alpha.Rating - * @instance - */ - Rating.prototype.ratingCount = 0; + /** + * ReplacementAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.queryTerms = $util.emptyArray; - /** - * Rating averageRating. - * @member {number} averageRating - * @memberof google.cloud.retail.v2alpha.Rating - * @instance - */ - Rating.prototype.averageRating = 0; + /** + * ReplacementAction replacementTerm. + * @member {string} replacementTerm + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.replacementTerm = ""; - /** - * Rating ratingHistogram. - * @member {Array.} ratingHistogram - * @memberof google.cloud.retail.v2alpha.Rating - * @instance - */ - Rating.prototype.ratingHistogram = $util.emptyArray; + /** + * ReplacementAction term. + * @member {string} term + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.term = ""; - /** - * Creates a new Rating instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rating} Rating instance - */ - Rating.create = function create(properties) { - return new Rating(properties); - }; + /** + * Creates a new ReplacementAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction instance + */ + ReplacementAction.create = function create(properties) { + return new ReplacementAction(properties); + }; - /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Rating.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); - if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); - if (message.ratingHistogram != null && message.ratingHistogram.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (var i = 0; i < message.ratingHistogram.length; ++i) - writer.int32(message.ratingHistogram[i]); - writer.ldelim(); - } - return writer; - }; + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.term != null && Object.hasOwnProperty.call(message, "term")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + return writer; + }; - /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Rating.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Rating message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rating} Rating - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Rating.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rating(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ratingCount = reader.int32(); - break; - case 2: - message.averageRating = reader.float(); - break; - case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.ratingHistogram.push(reader.int32()); - } else - message.ratingHistogram.push(reader.int32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + message.replacementTerm = reader.string(); + break; + case 1: + message.term = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a Rating message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rating} Rating - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Rating.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a Rating message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Rating.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - if (!$util.isInteger(message.ratingCount)) - return "ratingCount: integer expected"; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - if (typeof message.averageRating !== "number") - return "averageRating: number expected"; - if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { - if (!Array.isArray(message.ratingHistogram)) - return "ratingHistogram: array expected"; - for (var i = 0; i < message.ratingHistogram.length; ++i) - if (!$util.isInteger(message.ratingHistogram[i])) - return "ratingHistogram: integer[] expected"; - } - return null; - }; + /** + * Verifies a ReplacementAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplacementAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + if (!$util.isString(message.replacementTerm)) + return "replacementTerm: string expected"; + if (message.term != null && message.hasOwnProperty("term")) + if (!$util.isString(message.term)) + return "term: string expected"; + return null; + }; - /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rating} Rating - */ - Rating.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rating) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rating(); - if (object.ratingCount != null) - message.ratingCount = object.ratingCount | 0; - if (object.averageRating != null) - message.averageRating = Number(object.averageRating); - if (object.ratingHistogram) { - if (!Array.isArray(object.ratingHistogram)) - throw TypeError(".google.cloud.retail.v2alpha.Rating.ratingHistogram: array expected"); - message.ratingHistogram = []; - for (var i = 0; i < object.ratingHistogram.length; ++i) - message.ratingHistogram[i] = object.ratingHistogram[i] | 0; - } - return message; - }; + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + */ + ReplacementAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.ReplacementAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.ReplacementAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.replacementTerm != null) + message.replacementTerm = String(object.replacementTerm); + if (object.term != null) + message.term = String(object.term); + return message; + }; - /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rating - * @static - * @param {google.cloud.retail.v2alpha.Rating} message Rating - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Rating.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.ratingHistogram = []; - if (options.defaults) { - object.ratingCount = 0; - object.averageRating = 0; - } - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - object.ratingCount = message.ratingCount; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; - if (message.ratingHistogram && message.ratingHistogram.length) { - object.ratingHistogram = []; - for (var j = 0; j < message.ratingHistogram.length; ++j) - object.ratingHistogram[j] = message.ratingHistogram[j]; - } - return object; - }; + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ReplacementAction} message ReplacementAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplacementAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.queryTerms = []; + if (options.defaults) { + object.term = ""; + object.replacementTerm = ""; + } + if (message.term != null && message.hasOwnProperty("term")) + object.term = message.term; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + object.replacementTerm = message.replacementTerm; + return object; + }; - /** - * Converts this Rating to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rating - * @instance - * @returns {Object.} JSON object - */ - Rating.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this ReplacementAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + * @returns {Object.} JSON object + */ + ReplacementAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Rating; + return ReplacementAction; + })(); + + Rule.IgnoreAction = (function() { + + /** + * Properties of an IgnoreAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IIgnoreAction + * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + */ + + /** + * Constructs a new IgnoreAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents an IgnoreAction. + * @implements IIgnoreAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + */ + function IgnoreAction(properties) { + this.ignoreTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IgnoreAction ignoreTerms. + * @member {Array.} ignoreTerms + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @instance + */ + IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction instance + */ + IgnoreAction.create = function create(properties) { + return new IgnoreAction(properties); + }; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ignoreTerms != null && message.ignoreTerms.length) + for (var i = 0; i < message.ignoreTerms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + return writer; + }; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IgnoreAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IgnoreAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { + if (!Array.isArray(message.ignoreTerms)) + return "ignoreTerms: array expected"; + for (var i = 0; i < message.ignoreTerms.length; ++i) + if (!$util.isString(message.ignoreTerms[i])) + return "ignoreTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + */ + IgnoreAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.IgnoreAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + if (object.ignoreTerms) { + if (!Array.isArray(object.ignoreTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.IgnoreAction.ignoreTerms: array expected"); + message.ignoreTerms = []; + for (var i = 0; i < object.ignoreTerms.length; ++i) + message.ignoreTerms[i] = String(object.ignoreTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IgnoreAction} message IgnoreAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IgnoreAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreTerms = []; + if (message.ignoreTerms && message.ignoreTerms.length) { + object.ignoreTerms = []; + for (var j = 0; j < message.ignoreTerms.length; ++j) + object.ignoreTerms[j] = message.ignoreTerms[j]; + } + return object; + }; + + /** + * Converts this IgnoreAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @instance + * @returns {Object.} JSON object + */ + IgnoreAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IgnoreAction; + })(); + + return Rule; })(); - v2alpha.UserInfo = (function() { + v2alpha.Audience = (function() { /** - * Properties of a UserInfo. + * Properties of an Audience. * @memberof google.cloud.retail.v2alpha - * @interface IUserInfo - * @property {string|null} [userId] UserInfo userId - * @property {string|null} [ipAddress] UserInfo ipAddress - * @property {string|null} [userAgent] UserInfo userAgent - * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups */ /** - * Constructs a new UserInfo. + * Constructs a new Audience. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserInfo. - * @implements IUserInfo + * @classdesc Represents an Audience. + * @implements IAudience * @constructor - * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set */ - function UserInfo(properties) { + function Audience(properties) { + this.genders = []; + this.ageGroups = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29452,114 +29073,94 @@ } /** - * UserInfo userId. - * @member {string} userId - * @memberof google.cloud.retail.v2alpha.UserInfo - * @instance - */ - UserInfo.prototype.userId = ""; - - /** - * UserInfo ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.retail.v2alpha.UserInfo - * @instance - */ - UserInfo.prototype.ipAddress = ""; - - /** - * UserInfo userAgent. - * @member {string} userAgent - * @memberof google.cloud.retail.v2alpha.UserInfo + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2alpha.Audience * @instance */ - UserInfo.prototype.userAgent = ""; + Audience.prototype.genders = $util.emptyArray; /** - * UserInfo directUserRequest. - * @member {boolean} directUserRequest - * @memberof google.cloud.retail.v2alpha.UserInfo + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2alpha.Audience * @instance */ - UserInfo.prototype.directUserRequest = false; + Audience.prototype.ageGroups = $util.emptyArray; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance + * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Audience} Audience instance */ - UserInfo.create = function create(properties) { - return new UserInfo(properties); + Audience.create = function create(properties) { + return new Audience(properties); }; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encode = function encode(message, writer) { + Audience.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); return writer; }; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + Audience.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decode = function decode(reader, length) { + Audience.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Audience(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userId = reader.string(); + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); break; case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -29570,132 +29171,143 @@ }; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decodeDelimited = function decodeDelimited(reader) { + Audience.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserInfo message. + * Verifies an Audience message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserInfo.verify = function verify(message) { + Audience.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userId != null && message.hasOwnProperty("userId")) - if (!$util.isString(message.userId)) - return "userId: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - if (typeof message.directUserRequest !== "boolean") - return "directUserRequest: boolean expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; + } return null; }; /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.Audience} Audience */ - UserInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Audience) return object; - var message = new $root.google.cloud.retail.v2alpha.UserInfo(); - if (object.userId != null) - message.userId = String(object.userId); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.directUserRequest != null) - message.directUserRequest = Boolean(object.directUserRequest); + var message = new $root.google.cloud.retail.v2alpha.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2alpha.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2alpha.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); + } return message; }; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * Creates a plain object from an Audience message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo + * @param {google.cloud.retail.v2alpha.Audience} message Audience * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserInfo.toObject = function toObject(message, options) { + Audience.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.userId = ""; - object.ipAddress = ""; - object.userAgent = ""; - object.directUserRequest = false; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; } - if (message.userId != null && message.hasOwnProperty("userId")) - object.userId = message.userId; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this UserInfo to JSON. + * Converts this Audience to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Audience * @instance * @returns {Object.} JSON object */ - UserInfo.prototype.toJSON = function toJSON() { + Audience.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserInfo; + return Audience; })(); - v2alpha.Promotion = (function() { + v2alpha.ColorInfo = (function() { /** - * Properties of a Promotion. + * Properties of a ColorInfo. * @memberof google.cloud.retail.v2alpha - * @interface IPromotion - * @property {string|null} [promotionId] Promotion promotionId + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors */ /** - * Constructs a new Promotion. + * Constructs a new ColorInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Promotion. - * @implements IPromotion + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set */ - function Promotion(properties) { + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29703,75 +29315,94 @@ } /** - * Promotion promotionId. - * @member {string} promotionId - * @memberof google.cloud.retail.v2alpha.Promotion + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance */ - Promotion.prototype.promotionId = ""; + ColorInfo.prototype.colorFamilies = $util.emptyArray; /** - * Creates a new Promotion instance using the specified properties. + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2alpha.ColorInfo + * @instance + */ + ColorInfo.prototype.colors = $util.emptyArray; + + /** + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion instance + * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo instance */ - Promotion.create = function create(properties) { - return new Promotion(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); return writer; }; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decode = function decode(reader, length) { + ColorInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Promotion(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.promotionId = reader.string(); + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); + break; + case 2: + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -29782,110 +29413,145 @@ }; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Promotion message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Promotion.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - if (!$util.isString(message.promotionId)) - return "promotionId: string expected"; + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; + } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; + } return null; }; /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo */ - Promotion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Promotion) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ColorInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.Promotion(); - if (object.promotionId != null) - message.promotionId = String(object.promotionId); + var message = new $root.google.cloud.retail.v2alpha.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); + } + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); + } return message; }; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.Promotion} message Promotion + * @param {google.cloud.retail.v2alpha.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Promotion.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.promotionId = ""; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - object.promotionId = message.promotionId; + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; + } + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; + } + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; + } return object; }; /** - * Converts this Promotion to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance * @returns {Object.} JSON object */ - Promotion.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Promotion; + return ColorInfo; })(); - v2alpha.LocalInventory = (function() { + v2alpha.CustomAttribute = (function() { /** - * Properties of a LocalInventory. + * Properties of a CustomAttribute. * @memberof google.cloud.retail.v2alpha - * @interface ILocalInventory - * @property {string|null} [placeId] LocalInventory placeId - * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] LocalInventory priceInfo - * @property {Object.|null} [attributes] LocalInventory attributes + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable */ /** - * Constructs a new LocalInventory. + * Constructs a new CustomAttribute. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a LocalInventory. - * @implements ILocalInventory + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute * @constructor - * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set */ - function LocalInventory(properties) { - this.attributes = {}; + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29893,123 +29559,153 @@ } /** - * LocalInventory placeId. - * @member {string} placeId - * @memberof google.cloud.retail.v2alpha.LocalInventory + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - LocalInventory.prototype.placeId = ""; + CustomAttribute.prototype.text = $util.emptyArray; /** - * LocalInventory priceInfo. - * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2alpha.LocalInventory + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - LocalInventory.prototype.priceInfo = null; + CustomAttribute.prototype.numbers = $util.emptyArray; /** - * LocalInventory attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.LocalInventory + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - LocalInventory.prototype.attributes = $util.emptyObject; + CustomAttribute.prototype.searchable = null; /** - * Creates a new LocalInventory instance using the specified properties. + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + CustomAttribute.prototype.indexable = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory instance + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance */ - LocalInventory.create = function create(properties) { - return new LocalInventory(properties); + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); }; /** - * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocalInventory.encode = function encode(message, writer) { + CustomAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocalInventory message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocalInventory.decode = function decode(reader, length) { + CustomAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.LocalInventory(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placeId = reader.string(); + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); break; case 2: - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); break; case 3: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; + message.searchable = reader.bool(); + break; + case 4: + message.indexable = reader.bool(); break; default: reader.skipType(tag & 7); @@ -30020,151 +29716,167 @@ }; /** - * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocalInventory.decodeDelimited = function decodeDelimited(reader) { + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocalInventory message. + * Verifies a CustomAttribute message. * @function verify - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocalInventory.verify = function verify(message) { + CustomAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placeId != null && message.hasOwnProperty("placeId")) - if (!$util.isString(message.placeId)) - return "placeId: string expected"; - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; } return null; }; /** - * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute */ - LocalInventory.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.LocalInventory) + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) return object; - var message = new $root.google.cloud.retail.v2alpha.LocalInventory(); - if (object.placeId != null) - message.placeId = String(object.placeId); - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); return message; }; /** - * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.LocalInventory} message LocalInventory + * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocalInventory.toObject = function toObject(message, options) { + CustomAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) { - object.placeId = ""; - object.priceInfo = null; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; } - if (message.placeId != null && message.hasOwnProperty("placeId")) - object.placeId = message.placeId; - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; + if (options.oneofs) + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; } return object; }; /** - * Converts this LocalInventory to JSON. + * Converts this CustomAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance * @returns {Object.} JSON object */ - LocalInventory.prototype.toJSON = function toJSON() { + CustomAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocalInventory; + return CustomAttribute; })(); - v2alpha.GcsSource = (function() { + v2alpha.FulfillmentInfo = (function() { /** - * Properties of a GcsSource. + * Properties of a FulfillmentInfo. * @memberof google.cloud.retail.v2alpha - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds */ /** - * Constructs a new GcsSource. + * Constructs a new FulfillmentInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo * @constructor - * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set */ - function GcsSource(properties) { - this.inputUris = []; + function FulfillmentInfo(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30172,91 +29884,91 @@ } /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2alpha.GcsSource + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance */ - GcsSource.prototype.inputUris = $util.emptyArray; + FulfillmentInfo.prototype.type = ""; /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2alpha.GcsSource + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance */ - GcsSource.prototype.dataSchema = ""; + FulfillmentInfo.prototype.placeIds = $util.emptyArray; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + FulfillmentInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + FulfillmentInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); + message.type = reader.string(); break; case 2: - message.dataSchema = reader.string(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -30267,133 +29979,130 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies a FulfillmentInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + FulfillmentInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.FulfillmentInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); + var message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource + * @param {google.cloud.retail.v2alpha.FulfillmentInfo} message FulfillmentInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + FulfillmentInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.inputUris = []; + object.placeIds = []; if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; return object; }; /** - * Converts this GcsSource to JSON. + * Converts this FulfillmentInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + FulfillmentInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return FulfillmentInfo; })(); - v2alpha.BigQuerySource = (function() { + v2alpha.Image = (function() { /** - * Properties of a BigQuerySource. + * Properties of an Image. * @memberof google.cloud.retail.v2alpha - * @interface IBigQuerySource - * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width */ /** - * Constructs a new BigQuerySource. + * Constructs a new Image. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set */ - function BigQuerySource(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30401,154 +30110,101 @@ } /** - * BigQuerySource partitionDate. - * @member {google.type.IDate|null|undefined} partitionDate - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance - */ - BigQuerySource.prototype.partitionDate = null; - - /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance - */ - BigQuerySource.prototype.projectId = ""; - - /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance - */ - BigQuerySource.prototype.datasetId = ""; - - /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance - */ - BigQuerySource.prototype.tableId = ""; - - /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - BigQuerySource.prototype.gcsStagingDir = ""; + Image.prototype.uri = ""; /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - BigQuerySource.prototype.dataSchema = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + Image.prototype.height = 0; /** - * BigQuerySource partition. - * @member {"partitionDate"|undefined} partition - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - Object.defineProperty(BigQuerySource.prototype, "partition", { - get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), - set: $util.oneOfSetter($oneOfFields) - }); + Image.prototype.width = 0; /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Image} Image instance */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); - if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) - $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + Image.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 5: - message.projectId = reader.string(); - break; case 1: - message.datasetId = reader.string(); + message.uri = reader.string(); break; case 2: - message.tableId = reader.string(); + message.height = reader.int32(); break; case 3: - message.gcsStagingDir = reader.string(); - break; - case 4: - message.dataSchema = reader.string(); + message.width = reader.int32(); break; default: reader.skipType(tag & 7); @@ -30559,160 +30215,127 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - properties.partition = 1; - { - var error = $root.google.type.Date.verify(message.partitionDate); - if (error) - return "partitionDate." + error; - } - } - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.Image} Image */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Image) return object; - var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); - if (object.partitionDate != null) { - if (typeof object.partitionDate !== "object") - throw TypeError(".google.cloud.retail.v2alpha.BigQuerySource.partitionDate: object expected"); - message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); - } - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); + var message = new $root.google.cloud.retail.v2alpha.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2alpha.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; - } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); - if (options.oneofs) - object.partition = "partitionDate"; + object.uri = ""; + object.height = 0; + object.width = 0; } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.Image * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BigQuerySource; + return Image; })(); - v2alpha.ProductInlineSource = (function() { + v2alpha.Interval = (function() { /** - * Properties of a ProductInlineSource. + * Properties of an Interval. * @memberof google.cloud.retail.v2alpha - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum */ /** - * Constructs a new ProductInlineSource. + * Constructs a new Interval. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource + * @classdesc Represents an Interval. + * @implements IInterval * @constructor - * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set */ - function ProductInlineSource(properties) { - this.products = []; + function Interval(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30720,286 +30343,139 @@ } /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - ProductInlineSource.prototype.products = $util.emptyArray; + Interval.prototype.minimum = null; /** - * Creates a new ProductInlineSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2alpha.Interval + * @instance */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); - }; + Interval.prototype.exclusiveMinimum = null; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2alpha.Interval + * @instance */ - ProductInlineSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + Interval.prototype.maximum = null; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2alpha.Interval + * @instance */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductInlineSource.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductInlineSource message. - * @function verify - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductInlineSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - return null; - }; - - /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource - */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) - return object; - var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductInlineSource - * @static - * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); - } - return object; - }; - - /** - * Converts this ProductInlineSource to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2alpha.Interval * @instance - * @returns {Object.} JSON object - */ - ProductInlineSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ProductInlineSource; - })(); - - v2alpha.UserEventInlineSource = (function() { - - /** - * Properties of a UserEventInlineSource. - * @memberof google.cloud.retail.v2alpha - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents - */ - - /** - * Constructs a new UserEventInlineSource. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource - * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set */ - function UserEventInlineSource(properties) { - this.userEvents = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new Interval instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance + * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Interval} Interval instance */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); + Interval.create = function create(properties) { + return new Interval(properties); }; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encode = function encode(message, writer) { + Interval.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); return writer; }; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + Interval.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2alpha.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decode = function decode(reader, length) { + Interval.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Interval(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); + message.minimum = reader.double(); + break; + case 2: + message.exclusiveMinimum = reader.double(); + break; + case 3: + message.maximum = reader.double(); + break; + case 4: + message.exclusiveMaximum = reader.double(); break; default: reader.skipType(tag & 7); @@ -31010,124 +30486,157 @@ }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2alpha.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + Interval.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInlineSource message. + * Verifies an Interval message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInlineSource.verify = function verify(message) { + Interval.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); - if (error) - return "userEvents." + error; - } + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; } return null; }; /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2alpha.Interval} Interval */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Interval) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); - } - } + var message = new $root.google.cloud.retail.v2alpha.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); return message; }; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * Creates a plain object from an Interval message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource + * @param {google.cloud.retail.v2alpha.Interval} message Interval * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInlineSource.toObject = function toObject(message, options) { + Interval.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; } return object; }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this Interval to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.Interval * @instance * @returns {Object.} JSON object */ - UserEventInlineSource.prototype.toJSON = function toJSON() { + Interval.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInlineSource; + return Interval; })(); - v2alpha.ImportErrorsConfig = (function() { + v2alpha.PriceInfo = (function() { /** - * Properties of an ImportErrorsConfig. + * Properties of a PriceInfo. * @memberof google.cloud.retail.v2alpha - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange */ /** - * Constructs a new ImportErrorsConfig. + * Constructs a new PriceInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo * @constructor - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set */ - function ImportErrorsConfig(properties) { + function PriceInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31135,89 +30644,153 @@ } /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PriceInfo * @instance */ - ImportErrorsConfig.prototype.gcsPrefix = null; + PriceInfo.prototype.currencyCode = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo * @instance */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + PriceInfo.prototype.originalPrice = 0; /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceEffectiveTime = null; + + /** + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceExpireTime = null; + + /** + * PriceInfo priceRange. + * @member {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceRange = null; + + /** + * Creates a new PriceInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); }; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encode = function encode(message, writer) { + PriceInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decode = function decode(reader, length) { + PriceInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -31228,117 +30801,394 @@ }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + PriceInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportErrorsConfig message. + * Verifies a PriceInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportErrorsConfig.verify = function verify(message) { + PriceInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; } return null; }; /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); + var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.fromObject(object.priceRange); + } return message; }; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig + * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportErrorsConfig.toObject = function toObject(message, options) { + PriceInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this PriceInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.PriceInfo * @instance * @returns {Object.} JSON object */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { + PriceInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportErrorsConfig; + PriceInfo.PriceRange = (function() { + + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2alpha.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2alpha.IInterval|null} [originalPrice] PriceRange originalPrice + */ + + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PriceRange price. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; + + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; + + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2alpha.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2alpha.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + + return PriceInfo; })(); - v2alpha.ImportProductsRequest = (function() { + v2alpha.Rating = (function() { /** - * Properties of an ImportProductsRequest. + * Properties of a Rating. * @memberof google.cloud.retail.v2alpha - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {string|null} [requestId] ImportProductsRequest requestId - * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask - * @property {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode - * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram */ /** - * Constructs a new ImportProductsRequest. + * Constructs a new Rating. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest + * @classdesc Represents a Rating. + * @implements IRating * @constructor - * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set */ - function ImportProductsRequest(properties) { + function Rating(properties) { + this.ratingHistogram = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31346,153 +31196,112 @@ } /** - * ImportProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.parent = ""; - - /** - * ImportProductsRequest requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.requestId = ""; - - /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.inputConfig = null; - - /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.errorsConfig = null; - - /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - ImportProductsRequest.prototype.updateMask = null; + Rating.prototype.ratingCount = 0; /** - * ImportProductsRequest reconciliationMode. - * @member {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} reconciliationMode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - ImportProductsRequest.prototype.reconciliationMode = 0; + Rating.prototype.averageRating = 0; /** - * ImportProductsRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - ImportProductsRequest.prototype.notificationPubsubTopic = ""; + Rating.prototype.ratingHistogram = $util.emptyArray; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new Rating instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance + * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rating} Rating instance */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); + Rating.create = function create(properties) { + return new Rating(properties); }; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encode = function encode(message, writer) { + Rating.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + Rating.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a Rating message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decode = function decode(reader, length) { + Rating.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rating(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); + message.ratingCount = reader.int32(); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); + message.averageRating = reader.float(); break; case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.reconciliationMode = reader.int32(); - break; - case 7: - message.notificationPubsubTopic = reader.string(); + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -31503,207 +31312,140 @@ }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a Rating message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + Rating.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsRequest message. + * Verifies a Rating message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsRequest.verify = function verify(message) { + Rating.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; } - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - switch (message.reconciliationMode) { - default: - return "reconciliationMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Rating message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.Rating} Rating */ - ImportProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rating) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - switch (object.reconciliationMode) { - case "RECONCILIATION_MODE_UNSPECIFIED": - case 0: - message.reconciliationMode = 0; - break; - case "INCREMENTAL": - case 1: - message.reconciliationMode = 1; - break; - case "FULL": - case 2: - message.reconciliationMode = 2; - break; + var message = new $root.google.cloud.retail.v2alpha.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2alpha.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a Rating message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest + * @param {google.cloud.retail.v2alpha.Rating} message Rating * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsRequest.toObject = function toObject(message, options) { + Rating.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.ratingHistogram = []; if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - object.updateMask = null; - object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + object.ratingCount = 0; + object.averageRating = 0; + } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this Rating to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.Rating * @instance * @returns {Object.} JSON object */ - ImportProductsRequest.prototype.toJSON = function toJSON() { + Rating.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * ReconciliationMode enum. - * @name google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode - * @enum {number} - * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value - * @property {number} INCREMENTAL=1 INCREMENTAL value - * @property {number} FULL=2 FULL value - */ - ImportProductsRequest.ReconciliationMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INCREMENTAL"] = 1; - values[valuesById[2] = "FULL"] = 2; - return values; - })(); - - return ImportProductsRequest; + return Rating; })(); - v2alpha.ImportUserEventsRequest = (function() { + v2alpha.UserInfo = (function() { /** - * Properties of an ImportUserEventsRequest. + * Properties of a UserInfo. * @memberof google.cloud.retail.v2alpha - * @interface IImportUserEventsRequest - * @property {string|null} [parent] ImportUserEventsRequest parent - * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest */ /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new UserInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportUserEventsRequest. - * @implements IImportUserEventsRequest + * @classdesc Represents a UserInfo. + * @implements IUserInfo * @constructor - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set */ - function ImportUserEventsRequest(properties) { + function UserInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31711,101 +31453,114 @@ } /** - * ImportUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance */ - ImportUserEventsRequest.prototype.parent = ""; + UserInfo.prototype.userId = ""; /** - * ImportUserEventsRequest inputConfig. - * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance */ - ImportUserEventsRequest.prototype.inputConfig = null; + UserInfo.prototype.ipAddress = ""; /** - * ImportUserEventsRequest errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance */ - ImportUserEventsRequest.prototype.errorsConfig = null; + UserInfo.prototype.userAgent = ""; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance */ - ImportUserEventsRequest.create = function create(properties) { - return new ImportUserEventsRequest(properties); + UserInfo.create = function create(properties) { + return new UserInfo(properties); }; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encode = function encode(message, writer) { + UserInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); return writer; }; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a UserInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decode = function decode(reader, length) { + UserInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.userId = reader.string(); break; case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); + message.ipAddress = reader.string(); break; case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); break; default: reader.skipType(tag & 7); @@ -31816,136 +31571,132 @@ }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a UserInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + UserInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a UserInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsRequest.verify = function verify(message) { + UserInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; return null; }; /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo */ - ImportUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2alpha.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); return message; }; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsRequest.toObject = function toObject(message, options) { + UserInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this UserInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance * @returns {Object.} JSON object */ - ImportUserEventsRequest.prototype.toJSON = function toJSON() { + UserInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsRequest; + return UserInfo; })(); - v2alpha.ImportCompletionDataRequest = (function() { + v2alpha.Promotion = (function() { /** - * Properties of an ImportCompletionDataRequest. + * Properties of a Promotion. * @memberof google.cloud.retail.v2alpha - * @interface IImportCompletionDataRequest - * @property {string|null} [parent] ImportCompletionDataRequest parent - * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig - * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId */ /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new Promotion. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportCompletionDataRequest. - * @implements IImportCompletionDataRequest + * @classdesc Represents a Promotion. + * @implements IPromotion * @constructor - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set */ - function ImportCompletionDataRequest(properties) { + function Promotion(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31953,101 +31704,75 @@ } /** - * ImportCompletionDataRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest - * @instance - */ - ImportCompletionDataRequest.prototype.parent = ""; - - /** - * ImportCompletionDataRequest inputConfig. - * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest - * @instance - */ - ImportCompletionDataRequest.prototype.inputConfig = null; - - /** - * ImportCompletionDataRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2alpha.Promotion * @instance */ - ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + Promotion.prototype.promotionId = ""; /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest instance + * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion instance */ - ImportCompletionDataRequest.create = function create(properties) { - return new ImportCompletionDataRequest(properties); + Promotion.create = function create(properties) { + return new Promotion(properties); }; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataRequest.encode = function encode(message, writer) { + Promotion.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); return writer; }; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + Promotion.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataRequest.decode = function decode(reader, length) { + Promotion.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Promotion(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.notificationPubsubTopic = reader.string(); + message.promotionId = reader.string(); break; default: reader.skipType(tag & 7); @@ -32058,131 +31783,110 @@ }; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { + Promotion.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies a Promotion message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportCompletionDataRequest.verify = function verify(message) { + Promotion.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; return null; }; /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion */ - ImportCompletionDataRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest) + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Promotion) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.inputConfig); - } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); + var message = new $root.google.cloud.retail.v2alpha.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); return message; }; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * Creates a plain object from a Promotion message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @static - * @param {google.cloud.retail.v2alpha.ImportCompletionDataRequest} message ImportCompletionDataRequest + * @param {google.cloud.retail.v2alpha.Promotion} message Promotion * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportCompletionDataRequest.toObject = function toObject(message, options) { + Promotion.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.notificationPubsubTopic = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.inputConfig, options); - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; return object; }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this Promotion to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.Promotion * @instance * @returns {Object.} JSON object */ - ImportCompletionDataRequest.prototype.toJSON = function toJSON() { + Promotion.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportCompletionDataRequest; + return Promotion; })(); - v2alpha.ProductInputConfig = (function() { + v2alpha.LocalInventory = (function() { /** - * Properties of a ProductInputConfig. + * Properties of a LocalInventory. * @memberof google.cloud.retail.v2alpha - * @interface IProductInputConfig - * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + * @interface ILocalInventory + * @property {string|null} [placeId] LocalInventory placeId + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] LocalInventory priceInfo + * @property {Object.|null} [attributes] LocalInventory attributes */ /** - * Constructs a new ProductInputConfig. + * Constructs a new LocalInventory. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig + * @classdesc Represents a LocalInventory. + * @implements ILocalInventory * @constructor - * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set */ - function ProductInputConfig(properties) { + function LocalInventory(properties) { + this.attributes = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32190,115 +31894,123 @@ } /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig - * @instance - */ - ProductInputConfig.prototype.productInlineSource = null; - - /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * LocalInventory placeId. + * @member {string} placeId + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - ProductInputConfig.prototype.gcsSource = null; + LocalInventory.prototype.placeId = ""; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * LocalInventory priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - ProductInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + LocalInventory.prototype.priceInfo = null; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * LocalInventory attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + LocalInventory.prototype.attributes = $util.emptyObject; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new LocalInventory instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + LocalInventory.create = function create(properties) { + return new LocalInventory(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + LocalInventory.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + LocalInventory.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.LocalInventory(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + message.placeId = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; break; default: reader.skipType(tag & 7); @@ -32309,159 +32021,151 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + LocalInventory.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies a LocalInventory message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + LocalInventory.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.placeId != null && message.hasOwnProperty("placeId")) + if (!$util.isString(message.placeId)) + return "placeId: string expected"; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); if (error) - return "bigQuerySource." + error; + return "attributes." + error; } } return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) + LocalInventory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.LocalInventory) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.retail.v2alpha.LocalInventory(); + if (object.placeId != null) + message.placeId = String(object.placeId); + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } } return message; }; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static - * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig + * @param {google.cloud.retail.v2alpha.LocalInventory} message LocalInventory * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInputConfig.toObject = function toObject(message, options) { + LocalInventory.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.placeId = ""; + object.priceInfo = null; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (message.placeId != null && message.hasOwnProperty("placeId")) + object.placeId = message.placeId; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); } return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this LocalInventory to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + LocalInventory.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; + return LocalInventory; })(); - v2alpha.UserEventInputConfig = (function() { + v2alpha.GcsSource = (function() { /** - * Properties of a UserEventInputConfig. + * Properties of a GcsSource. * @memberof google.cloud.retail.v2alpha - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema */ /** - * Constructs a new UserEventInputConfig. + * Constructs a new GcsSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set */ - function UserEventInputConfig(properties) { + function GcsSource(properties) { + this.inputUris = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32469,115 +32173,91 @@ } /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.userEventInlineSource = null; - - /** - * UserEventInputConfig gcsSource. - * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.gcsSource = null; - - /** - * UserEventInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance */ - UserEventInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + GcsSource.prototype.inputUris = $util.emptyArray; /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + GcsSource.prototype.dataSchema = ""; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); return writer; }; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decode = function decode(reader, length) { + GcsSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -32588,157 +32268,133 @@ }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInputConfig message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInputConfig.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); - if (error) - return "userEventInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource */ - UserEventInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); - if (object.userEventInlineSource != null) { - if (typeof object.userEventInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); - } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2alpha.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig + * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInputConfig.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); - if (options.oneofs) - object.source = "userEventInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; return object; }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance * @returns {Object.} JSON object */ - UserEventInputConfig.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInputConfig; + return GcsSource; })(); - v2alpha.CompletionDataInputConfig = (function() { + v2alpha.BigQuerySource = (function() { /** - * Properties of a CompletionDataInputConfig. + * Properties of a BigQuerySource. * @memberof google.cloud.retail.v2alpha - * @interface ICompletionDataInputConfig - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema */ /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new BigQuerySource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompletionDataInputConfig. - * @implements ICompletionDataInputConfig + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource * @constructor - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set */ - function CompletionDataInputConfig(properties) { + function BigQuerySource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32746,89 +32402,154 @@ } /** - * CompletionDataInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance */ - CompletionDataInputConfig.prototype.bigQuerySource = null; + BigQuerySource.prototype.partitionDate = null; + + /** + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.projectId = ""; + + /** + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * CompletionDataInputConfig source. - * @member {"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance */ - Object.defineProperty(CompletionDataInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * Creates a new BigQuerySource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig instance + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance */ - CompletionDataInputConfig.create = function create(properties) { - return new CompletionDataInputConfig(properties); + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); }; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encode = function encode(message, writer) { + BigQuerySource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decode = function decode(reader, length) { + BigQuerySource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 5: + message.projectId = reader.string(); + break; case 1: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -32839,122 +32560,160 @@ }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a BigQuerySource message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompletionDataInputConfig.verify = function verify(message) { + BigQuerySource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - properties.source = 1; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + var error = $root.google.type.Date.verify(message.partitionDate); if (error) - return "bigQuerySource." + error; + return "partitionDate." + error; } } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource */ - CompletionDataInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDataInputConfig) + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) return object; - var message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompletionDataInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2alpha.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); } + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompletionDataInputConfig.toObject = function toObject(message, options) { + BigQuerySource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); if (options.oneofs) - object.source = "bigQuerySource"; + object.partition = "partitionDate"; } return object; }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this BigQuerySource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance * @returns {Object.} JSON object */ - CompletionDataInputConfig.prototype.toJSON = function toJSON() { + BigQuerySource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompletionDataInputConfig; + return BigQuerySource; })(); - v2alpha.ImportMetadata = (function() { + v2alpha.ProductInlineSource = (function() { /** - * Properties of an ImportMetadata. + * Properties of a ProductInlineSource. * @memberof google.cloud.retail.v2alpha - * @interface IImportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime - * @property {number|Long|null} [successCount] ImportMetadata successCount - * @property {number|Long|null} [failureCount] ImportMetadata failureCount - * @property {string|null} [requestId] ImportMetadata requestId - * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products */ /** - * Constructs a new ImportMetadata. + * Constructs a new ProductInlineSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportMetadata. - * @implements IImportMetadata + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource * @constructor - * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set */ - function ImportMetadata(properties) { + function ProductInlineSource(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32962,140 +32721,78 @@ } /** - * ImportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.createTime = null; - - /** - * ImportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.updateTime = null; - - /** - * ImportMetadata successCount. - * @member {number|Long} successCount - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ImportMetadata failureCount. - * @member {number|Long} failureCount - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ImportMetadata requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.requestId = ""; - - /** - * ImportMetadata notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @instance */ - ImportMetadata.prototype.notificationPubsubTopic = ""; + ProductInlineSource.prototype.products = $util.emptyArray; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance */ - ImportMetadata.create = function create(properties) { - return new ImportMetadata(properties); + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); }; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encode = function encode(message, writer) { + ProductInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); - if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decode = function decode(reader, length) { + ProductInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -33106,188 +32803,125 @@ }; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportMetadata message. + * Verifies a ProductInlineSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportMetadata.verify = function verify(message) { + ProductInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } } - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) - return "successCount: integer|Long expected"; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) - return "failureCount: integer|Long expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource */ - ImportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } } - if (object.successCount != null) - if ($util.Long) - (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; - else if (typeof object.successCount === "string") - message.successCount = parseInt(object.successCount, 10); - else if (typeof object.successCount === "number") - message.successCount = object.successCount; - else if (typeof object.successCount === "object") - message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); - if (object.failureCount != null) - if ($util.Long) - (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; - else if (typeof object.failureCount === "string") - message.failureCount = parseInt(object.failureCount, 10); - else if (typeof object.failureCount === "number") - message.failureCount = object.failureCount; - else if (typeof object.failureCount === "object") - message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata + * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportMetadata.toObject = function toObject(message, options) { + ProductInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.createTime = null; - object.updateTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.successCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failureCount = options.longs === String ? "0" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (typeof message.successCount === "number") - object.successCount = options.longs === String ? String(message.successCount) : message.successCount; - else - object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (typeof message.failureCount === "number") - object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; - else - object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportMetadata to JSON. + * Converts this ProductInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @instance * @returns {Object.} JSON object */ - ImportMetadata.prototype.toJSON = function toJSON() { + ProductInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportMetadata; + return ProductInlineSource; })(); - v2alpha.ImportProductsResponse = (function() { + v2alpha.UserEventInlineSource = (function() { /** - * Properties of an ImportProductsResponse. + * Properties of a UserEventInlineSource. * @memberof google.cloud.retail.v2alpha - * @interface IImportProductsResponse - * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents */ /** - * Constructs a new ImportProductsResponse. + * Constructs a new UserEventInlineSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportProductsResponse. - * @implements IImportProductsResponse + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource * @constructor - * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set */ - function ImportProductsResponse(properties) { - this.errorSamples = []; + function UserEventInlineSource(properties) { + this.userEvents = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33295,91 +32929,78 @@ } /** - * ImportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse - * @instance - */ - ImportProductsResponse.prototype.errorSamples = $util.emptyArray; - - /** - * ImportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @instance */ - ImportProductsResponse.prototype.errorsConfig = null; + UserEventInlineSource.prototype.userEvents = $util.emptyArray; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Creates a new UserEventInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance */ - ImportProductsResponse.create = function create(properties) { - return new ImportProductsResponse(properties); + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); }; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encode = function encode(message, writer) { + UserEventInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decode = function decode(reader, length) { + UserEventInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -33390,141 +33011,124 @@ }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsResponse message. + * Verifies a UserEventInlineSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsResponse.verify = function verify(message) { + UserEventInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); if (error) - return "errorSamples." + error; + return "userEvents." + error; } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } return null; }; /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource */ - ImportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); } } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } return message; }; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse + * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsResponse.toObject = function toObject(message, options) { + UserEventInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this UserEventInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @instance * @returns {Object.} JSON object */ - ImportProductsResponse.prototype.toJSON = function toJSON() { + UserEventInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsResponse; + return UserEventInlineSource; })(); - v2alpha.ImportUserEventsResponse = (function() { + v2alpha.ImportErrorsConfig = (function() { /** - * Properties of an ImportUserEventsResponse. + * Properties of an ImportErrorsConfig. * @memberof google.cloud.retail.v2alpha - * @interface IImportUserEventsResponse - * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig - * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix */ /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new ImportErrorsConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportUserEventsResponse. - * @implements IImportUserEventsResponse + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig * @constructor - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set */ - function ImportUserEventsResponse(properties) { - this.errorSamples = []; + function ImportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33532,104 +33136,89 @@ } /** - * ImportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + ImportErrorsConfig.prototype.gcsPrefix = null; - /** - * ImportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse - * @instance - */ - ImportUserEventsResponse.prototype.errorsConfig = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ImportUserEventsResponse importSummary. - * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ImportUserEventsResponse.prototype.importSummary = null; + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Creates a new ImportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance */ - ImportUserEventsResponse.create = function create(properties) { - return new ImportUserEventsResponse(properties); + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); }; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encode = function encode(message, writer) { + ImportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) - $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes an ImportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decode = function decode(reader, length) { + ImportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -33640,153 +33229,117 @@ }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsResponse message. + * Verifies an ImportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsResponse.verify = function verify(message) { + ImportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.importSummary != null && message.hasOwnProperty("importSummary")) { - var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); - if (error) - return "importSummary." + error; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } return null; }; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig */ - ImportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.importSummary != null) { - if (typeof object.importSummary !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); - } + var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsResponse.toObject = function toObject(message, options) { + ImportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) { - object.errorsConfig = null; - object.importSummary = null; - } - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.importSummary != null && message.hasOwnProperty("importSummary")) - object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this ImportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance * @returns {Object.} JSON object */ - ImportUserEventsResponse.prototype.toJSON = function toJSON() { + ImportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsResponse; + return ImportErrorsConfig; })(); - v2alpha.UserEventImportSummary = (function() { + v2alpha.ImportProductsRequest = (function() { /** - * Properties of a UserEventImportSummary. + * Properties of an ImportProductsRequest. * @memberof google.cloud.retail.v2alpha - * @interface IUserEventImportSummary - * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount - * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount - */ - - /** - * Constructs a new UserEventImportSummary. + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + */ + + /** + * Constructs a new ImportProductsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventImportSummary. - * @implements IUserEventImportSummary + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set */ - function UserEventImportSummary(properties) { + function ImportProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33794,88 +33347,153 @@ } /** - * UserEventImportSummary joinedEventsCount. - * @member {number|Long} joinedEventsCount - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportProductsRequest.prototype.parent = ""; /** - * UserEventImportSummary unjoinedEventsCount. - * @member {number|Long} unjoinedEventsCount - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportProductsRequest.prototype.requestId = ""; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance */ - UserEventImportSummary.create = function create(properties) { - return new UserEventImportSummary(properties); + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); }; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encode = function encode(message, writer) { + ImportProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); - if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decode = function decode(reader, length) { + ImportProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.joinedEventsCount = reader.int64(); + message.parent = reader.string(); + break; + case 6: + message.requestId = reader.string(); break; case 2: - message.unjoinedEventsCount = reader.int64(); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -33886,145 +33504,207 @@ }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventImportSummary message. + * Verifies an ImportProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventImportSummary.verify = function verify(message) { + ImportProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) - return "joinedEventsCount: integer|Long expected"; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) - return "unjoinedEventsCount: integer|Long expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest */ - UserEventImportSummary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); - if (object.joinedEventsCount != null) - if ($util.Long) - (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; - else if (typeof object.joinedEventsCount === "string") - message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); - else if (typeof object.joinedEventsCount === "number") - message.joinedEventsCount = object.joinedEventsCount; - else if (typeof object.joinedEventsCount === "object") - message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); - if (object.unjoinedEventsCount != null) - if ($util.Long) - (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; - else if (typeof object.unjoinedEventsCount === "string") - message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); - else if (typeof object.unjoinedEventsCount === "number") - message.unjoinedEventsCount = object.unjoinedEventsCount; - else if (typeof object.unjoinedEventsCount === "object") - message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary + * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventImportSummary.toObject = function toObject(message, options) { + ImportProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.joinedEventsCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.unjoinedEventsCount = options.longs === String ? "0" : 0; + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (typeof message.joinedEventsCount === "number") - object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; - else - object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (typeof message.unjoinedEventsCount === "number") - object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; - else - object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this ImportProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance * @returns {Object.} JSON object */ - UserEventImportSummary.prototype.toJSON = function toJSON() { + ImportProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventImportSummary; + /** + * ReconciliationMode enum. + * @name google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value + */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); + + return ImportProductsRequest; })(); - v2alpha.ImportCompletionDataResponse = (function() { + v2alpha.ImportUserEventsRequest = (function() { /** - * Properties of an ImportCompletionDataResponse. + * Properties of an ImportUserEventsRequest. * @memberof google.cloud.retail.v2alpha - * @interface IImportCompletionDataResponse - * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig */ /** - * Constructs a new ImportCompletionDataResponse. + * Constructs a new ImportUserEventsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportCompletionDataResponse. - * @implements IImportCompletionDataResponse + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set */ - function ImportCompletionDataResponse(properties) { - this.errorSamples = []; + function ImportUserEventsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -34032,78 +33712,101 @@ } /** - * ImportCompletionDataResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + ImportUserEventsRequest.prototype.parent = ""; /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.inputConfig = null; + + /** + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.errorsConfig = null; + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance */ - ImportCompletionDataResponse.create = function create(properties) { - return new ImportCompletionDataResponse(properties); + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); }; /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encode = function encode(message, writer) { + ImportUserEventsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decode = function decode(reader, length) { + ImportUserEventsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -34114,169 +33817,136 @@ }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportCompletionDataResponse message. + * Verifies an ImportUserEventsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportCompletionDataResponse.verify = function verify(message) { + ImportUserEventsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; } return null; }; /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest */ - ImportCompletionDataResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse) + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); } return message; }; /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportCompletionDataResponse.toObject = function toObject(message, options) { + ImportUserEventsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ImportCompletionDataResponse to JSON. + * Converts this ImportUserEventsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance * @returns {Object.} JSON object */ - ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + ImportUserEventsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportCompletionDataResponse; + return ImportUserEventsRequest; })(); - v2alpha.Product = (function() { + v2alpha.ImportCompletionDataRequest = (function() { /** - * Properties of a Product. + * Properties of an ImportCompletionDataRequest. * @memberof google.cloud.retail.v2alpha - * @interface IProduct - * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime - * @property {google.protobuf.IDuration|null} [ttl] Product ttl - * @property {string|null} [name] Product name - * @property {string|null} [id] Product id - * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type - * @property {string|null} [primaryProductId] Product primaryProductId - * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds - * @property {string|null} [gtin] Product gtin - * @property {Array.|null} [categories] Product categories - * @property {string|null} [title] Product title - * @property {Array.|null} [brands] Product brands - * @property {string|null} [description] Product description - * @property {string|null} [languageCode] Product languageCode - * @property {Object.|null} [attributes] Product attributes - * @property {Array.|null} [tags] Product tags - * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo - * @property {google.cloud.retail.v2alpha.IRating|null} [rating] Product rating - * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime - * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability - * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity - * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo - * @property {string|null} [uri] Product uri - * @property {Array.|null} [images] Product images - * @property {google.cloud.retail.v2alpha.IAudience|null} [audience] Product audience - * @property {google.cloud.retail.v2alpha.IColorInfo|null} [colorInfo] Product colorInfo - * @property {Array.|null} [sizes] Product sizes - * @property {Array.|null} [materials] Product materials - * @property {Array.|null} [patterns] Product patterns - * @property {Array.|null} [conditions] Product conditions - * @property {Array.|null} [promotions] Product promotions - * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime - * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields - * @property {Array.|null} [variants] Product variants + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic */ /** - * Constructs a new Product. + * Constructs a new ImportCompletionDataRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Product. - * @implements IProduct + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest * @constructor - * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set */ - function Product(properties) { - this.collectionMemberIds = []; - this.categories = []; - this.brands = []; - this.attributes = {}; - this.tags = []; - this.fulfillmentInfo = []; - this.images = []; - this.sizes = []; - this.materials = []; - this.patterns = []; - this.conditions = []; - this.promotions = []; - this.variants = []; + function ImportCompletionDataRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -34284,563 +33954,631 @@ } /** - * Product expireTime. - * @member {google.protobuf.ITimestamp|null|undefined} expireTime - * @memberof google.cloud.retail.v2alpha.Product + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - Product.prototype.expireTime = null; + ImportCompletionDataRequest.prototype.parent = ""; /** - * Product ttl. - * @member {google.protobuf.IDuration|null|undefined} ttl - * @memberof google.cloud.retail.v2alpha.Product + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - Product.prototype.ttl = null; + ImportCompletionDataRequest.prototype.inputConfig = null; /** - * Product name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.Product + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - Product.prototype.name = ""; + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; /** - * Product id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest instance */ - Product.prototype.id = ""; + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); + }; /** - * Product type. - * @member {google.cloud.retail.v2alpha.Product.Type} type - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.type = 0; + ImportCompletionDataRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); + return writer; + }; /** - * Product primaryProductId. - * @member {string} primaryProductId - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.primaryProductId = ""; + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product collectionMemberIds. - * @member {Array.} collectionMemberIds - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.collectionMemberIds = $util.emptyArray; + ImportCompletionDataRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product gtin. - * @member {string} gtin - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.gtin = ""; + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product categories. - * @member {Array.} categories - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Verifies an ImportCompletionDataRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.categories = $util.emptyArray; + ImportCompletionDataRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; /** - * Product title. - * @member {string} title - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest */ - Product.prototype.title = ""; + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.inputConfig); + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; /** - * Product brands. - * @member {Array.} brands - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2alpha.ImportCompletionDataRequest} message ImportCompletionDataRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.brands = $util.emptyArray; + ImportCompletionDataRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; /** - * Product description. - * @member {string} description - * @memberof google.cloud.retail.v2alpha.Product + * Converts this ImportCompletionDataRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance + * @returns {Object.} JSON object */ - Product.prototype.description = ""; + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Product languageCode. - * @member {string} languageCode - * @memberof google.cloud.retail.v2alpha.Product - * @instance - */ - Product.prototype.languageCode = ""; + return ImportCompletionDataRequest; + })(); - /** - * Product attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.Product - * @instance - */ - Product.prototype.attributes = $util.emptyObject; + v2alpha.ProductInputConfig = (function() { /** - * Product tags. - * @member {Array.} tags - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IProductInputConfig + * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource */ - Product.prototype.tags = $util.emptyArray; /** - * Product priceInfo. - * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set */ - Product.prototype.priceInfo = null; + function ProductInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Product rating. - * @member {google.cloud.retail.v2alpha.IRating|null|undefined} rating - * @memberof google.cloud.retail.v2alpha.Product + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - Product.prototype.rating = null; + ProductInputConfig.prototype.productInlineSource = null; /** - * Product availableTime. - * @member {google.protobuf.ITimestamp|null|undefined} availableTime - * @memberof google.cloud.retail.v2alpha.Product + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - Product.prototype.availableTime = null; + ProductInputConfig.prototype.gcsSource = null; /** - * Product availability. - * @member {google.cloud.retail.v2alpha.Product.Availability} availability - * @memberof google.cloud.retail.v2alpha.Product + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - Product.prototype.availability = 0; + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Product availableQuantity. - * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity - * @memberof google.cloud.retail.v2alpha.Product + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - Product.prototype.availableQuantity = null; + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Product fulfillmentInfo. - * @member {Array.} fulfillmentInfo - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a new ProductInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance */ - Product.prototype.fulfillmentInfo = $util.emptyArray; + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); + }; /** - * Product uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.uri = ""; + ProductInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; /** - * Product images. - * @member {Array.} images - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.images = $util.emptyArray; + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product audience. - * @member {google.cloud.retail.v2alpha.IAudience|null|undefined} audience - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.audience = null; + ProductInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product colorInfo. - * @member {google.cloud.retail.v2alpha.IColorInfo|null|undefined} colorInfo - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.colorInfo = null; + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product sizes. - * @member {Array.} sizes - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.sizes = $util.emptyArray; + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; /** - * Product materials. - * @member {Array.} materials - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig */ - Product.prototype.materials = $util.emptyArray; + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; /** - * Product patterns. - * @member {Array.} patterns - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.patterns = $util.emptyArray; + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; /** - * Product conditions. - * @member {Array.} conditions - * @memberof google.cloud.retail.v2alpha.Product + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance + * @returns {Object.} JSON object */ - Product.prototype.conditions = $util.emptyArray; + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2alpha.UserEventInputConfig = (function() { /** - * Product promotions. - * @member {Array.} promotions - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource */ - Product.prototype.promotions = $util.emptyArray; /** - * Product publishTime. - * @member {google.protobuf.ITimestamp|null|undefined} publishTime - * @memberof google.cloud.retail.v2alpha.Product + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - Product.prototype.publishTime = null; + UserEventInputConfig.prototype.userEventInlineSource = null; /** - * Product retrievableFields. - * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields - * @memberof google.cloud.retail.v2alpha.Product + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - Product.prototype.retrievableFields = null; + UserEventInputConfig.prototype.gcsSource = null; /** - * Product variants. - * @member {Array.} variants - * @memberof google.cloud.retail.v2alpha.Product + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - Product.prototype.variants = $util.emptyArray; + UserEventInputConfig.prototype.bigQuerySource = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * Product expiration. - * @member {"expireTime"|"ttl"|undefined} expiration - * @memberof google.cloud.retail.v2alpha.Product + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - Object.defineProperty(Product.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new Product instance using the specified properties. + * Creates a new UserEventInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Product} Product instance + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance */ - Product.create = function create(properties) { - return new Product(properties); + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); }; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encode = function encode(message, writer) { + UserEventInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); - if (message.collectionMemberIds != null && message.collectionMemberIds.length) - for (var i = 0; i < message.collectionMemberIds.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); - if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); - if (message.brands != null && message.brands.length) - for (var i = 0; i < message.brands.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) - $root.google.cloud.retail.v2alpha.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) - $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) - $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) - $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); - if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) - $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) - for (var i = 0; i < message.fulfillmentInfo.length; ++i) - $root.google.cloud.retail.v2alpha.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); - if (message.images != null && message.images.length) - for (var i = 0; i < message.images.length; ++i) - $root.google.cloud.retail.v2alpha.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); - if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) - $root.google.cloud.retail.v2alpha.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) - $root.google.cloud.retail.v2alpha.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.sizes != null && message.sizes.length) - for (var i = 0; i < message.sizes.length; ++i) - writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); - if (message.materials != null && message.materials.length) - for (var i = 0; i < message.materials.length; ++i) - writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); - if (message.patterns != null && message.patterns.length) - for (var i = 0; i < message.patterns.length; ++i) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); - if (message.conditions != null && message.conditions.length) - for (var i = 0; i < message.conditions.length; ++i) - writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); - if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) - $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); - if (message.variants != null && message.variants.length) - for (var i = 0; i < message.variants.length; ++i) - $root.google.cloud.retail.v2alpha.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); - if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) - $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); - if (message.promotions != null && message.promotions.length) - for (var i = 0; i < message.promotions.length; ++i) - $root.google.cloud.retail.v2alpha.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Product} Product + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decode = function decode(reader, length) { + UserEventInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Product(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 16: - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 17: - message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; case 1: - message.name = reader.string(); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); break; case 2: - message.id = reader.string(); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); break; case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 5: - if (!(message.collectionMemberIds && message.collectionMemberIds.length)) - message.collectionMemberIds = []; - message.collectionMemberIds.push(reader.string()); - break; - case 6: - message.gtin = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 9: - if (!(message.brands && message.brands.length)) - message.brands = []; - message.brands.push(reader.string()); - break; - case 10: - message.description = reader.string(); - break; - case 11: - message.languageCode = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); - break; - case 15: - message.rating = $root.google.cloud.retail.v2alpha.Rating.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 21: - if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) - message.fulfillmentInfo = []; - message.fulfillmentInfo.push($root.google.cloud.retail.v2alpha.FulfillmentInfo.decode(reader, reader.uint32())); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); - break; - case 24: - message.audience = $root.google.cloud.retail.v2alpha.Audience.decode(reader, reader.uint32()); - break; - case 25: - message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.decode(reader, reader.uint32()); - break; - case 26: - if (!(message.sizes && message.sizes.length)) - message.sizes = []; - message.sizes.push(reader.string()); - break; - case 27: - if (!(message.materials && message.materials.length)) - message.materials = []; - message.materials.push(reader.string()); - break; - case 28: - if (!(message.patterns && message.patterns.length)) - message.patterns = []; - message.patterns.push(reader.string()); - break; - case 29: - if (!(message.conditions && message.conditions.length)) - message.conditions = []; - message.conditions.push(reader.string()); - break; - case 34: - if (!(message.promotions && message.promotions.length)) - message.promotions = []; - message.promotions.push($root.google.cloud.retail.v2alpha.Promotion.decode(reader, reader.uint32())); - break; - case 33: - message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 30: - message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 31: - if (!(message.variants && message.variants.length)) - message.variants = []; - message.variants.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -34851,725 +34589,157 @@ }; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Product} Product + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decodeDelimited = function decodeDelimited(reader) { + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Product message. + * Verifies a UserEventInputConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.verify = function verify(message) { + UserEventInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - properties.expiration = 1; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; { - var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); if (error) - return "expireTime." + error; + return "userEventInlineSource." + error; } } - if (message.ttl != null && message.hasOwnProperty("ttl")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; { - var error = $root.google.protobuf.Duration.verify(message.ttl); + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); if (error) - return "ttl." + error; + return "gcsSource." + error; } } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - if (!$util.isString(message.primaryProductId)) - return "primaryProductId: string expected"; - if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { - if (!Array.isArray(message.collectionMemberIds)) - return "collectionMemberIds: array expected"; - for (var i = 0; i < message.collectionMemberIds.length; ++i) - if (!$util.isString(message.collectionMemberIds[i])) - return "collectionMemberIds: string[] expected"; - } - if (message.gtin != null && message.hasOwnProperty("gtin")) - if (!$util.isString(message.gtin)) - return "gtin: string expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) - if (!$util.isString(message.categories[i])) - return "categories: string[] expected"; - } - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.brands != null && message.hasOwnProperty("brands")) { - if (!Array.isArray(message.brands)) - return "brands: array expected"; - for (var i = 0; i < message.brands.length; ++i) - if (!$util.isString(message.brands[i])) - return "brands: string[] expected"; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; - } - if (message.rating != null && message.hasOwnProperty("rating")) { - var error = $root.google.cloud.retail.v2alpha.Rating.verify(message.rating); - if (error) - return "rating." + error; - } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.availableTime); - if (error) - return "availableTime." + error; - } - if (message.availability != null && message.hasOwnProperty("availability")) - switch (message.availability) { - default: - return "availability: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); - if (error) - return "availableQuantity." + error; - } - if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { - if (!Array.isArray(message.fulfillmentInfo)) - return "fulfillmentInfo: array expected"; - for (var i = 0; i < message.fulfillmentInfo.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.FulfillmentInfo.verify(message.fulfillmentInfo[i]); - if (error) - return "fulfillmentInfo." + error; - } - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.images != null && message.hasOwnProperty("images")) { - if (!Array.isArray(message.images)) - return "images: array expected"; - for (var i = 0; i < message.images.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Image.verify(message.images[i]); - if (error) - return "images." + error; - } - } - if (message.audience != null && message.hasOwnProperty("audience")) { - var error = $root.google.cloud.retail.v2alpha.Audience.verify(message.audience); - if (error) - return "audience." + error; - } - if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { - var error = $root.google.cloud.retail.v2alpha.ColorInfo.verify(message.colorInfo); - if (error) - return "colorInfo." + error; - } - if (message.sizes != null && message.hasOwnProperty("sizes")) { - if (!Array.isArray(message.sizes)) - return "sizes: array expected"; - for (var i = 0; i < message.sizes.length; ++i) - if (!$util.isString(message.sizes[i])) - return "sizes: string[] expected"; - } - if (message.materials != null && message.hasOwnProperty("materials")) { - if (!Array.isArray(message.materials)) - return "materials: array expected"; - for (var i = 0; i < message.materials.length; ++i) - if (!$util.isString(message.materials[i])) - return "materials: string[] expected"; - } - if (message.patterns != null && message.hasOwnProperty("patterns")) { - if (!Array.isArray(message.patterns)) - return "patterns: array expected"; - for (var i = 0; i < message.patterns.length; ++i) - if (!$util.isString(message.patterns[i])) - return "patterns: string[] expected"; - } - if (message.conditions != null && message.hasOwnProperty("conditions")) { - if (!Array.isArray(message.conditions)) - return "conditions: array expected"; - for (var i = 0; i < message.conditions.length; ++i) - if (!$util.isString(message.conditions[i])) - return "conditions: string[] expected"; - } - if (message.promotions != null && message.hasOwnProperty("promotions")) { - if (!Array.isArray(message.promotions)) - return "promotions: array expected"; - for (var i = 0; i < message.promotions.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Promotion.verify(message.promotions[i]); - if (error) - return "promotions." + error; - } - } - if (message.publishTime != null && message.hasOwnProperty("publishTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.publishTime); - if (error) - return "publishTime." + error; - } - if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { - var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); - if (error) - return "retrievableFields." + error; - } - if (message.variants != null && message.hasOwnProperty("variants")) { - if (!Array.isArray(message.variants)) - return "variants: array expected"; - for (var i = 0; i < message.variants.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.variants[i]); - if (error) - return "variants." + error; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; } } return null; }; /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Product} Product + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Product) + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.Product(); - if (object.expireTime != null) { - if (typeof object.expireTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.expireTime: object expected"); - message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); - } - if (object.ttl != null) { - if (typeof object.ttl !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.ttl: object expected"); - message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); - } - if (object.name != null) - message.name = String(object.name); - if (object.id != null) - message.id = String(object.id); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "VARIANT": - case 2: - message.type = 2; - break; - case "COLLECTION": - case 3: - message.type = 3; - break; - } - if (object.primaryProductId != null) - message.primaryProductId = String(object.primaryProductId); - if (object.collectionMemberIds) { - if (!Array.isArray(object.collectionMemberIds)) - throw TypeError(".google.cloud.retail.v2alpha.Product.collectionMemberIds: array expected"); - message.collectionMemberIds = []; - for (var i = 0; i < object.collectionMemberIds.length; ++i) - message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); - } - if (object.gtin != null) - message.gtin = String(object.gtin); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.retail.v2alpha.Product.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) - message.categories[i] = String(object.categories[i]); - } - if (object.title != null) - message.title = String(object.title); - if (object.brands) { - if (!Array.isArray(object.brands)) - throw TypeError(".google.cloud.retail.v2alpha.Product.brands: array expected"); - message.brands = []; - for (var i = 0; i < object.brands.length; ++i) - message.brands[i] = String(object.brands[i]); - } - if (object.description != null) - message.description = String(object.description); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.retail.v2alpha.Product.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); - } - if (object.rating != null) { - if (typeof object.rating !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.rating: object expected"); - message.rating = $root.google.cloud.retail.v2alpha.Rating.fromObject(object.rating); - } - if (object.availableTime != null) { - if (typeof object.availableTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.availableTime: object expected"); - message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); - } - switch (object.availability) { - case "AVAILABILITY_UNSPECIFIED": - case 0: - message.availability = 0; - break; - case "IN_STOCK": - case 1: - message.availability = 1; - break; - case "OUT_OF_STOCK": - case 2: - message.availability = 2; - break; - case "PREORDER": - case 3: - message.availability = 3; - break; - case "BACKORDER": - case 4: - message.availability = 4; - break; - } - if (object.availableQuantity != null) { - if (typeof object.availableQuantity !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.availableQuantity: object expected"); - message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); - } - if (object.fulfillmentInfo) { - if (!Array.isArray(object.fulfillmentInfo)) - throw TypeError(".google.cloud.retail.v2alpha.Product.fulfillmentInfo: array expected"); - message.fulfillmentInfo = []; - for (var i = 0; i < object.fulfillmentInfo.length; ++i) { - if (typeof object.fulfillmentInfo[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.fulfillmentInfo: object expected"); - message.fulfillmentInfo[i] = $root.google.cloud.retail.v2alpha.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); - } - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.images) { - if (!Array.isArray(object.images)) - throw TypeError(".google.cloud.retail.v2alpha.Product.images: array expected"); - message.images = []; - for (var i = 0; i < object.images.length; ++i) { - if (typeof object.images[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.images: object expected"); - message.images[i] = $root.google.cloud.retail.v2alpha.Image.fromObject(object.images[i]); - } - } - if (object.audience != null) { - if (typeof object.audience !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.audience: object expected"); - message.audience = $root.google.cloud.retail.v2alpha.Audience.fromObject(object.audience); - } - if (object.colorInfo != null) { - if (typeof object.colorInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.colorInfo: object expected"); - message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.fromObject(object.colorInfo); - } - if (object.sizes) { - if (!Array.isArray(object.sizes)) - throw TypeError(".google.cloud.retail.v2alpha.Product.sizes: array expected"); - message.sizes = []; - for (var i = 0; i < object.sizes.length; ++i) - message.sizes[i] = String(object.sizes[i]); - } - if (object.materials) { - if (!Array.isArray(object.materials)) - throw TypeError(".google.cloud.retail.v2alpha.Product.materials: array expected"); - message.materials = []; - for (var i = 0; i < object.materials.length; ++i) - message.materials[i] = String(object.materials[i]); - } - if (object.patterns) { - if (!Array.isArray(object.patterns)) - throw TypeError(".google.cloud.retail.v2alpha.Product.patterns: array expected"); - message.patterns = []; - for (var i = 0; i < object.patterns.length; ++i) - message.patterns[i] = String(object.patterns[i]); - } - if (object.conditions) { - if (!Array.isArray(object.conditions)) - throw TypeError(".google.cloud.retail.v2alpha.Product.conditions: array expected"); - message.conditions = []; - for (var i = 0; i < object.conditions.length; ++i) - message.conditions[i] = String(object.conditions[i]); - } - if (object.promotions) { - if (!Array.isArray(object.promotions)) - throw TypeError(".google.cloud.retail.v2alpha.Product.promotions: array expected"); - message.promotions = []; - for (var i = 0; i < object.promotions.length; ++i) { - if (typeof object.promotions[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.promotions: object expected"); - message.promotions[i] = $root.google.cloud.retail.v2alpha.Promotion.fromObject(object.promotions[i]); - } - } - if (object.publishTime != null) { - if (typeof object.publishTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.publishTime: object expected"); - message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); } - if (object.retrievableFields != null) { - if (typeof object.retrievableFields !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.retrievableFields: object expected"); - message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); } - if (object.variants) { - if (!Array.isArray(object.variants)) - throw TypeError(".google.cloud.retail.v2alpha.Product.variants: array expected"); - message.variants = []; - for (var i = 0; i < object.variants.length; ++i) { - if (typeof object.variants[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Product.variants: object expected"); - message.variants[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.variants[i]); - } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); } return message; }; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.Product} message Product + * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Product.toObject = function toObject(message, options) { + UserEventInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.collectionMemberIds = []; - object.categories = []; - object.brands = []; - object.tags = []; - object.fulfillmentInfo = []; - object.images = []; - object.sizes = []; - object.materials = []; - object.patterns = []; - object.conditions = []; - object.variants = []; - object.promotions = []; - } - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) { - object.name = ""; - object.id = ""; - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.primaryProductId = ""; - object.gtin = ""; - object.title = ""; - object.description = ""; - object.languageCode = ""; - object.priceInfo = null; - object.rating = null; - object.availableTime = null; - object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; - object.availableQuantity = null; - object.uri = ""; - object.audience = null; - object.colorInfo = null; - object.retrievableFields = null; - object.publishTime = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - object.primaryProductId = message.primaryProductId; - if (message.collectionMemberIds && message.collectionMemberIds.length) { - object.collectionMemberIds = []; - for (var j = 0; j < message.collectionMemberIds.length; ++j) - object.collectionMemberIds[j] = message.collectionMemberIds[j]; - } - if (message.gtin != null && message.hasOwnProperty("gtin")) - object.gtin = message.gtin; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = message.categories[j]; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.brands && message.brands.length) { - object.brands = []; - for (var j = 0; j < message.brands.length; ++j) - object.brands[j] = message.brands[j]; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); - if (message.rating != null && message.hasOwnProperty("rating")) - object.rating = $root.google.cloud.retail.v2alpha.Rating.toObject(message.rating, options); - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); if (options.oneofs) - object.expiration = "expireTime"; + object.source = "userEventInlineSource"; } - if (message.ttl != null && message.hasOwnProperty("ttl")) { - object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); if (options.oneofs) - object.expiration = "ttl"; + object.source = "gcsSource"; } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) - object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); - if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) - object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); - if (message.fulfillmentInfo && message.fulfillmentInfo.length) { - object.fulfillmentInfo = []; - for (var j = 0; j < message.fulfillmentInfo.length; ++j) - object.fulfillmentInfo[j] = $root.google.cloud.retail.v2alpha.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.images && message.images.length) { - object.images = []; - for (var j = 0; j < message.images.length; ++j) - object.images[j] = $root.google.cloud.retail.v2alpha.Image.toObject(message.images[j], options); - } - if (message.audience != null && message.hasOwnProperty("audience")) - object.audience = $root.google.cloud.retail.v2alpha.Audience.toObject(message.audience, options); - if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) - object.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.toObject(message.colorInfo, options); - if (message.sizes && message.sizes.length) { - object.sizes = []; - for (var j = 0; j < message.sizes.length; ++j) - object.sizes[j] = message.sizes[j]; - } - if (message.materials && message.materials.length) { - object.materials = []; - for (var j = 0; j < message.materials.length; ++j) - object.materials[j] = message.materials[j]; - } - if (message.patterns && message.patterns.length) { - object.patterns = []; - for (var j = 0; j < message.patterns.length; ++j) - object.patterns[j] = message.patterns[j]; - } - if (message.conditions && message.conditions.length) { - object.conditions = []; - for (var j = 0; j < message.conditions.length; ++j) - object.conditions[j] = message.conditions[j]; - } - if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) - object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); - if (message.variants && message.variants.length) { - object.variants = []; - for (var j = 0; j < message.variants.length; ++j) - object.variants[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.variants[j], options); - } - if (message.publishTime != null && message.hasOwnProperty("publishTime")) - object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); - if (message.promotions && message.promotions.length) { - object.promotions = []; - for (var j = 0; j < message.promotions.length; ++j) - object.promotions[j] = $root.google.cloud.retail.v2alpha.Promotion.toObject(message.promotions[j], options); + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } return object; }; /** - * Converts this Product to JSON. + * Converts this UserEventInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Product + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance * @returns {Object.} JSON object */ - Product.prototype.toJSON = function toJSON() { + UserEventInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.retail.v2alpha.Product.Type - * @enum {number} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} VARIANT=2 VARIANT value - * @property {number} COLLECTION=3 COLLECTION value - */ - Product.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "VARIANT"] = 2; - values[valuesById[3] = "COLLECTION"] = 3; - return values; - })(); - - /** - * Availability enum. - * @name google.cloud.retail.v2alpha.Product.Availability - * @enum {number} - * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value - * @property {number} IN_STOCK=1 IN_STOCK value - * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value - * @property {number} PREORDER=3 PREORDER value - * @property {number} BACKORDER=4 BACKORDER value - */ - Product.Availability = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "IN_STOCK"] = 1; - values[valuesById[2] = "OUT_OF_STOCK"] = 2; - values[valuesById[3] = "PREORDER"] = 3; - values[valuesById[4] = "BACKORDER"] = 4; - return values; - })(); - - return Product; + return UserEventInputConfig; })(); - v2alpha.UserEvent = (function() { + v2alpha.CompletionDataInputConfig = (function() { /** - * Properties of a UserEvent. + * Properties of a CompletionDataInputConfig. * @memberof google.cloud.retail.v2alpha - * @interface IUserEvent - * @property {string|null} [eventType] UserEvent eventType - * @property {string|null} [visitorId] UserEvent visitorId - * @property {string|null} [sessionId] UserEvent sessionId - * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime - * @property {Array.|null} [experimentIds] UserEvent experimentIds - * @property {string|null} [attributionToken] UserEvent attributionToken - * @property {Array.|null} [productDetails] UserEvent productDetails - * @property {google.cloud.retail.v2alpha.ICompletionDetail|null} [completionDetail] UserEvent completionDetail - * @property {Object.|null} [attributes] UserEvent attributes - * @property {string|null} [cartId] UserEvent cartId - * @property {google.cloud.retail.v2alpha.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction - * @property {string|null} [searchQuery] UserEvent searchQuery - * @property {string|null} [filter] UserEvent filter - * @property {string|null} [orderBy] UserEvent orderBy - * @property {number|null} [offset] UserEvent offset - * @property {Array.|null} [pageCategories] UserEvent pageCategories - * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] UserEvent userInfo - * @property {string|null} [uri] UserEvent uri - * @property {string|null} [referrerUri] UserEvent referrerUri - * @property {string|null} [pageViewId] UserEvent pageViewId + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource */ /** - * Constructs a new UserEvent. + * Constructs a new CompletionDataInputConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEvent. - * @implements IUserEvent + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig * @constructor - * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set */ - function UserEvent(properties) { - this.experimentIds = []; - this.productDetails = []; - this.attributes = {}; - this.pageCategories = []; + function CompletionDataInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -35577,353 +34747,356 @@ } /** - * UserEvent eventType. - * @member {string} eventType - * @memberof google.cloud.retail.v2alpha.UserEvent + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance */ - UserEvent.prototype.eventType = ""; + CompletionDataInputConfig.prototype.bigQuerySource = null; - /** - * UserEvent visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance - */ - UserEvent.prototype.visitorId = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * UserEvent sessionId. - * @member {string} sessionId - * @memberof google.cloud.retail.v2alpha.UserEvent + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance */ - UserEvent.prototype.sessionId = ""; + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * UserEvent eventTime. - * @member {google.protobuf.ITimestamp|null|undefined} eventTime - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig instance */ - UserEvent.prototype.eventTime = null; + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); + }; /** - * UserEvent experimentIds. - * @member {Array.} experimentIds - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.experimentIds = $util.emptyArray; + CompletionDataInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; /** - * UserEvent attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - UserEvent.prototype.attributionToken = ""; + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * UserEvent productDetails. - * @member {Array.} productDetails - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.productDetails = $util.emptyArray; + CompletionDataInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * UserEvent completionDetail. - * @member {google.cloud.retail.v2alpha.ICompletionDetail|null|undefined} completionDetail - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.prototype.completionDetail = null; + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * UserEvent attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Verifies a CompletionDataInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.prototype.attributes = $util.emptyObject; + CompletionDataInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; /** - * UserEvent cartId. - * @member {string} cartId - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig */ - UserEvent.prototype.cartId = ""; + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDataInputConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; /** - * UserEvent purchaseTransaction. - * @member {google.cloud.retail.v2alpha.IPurchaseTransaction|null|undefined} purchaseTransaction - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - UserEvent.prototype.purchaseTransaction = null; + CompletionDataInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; /** - * UserEvent searchQuery. - * @member {string} searchQuery - * @memberof google.cloud.retail.v2alpha.UserEvent + * Converts this CompletionDataInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance + * @returns {Object.} JSON object */ - UserEvent.prototype.searchQuery = ""; + CompletionDataInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDataInputConfig; + })(); + + v2alpha.ImportMetadata = (function() { /** - * UserEvent filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic */ - UserEvent.prototype.filter = ""; /** - * UserEvent orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2alpha.UserEvent - * @instance + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set */ - UserEvent.prototype.orderBy = ""; + function ImportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * UserEvent offset. - * @member {number} offset - * @memberof google.cloud.retail.v2alpha.UserEvent + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - UserEvent.prototype.offset = 0; + ImportMetadata.prototype.createTime = null; /** - * UserEvent pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2alpha.UserEvent + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - UserEvent.prototype.pageCategories = $util.emptyArray; + ImportMetadata.prototype.updateTime = null; /** - * UserEvent userInfo. - * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2alpha.UserEvent + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - UserEvent.prototype.userInfo = null; + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * UserEvent uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.UserEvent + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - UserEvent.prototype.uri = ""; + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * UserEvent referrerUri. - * @member {string} referrerUri - * @memberof google.cloud.retail.v2alpha.UserEvent + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - UserEvent.prototype.referrerUri = ""; + ImportMetadata.prototype.requestId = ""; /** - * UserEvent pageViewId. - * @member {string} pageViewId - * @memberof google.cloud.retail.v2alpha.UserEvent + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - UserEvent.prototype.pageViewId = ""; + ImportMetadata.prototype.notificationPubsubTopic = ""; /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new ImportMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent instance + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance */ - UserEvent.create = function create(properties) { - return new UserEvent(properties); + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); }; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encode = function encode(message, writer) { + ImportMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); - if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) - $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.experimentIds != null && message.experimentIds.length) - for (var i = 0; i < message.experimentIds.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.productDetails != null && message.productDetails.length) - for (var i = 0; i < message.productDetails.length; ++i) - $root.google.cloud.retail.v2alpha.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); - if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) - $root.google.cloud.retail.v2alpha.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); - if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); - if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); - if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) - writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); - if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) - $root.google.cloud.retail.v2alpha.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decode = function decode(reader, length) { + ImportMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEvent(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.eventType = reader.string(); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 2: - message.visitorId = reader.string(); - break; - case 21: - message.sessionId = reader.string(); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.successCount = reader.int64(); break; case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); + message.failureCount = reader.int64(); break; case 5: - message.attributionToken = reader.string(); + message.requestId = reader.string(); break; case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); - break; - case 22: - message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.decode(reader, reader.uint32()); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 16: - message.filter = reader.string(); - break; - case 17: - message.orderBy = reader.string(); - break; - case 18: - message.offset = reader.int32(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -35934,344 +35107,188 @@ }; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decodeDelimited = function decodeDelimited(reader) { + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEvent message. + * Verifies an ImportMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.verify = function verify(message) { + ImportMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.eventType != null && message.hasOwnProperty("eventType")) - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.sessionId != null && message.hasOwnProperty("sessionId")) - if (!$util.isString(message.sessionId)) - return "sessionId: string expected"; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.eventTime); - if (error) - return "eventTime." + error; - } - if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { - if (!Array.isArray(message.experimentIds)) - return "experimentIds: array expected"; - for (var i = 0; i < message.experimentIds.length; ++i) - if (!$util.isString(message.experimentIds[i])) - return "experimentIds: string[] expected"; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.productDetails != null && message.hasOwnProperty("productDetails")) { - if (!Array.isArray(message.productDetails)) - return "productDetails: array expected"; - for (var i = 0; i < message.productDetails.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.ProductDetail.verify(message.productDetails[i]); - if (error) - return "productDetails." + error; - } - } - if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { - var error = $root.google.cloud.retail.v2alpha.CompletionDetail.verify(message.completionDetail); - if (error) - return "completionDetail." + error; - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - if (!$util.isString(message.cartId)) - return "cartId: string expected"; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { - var error = $root.google.cloud.retail.v2alpha.PurchaseTransaction.verify(message.purchaseTransaction); + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) - return "purchaseTransaction." + error; - } - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - if (!$util.isString(message.searchQuery)) - return "searchQuery: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; + return "createTime." + error; } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); if (error) - return "userInfo." + error; + return "updateTime." + error; } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - if (!$util.isString(message.referrerUri)) - return "referrerUri: string expected"; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - if (!$util.isString(message.pageViewId)) - return "pageViewId: string expected"; + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata */ - UserEvent.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEvent) + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEvent(); - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.sessionId != null) - message.sessionId = String(object.sessionId); - if (object.eventTime != null) { - if (typeof object.eventTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.eventTime: object expected"); - message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); - } - if (object.experimentIds) { - if (!Array.isArray(object.experimentIds)) - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.experimentIds: array expected"); - message.experimentIds = []; - for (var i = 0; i < object.experimentIds.length; ++i) - message.experimentIds[i] = String(object.experimentIds[i]); - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.productDetails) { - if (!Array.isArray(object.productDetails)) - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: array expected"); - message.productDetails = []; - for (var i = 0; i < object.productDetails.length; ++i) { - if (typeof object.productDetails[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: object expected"); - message.productDetails[i] = $root.google.cloud.retail.v2alpha.ProductDetail.fromObject(object.productDetails[i]); - } - } - if (object.completionDetail != null) { - if (typeof object.completionDetail !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.completionDetail: object expected"); - message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.fromObject(object.completionDetail); - } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - if (object.cartId != null) - message.cartId = String(object.cartId); - if (object.purchaseTransaction != null) { - if (typeof object.purchaseTransaction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.purchaseTransaction: object expected"); - message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.fromObject(object.purchaseTransaction); - } - if (object.searchQuery != null) - message.searchQuery = String(object.searchQuery); - if (object.filter != null) - message.filter = String(object.filter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); + var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEvent.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } - if (object.uri != null) - message.uri = String(object.uri); - if (object.referrerUri != null) - message.referrerUri = String(object.referrerUri); - if (object.pageViewId != null) - message.pageViewId = String(object.pageViewId); + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.UserEvent} message UserEvent + * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEvent.toObject = function toObject(message, options) { + ImportMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.experimentIds = []; - object.productDetails = []; - object.pageCategories = []; - } - if (options.objects || options.defaults) - object.attributes = {}; if (options.defaults) { - object.eventType = ""; - object.visitorId = ""; - object.eventTime = null; - object.attributionToken = ""; - object.cartId = ""; - object.purchaseTransaction = null; - object.searchQuery = ""; - object.userInfo = null; - object.uri = ""; - object.referrerUri = ""; - object.pageViewId = ""; - object.filter = ""; - object.orderBy = ""; - object.offset = 0; - object.sessionId = ""; - object.completionDetail = null; - } - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) - object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); - if (message.experimentIds && message.experimentIds.length) { - object.experimentIds = []; - for (var j = 0; j < message.experimentIds.length; ++j) - object.experimentIds[j] = message.experimentIds[j]; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.productDetails && message.productDetails.length) { - object.productDetails = []; - for (var j = 0; j < message.productDetails.length; ++j) - object.productDetails[j] = $root.google.cloud.retail.v2alpha.ProductDetail.toObject(message.productDetails[j], options); - } - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - object.cartId = message.cartId; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) - object.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.toObject(message.purchaseTransaction, options); - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - object.searchQuery = message.searchQuery; - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - object.referrerUri = message.referrerUri; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - object.pageViewId = message.pageViewId; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.sessionId != null && message.hasOwnProperty("sessionId")) - object.sessionId = message.sessionId; - if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) - object.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.toObject(message.completionDetail, options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this UserEvent to JSON. + * Converts this ImportMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEvent + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance * @returns {Object.} JSON object */ - UserEvent.prototype.toJSON = function toJSON() { + ImportMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEvent; + return ImportMetadata; })(); - v2alpha.ProductDetail = (function() { + v2alpha.ImportProductsResponse = (function() { /** - * Properties of a ProductDetail. + * Properties of an ImportProductsResponse. * @memberof google.cloud.retail.v2alpha - * @interface IProductDetail - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] ProductDetail product - * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig */ /** - * Constructs a new ProductDetail. + * Constructs a new ImportProductsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductDetail. - * @implements IProductDetail + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set */ - function ProductDetail(properties) { + function ImportProductsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36279,88 +35296,91 @@ } /** - * ProductDetail product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.ProductDetail + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance */ - ProductDetail.prototype.product = null; + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * ProductDetail quantity. - * @member {google.protobuf.IInt32Value|null|undefined} quantity - * @memberof google.cloud.retail.v2alpha.ProductDetail + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance */ - ProductDetail.prototype.quantity = null; + ImportProductsResponse.prototype.errorsConfig = null; /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail instance + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance */ - ProductDetail.create = function create(properties) { - return new ProductDetail(properties); + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); }; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encode = function encode(message, writer) { + ImportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) - $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decode = function decode(reader, length) { + ImportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductDetail(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -36371,128 +35391,141 @@ }; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductDetail.decodeDelimited = function decodeDelimited(reader) { + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductDetail message. + * Verifies an ImportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductDetail.verify = function verify(message) { + ImportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } } - if (message.quantity != null && message.hasOwnProperty("quantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); if (error) - return "quantity." + error; + return "errorsConfig." + error; } return null; }; /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse */ - ProductDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductDetail) + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductDetail(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } } - if (object.quantity != null) { - if (typeof object.quantity !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.quantity: object expected"); - message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); } return message; }; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ProductDetail} message ProductDetail + * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductDetail.toObject = function toObject(message, options) { + ImportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.product = null; - object.quantity = null; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.quantity != null && message.hasOwnProperty("quantity")) - object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ProductDetail to JSON. + * Converts this ImportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductDetail + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance * @returns {Object.} JSON object */ - ProductDetail.prototype.toJSON = function toJSON() { + ImportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductDetail; + return ImportProductsResponse; })(); - v2alpha.CompletionDetail = (function() { + v2alpha.ImportUserEventsResponse = (function() { /** - * Properties of a CompletionDetail. + * Properties of an ImportUserEventsResponse. * @memberof google.cloud.retail.v2alpha - * @interface ICompletionDetail - * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken - * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion - * @property {number|null} [selectedPosition] CompletionDetail selectedPosition + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary */ /** - * Constructs a new CompletionDetail. + * Constructs a new ImportUserEventsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompletionDetail. - * @implements ICompletionDetail + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse * @constructor - * @param {google.cloud.retail.v2alpha.ICompletionDetail=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set */ - function CompletionDetail(properties) { + function ImportUserEventsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36500,101 +35533,104 @@ } /** - * CompletionDetail completionAttributionToken. - * @member {string} completionAttributionToken - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance */ - CompletionDetail.prototype.completionAttributionToken = ""; + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; /** - * CompletionDetail selectedSuggestion. - * @member {string} selectedSuggestion - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance */ - CompletionDetail.prototype.selectedSuggestion = ""; + ImportUserEventsResponse.prototype.errorsConfig = null; /** - * CompletionDetail selectedPosition. - * @member {number} selectedPosition - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance */ - CompletionDetail.prototype.selectedPosition = 0; + ImportUserEventsResponse.prototype.importSummary = null; /** - * Creates a new CompletionDetail instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ICompletionDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance */ - CompletionDetail.create = function create(properties) { - return new CompletionDetail(properties); + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); }; /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDetail.encode = function encode(message, writer) { + ImportUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); - if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); - if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompletionDetail message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDetail.decode = function decode(reader, length) { + ImportUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDetail(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.completionAttributionToken = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.selectedSuggestion = reader.string(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; case 3: - message.selectedPosition = reader.int32(); + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -36605,128 +35641,153 @@ }; /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDetail.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompletionDetail message. + * Verifies an ImportUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompletionDetail.verify = function verify(message) { + ImportUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) - if (!$util.isString(message.completionAttributionToken)) - return "completionAttributionToken: string expected"; - if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) - if (!$util.isString(message.selectedSuggestion)) - return "selectedSuggestion: string expected"; - if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) - if (!$util.isInteger(message.selectedPosition)) - return "selectedPosition: integer expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } return null; }; /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse */ - CompletionDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDetail) + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.CompletionDetail(); - if (object.completionAttributionToken != null) - message.completionAttributionToken = String(object.completionAttributionToken); - if (object.selectedSuggestion != null) - message.selectedSuggestion = String(object.selectedSuggestion); - if (object.selectedPosition != null) - message.selectedPosition = object.selectedPosition | 0; + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); + } return message; }; /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.CompletionDetail} message CompletionDetail + * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompletionDetail.toObject = function toObject(message, options) { + ImportUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; if (options.defaults) { - object.completionAttributionToken = ""; - object.selectedSuggestion = ""; - object.selectedPosition = 0; + object.errorsConfig = null; + object.importSummary = null; } - if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) - object.completionAttributionToken = message.completionAttributionToken; - if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) - object.selectedSuggestion = message.selectedSuggestion; - if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) - object.selectedPosition = message.selectedPosition; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this CompletionDetail to JSON. + * Converts this ImportUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance * @returns {Object.} JSON object */ - CompletionDetail.prototype.toJSON = function toJSON() { + ImportUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompletionDetail; + return ImportUserEventsResponse; })(); - v2alpha.PurchaseTransaction = (function() { + v2alpha.UserEventImportSummary = (function() { /** - * Properties of a PurchaseTransaction. + * Properties of a UserEventImportSummary. * @memberof google.cloud.retail.v2alpha - * @interface IPurchaseTransaction - * @property {string|null} [id] PurchaseTransaction id - * @property {number|null} [revenue] PurchaseTransaction revenue - * @property {number|null} [tax] PurchaseTransaction tax - * @property {number|null} [cost] PurchaseTransaction cost - * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount */ /** - * Constructs a new PurchaseTransaction. + * Constructs a new UserEventImportSummary. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurchaseTransaction. - * @implements IPurchaseTransaction + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary * @constructor - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set */ - function PurchaseTransaction(properties) { + function UserEventImportSummary(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36734,127 +35795,88 @@ } /** - * PurchaseTransaction id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.id = ""; - - /** - * PurchaseTransaction revenue. - * @member {number} revenue - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.revenue = 0; - - /** - * PurchaseTransaction tax. - * @member {number} tax - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.tax = 0; - - /** - * PurchaseTransaction cost. - * @member {number} cost - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance */ - PurchaseTransaction.prototype.cost = 0; + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * PurchaseTransaction currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance */ - PurchaseTransaction.prototype.currencyCode = ""; + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction instance + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance */ - PurchaseTransaction.create = function create(properties) { - return new PurchaseTransaction(properties); + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); }; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encode = function encode(message, writer) { + UserEventImportSummary.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); - if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); return writer; }; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decode = function decode(reader, length) { + UserEventImportSummary.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.string(); + message.joinedEventsCount = reader.int64(); break; case 2: - message.revenue = reader.float(); - break; - case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); + message.unjoinedEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -36865,309 +35887,145 @@ }; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurchaseTransaction message. + * Verifies a UserEventImportSummary message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurchaseTransaction.verify = function verify(message) { + UserEventImportSummary.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.revenue != null && message.hasOwnProperty("revenue")) - if (typeof message.revenue !== "number") - return "revenue: number expected"; - if (message.tax != null && message.hasOwnProperty("tax")) - if (typeof message.tax !== "number") - return "tax: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; return null; }; /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary */ - PurchaseTransaction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurchaseTransaction) + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) return object; - var message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); - if (object.id != null) - message.id = String(object.id); - if (object.revenue != null) - message.revenue = Number(object.revenue); - if (object.tax != null) - message.tax = Number(object.tax); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); + var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @static - * @param {google.cloud.retail.v2alpha.PurchaseTransaction} message PurchaseTransaction + * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurchaseTransaction.toObject = function toObject(message, options) { + UserEventImportSummary.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.id = ""; - object.revenue = 0; - object.tax = 0; - object.cost = 0; - object.currencyCode = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.revenue != null && message.hasOwnProperty("revenue")) - object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; - if (message.tax != null && message.hasOwnProperty("tax")) - object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; return object; }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this UserEventImportSummary to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance * @returns {Object.} JSON object */ - PurchaseTransaction.prototype.toJSON = function toJSON() { + UserEventImportSummary.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurchaseTransaction; - })(); - - v2alpha.CatalogService = (function() { - - /** - * Constructs a new CatalogService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CatalogService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.CatalogService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. - */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. - * @memberof google.cloud.retail.v2alpha.CatalogService - * @typedef ListCatalogsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} [response] ListCatalogsResponse - */ - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2alpha.ListCatalogsRequest, $root.google.cloud.retail.v2alpha.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. - * @memberof google.cloud.retail.v2alpha.CatalogService - * @typedef UpdateCatalogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Catalog} [response] Catalog - */ - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2alpha.UpdateCatalogRequest, $root.google.cloud.retail.v2alpha.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. - * @memberof google.cloud.retail.v2alpha.CatalogService - * @typedef SetDefaultBranchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2alpha.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { - return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "SetDefaultBranch" }); - - /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. - * @memberof google.cloud.retail.v2alpha.CatalogService - * @typedef GetDefaultBranchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.GetDefaultBranchResponse} [response] GetDefaultBranchResponse - */ - - /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2alpha.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { - return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest, $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse, request, callback); - }, "name", { value: "GetDefaultBranch" }); - - /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2alpha.CatalogService - * @instance - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return CatalogService; + return UserEventImportSummary; })(); - v2alpha.ListCatalogsRequest = (function() { + v2alpha.ImportCompletionDataResponse = (function() { /** - * Properties of a ListCatalogsRequest. + * Properties of an ImportCompletionDataResponse. * @memberof google.cloud.retail.v2alpha - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples */ /** - * Constructs a new ListCatalogsRequest. + * Constructs a new ImportCompletionDataResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse * @constructor - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -37175,101 +36033,78 @@ } /** - * ListCatalogsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest - * @instance - */ - ListCatalogsRequest.prototype.parent = ""; - - /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest - * @instance - */ - ListCatalogsRequest.prototype.pageSize = 0; - - /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + ImportCompletionDataResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + ImportCompletionDataResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -37280,126 +36115,169 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies an ImportCompletionDataResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + ImportCompletionDataResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsRequest) + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @static - * @param {google.cloud.retail.v2alpha.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2alpha.ImportCompletionDataResponse} message ImportCompletionDataResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + ImportCompletionDataResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; return object; }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @instance * @returns {Object.} JSON object */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsRequest; + return ImportCompletionDataResponse; })(); - v2alpha.ListCatalogsResponse = (function() { + v2alpha.Product = (function() { /** - * Properties of a ListCatalogsResponse. + * Properties of a Product. * @memberof google.cloud.retail.v2alpha - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands + * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2alpha.IRating|null} [rating] Product rating + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2alpha.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2alpha.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants */ /** - * Constructs a new ListCatalogsResponse. + * Constructs a new Product. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse + * @classdesc Represents a Product. + * @implements IProduct * @constructor - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set */ - function ListCatalogsResponse(properties) { - this.catalogs = []; + function Product(properties) { + this.collectionMemberIds = []; + this.categories = []; + this.brands = []; + this.attributes = {}; + this.tags = []; + this.fulfillmentInfo = []; + this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -37407,756 +36285,563 @@ } /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + Product.prototype.expireTime = null; /** - * ListCatalogsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - ListCatalogsResponse.prototype.nextPageToken = ""; + Product.prototype.ttl = null; /** - * Creates a new ListCatalogsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse instance + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); - }; + Product.prototype.name = ""; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; + Product.prototype.id = ""; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product type. + * @member {google.cloud.retail.v2alpha.Product.Type} type + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Product.prototype.type = 0; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + Product.prototype.primaryProductId = ""; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Product.prototype.collectionMemberIds = $util.emptyArray; /** - * Verifies a ListCatalogsResponse message. - * @function verify - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Product gtin. + * @member {string} gtin + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalogs[i]); - if (error) - return "catalogs." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; + Product.prototype.gtin = ""; /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsResponse) - return object; - var message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalogs[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; + Product.prototype.categories = $util.emptyArray; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} message ListCatalogsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - ListCatalogsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.catalogs = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalogs[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; + Product.prototype.title = ""; /** - * Converts this ListCatalogsResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2alpha.Product * @instance - * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListCatalogsResponse; - })(); - - v2alpha.UpdateCatalogRequest = (function() { + Product.prototype.brands = $util.emptyArray; /** - * Properties of an UpdateCatalogRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2alpha.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ + Product.prototype.description = ""; /** - * Constructs a new UpdateCatalogRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set + * Product languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - function UpdateCatalogRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Product.prototype.languageCode = ""; /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2alpha.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + Product.prototype.attributes = $util.emptyObject; /** - * UpdateCatalogRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + Product.prototype.tags = $util.emptyArray; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest instance + * Product priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); - }; + Product.prototype.priceInfo = null; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product rating. + * @member {google.cloud.retail.v2alpha.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + Product.prototype.rating = null; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Product.prototype.availableTime = null; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product availability. + * @member {google.cloud.retail.v2alpha.Product.Availability} availability + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + Product.prototype.availability = 0; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Product.prototype.availableQuantity = null; /** - * Verifies an UpdateCatalogRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalog); - if (error) - return "catalog." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; + Product.prototype.fulfillmentInfo = $util.emptyArray; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UpdateCatalogRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalog); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; + Product.prototype.uri = ""; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest - * @static - * @param {google.cloud.retail.v2alpha.UpdateCatalogRequest} message UpdateCatalogRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - UpdateCatalogRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.catalog = null; - object.updateMask = null; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalog, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; + Product.prototype.images = $util.emptyArray; /** - * Converts this UpdateCatalogRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * Product audience. + * @member {google.cloud.retail.v2alpha.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2alpha.Product * @instance - * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UpdateCatalogRequest; - })(); - - v2alpha.SetDefaultBranchRequest = (function() { + Product.prototype.audience = null; /** - * Properties of a SetDefaultBranchRequest. - * @memberof google.cloud.retail.v2alpha - * @interface ISetDefaultBranchRequest - * @property {string|null} [catalog] SetDefaultBranchRequest catalog - * @property {string|null} [branchId] SetDefaultBranchRequest branchId - * @property {string|null} [note] SetDefaultBranchRequest note + * Product colorInfo. + * @member {google.cloud.retail.v2alpha.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ + Product.prototype.colorInfo = null; /** - * Constructs a new SetDefaultBranchRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetDefaultBranchRequest. - * @implements ISetDefaultBranchRequest - * @constructor - * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest=} [properties] Properties to set + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - function SetDefaultBranchRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Product.prototype.sizes = $util.emptyArray; /** - * SetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - SetDefaultBranchRequest.prototype.catalog = ""; + Product.prototype.materials = $util.emptyArray; /** - * SetDefaultBranchRequest branchId. - * @member {string} branchId - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - SetDefaultBranchRequest.prototype.branchId = ""; + Product.prototype.patterns = $util.emptyArray; /** - * SetDefaultBranchRequest note. - * @member {string} note - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @instance - */ - SetDefaultBranchRequest.prototype.note = ""; - - /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest instance - */ - SetDefaultBranchRequest.create = function create(properties) { - return new SetDefaultBranchRequest(properties); - }; - - /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SetDefaultBranchRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); - return writer; - }; - - /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SetDefaultBranchRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - message.note = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SetDefaultBranchRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - SetDefaultBranchRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.branchId != null && message.hasOwnProperty("branchId")) - if (!$util.isString(message.branchId)) - return "branchId: string expected"; - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; - return null; - }; + Product.prototype.conditions = $util.emptyArray; /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - SetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.branchId != null) - message.branchId = String(object.branchId); - if (object.note != null) - message.note = String(object.note); - return message; - }; + Product.prototype.promotions = $util.emptyArray; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2alpha.SetDefaultBranchRequest} message SetDefaultBranchRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ - SetDefaultBranchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.catalog = ""; - object.branchId = ""; - object.note = ""; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.branchId != null && message.hasOwnProperty("branchId")) - object.branchId = message.branchId; - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; - return object; - }; + Product.prototype.publishTime = null; /** - * Converts this SetDefaultBranchRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2alpha.Product * @instance - * @returns {Object.} JSON object */ - SetDefaultBranchRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SetDefaultBranchRequest; - })(); - - v2alpha.GetDefaultBranchRequest = (function() { + Product.prototype.retrievableFields = null; /** - * Properties of a GetDefaultBranchRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IGetDefaultBranchRequest - * @property {string|null} [catalog] GetDefaultBranchRequest catalog + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2alpha.Product + * @instance */ + Product.prototype.variants = $util.emptyArray; - /** - * Constructs a new GetDefaultBranchRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GetDefaultBranchRequest. - * @implements IGetDefaultBranchRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest=} [properties] Properties to set - */ - function GetDefaultBranchRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * GetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2alpha.Product * @instance */ - GetDefaultBranchRequest.prototype.catalog = ""; + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. + * Creates a new Product instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest instance + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Product} Product instance */ - GetDefaultBranchRequest.create = function create(properties) { - return new GetDefaultBranchRequest(properties); + Product.create = function create(properties) { + return new Product(properties); }; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchRequest.encode = function encode(message, writer) { + Product.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2alpha.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) + $root.google.cloud.retail.v2alpha.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2alpha.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + $root.google.cloud.retail.v2alpha.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) + $root.google.cloud.retail.v2alpha.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.sizes != null && message.sizes.length) + for (var i = 0; i < message.sizes.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); + if (message.materials != null && message.materials.length) + for (var i = 0; i < message.materials.length; ++i) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); + if (message.patterns != null && message.patterns.length) + for (var i = 0; i < message.patterns.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); + if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) + $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.variants != null && message.variants.length) + for (var i = 0; i < message.variants.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.promotions != null && message.promotions.length) + for (var i = 0; i < message.promotions.length; ++i) + $root.google.cloud.retail.v2alpha.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2alpha.Product * @static - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + Product.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2alpha.Product} Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchRequest.decode = function decode(reader, length) { + Product.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Product(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 16: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; case 1: - message.catalog = reader.string(); + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 5: + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + case 6: + message.gtin = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 9: + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + case 10: + message.description = reader.string(); + break; + case 11: + message.languageCode = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + case 15: + message.rating = $root.google.cloud.retail.v2alpha.Rating.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 21: + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2alpha.FulfillmentInfo.decode(reader, reader.uint32())); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); + break; + case 24: + message.audience = $root.google.cloud.retail.v2alpha.Audience.decode(reader, reader.uint32()); + break; + case 25: + message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.decode(reader, reader.uint32()); + break; + case 26: + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + case 27: + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + case 28: + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + case 29: + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + case 34: + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2alpha.Promotion.decode(reader, reader.uint32())); + break; + case 33: + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 30: + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 31: + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -38167,452 +36852,725 @@ }; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2alpha.Product} Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + Product.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDefaultBranchRequest message. + * Verifies a Product message. * @function verify - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDefaultBranchRequest.verify = function verify(message) { + Product.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - return null; - }; - - /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest - */ - GetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - return message; - }; - - /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest - * @static - * @param {google.cloud.retail.v2alpha.GetDefaultBranchRequest} message GetDefaultBranchRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDefaultBranchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.catalog = ""; - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - return object; - }; - - /** - * Converts this GetDefaultBranchRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest - * @instance - * @returns {Object.} JSON object - */ - GetDefaultBranchRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetDefaultBranchRequest; - })(); - - v2alpha.GetDefaultBranchResponse = (function() { - - /** - * Properties of a GetDefaultBranchResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IGetDefaultBranchResponse - * @property {string|null} [branch] GetDefaultBranchResponse branch - * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime - * @property {string|null} [note] GetDefaultBranchResponse note - */ - - /** - * Constructs a new GetDefaultBranchResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GetDefaultBranchResponse. - * @implements IGetDefaultBranchResponse - * @constructor - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse=} [properties] Properties to set - */ - function GetDefaultBranchResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetDefaultBranchResponse branch. - * @member {string} branch - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @instance - */ - GetDefaultBranchResponse.prototype.branch = ""; - - /** - * GetDefaultBranchResponse setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @instance - */ - GetDefaultBranchResponse.prototype.setTime = null; - - /** - * GetDefaultBranchResponse note. - * @member {string} note - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @instance - */ - GetDefaultBranchResponse.prototype.note = ""; - - /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse instance - */ - GetDefaultBranchResponse.create = function create(properties) { - return new GetDefaultBranchResponse(properties); - }; - - /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDefaultBranchResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); - return writer; - }; - - /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDefaultBranchResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + var properties = {}; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.ttl); + if (error) + return "ttl." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: case 1: - message.branch = reader.string(); - break; case 2: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; case 3: - message.note = reader.string(); break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { + if (!Array.isArray(message.collectionMemberIds)) + return "collectionMemberIds: array expected"; + for (var i = 0; i < message.collectionMemberIds.length; ++i) + if (!$util.isString(message.collectionMemberIds[i])) + return "collectionMemberIds: string[] expected"; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + if (!$util.isString(message.gtin)) + return "gtin: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.brands != null && message.hasOwnProperty("brands")) { + if (!Array.isArray(message.brands)) + return "brands: array expected"; + for (var i = 0; i < message.brands.length; ++i) + if (!$util.isString(message.brands[i])) + return "brands: string[] expected"; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.rating != null && message.hasOwnProperty("rating")) { + var error = $root.google.cloud.retail.v2alpha.Rating.verify(message.rating); + if (error) + return "rating." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { default: - reader.skipType(tag & 7); + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: break; } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; } - return message; - }; - - /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetDefaultBranchResponse message. - * @function verify - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDefaultBranchResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + if (!Array.isArray(message.fulfillmentInfo)) + return "fulfillmentInfo: array expected"; + for (var i = 0; i < message.fulfillmentInfo.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.FulfillmentInfo.verify(message.fulfillmentInfo[i]); + if (error) + return "fulfillmentInfo." + error; + } + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + if (message.audience != null && message.hasOwnProperty("audience")) { + var error = $root.google.cloud.retail.v2alpha.Audience.verify(message.audience); if (error) - return "setTime." + error; + return "audience." + error; + } + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { + var error = $root.google.cloud.retail.v2alpha.ColorInfo.verify(message.colorInfo); + if (error) + return "colorInfo." + error; + } + if (message.sizes != null && message.hasOwnProperty("sizes")) { + if (!Array.isArray(message.sizes)) + return "sizes: array expected"; + for (var i = 0; i < message.sizes.length; ++i) + if (!$util.isString(message.sizes[i])) + return "sizes: string[] expected"; + } + if (message.materials != null && message.hasOwnProperty("materials")) { + if (!Array.isArray(message.materials)) + return "materials: array expected"; + for (var i = 0; i < message.materials.length; ++i) + if (!$util.isString(message.materials[i])) + return "materials: string[] expected"; + } + if (message.patterns != null && message.hasOwnProperty("patterns")) { + if (!Array.isArray(message.patterns)) + return "patterns: array expected"; + for (var i = 0; i < message.patterns.length; ++i) + if (!$util.isString(message.patterns[i])) + return "patterns: string[] expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) + if (!$util.isString(message.conditions[i])) + return "conditions: string[] expected"; + } + if (message.promotions != null && message.hasOwnProperty("promotions")) { + if (!Array.isArray(message.promotions)) + return "promotions: array expected"; + for (var i = 0; i < message.promotions.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Promotion.verify(message.promotions[i]); + if (error) + return "promotions." + error; + } + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.publishTime); + if (error) + return "publishTime." + error; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { + var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); + if (error) + return "retrievableFields." + error; + } + if (message.variants != null && message.hasOwnProperty("variants")) { + if (!Array.isArray(message.variants)) + return "variants: array expected"; + for (var i = 0; i < message.variants.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.variants[i]); + if (error) + return "variants." + error; + } } - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; return null; }; /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2alpha.Product * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2alpha.Product} Product */ - GetDefaultBranchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse) + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Product) return object; - var message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse(); - if (object.branch != null) - message.branch = String(object.branch); - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.GetDefaultBranchResponse.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + var message = new $root.google.cloud.retail.v2alpha.Product(); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); } - if (object.note != null) - message.note = String(object.note); - return message; - }; - - /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2alpha.GetDefaultBranchResponse} message GetDefaultBranchResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDefaultBranchResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.branch = ""; - object.setTime = null; - object.note = ""; + if (object.ttl != null) { + if (typeof object.ttl !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.ttl: object expected"); + message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); } - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; - return object; - }; - - /** - * Converts this GetDefaultBranchResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse - * @instance - * @returns {Object.} JSON object - */ - GetDefaultBranchResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetDefaultBranchResponse; - })(); - - v2alpha.CompletionService = (function() { - - /** - * Constructs a new CompletionService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompletionService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CompletionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; - - /** - * Creates new CompletionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.CompletionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. - */ - CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. - * @memberof google.cloud.retail.v2alpha.CompletionService - * @typedef CompleteQueryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} [response] CompleteQueryResponse - */ + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.collectionMemberIds) { + if (!Array.isArray(object.collectionMemberIds)) + throw TypeError(".google.cloud.retail.v2alpha.Product.collectionMemberIds: array expected"); + message.collectionMemberIds = []; + for (var i = 0; i < object.collectionMemberIds.length; ++i) + message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); + } + if (object.gtin != null) + message.gtin = String(object.gtin); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2alpha.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.brands) { + if (!Array.isArray(object.brands)) + throw TypeError(".google.cloud.retail.v2alpha.Product.brands: array expected"); + message.brands = []; + for (var i = 0; i < object.brands.length; ++i) + message.brands[i] = String(object.brands[i]); + } + if (object.description != null) + message.description = String(object.description); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2alpha.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + } + if (object.rating != null) { + if (typeof object.rating !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.rating: object expected"); + message.rating = $root.google.cloud.retail.v2alpha.Rating.fromObject(object.rating); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.fulfillmentInfo) { + if (!Array.isArray(object.fulfillmentInfo)) + throw TypeError(".google.cloud.retail.v2alpha.Product.fulfillmentInfo: array expected"); + message.fulfillmentInfo = []; + for (var i = 0; i < object.fulfillmentInfo.length; ++i) { + if (typeof object.fulfillmentInfo[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.fulfillmentInfo: object expected"); + message.fulfillmentInfo[i] = $root.google.cloud.retail.v2alpha.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); + } + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2alpha.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2alpha.Image.fromObject(object.images[i]); + } + } + if (object.audience != null) { + if (typeof object.audience !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.audience: object expected"); + message.audience = $root.google.cloud.retail.v2alpha.Audience.fromObject(object.audience); + } + if (object.colorInfo != null) { + if (typeof object.colorInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.colorInfo: object expected"); + message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.fromObject(object.colorInfo); + } + if (object.sizes) { + if (!Array.isArray(object.sizes)) + throw TypeError(".google.cloud.retail.v2alpha.Product.sizes: array expected"); + message.sizes = []; + for (var i = 0; i < object.sizes.length; ++i) + message.sizes[i] = String(object.sizes[i]); + } + if (object.materials) { + if (!Array.isArray(object.materials)) + throw TypeError(".google.cloud.retail.v2alpha.Product.materials: array expected"); + message.materials = []; + for (var i = 0; i < object.materials.length; ++i) + message.materials[i] = String(object.materials[i]); + } + if (object.patterns) { + if (!Array.isArray(object.patterns)) + throw TypeError(".google.cloud.retail.v2alpha.Product.patterns: array expected"); + message.patterns = []; + for (var i = 0; i < object.patterns.length; ++i) + message.patterns[i] = String(object.patterns[i]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.cloud.retail.v2alpha.Product.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) + message.conditions[i] = String(object.conditions[i]); + } + if (object.promotions) { + if (!Array.isArray(object.promotions)) + throw TypeError(".google.cloud.retail.v2alpha.Product.promotions: array expected"); + message.promotions = []; + for (var i = 0; i < object.promotions.length; ++i) { + if (typeof object.promotions[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.promotions: object expected"); + message.promotions[i] = $root.google.cloud.retail.v2alpha.Promotion.fromObject(object.promotions[i]); + } + } + if (object.publishTime != null) { + if (typeof object.publishTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.publishTime: object expected"); + message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + } + if (object.retrievableFields != null) { + if (typeof object.retrievableFields !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.retrievableFields: object expected"); + message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + } + if (object.variants) { + if (!Array.isArray(object.variants)) + throw TypeError(".google.cloud.retail.v2alpha.Product.variants: array expected"); + message.variants = []; + for (var i = 0; i < object.variants.length; ++i) { + if (typeof object.variants[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Product.variants: object expected"); + message.variants[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.variants[i]); + } + } + return message; + }; /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @param {google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse - * @returns {undefined} - * @variation 1 + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { - return this.rpcCall(completeQuery, $root.google.cloud.retail.v2alpha.CompleteQueryRequest, $root.google.cloud.retail.v2alpha.CompleteQueryResponse, request, callback); - }, "name", { value: "CompleteQuery" }); + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.collectionMemberIds = []; + object.categories = []; + object.brands = []; + object.tags = []; + object.fulfillmentInfo = []; + object.images = []; + object.sizes = []; + object.materials = []; + object.patterns = []; + object.conditions = []; + object.variants = []; + object.promotions = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.gtin = ""; + object.title = ""; + object.description = ""; + object.languageCode = ""; + object.priceInfo = null; + object.rating = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + object.audience = null; + object.colorInfo = null; + object.retrievableFields = null; + object.publishTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.collectionMemberIds && message.collectionMemberIds.length) { + object.collectionMemberIds = []; + for (var j = 0; j < message.collectionMemberIds.length; ++j) + object.collectionMemberIds[j] = message.collectionMemberIds[j]; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + object.gtin = message.gtin; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.brands && message.brands.length) { + object.brands = []; + for (var j = 0; j < message.brands.length; ++j) + object.brands[j] = message.brands[j]; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + if (message.rating != null && message.hasOwnProperty("rating")) + object.rating = $root.google.cloud.retail.v2alpha.Rating.toObject(message.rating, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (options.oneofs) + object.expiration = "expireTime"; + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (options.oneofs) + object.expiration = "ttl"; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.fulfillmentInfo && message.fulfillmentInfo.length) { + object.fulfillmentInfo = []; + for (var j = 0; j < message.fulfillmentInfo.length; ++j) + object.fulfillmentInfo[j] = $root.google.cloud.retail.v2alpha.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2alpha.Image.toObject(message.images[j], options); + } + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = $root.google.cloud.retail.v2alpha.Audience.toObject(message.audience, options); + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) + object.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.toObject(message.colorInfo, options); + if (message.sizes && message.sizes.length) { + object.sizes = []; + for (var j = 0; j < message.sizes.length; ++j) + object.sizes[j] = message.sizes[j]; + } + if (message.materials && message.materials.length) { + object.materials = []; + for (var j = 0; j < message.materials.length; ++j) + object.materials[j] = message.materials[j]; + } + if (message.patterns && message.patterns.length) { + object.patterns = []; + for (var j = 0; j < message.patterns.length; ++j) + object.patterns[j] = message.patterns[j]; + } + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = message.conditions[j]; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) + object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); + if (message.variants && message.variants.length) { + object.variants = []; + for (var j = 0; j < message.variants.length; ++j) + object.variants[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.variants[j], options); + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); + if (message.promotions && message.promotions.length) { + object.promotions = []; + for (var j = 0; j < message.promotions.length; ++j) + object.promotions[j] = $root.google.cloud.retail.v2alpha.Promotion.toObject(message.promotions[j], options); + } + return object; + }; /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2alpha.CompletionService + * Converts this Product to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Product * @instance - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. - * @memberof google.cloud.retail.v2alpha.CompletionService - * @typedef ImportCompletionDataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * @returns {Object.} JSON object */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @param {google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Type enum. + * @name google.cloud.retail.v2alpha.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value */ - Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { - return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportCompletionData" }); + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Availability enum. + * @name google.cloud.retail.v2alpha.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); - return CompletionService; + return Product; })(); - v2alpha.CompleteQueryRequest = (function() { + v2alpha.UserEvent = (function() { /** - * Properties of a CompleteQueryRequest. + * Properties of a UserEvent. * @memberof google.cloud.retail.v2alpha - * @interface ICompleteQueryRequest - * @property {string|null} [catalog] CompleteQueryRequest catalog - * @property {string|null} [query] CompleteQueryRequest query - * @property {string|null} [visitorId] CompleteQueryRequest visitorId - * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes - * @property {string|null} [deviceType] CompleteQueryRequest deviceType - * @property {string|null} [dataset] CompleteQueryRequest dataset - * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2alpha.ICompletionDetail|null} [completionDetail] UserEvent completionDetail + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2alpha.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {string|null} [filter] UserEvent filter + * @property {string|null} [orderBy] UserEvent orderBy + * @property {number|null} [offset] UserEvent offset + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId */ /** - * Constructs a new CompleteQueryRequest. + * Constructs a new UserEvent. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompleteQueryRequest. - * @implements ICompleteQueryRequest + * @classdesc Represents a UserEvent. + * @implements IUserEvent * @constructor - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set */ - function CompleteQueryRequest(properties) { - this.languageCodes = []; + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38620,156 +37578,353 @@ } /** - * CompleteQueryRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.catalog = ""; + UserEvent.prototype.eventType = ""; /** - * CompleteQueryRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.query = ""; + UserEvent.prototype.visitorId = ""; /** - * CompleteQueryRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent sessionId. + * @member {string} sessionId + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.visitorId = ""; + UserEvent.prototype.sessionId = ""; /** - * CompleteQueryRequest languageCodes. - * @member {Array.} languageCodes - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + UserEvent.prototype.eventTime = null; /** - * CompleteQueryRequest deviceType. - * @member {string} deviceType - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.deviceType = ""; + UserEvent.prototype.experimentIds = $util.emptyArray; /** - * CompleteQueryRequest dataset. - * @member {string} dataset - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.dataset = ""; + UserEvent.prototype.attributionToken = ""; /** - * CompleteQueryRequest maxSuggestions. - * @member {number} maxSuggestions - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance */ - CompleteQueryRequest.prototype.maxSuggestions = 0; + UserEvent.prototype.productDetails = $util.emptyArray; /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * UserEvent completionDetail. + * @member {google.cloud.retail.v2alpha.ICompletionDetail|null|undefined} completionDetail + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.completionDetail = null; + + /** + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.attributes = $util.emptyObject; + + /** + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.cartId = ""; + + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2alpha.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; + + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; + + /** + * UserEvent filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.filter = ""; + + /** + * UserEvent orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.orderBy = ""; + + /** + * UserEvent offset. + * @member {number} offset + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.offset = 0; + + /** + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.pageCategories = $util.emptyArray; + + /** + * UserEvent userInfo. + * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.userInfo = null; + + /** + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2alpha.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest instance + * @param {google.cloud.retail.v2alpha.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent instance */ - CompleteQueryRequest.create = function create(properties) { - return new CompleteQueryRequest(properties); + UserEvent.create = function create(properties) { + return new UserEvent(properties); }; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encode = function encode(message, writer) { + UserEvent.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); - if (message.languageCodes != null && message.languageCodes.length) - for (var i = 0; i < message.languageCodes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); - if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); - if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); - if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2alpha.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2alpha.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); + if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) + $root.google.cloud.retail.v2alpha.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEvent.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEvent} message UserEvent message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a UserEvent message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decode = function decode(reader, length) { + UserEvent.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEvent(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = reader.string(); + message.eventType = reader.string(); break; case 2: - message.query = reader.string(); - break; - case 7: message.visitorId = reader.string(); break; + case 21: + message.sessionId = reader.string(); + break; case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 4: - message.deviceType = reader.string(); + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); break; case 6: - message.dataset = reader.string(); + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); break; - case 5: - message.maxSuggestions = reader.int32(); + case 22: + message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.decode(reader, reader.uint32()); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 16: + message.filter = reader.string(); + break; + case 17: + message.orderBy = reader.string(); + break; + case 18: + message.offset = reader.int32(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); break; default: reader.skipType(tag & 7); @@ -38780,173 +37935,344 @@ }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a UserEvent message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + UserEvent.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryRequest message. + * Verifies a UserEvent message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryRequest.verify = function verify(message) { + UserEvent.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; if (message.visitorId != null && message.hasOwnProperty("visitorId")) if (!$util.isString(message.visitorId)) return "visitorId: string expected"; - if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { - if (!Array.isArray(message.languageCodes)) - return "languageCodes: array expected"; - for (var i = 0; i < message.languageCodes.length; ++i) - if (!$util.isString(message.languageCodes[i])) - return "languageCodes: string[] expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isString(message.sessionId)) + return "sessionId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - if (!$util.isString(message.deviceType)) - return "deviceType: string expected"; - if (message.dataset != null && message.hasOwnProperty("dataset")) - if (!$util.isString(message.dataset)) - return "dataset: string expected"; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - if (!$util.isInteger(message.maxSuggestions)) - return "maxSuggestions: integer expected"; + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDetail.verify(message.completionDetail); + if (error) + return "completionDetail." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2alpha.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; return null; }; /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2alpha.UserEvent} UserEvent */ - CompleteQueryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryRequest) + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEvent) return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.query != null) - message.query = String(object.query); + var message = new $root.google.cloud.retail.v2alpha.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); if (object.visitorId != null) message.visitorId = String(object.visitorId); - if (object.languageCodes) { - if (!Array.isArray(object.languageCodes)) - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryRequest.languageCodes: array expected"); - message.languageCodes = []; - for (var i = 0; i < object.languageCodes.length; ++i) - message.languageCodes[i] = String(object.languageCodes[i]); + if (object.sessionId != null) + message.sessionId = String(object.sessionId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); } - if (object.deviceType != null) - message.deviceType = String(object.deviceType); - if (object.dataset != null) - message.dataset = String(object.dataset); - if (object.maxSuggestions != null) - message.maxSuggestions = object.maxSuggestions | 0; - return message; - }; - - /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryRequest} message CompleteQueryRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompleteQueryRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.languageCodes = []; - if (options.defaults) { - object.catalog = ""; - object.query = ""; - object.deviceType = ""; - object.maxSuggestions = 0; - object.dataset = ""; - object.visitorId = ""; + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.languageCodes && message.languageCodes.length) { - object.languageCodes = []; - for (var j = 0; j < message.languageCodes.length; ++j) - object.languageCodes[j] = message.languageCodes[j]; + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2alpha.ProductDetail.fromObject(object.productDetails[i]); + } } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - object.deviceType = message.deviceType; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - object.maxSuggestions = message.maxSuggestions; - if (message.dataset != null && message.hasOwnProperty("dataset")) - object.dataset = message.dataset; + if (object.completionDetail != null) { + if (typeof object.completionDetail !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.completionDetail: object expected"); + message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.fromObject(object.completionDetail); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {google.cloud.retail.v2alpha.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + object.filter = ""; + object.orderBy = ""; + object.offset = 0; + object.sessionId = ""; + object.completionDetail = null; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; if (message.visitorId != null && message.hasOwnProperty("visitorId")) object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2alpha.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) + object.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.toObject(message.completionDetail, options); return object; }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this UserEvent to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.UserEvent * @instance * @returns {Object.} JSON object */ - CompleteQueryRequest.prototype.toJSON = function toJSON() { + UserEvent.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompleteQueryRequest; + return UserEvent; })(); - v2alpha.CompleteQueryResponse = (function() { + v2alpha.ProductDetail = (function() { /** - * Properties of a CompleteQueryResponse. + * Properties of a ProductDetail. * @memberof google.cloud.retail.v2alpha - * @interface ICompleteQueryResponse - * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults - * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken - * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + * @interface IProductDetail + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity */ /** - * Constructs a new CompleteQueryResponse. + * Constructs a new ProductDetail. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompleteQueryResponse. - * @implements ICompleteQueryResponse + * @classdesc Represents a ProductDetail. + * @implements IProductDetail * @constructor - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set */ - function CompleteQueryResponse(properties) { - this.completionResults = []; - this.recentSearchResults = []; + function ProductDetail(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38954,107 +38280,88 @@ } /** - * CompleteQueryResponse completionResults. - * @member {Array.} completionResults - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @instance - */ - CompleteQueryResponse.prototype.completionResults = $util.emptyArray; - - /** - * CompleteQueryResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * ProductDetail product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.ProductDetail * @instance */ - CompleteQueryResponse.prototype.attributionToken = ""; + ProductDetail.prototype.product = null; /** - * CompleteQueryResponse recentSearchResults. - * @member {Array.} recentSearchResults - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2alpha.ProductDetail * @instance */ - CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + ProductDetail.prototype.quantity = null; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new ProductDetail instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse instance + * @param {google.cloud.retail.v2alpha.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail instance */ - CompleteQueryResponse.create = function create(properties) { - return new CompleteQueryResponse(properties); + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); }; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encode = function encode(message, writer) { + ProductDetail.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionResults != null && message.completionResults.length) - for (var i = 0; i < message.completionResults.length; ++i) - $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.recentSearchResults != null && message.recentSearchResults.length) - for (var i = 0; i < message.recentSearchResults.length; ++i) - $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductDetail.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductDetail} message ProductDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes a ProductDetail message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decode = function decode(reader, length) { + ProductDetail.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductDetail(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); break; case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -39065,688 +38372,230 @@ }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + ProductDetail.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryResponse message. + * Verifies a ProductDetail message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryResponse.verify = function verify(message) { + ProductDetail.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.completionResults != null && message.hasOwnProperty("completionResults")) { - if (!Array.isArray(message.completionResults)) - return "completionResults: array expected"; - for (var i = 0; i < message.completionResults.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); - if (error) - return "completionResults." + error; - } + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { - if (!Array.isArray(message.recentSearchResults)) - return "recentSearchResults: array expected"; - for (var i = 0; i < message.recentSearchResults.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); - if (error) - return "recentSearchResults." + error; - } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; } return null; }; /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2alpha.ProductDetail} ProductDetail */ - CompleteQueryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse) + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductDetail) return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); - if (object.completionResults) { - if (!Array.isArray(object.completionResults)) - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: array expected"); - message.completionResults = []; - for (var i = 0; i < object.completionResults.length; ++i) { - if (typeof object.completionResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: object expected"); - message.completionResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); - } + var message = new $root.google.cloud.retail.v2alpha.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.recentSearchResults) { - if (!Array.isArray(object.recentSearchResults)) - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: array expected"); - message.recentSearchResults = []; - for (var i = 0; i < object.recentSearchResults.length; ++i) { - if (typeof object.recentSearchResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: object expected"); - message.recentSearchResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); - } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); } return message; }; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} message CompleteQueryResponse + * @param {google.cloud.retail.v2alpha.ProductDetail} message ProductDetail * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryResponse.toObject = function toObject(message, options) { + ProductDetail.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.completionResults = []; - object.recentSearchResults = []; - } - if (options.defaults) - object.attributionToken = ""; - if (message.completionResults && message.completionResults.length) { - object.completionResults = []; - for (var j = 0; j < message.completionResults.length; ++j) - object.completionResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.recentSearchResults && message.recentSearchResults.length) { - object.recentSearchResults = []; - for (var j = 0; j < message.recentSearchResults.length; ++j) - object.recentSearchResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + if (options.defaults) { + object.product = null; + object.quantity = null; } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); return object; }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this ProductDetail to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.ProductDetail * @instance * @returns {Object.} JSON object */ - CompleteQueryResponse.prototype.toJSON = function toJSON() { + ProductDetail.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - CompleteQueryResponse.CompletionResult = (function() { + return ProductDetail; + })(); - /** - * Properties of a CompletionResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @interface ICompletionResult - * @property {string|null} [suggestion] CompletionResult suggestion - * @property {Object.|null} [attributes] CompletionResult attributes - */ + v2alpha.CompletionDetail = (function() { - /** - * Constructs a new CompletionResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @classdesc Represents a CompletionResult. - * @implements ICompletionResult - * @constructor - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - */ - function CompletionResult(properties) { - this.attributes = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a CompletionDetail. + * @memberof google.cloud.retail.v2alpha + * @interface ICompletionDetail + * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken + * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion + * @property {number|null} [selectedPosition] CompletionDetail selectedPosition + */ - /** - * CompletionResult suggestion. - * @member {string} suggestion - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.suggestion = ""; + /** + * Constructs a new CompletionDetail. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompletionDetail. + * @implements ICompletionDetail + * @constructor + * @param {google.cloud.retail.v2alpha.ICompletionDetail=} [properties] Properties to set + */ + function CompletionDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CompletionResult attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.attributes = $util.emptyObject; + /** + * CompletionDetail completionAttributionToken. + * @member {string} completionAttributionToken + * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @instance + */ + CompletionDetail.prototype.completionAttributionToken = ""; - /** - * Creates a new CompletionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult instance - */ - CompletionResult.create = function create(properties) { - return new CompletionResult(properties); - }; - - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompletionResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompletionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - if (!$util.isString(message.suggestion)) - return "suggestion: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - return null; - }; - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult - */ - CompletionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(); - if (object.suggestion != null) - message.suggestion = String(object.suggestion); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} message CompletionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompletionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) - object.suggestion = ""; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - object.suggestion = message.suggestion; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - return object; - }; - - /** - * Converts this CompletionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @instance - * @returns {Object.} JSON object - */ - CompletionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompletionResult; - })(); - - CompleteQueryResponse.RecentSearchResult = (function() { - - /** - * Properties of a RecentSearchResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @interface IRecentSearchResult - * @property {string|null} [recentSearch] RecentSearchResult recentSearch - */ - - /** - * Constructs a new RecentSearchResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @classdesc Represents a RecentSearchResult. - * @implements IRecentSearchResult - * @constructor - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - */ - function RecentSearchResult(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RecentSearchResult recentSearch. - * @member {string} recentSearch - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @instance - */ - RecentSearchResult.prototype.recentSearch = ""; - - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance - */ - RecentSearchResult.create = function create(properties) { - return new RecentSearchResult(properties); - }; - - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); - return writer; - }; - - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RecentSearchResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RecentSearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - if (!$util.isString(message.recentSearch)) - return "recentSearch: string expected"; - return null; - }; - - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - */ - RecentSearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); - if (object.recentSearch != null) - message.recentSearch = String(object.recentSearch); - return message; - }; - - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RecentSearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.recentSearch = ""; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - object.recentSearch = message.recentSearch; - return object; - }; - - /** - * Converts this RecentSearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @instance - * @returns {Object.} JSON object - */ - RecentSearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RecentSearchResult; - })(); - - return CompleteQueryResponse; - })(); - - v2alpha.ExportErrorsConfig = (function() { - - /** - * Properties of an ExportErrorsConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IExportErrorsConfig - * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix - */ - - /** - * Constructs a new ExportErrorsConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportErrorsConfig. - * @implements IExportErrorsConfig - * @constructor - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set - */ - function ExportErrorsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig - * @instance - */ - ExportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * CompletionDetail selectedSuggestion. + * @member {string} selectedSuggestion + * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedSuggestion = ""; /** - * ExportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * CompletionDetail selectedPosition. + * @member {number} selectedPosition + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @instance */ - Object.defineProperty(ExportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + CompletionDetail.prototype.selectedPosition = 0; /** - * Creates a new ExportErrorsConfig instance using the specified properties. + * Creates a new CompletionDetail instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance + * @param {google.cloud.retail.v2alpha.ICompletionDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail instance */ - ExportErrorsConfig.create = function create(properties) { - return new ExportErrorsConfig(properties); + CompletionDetail.create = function create(properties) { + return new CompletionDetail(properties); }; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDetail} message CompletionDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encode = function encode(message, writer) { + CompletionDetail.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); + if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); + if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); return writer; }; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDetail.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDetail} message CompletionDetail message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * Decodes a CompletionDetail message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decode = function decode(reader, length) { + CompletionDetail.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDetail(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + message.completionAttributionToken = reader.string(); + break; + case 2: + message.selectedSuggestion = reader.string(); + break; + case 3: + message.selectedPosition = reader.int32(); break; default: reader.skipType(tag & 7); @@ -39757,112 +38606,128 @@ }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + CompletionDetail.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportErrorsConfig message. + * Verifies a CompletionDetail message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportErrorsConfig.verify = function verify(message) { + CompletionDetail.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + if (!$util.isString(message.completionAttributionToken)) + return "completionAttributionToken: string expected"; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + if (!$util.isString(message.selectedSuggestion)) + return "selectedSuggestion: string expected"; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + if (!$util.isInteger(message.selectedPosition)) + return "selectedPosition: integer expected"; return null; }; /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.CompletionDetail} CompletionDetail */ - ExportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) + CompletionDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDetail) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); - return message; + var message = new $root.google.cloud.retail.v2alpha.CompletionDetail(); + if (object.completionAttributionToken != null) + message.completionAttributionToken = String(object.completionAttributionToken); + if (object.selectedSuggestion != null) + message.selectedSuggestion = String(object.selectedSuggestion); + if (object.selectedPosition != null) + message.selectedPosition = object.selectedPosition | 0; + return message; }; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @static - * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig + * @param {google.cloud.retail.v2alpha.CompletionDetail} message CompletionDetail * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportErrorsConfig.toObject = function toObject(message, options) { + CompletionDetail.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; + if (options.defaults) { + object.completionAttributionToken = ""; + object.selectedSuggestion = ""; + object.selectedPosition = 0; } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + object.completionAttributionToken = message.completionAttributionToken; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + object.selectedSuggestion = message.selectedSuggestion; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + object.selectedPosition = message.selectedPosition; return object; }; /** - * Converts this ExportErrorsConfig to JSON. + * Converts this CompletionDetail to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.CompletionDetail * @instance * @returns {Object.} JSON object */ - ExportErrorsConfig.prototype.toJSON = function toJSON() { + CompletionDetail.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportErrorsConfig; + return CompletionDetail; })(); - v2alpha.ExportMetadata = (function() { + v2alpha.PurchaseTransaction = (function() { /** - * Properties of an ExportMetadata. + * Properties of a PurchaseTransaction. * @memberof google.cloud.retail.v2alpha - * @interface IExportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode */ /** - * Constructs a new ExportMetadata. + * Constructs a new PurchaseTransaction. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportMetadata. - * @implements IExportMetadata + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction * @constructor - * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set */ - function ExportMetadata(properties) { + function PurchaseTransaction(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -39870,88 +38735,127 @@ } /** - * ExportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @instance */ - ExportMetadata.prototype.createTime = null; + PurchaseTransaction.prototype.id = ""; /** - * ExportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @instance */ - ExportMetadata.prototype.updateTime = null; + PurchaseTransaction.prototype.revenue = 0; /** - * Creates a new ExportMetadata instance using the specified properties. + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction instance */ - ExportMetadata.create = function create(properties) { - return new ExportMetadata(properties); + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); }; /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encode = function encode(message, writer) { + PurchaseTransaction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); return writer; }; /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurchaseTransaction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportMetadata message from the specified reader or buffer. + * Decodes a PurchaseTransaction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decode = function decode(reader, length) { + PurchaseTransaction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.id = reader.string(); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); break; default: reader.skipType(tag & 7); @@ -39962,128 +38866,309 @@ }; /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportMetadata message. + * Verifies a PurchaseTransaction message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportMetadata.verify = function verify(message) { + PurchaseTransaction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; - } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; return null; }; /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.PurchaseTransaction} PurchaseTransaction */ - ExportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurchaseTransaction) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } + var message = new $root.google.cloud.retail.v2alpha.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); return message; }; /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @static - * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata + * @param {google.cloud.retail.v2alpha.PurchaseTransaction} message PurchaseTransaction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportMetadata.toObject = function toObject(message, options) { + PurchaseTransaction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.createTime = null; - object.updateTime = null; + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; return object; }; /** - * Converts this ExportMetadata to JSON. + * Converts this PurchaseTransaction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction * @instance * @returns {Object.} JSON object */ - ExportMetadata.prototype.toJSON = function toJSON() { + PurchaseTransaction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportMetadata; + return PurchaseTransaction; })(); - v2alpha.ExportProductsResponse = (function() { + v2alpha.CatalogService = (function() { /** - * Properties of an ExportProductsResponse. + * Constructs a new CatalogService service. * @memberof google.cloud.retail.v2alpha - * @interface IExportProductsResponse - * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} [response] ListCatalogsResponse */ /** - * Constructs a new ExportProductsResponse. + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2alpha.ListCatalogsRequest, $root.google.cloud.retail.v2alpha.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2alpha.UpdateCatalogRequest, $root.google.cloud.retail.v2alpha.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + */ + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest, $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2alpha.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportProductsResponse. - * @implements IExportProductsResponse + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set */ - function ExportProductsResponse(properties) { - this.errorSamples = []; + function ListCatalogsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40091,91 +39176,101 @@ } /** - * ExportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance */ - ExportProductsResponse.prototype.errorSamples = $util.emptyArray; + ListCatalogsRequest.prototype.parent = ""; /** - * ExportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance */ - ExportProductsResponse.prototype.errorsConfig = null; + ListCatalogsRequest.prototype.pageSize = 0; /** - * Creates a new ExportProductsResponse instance using the specified properties. + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest instance */ - ExportProductsResponse.create = function create(properties) { - return new ExportProductsResponse(properties); + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); }; /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encode = function encode(message, writer) { + ListCatalogsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decode = function decode(reader, length) { + ListCatalogsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -40186,140 +39281,126 @@ }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportProductsResponse message. + * Verifies a ListCatalogsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportProductsResponse.verify = function verify(message) { + ListCatalogsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsRequest} ListCatalogsRequest */ - ExportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2alpha.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse + * @param {google.cloud.retail.v2alpha.ListCatalogsRequest} message ListCatalogsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportProductsResponse.toObject = function toObject(message, options) { + ListCatalogsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; return object; }; /** - * Converts this ExportProductsResponse to JSON. + * Converts this ListCatalogsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest * @instance * @returns {Object.} JSON object */ - ExportProductsResponse.prototype.toJSON = function toJSON() { + ListCatalogsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportProductsResponse; + return ListCatalogsRequest; })(); - v2alpha.ExportUserEventsResponse = (function() { + v2alpha.ListCatalogsResponse = (function() { /** - * Properties of an ExportUserEventsResponse. + * Properties of a ListCatalogsResponse. * @memberof google.cloud.retail.v2alpha - * @interface IExportUserEventsResponse - * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken */ /** - * Constructs a new ExportUserEventsResponse. + * Constructs a new ListCatalogsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportUserEventsResponse. - * @implements IExportUserEventsResponse + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set */ - function ExportUserEventsResponse(properties) { - this.errorSamples = []; + function ListCatalogsResponse(properties) { + this.catalogs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40327,91 +39408,91 @@ } /** - * ExportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @instance */ - ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; /** - * ExportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @instance */ - ExportUserEventsResponse.prototype.errorsConfig = null; + ListCatalogsResponse.prototype.nextPageToken = ""; /** - * Creates a new ExportUserEventsResponse instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse instance */ - ExportUserEventsResponse.create = function create(properties) { - return new ExportUserEventsResponse(properties); + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); }; /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encode = function encode(message, writer) { + ListCatalogsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListCatalogsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decode = function decode(reader, length) { + ListCatalogsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -40422,215 +39503,134 @@ }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a ListCatalogsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportUserEventsResponse.verify = function verify(message) { + ListCatalogsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalogs[i]); if (error) - return "errorSamples." + error; + return "catalogs." + error; } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ListCatalogsResponse} ListCatalogsResponse */ - ExportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListCatalogsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + var message = new $root.google.cloud.retail.v2alpha.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalogs[i]); } } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); - } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {google.cloud.retail.v2alpha.ListCatalogsResponse} message ListCatalogsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportUserEventsResponse.toObject = function toObject(message, options) { + ListCatalogsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.errorSamples = []; + object.catalogs = []; if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalogs[j], options); } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this ListCatalogsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse * @instance * @returns {Object.} JSON object */ - ExportUserEventsResponse.prototype.toJSON = function toJSON() { + ListCatalogsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportUserEventsResponse; - })(); - - v2alpha.PredictionService = (function() { - - /** - * Constructs a new PredictionService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictionService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; - - /** - * Creates new PredictionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.PredictionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. - */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. - * @memberof google.cloud.retail.v2alpha.PredictionService - * @typedef PredictCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse - */ - - /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2alpha.PredictionService - * @instance - * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); - }, "name", { value: "Predict" }); - - /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2alpha.PredictionService - * @instance - * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return PredictionService; + return ListCatalogsResponse; })(); - v2alpha.PredictRequest = (function() { + v2alpha.UpdateCatalogRequest = (function() { /** - * Properties of a PredictRequest. + * Properties of an UpdateCatalogRequest. * @memberof google.cloud.retail.v2alpha - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2alpha.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask */ /** - * Constructs a new PredictRequest. + * Constructs a new UpdateCatalogRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest * @constructor - * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; + function UpdateCatalogRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40638,208 +39638,88 @@ } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.placement = ""; - - /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.userEvent = null; - - /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.pageSize = 0; - - /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.pageToken = ""; - - /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.filter = ""; - - /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.validateOnly = false; - - /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2alpha.PredictRequest + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2alpha.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @instance */ - PredictRequest.prototype.params = $util.emptyObject; + UpdateCatalogRequest.prototype.catalog = null; /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2alpha.PredictRequest + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @instance */ - PredictRequest.prototype.labels = $util.emptyObject; + UpdateCatalogRequest.prototype.updateMask = null; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + UpdateCatalogRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2alpha.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCatalogRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + UpdateCatalogRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); break; case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); - break; - case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -40850,208 +39730,128 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies an UpdateCatalogRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + UpdateCatalogRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2alpha.Catalog.verify(message.catalog); if (error) - return "userEvent." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } + return "catalog." + error; } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } return null; }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.UpdateCatalogRequest} UpdateCatalogRequest */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateCatalogRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } + var message = new $root.google.cloud.retail.v2alpha.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.fromObject(object.catalog); } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } return message; }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest + * @param {google.cloud.retail.v2alpha.UpdateCatalogRequest} message UpdateCatalogRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictRequest.toObject = function toObject(message, options) { + UpdateCatalogRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } if (options.defaults) { - object.placement = ""; - object.userEvent = null; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); - } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; + object.catalog = null; + object.updateMask = null; } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2alpha.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this PredictRequest to JSON. + * Converts this UpdateCatalogRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest * @instance * @returns {Object.} JSON object */ - PredictRequest.prototype.toJSON = function toJSON() { + UpdateCatalogRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PredictRequest; + return UpdateCatalogRequest; })(); - v2alpha.PredictResponse = (function() { + v2alpha.SetDefaultBranchRequest = (function() { /** - * Properties of a PredictResponse. + * Properties of a SetDefaultBranchRequest. * @memberof google.cloud.retail.v2alpha - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note */ /** - * Constructs a new PredictResponse. + * Constructs a new SetDefaultBranchRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function SetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41059,120 +39859,101 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @instance - */ - PredictResponse.prototype.results = $util.emptyArray; - - /** - * PredictResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.PredictResponse + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance */ - PredictResponse.prototype.attributionToken = ""; + SetDefaultBranchRequest.prototype.catalog = ""; /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2alpha.PredictResponse + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance */ - PredictResponse.prototype.missingIds = $util.emptyArray; + SetDefaultBranchRequest.prototype.branchId = ""; /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2alpha.PredictResponse + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance */ - PredictResponse.prototype.validateOnly = false; + SetDefaultBranchRequest.prototype.note = ""; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + SetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + SetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + message.catalog = reader.string(); break; case 2: - message.attributionToken = reader.string(); + message.branchId = reader.string(); break; case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -41183,815 +39964,313 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies a SetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + SetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; - } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.SetDefaultBranchRequest} SetDefaultBranchRequest */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); - } - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); - } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); + var message = new $root.google.cloud.retail.v2alpha.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2alpha.SetDefaultBranchRequest} message SetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + SetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; - } if (options.defaults) { - object.attributionToken = ""; - object.validateOnly = false; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + object.catalog = ""; + object.branchId = ""; + object.note = ""; } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PredictResponse.PredictionResult = (function() { - - /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata - */ - - /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.id = ""; - - /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.metadata = $util.emptyObject; - - /** - * Creates a new PredictionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance - */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); - }; - - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PredictionResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PredictionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); - if (error) - return "metadata." + error; - } - } - return null; - }; - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult - */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PredictionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.metadata = {}; - if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); - } - return object; - }; - - /** - * Converts this PredictionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult - * @instance - * @returns {Object.} JSON object - */ - PredictionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PredictionResult; - })(); - - return PredictResponse; + return SetDefaultBranchRequest; })(); - v2alpha.ProductService = (function() { + v2alpha.GetDefaultBranchRequest = (function() { /** - * Constructs a new ProductService service. + * Properties of a GetDefaultBranchRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductService - * @extends $protobuf.rpc.Service + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog + */ + + /** + * Constructs a new GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest=} [properties] Properties to set */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function GetDefaultBranchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + /** + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @instance + */ + GetDefaultBranchRequest.prototype.catalog = ""; /** - * Creates new ProductService service using the specified rpc implementation. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductService + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest instance */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + GetDefaultBranchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + return writer; + }; /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "CreateProduct" }); + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GetDefaultBranchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 + * Verifies a GetDefaultBranchRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "GetProduct" }); + GetDefaultBranchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + return null; + }; /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchRequest} GetDefaultBranchRequest */ + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + return message; + }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.ListProductsResponse} [response] ListProductsResponse + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2alpha.GetDefaultBranchRequest} message GetDefaultBranchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ + GetDefaultBranchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + return object; + }; /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2alpha.ProductService + * Converts this GetDefaultBranchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest * @instance - * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 + * @returns {Object.} JSON object */ - Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.retail.v2alpha.ListProductsRequest, $root.google.cloud.retail.v2alpha.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + return GetDefaultBranchRequest; + })(); + + v2alpha.GetDefaultBranchResponse = (function() { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product + * Properties of a GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note */ /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef SetInventoryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { - return this.rpcCall(setInventory, $root.google.cloud.retail.v2alpha.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "SetInventory" }); - - /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef AddFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { - return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddFulfillmentPlaces" }); - - /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef RemoveFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { - return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveFulfillmentPlaces" }); - - /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef AddLocalInventoriesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AddLocalInventories. - * @function addLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { - return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddLocalInventories" }); - - /** - * Calls AddLocalInventories. - * @function addLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef RemoveLocalInventoriesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RemoveLocalInventories. - * @function removeLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { - return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveLocalInventories" }); - - /** - * Calls RemoveLocalInventories. - * @function removeLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductService; - })(); - - v2alpha.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ - - /** - * Constructs a new CreateProductRequest. + * Constructs a new GetDefaultBranchResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse * @constructor - * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse=} [properties] Properties to set */ - function CreateProductRequest(properties) { + function GetDefaultBranchResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41999,101 +40278,101 @@ } /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance */ - CreateProductRequest.prototype.parent = ""; + GetDefaultBranchResponse.prototype.branch = ""; /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance */ - CreateProductRequest.prototype.product = null; + GetDefaultBranchResponse.prototype.setTime = null; /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance */ - CreateProductRequest.prototype.productId = ""; + GetDefaultBranchResponse.prototype.note = ""; /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse instance */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); }; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encode = function encode(message, writer) { + GetDefaultBranchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetDefaultBranchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decode = function decode(reader, length) { + GetDefaultBranchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.branch = reader.string(); break; case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.productId = reader.string(); + message.note = reader.string(); break; default: reader.skipType(tag & 7); @@ -42104,205 +40383,394 @@ }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProductRequest message. + * Verifies a GetDefaultBranchResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProductRequest.verify = function verify(message) { + GetDefaultBranchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); if (error) - return "product." + error; + return "setTime." + error; } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2alpha.GetDefaultBranchResponse} GetDefaultBranchResponse */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2alpha.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); } - if (object.productId != null) - message.productId = String(object.productId); + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest + * @param {google.cloud.retail.v2alpha.GetDefaultBranchResponse} message GetDefaultBranchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProductRequest.toObject = function toObject(message, options) { + GetDefaultBranchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; + object.branch = ""; + object.setTime = null; + object.note = ""; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this CreateProductRequest to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse * @instance * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateProductRequest; + return GetDefaultBranchResponse; })(); - v2alpha.GetProductRequest = (function() { - - /** - * Properties of a GetProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name - */ + v2alpha.CompletionService = (function() { /** - * Constructs a new GetProductRequest. + * Constructs a new CompletionService service. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service * @constructor - * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function GetProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.GetProductRequest - * @instance - */ - GetProductRequest.prototype.name = ""; + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates new CompletionService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompletionService * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.GetProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2alpha.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} [response] CompleteQueryResponse */ - GetProductRequest.encode = function encode(message, writer) { + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2alpha.CompleteQueryRequest, $root.google.cloud.retail.v2alpha.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2alpha.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; + })(); + + v2alpha.CompleteQueryRequest = (function() { + + /** + * Properties of a CompleteQueryRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + */ + + /** + * Constructs a new CompleteQueryRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set + */ + function CompleteQueryRequest(properties) { + this.languageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.catalog = ""; + + /** + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.query = ""; + + /** + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.visitorId = ""; + + /** + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + + /** + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.deviceType = ""; + + /** + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.dataset = ""; + + /** + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.maxSuggestions = 0; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest instance + */ + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); + }; + + /** + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + CompleteQueryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.catalog = reader.string(); + break; + case 2: + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); + break; + case 3: + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + case 4: + message.deviceType = reader.string(); + break; + case 6: + message.dataset = reader.string(); + break; + case 5: + message.maxSuggestions = reader.int32(); break; default: reader.skipType(tag & 7); @@ -42313,109 +40781,173 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a CompleteQueryRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + CompleteQueryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; return null; }; /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; return message; }; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest + * @param {google.cloud.retail.v2alpha.CompleteQueryRequest} message CompleteQueryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProductRequest.toObject = function toObject(message, options) { + CompleteQueryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (options.defaults) { + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; return object; }; /** - * Converts this GetProductRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance * @returns {Object.} JSON object */ - GetProductRequest.prototype.toJSON = function toJSON() { + CompleteQueryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProductRequest; + return CompleteQueryRequest; })(); - v2alpha.UpdateProductRequest = (function() { + v2alpha.CompleteQueryResponse = (function() { /** - * Properties of an UpdateProductRequest. + * Properties of a CompleteQueryResponse. * @memberof google.cloud.retail.v2alpha - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults */ /** - * Constructs a new UpdateProductRequest. + * Constructs a new CompleteQueryResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse * @constructor - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set */ - function UpdateProductRequest(properties) { + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42423,101 +40955,107 @@ } /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - UpdateProductRequest.prototype.product = null; + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - UpdateProductRequest.prototype.updateMask = null; + CompleteQueryResponse.prototype.attributionToken = ""; /** - * UpdateProductRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - UpdateProductRequest.prototype.allowMissing = false; + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse instance */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); }; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encode = function encode(message, writer) { + CompleteQueryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decode = function decode(reader, length) { + CompleteQueryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.attributionToken = reader.string(); break; case 3: - message.allowMissing = reader.bool(); + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -42528,467 +41066,688 @@ }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateProductRequest message. + * Verifies a CompleteQueryResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateProductRequest.verify = function verify(message) { + CompleteQueryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} message CompleteQueryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateProductRequest.toObject = function toObject(message, options) { + CompleteQueryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - object.allowMissing = false; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; return object; }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this CompleteQueryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance * @returns {Object.} JSON object */ - UpdateProductRequest.prototype.toJSON = function toJSON() { + CompleteQueryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateProductRequest; - })(); + CompleteQueryResponse.CompletionResult = (function() { - v2alpha.DeleteProductRequest = (function() { + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ - /** - * Properties of a DeleteProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name - */ + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new DeleteProductRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set - */ - function DeleteProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; - /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @instance - */ - DeleteProductRequest.prototype.name = ""; + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance - */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); - }; + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.suggestion = reader.string(); + break; + case 2: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a DeleteProductRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; - /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest - */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; - /** - * Converts this DeleteProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return DeleteProductRequest; - })(); + return CompletionResult; + })(); - v2alpha.ListProductsRequest = (function() { + CompleteQueryResponse.RecentSearchResult = (function() { - /** - * Properties of a ListProductsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - * @property {string|null} [filter] ListProductsRequest filter - * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask - * @property {boolean|null} [requireTotalSize] ListProductsRequest requireTotalSize - */ + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ - /** - * Constructs a new ListProductsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set - */ - function ListProductsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; + })(); + + v2alpha.ExportErrorsConfig = (function() { /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance + * Properties of an ExportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IExportErrorsConfig + * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix */ - ListProductsRequest.prototype.pageToken = ""; /** - * ListProductsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance + * Constructs a new ExportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportErrorsConfig. + * @implements IExportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set */ - ListProductsRequest.prototype.filter = ""; + function ExportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * ListProductsRequest readMask. - * @member {google.protobuf.IFieldMask|null|undefined} readMask - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @instance */ - ListProductsRequest.prototype.readMask = null; + ExportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ListProductsRequest requireTotalSize. - * @member {boolean} requireTotalSize - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @instance */ - ListProductsRequest.prototype.requireTotalSize = false; + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ListProductsRequest instance using the specified properties. + * Creates a new ExportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest instance + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); }; /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsRequest.encode = function encode(message, writer) { + ExportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) - $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.requireTotalSize != null && Object.hasOwnProperty.call(message, "requireTotalSize")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requireTotalSize); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer. + * Decodes an ExportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decode = function decode(reader, length) { + ExportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 6: - message.requireTotalSize = reader.bool(); + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -42999,156 +41758,112 @@ }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsRequest message. + * Verifies an ExportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsRequest.verify = function verify(message) { + ExportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.readMask != null && message.hasOwnProperty("readMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.readMask); - if (error) - return "readMask." + error; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } - if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) - if (typeof message.requireTotalSize !== "boolean") - return "requireTotalSize: boolean expected"; return null; }; /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsRequest) + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.readMask != null) { - if (typeof object.readMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ListProductsRequest.readMask: object expected"); - message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); - } - if (object.requireTotalSize != null) - message.requireTotalSize = Boolean(object.requireTotalSize); + var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.ListProductsRequest} message ListProductsRequest + * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsRequest.toObject = function toObject(message, options) { + ExportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.readMask = null; - object.requireTotalSize = false; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.readMask != null && message.hasOwnProperty("readMask")) - object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); - if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) - object.requireTotalSize = message.requireTotalSize; return object; }; /** - * Converts this ListProductsRequest to JSON. + * Converts this ExportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig * @instance * @returns {Object.} JSON object */ - ListProductsRequest.prototype.toJSON = function toJSON() { + ExportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProductsRequest; + return ExportErrorsConfig; })(); - v2alpha.ListProductsResponse = (function() { + v2alpha.ExportMetadata = (function() { /** - * Properties of a ListProductsResponse. + * Properties of an ExportMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken - * @property {number|null} [totalSize] ListProductsResponse totalSize + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime */ /** - * Constructs a new ListProductsResponse. + * Constructs a new ExportMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set */ - function ListProductsResponse(properties) { - this.products = []; + function ExportMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43156,104 +41871,88 @@ } /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.retail.v2alpha.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @instance */ - ListProductsResponse.prototype.nextPageToken = ""; + ExportMetadata.prototype.createTime = null; /** - * ListProductsResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @instance */ - ListProductsResponse.prototype.totalSize = 0; + ExportMetadata.prototype.updateTime = null; /** - * Creates a new ListProductsResponse instance using the specified properties. + * Creates a new ExportMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static - * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse instance + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); }; /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static - * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encode = function encode(message, writer) { + ExportMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static - * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer. + * Decodes an ExportMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decode = function decode(reader, length) { + ExportMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 2: - message.nextPageToken = reader.string(); - break; - case 3: - message.totalSize = reader.int32(); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -43264,145 +41963,128 @@ }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsResponse message. + * Verifies an ExportMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsResponse.verify = function verify(message) { + ExportMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); - if (error) - return "products." + error; - } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; return null; }; /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsResponse) + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); - } + var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; return message; }; /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @static - * @param {google.cloud.retail.v2alpha.ListProductsResponse} message ListProductsResponse + * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsResponse.toObject = function toObject(message, options) { + ExportMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.products = []; if (options.defaults) { - object.nextPageToken = ""; - object.totalSize = 0; - } - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); + object.createTime = null; + object.updateTime = null; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this ListProductsResponse to JSON. + * Converts this ExportMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.ExportMetadata * @instance * @returns {Object.} JSON object */ - ListProductsResponse.prototype.toJSON = function toJSON() { + ExportMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProductsResponse; + return ExportMetadata; })(); - v2alpha.SetInventoryRequest = (function() { + v2alpha.ExportProductsResponse = (function() { /** - * Properties of a SetInventoryRequest. + * Properties of an ExportProductsResponse. * @memberof google.cloud.retail.v2alpha - * @interface ISetInventoryRequest - * @property {google.cloud.retail.v2alpha.IProduct|null} [inventory] SetInventoryRequest inventory - * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask - * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime - * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + * @interface IExportProductsResponse + * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig */ /** - * Constructs a new SetInventoryRequest. + * Constructs a new ExportProductsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetInventoryRequest. - * @implements ISetInventoryRequest + * @classdesc Represents an ExportProductsResponse. + * @implements IExportProductsResponse * @constructor - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set */ - function SetInventoryRequest(properties) { + function ExportProductsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43410,114 +42092,91 @@ } /** - * SetInventoryRequest inventory. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} inventory - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest - * @instance - */ - SetInventoryRequest.prototype.inventory = null; - - /** - * SetInventoryRequest setMask. - * @member {google.protobuf.IFieldMask|null|undefined} setMask - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest - * @instance - */ - SetInventoryRequest.prototype.setMask = null; - - /** - * SetInventoryRequest setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * ExportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @instance */ - SetInventoryRequest.prototype.setTime = null; + ExportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * SetInventoryRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * ExportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @instance */ - SetInventoryRequest.prototype.allowMissing = false; + ExportProductsResponse.prototype.errorsConfig = null; /** - * Creates a new SetInventoryRequest instance using the specified properties. + * Creates a new ExportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest instance + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance */ - SetInventoryRequest.create = function create(properties) { - return new SetInventoryRequest(properties); + ExportProductsResponse.create = function create(properties) { + return new ExportProductsResponse(properties); }; /** - * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encode = function encode(message, writer) { + ExportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) - $root.google.cloud.retail.v2alpha.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) - $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer. + * Decodes an ExportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decode = function decode(reader, length) { + ExportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.allowMissing = reader.bool(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -43528,146 +42187,140 @@ }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryRequest message. + * Verifies an ExportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryRequest.verify = function verify(message) { + ExportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inventory != null && message.hasOwnProperty("inventory")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.inventory); - if (error) - return "inventory." + error; - } - if (message.setMask != null && message.hasOwnProperty("setMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.setMask); - if (error) - return "setMask." + error; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } } - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); if (error) - return "setTime." + error; + return "errorsConfig." + error; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse */ - SetInventoryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryRequest) + ExportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); - if (object.inventory != null) { - if (typeof object.inventory !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.inventory: object expected"); - message.inventory = $root.google.cloud.retail.v2alpha.Product.fromObject(object.inventory); - } - if (object.setMask != null) { - if (typeof object.setMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setMask: object expected"); - message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } } - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.SetInventoryRequest} message SetInventoryRequest + * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryRequest.toObject = function toObject(message, options) { + ExportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.inventory = null; - object.setMask = null; - object.setTime = null; - object.allowMissing = false; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.inventory != null && message.hasOwnProperty("inventory")) - object.inventory = $root.google.cloud.retail.v2alpha.Product.toObject(message.inventory, options); - if (message.setMask != null && message.hasOwnProperty("setMask")) - object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this SetInventoryRequest to JSON. + * Converts this ExportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse * @instance * @returns {Object.} JSON object */ - SetInventoryRequest.prototype.toJSON = function toJSON() { + ExportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryRequest; + return ExportProductsResponse; })(); - v2alpha.SetInventoryMetadata = (function() { + v2alpha.ExportUserEventsResponse = (function() { /** - * Properties of a SetInventoryMetadata. + * Properties of an ExportUserEventsResponse. * @memberof google.cloud.retail.v2alpha - * @interface ISetInventoryMetadata + * @interface IExportUserEventsResponse + * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig */ /** - * Constructs a new SetInventoryMetadata. + * Constructs a new ExportUserEventsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetInventoryMetadata. - * @implements ISetInventoryMetadata + * @classdesc Represents an ExportUserEventsResponse. + * @implements IExportUserEventsResponse * @constructor - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set */ - function SetInventoryMetadata(properties) { + function ExportUserEventsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43675,63 +42328,92 @@ } /** - * Creates a new SetInventoryMetadata instance using the specified properties. + * ExportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata instance + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance */ - SetInventoryMetadata.create = function create(properties) { - return new SetInventoryMetadata(properties); + ExportUserEventsResponse.create = function create(properties) { + return new ExportUserEventsResponse(properties); }; /** - * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encode = function encode(message, writer) { + ExportUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decode = function decode(reader, length) { + ExportUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -43741,259 +42423,215 @@ }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryMetadata message. + * Verifies an ExportUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryMetadata.verify = function verify(message) { + ExportUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } return null; }; /** - * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse */ - SetInventoryMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryMetadata) + ExportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) return object; - return new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); + var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + } + return message; }; /** - * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.SetInventoryMetadata} message SetInventoryMetadata + * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryMetadata.toObject = function toObject() { - return {}; - }; - - /** - * Converts this SetInventoryMetadata to JSON. + ExportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ExportUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse * @instance * @returns {Object.} JSON object */ - SetInventoryMetadata.prototype.toJSON = function toJSON() { + ExportUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryMetadata; + return ExportUserEventsResponse; })(); - v2alpha.SetInventoryResponse = (function() { - - /** - * Properties of a SetInventoryResponse. - * @memberof google.cloud.retail.v2alpha - * @interface ISetInventoryResponse - */ + v2alpha.PredictionService = (function() { /** - * Constructs a new SetInventoryResponse. + * Constructs a new PredictionService service. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetInventoryResponse. - * @implements ISetInventoryResponse + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service * @constructor - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function SetInventoryResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - /** - * Creates a new SetInventoryResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse instance - */ - SetInventoryResponse.create = function create(properties) { - return new SetInventoryResponse(properties); - }; - - /** - * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SetInventoryResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SetInventoryResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SetInventoryResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; /** - * Verifies a SetInventoryResponse message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictionService * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. */ - SetInventoryResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @memberof google.cloud.retail.v2alpha.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse */ - SetInventoryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryResponse) - return object; - return new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); - }; /** - * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse - * @static - * @param {google.cloud.retail.v2alpha.SetInventoryResponse} message SetInventoryResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService + * @instance + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 */ - SetInventoryResponse.toObject = function toObject() { - return {}; - }; + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); + }, "name", { value: "Predict" }); /** - * Converts this SetInventoryResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - SetInventoryResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - return SetInventoryResponse; + return PredictionService; })(); - v2alpha.AddFulfillmentPlacesRequest = (function() { + v2alpha.PredictRequest = (function() { /** - * Properties of an AddFulfillmentPlacesRequest. + * Properties of a PredictRequest. * @memberof google.cloud.retail.v2alpha - * @interface IAddFulfillmentPlacesRequest - * @property {string|null} [product] AddFulfillmentPlacesRequest product - * @property {string|null} [type] AddFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime - * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels */ /** - * Constructs a new AddFulfillmentPlacesRequest. + * Constructs a new PredictRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddFulfillmentPlacesRequest. - * @implements IAddFulfillmentPlacesRequest + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest * @constructor - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set */ - function AddFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44001,130 +42639,208 @@ } /** - * AddFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.product = ""; + PredictRequest.prototype.placement = ""; /** - * AddFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * PredictRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.type = ""; + PredictRequest.prototype.userEvent = null; /** - * AddFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + PredictRequest.prototype.pageSize = 0; /** - * AddFulfillmentPlacesRequest addTime. - * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.addTime = null; + PredictRequest.prototype.pageToken = ""; /** - * AddFulfillmentPlacesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.allowMissing = false; + PredictRequest.prototype.filter = ""; /** - * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance */ - AddFulfillmentPlacesRequest.create = function create(properties) { - return new AddFulfillmentPlacesRequest(properties); + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); }; /** - * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + PredictRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + PredictRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = reader.string(); + message.placement = reader.string(); break; case 2: - message.type = reader.string(); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); break; case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + message.pageSize = reader.int32(); break; case 4: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.pageToken = reader.string(); break; case 5: - message.allowMissing = reader.bool(); + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; break; default: reader.skipType(tag & 7); @@ -44135,157 +42851,208 @@ }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + PredictRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesRequest message. + * Verifies a PredictRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesRequest.verify = function verify(message) { + PredictRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); if (error) - return "addTime." + error; + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest */ - AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest) + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); + var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); } - if (object.addTime != null) { - if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.addTime: object expected"); - message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @static - * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + PredictRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } if (options.defaults) { - object.product = ""; - object.type = ""; - object.addTime = null; - object.allowMissing = false; + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; } - if (message.addTime != null && message.hasOwnProperty("addTime")) - object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; return object; }; /** - * Converts this AddFulfillmentPlacesRequest to JSON. + * Converts this PredictRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.PredictRequest * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + PredictRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesRequest; + return PredictRequest; })(); - v2alpha.AddFulfillmentPlacesMetadata = (function() { + v2alpha.PredictResponse = (function() { /** - * Properties of an AddFulfillmentPlacesMetadata. + * Properties of a PredictResponse. * @memberof google.cloud.retail.v2alpha - * @interface IAddFulfillmentPlacesMetadata + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly */ /** - * Constructs a new AddFulfillmentPlacesMetadata. + * Constructs a new PredictResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddFulfillmentPlacesMetadata. - * @implements IAddFulfillmentPlacesMetadata + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse * @constructor - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set */ - function AddFulfillmentPlacesMetadata(properties) { + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44293,223 +43060,121 @@ } /** - * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance - */ - AddFulfillmentPlacesMetadata.create = function create(properties) { - return new AddFulfillmentPlacesMetadata(properties); - }; - - /** - * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AddFulfillmentPlacesMetadata message. - * @function verify - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AddFulfillmentPlacesMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata - */ - AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata) - return object; - return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); - }; - - /** - * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata - * @static - * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance */ - AddFulfillmentPlacesMetadata.toObject = function toObject() { - return {}; - }; + PredictResponse.prototype.results = $util.emptyArray; /** - * Converts this AddFulfillmentPlacesMetadata to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.PredictResponse * @instance - * @returns {Object.} JSON object */ - AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AddFulfillmentPlacesMetadata; - })(); - - v2alpha.AddFulfillmentPlacesResponse = (function() { + PredictResponse.prototype.attributionToken = ""; /** - * Properties of an AddFulfillmentPlacesResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IAddFulfillmentPlacesResponse + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance */ + PredictResponse.prototype.missingIds = $util.emptyArray; /** - * Constructs a new AddFulfillmentPlacesResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddFulfillmentPlacesResponse. - * @implements IAddFulfillmentPlacesResponse - * @constructor - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance */ - function AddFulfillmentPlacesResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + PredictResponse.prototype.validateOnly = false; /** - * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * Creates a new PredictResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance */ - AddFulfillmentPlacesResponse.create = function create(properties) { - return new AddFulfillmentPlacesResponse(properties); + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); }; /** - * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + PredictResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + PredictResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -44519,401 +43184,815 @@ }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + PredictResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesResponse message. + * Verifies a PredictResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesResponse.verify = function verify(message) { + PredictResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; return null; }; /** - * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse */ - AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse) + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) return object; - return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; }; /** - * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @static - * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesResponse.toObject = function toObject() { - return {}; + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; }; /** - * Converts this AddFulfillmentPlacesResponse to JSON. + * Converts this PredictResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.PredictResponse * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + PredictResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesResponse; - })(); + PredictResponse.PredictionResult = (function() { - v2alpha.AddLocalInventoriesRequest = (function() { + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ - /** - * Properties of an AddLocalInventoriesRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IAddLocalInventoriesRequest - * @property {string|null} [product] AddLocalInventoriesRequest product - * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories - * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask - * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime - * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing - */ + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new AddLocalInventoriesRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddLocalInventoriesRequest. - * @implements IAddLocalInventoriesRequest + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2alpha.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service * @constructor - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function AddLocalInventoriesRequest(properties) { - this.localInventories = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + /** - * AddLocalInventoriesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @instance + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. */ - AddLocalInventoriesRequest.prototype.product = ""; + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * AddLocalInventoriesRequest localInventories. - * @member {Array.} localInventories - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "CreateProduct" }); /** - * AddLocalInventoriesRequest addMask. - * @member {google.protobuf.IFieldMask|null|undefined} addMask - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddLocalInventoriesRequest.prototype.addMask = null; /** - * AddLocalInventoriesRequest addTime. - * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - AddLocalInventoriesRequest.prototype.addTime = null; + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "GetProduct" }); /** - * AddLocalInventoriesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddLocalInventoriesRequest.prototype.allowMissing = false; /** - * Creates a new AddLocalInventoriesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListProductsResponse} [response] ListProductsResponse */ - AddLocalInventoriesRequest.create = function create(properties) { - return new AddLocalInventoriesRequest(properties); - }; /** - * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 */ - AddLocalInventoriesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.localInventories != null && message.localInventories.length) - for (var i = 0; i < message.localInventories.length; ++i) - $root.google.cloud.retail.v2alpha.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) - $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); - return writer; - }; + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2alpha.ListProductsRequest, $root.google.cloud.retail.v2alpha.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); /** - * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product */ - AddLocalInventoriesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.localInventories && message.localInventories.length)) - message.localInventories = []; - message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); - break; - case 4: - message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.allowMissing = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 */ - AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "UpdateProduct" }); /** - * Verifies an AddLocalInventoriesRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddLocalInventoriesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.localInventories != null && message.hasOwnProperty("localInventories")) { - if (!Array.isArray(message.localInventories)) - return "localInventories: array expected"; - for (var i = 0; i < message.localInventories.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.LocalInventory.verify(message.localInventories[i]); - if (error) - return "localInventories." + error; - } - } - if (message.addMask != null && message.hasOwnProperty("addMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.addMask); - if (error) - return "addMask." + error; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.addTime); - if (error) - return "addTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; - return null; - }; /** - * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty */ - AddLocalInventoriesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.localInventories) { - if (!Array.isArray(object.localInventories)) - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: array expected"); - message.localInventories = []; - for (var i = 0; i < object.localInventories.length; ++i) { - if (typeof object.localInventories[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: object expected"); - message.localInventories[i] = $root.google.cloud.retail.v2alpha.LocalInventory.fromObject(object.localInventories[i]); - } - } - if (object.addMask != null) { - if (typeof object.addMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addMask: object expected"); - message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); - } - if (object.addTime != null) { - if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addTime: object expected"); - message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - return message; - }; /** - * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @static - * @param {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} message AddLocalInventoriesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 */ - AddLocalInventoriesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.localInventories = []; - if (options.defaults) { - object.product = ""; - object.addMask = null; - object.addTime = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.localInventories && message.localInventories.length) { - object.localInventories = []; - for (var j = 0; j < message.localInventories.length; ++j) - object.localInventories[j] = $root.google.cloud.retail.v2alpha.LocalInventory.toObject(message.localInventories[j], options); - } - if (message.addMask != null && message.hasOwnProperty("addMask")) - object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); - if (message.addTime != null && message.hasOwnProperty("addTime")) - object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - return object; - }; + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); /** - * Converts this AddLocalInventoriesRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - return AddLocalInventoriesRequest; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2alpha.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; })(); - v2alpha.AddLocalInventoriesMetadata = (function() { + v2alpha.CreateProductRequest = (function() { /** - * Properties of an AddLocalInventoriesMetadata. + * Properties of a CreateProductRequest. * @memberof google.cloud.retail.v2alpha - * @interface IAddLocalInventoriesMetadata + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId */ /** - * Constructs a new AddLocalInventoriesMetadata. + * Constructs a new CreateProductRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddLocalInventoriesMetadata. - * @implements IAddLocalInventoriesMetadata + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set */ - function AddLocalInventoriesMetadata(properties) { + function CreateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44921,63 +44000,102 @@ } /** - * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance */ - AddLocalInventoriesMetadata.create = function create(properties) { - return new AddLocalInventoriesMetadata(properties); + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); }; /** - * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesMetadata.encode = function encode(message, writer) { + CreateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); return writer; }; /** - * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesMetadata.decode = function decode(reader, length) { + CreateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -44987,93 +44105,129 @@ }; /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesMetadata message. + * Verifies a CreateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesMetadata.verify = function verify(message) { + CreateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; return null; }; /** - * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest */ - AddLocalInventoriesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata) + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) return object; - return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; }; /** - * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @static - * @param {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesMetadata.toObject = function toObject() { - return {}; + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; }; /** - * Converts this AddLocalInventoriesMetadata to JSON. + * Converts this CreateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.CreateProductRequest * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + CreateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddLocalInventoriesMetadata; + return CreateProductRequest; })(); - v2alpha.AddLocalInventoriesResponse = (function() { + v2alpha.GetProductRequest = (function() { /** - * Properties of an AddLocalInventoriesResponse. + * Properties of a GetProductRequest. * @memberof google.cloud.retail.v2alpha - * @interface IAddLocalInventoriesResponse + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name */ /** - * Constructs a new AddLocalInventoriesResponse. + * Constructs a new GetProductRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddLocalInventoriesResponse. - * @implements IAddLocalInventoriesResponse + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set */ - function AddLocalInventoriesResponse(properties) { + function GetProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45081,63 +44235,76 @@ } /** - * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance */ - AddLocalInventoriesResponse.create = function create(properties) { - return new AddLocalInventoriesResponse(properties); + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); }; /** - * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesResponse.encode = function encode(message, writer) { + GetProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * Decodes a GetProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesResponse.decode = function decode(reader, length) { + GetProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -45147,98 +44314,109 @@ }; /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesResponse message. + * Verifies a GetProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesResponse.verify = function verify(message) { + GetProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest */ - AddLocalInventoriesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse) + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) return object; - return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; }; /** - * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @static - * @param {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} message AddLocalInventoriesResponse + * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesResponse.toObject = function toObject() { - return {}; + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; }; /** - * Converts this AddLocalInventoriesResponse to JSON. + * Converts this GetProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.GetProductRequest * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + GetProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddLocalInventoriesResponse; + return GetProductRequest; })(); - v2alpha.RemoveLocalInventoriesRequest = (function() { + v2alpha.UpdateProductRequest = (function() { /** - * Properties of a RemoveLocalInventoriesRequest. + * Properties of an UpdateProductRequest. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveLocalInventoriesRequest - * @property {string|null} [product] RemoveLocalInventoriesRequest product - * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing */ /** - * Constructs a new RemoveLocalInventoriesRequest. + * Constructs a new UpdateProductRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveLocalInventoriesRequest. - * @implements IRemoveLocalInventoriesRequest + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set */ - function RemoveLocalInventoriesRequest(properties) { - this.placeIds = []; + function UpdateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45246,114 +44424,98 @@ } /** - * RemoveLocalInventoriesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest - * @instance - */ - RemoveLocalInventoriesRequest.prototype.product = ""; - - /** - * RemoveLocalInventoriesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * UpdateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance */ - RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; + UpdateProductRequest.prototype.product = null; /** - * RemoveLocalInventoriesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance */ - RemoveLocalInventoriesRequest.prototype.removeTime = null; + UpdateProductRequest.prototype.updateMask = null; /** - * RemoveLocalInventoriesRequest allowMissing. + * UpdateProductRequest allowMissing. * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance */ - RemoveLocalInventoriesRequest.prototype.allowMissing = false; + UpdateProductRequest.prototype.allowMissing = false; /** - * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * Creates a new UpdateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance */ - RemoveLocalInventoriesRequest.create = function create(properties) { - return new RemoveLocalInventoriesRequest(properties); + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + UpdateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * Decodes an UpdateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + UpdateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = reader.string(); + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); break; case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 5: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; case 3: message.allowMissing = reader.bool(); @@ -45367,46 +44529,41 @@ }; /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesRequest message. + * Verifies an UpdateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesRequest.verify = function verify(message) { + UpdateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); if (error) - return "removeTime." + error; + return "updateMask." + error; } if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) if (typeof message.allowMissing !== "boolean") @@ -45415,30 +44572,26 @@ }; /** - * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest */ - RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest) + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); + var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } if (object.allowMissing != null) message.allowMissing = Boolean(object.allowMissing); @@ -45446,70 +44599,64 @@ }; /** - * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + UpdateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; if (options.defaults) { - object.product = ""; + object.product = null; + object.updateMask = null; object.allowMissing = false; - object.removeTime = null; } if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; - } + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) object.allowMissing = message.allowMissing; - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); return object; }; /** - * Converts this RemoveLocalInventoriesRequest to JSON. + * Converts this UpdateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + UpdateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveLocalInventoriesRequest; + return UpdateProductRequest; })(); - v2alpha.RemoveLocalInventoriesMetadata = (function() { + v2alpha.DeleteProductRequest = (function() { /** - * Properties of a RemoveLocalInventoriesMetadata. + * Properties of a DeleteProductRequest. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveLocalInventoriesMetadata + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name */ /** - * Constructs a new RemoveLocalInventoriesMetadata. + * Constructs a new DeleteProductRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveLocalInventoriesMetadata. - * @implements IRemoveLocalInventoriesMetadata + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set */ - function RemoveLocalInventoriesMetadata(properties) { + function DeleteProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45517,63 +44664,76 @@ } /** - * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @instance + */ + DeleteProductRequest.prototype.name = ""; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance */ - RemoveLocalInventoriesMetadata.create = function create(properties) { - return new RemoveLocalInventoriesMetadata(properties); + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + DeleteProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + DeleteProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -45583,93 +44743,112 @@ }; /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesMetadata message. + * Verifies a DeleteProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesMetadata.verify = function verify(message) { + DeleteProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest */ - RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata) + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) return object; - return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; }; /** - * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesMetadata.toObject = function toObject() { - return {}; + DeleteProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; }; /** - * Converts this RemoveLocalInventoriesMetadata to JSON. + * Converts this DeleteProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + DeleteProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveLocalInventoriesMetadata; + return DeleteProductRequest; })(); - v2alpha.RemoveLocalInventoriesResponse = (function() { + v2alpha.ListProductsRequest = (function() { /** - * Properties of a RemoveLocalInventoriesResponse. + * Properties of a ListProductsRequest. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveLocalInventoriesResponse + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + * @property {boolean|null} [requireTotalSize] ListProductsRequest requireTotalSize */ /** - * Constructs a new RemoveLocalInventoriesResponse. + * Constructs a new ListProductsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveLocalInventoriesResponse. - * @implements IRemoveLocalInventoriesResponse + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set */ - function RemoveLocalInventoriesResponse(properties) { + function ListProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45677,63 +44856,141 @@ } /** - * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * ListProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.parent = ""; + + /** + * ListProductsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageSize = 0; + + /** + * ListProductsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageToken = ""; + + /** + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.filter = ""; + + /** + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * ListProductsRequest requireTotalSize. + * @member {boolean} requireTotalSize + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.requireTotalSize = false; + + /** + * Creates a new ListProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest instance */ - RemoveLocalInventoriesResponse.create = function create(properties) { - return new RemoveLocalInventoriesResponse(properties); + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + ListProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - return writer; + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.requireTotalSize != null && Object.hasOwnProperty.call(message, "requireTotalSize")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requireTotalSize); + return writer; }; /** - * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * Decodes a ListProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + ListProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 6: + message.requireTotalSize = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -45743,99 +45000,156 @@ }; /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesResponse message. + * Verifies a ListProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesResponse.verify = function verify(message) { + ListProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (error) + return "readMask." + error; + } + if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) + if (typeof message.requireTotalSize !== "boolean") + return "requireTotalSize: boolean expected"; return null; }; /** - * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest */ - RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse) + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsRequest) return object; - return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + var message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + } + if (object.requireTotalSize != null) + message.requireTotalSize = Boolean(object.requireTotalSize); + return message; }; /** - * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {google.cloud.retail.v2alpha.ListProductsRequest} message ListProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesResponse.toObject = function toObject() { - return {}; + ListProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.readMask = null; + object.requireTotalSize = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); + if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) + object.requireTotalSize = message.requireTotalSize; + return object; }; /** - * Converts this RemoveLocalInventoriesResponse to JSON. + * Converts this ListProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + ListProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveLocalInventoriesResponse; + return ListProductsRequest; })(); - v2alpha.RemoveFulfillmentPlacesRequest = (function() { + v2alpha.ListProductsResponse = (function() { /** - * Properties of a RemoveFulfillmentPlacesRequest. + * Properties of a ListProductsResponse. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveFulfillmentPlacesRequest - * @property {string|null} [product] RemoveFulfillmentPlacesRequest product - * @property {string|null} [type] RemoveFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + * @property {number|null} [totalSize] ListProductsResponse totalSize */ /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new ListProductsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveFulfillmentPlacesRequest. - * @implements IRemoveFulfillmentPlacesRequest + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set */ - function RemoveFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function ListProductsResponse(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45843,130 +45157,104 @@ } /** - * RemoveFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.product = ""; - - /** - * RemoveFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.type = ""; - - /** - * RemoveFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @instance */ - RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + ListProductsResponse.prototype.products = $util.emptyArray; /** - * RemoveFulfillmentPlacesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * ListProductsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @instance */ - RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + ListProductsResponse.prototype.nextPageToken = ""; /** - * RemoveFulfillmentPlacesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * ListProductsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @instance */ - RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + ListProductsResponse.prototype.totalSize = 0; /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new ListProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse instance */ - RemoveFulfillmentPlacesRequest.create = function create(properties) { - return new RemoveFulfillmentPlacesRequest(properties); + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + ListProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a ListProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + ListProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = reader.string(); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); break; case 2: - message.type = reader.string(); + message.nextPageToken = reader.string(); break; case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); + message.totalSize = reader.int32(); break; default: reader.skipType(tag & 7); @@ -45977,157 +45265,145 @@ }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies a ListProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesRequest.verify = function verify(message) { + ListProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); - if (error) - return "removeTime." + error; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse */ - RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest) + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + var message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; return message; }; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {google.cloud.retail.v2alpha.ListProductsResponse} message ListProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + ListProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.placeIds = []; + object.products = []; if (options.defaults) { - object.product = ""; - object.type = ""; - object.removeTime = null; - object.allowMissing = false; + object.nextPageToken = ""; + object.totalSize = 0; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; return object; }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this ListProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + ListProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesRequest; + return ListProductsResponse; })(); - v2alpha.RemoveFulfillmentPlacesMetadata = (function() { + v2alpha.SetInventoryRequest = (function() { /** - * Properties of a RemoveFulfillmentPlacesMetadata. + * Properties of a SetInventoryRequest. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveFulfillmentPlacesMetadata + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing */ /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new SetInventoryRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveFulfillmentPlacesMetadata. - * @implements IRemoveFulfillmentPlacesMetadata + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set */ - function RemoveFulfillmentPlacesMetadata(properties) { + function SetInventoryRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46135,63 +45411,115 @@ } /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.inventory = null; + + /** + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setMask = null; + + /** + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest instance */ - RemoveFulfillmentPlacesMetadata.create = function create(properties) { - return new RemoveFulfillmentPlacesMetadata(properties); + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + SetInventoryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2alpha.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + SetInventoryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 2: + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -46201,93 +45529,146 @@ }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesMetadata message. + * Verifies a SetInventoryRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + SetInventoryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.inventory); + if (error) + return "inventory." + error; + } + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); + if (error) + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest */ - RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata) + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryRequest) return object; - return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + var message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2alpha.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2alpha.SetInventoryRequest} message SetInventoryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesMetadata.toObject = function toObject() { - return {}; + SetInventoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2alpha.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; }; /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * Converts this SetInventoryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + SetInventoryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesMetadata; + return SetInventoryRequest; })(); - v2alpha.RemoveFulfillmentPlacesResponse = (function() { + v2alpha.SetInventoryMetadata = (function() { /** - * Properties of a RemoveFulfillmentPlacesResponse. + * Properties of a SetInventoryMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveFulfillmentPlacesResponse + * @interface ISetInventoryMetadata */ /** - * Constructs a new RemoveFulfillmentPlacesResponse. + * Constructs a new SetInventoryMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveFulfillmentPlacesResponse. - * @implements IRemoveFulfillmentPlacesResponse + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set */ - function RemoveFulfillmentPlacesResponse(properties) { + function SetInventoryMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46295,60 +45676,60 @@ } /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata instance */ - RemoveFulfillmentPlacesResponse.create = function create(properties) { - return new RemoveFulfillmentPlacesResponse(properties); + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + SetInventoryMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + SetInventoryMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -46361,93 +45742,93 @@ }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesResponse message. + * Verifies a SetInventoryMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesResponse.verify = function verify(message) { + SetInventoryMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata */ - RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse) + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryMetadata) return object; - return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + return new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {google.cloud.retail.v2alpha.SetInventoryMetadata} message SetInventoryMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesResponse.toObject = function toObject() { + SetInventoryMetadata.toObject = function toObject() { return {}; }; /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. + * Converts this SetInventoryMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + SetInventoryMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesResponse; + return SetInventoryMetadata; })(); - v2alpha.PurgeMetadata = (function() { + v2alpha.SetInventoryResponse = (function() { /** - * Properties of a PurgeMetadata. + * Properties of a SetInventoryResponse. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeMetadata + * @interface ISetInventoryResponse */ /** - * Constructs a new PurgeMetadata. + * Constructs a new SetInventoryResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function SetInventoryResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46455,60 +45836,60 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse instance */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); }; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encode = function encode(message, writer) { + SetInventoryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decode = function decode(reader, length) { + SetInventoryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -46521,96 +45902,99 @@ }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeMetadata message. + * Verifies a SetInventoryResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeMetadata.verify = function verify(message) { + SetInventoryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryResponse) return object; - return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + return new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); }; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata + * @param {google.cloud.retail.v2alpha.SetInventoryResponse} message SetInventoryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeMetadata.toObject = function toObject() { + SetInventoryResponse.toObject = function toObject() { return {}; }; /** - * Converts this PurgeMetadata to JSON. + * Converts this SetInventoryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @instance * @returns {Object.} JSON object */ - PurgeMetadata.prototype.toJSON = function toJSON() { + SetInventoryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeMetadata; + return SetInventoryResponse; })(); - v2alpha.PurgeUserEventsRequest = (function() { + v2alpha.AddFulfillmentPlacesRequest = (function() { /** - * Properties of a PurgeUserEventsRequest. + * Properties of an AddFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new AddFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set */ - function PurgeUserEventsRequest(properties) { + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46618,101 +46002,130 @@ } /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @instance */ - PurgeUserEventsRequest.prototype.parent = ""; + AddFulfillmentPlacesRequest.prototype.product = ""; /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @instance */ - PurgeUserEventsRequest.prototype.filter = ""; + AddFulfillmentPlacesRequest.prototype.type = ""; /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @instance */ - PurgeUserEventsRequest.prototype.force = false; + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.addTime = null; + + /** + * AddFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.product = reader.string(); break; case 2: - message.filter = reader.string(); + message.type = reader.string(); break; case 3: - message.force = reader.bool(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -46723,124 +46136,157 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies an AddFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + AddFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); - return message; - }; - - /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + var message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; + object.product = ""; + object.type = ""; + object.addTime = null; + object.allowMissing = false; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + return AddFulfillmentPlacesRequest; })(); - v2alpha.PurgeUserEventsResponse = (function() { + v2alpha.AddFulfillmentPlacesMetadata = (function() { /** - * Properties of a PurgeUserEventsResponse. + * Properties of an AddFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * @interface IAddFulfillmentPlacesMetadata */ /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new AddFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function AddFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46848,76 +46294,63 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse - * @instance - */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encode = function encode(message, writer) { + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); return writer; }; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; default: reader.skipType(tag & 7); break; @@ -46927,529 +46360,390 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies an AddFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsResponse.verify = function verify(message) { + AddFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; return null; }; /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); - return message; + return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; - return object; + AddFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsResponse; + return AddFulfillmentPlacesMetadata; })(); - v2alpha.SearchService = (function() { + v2alpha.AddFulfillmentPlacesResponse = (function() { /** - * Constructs a new SearchService service. + * Properties of an AddFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SearchService - * @extends $protobuf.rpc.Service + * @interface IAddFulfillmentPlacesResponse + */ + + /** + * Constructs a new AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set */ - function SearchService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function AddFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; - /** - * Creates new SearchService service using the specified rpc implementation. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SearchService + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance */ - SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. - * @memberof google.cloud.retail.v2alpha.SearchService - * @typedef SearchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.SearchResponse} [response] SearchResponse + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2alpha.SearchService - * @instance - * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object - * @param {google.cloud.retail.v2alpha.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(SearchService.prototype.search = function search(request, callback) { - return this.rpcCall(search, $root.google.cloud.retail.v2alpha.SearchRequest, $root.google.cloud.retail.v2alpha.SearchResponse, request, callback); - }, "name", { value: "Search" }); + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2alpha.SearchService - * @instance - * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - - return SearchService; - })(); - - v2alpha.SearchRequest = (function() { + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Properties of a SearchRequest. - * @memberof google.cloud.retail.v2alpha - * @interface ISearchRequest - * @property {string|null} [placement] SearchRequest placement - * @property {string|null} [branch] SearchRequest branch - * @property {string|null} [query] SearchRequest query - * @property {string|null} [visitorId] SearchRequest visitorId - * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] SearchRequest userInfo - * @property {number|null} [pageSize] SearchRequest pageSize - * @property {string|null} [pageToken] SearchRequest pageToken - * @property {number|null} [offset] SearchRequest offset - * @property {string|null} [filter] SearchRequest filter - * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter - * @property {string|null} [orderBy] SearchRequest orderBy - * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs - * @property {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null} [relevanceThreshold] SearchRequest relevanceThreshold - * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys - * @property {Array.|null} [pageCategories] SearchRequest pageCategories - * @property {google.cloud.retail.v2alpha.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Constructs a new SearchRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SearchRequest. - * @implements ISearchRequest - * @constructor - * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set + * Verifies an AddFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - function SearchRequest(properties) { - this.facetSpecs = []; - this.variantRollupKeys = []; - this.pageCategories = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + AddFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; /** - * SearchRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse */ - SearchRequest.prototype.placement = ""; + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + }; /** - * SearchRequest branch. - * @member {string} branch - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchRequest.prototype.branch = ""; + AddFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; /** - * SearchRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2alpha.SearchRequest + * Converts this AddFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @instance + * @returns {Object.} JSON object */ - SearchRequest.prototype.query = ""; + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * SearchRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.visitorId = ""; + return AddFulfillmentPlacesResponse; + })(); - /** - * SearchRequest userInfo. - * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.userInfo = null; + v2alpha.AddLocalInventoriesRequest = (function() { /** - * SearchRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Properties of an AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing */ - SearchRequest.prototype.pageSize = 0; /** - * SearchRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Constructs a new AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set */ - SearchRequest.prototype.pageToken = ""; + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * SearchRequest offset. - * @member {number} offset - * @memberof google.cloud.retail.v2alpha.SearchRequest + * AddLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance */ - SearchRequest.prototype.offset = 0; + AddLocalInventoriesRequest.prototype.product = ""; /** - * SearchRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.SearchRequest + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance */ - SearchRequest.prototype.filter = ""; + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; /** - * SearchRequest canonicalFilter. - * @member {string} canonicalFilter - * @memberof google.cloud.retail.v2alpha.SearchRequest + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance */ - SearchRequest.prototype.canonicalFilter = ""; + AddLocalInventoriesRequest.prototype.addMask = null; /** - * SearchRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2alpha.SearchRequest + * AddLocalInventoriesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance */ - SearchRequest.prototype.orderBy = ""; + AddLocalInventoriesRequest.prototype.addTime = null; /** - * SearchRequest facetSpecs. - * @member {Array.} facetSpecs - * @memberof google.cloud.retail.v2alpha.SearchRequest + * AddLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance */ - SearchRequest.prototype.facetSpecs = $util.emptyArray; + AddLocalInventoriesRequest.prototype.allowMissing = false; /** - * SearchRequest dynamicFacetSpec. - * @member {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.dynamicFacetSpec = null; - - /** - * SearchRequest boostSpec. - * @member {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null|undefined} boostSpec - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.boostSpec = null; - - /** - * SearchRequest queryExpansionSpec. - * @member {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.queryExpansionSpec = null; - - /** - * SearchRequest relevanceThreshold. - * @member {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} relevanceThreshold - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.relevanceThreshold = 0; - - /** - * SearchRequest variantRollupKeys. - * @member {Array.} variantRollupKeys - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.variantRollupKeys = $util.emptyArray; - - /** - * SearchRequest pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.pageCategories = $util.emptyArray; - - /** - * SearchRequest searchMode. - * @member {google.cloud.retail.v2alpha.SearchRequest.SearchMode} searchMode - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.searchMode = 0; - - /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new AddLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance */ - SearchRequest.create = function create(properties) { - return new SearchRequest(properties); + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); }; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encode = function encode(message, writer) { + AddLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); - if (message.facetSpecs != null && message.facetSpecs.length) - for (var i = 0; i < message.facetSpecs.length; ++i) - $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) - $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) - $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.relevanceThreshold != null && Object.hasOwnProperty.call(message, "relevanceThreshold")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.relevanceThreshold); - if (message.variantRollupKeys != null && message.variantRollupKeys.length) - for (var i = 0; i < message.variantRollupKeys.length; ++i) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); - if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) - $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); - if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); - if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2alpha.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); return writer; }; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decode = function decode(reader, length) { + AddLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); + message.product = reader.string(); break; case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); break; case 4: - message.visitorId = reader.string(); + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; case 5: - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: - message.filter = reader.string(); - break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 15: - message.relevanceThreshold = reader.int32(); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; - case 31: - message.searchMode = reader.int32(); + case 6: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -47460,1958 +46754,1089 @@ }; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchRequest message. + * Verifies an AddLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.verify = function verify(message) { + AddLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - if (!$util.isString(message.canonicalFilter)) - return "canonicalFilter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { - if (!Array.isArray(message.facetSpecs)) - return "facetSpecs: array expected"; - for (var i = 0; i < message.facetSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.LocalInventory.verify(message.localInventories[i]); if (error) - return "facetSpecs." + error; + return "localInventories." + error; } } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); - if (error) - return "dynamicFacetSpec." + error; - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify(message.boostSpec); + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); if (error) - return "boostSpec." + error; + return "addMask." + error; } - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); if (error) - return "queryExpansionSpec." + error; - } - if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) - switch (message.relevanceThreshold) { - default: - return "relevanceThreshold: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { - if (!Array.isArray(message.variantRollupKeys)) - return "variantRollupKeys: array expected"; - for (var i = 0; i < message.variantRollupKeys.length; ++i) - if (!$util.isString(message.variantRollupKeys[i])) - return "variantRollupKeys: string[] expected"; - } - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; + return "addTime." + error; } - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - switch (message.searchMode) { - default: - return "searchMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest */ - SearchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest) + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.branch != null) - message.branch = String(object.branch); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.filter != null) - message.filter = String(object.filter); - if (object.canonicalFilter != null) - message.canonicalFilter = String(object.canonicalFilter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.facetSpecs) { - if (!Array.isArray(object.facetSpecs)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: array expected"); - message.facetSpecs = []; - for (var i = 0; i < object.facetSpecs.length; ++i) { - if (typeof object.facetSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: object expected"); - message.facetSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + var message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2alpha.LocalInventory.fromObject(object.localInventories[i]); } } - if (object.dynamicFacetSpec != null) { - if (typeof object.dynamicFacetSpec !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.dynamicFacetSpec: object expected"); - message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); - } - if (object.boostSpec != null) { - if (typeof object.boostSpec !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.boostSpec: object expected"); - message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.fromObject(object.boostSpec); - } - if (object.queryExpansionSpec != null) { - if (typeof object.queryExpansionSpec !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.queryExpansionSpec: object expected"); - message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); - } - switch (object.relevanceThreshold) { - case "RELEVANCE_THRESHOLD_UNSPECIFIED": - case 0: - message.relevanceThreshold = 0; - break; - case "HIGH": - case 1: - message.relevanceThreshold = 1; - break; - case "MEDIUM": - case 2: - message.relevanceThreshold = 2; - break; - case "LOW": - case 3: - message.relevanceThreshold = 3; - break; - case "LOWEST": - case 4: - message.relevanceThreshold = 4; - break; - } - if (object.variantRollupKeys) { - if (!Array.isArray(object.variantRollupKeys)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.variantRollupKeys: array expected"); - message.variantRollupKeys = []; - for (var i = 0; i < object.variantRollupKeys.length; ++i) - message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); - } - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); } - switch (object.searchMode) { - case "SEARCH_MODE_UNSPECIFIED": - case 0: - message.searchMode = 0; - break; - case "PRODUCT_SEARCH_ONLY": - case 1: - message.searchMode = 1; - break; - case "FACETED_SEARCH_ONLY": - case 2: - message.searchMode = 2; - break; + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.SearchRequest} message SearchRequest + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} message AddLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchRequest.toObject = function toObject(message, options) { + AddLocalInventoriesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.facetSpecs = []; - object.variantRollupKeys = []; - object.pageCategories = []; - } + if (options.arrays || options.defaults) + object.localInventories = []; if (options.defaults) { - object.placement = ""; - object.branch = ""; - object.query = ""; - object.visitorId = ""; - object.userInfo = null; - object.pageSize = 0; - object.pageToken = ""; - object.offset = 0; - object.filter = ""; - object.orderBy = ""; - object.boostSpec = null; - object.queryExpansionSpec = null; - object.relevanceThreshold = options.enums === String ? "RELEVANCE_THRESHOLD_UNSPECIFIED" : 0; - object.dynamicFacetSpec = null; - object.canonicalFilter = ""; - object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; + object.product = ""; + object.addMask = null; + object.addTime = null; + object.allowMissing = false; } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.facetSpecs && message.facetSpecs.length) { - object.facetSpecs = []; - for (var j = 0; j < message.facetSpecs.length; ++j) - object.facetSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) - object.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.toObject(message.boostSpec, options); - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) - object.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); - if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) - object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; - if (message.variantRollupKeys && message.variantRollupKeys.length) { - object.variantRollupKeys = []; - for (var j = 0; j < message.variantRollupKeys.length; ++j) - object.variantRollupKeys[j] = message.variantRollupKeys[j]; - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) - object.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2alpha.LocalInventory.toObject(message.localInventories[j], options); } - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - object.canonicalFilter = message.canonicalFilter; - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this SearchRequest to JSON. + * Converts this AddLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - SearchRequest.prototype.toJSON = function toJSON() { + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchRequest.FacetSpec = (function() { - - /** - * Properties of a FacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IFacetSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey - * @property {number|null} [limit] FacetSpec limit - * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys - * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition - */ - - /** - * Constructs a new FacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a FacetSpec. - * @implements IFacetSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set - */ - function FacetSpec(properties) { - this.excludedFilterKeys = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FacetSpec facetKey. - * @member {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.facetKey = null; + return AddLocalInventoriesRequest; + })(); - /** - * FacetSpec limit. - * @member {number} limit - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.limit = 0; + v2alpha.AddLocalInventoriesMetadata = (function() { - /** - * FacetSpec excludedFilterKeys. - * @member {Array.} excludedFilterKeys - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + /** + * Properties of an AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesMetadata + */ - /** - * FacetSpec enableDynamicPosition. - * @member {boolean} enableDynamicPosition - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.enableDynamicPosition = false; + /** + * Constructs a new AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + */ + function AddLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new FacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec instance - */ - FacetSpec.create = function create(properties) { - return new FacetSpec(properties); - }; + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + */ + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); + }; - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) - $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); - if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); - if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); - return writer; - }; + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a FacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.facetKey != null && message.hasOwnProperty("facetKey")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); - if (error) - return "facetKey." + error; - } - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit)) - return "limit: integer expected"; - if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { - if (!Array.isArray(message.excludedFilterKeys)) - return "excludedFilterKeys: array expected"; - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - if (!$util.isString(message.excludedFilterKeys[i])) - return "excludedFilterKeys: string[] expected"; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - if (typeof message.enableDynamicPosition !== "boolean") - return "enableDynamicPosition: boolean expected"; - return null; - }; + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec - */ - FacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); - if (object.facetKey != null) { - if (typeof object.facetKey !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.facetKey: object expected"); - message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); - } - if (object.limit != null) - message.limit = object.limit | 0; - if (object.excludedFilterKeys) { - if (!Array.isArray(object.excludedFilterKeys)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); - message.excludedFilterKeys = []; - for (var i = 0; i < object.excludedFilterKeys.length; ++i) - message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); - } - if (object.enableDynamicPosition != null) - message.enableDynamicPosition = Boolean(object.enableDynamicPosition); - return message; - }; + /** + * Verifies an AddLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} message FacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.excludedFilterKeys = []; - if (options.defaults) { - object.facetKey = null; - object.limit = 0; - object.enableDynamicPosition = false; - } - if (message.facetKey != null && message.hasOwnProperty("facetKey")) - object.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = message.limit; - if (message.excludedFilterKeys && message.excludedFilterKeys.length) { - object.excludedFilterKeys = []; - for (var j = 0; j < message.excludedFilterKeys.length; ++j) - object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - object.enableDynamicPosition = message.enableDynamicPosition; + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + */ + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata) return object; - }; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + }; - /** - * Converts this FacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - * @returns {Object.} JSON object - */ - FacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; - FacetSpec.FacetKey = (function() { + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a FacetKey. - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @interface IFacetKey - * @property {string|null} [key] FacetKey key - * @property {Array.|null} [intervals] FacetKey intervals - * @property {Array.|null} [restrictedValues] FacetKey restrictedValues - * @property {Array.|null} [prefixes] FacetKey prefixes - * @property {Array.|null} [contains] FacetKey contains - * @property {string|null} [orderBy] FacetKey orderBy - * @property {string|null} [query] FacetKey query - */ + return AddLocalInventoriesMetadata; + })(); - /** - * Constructs a new FacetKey. - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @classdesc Represents a FacetKey. - * @implements IFacetKey - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - */ - function FacetKey(properties) { - this.intervals = []; - this.restrictedValues = []; - this.prefixes = []; - this.contains = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2alpha.AddLocalInventoriesResponse = (function() { - /** - * FacetKey key. - * @member {string} key - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.key = ""; + /** + * Properties of an AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IAddLocalInventoriesResponse + */ - /** - * FacetKey intervals. - * @member {Array.} intervals - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.intervals = $util.emptyArray; + /** + * Constructs a new AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + */ + function AddLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FacetKey restrictedValues. - * @member {Array.} restrictedValues - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.restrictedValues = $util.emptyArray; + /** + * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + */ + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); + }; - /** - * FacetKey prefixes. - * @member {Array.} prefixes - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.prefixes = $util.emptyArray; + /** + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * FacetKey contains. - * @member {Array.} contains - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.contains = $util.emptyArray; + /** + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * FacetKey orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.orderBy = ""; + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * FacetKey query. - * @member {string} query - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.query = ""; + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a new FacetKey instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey instance - */ - FacetKey.create = function create(properties) { - return new FacetKey(properties); - }; + /** + * Verifies an AddLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.intervals != null && message.intervals.length) - for (var i = 0; i < message.intervals.length; ++i) - $root.google.cloud.retail.v2alpha.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.restrictedValues != null && message.restrictedValues.length) - for (var i = 0; i < message.restrictedValues.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); - if (message.prefixes != null && message.prefixes.length) - for (var i = 0; i < message.prefixes.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); - if (message.contains != null && message.contains.length) - for (var i = 0; i < message.contains.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); - return writer; - }; + /** + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + */ + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + }; - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} message AddLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Converts this AddLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return AddLocalInventoriesResponse; + })(); - /** - * Verifies a FacetKey message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.intervals != null && message.hasOwnProperty("intervals")) { - if (!Array.isArray(message.intervals)) - return "intervals: array expected"; - for (var i = 0; i < message.intervals.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.intervals[i]); - if (error) - return "intervals." + error; - } - } - if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { - if (!Array.isArray(message.restrictedValues)) - return "restrictedValues: array expected"; - for (var i = 0; i < message.restrictedValues.length; ++i) - if (!$util.isString(message.restrictedValues[i])) - return "restrictedValues: string[] expected"; - } - if (message.prefixes != null && message.hasOwnProperty("prefixes")) { - if (!Array.isArray(message.prefixes)) - return "prefixes: array expected"; - for (var i = 0; i < message.prefixes.length; ++i) - if (!$util.isString(message.prefixes[i])) - return "prefixes: string[] expected"; - } - if (message.contains != null && message.hasOwnProperty("contains")) { - if (!Array.isArray(message.contains)) - return "contains: array expected"; - for (var i = 0; i < message.contains.length; ++i) - if (!$util.isString(message.contains[i])) - return "contains: string[] expected"; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - return null; - }; + v2alpha.RemoveLocalInventoriesRequest = (function() { - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey - */ - FacetKey.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); - if (object.key != null) - message.key = String(object.key); - if (object.intervals) { - if (!Array.isArray(object.intervals)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); - message.intervals = []; - for (var i = 0; i < object.intervals.length; ++i) { - if (typeof object.intervals[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); - message.intervals[i] = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.intervals[i]); - } - } - if (object.restrictedValues) { - if (!Array.isArray(object.restrictedValues)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); - message.restrictedValues = []; - for (var i = 0; i < object.restrictedValues.length; ++i) - message.restrictedValues[i] = String(object.restrictedValues[i]); - } - if (object.prefixes) { - if (!Array.isArray(object.prefixes)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); - message.prefixes = []; - for (var i = 0; i < object.prefixes.length; ++i) - message.prefixes[i] = String(object.prefixes[i]); - } - if (object.contains) { - if (!Array.isArray(object.contains)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.contains: array expected"); - message.contains = []; - for (var i = 0; i < object.contains.length; ++i) - message.contains[i] = String(object.contains[i]); - } - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.query != null) - message.query = String(object.query); - return message; - }; + /** + * Properties of a RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + */ - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} message FacetKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.intervals = []; - object.restrictedValues = []; - object.prefixes = []; - object.contains = []; - } - if (options.defaults) { - object.key = ""; - object.orderBy = ""; - object.query = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.intervals && message.intervals.length) { - object.intervals = []; - for (var j = 0; j < message.intervals.length; ++j) - object.intervals[j] = $root.google.cloud.retail.v2alpha.Interval.toObject(message.intervals[j], options); - } - if (message.restrictedValues && message.restrictedValues.length) { - object.restrictedValues = []; - for (var j = 0; j < message.restrictedValues.length; ++j) - object.restrictedValues[j] = message.restrictedValues[j]; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.prefixes && message.prefixes.length) { - object.prefixes = []; - for (var j = 0; j < message.prefixes.length; ++j) - object.prefixes[j] = message.prefixes[j]; - } - if (message.contains && message.contains.length) { - object.contains = []; - for (var j = 0; j < message.contains.length; ++j) - object.contains[j] = message.contains[j]; - } - return object; - }; + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + */ + function RemoveLocalInventoriesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this FacetKey to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - * @returns {Object.} JSON object - */ - FacetKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.product = ""; - return FacetKey; - })(); + /** + * RemoveLocalInventoriesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; - return FacetSpec; - })(); + /** + * RemoveLocalInventoriesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.removeTime = null; - SearchRequest.DynamicFacetSpec = (function() { + /** + * RemoveLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.allowMissing = false; - /** - * Properties of a DynamicFacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IDynamicFacetSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode - */ - - /** - * Constructs a new DynamicFacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a DynamicFacetSpec. - * @implements IDynamicFacetSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - */ - function DynamicFacetSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DynamicFacetSpec mode. - * @member {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode} mode - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @instance - */ - DynamicFacetSpec.prototype.mode = 0; - - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance - */ - DynamicFacetSpec.create = function create(properties) { - return new DynamicFacetSpec(properties); - }; - - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; - - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + */ + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); + }; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; - /** - * Verifies a DynamicFacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DynamicFacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; + /** + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - */ - DynamicFacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "DISABLED": + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - message.mode = 1; + message.product = reader.string(); break; - case "ENABLED": case 2: - message.mode = 2; + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 5: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); break; } - return message; - }; - - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DynamicFacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; - return object; - }; + } + return message; + }; - /** - * Converts this DynamicFacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @instance - * @returns {Object.} JSON object - */ - DynamicFacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Mode enum. - * @name google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} ENABLED=2 ENABLED value - */ - DynamicFacetSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[2] = "ENABLED"] = 2; - return values; - })(); + /** + * Verifies a RemoveLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; - return DynamicFacetSpec; - })(); + /** + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + */ + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; - SearchRequest.BoostSpec = (function() { + /** + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.allowMissing = false; + object.removeTime = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + return object; + }; - /** - * Properties of a BoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IBoostSpec - * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs - */ + /** + * Converts this RemoveLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Constructs a new BoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a BoostSpec. - * @implements IBoostSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set - */ - function BoostSpec(properties) { - this.conditionBoostSpecs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return RemoveLocalInventoriesRequest; + })(); - /** - * BoostSpec conditionBoostSpecs. - * @member {Array.} conditionBoostSpecs - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @instance - */ - BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + v2alpha.RemoveLocalInventoriesMetadata = (function() { - /** - * Creates a new BoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec instance - */ - BoostSpec.create = function create(properties) { - return new BoostSpec(properties); - }; + /** + * Properties of a RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesMetadata + */ - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) - $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Constructs a new RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + */ + function RemoveLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + */ + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); + }; - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a BoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { - if (!Array.isArray(message.conditionBoostSpecs)) - return "conditionBoostSpecs: array expected"; - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); - if (error) - return "conditionBoostSpecs." + error; - } + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; } - return null; - }; + } + return message; + }; - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec - */ - BoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); - if (object.conditionBoostSpecs) { - if (!Array.isArray(object.conditionBoostSpecs)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); - message.conditionBoostSpecs = []; - for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { - if (typeof object.conditionBoostSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); - message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); - } - } - return message; - }; + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} message BoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.conditionBoostSpecs = []; - if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { - object.conditionBoostSpecs = []; - for (var j = 0; j < message.conditionBoostSpecs.length; ++j) - object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); - } + /** + * Verifies a RemoveLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + */ + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata) return object; - }; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + }; - /** - * Converts this BoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @instance - * @returns {Object.} JSON object - */ - BoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; - BoostSpec.ConditionBoostSpec = (function() { + /** + * Converts this RemoveLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a ConditionBoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @interface IConditionBoostSpec - * @property {string|null} [condition] ConditionBoostSpec condition - * @property {number|null} [boost] ConditionBoostSpec boost - */ + return RemoveLocalInventoriesMetadata; + })(); - /** - * Constructs a new ConditionBoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @classdesc Represents a ConditionBoostSpec. - * @implements IConditionBoostSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - */ - function ConditionBoostSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2alpha.RemoveLocalInventoriesResponse = (function() { - /** - * ConditionBoostSpec condition. - * @member {string} condition - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.condition = ""; + /** + * Properties of a RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesResponse + */ - /** - * ConditionBoostSpec boost. - * @member {number} boost - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.boost = 0; + /** + * Constructs a new RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + */ + function RemoveLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance - */ - ConditionBoostSpec.create = function create(properties) { - return new ConditionBoostSpec(properties); - }; + /** + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + */ + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); + }; - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); - return writer; - }; + /** + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ConditionBoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConditionBoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - if (!$util.isString(message.condition)) - return "condition: string expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - return null; - }; + /** + * Verifies a RemoveLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - */ - ConditionBoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); - if (object.condition != null) - message.condition = String(object.condition); - if (object.boost != null) - message.boost = Number(object.boost); - return message; - }; - - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConditionBoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = ""; - object.boost = 0; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = message.condition; - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - return object; - }; - - /** - * Converts this ConditionBoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - * @returns {Object.} JSON object - */ - ConditionBoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConditionBoostSpec; - })(); - - return BoostSpec; - })(); - - SearchRequest.QueryExpansionSpec = (function() { - - /** - * Properties of a QueryExpansionSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IQueryExpansionSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition - * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults - */ - - /** - * Constructs a new QueryExpansionSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a QueryExpansionSpec. - * @implements IQueryExpansionSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - */ - function QueryExpansionSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryExpansionSpec condition. - * @member {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition} condition - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.condition = 0; - - /** - * QueryExpansionSpec pinUnexpandedResults. - * @member {boolean} pinUnexpandedResults - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.pinUnexpandedResults = false; - - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance - */ - QueryExpansionSpec.create = function create(properties) { - return new QueryExpansionSpec(properties); - }; - - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); - if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); - return writer; - }; - - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryExpansionSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - switch (message.condition) { - default: - return "condition: enum value expected"; - case 0: - case 1: - case 3: - break; - } - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - if (typeof message.pinUnexpandedResults !== "boolean") - return "pinUnexpandedResults: boolean expected"; - return null; - }; - - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - */ - QueryExpansionSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); - switch (object.condition) { - case "CONDITION_UNSPECIFIED": - case 0: - message.condition = 0; - break; - case "DISABLED": - case 1: - message.condition = 1; - break; - case "AUTO": - case 3: - message.condition = 3; - break; - } - if (object.pinUnexpandedResults != null) - message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); - return message; - }; - - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; - object.pinUnexpandedResults = false; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - object.pinUnexpandedResults = message.pinUnexpandedResults; - return object; - }; - - /** - * Converts this QueryExpansionSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Condition enum. - * @name google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition - * @enum {number} - * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} AUTO=3 AUTO value - */ - QueryExpansionSpec.Condition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[3] = "AUTO"] = 3; - return values; - })(); - - return QueryExpansionSpec; - })(); + /** + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + */ + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + }; /** - * RelevanceThreshold enum. - * @name google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold - * @enum {number} - * @property {number} RELEVANCE_THRESHOLD_UNSPECIFIED=0 RELEVANCE_THRESHOLD_UNSPECIFIED value - * @property {number} HIGH=1 HIGH value - * @property {number} MEDIUM=2 MEDIUM value - * @property {number} LOW=3 LOW value - * @property {number} LOWEST=4 LOWEST value + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchRequest.RelevanceThreshold = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RELEVANCE_THRESHOLD_UNSPECIFIED"] = 0; - values[valuesById[1] = "HIGH"] = 1; - values[valuesById[2] = "MEDIUM"] = 2; - values[valuesById[3] = "LOW"] = 3; - values[valuesById[4] = "LOWEST"] = 4; - return values; - })(); + RemoveLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; /** - * SearchMode enum. - * @name google.cloud.retail.v2alpha.SearchRequest.SearchMode - * @enum {number} - * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value - * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value - * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + * Converts this RemoveLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object */ - SearchRequest.SearchMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; - values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; - return values; - })(); + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return SearchRequest; + return RemoveLocalInventoriesResponse; })(); - v2alpha.SearchResponse = (function() { + v2alpha.RemoveFulfillmentPlacesRequest = (function() { /** - * Properties of a SearchResponse. + * Properties of a RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @interface ISearchResponse - * @property {Array.|null} [results] SearchResponse results - * @property {Array.|null} [facets] SearchResponse facets - * @property {number|null} [totalSize] SearchResponse totalSize - * @property {string|null} [correctedQuery] SearchResponse correctedQuery - * @property {string|null} [attributionToken] SearchResponse attributionToken - * @property {string|null} [nextPageToken] SearchResponse nextPageToken - * @property {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo - * @property {string|null} [redirectUri] SearchResponse redirectUri - * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new SearchResponse. + * Constructs a new RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SearchResponse. - * @implements ISearchResponse + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set */ - function SearchResponse(properties) { - this.results = []; - this.facets = []; - this.appliedControls = []; + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -49419,188 +47844,130 @@ } /** - * SearchResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance - */ - SearchResponse.prototype.results = $util.emptyArray; - - /** - * SearchResponse facets. - * @member {Array.} facets - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance - */ - SearchResponse.prototype.facets = $util.emptyArray; - - /** - * SearchResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance - */ - SearchResponse.prototype.totalSize = 0; - - /** - * SearchResponse correctedQuery. - * @member {string} correctedQuery - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance - */ - SearchResponse.prototype.correctedQuery = ""; - - /** - * SearchResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.SearchResponse + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance */ - SearchResponse.prototype.attributionToken = ""; + RemoveFulfillmentPlacesRequest.prototype.product = ""; /** - * SearchResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2alpha.SearchResponse + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance */ - SearchResponse.prototype.nextPageToken = ""; + RemoveFulfillmentPlacesRequest.prototype.type = ""; /** - * SearchResponse queryExpansionInfo. - * @member {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo - * @memberof google.cloud.retail.v2alpha.SearchResponse + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance */ - SearchResponse.prototype.queryExpansionInfo = null; + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * SearchResponse redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2alpha.SearchResponse + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance */ - SearchResponse.prototype.redirectUri = ""; + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; /** - * SearchResponse appliedControls. - * @member {Array.} appliedControls - * @memberof google.cloud.retail.v2alpha.SearchResponse + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance */ - SearchResponse.prototype.appliedControls = $util.emptyArray; + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance */ - SearchResponse.create = function create(properties) { - return new SearchResponse(properties); + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encode = function encode(message, writer) { + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.facets != null && message.facets.length) - for (var i = 0; i < message.facets.length; ++i) - $root.google.cloud.retail.v2alpha.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); - if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); - if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) - $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); - if (message.appliedControls != null && message.appliedControls.length) - for (var i = 0; i < message.appliedControls.length; ++i) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decode = function decode(reader, length) { + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); + message.product = reader.string(); break; case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); + message.type = reader.string(); break; case 3: - message.totalSize = reader.int32(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; case 4: - message.correctedQuery = reader.string(); + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); - break; - case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - case 10: - message.redirectUri = reader.string(); - break; - case 12: - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -49611,1635 +47978,946 @@ }; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchResponse message. + * Verifies a RemoveFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.verify = function verify(message) { + RemoveFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.facets != null && message.hasOwnProperty("facets")) { - if (!Array.isArray(message.facets)) - return "facets: array expected"; - for (var i = 0; i < message.facets.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.verify(message.facets[i]); - if (error) - return "facets." + error; - } + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - if (!$util.isString(message.correctedQuery)) - return "correctedQuery: string expected"; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); if (error) - return "queryExpansionInfo." + error; - } - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; - if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { - if (!Array.isArray(message.appliedControls)) - return "appliedControls: array expected"; - for (var i = 0; i < message.appliedControls.length; ++i) - if (!$util.isString(message.appliedControls[i])) - return "appliedControls: string[] expected"; + return "removeTime." + error; } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest */ - SearchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse) + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.fromObject(object.results[i]); - } - } - if (object.facets) { - if (!Array.isArray(object.facets)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: array expected"); - message.facets = []; - for (var i = 0; i < object.facets.length; ++i) { - if (typeof object.facets[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: object expected"); - message.facets[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.fromObject(object.facets[i]); - } - } - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; - if (object.correctedQuery != null) - message.correctedQuery = String(object.correctedQuery); - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.queryExpansionInfo != null) { - if (typeof object.queryExpansionInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.queryExpansionInfo: object expected"); - message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + var message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); } - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); - if (object.appliedControls) { - if (!Array.isArray(object.appliedControls)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.appliedControls: array expected"); - message.appliedControls = []; - for (var i = 0; i < object.appliedControls.length; ++i) - message.appliedControls[i] = String(object.appliedControls[i]); + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.SearchResponse} message SearchResponse + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchResponse.toObject = function toObject(message, options) { + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.facets = []; - object.appliedControls = []; - } + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) { - object.totalSize = 0; - object.correctedQuery = ""; - object.attributionToken = ""; - object.nextPageToken = ""; - object.queryExpansionInfo = null; - object.redirectUri = ""; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.toObject(message.results[j], options); - } - if (message.facets && message.facets.length) { - object.facets = []; - for (var j = 0; j < message.facets.length; ++j) - object.facets[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.toObject(message.facets[j], options); + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - object.correctedQuery = message.correctedQuery; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) - object.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; - if (message.appliedControls && message.appliedControls.length) { - object.appliedControls = []; - for (var j = 0; j < message.appliedControls.length; ++j) - object.appliedControls[j] = message.appliedControls[j]; + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this SearchResponse to JSON. + * Converts this RemoveFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - SearchResponse.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchResponse.SearchResult = (function() { + return RemoveFulfillmentPlacesRequest; + })(); - /** - * Properties of a SearchResult. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @interface ISearchResult - * @property {string|null} [id] SearchResult id - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] SearchResult product - * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount - * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields - * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues - */ + v2alpha.RemoveFulfillmentPlacesMetadata = (function() { - /** - * Constructs a new SearchResult. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @classdesc Represents a SearchResult. - * @implements ISearchResult - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set - */ - function SearchResult(properties) { - this.matchingVariantFields = {}; - this.variantRollupValues = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveFulfillmentPlacesMetadata + */ - /** - * SearchResult id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.id = ""; + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * SearchResult product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.product = null; + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + */ + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); + }; - /** - * SearchResult matchingVariantCount. - * @member {number} matchingVariantCount - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantCount = 0; + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * SearchResult matchingVariantFields. - * @member {Object.} matchingVariantFields - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantFields = $util.emptyObject; + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * SearchResult variantRollupValues. - * @member {Object.} variantRollupValues - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.variantRollupValues = $util.emptyObject; + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new SearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult instance - */ - SearchResult.create = function create(properties) { - return new SearchResult(properties); - }; + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); - if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) - for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) - for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + */ + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + }; - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 3: - message.matchingVariantCount = reader.int32(); - break; - case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.variantRollupValues[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a SearchResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - if (!$util.isInteger(message.matchingVariantCount)) - return "matchingVariantCount: integer expected"; - if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { - if (!$util.isObject(message.matchingVariantFields)) - return "matchingVariantFields: object expected"; - var key = Object.keys(message.matchingVariantFields); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); - if (error) - return "matchingVariantFields." + error; - } - } - if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { - if (!$util.isObject(message.variantRollupValues)) - return "variantRollupValues: object expected"; - var key = Object.keys(message.variantRollupValues); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); - if (error) - return "variantRollupValues." + error; - } - } - return null; - }; + return RemoveFulfillmentPlacesMetadata; + })(); - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult - */ - SearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(); - if (object.id != null) - message.id = String(object.id); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); - } - if (object.matchingVariantCount != null) - message.matchingVariantCount = object.matchingVariantCount | 0; - if (object.matchingVariantFields) { - if (typeof object.matchingVariantFields !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields = {}; - for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { - if (typeof object.matchingVariantFields[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); - } - } - if (object.variantRollupValues) { - if (typeof object.variantRollupValues !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues = {}; - for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { - if (typeof object.variantRollupValues[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); - } - } - return message; - }; + v2alpha.RemoveFulfillmentPlacesResponse = (function() { - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.SearchResult} message SearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) { - object.matchingVariantFields = {}; - object.variantRollupValues = {}; - } - if (options.defaults) { - object.id = ""; - object.product = null; - object.matchingVariantCount = 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - object.matchingVariantCount = message.matchingVariantCount; - var keys2; - if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { - object.matchingVariantFields = {}; - for (var j = 0; j < keys2.length; ++j) - object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); - } - if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { - object.variantRollupValues = {}; - for (var j = 0; j < keys2.length; ++j) - object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); - } - return object; - }; + /** + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveFulfillmentPlacesResponse + */ - /** - * Converts this SearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - * @returns {Object.} JSON object - */ - SearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - return SearchResult; - })(); + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + */ + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); + }; - SearchResponse.Facet = (function() { + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Properties of a Facet. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @interface IFacet - * @property {string|null} [key] Facet key - * @property {Array.|null} [values] Facet values - * @property {boolean|null} [dynamicFacet] Facet dynamicFacet - */ + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Constructs a new Facet. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @classdesc Represents a Facet. - * @implements IFacet - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set - */ - function Facet(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } } + return message; + }; - /** - * Facet key. - * @member {string} key - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - */ - Facet.prototype.key = ""; - - /** - * Facet values. - * @member {Array.} values - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - */ - Facet.prototype.values = $util.emptyArray; + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Facet dynamicFacet. - * @member {boolean} dynamicFacet - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - */ - Facet.prototype.dynamicFacet = false; + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Creates a new Facet instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet instance - */ - Facet.create = function create(properties) { - return new Facet(properties); - }; + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + */ + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + }; - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); - return writer; - }; + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a Facet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + return RemoveFulfillmentPlacesResponse; + })(); - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + v2alpha.PurgeMetadata = (function() { - /** - * Verifies a Facet message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Facet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - if (typeof message.dynamicFacet !== "boolean") - return "dynamicFacet: boolean expected"; - return null; - }; - - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet - */ - Facet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); - if (object.key != null) - message.key = String(object.key); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: object expected"); - message.values[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); - } - } - if (object.dynamicFacet != null) - message.dynamicFacet = Boolean(object.dynamicFacet); - return message; - }; + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeMetadata + */ - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet} message Facet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Facet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (options.defaults) { - object.key = ""; - object.dynamicFacet = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - object.dynamicFacet = message.dynamicFacet; - return object; - }; + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this Facet to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - * @returns {Object.} JSON object - */ - Facet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; - Facet.FacetValue = (function() { + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Properties of a FacetValue. - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @interface IFacetValue - * @property {string|null} [value] FacetValue value - * @property {google.cloud.retail.v2alpha.IInterval|null} [interval] FacetValue interval - * @property {number|Long|null} [count] FacetValue count - */ + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Constructs a new FacetValue. - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @classdesc Represents a FacetValue. - * @implements IFacetValue - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - */ - function FacetValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; } + } + return message; + }; - /** - * FacetValue value. - * @member {string|null|undefined} value - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.value = null; + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * FacetValue interval. - * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} interval - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.interval = null; + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * FacetValue count. - * @member {number|Long} count - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; - /** - * FacetValue facetValue. - * @member {"value"|"interval"|undefined} facetValue - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - Object.defineProperty(FacetValue.prototype, "facetValue", { - get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new FacetValue instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue instance - */ - FacetValue.create = function create(properties) { - return new FacetValue(properties); - }; + return PurgeMetadata; + })(); - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) - $root.google.cloud.retail.v2alpha.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); - return writer; - }; + v2alpha.PurgeUserEventsRequest = (function() { - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; - case 3: - message.count = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; - /** - * Verifies a FacetValue message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.value != null && message.hasOwnProperty("value")) { - properties.facetValue = 1; - if (!$util.isString(message.value)) - return "value: string expected"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - if (properties.facetValue === 1) - return "facetValue: multiple values"; - properties.facetValue = 1; - { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.interval); - if (error) - return "interval." + error; - } - } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - return null; - }; + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue - */ - FacetValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); - if (object.value != null) - message.value = String(object.value); - if (object.interval != null) { - if (typeof object.interval !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval: object expected"); - message.interval = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.interval); - } - if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - return message; - }; + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} message FacetValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) { - object.value = message.value; - if (options.oneofs) - object.facetValue = "value"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - object.interval = $root.google.cloud.retail.v2alpha.Interval.toObject(message.interval, options); - if (options.oneofs) - object.facetValue = "interval"; - } - if (message.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - return object; - }; - - /** - * Converts this FacetValue to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - * @returns {Object.} JSON object - */ - FacetValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FacetValue; - })(); - - return Facet; - })(); - - SearchResponse.QueryExpansionInfo = (function() { - - /** - * Properties of a QueryExpansionInfo. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @interface IQueryExpansionInfo - * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery - * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount - */ - - /** - * Constructs a new QueryExpansionInfo. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @classdesc Represents a QueryExpansionInfo. - * @implements IQueryExpansionInfo - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - */ - function QueryExpansionInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryExpansionInfo expandedQuery. - * @member {boolean} expandedQuery - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.expandedQuery = false; - - /** - * QueryExpansionInfo pinnedResultCount. - * @member {number|Long} pinnedResultCount - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance - */ - QueryExpansionInfo.create = function create(properties) { - return new QueryExpansionInfo(properties); - }; - - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); - if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); - return writer; - }; - - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; - /** - * Verifies a QueryExpansionInfo message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - if (typeof message.expandedQuery !== "boolean") - return "expandedQuery: boolean expected"; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) - return "pinnedResultCount: integer|Long expected"; - return null; - }; + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - */ - QueryExpansionInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); - if (object.expandedQuery != null) - message.expandedQuery = Boolean(object.expandedQuery); - if (object.pinnedResultCount != null) - if ($util.Long) - (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; - else if (typeof object.pinnedResultCount === "string") - message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); - else if (typeof object.pinnedResultCount === "number") - message.pinnedResultCount = object.pinnedResultCount; - else if (typeof object.pinnedResultCount === "object") - message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); - return message; - }; + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.expandedQuery = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pinnedResultCount = options.longs === String ? "0" : 0; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - object.expandedQuery = message.expandedQuery; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (typeof message.pinnedResultCount === "number") - object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; - else - object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; - return object; - }; - - /** - * Converts this QueryExpansionInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryExpansionInfo; - })(); - - return SearchResponse; - })(); - - v2alpha.UserEventService = (function() { + } + return message; + }; /** - * Constructs a new UserEventService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - function UserEventService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Creates new UserEventService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.UserEventService + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef WriteUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.UserEvent} [response] UserEvent + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent - * @returns {undefined} - * @variation 1 + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { - return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2alpha.WriteUserEventRequest, $root.google.cloud.retail.v2alpha.UserEvent, request, callback); - }, "name", { value: "WriteUserEvent" }); + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; /** - * Calls WriteUserEvent. - * @function writeUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest * @instance - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsRequest; + })(); + + v2alpha.PurgeUserEventsResponse = (function() { /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef CollectUserEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.api.HttpBody} [response] HttpBody + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount */ /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody - * @returns {undefined} - * @variation 1 + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set */ - Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { - return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2alpha.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); - }, "name", { value: "CollectUserEvent" }); + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Calls CollectUserEvent. - * @function collectUserEvent - * @memberof google.cloud.retail.v2alpha.UserEventService + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @instance - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef PurgeUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { - return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "PurgeUserEvents" }); - - /** - * Calls PurgeUserEvents. - * @function purgeUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef ImportUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { - return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2alpha.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportUserEvents" }); - - /** - * Calls ImportUserEvents. - * @function importUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. - * @memberof google.cloud.retail.v2alpha.UserEventService - * @typedef RejoinUserEventsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @param {google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { - return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RejoinUserEvents" }); - - /** - * Calls RejoinUserEvents. - * @function rejoinUserEvents - * @memberof google.cloud.retail.v2alpha.UserEventService - * @instance - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return UserEventService; - })(); - - v2alpha.WriteUserEventRequest = (function() { - - /** - * Properties of a WriteUserEventRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IWriteUserEventRequest - * @property {string|null} [parent] WriteUserEventRequest parent - * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent - */ - - /** - * Constructs a new WriteUserEventRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a WriteUserEventRequest. - * @implements IWriteUserEventRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set - */ - function WriteUserEventRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * WriteUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.parent = ""; - - /** - * WriteUserEventRequest userEvent. - * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest - * @instance - */ - WriteUserEventRequest.prototype.userEvent = null; - - /** - * Creates a new WriteUserEventRequest instance using the specified properties. + * Creates a new PurgeUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance */ - WriteUserEventRequest.create = function create(properties) { - return new WriteUserEventRequest(properties); + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); }; /** - * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WriteUserEventRequest.encode = function encode(message, writer) { + PurgeUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); return writer; }; /** - * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WriteUserEventRequest.decode = function decode(reader, length) { + PurgeUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + message.purgedEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -51250,124 +48928,210 @@ }; /** - * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WriteUserEventRequest message. + * Verifies a PurgeUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WriteUserEventRequest.verify = function verify(message) { + PurgeUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; return null; }; /** - * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse */ - WriteUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.WriteUserEventRequest) + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2alpha.WriteUserEventRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); - } + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.WriteUserEventRequest} message WriteUserEventRequest + * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WriteUserEventRequest.toObject = function toObject(message, options) { + PurgeUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; return object; }; /** - * Converts this WriteUserEventRequest to JSON. + * Converts this PurgeUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse * @instance * @returns {Object.} JSON object */ - WriteUserEventRequest.prototype.toJSON = function toJSON() { + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WriteUserEventRequest; + return PurgeUserEventsResponse; })(); - v2alpha.CollectUserEventRequest = (function() { + v2alpha.SearchService = (function() { /** - * Properties of a CollectUserEventRequest. + * Constructs a new SearchService service. * @memberof google.cloud.retail.v2alpha - * @interface ICollectUserEventRequest - * @property {string|null} [parent] CollectUserEventRequest parent - * @property {string|null} [userEvent] CollectUserEventRequest userEvent - * @property {string|null} [uri] CollectUserEventRequest uri - * @property {number|Long|null} [ets] CollectUserEventRequest ets + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; /** - * Constructs a new CollectUserEventRequest. + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * @memberof google.cloud.retail.v2alpha.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.SearchResponse} [response] SearchResponse + */ + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2alpha.SearchService + * @instance + * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2alpha.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2alpha.SearchRequest, $root.google.cloud.retail.v2alpha.SearchResponse, request, callback); + }, "name", { value: "Search" }); + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2alpha.SearchService + * @instance + * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SearchService; + })(); + + v2alpha.SearchRequest = (function() { + + /** + * Properties of a SearchRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CollectUserEventRequest. - * @implements ICollectUserEventRequest + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null} [relevanceThreshold] SearchRequest relevanceThreshold + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2alpha.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + */ + + /** + * Constructs a new SearchRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest * @constructor - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set */ - function CollectUserEventRequest(properties) { + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51375,354 +49139,318 @@ } /** - * CollectUserEventRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CollectUserEventRequest.prototype.parent = ""; + SearchRequest.prototype.placement = ""; /** - * CollectUserEventRequest userEvent. - * @member {string} userEvent - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CollectUserEventRequest.prototype.userEvent = ""; + SearchRequest.prototype.branch = ""; /** - * CollectUserEventRequest uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CollectUserEventRequest.prototype.uri = ""; + SearchRequest.prototype.query = ""; /** - * CollectUserEventRequest ets. - * @member {number|Long} ets - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + SearchRequest.prototype.visitorId = ""; /** - * Creates a new CollectUserEventRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest instance + * SearchRequest userInfo. + * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.create = function create(properties) { - return new CollectUserEventRequest(properties); - }; + SearchRequest.prototype.userInfo = null; /** - * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); - if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); - return writer; - }; + SearchRequest.prototype.pageSize = 0; /** - * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + SearchRequest.prototype.pageToken = ""; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + SearchRequest.prototype.offset = 0; /** - * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + SearchRequest.prototype.filter = ""; /** - * Verifies a CollectUserEventRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - if (!$util.isString(message.userEvent)) - return "userEvent: string expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.ets != null && message.hasOwnProperty("ets")) - if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) - return "ets: integer|Long expected"; - return null; - }; + SearchRequest.prototype.canonicalFilter = ""; /** - * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CollectUserEventRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.userEvent != null) - message.userEvent = String(object.userEvent); - if (object.uri != null) - message.uri = String(object.uri); - if (object.ets != null) - if ($util.Long) - (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; - else if (typeof object.ets === "string") - message.ets = parseInt(object.ets, 10); - else if (typeof object.ets === "number") - message.ets = object.ets; - else if (typeof object.ets === "object") - message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); - return message; - }; + SearchRequest.prototype.orderBy = ""; /** - * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest - * @static - * @param {google.cloud.retail.v2alpha.CollectUserEventRequest} message CollectUserEventRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CollectUserEventRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.userEvent = ""; - object.uri = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.ets = options.longs === String ? "0" : 0; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = message.userEvent; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.ets != null && message.hasOwnProperty("ets")) - if (typeof message.ets === "number") - object.ets = options.longs === String ? String(message.ets) : message.ets; - else - object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; - return object; - }; + SearchRequest.prototype.facetSpecs = $util.emptyArray; /** - * Converts this CollectUserEventRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance - * @returns {Object.} JSON object */ - CollectUserEventRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + SearchRequest.prototype.dynamicFacetSpec = null; - return CollectUserEventRequest; - })(); + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; - v2alpha.RejoinUserEventsRequest = (function() { + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; /** - * Properties of a RejoinUserEventsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IRejoinUserEventsRequest - * @property {string|null} [parent] RejoinUserEventsRequest parent - * @property {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + * SearchRequest relevanceThreshold. + * @member {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} relevanceThreshold + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ + SearchRequest.prototype.relevanceThreshold = 0; /** - * Constructs a new RejoinUserEventsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RejoinUserEventsRequest. - * @implements IRejoinUserEventsRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - function RejoinUserEventsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; /** - * RejoinUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - RejoinUserEventsRequest.prototype.parent = ""; + SearchRequest.prototype.pageCategories = $util.emptyArray; /** - * RejoinUserEventsRequest userEventRejoinScope. - * @member {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * SearchRequest searchMode. + * @member {google.cloud.retail.v2alpha.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; + SearchRequest.prototype.searchMode = 0; /** - * Creates a new RejoinUserEventsRequest instance using the specified properties. + * Creates a new SearchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest instance */ - RejoinUserEventsRequest.create = function create(properties) { - return new RejoinUserEventsRequest(properties); + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); }; /** - * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsRequest.encode = function encode(message, writer) { + SearchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.relevanceThreshold != null && Object.hasOwnProperty.call(message, "relevanceThreshold")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.relevanceThreshold); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); return writer; }; /** - * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsRequest.decode = function decode(reader, length) { + SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.placement = reader.string(); break; case 2: - message.userEventRejoinScope = reader.int32(); + message.branch = reader.string(); + break; + case 3: + message.query = reader.string(); + break; + case 4: + message.visitorId = reader.string(); + break; + case 5: + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); + break; + case 10: + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 15: + message.relevanceThreshold = reader.int32(); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 31: + message.searchMode = reader.int32(); break; default: reader.skipType(tag & 7); @@ -51733,39 +49461,120 @@ }; /** - * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + SearchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RejoinUserEventsRequest message. + * Verifies a SearchRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RejoinUserEventsRequest.verify = function verify(message) { + SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - switch (message.userEventRejoinScope) { + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (error) + return "facetSpecs." + error; + } + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) + switch (message.relevanceThreshold) { default: - return "userEventRejoinScope: enum value expected"; + return "relevanceThreshold: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; case 0: case 1: case 2: @@ -51775,1194 +49584,1124 @@ }; /** - * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest */ - RejoinUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest) + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - switch (object.userEventRejoinScope) { - case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + var message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + switch (object.relevanceThreshold) { + case "RELEVANCE_THRESHOLD_UNSPECIFIED": case 0: - message.userEventRejoinScope = 0; + message.relevanceThreshold = 0; break; - case "JOINED_EVENTS": + case "HIGH": case 1: - message.userEventRejoinScope = 1; + message.relevanceThreshold = 1; break; - case "UNJOINED_EVENTS": + case "MEDIUM": case 2: - message.userEventRejoinScope = 2; + message.relevanceThreshold = 2; + break; + case "LOW": + case 3: + message.relevanceThreshold = 3; + break; + case "LOWEST": + case 4: + message.relevanceThreshold = 4; + break; + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; break; } return message; }; /** - * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest} message RejoinUserEventsRequest + * @param {google.cloud.retail.v2alpha.SearchRequest} message SearchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RejoinUserEventsRequest.toObject = function toObject(message, options) { + SearchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; + } if (options.defaults) { - object.parent = ""; - object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.relevanceThreshold = options.enums === String ? "RELEVANCE_THRESHOLD_UNSPECIFIED" : 0; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) + object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; return object; }; /** - * Converts this RejoinUserEventsRequest to JSON. + * Converts this SearchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance * @returns {Object.} JSON object */ - RejoinUserEventsRequest.prototype.toJSON = function toJSON() { + SearchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * UserEventRejoinScope enum. - * @name google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope - * @enum {number} - * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value - * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value - * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value - */ - RejoinUserEventsRequest.UserEventRejoinScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "JOINED_EVENTS"] = 1; - values[valuesById[2] = "UNJOINED_EVENTS"] = 2; - return values; - })(); + SearchRequest.FacetSpec = (function() { - return RejoinUserEventsRequest; - })(); + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ - v2alpha.RejoinUserEventsResponse = (function() { + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Properties of a RejoinUserEventsResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IRejoinUserEventsResponse - * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount - */ + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; - /** - * Constructs a new RejoinUserEventsResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RejoinUserEventsResponse. - * @implements IRejoinUserEventsResponse - * @constructor - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set - */ - function RejoinUserEventsResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; - /** - * RejoinUserEventsResponse rejoinedUserEventsCount. - * @member {number|Long} rejoinedUserEventsCount - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @instance - */ - RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; - /** - * Creates a new RejoinUserEventsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse instance - */ - RejoinUserEventsResponse.create = function create(properties) { - return new RejoinUserEventsResponse(properties); - }; + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; - /** - * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); - return writer; - }; + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; - /** - * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; - /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.rejoinedUserEventsCount = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + case 2: + message.limit = reader.int32(); + break; + case 3: + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + case 4: + message.enableDynamicPosition = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a RejoinUserEventsResponse message. - * @function verify - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RejoinUserEventsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) - return "rejoinedUserEventsCount: integer|Long expected"; - return null; - }; + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); + if (error) + return "facetKey." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; - /** - * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse - */ - RejoinUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse) - return object; - var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); - if (object.rejoinedUserEventsCount != null) - if ($util.Long) - (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; - else if (typeof object.rejoinedUserEventsCount === "string") - message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); - else if (typeof object.rejoinedUserEventsCount === "number") - message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; - else if (typeof object.rejoinedUserEventsCount === "object") - message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); - return message; - }; + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); + } + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; - /** - * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @static - * @param {google.cloud.retail.v2alpha.RejoinUserEventsResponse} message RejoinUserEventsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RejoinUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; - if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) - if (typeof message.rejoinedUserEventsCount === "number") - object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; - else - object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; - return object; - }; - - /** - * Converts this RejoinUserEventsResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse - * @instance - * @returns {Object.} JSON object - */ - RejoinUserEventsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RejoinUserEventsResponse; - })(); - - v2alpha.RejoinUserEventsMetadata = (function() { - - /** - * Properties of a RejoinUserEventsMetadata. - * @memberof google.cloud.retail.v2alpha - * @interface IRejoinUserEventsMetadata - */ - - /** - * Constructs a new RejoinUserEventsMetadata. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RejoinUserEventsMetadata. - * @implements IRejoinUserEventsMetadata - * @constructor - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set - */ - function RejoinUserEventsMetadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new RejoinUserEventsMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance - */ - RejoinUserEventsMetadata.create = function create(properties) { - return new RejoinUserEventsMetadata(properties); - }; - - /** - * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; } - } - return message; - }; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; + return object; + }; - /** - * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a RejoinUserEventsMetadata message. - * @function verify - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RejoinUserEventsMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; + FacetSpec.FacetKey = (function() { - /** - * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata - */ - RejoinUserEventsMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata) - return object; - return new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); - }; + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ - /** - * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @static - * @param {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} message RejoinUserEventsMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RejoinUserEventsMetadata.toObject = function toObject() { - return {}; - }; + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this RejoinUserEventsMetadata to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata - * @instance - * @returns {Object.} JSON object - */ - RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; - return RejoinUserEventsMetadata; - })(); + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; - return v2alpha; - })(); + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; - retail.v2beta = (function() { + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; - /** - * Namespace v2beta. - * @memberof google.cloud.retail - * @namespace - */ - var v2beta = {}; + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; - v2beta.ProductLevelConfig = (function() { + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; - /** - * Properties of a ProductLevelConfig. - * @memberof google.cloud.retail.v2beta - * @interface IProductLevelConfig - * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType - * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField - */ + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; - /** - * Constructs a new ProductLevelConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductLevelConfig. - * @implements IProductLevelConfig - * @constructor - * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set - */ - function ProductLevelConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; - /** - * ProductLevelConfig ingestionProductType. - * @member {string} ingestionProductType - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @instance - */ - ProductLevelConfig.prototype.ingestionProductType = ""; + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2alpha.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + return writer; + }; - /** - * ProductLevelConfig merchantCenterProductIdField. - * @member {string} merchantCenterProductIdField - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @instance - */ - ProductLevelConfig.prototype.merchantCenterProductIdField = ""; + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new ProductLevelConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig instance - */ - ProductLevelConfig.create = function create(properties) { - return new ProductLevelConfig(properties); - }; + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductLevelConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); - if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); - return writer; - }; + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + return null; + }; - /** - * Decodes a ProductLevelConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductLevelConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ingestionProductType = reader.string(); - break; - case 2: - message.merchantCenterProductIdField = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + return message; + }; - /** - * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2alpha.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + return object; + }; - /** - * Verifies a ProductLevelConfig message. - * @function verify - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductLevelConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - if (!$util.isString(message.ingestionProductType)) - return "ingestionProductType: string expected"; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - if (!$util.isString(message.merchantCenterProductIdField)) - return "merchantCenterProductIdField: string expected"; - return null; - }; + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig - */ - ProductLevelConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductLevelConfig) - return object; - var message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); - if (object.ingestionProductType != null) - message.ingestionProductType = String(object.ingestionProductType); - if (object.merchantCenterProductIdField != null) - message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); - return message; - }; + return FacetKey; + })(); - /** - * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @static - * @param {google.cloud.retail.v2beta.ProductLevelConfig} message ProductLevelConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductLevelConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.ingestionProductType = ""; - object.merchantCenterProductIdField = ""; - } - if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) - object.ingestionProductType = message.ingestionProductType; - if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) - object.merchantCenterProductIdField = message.merchantCenterProductIdField; - return object; - }; + return FacetSpec; + })(); - /** - * Converts this ProductLevelConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductLevelConfig - * @instance - * @returns {Object.} JSON object - */ - ProductLevelConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + SearchRequest.DynamicFacetSpec = (function() { - return ProductLevelConfig; - })(); + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ - v2beta.Catalog = (function() { + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Properties of a Catalog. - * @memberof google.cloud.retail.v2beta - * @interface ICatalog - * @property {string|null} [name] Catalog name - * @property {string|null} [displayName] Catalog displayName - * @property {google.cloud.retail.v2beta.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig - */ + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; - /** - * Constructs a new Catalog. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Catalog. - * @implements ICatalog - * @constructor - * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set - */ - function Catalog(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; - /** - * Catalog name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.Catalog - * @instance - */ - Catalog.prototype.name = ""; + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; - /** - * Catalog displayName. - * @member {string} displayName - * @memberof google.cloud.retail.v2beta.Catalog - * @instance - */ - Catalog.prototype.displayName = ""; + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Catalog productLevelConfig. - * @member {google.cloud.retail.v2beta.IProductLevelConfig|null|undefined} productLevelConfig - * @memberof google.cloud.retail.v2beta.Catalog - * @instance - */ - Catalog.prototype.productLevelConfig = null; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new Catalog instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Catalog} Catalog instance - */ - Catalog.create = function create(properties) { - return new Catalog(properties); - }; + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Catalog.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) - $root.google.cloud.retail.v2beta.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; - /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Catalog message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Catalog} Catalog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Catalog.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Catalog(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": case 1: - message.name = reader.string(); + message.mode = 1; break; + case "ENABLED": case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); + message.mode = 2; break; } - } - return message; - }; - - /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Catalog} Catalog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Catalog.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Catalog message. - * @function verify - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Catalog.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2beta.ProductLevelConfig.verify(message.productLevelConfig); - if (error) - return "productLevelConfig." + error; - } - return null; - }; + return message; + }; - /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Catalog} Catalog - */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Catalog) + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; return object; - var message = new $root.google.cloud.retail.v2beta.Catalog(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.fromObject(object.productLevelConfig); - } - return message; - }; - - /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Catalog - * @static - * @param {google.cloud.retail.v2beta.Catalog} message Catalog - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Catalog.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.toObject(message.productLevelConfig, options); - return object; - }; - - /** - * Converts this Catalog to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Catalog - * @instance - * @returns {Object.} JSON object - */ - Catalog.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Catalog; - })(); - - /** - * SolutionType enum. - * @name google.cloud.retail.v2beta.SolutionType - * @enum {number} - * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value - * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value - * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value - */ - v2beta.SolutionType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; - values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; - return values; - })(); - - v2beta.Condition = (function() { - - /** - * Properties of a Condition. - * @memberof google.cloud.retail.v2beta - * @interface ICondition - * @property {Array.|null} [queryTerms] Condition queryTerms - * @property {Array.|null} [activeTimeRange] Condition activeTimeRange - */ - - /** - * Constructs a new Condition. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Condition. - * @implements ICondition - * @constructor - * @param {google.cloud.retail.v2beta.ICondition=} [properties] Properties to set - */ - function Condition(properties) { - this.queryTerms = []; - this.activeTimeRange = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Condition queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2beta.Condition - * @instance - */ - Condition.prototype.queryTerms = $util.emptyArray; - - /** - * Condition activeTimeRange. - * @member {Array.} activeTimeRange - * @memberof google.cloud.retail.v2beta.Condition - * @instance - */ - Condition.prototype.activeTimeRange = $util.emptyArray; - - /** - * Creates a new Condition instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {google.cloud.retail.v2beta.ICondition=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Condition} Condition instance - */ - Condition.create = function create(properties) { - return new Condition(properties); - }; - - /** - * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {google.cloud.retail.v2beta.ICondition} message Condition message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Condition.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - $root.google.cloud.retail.v2beta.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeTimeRange != null && message.activeTimeRange.length) - for (var i = 0; i < message.activeTimeRange.length; ++i) - $root.google.cloud.retail.v2beta.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {google.cloud.retail.v2beta.ICondition} message Condition message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Condition.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Condition message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Condition} Condition - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Condition.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push($root.google.cloud.retail.v2beta.Condition.QueryTerm.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.activeTimeRange && message.activeTimeRange.length)) - message.activeTimeRange = []; - message.activeTimeRange.push($root.google.cloud.retail.v2beta.Condition.TimeRange.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Condition message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Condition} Condition - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Condition.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Condition message. - * @function verify - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Condition.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Condition.QueryTerm.verify(message.queryTerms[i]); - if (error) - return "queryTerms." + error; - } - } - if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { - if (!Array.isArray(message.activeTimeRange)) - return "activeTimeRange: array expected"; - for (var i = 0; i < message.activeTimeRange.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Condition.TimeRange.verify(message.activeTimeRange[i]); - if (error) - return "activeTimeRange." + error; - } - } - return null; - }; + }; - /** - * Creates a Condition message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Condition} Condition - */ - Condition.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Condition) - return object; - var message = new $root.google.cloud.retail.v2beta.Condition(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2beta.Condition.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) { - if (typeof object.queryTerms[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Condition.queryTerms: object expected"); - message.queryTerms[i] = $root.google.cloud.retail.v2beta.Condition.QueryTerm.fromObject(object.queryTerms[i]); - } - } - if (object.activeTimeRange) { - if (!Array.isArray(object.activeTimeRange)) - throw TypeError(".google.cloud.retail.v2beta.Condition.activeTimeRange: array expected"); - message.activeTimeRange = []; - for (var i = 0; i < object.activeTimeRange.length; ++i) { - if (typeof object.activeTimeRange[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Condition.activeTimeRange: object expected"); - message.activeTimeRange[i] = $root.google.cloud.retail.v2beta.Condition.TimeRange.fromObject(object.activeTimeRange[i]); - } - } - return message; - }; + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a plain object from a Condition message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Condition - * @static - * @param {google.cloud.retail.v2beta.Condition} message Condition - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Condition.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.queryTerms = []; - object.activeTimeRange = []; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = $root.google.cloud.retail.v2beta.Condition.QueryTerm.toObject(message.queryTerms[j], options); - } - if (message.activeTimeRange && message.activeTimeRange.length) { - object.activeTimeRange = []; - for (var j = 0; j < message.activeTimeRange.length; ++j) - object.activeTimeRange[j] = $root.google.cloud.retail.v2beta.Condition.TimeRange.toObject(message.activeTimeRange[j], options); - } - return object; - }; + /** + * Mode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); - /** - * Converts this Condition to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Condition - * @instance - * @returns {Object.} JSON object - */ - Condition.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return DynamicFacetSpec; + })(); - Condition.QueryTerm = (function() { + SearchRequest.BoostSpec = (function() { /** - * Properties of a QueryTerm. - * @memberof google.cloud.retail.v2beta.Condition - * @interface IQueryTerm - * @property {string|null} [value] QueryTerm value - * @property {boolean|null} [fullMatch] QueryTerm fullMatch + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs */ /** - * Constructs a new QueryTerm. - * @memberof google.cloud.retail.v2beta.Condition - * @classdesc Represents a QueryTerm. - * @implements IQueryTerm + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec * @constructor - * @param {google.cloud.retail.v2beta.Condition.IQueryTerm=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set */ - function QueryTerm(properties) { + function BoostSpec(properties) { + this.conditionBoostSpecs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -52970,88 +50709,78 @@ } /** - * QueryTerm value. - * @member {string} value - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm - * @instance - */ - QueryTerm.prototype.value = ""; - - /** - * QueryTerm fullMatch. - * @member {boolean} fullMatch - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @instance */ - QueryTerm.prototype.fullMatch = false; + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; /** - * Creates a new QueryTerm instance using the specified properties. + * Creates a new BoostSpec instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static - * @param {google.cloud.retail.v2beta.Condition.IQueryTerm=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm instance + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec instance */ - QueryTerm.create = function create(properties) { - return new QueryTerm(properties); + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); }; /** - * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static - * @param {google.cloud.retail.v2beta.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - QueryTerm.encode = function encode(message, writer) { + BoostSpec.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static - * @param {google.cloud.retail.v2beta.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a QueryTerm message from the specified reader or buffer. + * Decodes a BoostSpec message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryTerm.decode = function decode(reader, length) { + BoostSpec.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition.QueryTerm(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.value = reader.string(); - break; - case 2: - message.fullMatch = reader.bool(); + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -53062,117 +50791,335 @@ }; /** - * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryTerm.decodeDelimited = function decodeDelimited(reader) { + BoostSpec.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a QueryTerm message. + * Verifies a BoostSpec message. * @function verify - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - QueryTerm.verify = function verify(message) { + BoostSpec.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) - if (typeof message.fullMatch !== "boolean") - return "fullMatch: boolean expected"; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } return null; }; /** - * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec */ - QueryTerm.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Condition.QueryTerm) + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec) return object; - var message = new $root.google.cloud.retail.v2beta.Condition.QueryTerm(); - if (object.value != null) - message.value = String(object.value); - if (object.fullMatch != null) - message.fullMatch = Boolean(object.fullMatch); + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } return message; }; /** - * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @static - * @param {google.cloud.retail.v2beta.Condition.QueryTerm} message QueryTerm + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} message BoostSpec * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - QueryTerm.toObject = function toObject(message, options) { + BoostSpec.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.value = ""; - object.fullMatch = false; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) - object.fullMatch = message.fullMatch; return object; }; /** - * Converts this QueryTerm to JSON. + * Converts this BoostSpec to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec * @instance * @returns {Object.} JSON object */ - QueryTerm.prototype.toJSON = function toJSON() { + BoostSpec.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return QueryTerm; + BoostSpec.ConditionBoostSpec = (function() { + + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ + + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; + + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConditionBoostSpec; + })(); + + return BoostSpec; })(); - Condition.TimeRange = (function() { + SearchRequest.QueryExpansionSpec = (function() { /** - * Properties of a TimeRange. - * @memberof google.cloud.retail.v2beta.Condition - * @interface ITimeRange - * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime - * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults */ /** - * Constructs a new TimeRange. - * @memberof google.cloud.retail.v2beta.Condition - * @classdesc Represents a TimeRange. - * @implements ITimeRange + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec * @constructor - * @param {google.cloud.retail.v2beta.Condition.ITimeRange=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set */ - function TimeRange(properties) { + function QueryExpansionSpec(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -53180,88 +51127,88 @@ } /** - * TimeRange startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @instance */ - TimeRange.prototype.startTime = null; + QueryExpansionSpec.prototype.condition = 0; /** - * TimeRange endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @instance */ - TimeRange.prototype.endTime = null; + QueryExpansionSpec.prototype.pinUnexpandedResults = false; /** - * Creates a new TimeRange instance using the specified properties. + * Creates a new QueryExpansionSpec instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static - * @param {google.cloud.retail.v2beta.Condition.ITimeRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange instance + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance */ - TimeRange.create = function create(properties) { - return new TimeRange(properties); + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); }; /** - * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static - * @param {google.cloud.retail.v2beta.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TimeRange.encode = function encode(message, writer) { + QueryExpansionSpec.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); return writer; }; /** - * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static - * @param {google.cloud.retail.v2beta.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TimeRange.encodeDelimited = function encodeDelimited(message, writer) { + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TimeRange message from the specified reader or buffer. + * Decodes a QueryExpansionSpec message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeRange.decode = function decode(reader, length) { + QueryExpansionSpec.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition.TimeRange(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.condition = reader.int32(); break; case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.pinUnexpandedResults = reader.bool(); break; default: reader.skipType(tag & 7); @@ -53272,137 +51219,200 @@ }; /** - * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeRange.decodeDelimited = function decodeDelimited(reader) { + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TimeRange message. + * Verifies a QueryExpansionSpec message. * @function verify - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeRange.verify = function verify(message) { + QueryExpansionSpec.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; return null; }; /** - * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec */ - TimeRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Condition.TimeRange) + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec) return object; - var message = new $root.google.cloud.retail.v2beta.Condition.TimeRange(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.Condition.TimeRange.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.Condition.TimeRange.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); return message; }; /** - * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @static - * @param {google.cloud.retail.v2beta.Condition.TimeRange} message TimeRange + * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TimeRange.toObject = function toObject(message, options) { + QueryExpansionSpec.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.startTime = null; - object.endTime = null; + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; return object; }; /** - * Converts this TimeRange to JSON. + * Converts this QueryExpansionSpec to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec * @instance * @returns {Object.} JSON object */ - TimeRange.prototype.toJSON = function toJSON() { + QueryExpansionSpec.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return TimeRange; + /** + * Condition enum. + * @name google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; })(); - return Condition; + /** + * RelevanceThreshold enum. + * @name google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold + * @enum {number} + * @property {number} RELEVANCE_THRESHOLD_UNSPECIFIED=0 RELEVANCE_THRESHOLD_UNSPECIFIED value + * @property {number} HIGH=1 HIGH value + * @property {number} MEDIUM=2 MEDIUM value + * @property {number} LOW=3 LOW value + * @property {number} LOWEST=4 LOWEST value + */ + SearchRequest.RelevanceThreshold = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RELEVANCE_THRESHOLD_UNSPECIFIED"] = 0; + values[valuesById[1] = "HIGH"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + values[valuesById[3] = "LOW"] = 3; + values[valuesById[4] = "LOWEST"] = 4; + return values; + })(); + + /** + * SearchMode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + */ + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); + + return SearchRequest; })(); - v2beta.Rule = (function() { + v2alpha.SearchResponse = (function() { /** - * Properties of a Rule. - * @memberof google.cloud.retail.v2beta - * @interface IRule - * @property {google.cloud.retail.v2beta.Rule.IBoostAction|null} [boostAction] Rule boostAction - * @property {google.cloud.retail.v2beta.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction - * @property {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction - * @property {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction - * @property {google.cloud.retail.v2beta.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction - * @property {google.cloud.retail.v2beta.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction - * @property {google.cloud.retail.v2beta.Rule.IFilterAction|null} [filterAction] Rule filterAction - * @property {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction - * @property {google.cloud.retail.v2beta.ICondition|null} [condition] Rule condition + * Properties of a SearchResponse. + * @memberof google.cloud.retail.v2alpha + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls */ /** - * Constructs a new Rule. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Rule. - * @implements IRule + * Constructs a new SearchResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse * @constructor - * @param {google.cloud.retail.v2beta.IRule=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set */ - function Rule(properties) { + function SearchResponse(properties) { + this.results = []; + this.facets = []; + this.appliedControls = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -53410,193 +51420,188 @@ } /** - * Rule boostAction. - * @member {google.cloud.retail.v2beta.Rule.IBoostAction|null|undefined} boostAction - * @memberof google.cloud.retail.v2beta.Rule - * @instance - */ - Rule.prototype.boostAction = null; - - /** - * Rule redirectAction. - * @member {google.cloud.retail.v2beta.Rule.IRedirectAction|null|undefined} redirectAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.redirectAction = null; + SearchResponse.prototype.results = $util.emptyArray; /** - * Rule onewaySynonymsAction. - * @member {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.onewaySynonymsAction = null; + SearchResponse.prototype.facets = $util.emptyArray; /** - * Rule doNotAssociateAction. - * @member {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.doNotAssociateAction = null; + SearchResponse.prototype.totalSize = 0; /** - * Rule replacementAction. - * @member {google.cloud.retail.v2beta.Rule.IReplacementAction|null|undefined} replacementAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.replacementAction = null; + SearchResponse.prototype.correctedQuery = ""; /** - * Rule ignoreAction. - * @member {google.cloud.retail.v2beta.Rule.IIgnoreAction|null|undefined} ignoreAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.ignoreAction = null; + SearchResponse.prototype.attributionToken = ""; /** - * Rule filterAction. - * @member {google.cloud.retail.v2beta.Rule.IFilterAction|null|undefined} filterAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.filterAction = null; + SearchResponse.prototype.nextPageToken = ""; /** - * Rule twowaySynonymsAction. - * @member {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.twowaySynonymsAction = null; + SearchResponse.prototype.queryExpansionInfo = null; /** - * Rule condition. - * @member {google.cloud.retail.v2beta.ICondition|null|undefined} condition - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Rule.prototype.condition = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + SearchResponse.prototype.redirectUri = ""; /** - * Rule action. - * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action - * @memberof google.cloud.retail.v2beta.Rule + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance */ - Object.defineProperty(Rule.prototype, "action", { - get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), - set: $util.oneOfSetter($oneOfFields) - }); + SearchResponse.prototype.appliedControls = $util.emptyArray; /** - * Creates a new Rule instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static - * @param {google.cloud.retail.v2beta.IRule=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule} Rule instance + * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse instance */ - Rule.create = function create(properties) { - return new Rule(properties); + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); }; /** - * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static - * @param {google.cloud.retail.v2beta.IRule} message Rule message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rule.encode = function encode(message, writer) { + SearchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - $root.google.cloud.retail.v2beta.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) - $root.google.cloud.retail.v2beta.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) - $root.google.cloud.retail.v2beta.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) - $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) - $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) - $root.google.cloud.retail.v2beta.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) - $root.google.cloud.retail.v2beta.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) - $root.google.cloud.retail.v2beta.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) - $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); return writer; }; /** - * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static - * @param {google.cloud.retail.v2beta.IRule} message Rule message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rule.encodeDelimited = function encodeDelimited(message, writer) { + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Rule message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule} Rule + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.decode = function decode(reader, length) { + SearchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; case 2: - message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.decode(reader, reader.uint32()); + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); break; case 3: - message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.decode(reader, reader.uint32()); + message.totalSize = reader.int32(); break; - case 6: - message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + case 4: + message.correctedQuery = reader.string(); break; - case 7: - message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + case 5: + message.attributionToken = reader.string(); break; - case 8: - message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.decode(reader, reader.uint32()); + case 6: + message.nextPageToken = reader.string(); break; - case 9: - message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.decode(reader, reader.uint32()); + case 7: + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); break; case 10: - message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.decode(reader, reader.uint32()); - break; - case 11: - message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + message.redirectUri = reader.string(); break; - case 1: - message.condition = $root.google.cloud.retail.v2beta.Condition.decode(reader, reader.uint32()); + case 12: + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -53607,269 +51612,228 @@ }; /** - * Decodes a Rule message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule} Rule + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.decodeDelimited = function decodeDelimited(reader) { + SearchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Rule message. + * Verifies a SearchResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rule.verify = function verify(message) { + SearchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.boostAction != null && message.hasOwnProperty("boostAction")) { - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.BoostAction.verify(message.boostAction); - if (error) - return "boostAction." + error; - } - } - if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.RedirectAction.verify(message.redirectAction); - if (error) - return "redirectAction." + error; - } - } - if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); - if (error) - return "onewaySynonymsAction." + error; - } - } - if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); - if (error) - return "doNotAssociateAction." + error; - } - } - if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.verify(message.replacementAction); - if (error) - return "replacementAction." + error; - } - } - if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.verify(message.ignoreAction); - if (error) - return "ignoreAction." + error; - } - } - if (message.filterAction != null && message.hasOwnProperty("filterAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.FilterAction.verify(message.filterAction); + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify(message.results[i]); if (error) - return "filterAction." + error; + return "results." + error; } } - if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.verify(message.facets[i]); if (error) - return "twowaySynonymsAction." + error; + return "facets." + error; } } - if (message.condition != null && message.hasOwnProperty("condition")) { - var error = $root.google.cloud.retail.v2beta.Condition.verify(message.condition); + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); if (error) - return "condition." + error; + return "queryExpansionInfo." + error; + } + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; } return null; }; /** - * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule} Rule + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse */ - Rule.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule) + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse) return object; - var message = new $root.google.cloud.retail.v2beta.Rule(); - if (object.boostAction != null) { - if (typeof object.boostAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.boostAction: object expected"); - message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.fromObject(object.boostAction); + var message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.fromObject(object.results[i]); + } } - if (object.redirectAction != null) { - if (typeof object.redirectAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.redirectAction: object expected"); - message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.fromObject(object.redirectAction); + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.fromObject(object.facets[i]); + } } - if (object.onewaySynonymsAction != null) { - if (typeof object.onewaySynonymsAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.onewaySynonymsAction: object expected"); - message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); } - if (object.doNotAssociateAction != null) { - if (typeof object.doNotAssociateAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.doNotAssociateAction: object expected"); - message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); - } - if (object.replacementAction != null) { - if (typeof object.replacementAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.replacementAction: object expected"); - message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.fromObject(object.replacementAction); - } - if (object.ignoreAction != null) { - if (typeof object.ignoreAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.ignoreAction: object expected"); - message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.fromObject(object.ignoreAction); - } - if (object.filterAction != null) { - if (typeof object.filterAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.filterAction: object expected"); - message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.fromObject(object.filterAction); - } - if (object.twowaySynonymsAction != null) { - if (typeof object.twowaySynonymsAction !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.twowaySynonymsAction: object expected"); - message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); - } - if (object.condition != null) { - if (typeof object.condition !== "object") - throw TypeError(".google.cloud.retail.v2beta.Rule.condition: object expected"); - message.condition = $root.google.cloud.retail.v2beta.Condition.fromObject(object.condition); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); } return message; }; /** - * Creates a plain object from a Rule message. Also converts values to other types if specified. + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @static - * @param {google.cloud.retail.v2beta.Rule} message Rule + * @param {google.cloud.retail.v2alpha.SearchResponse} message SearchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Rule.toObject = function toObject(message, options) { + SearchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.condition = null; - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = $root.google.cloud.retail.v2beta.Condition.toObject(message.condition, options); - if (message.boostAction != null && message.hasOwnProperty("boostAction")) { - object.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.toObject(message.boostAction, options); - if (options.oneofs) - object.action = "boostAction"; - } - if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { - object.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.toObject(message.redirectAction, options); - if (options.oneofs) - object.action = "redirectAction"; - } - if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { - object.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); - if (options.oneofs) - object.action = "onewaySynonymsAction"; - } - if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { - object.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); - if (options.oneofs) - object.action = "doNotAssociateAction"; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + object.appliedControls = []; } - if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { - object.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.toObject(message.replacementAction, options); - if (options.oneofs) - object.action = "replacementAction"; + if (options.defaults) { + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; } - if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { - object.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.toObject(message.ignoreAction, options); - if (options.oneofs) - object.action = "ignoreAction"; + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.toObject(message.results[j], options); } - if (message.filterAction != null && message.hasOwnProperty("filterAction")) { - object.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.toObject(message.filterAction, options); - if (options.oneofs) - object.action = "filterAction"; + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.toObject(message.facets[j], options); } - if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { - object.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); - if (options.oneofs) - object.action = "twowaySynonymsAction"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; } return object; }; /** - * Converts this Rule to JSON. + * Converts this SearchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule + * @memberof google.cloud.retail.v2alpha.SearchResponse * @instance * @returns {Object.} JSON object */ - Rule.prototype.toJSON = function toJSON() { + SearchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - Rule.BoostAction = (function() { + SearchResponse.SearchResult = (function() { /** - * Properties of a BoostAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IBoostAction - * @property {number|null} [boost] BoostAction boost - * @property {string|null} [productsFilter] BoostAction productsFilter + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues */ /** - * Constructs a new BoostAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents a BoostAction. - * @implements IBoostAction + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult * @constructor - * @param {google.cloud.retail.v2beta.Rule.IBoostAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set */ - function BoostAction(properties) { + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -53877,88 +51841,171 @@ } /** - * BoostAction boost. - * @member {number} boost - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @instance */ - BoostAction.prototype.boost = 0; + SearchResult.prototype.id = ""; /** - * BoostAction productsFilter. - * @member {string} productsFilter - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * SearchResult product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @instance */ - BoostAction.prototype.productsFilter = ""; + SearchResult.prototype.product = null; /** - * Creates a new BoostAction instance using the specified properties. + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; + + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; + + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; + + /** + * Creates a new SearchResult instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static - * @param {google.cloud.retail.v2beta.Rule.IBoostAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction instance + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult instance */ - BoostAction.create = function create(properties) { - return new BoostAction(properties); + SearchResult.create = function create(properties) { + return new SearchResult(properties); }; /** - * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static - * @param {google.cloud.retail.v2beta.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoostAction.encode = function encode(message, writer) { + SearchResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); - if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } return writer; }; /** - * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static - * @param {google.cloud.retail.v2beta.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoostAction message from the specified reader or buffer. + * Decodes a SearchResult message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoostAction.decode = function decode(reader, length) { + SearchResult.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.BoostAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boost = reader.float(); + message.id = reader.string(); break; case 2: - message.productsFilter = reader.string(); + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; break; default: reader.skipType(tag & 7); @@ -53969,116 +52016,187 @@ }; /** - * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * Decodes a SearchResult message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoostAction.decodeDelimited = function decodeDelimited(reader) { + SearchResult.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoostAction message. + * Verifies a SearchResult message. * @function verify - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoostAction.verify = function verify(message) { + SearchResult.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) - if (!$util.isString(message.productsFilter)) - return "productsFilter: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } return null; }; /** - * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult */ - BoostAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.BoostAction) + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult) return object; - var message = new $root.google.cloud.retail.v2beta.Rule.BoostAction(); - if (object.boost != null) - message.boost = Number(object.boost); - if (object.productsFilter != null) - message.productsFilter = String(object.productsFilter); + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } return message; }; /** - * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @static - * @param {google.cloud.retail.v2beta.Rule.BoostAction} message BoostAction + * @param {google.cloud.retail.v2alpha.SearchResponse.SearchResult} message SearchResult * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoostAction.toObject = function toObject(message, options) { + SearchResult.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; + } if (options.defaults) { - object.boost = 0; - object.productsFilter = ""; + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); } - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) - object.productsFilter = message.productsFilter; return object; }; /** - * Converts this BoostAction to JSON. + * Converts this SearchResult to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult * @instance * @returns {Object.} JSON object */ - BoostAction.prototype.toJSON = function toJSON() { + SearchResult.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoostAction; + return SearchResult; })(); - Rule.FilterAction = (function() { + SearchResponse.Facet = (function() { /** - * Properties of a FilterAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IFilterAction - * @property {string|null} [filter] FilterAction filter + * Properties of a Facet. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet */ /** - * Constructs a new FilterAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents a FilterAction. - * @implements IFilterAction + * Constructs a new Facet. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet * @constructor - * @param {google.cloud.retail.v2beta.Rule.IFilterAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set */ - function FilterAction(properties) { + function Facet(properties) { + this.values = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54086,75 +52204,104 @@ } /** - * FilterAction filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @instance */ - FilterAction.prototype.filter = ""; + Facet.prototype.key = ""; /** - * Creates a new FilterAction instance using the specified properties. + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; + + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; + + /** + * Creates a new Facet instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2beta.Rule.IFilterAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction instance + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet instance */ - FilterAction.create = function create(properties) { - return new FilterAction(properties); + Facet.create = function create(properties) { + return new Facet(properties); }; /** - * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2beta.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FilterAction.encode = function encode(message, writer) { + Facet.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); return writer; }; /** - * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2beta.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + Facet.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FilterAction message from the specified reader or buffer. + * Decodes a Facet message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FilterAction.decode = function decode(reader, length) { + Facet.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.FilterAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.filter = reader.string(); + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); break; default: reader.skipType(tag & 7); @@ -54165,107 +52312,419 @@ }; /** - * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * Decodes a Facet message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FilterAction.decodeDelimited = function decodeDelimited(reader) { + Facet.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FilterAction message. + * Verifies a Facet message. * @function verify - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FilterAction.verify = function verify(message) { + Facet.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; return null; }; /** - * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * Creates a Facet message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet */ - FilterAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.FilterAction) + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet) return object; - var message = new $root.google.cloud.retail.v2beta.Rule.FilterAction(); - if (object.filter != null) - message.filter = String(object.filter); + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); return message; }; /** - * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * Creates a plain object from a Facet message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2beta.Rule.FilterAction} message FilterAction + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet} message Facet * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FilterAction.toObject = function toObject(message, options) { + Facet.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.filter = ""; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; return object; }; /** - * Converts this FilterAction to JSON. + * Converts this Facet to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet * @instance * @returns {Object.} JSON object */ - FilterAction.prototype.toJSON = function toJSON() { + Facet.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FilterAction; + Facet.FacetValue = (function() { + + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2alpha.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ + + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; + + /** + * FacetValue interval. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; + + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2alpha.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; + + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetValue; + })(); + + return Facet; })(); - Rule.RedirectAction = (function() { + SearchResponse.QueryExpansionInfo = (function() { /** - * Properties of a RedirectAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IRedirectAction - * @property {string|null} [redirectUri] RedirectAction redirectUri + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount */ /** - * Constructs a new RedirectAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents a RedirectAction. - * @implements IRedirectAction + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo * @constructor - * @param {google.cloud.retail.v2beta.Rule.IRedirectAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set */ - function RedirectAction(properties) { + function QueryExpansionInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54273,75 +52732,88 @@ } /** - * RedirectAction redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @instance */ - RedirectAction.prototype.redirectUri = ""; + QueryExpansionInfo.prototype.expandedQuery = false; /** - * Creates a new RedirectAction instance using the specified properties. + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2beta.Rule.IRedirectAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction instance + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance */ - RedirectAction.create = function create(properties) { - return new RedirectAction(properties); + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); }; /** - * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2beta.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RedirectAction.encode = function encode(message, writer) { + QueryExpansionInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); return writer; }; /** - * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2beta.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RedirectAction message from the specified reader or buffer. + * Decodes a QueryExpansionInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RedirectAction.decode = function decode(reader, length) { + QueryExpansionInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.RedirectAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.redirectUri = reader.string(); + message.expandedQuery = reader.bool(); + break; + case 2: + message.pinnedResultCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -54352,1423 +52824,906 @@ }; /** - * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RedirectAction.decodeDelimited = function decodeDelimited(reader) { + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RedirectAction message. + * Verifies a QueryExpansionInfo message. * @function verify - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RedirectAction.verify = function verify(message) { + QueryExpansionInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; return null; }; /** - * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo */ - RedirectAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.RedirectAction) + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo) return object; - var message = new $root.google.cloud.retail.v2beta.Rule.RedirectAction(); - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2beta.Rule.RedirectAction} message RedirectAction + * @param {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RedirectAction.toObject = function toObject(message, options) { + QueryExpansionInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.redirectUri = ""; - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; + if (options.defaults) { + object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; return object; }; /** - * Converts this RedirectAction to JSON. + * Converts this QueryExpansionInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo * @instance * @returns {Object.} JSON object */ - RedirectAction.prototype.toJSON = function toJSON() { + QueryExpansionInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RedirectAction; + return QueryExpansionInfo; })(); - Rule.TwowaySynonymsAction = (function() { + return SearchResponse; + })(); - /** - * Properties of a TwowaySynonymsAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface ITwowaySynonymsAction - * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms - */ + v2alpha.UserEventService = (function() { - /** - * Constructs a new TwowaySynonymsAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents a TwowaySynonymsAction. - * @implements ITwowaySynonymsAction - * @constructor - * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction=} [properties] Properties to set - */ - function TwowaySynonymsAction(properties) { - this.synonyms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new UserEventService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a UserEventService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function UserEventService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * TwowaySynonymsAction synonyms. - * @member {Array.} synonyms - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @instance - */ - TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; + (UserEventService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UserEventService; - /** - * Creates a new TwowaySynonymsAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance - */ - TwowaySynonymsAction.create = function create(properties) { - return new TwowaySynonymsAction(properties); - }; + /** + * Creates new UserEventService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {UserEventService} RPC service. Useful where requests and/or responses are streamed. + */ + UserEventService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TwowaySynonymsAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.synonyms != null && message.synonyms.length) - for (var i = 0; i < message.synonyms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); - return writer; - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef WriteUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.UserEvent} [response] UserEvent + */ - /** - * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.WriteUserEventCallback} callback Node-style callback called with the error, if any, and UserEvent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.writeUserEvent = function writeUserEvent(request, callback) { + return this.rpcCall(writeUserEvent, $root.google.cloud.retail.v2alpha.WriteUserEventRequest, $root.google.cloud.retail.v2alpha.UserEvent, request, callback); + }, "name", { value: "WriteUserEvent" }); - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TwowaySynonymsAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Calls WriteUserEvent. + * @function writeUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} request WriteUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef CollectUserEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.HttpBody} [response] HttpBody + */ - /** - * Verifies a TwowaySynonymsAction message. - * @function verify - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TwowaySynonymsAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.synonyms != null && message.hasOwnProperty("synonyms")) { - if (!Array.isArray(message.synonyms)) - return "synonyms: array expected"; - for (var i = 0; i < message.synonyms.length; ++i) - if (!$util.isString(message.synonyms[i])) - return "synonyms: string[] expected"; - } - return null; - }; + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.CollectUserEventCallback} callback Node-style callback called with the error, if any, and HttpBody + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.collectUserEvent = function collectUserEvent(request, callback) { + return this.rpcCall(collectUserEvent, $root.google.cloud.retail.v2alpha.CollectUserEventRequest, $root.google.api.HttpBody, request, callback); + }, "name", { value: "CollectUserEvent" }); - /** - * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction - */ - TwowaySynonymsAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction) - return object; - var message = new $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction(); - if (object.synonyms) { - if (!Array.isArray(object.synonyms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.synonyms: array expected"); - message.synonyms = []; - for (var i = 0; i < object.synonyms.length; ++i) - message.synonyms[i] = String(object.synonyms[i]); - } - return message; - }; + /** + * Calls CollectUserEvent. + * @function collectUserEvent + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} request CollectUserEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} message TwowaySynonymsAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TwowaySynonymsAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.synonyms = []; - if (message.synonyms && message.synonyms.length) { - object.synonyms = []; - for (var j = 0; j < message.synonyms.length; ++j) - object.synonyms[j] = message.synonyms[j]; - } - return object; - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef PurgeUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * Converts this TwowaySynonymsAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction - * @instance - * @returns {Object.} JSON object - */ - TwowaySynonymsAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.PurgeUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.purgeUserEvents = function purgeUserEvents(request, callback) { + return this.rpcCall(purgeUserEvents, $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeUserEvents" }); - return TwowaySynonymsAction; - })(); + /** + * Calls PurgeUserEvents. + * @function purgeUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} request PurgeUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - Rule.OnewaySynonymsAction = (function() { + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef ImportUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * Properties of an OnewaySynonymsAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IOnewaySynonymsAction - * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms - * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms - * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms - */ + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.ImportUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.importUserEvents = function importUserEvents(request, callback) { + return this.rpcCall(importUserEvents, $root.google.cloud.retail.v2alpha.ImportUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportUserEvents" }); - /** - * Constructs a new OnewaySynonymsAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents an OnewaySynonymsAction. - * @implements IOnewaySynonymsAction - * @constructor - * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction=} [properties] Properties to set - */ - function OnewaySynonymsAction(properties) { - this.queryTerms = []; - this.synonyms = []; - this.onewayTerms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Calls ImportUserEvents. + * @function importUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} request ImportUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * OnewaySynonymsAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * @memberof google.cloud.retail.v2alpha.UserEventService + * @typedef RejoinUserEventsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * OnewaySynonymsAction synonyms. - * @member {Array.} synonyms - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @param {google.cloud.retail.v2alpha.UserEventService.RejoinUserEventsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UserEventService.prototype.rejoinUserEvents = function rejoinUserEvents(request, callback) { + return this.rpcCall(rejoinUserEvents, $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RejoinUserEvents" }); - /** - * OnewaySynonymsAction onewayTerms. - * @member {Array.} onewayTerms - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; + /** + * Calls RejoinUserEvents. + * @function rejoinUserEvents + * @memberof google.cloud.retail.v2alpha.UserEventService + * @instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} request RejoinUserEventsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a new OnewaySynonymsAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance - */ - OnewaySynonymsAction.create = function create(properties) { - return new OnewaySynonymsAction(properties); - }; + return UserEventService; + })(); - /** - * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnewaySynonymsAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.onewayTerms != null && message.onewayTerms.length) - for (var i = 0; i < message.onewayTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); - if (message.synonyms != null && message.synonyms.length) - for (var i = 0; i < message.synonyms.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); - return writer; - }; + v2alpha.WriteUserEventRequest = (function() { - /** - * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a WriteUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IWriteUserEventRequest + * @property {string|null} [parent] WriteUserEventRequest parent + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] WriteUserEventRequest userEvent + */ - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnewaySynonymsAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 4: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - case 2: - if (!(message.onewayTerms && message.onewayTerms.length)) - message.onewayTerms = []; - message.onewayTerms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Constructs a new WriteUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a WriteUserEventRequest. + * @implements IWriteUserEventRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + */ + function WriteUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * WriteUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.parent = ""; - /** - * Verifies an OnewaySynonymsAction message. - * @function verify - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OnewaySynonymsAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.synonyms != null && message.hasOwnProperty("synonyms")) { - if (!Array.isArray(message.synonyms)) - return "synonyms: array expected"; - for (var i = 0; i < message.synonyms.length; ++i) - if (!$util.isString(message.synonyms[i])) - return "synonyms: string[] expected"; - } - if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { - if (!Array.isArray(message.onewayTerms)) - return "onewayTerms: array expected"; - for (var i = 0; i < message.onewayTerms.length; ++i) - if (!$util.isString(message.onewayTerms[i])) - return "onewayTerms: string[] expected"; - } - return null; - }; + /** + * WriteUserEventRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + */ + WriteUserEventRequest.prototype.userEvent = null; - /** - * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction - */ - OnewaySynonymsAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction) - return object; - var message = new $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.synonyms) { - if (!Array.isArray(object.synonyms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.synonyms: array expected"); - message.synonyms = []; - for (var i = 0; i < object.synonyms.length; ++i) - message.synonyms[i] = String(object.synonyms[i]); - } - if (object.onewayTerms) { - if (!Array.isArray(object.onewayTerms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.onewayTerms: array expected"); - message.onewayTerms = []; - for (var i = 0; i < object.onewayTerms.length; ++i) - message.onewayTerms[i] = String(object.onewayTerms[i]); - } - return message; - }; + /** + * Creates a new WriteUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest instance + */ + WriteUserEventRequest.create = function create(properties) { + return new WriteUserEventRequest(properties); + }; - /** - * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @static - * @param {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} message OnewaySynonymsAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OnewaySynonymsAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.onewayTerms = []; - object.queryTerms = []; - object.synonyms = []; - } - if (message.onewayTerms && message.onewayTerms.length) { - object.onewayTerms = []; - for (var j = 0; j < message.onewayTerms.length; ++j) - object.onewayTerms[j] = message.onewayTerms[j]; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.synonyms && message.synonyms.length) { - object.synonyms = []; - for (var j = 0; j < message.synonyms.length; ++j) - object.synonyms[j] = message.synonyms[j]; - } - return object; - }; + /** + * Encodes the specified WriteUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Converts this OnewaySynonymsAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction - * @instance - * @returns {Object.} JSON object - */ - OnewaySynonymsAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified WriteUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.WriteUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.IWriteUserEventRequest} message WriteUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - return OnewaySynonymsAction; - })(); + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - Rule.DoNotAssociateAction = (function() { + /** + * Decodes a WriteUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Properties of a DoNotAssociateAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IDoNotAssociateAction - * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms - * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms - * @property {Array.|null} [terms] DoNotAssociateAction terms - */ + /** + * Verifies a WriteUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + return null; + }; - /** - * Constructs a new DoNotAssociateAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents a DoNotAssociateAction. - * @implements IDoNotAssociateAction - * @constructor - * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction=} [properties] Properties to set - */ - function DoNotAssociateAction(properties) { - this.queryTerms = []; - this.doNotAssociateTerms = []; - this.terms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a WriteUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.WriteUserEventRequest} WriteUserEventRequest + */ + WriteUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.WriteUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.WriteUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.WriteUserEventRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); } + return message; + }; - /** - * DoNotAssociateAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; + /** + * Creates a plain object from a WriteUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.WriteUserEventRequest} message WriteUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + return object; + }; - /** - * DoNotAssociateAction doNotAssociateTerms. - * @member {Array.} doNotAssociateTerms - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; + /** + * Converts this WriteUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + WriteUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * DoNotAssociateAction terms. - * @member {Array.} terms - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.terms = $util.emptyArray; + return WriteUserEventRequest; + })(); - /** - * Creates a new DoNotAssociateAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction instance - */ - DoNotAssociateAction.create = function create(properties) { - return new DoNotAssociateAction(properties); - }; + v2alpha.CollectUserEventRequest = (function() { - /** - * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoNotAssociateAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.terms != null && message.terms.length) - for (var i = 0; i < message.terms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); - if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) - for (var i = 0; i < message.doNotAssociateTerms.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); - return writer; - }; + /** + * Properties of a CollectUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICollectUserEventRequest + * @property {string|null} [parent] CollectUserEventRequest parent + * @property {string|null} [userEvent] CollectUserEventRequest userEvent + * @property {string|null} [uri] CollectUserEventRequest uri + * @property {number|Long|null} [ets] CollectUserEventRequest ets + */ - /** - * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new CollectUserEventRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CollectUserEventRequest. + * @implements ICollectUserEventRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + */ + function CollectUserEventRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DoNotAssociateAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) - message.doNotAssociateTerms = []; - message.doNotAssociateTerms.push(reader.string()); - break; - case 1: - if (!(message.terms && message.terms.length)) - message.terms = []; - message.terms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * CollectUserEventRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.parent = ""; - /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * CollectUserEventRequest userEvent. + * @member {string} userEvent + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.userEvent = ""; - /** - * Verifies a DoNotAssociateAction message. - * @function verify - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DoNotAssociateAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { - if (!Array.isArray(message.doNotAssociateTerms)) - return "doNotAssociateTerms: array expected"; - for (var i = 0; i < message.doNotAssociateTerms.length; ++i) - if (!$util.isString(message.doNotAssociateTerms[i])) - return "doNotAssociateTerms: string[] expected"; - } - if (message.terms != null && message.hasOwnProperty("terms")) { - if (!Array.isArray(message.terms)) - return "terms: array expected"; - for (var i = 0; i < message.terms.length; ++i) - if (!$util.isString(message.terms[i])) - return "terms: string[] expected"; - } - return null; - }; + /** + * CollectUserEventRequest uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.uri = ""; - /** - * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction - */ - DoNotAssociateAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction) - return object; - var message = new $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.doNotAssociateTerms) { - if (!Array.isArray(object.doNotAssociateTerms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); - message.doNotAssociateTerms = []; - for (var i = 0; i < object.doNotAssociateTerms.length; ++i) - message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); - } - if (object.terms) { - if (!Array.isArray(object.terms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.terms: array expected"); - message.terms = []; - for (var i = 0; i < object.terms.length; ++i) - message.terms[i] = String(object.terms[i]); - } - return message; - }; + /** + * CollectUserEventRequest ets. + * @member {number|Long} ets + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + */ + CollectUserEventRequest.prototype.ets = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @static - * @param {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} message DoNotAssociateAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DoNotAssociateAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.terms = []; - object.queryTerms = []; - object.doNotAssociateTerms = []; - } - if (message.terms && message.terms.length) { - object.terms = []; - for (var j = 0; j < message.terms.length; ++j) - object.terms[j] = message.terms[j]; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { - object.doNotAssociateTerms = []; - for (var j = 0; j < message.doNotAssociateTerms.length; ++j) - object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; - } - return object; - }; + /** + * Creates a new CollectUserEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest instance + */ + CollectUserEventRequest.create = function create(properties) { + return new CollectUserEventRequest(properties); + }; - /** - * Converts this DoNotAssociateAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction - * @instance - * @returns {Object.} JSON object - */ - DoNotAssociateAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified CollectUserEventRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.userEvent); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri); + if (message.ets != null && Object.hasOwnProperty.call(message, "ets")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.ets); + return writer; + }; - return DoNotAssociateAction; - })(); + /** + * Encodes the specified CollectUserEventRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CollectUserEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.ICollectUserEventRequest} message CollectUserEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectUserEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - Rule.ReplacementAction = (function() { + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.userEvent = reader.string(); + break; + case 3: + message.uri = reader.string(); + break; + case 4: + message.ets = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Properties of a ReplacementAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IReplacementAction - * @property {Array.|null} [queryTerms] ReplacementAction queryTerms - * @property {string|null} [replacementTerm] ReplacementAction replacementTerm - * @property {string|null} [term] ReplacementAction term - */ + /** + * Decodes a CollectUserEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectUserEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Constructs a new ReplacementAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents a ReplacementAction. - * @implements IReplacementAction - * @constructor - * @param {google.cloud.retail.v2beta.Rule.IReplacementAction=} [properties] Properties to set - */ - function ReplacementAction(properties) { - this.queryTerms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Verifies a CollectUserEventRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectUserEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + if (!$util.isString(message.userEvent)) + return "userEvent: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.ets != null && message.hasOwnProperty("ets")) + if (!$util.isInteger(message.ets) && !(message.ets && $util.isInteger(message.ets.low) && $util.isInteger(message.ets.high))) + return "ets: integer|Long expected"; + return null; + }; + + /** + * Creates a CollectUserEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CollectUserEventRequest} CollectUserEventRequest + */ + CollectUserEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CollectUserEventRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CollectUserEventRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.userEvent != null) + message.userEvent = String(object.userEvent); + if (object.uri != null) + message.uri = String(object.uri); + if (object.ets != null) + if ($util.Long) + (message.ets = $util.Long.fromValue(object.ets)).unsigned = false; + else if (typeof object.ets === "string") + message.ets = parseInt(object.ets, 10); + else if (typeof object.ets === "number") + message.ets = object.ets; + else if (typeof object.ets === "object") + message.ets = new $util.LongBits(object.ets.low >>> 0, object.ets.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a CollectUserEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {google.cloud.retail.v2alpha.CollectUserEventRequest} message CollectUserEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectUserEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.userEvent = ""; + object.uri = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ets = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ets = options.longs === String ? "0" : 0; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = message.userEvent; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ets != null && message.hasOwnProperty("ets")) + if (typeof message.ets === "number") + object.ets = options.longs === String ? String(message.ets) : message.ets; + else + object.ets = options.longs === String ? $util.Long.prototype.toString.call(message.ets) : options.longs === Number ? new $util.LongBits(message.ets.low >>> 0, message.ets.high >>> 0).toNumber() : message.ets; + return object; + }; - /** - * ReplacementAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @instance - */ - ReplacementAction.prototype.queryTerms = $util.emptyArray; + /** + * Converts this CollectUserEventRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @instance + * @returns {Object.} JSON object + */ + CollectUserEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * ReplacementAction replacementTerm. - * @member {string} replacementTerm - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @instance - */ - ReplacementAction.prototype.replacementTerm = ""; + return CollectUserEventRequest; + })(); - /** - * ReplacementAction term. - * @member {string} term - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @instance - */ - ReplacementAction.prototype.term = ""; + v2alpha.RejoinUserEventsRequest = (function() { - /** - * Creates a new ReplacementAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IReplacementAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction instance - */ - ReplacementAction.create = function create(properties) { - return new ReplacementAction(properties); - }; + /** + * Properties of a RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsRequest + * @property {string|null} [parent] RejoinUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope|null} [userEventRejoinScope] RejoinUserEventsRequest userEventRejoinScope + */ - /** - * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IReplacementAction} message ReplacementAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplacementAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.term != null && Object.hasOwnProperty.call(message, "term")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); - if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); - return writer; - }; + /** + * Constructs a new RejoinUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsRequest. + * @implements IRejoinUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + */ + function RejoinUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IReplacementAction} message ReplacementAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReplacementAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplacementAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.ReplacementAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - message.replacementTerm = reader.string(); - break; - case 1: - message.term = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplacementAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReplacementAction message. - * @function verify - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReplacementAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) - if (!$util.isString(message.replacementTerm)) - return "replacementTerm: string expected"; - if (message.term != null && message.hasOwnProperty("term")) - if (!$util.isString(message.term)) - return "term: string expected"; - return null; - }; - - /** - * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction - */ - ReplacementAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.ReplacementAction) - return object; - var message = new $root.google.cloud.retail.v2beta.Rule.ReplacementAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.ReplacementAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.replacementTerm != null) - message.replacementTerm = String(object.replacementTerm); - if (object.term != null) - message.term = String(object.term); - return message; - }; - - /** - * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @static - * @param {google.cloud.retail.v2beta.Rule.ReplacementAction} message ReplacementAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReplacementAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.queryTerms = []; - if (options.defaults) { - object.term = ""; - object.replacementTerm = ""; - } - if (message.term != null && message.hasOwnProperty("term")) - object.term = message.term; - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) - object.replacementTerm = message.replacementTerm; - return object; - }; - - /** - * Converts this ReplacementAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction - * @instance - * @returns {Object.} JSON object - */ - ReplacementAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ReplacementAction; - })(); - - Rule.IgnoreAction = (function() { - - /** - * Properties of an IgnoreAction. - * @memberof google.cloud.retail.v2beta.Rule - * @interface IIgnoreAction - * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms - */ - - /** - * Constructs a new IgnoreAction. - * @memberof google.cloud.retail.v2beta.Rule - * @classdesc Represents an IgnoreAction. - * @implements IIgnoreAction - * @constructor - * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction=} [properties] Properties to set - */ - function IgnoreAction(properties) { - this.ignoreTerms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IgnoreAction ignoreTerms. - * @member {Array.} ignoreTerms - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @instance - */ - IgnoreAction.prototype.ignoreTerms = $util.emptyArray; - - /** - * Creates a new IgnoreAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction instance - */ - IgnoreAction.create = function create(properties) { - return new IgnoreAction(properties); - }; - - /** - * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IgnoreAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ignoreTerms != null && message.ignoreTerms.length) - for (var i = 0; i < message.ignoreTerms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); - return writer; - }; - - /** - * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IgnoreAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IgnoreAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.IgnoreAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.ignoreTerms && message.ignoreTerms.length)) - message.ignoreTerms = []; - message.ignoreTerms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IgnoreAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IgnoreAction message. - * @function verify - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IgnoreAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { - if (!Array.isArray(message.ignoreTerms)) - return "ignoreTerms: array expected"; - for (var i = 0; i < message.ignoreTerms.length; ++i) - if (!$util.isString(message.ignoreTerms[i])) - return "ignoreTerms: string[] expected"; - } - return null; - }; - - /** - * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction - */ - IgnoreAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rule.IgnoreAction) - return object; - var message = new $root.google.cloud.retail.v2beta.Rule.IgnoreAction(); - if (object.ignoreTerms) { - if (!Array.isArray(object.ignoreTerms)) - throw TypeError(".google.cloud.retail.v2beta.Rule.IgnoreAction.ignoreTerms: array expected"); - message.ignoreTerms = []; - for (var i = 0; i < object.ignoreTerms.length; ++i) - message.ignoreTerms[i] = String(object.ignoreTerms[i]); - } - return message; - }; - - /** - * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @static - * @param {google.cloud.retail.v2beta.Rule.IgnoreAction} message IgnoreAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IgnoreAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.ignoreTerms = []; - if (message.ignoreTerms && message.ignoreTerms.length) { - object.ignoreTerms = []; - for (var j = 0; j < message.ignoreTerms.length; ++j) - object.ignoreTerms[j] = message.ignoreTerms[j]; - } - return object; - }; - - /** - * Converts this IgnoreAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction - * @instance - * @returns {Object.} JSON object - */ - IgnoreAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IgnoreAction; - })(); - - return Rule; - })(); - - v2beta.Audience = (function() { - - /** - * Properties of an Audience. - * @memberof google.cloud.retail.v2beta - * @interface IAudience - * @property {Array.|null} [genders] Audience genders - * @property {Array.|null} [ageGroups] Audience ageGroups - */ + /** + * RejoinUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @instance + */ + RejoinUserEventsRequest.prototype.parent = ""; /** - * Constructs a new Audience. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an Audience. - * @implements IAudience - * @constructor - * @param {google.cloud.retail.v2beta.IAudience=} [properties] Properties to set - */ - function Audience(properties) { - this.genders = []; - this.ageGroups = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Audience genders. - * @member {Array.} genders - * @memberof google.cloud.retail.v2beta.Audience - * @instance - */ - Audience.prototype.genders = $util.emptyArray; - - /** - * Audience ageGroups. - * @member {Array.} ageGroups - * @memberof google.cloud.retail.v2beta.Audience + * RejoinUserEventsRequest userEventRejoinScope. + * @member {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} userEventRejoinScope + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @instance */ - Audience.prototype.ageGroups = $util.emptyArray; + RejoinUserEventsRequest.prototype.userEventRejoinScope = 0; /** - * Creates a new Audience instance using the specified properties. + * Creates a new RejoinUserEventsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.IAudience=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Audience} Audience instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest instance */ - Audience.create = function create(properties) { - return new Audience(properties); + RejoinUserEventsRequest.create = function create(properties) { + return new RejoinUserEventsRequest(properties); }; /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * Encodes the specified RejoinUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.IAudience} message Audience message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Audience.encode = function encode(message, writer) { + RejoinUserEventsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.genders != null && message.genders.length) - for (var i = 0; i < message.genders.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); - if (message.ageGroups != null && message.ageGroups.length) - for (var i = 0; i < message.ageGroups.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.userEventRejoinScope != null && Object.hasOwnProperty.call(message, "userEventRejoinScope")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.userEventRejoinScope); return writer; }; /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. + * Encodes the specified RejoinUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.IAudience} message Audience message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsRequest} message RejoinUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Audience.encodeDelimited = function encodeDelimited(message, writer) { + RejoinUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Audience message from the specified reader or buffer. + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Audience} Audience + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Audience.decode = function decode(reader, length) { + RejoinUserEventsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Audience(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); + message.parent = reader.string(); break; case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); + message.userEventRejoinScope = reader.int32(); break; default: reader.skipType(tag & 7); @@ -55779,143 +53734,150 @@ }; /** - * Decodes an Audience message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Audience} Audience + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Audience.decodeDelimited = function decodeDelimited(reader) { + RejoinUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Audience message. + * Verifies a RejoinUserEventsRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Audience.verify = function verify(message) { + RejoinUserEventsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.genders != null && message.hasOwnProperty("genders")) { - if (!Array.isArray(message.genders)) - return "genders: array expected"; - for (var i = 0; i < message.genders.length; ++i) - if (!$util.isString(message.genders[i])) - return "genders: string[] expected"; - } - if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { - if (!Array.isArray(message.ageGroups)) - return "ageGroups: array expected"; - for (var i = 0; i < message.ageGroups.length; ++i) - if (!$util.isString(message.ageGroups[i])) - return "ageGroups: string[] expected"; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + switch (message.userEventRejoinScope) { + default: + return "userEventRejoinScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Audience} Audience + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsRequest} RejoinUserEventsRequest */ - Audience.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Audience) + RejoinUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest) return object; - var message = new $root.google.cloud.retail.v2beta.Audience(); - if (object.genders) { - if (!Array.isArray(object.genders)) - throw TypeError(".google.cloud.retail.v2beta.Audience.genders: array expected"); - message.genders = []; - for (var i = 0; i < object.genders.length; ++i) - message.genders[i] = String(object.genders[i]); - } - if (object.ageGroups) { - if (!Array.isArray(object.ageGroups)) - throw TypeError(".google.cloud.retail.v2beta.Audience.ageGroups: array expected"); - message.ageGroups = []; - for (var i = 0; i < object.ageGroups.length; ++i) - message.ageGroups[i] = String(object.ageGroups[i]); - } - return message; - }; - - /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.Audience + var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + switch (object.userEventRejoinScope) { + case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": + case 0: + message.userEventRejoinScope = 0; + break; + case "JOINED_EVENTS": + case 1: + message.userEventRejoinScope = 1; + break; + case "UNJOINED_EVENTS": + case 2: + message.userEventRejoinScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a RejoinUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @static - * @param {google.cloud.retail.v2beta.Audience} message Audience + * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest} message RejoinUserEventsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Audience.toObject = function toObject(message, options) { + RejoinUserEventsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.genders = []; - object.ageGroups = []; - } - if (message.genders && message.genders.length) { - object.genders = []; - for (var j = 0; j < message.genders.length; ++j) - object.genders[j] = message.genders[j]; - } - if (message.ageGroups && message.ageGroups.length) { - object.ageGroups = []; - for (var j = 0; j < message.ageGroups.length; ++j) - object.ageGroups[j] = message.ageGroups[j]; + if (options.defaults) { + object.parent = ""; + object.userEventRejoinScope = options.enums === String ? "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" : 0; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; return object; }; /** - * Converts this Audience to JSON. + * Converts this RejoinUserEventsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Audience + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest * @instance * @returns {Object.} JSON object */ - Audience.prototype.toJSON = function toJSON() { + RejoinUserEventsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Audience; + /** + * UserEventRejoinScope enum. + * @name google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope + * @enum {number} + * @property {number} USER_EVENT_REJOIN_SCOPE_UNSPECIFIED=0 USER_EVENT_REJOIN_SCOPE_UNSPECIFIED value + * @property {number} JOINED_EVENTS=1 JOINED_EVENTS value + * @property {number} UNJOINED_EVENTS=2 UNJOINED_EVENTS value + */ + RejoinUserEventsRequest.UserEventRejoinScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "JOINED_EVENTS"] = 1; + values[valuesById[2] = "UNJOINED_EVENTS"] = 2; + return values; + })(); + + return RejoinUserEventsRequest; })(); - v2beta.ColorInfo = (function() { + v2alpha.RejoinUserEventsResponse = (function() { /** - * Properties of a ColorInfo. - * @memberof google.cloud.retail.v2beta - * @interface IColorInfo - * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies - * @property {Array.|null} [colors] ColorInfo colors + * Properties of a RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsResponse + * @property {number|Long|null} [rejoinedUserEventsCount] RejoinUserEventsResponse rejoinedUserEventsCount */ /** - * Constructs a new ColorInfo. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ColorInfo. - * @implements IColorInfo + * Constructs a new RejoinUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsResponse. + * @implements IRejoinUserEventsResponse * @constructor - * @param {google.cloud.retail.v2beta.IColorInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set */ - function ColorInfo(properties) { - this.colorFamilies = []; - this.colors = []; + function RejoinUserEventsResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -55923,94 +53885,75 @@ } /** - * ColorInfo colorFamilies. - * @member {Array.} colorFamilies - * @memberof google.cloud.retail.v2beta.ColorInfo - * @instance - */ - ColorInfo.prototype.colorFamilies = $util.emptyArray; - - /** - * ColorInfo colors. - * @member {Array.} colors - * @memberof google.cloud.retail.v2beta.ColorInfo + * RejoinUserEventsResponse rejoinedUserEventsCount. + * @member {number|Long} rejoinedUserEventsCount + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @instance */ - ColorInfo.prototype.colors = $util.emptyArray; + RejoinUserEventsResponse.prototype.rejoinedUserEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new RejoinUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse instance */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); + RejoinUserEventsResponse.create = function create(properties) { + return new RejoinUserEventsResponse(properties); }; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * Encodes the specified RejoinUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encode = function encode(message, writer) { + RejoinUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.colorFamilies != null && message.colorFamilies.length) - for (var i = 0; i < message.colorFamilies.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); + if (message.rejoinedUserEventsCount != null && Object.hasOwnProperty.call(message, "rejoinedUserEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.rejoinedUserEventsCount); return writer; }; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. + * Encodes the specified RejoinUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsResponse} message RejoinUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + RejoinUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decode = function decode(reader, length) { + RejoinUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ColorInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); + message.rejoinedUserEventsCount = reader.int64(); break; default: reader.skipType(tag & 7); @@ -56021,145 +53964,120 @@ }; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { + RejoinUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ColorInfo message. + * Verifies a RejoinUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ColorInfo.verify = function verify(message) { + RejoinUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { - if (!Array.isArray(message.colorFamilies)) - return "colorFamilies: array expected"; - for (var i = 0; i < message.colorFamilies.length; ++i) - if (!$util.isString(message.colorFamilies[i])) - return "colorFamilies: string[] expected"; - } - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) - if (!$util.isString(message.colors[i])) - return "colors: string[] expected"; - } + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (!$util.isInteger(message.rejoinedUserEventsCount) && !(message.rejoinedUserEventsCount && $util.isInteger(message.rejoinedUserEventsCount.low) && $util.isInteger(message.rejoinedUserEventsCount.high))) + return "rejoinedUserEventsCount: integer|Long expected"; return null; }; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsResponse} RejoinUserEventsResponse */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ColorInfo) + RejoinUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.ColorInfo(); - if (object.colorFamilies) { - if (!Array.isArray(object.colorFamilies)) - throw TypeError(".google.cloud.retail.v2beta.ColorInfo.colorFamilies: array expected"); - message.colorFamilies = []; - for (var i = 0; i < object.colorFamilies.length; ++i) - message.colorFamilies[i] = String(object.colorFamilies[i]); - } - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.retail.v2beta.ColorInfo.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) - message.colors[i] = String(object.colors[i]); - } + var message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsResponse(); + if (object.rejoinedUserEventsCount != null) + if ($util.Long) + (message.rejoinedUserEventsCount = $util.Long.fromValue(object.rejoinedUserEventsCount)).unsigned = false; + else if (typeof object.rejoinedUserEventsCount === "string") + message.rejoinedUserEventsCount = parseInt(object.rejoinedUserEventsCount, 10); + else if (typeof object.rejoinedUserEventsCount === "number") + message.rejoinedUserEventsCount = object.rejoinedUserEventsCount; + else if (typeof object.rejoinedUserEventsCount === "object") + message.rejoinedUserEventsCount = new $util.LongBits(object.rejoinedUserEventsCount.low >>> 0, object.rejoinedUserEventsCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * Creates a plain object from a RejoinUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.ColorInfo} message ColorInfo + * @param {google.cloud.retail.v2alpha.RejoinUserEventsResponse} message RejoinUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ColorInfo.toObject = function toObject(message, options) { + RejoinUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.colorFamilies = []; - object.colors = []; - } - if (message.colorFamilies && message.colorFamilies.length) { - object.colorFamilies = []; - for (var j = 0; j < message.colorFamilies.length; ++j) - object.colorFamilies[j] = message.colorFamilies[j]; - } - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = message.colors[j]; - } + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rejoinedUserEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rejoinedUserEventsCount = options.longs === String ? "0" : 0; + if (message.rejoinedUserEventsCount != null && message.hasOwnProperty("rejoinedUserEventsCount")) + if (typeof message.rejoinedUserEventsCount === "number") + object.rejoinedUserEventsCount = options.longs === String ? String(message.rejoinedUserEventsCount) : message.rejoinedUserEventsCount; + else + object.rejoinedUserEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.rejoinedUserEventsCount) : options.longs === Number ? new $util.LongBits(message.rejoinedUserEventsCount.low >>> 0, message.rejoinedUserEventsCount.high >>> 0).toNumber() : message.rejoinedUserEventsCount; return object; }; /** - * Converts this ColorInfo to JSON. + * Converts this RejoinUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ColorInfo + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse * @instance * @returns {Object.} JSON object */ - ColorInfo.prototype.toJSON = function toJSON() { + RejoinUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ColorInfo; + return RejoinUserEventsResponse; })(); - v2beta.CustomAttribute = (function() { + v2alpha.RejoinUserEventsMetadata = (function() { /** - * Properties of a CustomAttribute. - * @memberof google.cloud.retail.v2beta - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers - * @property {boolean|null} [searchable] CustomAttribute searchable - * @property {boolean|null} [indexable] CustomAttribute indexable + * Properties of a RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IRejoinUserEventsMetadata */ /** - * Constructs a new CustomAttribute. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute + * Constructs a new RejoinUserEventsMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RejoinUserEventsMetadata. + * @implements IRejoinUserEventsMetadata * @constructor - * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; + function RejoinUserEventsMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56167,154 +54085,63 @@ } /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2beta.CustomAttribute - * @instance - */ - CustomAttribute.prototype.text = $util.emptyArray; - - /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2beta.CustomAttribute - * @instance - */ - CustomAttribute.prototype.numbers = $util.emptyArray; - - /** - * CustomAttribute searchable. - * @member {boolean|null|undefined} searchable - * @memberof google.cloud.retail.v2beta.CustomAttribute - * @instance - */ - CustomAttribute.prototype.searchable = null; - - /** - * CustomAttribute indexable. - * @member {boolean|null|undefined} indexable - * @memberof google.cloud.retail.v2beta.CustomAttribute - * @instance - */ - CustomAttribute.prototype.indexable = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * CustomAttribute _searchable. - * @member {"searchable"|undefined} _searchable - * @memberof google.cloud.retail.v2beta.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_searchable", { - get: $util.oneOfGetter($oneOfFields = ["searchable"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * CustomAttribute _indexable. - * @member {"indexable"|undefined} _indexable - * @memberof google.cloud.retail.v2beta.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_indexable", { - get: $util.oneOfGetter($oneOfFields = ["indexable"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new RejoinUserEventsMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute instance + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata instance */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); + RejoinUserEventsMetadata.create = function create(properties) { + return new RejoinUserEventsMetadata(properties); }; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * Encodes the specified RejoinUserEventsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encode = function encode(message, writer) { + RejoinUserEventsMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } - if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); - if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. + * Encodes the specified RejoinUserEventsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RejoinUserEventsMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRejoinUserEventsMetadata} message RejoinUserEventsMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + RejoinUserEventsMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decode = function decode(reader, length) { + RejoinUserEventsMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -56324,167 +54151,107 @@ }; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a RejoinUserEventsMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + RejoinUserEventsMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomAttribute message. + * Verifies a RejoinUserEventsMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomAttribute.verify = function verify(message) { + RejoinUserEventsMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - properties._searchable = 1; - if (typeof message.searchable !== "boolean") - return "searchable: boolean expected"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - properties._indexable = 1; - if (typeof message.indexable !== "boolean") - return "indexable: boolean expected"; - } return null; }; /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a RejoinUserEventsMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute + * @returns {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} RejoinUserEventsMetadata */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CustomAttribute) + RejoinUserEventsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata) return object; - var message = new $root.google.cloud.retail.v2beta.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); - } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); - } - if (object.searchable != null) - message.searchable = Boolean(object.searchable); - if (object.indexable != null) - message.indexable = Boolean(object.indexable); - return message; + return new $root.google.cloud.retail.v2alpha.RejoinUserEventsMetadata(); }; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * Creates a plain object from a RejoinUserEventsMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @static - * @param {google.cloud.retail.v2beta.CustomAttribute} message CustomAttribute + * @param {google.cloud.retail.v2alpha.RejoinUserEventsMetadata} message RejoinUserEventsMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomAttribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - object.searchable = message.searchable; - if (options.oneofs) - object._searchable = "searchable"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - object.indexable = message.indexable; - if (options.oneofs) - object._indexable = "indexable"; - } - return object; + RejoinUserEventsMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this CustomAttribute to JSON. + * Converts this RejoinUserEventsMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CustomAttribute + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata * @instance * @returns {Object.} JSON object */ - CustomAttribute.prototype.toJSON = function toJSON() { + RejoinUserEventsMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomAttribute; + return RejoinUserEventsMetadata; })(); - v2beta.FulfillmentInfo = (function() { + return v2alpha; + })(); + + retail.v2beta = (function() { + + /** + * Namespace v2beta. + * @memberof google.cloud.retail + * @namespace + */ + var v2beta = {}; + + v2beta.ProductLevelConfig = (function() { /** - * Properties of a FulfillmentInfo. + * Properties of a ProductLevelConfig. * @memberof google.cloud.retail.v2beta - * @interface IFulfillmentInfo - * @property {string|null} [type] FulfillmentInfo type - * @property {Array.|null} [placeIds] FulfillmentInfo placeIds + * @interface IProductLevelConfig + * @property {string|null} [ingestionProductType] ProductLevelConfig ingestionProductType + * @property {string|null} [merchantCenterProductIdField] ProductLevelConfig merchantCenterProductIdField */ /** - * Constructs a new FulfillmentInfo. + * Constructs a new ProductLevelConfig. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a FulfillmentInfo. - * @implements IFulfillmentInfo + * @classdesc Represents a ProductLevelConfig. + * @implements IProductLevelConfig * @constructor - * @param {google.cloud.retail.v2beta.IFulfillmentInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set */ - function FulfillmentInfo(properties) { - this.placeIds = []; + function ProductLevelConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56492,91 +54259,88 @@ } /** - * FulfillmentInfo type. - * @member {string} type - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * ProductLevelConfig ingestionProductType. + * @member {string} ingestionProductType + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @instance */ - FulfillmentInfo.prototype.type = ""; + ProductLevelConfig.prototype.ingestionProductType = ""; /** - * FulfillmentInfo placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * ProductLevelConfig merchantCenterProductIdField. + * @member {string} merchantCenterProductIdField + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @instance */ - FulfillmentInfo.prototype.placeIds = $util.emptyArray; + ProductLevelConfig.prototype.merchantCenterProductIdField = ""; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * Creates a new ProductLevelConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static - * @param {google.cloud.retail.v2beta.IFulfillmentInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo instance + * @param {google.cloud.retail.v2beta.IProductLevelConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig instance */ - FulfillmentInfo.create = function create(properties) { - return new FulfillmentInfo(properties); + ProductLevelConfig.create = function create(properties) { + return new ProductLevelConfig(properties); }; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * Encodes the specified ProductLevelConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static - * @param {google.cloud.retail.v2beta.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encode = function encode(message, writer) { + ProductLevelConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.ingestionProductType != null && Object.hasOwnProperty.call(message, "ingestionProductType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ingestionProductType); + if (message.merchantCenterProductIdField != null && Object.hasOwnProperty.call(message, "merchantCenterProductIdField")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.merchantCenterProductIdField); return writer; }; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. + * Encodes the specified ProductLevelConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductLevelConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static - * @param {google.cloud.retail.v2beta.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2beta.IProductLevelConfig} message ProductLevelConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + ProductLevelConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes a ProductLevelConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decode = function decode(reader, length) { + ProductLevelConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.FulfillmentInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.string(); + message.ingestionProductType = reader.string(); break; case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + message.merchantCenterProductIdField = reader.string(); break; default: reader.skipType(tag & 7); @@ -56587,130 +54351,121 @@ }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes a ProductLevelConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + ProductLevelConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FulfillmentInfo message. + * Verifies a ProductLevelConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FulfillmentInfo.verify = function verify(message) { + ProductLevelConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + if (!$util.isString(message.ingestionProductType)) + return "ingestionProductType: string expected"; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + if (!$util.isString(message.merchantCenterProductIdField)) + return "merchantCenterProductIdField: string expected"; return null; }; /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates a ProductLevelConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2beta.ProductLevelConfig} ProductLevelConfig */ - FulfillmentInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.FulfillmentInfo) + ProductLevelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductLevelConfig) return object; - var message = new $root.google.cloud.retail.v2beta.FulfillmentInfo(); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2beta.FulfillmentInfo.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } + var message = new $root.google.cloud.retail.v2beta.ProductLevelConfig(); + if (object.ingestionProductType != null) + message.ingestionProductType = String(object.ingestionProductType); + if (object.merchantCenterProductIdField != null) + message.merchantCenterProductIdField = String(object.merchantCenterProductIdField); return message; }; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * Creates a plain object from a ProductLevelConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @static - * @param {google.cloud.retail.v2beta.FulfillmentInfo} message FulfillmentInfo + * @param {google.cloud.retail.v2beta.ProductLevelConfig} message ProductLevelConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FulfillmentInfo.toObject = function toObject(message, options) { + ProductLevelConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) - object.type = ""; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (options.defaults) { + object.ingestionProductType = ""; + object.merchantCenterProductIdField = ""; } + if (message.ingestionProductType != null && message.hasOwnProperty("ingestionProductType")) + object.ingestionProductType = message.ingestionProductType; + if (message.merchantCenterProductIdField != null && message.hasOwnProperty("merchantCenterProductIdField")) + object.merchantCenterProductIdField = message.merchantCenterProductIdField; return object; }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this ProductLevelConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @memberof google.cloud.retail.v2beta.ProductLevelConfig * @instance * @returns {Object.} JSON object */ - FulfillmentInfo.prototype.toJSON = function toJSON() { + ProductLevelConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FulfillmentInfo; + return ProductLevelConfig; })(); - v2beta.Image = (function() { + v2beta.CatalogAttribute = (function() { /** - * Properties of an Image. + * Properties of a CatalogAttribute. * @memberof google.cloud.retail.v2beta - * @interface IImage - * @property {string|null} [uri] Image uri - * @property {number|null} [height] Image height - * @property {number|null} [width] Image width + * @interface ICatalogAttribute + * @property {string|null} [key] CatalogAttribute key + * @property {boolean|null} [inUse] CatalogAttribute inUse + * @property {google.cloud.retail.v2beta.CatalogAttribute.AttributeType|null} [type] CatalogAttribute type + * @property {google.cloud.retail.v2beta.CatalogAttribute.IndexableOption|null} [indexableOption] CatalogAttribute indexableOption + * @property {google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption|null} [dynamicFacetableOption] CatalogAttribute dynamicFacetableOption + * @property {google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|null} [searchableOption] CatalogAttribute searchableOption */ /** - * Constructs a new Image. + * Constructs a new CatalogAttribute. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a CatalogAttribute. + * @implements ICatalogAttribute * @constructor - * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICatalogAttribute=} [properties] Properties to set */ - function Image(properties) { + function CatalogAttribute(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56718,101 +54473,140 @@ } /** - * Image uri. - * @member {string} uri - * @memberof google.cloud.retail.v2beta.Image + * CatalogAttribute key. + * @member {string} key + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @instance */ - Image.prototype.uri = ""; + CatalogAttribute.prototype.key = ""; /** - * Image height. - * @member {number} height - * @memberof google.cloud.retail.v2beta.Image + * CatalogAttribute inUse. + * @member {boolean} inUse + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @instance */ - Image.prototype.height = 0; + CatalogAttribute.prototype.inUse = false; /** - * Image width. - * @member {number} width - * @memberof google.cloud.retail.v2beta.Image + * CatalogAttribute type. + * @member {google.cloud.retail.v2beta.CatalogAttribute.AttributeType} type + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @instance */ - Image.prototype.width = 0; + CatalogAttribute.prototype.type = 0; /** - * Creates a new Image instance using the specified properties. + * CatalogAttribute indexableOption. + * @member {google.cloud.retail.v2beta.CatalogAttribute.IndexableOption} indexableOption + * @memberof google.cloud.retail.v2beta.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.indexableOption = 0; + + /** + * CatalogAttribute dynamicFacetableOption. + * @member {google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption} dynamicFacetableOption + * @memberof google.cloud.retail.v2beta.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.dynamicFacetableOption = 0; + + /** + * CatalogAttribute searchableOption. + * @member {google.cloud.retail.v2beta.CatalogAttribute.SearchableOption} searchableOption + * @memberof google.cloud.retail.v2beta.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.searchableOption = 0; + + /** + * Creates a new CatalogAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static - * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Image} Image instance + * @param {google.cloud.retail.v2beta.ICatalogAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CatalogAttribute} CatalogAttribute instance */ - Image.create = function create(properties) { - return new Image(properties); + CatalogAttribute.create = function create(properties) { + return new CatalogAttribute(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * Encodes the specified CatalogAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CatalogAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static - * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2beta.ICatalogAttribute} message CatalogAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + CatalogAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.indexableOption != null && Object.hasOwnProperty.call(message, "indexableOption")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.indexableOption); + if (message.dynamicFacetableOption != null && Object.hasOwnProperty.call(message, "dynamicFacetableOption")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.dynamicFacetableOption); + if (message.searchableOption != null && Object.hasOwnProperty.call(message, "searchableOption")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.searchableOption); + if (message.inUse != null && Object.hasOwnProperty.call(message, "inUse")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.inUse); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.type); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. + * Encodes the specified CatalogAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CatalogAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static - * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2beta.ICatalogAttribute} message CatalogAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + CatalogAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a CatalogAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Image} Image + * @returns {google.cloud.retail.v2beta.CatalogAttribute} CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + CatalogAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CatalogAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.key = reader.string(); break; - case 2: - message.height = reader.int32(); + case 9: + message.inUse = reader.bool(); break; - case 3: - message.width = reader.int32(); + case 10: + message.type = reader.int32(); + break; + case 5: + message.indexableOption = reader.int32(); + break; + case 6: + message.dynamicFacetableOption = reader.int32(); + break; + case 7: + message.searchableOption = reader.int32(); break; default: reader.skipType(tag & 7); @@ -56823,127 +54617,287 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a CatalogAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Image} Image + * @returns {google.cloud.retail.v2beta.CatalogAttribute} CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + CatalogAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a CatalogAttribute message. * @function verify - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + CatalogAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.inUse != null && message.hasOwnProperty("inUse")) + if (typeof message.inUse !== "boolean") + return "inUse: boolean expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) + switch (message.indexableOption) { + default: + return "indexableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) + switch (message.dynamicFacetableOption) { + default: + return "dynamicFacetableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) + switch (message.searchableOption) { + default: + return "searchableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a CatalogAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Image} Image + * @returns {google.cloud.retail.v2beta.CatalogAttribute} CatalogAttribute */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Image) + CatalogAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CatalogAttribute) return object; - var message = new $root.google.cloud.retail.v2beta.Image(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.height != null) - message.height = object.height | 0; - if (object.width != null) - message.width = object.width | 0; + var message = new $root.google.cloud.retail.v2beta.CatalogAttribute(); + if (object.key != null) + message.key = String(object.key); + if (object.inUse != null) + message.inUse = Boolean(object.inUse); + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "TEXTUAL": + case 1: + message.type = 1; + break; + case "NUMERICAL": + case 2: + message.type = 2; + break; + } + switch (object.indexableOption) { + case "INDEXABLE_OPTION_UNSPECIFIED": + case 0: + message.indexableOption = 0; + break; + case "INDEXABLE_ENABLED": + case 1: + message.indexableOption = 1; + break; + case "INDEXABLE_DISABLED": + case 2: + message.indexableOption = 2; + break; + } + switch (object.dynamicFacetableOption) { + case "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": + case 0: + message.dynamicFacetableOption = 0; + break; + case "DYNAMIC_FACETABLE_ENABLED": + case 1: + message.dynamicFacetableOption = 1; + break; + case "DYNAMIC_FACETABLE_DISABLED": + case 2: + message.dynamicFacetableOption = 2; + break; + } + switch (object.searchableOption) { + case "SEARCHABLE_OPTION_UNSPECIFIED": + case 0: + message.searchableOption = 0; + break; + case "SEARCHABLE_ENABLED": + case 1: + message.searchableOption = 1; + break; + case "SEARCHABLE_DISABLED": + case 2: + message.searchableOption = 2; + break; + } return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a CatalogAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @static - * @param {google.cloud.retail.v2beta.Image} message Image + * @param {google.cloud.retail.v2beta.CatalogAttribute} message CatalogAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + CatalogAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.uri = ""; - object.height = 0; - object.width = 0; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; + object.key = ""; + object.indexableOption = options.enums === String ? "INDEXABLE_OPTION_UNSPECIFIED" : 0; + object.dynamicFacetableOption = options.enums === String ? "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" : 0; + object.searchableOption = options.enums === String ? "SEARCHABLE_OPTION_UNSPECIFIED" : 0; + object.inUse = false; + object.type = options.enums === String ? "UNKNOWN" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) + object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; + if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) + object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; + if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) + object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + if (message.inUse != null && message.hasOwnProperty("inUse")) + object.inUse = message.inUse; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.AttributeType[message.type] : message.type; return object; }; /** - * Converts this Image to JSON. + * Converts this CatalogAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Image + * @memberof google.cloud.retail.v2beta.CatalogAttribute * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + CatalogAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + /** + * AttributeType enum. + * @name google.cloud.retail.v2beta.CatalogAttribute.AttributeType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} TEXTUAL=1 TEXTUAL value + * @property {number} NUMERICAL=2 NUMERICAL value + */ + CatalogAttribute.AttributeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "TEXTUAL"] = 1; + values[valuesById[2] = "NUMERICAL"] = 2; + return values; + })(); + + /** + * IndexableOption enum. + * @name google.cloud.retail.v2beta.CatalogAttribute.IndexableOption + * @enum {number} + * @property {number} INDEXABLE_OPTION_UNSPECIFIED=0 INDEXABLE_OPTION_UNSPECIFIED value + * @property {number} INDEXABLE_ENABLED=1 INDEXABLE_ENABLED value + * @property {number} INDEXABLE_DISABLED=2 INDEXABLE_DISABLED value + */ + CatalogAttribute.IndexableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INDEXABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "INDEXABLE_ENABLED"] = 1; + values[valuesById[2] = "INDEXABLE_DISABLED"] = 2; + return values; + })(); + + /** + * DynamicFacetableOption enum. + * @name google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption + * @enum {number} + * @property {number} DYNAMIC_FACETABLE_OPTION_UNSPECIFIED=0 DYNAMIC_FACETABLE_OPTION_UNSPECIFIED value + * @property {number} DYNAMIC_FACETABLE_ENABLED=1 DYNAMIC_FACETABLE_ENABLED value + * @property {number} DYNAMIC_FACETABLE_DISABLED=2 DYNAMIC_FACETABLE_DISABLED value + */ + CatalogAttribute.DynamicFacetableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DYNAMIC_FACETABLE_ENABLED"] = 1; + values[valuesById[2] = "DYNAMIC_FACETABLE_DISABLED"] = 2; + return values; + })(); + + /** + * SearchableOption enum. + * @name google.cloud.retail.v2beta.CatalogAttribute.SearchableOption + * @enum {number} + * @property {number} SEARCHABLE_OPTION_UNSPECIFIED=0 SEARCHABLE_OPTION_UNSPECIFIED value + * @property {number} SEARCHABLE_ENABLED=1 SEARCHABLE_ENABLED value + * @property {number} SEARCHABLE_DISABLED=2 SEARCHABLE_DISABLED value + */ + CatalogAttribute.SearchableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCHABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "SEARCHABLE_ENABLED"] = 1; + values[valuesById[2] = "SEARCHABLE_DISABLED"] = 2; + return values; + })(); + + return CatalogAttribute; })(); - v2beta.Interval = (function() { + v2beta.AttributesConfig = (function() { /** - * Properties of an Interval. + * Properties of an AttributesConfig. * @memberof google.cloud.retail.v2beta - * @interface IInterval - * @property {number|null} [minimum] Interval minimum - * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum - * @property {number|null} [maximum] Interval maximum - * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum + * @interface IAttributesConfig + * @property {string|null} [name] AttributesConfig name + * @property {Object.|null} [catalogAttributes] AttributesConfig catalogAttributes + * @property {google.cloud.retail.v2beta.AttributeConfigLevel|null} [attributeConfigLevel] AttributesConfig attributeConfigLevel */ /** - * Constructs a new Interval. + * Constructs a new AttributesConfig. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an Interval. - * @implements IInterval + * @classdesc Represents an AttributesConfig. + * @implements IAttributesConfig * @constructor - * @param {google.cloud.retail.v2beta.IInterval=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAttributesConfig=} [properties] Properties to set */ - function Interval(properties) { + function AttributesConfig(properties) { + this.catalogAttributes = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56951,139 +54905,123 @@ } /** - * Interval minimum. - * @member {number|null|undefined} minimum - * @memberof google.cloud.retail.v2beta.Interval - * @instance - */ - Interval.prototype.minimum = null; - - /** - * Interval exclusiveMinimum. - * @member {number|null|undefined} exclusiveMinimum - * @memberof google.cloud.retail.v2beta.Interval - * @instance - */ - Interval.prototype.exclusiveMinimum = null; - - /** - * Interval maximum. - * @member {number|null|undefined} maximum - * @memberof google.cloud.retail.v2beta.Interval - * @instance - */ - Interval.prototype.maximum = null; - - /** - * Interval exclusiveMaximum. - * @member {number|null|undefined} exclusiveMaximum - * @memberof google.cloud.retail.v2beta.Interval + * AttributesConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.AttributesConfig * @instance */ - Interval.prototype.exclusiveMaximum = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + AttributesConfig.prototype.name = ""; /** - * Interval min. - * @member {"minimum"|"exclusiveMinimum"|undefined} min - * @memberof google.cloud.retail.v2beta.Interval + * AttributesConfig catalogAttributes. + * @member {Object.} catalogAttributes + * @memberof google.cloud.retail.v2beta.AttributesConfig * @instance */ - Object.defineProperty(Interval.prototype, "min", { - get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), - set: $util.oneOfSetter($oneOfFields) - }); + AttributesConfig.prototype.catalogAttributes = $util.emptyObject; /** - * Interval max. - * @member {"maximum"|"exclusiveMaximum"|undefined} max - * @memberof google.cloud.retail.v2beta.Interval + * AttributesConfig attributeConfigLevel. + * @member {google.cloud.retail.v2beta.AttributeConfigLevel} attributeConfigLevel + * @memberof google.cloud.retail.v2beta.AttributesConfig * @instance */ - Object.defineProperty(Interval.prototype, "max", { - get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), - set: $util.oneOfSetter($oneOfFields) - }); + AttributesConfig.prototype.attributeConfigLevel = 0; /** - * Creates a new Interval instance using the specified properties. + * Creates a new AttributesConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static - * @param {google.cloud.retail.v2beta.IInterval=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Interval} Interval instance + * @param {google.cloud.retail.v2beta.IAttributesConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AttributesConfig} AttributesConfig instance */ - Interval.create = function create(properties) { - return new Interval(properties); + AttributesConfig.create = function create(properties) { + return new AttributesConfig(properties); }; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * Encodes the specified AttributesConfig message. Does not implicitly {@link google.cloud.retail.v2beta.AttributesConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static - * @param {google.cloud.retail.v2beta.IInterval} message Interval message or plain object to encode + * @param {google.cloud.retail.v2beta.IAttributesConfig} message AttributesConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Interval.encode = function encode(message, writer) { + AttributesConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); - if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); - if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) - writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); - if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) - writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.catalogAttributes != null && Object.hasOwnProperty.call(message, "catalogAttributes")) + for (var keys = Object.keys(message.catalogAttributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CatalogAttribute.encode(message.catalogAttributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.attributeConfigLevel != null && Object.hasOwnProperty.call(message, "attributeConfigLevel")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.attributeConfigLevel); return writer; }; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. + * Encodes the specified AttributesConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AttributesConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static - * @param {google.cloud.retail.v2beta.IInterval} message Interval message or plain object to encode + * @param {google.cloud.retail.v2beta.IAttributesConfig} message AttributesConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Interval.encodeDelimited = function encodeDelimited(message, writer) { + AttributesConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes an AttributesConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Interval} Interval + * @returns {google.cloud.retail.v2beta.AttributesConfig} AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Interval.decode = function decode(reader, length) { + AttributesConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Interval(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AttributesConfig(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.minimum = reader.double(); + message.name = reader.string(); break; case 2: - message.exclusiveMinimum = reader.double(); + if (message.catalogAttributes === $util.emptyObject) + message.catalogAttributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.catalogAttributes[key] = value; break; case 3: - message.maximum = reader.double(); - break; - case 4: - message.exclusiveMaximum = reader.double(); + message.attributeConfigLevel = reader.int32(); break; default: reader.skipType(tag & 7); @@ -57094,157 +55032,172 @@ }; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes an AttributesConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Interval} Interval + * @returns {google.cloud.retail.v2beta.AttributesConfig} AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Interval.decodeDelimited = function decodeDelimited(reader) { + AttributesConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Interval message. + * Verifies an AttributesConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Interval.verify = function verify(message) { + AttributesConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - properties.min = 1; - if (typeof message.minimum !== "number") - return "minimum: number expected"; - } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - if (properties.min === 1) - return "min: multiple values"; - properties.min = 1; - if (typeof message.exclusiveMinimum !== "number") - return "exclusiveMinimum: number expected"; - } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - properties.max = 1; - if (typeof message.maximum !== "number") - return "maximum: number expected"; - } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - if (properties.max === 1) - return "max: multiple values"; - properties.max = 1; - if (typeof message.exclusiveMaximum !== "number") - return "exclusiveMaximum: number expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.catalogAttributes != null && message.hasOwnProperty("catalogAttributes")) { + if (!$util.isObject(message.catalogAttributes)) + return "catalogAttributes: object expected"; + var key = Object.keys(message.catalogAttributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CatalogAttribute.verify(message.catalogAttributes[key[i]]); + if (error) + return "catalogAttributes." + error; + } } + if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) + switch (message.attributeConfigLevel) { + default: + return "attributeConfigLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates an AttributesConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Interval} Interval + * @returns {google.cloud.retail.v2beta.AttributesConfig} AttributesConfig */ - Interval.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Interval) + AttributesConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AttributesConfig) return object; - var message = new $root.google.cloud.retail.v2beta.Interval(); - if (object.minimum != null) - message.minimum = Number(object.minimum); - if (object.exclusiveMinimum != null) - message.exclusiveMinimum = Number(object.exclusiveMinimum); - if (object.maximum != null) - message.maximum = Number(object.maximum); - if (object.exclusiveMaximum != null) - message.exclusiveMaximum = Number(object.exclusiveMaximum); + var message = new $root.google.cloud.retail.v2beta.AttributesConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.catalogAttributes) { + if (typeof object.catalogAttributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.AttributesConfig.catalogAttributes: object expected"); + message.catalogAttributes = {}; + for (var keys = Object.keys(object.catalogAttributes), i = 0; i < keys.length; ++i) { + if (typeof object.catalogAttributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.AttributesConfig.catalogAttributes: object expected"); + message.catalogAttributes[keys[i]] = $root.google.cloud.retail.v2beta.CatalogAttribute.fromObject(object.catalogAttributes[keys[i]]); + } + } + switch (object.attributeConfigLevel) { + case "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": + case 0: + message.attributeConfigLevel = 0; + break; + case "PRODUCT_LEVEL_ATTRIBUTE_CONFIG": + case 1: + message.attributeConfigLevel = 1; + break; + case "CATALOG_LEVEL_ATTRIBUTE_CONFIG": + case 2: + message.attributeConfigLevel = 2; + break; + } return message; }; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. + * Creates a plain object from an AttributesConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @static - * @param {google.cloud.retail.v2beta.Interval} message Interval + * @param {google.cloud.retail.v2beta.AttributesConfig} message AttributesConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Interval.toObject = function toObject(message, options) { + AttributesConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; - if (options.oneofs) - object.min = "minimum"; - } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; - if (options.oneofs) - object.min = "exclusiveMinimum"; - } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; - if (options.oneofs) - object.max = "maximum"; + if (options.objects || options.defaults) + object.catalogAttributes = {}; + if (options.defaults) { + object.name = ""; + object.attributeConfigLevel = options.enums === String ? "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" : 0; } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; - if (options.oneofs) - object.max = "exclusiveMaximum"; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + var keys2; + if (message.catalogAttributes && (keys2 = Object.keys(message.catalogAttributes)).length) { + object.catalogAttributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.catalogAttributes[keys2[j]] = $root.google.cloud.retail.v2beta.CatalogAttribute.toObject(message.catalogAttributes[keys2[j]], options); } + if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) + object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2beta.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; return object; }; /** - * Converts this Interval to JSON. + * Converts this AttributesConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Interval + * @memberof google.cloud.retail.v2beta.AttributesConfig * @instance * @returns {Object.} JSON object */ - Interval.prototype.toJSON = function toJSON() { + AttributesConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Interval; + return AttributesConfig; })(); - v2beta.PriceInfo = (function() { + v2beta.CompletionConfig = (function() { /** - * Properties of a PriceInfo. + * Properties of a CompletionConfig. * @memberof google.cloud.retail.v2beta - * @interface IPriceInfo - * @property {string|null} [currencyCode] PriceInfo currencyCode - * @property {number|null} [price] PriceInfo price - * @property {number|null} [originalPrice] PriceInfo originalPrice - * @property {number|null} [cost] PriceInfo cost - * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime - * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime - * @property {google.cloud.retail.v2beta.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange - */ - - /** - * Constructs a new PriceInfo. + * @interface ICompletionConfig + * @property {string|null} [name] CompletionConfig name + * @property {string|null} [matchingOrder] CompletionConfig matchingOrder + * @property {number|null} [maxSuggestions] CompletionConfig maxSuggestions + * @property {number|null} [minPrefixLength] CompletionConfig minPrefixLength + * @property {boolean|null} [autoLearning] CompletionConfig autoLearning + * @property {google.cloud.retail.v2beta.ICompletionDataInputConfig|null} [suggestionsInputConfig] CompletionConfig suggestionsInputConfig + * @property {string|null} [lastSuggestionsImportOperation] CompletionConfig lastSuggestionsImportOperation + * @property {google.cloud.retail.v2beta.ICompletionDataInputConfig|null} [denylistInputConfig] CompletionConfig denylistInputConfig + * @property {string|null} [lastDenylistImportOperation] CompletionConfig lastDenylistImportOperation + * @property {google.cloud.retail.v2beta.ICompletionDataInputConfig|null} [allowlistInputConfig] CompletionConfig allowlistInputConfig + * @property {string|null} [lastAllowlistImportOperation] CompletionConfig lastAllowlistImportOperation + */ + + /** + * Constructs a new CompletionConfig. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PriceInfo. - * @implements IPriceInfo + * @classdesc Represents a CompletionConfig. + * @implements ICompletionConfig * @constructor - * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICompletionConfig=} [properties] Properties to set */ - function PriceInfo(properties) { + function CompletionConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -57252,153 +55205,205 @@ } /** - * PriceInfo currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.currencyCode = ""; + CompletionConfig.prototype.name = ""; /** - * PriceInfo price. - * @member {number} price - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig matchingOrder. + * @member {string} matchingOrder + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.price = 0; + CompletionConfig.prototype.matchingOrder = ""; /** - * PriceInfo originalPrice. - * @member {number} originalPrice - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.originalPrice = 0; + CompletionConfig.prototype.maxSuggestions = 0; /** - * PriceInfo cost. - * @member {number} cost - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig minPrefixLength. + * @member {number} minPrefixLength + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.cost = 0; + CompletionConfig.prototype.minPrefixLength = 0; /** - * PriceInfo priceEffectiveTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig autoLearning. + * @member {boolean} autoLearning + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.priceEffectiveTime = null; + CompletionConfig.prototype.autoLearning = false; /** - * PriceInfo priceExpireTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig suggestionsInputConfig. + * @member {google.cloud.retail.v2beta.ICompletionDataInputConfig|null|undefined} suggestionsInputConfig + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.priceExpireTime = null; + CompletionConfig.prototype.suggestionsInputConfig = null; /** - * PriceInfo priceRange. - * @member {google.cloud.retail.v2beta.PriceInfo.IPriceRange|null|undefined} priceRange - * @memberof google.cloud.retail.v2beta.PriceInfo + * CompletionConfig lastSuggestionsImportOperation. + * @member {string} lastSuggestionsImportOperation + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance */ - PriceInfo.prototype.priceRange = null; + CompletionConfig.prototype.lastSuggestionsImportOperation = ""; /** - * Creates a new PriceInfo instance using the specified properties. + * CompletionConfig denylistInputConfig. + * @member {google.cloud.retail.v2beta.ICompletionDataInputConfig|null|undefined} denylistInputConfig + * @memberof google.cloud.retail.v2beta.CompletionConfig + * @instance + */ + CompletionConfig.prototype.denylistInputConfig = null; + + /** + * CompletionConfig lastDenylistImportOperation. + * @member {string} lastDenylistImportOperation + * @memberof google.cloud.retail.v2beta.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastDenylistImportOperation = ""; + + /** + * CompletionConfig allowlistInputConfig. + * @member {google.cloud.retail.v2beta.ICompletionDataInputConfig|null|undefined} allowlistInputConfig + * @memberof google.cloud.retail.v2beta.CompletionConfig + * @instance + */ + CompletionConfig.prototype.allowlistInputConfig = null; + + /** + * CompletionConfig lastAllowlistImportOperation. + * @member {string} lastAllowlistImportOperation + * @memberof google.cloud.retail.v2beta.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastAllowlistImportOperation = ""; + + /** + * Creates a new CompletionConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static - * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo instance + * @param {google.cloud.retail.v2beta.ICompletionConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompletionConfig} CompletionConfig instance */ - PriceInfo.create = function create(properties) { - return new PriceInfo(properties); + CompletionConfig.create = function create(properties) { + return new CompletionConfig(properties); }; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * Encodes the specified CompletionConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static - * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2beta.ICompletionConfig} message CompletionConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encode = function encode(message, writer) { + CompletionConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) - $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) - $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) - $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.matchingOrder != null && Object.hasOwnProperty.call(message, "matchingOrder")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.matchingOrder); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxSuggestions); + if (message.minPrefixLength != null && Object.hasOwnProperty.call(message, "minPrefixLength")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minPrefixLength); + if (message.suggestionsInputConfig != null && Object.hasOwnProperty.call(message, "suggestionsInputConfig")) + $root.google.cloud.retail.v2beta.CompletionDataInputConfig.encode(message.suggestionsInputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.lastSuggestionsImportOperation != null && Object.hasOwnProperty.call(message, "lastSuggestionsImportOperation")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.lastSuggestionsImportOperation); + if (message.denylistInputConfig != null && Object.hasOwnProperty.call(message, "denylistInputConfig")) + $root.google.cloud.retail.v2beta.CompletionDataInputConfig.encode(message.denylistInputConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.lastDenylistImportOperation != null && Object.hasOwnProperty.call(message, "lastDenylistImportOperation")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.lastDenylistImportOperation); + if (message.allowlistInputConfig != null && Object.hasOwnProperty.call(message, "allowlistInputConfig")) + $root.google.cloud.retail.v2beta.CompletionDataInputConfig.encode(message.allowlistInputConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.lastAllowlistImportOperation != null && Object.hasOwnProperty.call(message, "lastAllowlistImportOperation")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.lastAllowlistImportOperation); + if (message.autoLearning != null && Object.hasOwnProperty.call(message, "autoLearning")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoLearning); return writer; }; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. + * Encodes the specified CompletionConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static - * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2beta.ICompletionConfig} message CompletionConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + CompletionConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a CompletionConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2beta.CompletionConfig} CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decode = function decode(reader, length) { + CompletionConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.currencyCode = reader.string(); + message.name = reader.string(); break; case 2: - message.price = reader.float(); + message.matchingOrder = reader.string(); break; case 3: - message.originalPrice = reader.float(); + message.maxSuggestions = reader.int32(); break; case 4: - message.cost = reader.float(); + message.minPrefixLength = reader.int32(); + break; + case 11: + message.autoLearning = reader.bool(); break; case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.suggestionsInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); break; case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.lastSuggestionsImportOperation = reader.string(); break; case 7: - message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.decode(reader, reader.uint32()); + message.denylistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 8: + message.lastDenylistImportOperation = reader.string(); + break; + case 9: + message.allowlistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 10: + message.lastAllowlistImportOperation = reader.string(); break; default: reader.skipType(tag & 7); @@ -57409,507 +55414,339 @@ }; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a CompletionConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2beta.CompletionConfig} CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decodeDelimited = function decodeDelimited(reader) { + CompletionConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PriceInfo message. + * Verifies a CompletionConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PriceInfo.verify = function verify(message) { + CompletionConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - if (message.price != null && message.hasOwnProperty("price")) - if (typeof message.price !== "number") - return "price: number expected"; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - if (typeof message.originalPrice !== "number") - return "originalPrice: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.matchingOrder != null && message.hasOwnProperty("matchingOrder")) + if (!$util.isString(message.matchingOrder)) + return "matchingOrder: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + if (!$util.isInteger(message.minPrefixLength)) + return "minPrefixLength: integer expected"; + if (message.autoLearning != null && message.hasOwnProperty("autoLearning")) + if (typeof message.autoLearning !== "boolean") + return "autoLearning: boolean expected"; + if (message.suggestionsInputConfig != null && message.hasOwnProperty("suggestionsInputConfig")) { + var error = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.verify(message.suggestionsInputConfig); if (error) - return "priceEffectiveTime." + error; + return "suggestionsInputConfig." + error; } - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (message.lastSuggestionsImportOperation != null && message.hasOwnProperty("lastSuggestionsImportOperation")) + if (!$util.isString(message.lastSuggestionsImportOperation)) + return "lastSuggestionsImportOperation: string expected"; + if (message.denylistInputConfig != null && message.hasOwnProperty("denylistInputConfig")) { + var error = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.verify(message.denylistInputConfig); if (error) - return "priceExpireTime." + error; + return "denylistInputConfig." + error; } - if (message.priceRange != null && message.hasOwnProperty("priceRange")) { - var error = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.verify(message.priceRange); + if (message.lastDenylistImportOperation != null && message.hasOwnProperty("lastDenylistImportOperation")) + if (!$util.isString(message.lastDenylistImportOperation)) + return "lastDenylistImportOperation: string expected"; + if (message.allowlistInputConfig != null && message.hasOwnProperty("allowlistInputConfig")) { + var error = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.verify(message.allowlistInputConfig); if (error) - return "priceRange." + error; + return "allowlistInputConfig." + error; } + if (message.lastAllowlistImportOperation != null && message.hasOwnProperty("lastAllowlistImportOperation")) + if (!$util.isString(message.lastAllowlistImportOperation)) + return "lastAllowlistImportOperation: string expected"; return null; }; /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2beta.CompletionConfig} CompletionConfig */ - PriceInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo) + CompletionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompletionConfig) return object; - var message = new $root.google.cloud.retail.v2beta.PriceInfo(); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - if (object.price != null) - message.price = Number(object.price); - if (object.originalPrice != null) - message.originalPrice = Number(object.originalPrice); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.priceEffectiveTime != null) { - if (typeof object.priceEffectiveTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceEffectiveTime: object expected"); - message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); - } - if (object.priceExpireTime != null) { - if (typeof object.priceExpireTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceExpireTime: object expected"); - message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); - } - if (object.priceRange != null) { - if (typeof object.priceRange !== "object") - throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceRange: object expected"); - message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.fromObject(object.priceRange); - } + var message = new $root.google.cloud.retail.v2beta.CompletionConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.matchingOrder != null) + message.matchingOrder = String(object.matchingOrder); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; + if (object.minPrefixLength != null) + message.minPrefixLength = object.minPrefixLength | 0; + if (object.autoLearning != null) + message.autoLearning = Boolean(object.autoLearning); + if (object.suggestionsInputConfig != null) { + if (typeof object.suggestionsInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompletionConfig.suggestionsInputConfig: object expected"); + message.suggestionsInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.fromObject(object.suggestionsInputConfig); + } + if (object.lastSuggestionsImportOperation != null) + message.lastSuggestionsImportOperation = String(object.lastSuggestionsImportOperation); + if (object.denylistInputConfig != null) { + if (typeof object.denylistInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompletionConfig.denylistInputConfig: object expected"); + message.denylistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.fromObject(object.denylistInputConfig); + } + if (object.lastDenylistImportOperation != null) + message.lastDenylistImportOperation = String(object.lastDenylistImportOperation); + if (object.allowlistInputConfig != null) { + if (typeof object.allowlistInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompletionConfig.allowlistInputConfig: object expected"); + message.allowlistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.fromObject(object.allowlistInputConfig); + } + if (object.lastAllowlistImportOperation != null) + message.lastAllowlistImportOperation = String(object.lastAllowlistImportOperation); return message; }; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * Creates a plain object from a CompletionConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @static - * @param {google.cloud.retail.v2beta.PriceInfo} message PriceInfo + * @param {google.cloud.retail.v2beta.CompletionConfig} message CompletionConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PriceInfo.toObject = function toObject(message, options) { + CompletionConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.currencyCode = ""; - object.price = 0; - object.originalPrice = 0; - object.cost = 0; - object.priceEffectiveTime = null; - object.priceExpireTime = null; - object.priceRange = null; + object.name = ""; + object.matchingOrder = ""; + object.maxSuggestions = 0; + object.minPrefixLength = 0; + object.suggestionsInputConfig = null; + object.lastSuggestionsImportOperation = ""; + object.denylistInputConfig = null; + object.lastDenylistImportOperation = ""; + object.allowlistInputConfig = null; + object.lastAllowlistImportOperation = ""; + object.autoLearning = false; } - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - if (message.price != null && message.hasOwnProperty("price")) - object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) - object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) - object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); - if (message.priceRange != null && message.hasOwnProperty("priceRange")) - object.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.toObject(message.priceRange, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.matchingOrder != null && message.hasOwnProperty("matchingOrder")) + object.matchingOrder = message.matchingOrder; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + object.minPrefixLength = message.minPrefixLength; + if (message.suggestionsInputConfig != null && message.hasOwnProperty("suggestionsInputConfig")) + object.suggestionsInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.toObject(message.suggestionsInputConfig, options); + if (message.lastSuggestionsImportOperation != null && message.hasOwnProperty("lastSuggestionsImportOperation")) + object.lastSuggestionsImportOperation = message.lastSuggestionsImportOperation; + if (message.denylistInputConfig != null && message.hasOwnProperty("denylistInputConfig")) + object.denylistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.toObject(message.denylistInputConfig, options); + if (message.lastDenylistImportOperation != null && message.hasOwnProperty("lastDenylistImportOperation")) + object.lastDenylistImportOperation = message.lastDenylistImportOperation; + if (message.allowlistInputConfig != null && message.hasOwnProperty("allowlistInputConfig")) + object.allowlistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.toObject(message.allowlistInputConfig, options); + if (message.lastAllowlistImportOperation != null && message.hasOwnProperty("lastAllowlistImportOperation")) + object.lastAllowlistImportOperation = message.lastAllowlistImportOperation; + if (message.autoLearning != null && message.hasOwnProperty("autoLearning")) + object.autoLearning = message.autoLearning; return object; }; /** - * Converts this PriceInfo to JSON. + * Converts this CompletionConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PriceInfo + * @memberof google.cloud.retail.v2beta.CompletionConfig * @instance * @returns {Object.} JSON object */ - PriceInfo.prototype.toJSON = function toJSON() { + CompletionConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PriceInfo.PriceRange = (function() { + return CompletionConfig; + })(); - /** - * Properties of a PriceRange. - * @memberof google.cloud.retail.v2beta.PriceInfo - * @interface IPriceRange - * @property {google.cloud.retail.v2beta.IInterval|null} [price] PriceRange price - * @property {google.cloud.retail.v2beta.IInterval|null} [originalPrice] PriceRange originalPrice - */ + v2beta.MerchantCenterLink = (function() { - /** - * Constructs a new PriceRange. - * @memberof google.cloud.retail.v2beta.PriceInfo - * @classdesc Represents a PriceRange. - * @implements IPriceRange - * @constructor - * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange=} [properties] Properties to set - */ - function PriceRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a MerchantCenterLink. + * @memberof google.cloud.retail.v2beta + * @interface IMerchantCenterLink + * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId + * @property {string|null} [branchId] MerchantCenterLink branchId + * @property {Array.|null} [destinations] MerchantCenterLink destinations + * @property {string|null} [regionCode] MerchantCenterLink regionCode + * @property {string|null} [languageCode] MerchantCenterLink languageCode + */ - /** - * PriceRange price. - * @member {google.cloud.retail.v2beta.IInterval|null|undefined} price - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.price = null; + /** + * Constructs a new MerchantCenterLink. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a MerchantCenterLink. + * @implements IMerchantCenterLink + * @constructor + * @param {google.cloud.retail.v2beta.IMerchantCenterLink=} [properties] Properties to set + */ + function MerchantCenterLink(properties) { + this.destinations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PriceRange originalPrice. - * @member {google.cloud.retail.v2beta.IInterval|null|undefined} originalPrice - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.originalPrice = null; + /** + * MerchantCenterLink merchantCenterAccountId. + * @member {number|Long} merchantCenterAccountId + * @memberof google.cloud.retail.v2beta.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.merchantCenterAccountId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a new PriceRange instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange instance - */ - PriceRange.create = function create(properties) { - return new PriceRange(properties); - }; + /** + * MerchantCenterLink branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2beta.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.branchId = ""; - /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange} message PriceRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - $root.google.cloud.retail.v2beta.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - $root.google.cloud.retail.v2beta.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * MerchantCenterLink destinations. + * @member {Array.} destinations + * @memberof google.cloud.retail.v2beta.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.destinations = $util.emptyArray; - /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange} message PriceRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * MerchantCenterLink regionCode. + * @member {string} regionCode + * @memberof google.cloud.retail.v2beta.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.regionCode = ""; - /** - * Decodes a PriceRange message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo.PriceRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); - break; - case 2: - message.originalPrice = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PriceRange message. - * @function verify - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PriceRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.price != null && message.hasOwnProperty("price")) { - var error = $root.google.cloud.retail.v2beta.Interval.verify(message.price); - if (error) - return "price." + error; - } - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { - var error = $root.google.cloud.retail.v2beta.Interval.verify(message.originalPrice); - if (error) - return "originalPrice." + error; - } - return null; - }; - - /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange - */ - PriceRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo.PriceRange) - return object; - var message = new $root.google.cloud.retail.v2beta.PriceInfo.PriceRange(); - if (object.price != null) { - if (typeof object.price !== "object") - throw TypeError(".google.cloud.retail.v2beta.PriceInfo.PriceRange.price: object expected"); - message.price = $root.google.cloud.retail.v2beta.Interval.fromObject(object.price); - } - if (object.originalPrice != null) { - if (typeof object.originalPrice !== "object") - throw TypeError(".google.cloud.retail.v2beta.PriceInfo.PriceRange.originalPrice: object expected"); - message.originalPrice = $root.google.cloud.retail.v2beta.Interval.fromObject(object.originalPrice); - } - return message; - }; - - /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2beta.PriceInfo.PriceRange} message PriceRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PriceRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.price = null; - object.originalPrice = null; - } - if (message.price != null && message.hasOwnProperty("price")) - object.price = $root.google.cloud.retail.v2beta.Interval.toObject(message.price, options); - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = $root.google.cloud.retail.v2beta.Interval.toObject(message.originalPrice, options); - return object; - }; - - /** - * Converts this PriceRange to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange - * @instance - * @returns {Object.} JSON object - */ - PriceRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PriceRange; - })(); - - return PriceInfo; - })(); - - v2beta.Rating = (function() { - - /** - * Properties of a Rating. - * @memberof google.cloud.retail.v2beta - * @interface IRating - * @property {number|null} [ratingCount] Rating ratingCount - * @property {number|null} [averageRating] Rating averageRating - * @property {Array.|null} [ratingHistogram] Rating ratingHistogram - */ - - /** - * Constructs a new Rating. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Rating. - * @implements IRating - * @constructor - * @param {google.cloud.retail.v2beta.IRating=} [properties] Properties to set - */ - function Rating(properties) { - this.ratingHistogram = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Rating ratingCount. - * @member {number} ratingCount - * @memberof google.cloud.retail.v2beta.Rating - * @instance - */ - Rating.prototype.ratingCount = 0; - - /** - * Rating averageRating. - * @member {number} averageRating - * @memberof google.cloud.retail.v2beta.Rating - * @instance - */ - Rating.prototype.averageRating = 0; - - /** - * Rating ratingHistogram. - * @member {Array.} ratingHistogram - * @memberof google.cloud.retail.v2beta.Rating - * @instance - */ - Rating.prototype.ratingHistogram = $util.emptyArray; + /** + * MerchantCenterLink languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2beta.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.languageCode = ""; /** - * Creates a new Rating instance using the specified properties. + * Creates a new MerchantCenterLink instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static - * @param {google.cloud.retail.v2beta.IRating=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Rating} Rating instance + * @param {google.cloud.retail.v2beta.IMerchantCenterLink=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.MerchantCenterLink} MerchantCenterLink instance */ - Rating.create = function create(properties) { - return new Rating(properties); + MerchantCenterLink.create = function create(properties) { + return new MerchantCenterLink(properties); }; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLink.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static - * @param {google.cloud.retail.v2beta.IRating} message Rating message or plain object to encode + * @param {google.cloud.retail.v2beta.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rating.encode = function encode(message, writer) { + MerchantCenterLink.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); - if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); - if (message.ratingHistogram != null && message.ratingHistogram.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (var i = 0; i < message.ratingHistogram.length; ++i) - writer.int32(message.ratingHistogram[i]); - writer.ldelim(); - } + if (message.merchantCenterAccountId != null && Object.hasOwnProperty.call(message, "merchantCenterAccountId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.merchantCenterAccountId); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.destinations != null && message.destinations.length) + for (var i = 0; i < message.destinations.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.regionCode); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.languageCode); return writer; }; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLink.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static - * @param {google.cloud.retail.v2beta.IRating} message Rating message or plain object to encode + * @param {google.cloud.retail.v2beta.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rating.encodeDelimited = function encodeDelimited(message, writer) { + MerchantCenterLink.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes a MerchantCenterLink message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Rating} Rating + * @returns {google.cloud.retail.v2beta.MerchantCenterLink} MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rating.decode = function decode(reader, length) { + MerchantCenterLink.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rating(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.MerchantCenterLink(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.ratingCount = reader.int32(); + message.merchantCenterAccountId = reader.int64(); break; case 2: - message.averageRating = reader.float(); + message.branchId = reader.string(); break; case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.ratingHistogram.push(reader.int32()); - } else - message.ratingHistogram.push(reader.int32()); + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + message.destinations.push(reader.string()); + break; + case 4: + message.regionCode = reader.string(); + break; + case 5: + message.languageCode = reader.string(); break; default: reader.skipType(tag & 7); @@ -57920,140 +55757,168 @@ }; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Rating} Rating + * @returns {google.cloud.retail.v2beta.MerchantCenterLink} MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rating.decodeDelimited = function decodeDelimited(reader) { + MerchantCenterLink.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Rating message. + * Verifies a MerchantCenterLink message. * @function verify - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rating.verify = function verify(message) { + MerchantCenterLink.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - if (!$util.isInteger(message.ratingCount)) - return "ratingCount: integer expected"; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - if (typeof message.averageRating !== "number") - return "averageRating: number expected"; - if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { - if (!Array.isArray(message.ratingHistogram)) - return "ratingHistogram: array expected"; - for (var i = 0; i < message.ratingHistogram.length; ++i) - if (!$util.isInteger(message.ratingHistogram[i])) - return "ratingHistogram: integer[] expected"; + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (!$util.isInteger(message.merchantCenterAccountId) && !(message.merchantCenterAccountId && $util.isInteger(message.merchantCenterAccountId.low) && $util.isInteger(message.merchantCenterAccountId.high))) + return "merchantCenterAccountId: integer|Long expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + if (!$util.isString(message.destinations[i])) + return "destinations: string[] expected"; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + if (!$util.isString(message.regionCode)) + return "regionCode: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; return null; }; /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Rating} Rating + * @returns {google.cloud.retail.v2beta.MerchantCenterLink} MerchantCenterLink */ - Rating.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Rating) + MerchantCenterLink.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.MerchantCenterLink) return object; - var message = new $root.google.cloud.retail.v2beta.Rating(); - if (object.ratingCount != null) - message.ratingCount = object.ratingCount | 0; - if (object.averageRating != null) - message.averageRating = Number(object.averageRating); - if (object.ratingHistogram) { - if (!Array.isArray(object.ratingHistogram)) - throw TypeError(".google.cloud.retail.v2beta.Rating.ratingHistogram: array expected"); - message.ratingHistogram = []; - for (var i = 0; i < object.ratingHistogram.length; ++i) - message.ratingHistogram[i] = object.ratingHistogram[i] | 0; + var message = new $root.google.cloud.retail.v2beta.MerchantCenterLink(); + if (object.merchantCenterAccountId != null) + if ($util.Long) + (message.merchantCenterAccountId = $util.Long.fromValue(object.merchantCenterAccountId)).unsigned = false; + else if (typeof object.merchantCenterAccountId === "string") + message.merchantCenterAccountId = parseInt(object.merchantCenterAccountId, 10); + else if (typeof object.merchantCenterAccountId === "number") + message.merchantCenterAccountId = object.merchantCenterAccountId; + else if (typeof object.merchantCenterAccountId === "object") + message.merchantCenterAccountId = new $util.LongBits(object.merchantCenterAccountId.low >>> 0, object.merchantCenterAccountId.high >>> 0).toNumber(); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.cloud.retail.v2beta.MerchantCenterLink.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + message.destinations[i] = String(object.destinations[i]); } + if (object.regionCode != null) + message.regionCode = String(object.regionCode); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); return message; }; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @static - * @param {google.cloud.retail.v2beta.Rating} message Rating + * @param {google.cloud.retail.v2beta.MerchantCenterLink} message MerchantCenterLink * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Rating.toObject = function toObject(message, options) { + MerchantCenterLink.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.ratingHistogram = []; + object.destinations = []; if (options.defaults) { - object.ratingCount = 0; - object.averageRating = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.merchantCenterAccountId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.merchantCenterAccountId = options.longs === String ? "0" : 0; + object.branchId = ""; + object.regionCode = ""; + object.languageCode = ""; } - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - object.ratingCount = message.ratingCount; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; - if (message.ratingHistogram && message.ratingHistogram.length) { - object.ratingHistogram = []; - for (var j = 0; j < message.ratingHistogram.length; ++j) - object.ratingHistogram[j] = message.ratingHistogram[j]; + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (typeof message.merchantCenterAccountId === "number") + object.merchantCenterAccountId = options.longs === String ? String(message.merchantCenterAccountId) : message.merchantCenterAccountId; + else + object.merchantCenterAccountId = options.longs === String ? $util.Long.prototype.toString.call(message.merchantCenterAccountId) : options.longs === Number ? new $util.LongBits(message.merchantCenterAccountId.low >>> 0, message.merchantCenterAccountId.high >>> 0).toNumber() : message.merchantCenterAccountId; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = message.destinations[j]; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; return object; }; /** - * Converts this Rating to JSON. + * Converts this MerchantCenterLink to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Rating + * @memberof google.cloud.retail.v2beta.MerchantCenterLink * @instance * @returns {Object.} JSON object */ - Rating.prototype.toJSON = function toJSON() { + MerchantCenterLink.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Rating; + return MerchantCenterLink; })(); - v2beta.UserInfo = (function() { + v2beta.MerchantCenterLinkingConfig = (function() { /** - * Properties of a UserInfo. + * Properties of a MerchantCenterLinkingConfig. * @memberof google.cloud.retail.v2beta - * @interface IUserInfo - * @property {string|null} [userId] UserInfo userId - * @property {string|null} [ipAddress] UserInfo ipAddress - * @property {string|null} [userAgent] UserInfo userAgent - * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + * @interface IMerchantCenterLinkingConfig + * @property {Array.|null} [links] MerchantCenterLinkingConfig links */ /** - * Constructs a new UserInfo. + * Constructs a new MerchantCenterLinkingConfig. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserInfo. - * @implements IUserInfo + * @classdesc Represents a MerchantCenterLinkingConfig. + * @implements IMerchantCenterLinkingConfig * @constructor - * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IMerchantCenterLinkingConfig=} [properties] Properties to set */ - function UserInfo(properties) { + function MerchantCenterLinkingConfig(properties) { + this.links = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58061,114 +55926,78 @@ } /** - * UserInfo userId. - * @member {string} userId - * @memberof google.cloud.retail.v2beta.UserInfo - * @instance - */ - UserInfo.prototype.userId = ""; - - /** - * UserInfo ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.retail.v2beta.UserInfo - * @instance - */ - UserInfo.prototype.ipAddress = ""; - - /** - * UserInfo userAgent. - * @member {string} userAgent - * @memberof google.cloud.retail.v2beta.UserInfo - * @instance - */ - UserInfo.prototype.userAgent = ""; - - /** - * UserInfo directUserRequest. - * @member {boolean} directUserRequest - * @memberof google.cloud.retail.v2beta.UserInfo + * MerchantCenterLinkingConfig links. + * @member {Array.} links + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @instance */ - UserInfo.prototype.directUserRequest = false; + MerchantCenterLinkingConfig.prototype.links = $util.emptyArray; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo instance + * @param {google.cloud.retail.v2beta.IMerchantCenterLinkingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig instance */ - UserInfo.create = function create(properties) { - return new UserInfo(properties); + MerchantCenterLinkingConfig.create = function create(properties) { + return new MerchantCenterLinkingConfig(properties); }; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLinkingConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2beta.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encode = function encode(message, writer) { + MerchantCenterLinkingConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + if (message.links != null && message.links.length) + for (var i = 0; i < message.links.length; ++i) + $root.google.cloud.retail.v2beta.MerchantCenterLink.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.MerchantCenterLinkingConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2beta.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + MerchantCenterLinkingConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @returns {google.cloud.retail.v2beta.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decode = function decode(reader, length) { + MerchantCenterLinkingConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userId = reader.string(); - break; - case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.cloud.retail.v2beta.MerchantCenterLink.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -58179,132 +56008,127 @@ }; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @returns {google.cloud.retail.v2beta.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decodeDelimited = function decodeDelimited(reader) { + MerchantCenterLinkingConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserInfo message. + * Verifies a MerchantCenterLinkingConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserInfo.verify = function verify(message) { + MerchantCenterLinkingConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userId != null && message.hasOwnProperty("userId")) - if (!$util.isString(message.userId)) - return "userId: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - if (typeof message.directUserRequest !== "boolean") - return "directUserRequest: boolean expected"; + if (message.links != null && message.hasOwnProperty("links")) { + if (!Array.isArray(message.links)) + return "links: array expected"; + for (var i = 0; i < message.links.length; ++i) { + var error = $root.google.cloud.retail.v2beta.MerchantCenterLink.verify(message.links[i]); + if (error) + return "links." + error; + } + } return null; }; /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @returns {google.cloud.retail.v2beta.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig */ - UserInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserInfo) + MerchantCenterLinkingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig) return object; - var message = new $root.google.cloud.retail.v2beta.UserInfo(); - if (object.userId != null) - message.userId = String(object.userId); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.directUserRequest != null) - message.directUserRequest = Boolean(object.directUserRequest); + var message = new $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig(); + if (object.links) { + if (!Array.isArray(object.links)) + throw TypeError(".google.cloud.retail.v2beta.MerchantCenterLinkingConfig.links: array expected"); + message.links = []; + for (var i = 0; i < object.links.length; ++i) { + if (typeof object.links[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.MerchantCenterLinkingConfig.links: object expected"); + message.links[i] = $root.google.cloud.retail.v2beta.MerchantCenterLink.fromObject(object.links[i]); + } + } return message; }; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @static - * @param {google.cloud.retail.v2beta.UserInfo} message UserInfo + * @param {google.cloud.retail.v2beta.MerchantCenterLinkingConfig} message MerchantCenterLinkingConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserInfo.toObject = function toObject(message, options) { + MerchantCenterLinkingConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.userId = ""; - object.ipAddress = ""; - object.userAgent = ""; - object.directUserRequest = false; + if (options.arrays || options.defaults) + object.links = []; + if (message.links && message.links.length) { + object.links = []; + for (var j = 0; j < message.links.length; ++j) + object.links[j] = $root.google.cloud.retail.v2beta.MerchantCenterLink.toObject(message.links[j], options); } - if (message.userId != null && message.hasOwnProperty("userId")) - object.userId = message.userId; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this UserInfo to JSON. + * Converts this MerchantCenterLinkingConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UserInfo + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig * @instance * @returns {Object.} JSON object */ - UserInfo.prototype.toJSON = function toJSON() { + MerchantCenterLinkingConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserInfo; + return MerchantCenterLinkingConfig; })(); - v2beta.Promotion = (function() { + v2beta.Catalog = (function() { /** - * Properties of a Promotion. + * Properties of a Catalog. * @memberof google.cloud.retail.v2beta - * @interface IPromotion - * @property {string|null} [promotionId] Promotion promotionId + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2beta.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * @property {google.cloud.retail.v2beta.IMerchantCenterLinkingConfig|null} [merchantCenterLinkingConfig] Catalog merchantCenterLinkingConfig */ /** - * Constructs a new Promotion. + * Constructs a new Catalog. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Promotion. - * @implements IPromotion + * @classdesc Represents a Catalog. + * @implements ICatalog * @constructor - * @param {google.cloud.retail.v2beta.IPromotion=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set */ - function Promotion(properties) { + function Catalog(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58312,75 +56136,114 @@ } /** - * Promotion promotionId. - * @member {string} promotionId - * @memberof google.cloud.retail.v2beta.Promotion + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Catalog * @instance */ - Promotion.prototype.promotionId = ""; + Catalog.prototype.name = ""; /** - * Creates a new Promotion instance using the specified properties. + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; + + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2beta.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; + + /** + * Catalog merchantCenterLinkingConfig. + * @member {google.cloud.retail.v2beta.IMerchantCenterLinkingConfig|null|undefined} merchantCenterLinkingConfig + * @memberof google.cloud.retail.v2beta.Catalog + * @instance + */ + Catalog.prototype.merchantCenterLinkingConfig = null; + + /** + * Creates a new Catalog instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static - * @param {google.cloud.retail.v2beta.IPromotion=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Promotion} Promotion instance + * @param {google.cloud.retail.v2beta.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Catalog} Catalog instance */ - Promotion.create = function create(properties) { - return new Promotion(properties); + Catalog.create = function create(properties) { + return new Catalog(properties); }; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static - * @param {google.cloud.retail.v2beta.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encode = function encode(message, writer) { + Catalog.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2beta.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.merchantCenterLinkingConfig != null && Object.hasOwnProperty.call(message, "merchantCenterLinkingConfig")) + $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.encode(message.merchantCenterLinkingConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Catalog.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static - * @param {google.cloud.retail.v2beta.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2beta.ICatalog} message Catalog message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encodeDelimited = function encodeDelimited(message, writer) { + Catalog.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @returns {google.cloud.retail.v2beta.Catalog} Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decode = function decode(reader, length) { + Catalog.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Promotion(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Catalog(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.promotionId = reader.string(); + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); + break; + case 6: + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -58391,109 +56254,193 @@ }; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @returns {google.cloud.retail.v2beta.Catalog} Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decodeDelimited = function decodeDelimited(reader) { + Catalog.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Promotion message. + * Verifies a Catalog message. * @function verify - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Promotion.verify = function verify(message) { + Catalog.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - if (!$util.isString(message.promotionId)) - return "promotionId: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2beta.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { + var error = $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (error) + return "merchantCenterLinkingConfig." + error; + } return null; }; /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @returns {google.cloud.retail.v2beta.Catalog} Catalog */ - Promotion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Promotion) + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Catalog) return object; - var message = new $root.google.cloud.retail.v2beta.Promotion(); - if (object.promotionId != null) - message.promotionId = String(object.promotionId); + var message = new $root.google.cloud.retail.v2beta.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.fromObject(object.productLevelConfig); + } + if (object.merchantCenterLinkingConfig != null) { + if (typeof object.merchantCenterLinkingConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.Catalog.merchantCenterLinkingConfig: object expected"); + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); + } return message; }; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * Creates a plain object from a Catalog message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @static - * @param {google.cloud.retail.v2beta.Promotion} message Promotion + * @param {google.cloud.retail.v2beta.Catalog} message Catalog * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Promotion.toObject = function toObject(message, options) { + Catalog.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.promotionId = ""; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - object.promotionId = message.promotionId; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + object.merchantCenterLinkingConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) + object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); return object; }; /** - * Converts this Promotion to JSON. + * Converts this Catalog to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.Promotion + * @memberof google.cloud.retail.v2beta.Catalog * @instance * @returns {Object.} JSON object */ - Promotion.prototype.toJSON = function toJSON() { + Catalog.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Promotion; + return Catalog; })(); - v2beta.GcsSource = (function() { + /** + * AttributeConfigLevel enum. + * @name google.cloud.retail.v2beta.AttributeConfigLevel + * @enum {number} + * @property {number} ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED=0 ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED value + * @property {number} PRODUCT_LEVEL_ATTRIBUTE_CONFIG=1 PRODUCT_LEVEL_ATTRIBUTE_CONFIG value + * @property {number} CATALOG_LEVEL_ATTRIBUTE_CONFIG=2 CATALOG_LEVEL_ATTRIBUTE_CONFIG value + */ + v2beta.AttributeConfigLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_LEVEL_ATTRIBUTE_CONFIG"] = 1; + values[valuesById[2] = "CATALOG_LEVEL_ATTRIBUTE_CONFIG"] = 2; + return values; + })(); + + /** + * SolutionType enum. + * @name google.cloud.retail.v2beta.SolutionType + * @enum {number} + * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value + * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value + * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value + */ + v2beta.SolutionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; + values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; + return values; + })(); + + /** + * SearchSolutionUseCase enum. + * @name google.cloud.retail.v2beta.SearchSolutionUseCase + * @enum {number} + * @property {number} SEARCH_SOLUTION_USE_CASE_UNSPECIFIED=0 SEARCH_SOLUTION_USE_CASE_UNSPECIFIED value + * @property {number} SEARCH_SOLUTION_USE_CASE_SEARCH=1 SEARCH_SOLUTION_USE_CASE_SEARCH value + * @property {number} SEARCH_SOLUTION_USE_CASE_BROWSE=2 SEARCH_SOLUTION_USE_CASE_BROWSE value + */ + v2beta.SearchSolutionUseCase = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SEARCH_SOLUTION_USE_CASE_SEARCH"] = 1; + values[valuesById[2] = "SEARCH_SOLUTION_USE_CASE_BROWSE"] = 2; + return values; + })(); + + v2beta.Condition = (function() { /** - * Properties of a GcsSource. + * Properties of a Condition. * @memberof google.cloud.retail.v2beta - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema + * @interface ICondition + * @property {Array.|null} [queryTerms] Condition queryTerms + * @property {Array.|null} [activeTimeRange] Condition activeTimeRange */ /** - * Constructs a new GcsSource. + * Constructs a new Condition. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents a Condition. + * @implements ICondition * @constructor - * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICondition=} [properties] Properties to set */ - function GcsSource(properties) { - this.inputUris = []; + function Condition(properties) { + this.queryTerms = []; + this.activeTimeRange = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58501,91 +56448,94 @@ } /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2beta.GcsSource + * Condition queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Condition * @instance */ - GcsSource.prototype.inputUris = $util.emptyArray; + Condition.prototype.queryTerms = $util.emptyArray; /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2beta.GcsSource + * Condition activeTimeRange. + * @member {Array.} activeTimeRange + * @memberof google.cloud.retail.v2beta.Condition * @instance */ - GcsSource.prototype.dataSchema = ""; + Condition.prototype.activeTimeRange = $util.emptyArray; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new Condition instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static - * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource instance + * @param {google.cloud.retail.v2beta.ICondition=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Condition} Condition instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + Condition.create = function create(properties) { + return new Condition(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static - * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2beta.ICondition} message Condition message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + Condition.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + $root.google.cloud.retail.v2beta.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeTimeRange != null && message.activeTimeRange.length) + for (var i = 0; i < message.activeTimeRange.length; ++i) + $root.google.cloud.retail.v2beta.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static - * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2beta.ICondition} message Condition message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + Condition.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a Condition message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @returns {google.cloud.retail.v2beta.Condition} Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + Condition.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2beta.Condition.QueryTerm.decode(reader, reader.uint32())); break; - case 2: - message.dataSchema = reader.string(); + case 3: + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2beta.Condition.TimeRange.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -58596,133 +56546,588 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a Condition message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @returns {google.cloud.retail.v2beta.Condition} Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + Condition.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies a Condition message. * @function verify - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + Condition.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Condition.QueryTerm.verify(message.queryTerms[i]); + if (error) + return "queryTerms." + error; + } + } + if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { + if (!Array.isArray(message.activeTimeRange)) + return "activeTimeRange: array expected"; + for (var i = 0; i < message.activeTimeRange.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Condition.TimeRange.verify(message.activeTimeRange[i]); + if (error) + return "activeTimeRange." + error; + } } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a Condition message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @returns {google.cloud.retail.v2beta.Condition} Condition */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.GcsSource) + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Condition) return object; - var message = new $root.google.cloud.retail.v2beta.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2beta.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); + var message = new $root.google.cloud.retail.v2beta.Condition(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Condition.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) { + if (typeof object.queryTerms[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.queryTerms: object expected"); + message.queryTerms[i] = $root.google.cloud.retail.v2beta.Condition.QueryTerm.fromObject(object.queryTerms[i]); + } + } + if (object.activeTimeRange) { + if (!Array.isArray(object.activeTimeRange)) + throw TypeError(".google.cloud.retail.v2beta.Condition.activeTimeRange: array expected"); + message.activeTimeRange = []; + for (var i = 0; i < object.activeTimeRange.length; ++i) { + if (typeof object.activeTimeRange[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.activeTimeRange: object expected"); + message.activeTimeRange[i] = $root.google.cloud.retail.v2beta.Condition.TimeRange.fromObject(object.activeTimeRange[i]); + } } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from a Condition message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @static - * @param {google.cloud.retail.v2beta.GcsSource} message GcsSource + * @param {google.cloud.retail.v2beta.Condition} message Condition * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + Condition.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.inputUris = []; - if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; + if (options.arrays || options.defaults) { + object.queryTerms = []; + object.activeTimeRange = []; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = $root.google.cloud.retail.v2beta.Condition.QueryTerm.toObject(message.queryTerms[j], options); + } + if (message.activeTimeRange && message.activeTimeRange.length) { + object.activeTimeRange = []; + for (var j = 0; j < message.activeTimeRange.length; ++j) + object.activeTimeRange[j] = $root.google.cloud.retail.v2beta.Condition.TimeRange.toObject(message.activeTimeRange[j], options); } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; return object; }; /** - * Converts this GcsSource to JSON. + * Converts this Condition to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.GcsSource + * @memberof google.cloud.retail.v2beta.Condition * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + Condition.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; - })(); + Condition.QueryTerm = (function() { - v2beta.BigQuerySource = (function() { + /** + * Properties of a QueryTerm. + * @memberof google.cloud.retail.v2beta.Condition + * @interface IQueryTerm + * @property {string|null} [value] QueryTerm value + * @property {boolean|null} [fullMatch] QueryTerm fullMatch + */ - /** - * Properties of a BigQuerySource. - * @memberof google.cloud.retail.v2beta - * @interface IBigQuerySource - * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema - */ + /** + * Constructs a new QueryTerm. + * @memberof google.cloud.retail.v2beta.Condition + * @classdesc Represents a QueryTerm. + * @implements IQueryTerm + * @constructor + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm=} [properties] Properties to set + */ + function QueryTerm(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new BigQuerySource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource - * @constructor - * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set - */ - function BigQuerySource(properties) { + /** + * QueryTerm value. + * @member {string} value + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.value = ""; + + /** + * QueryTerm fullMatch. + * @member {boolean} fullMatch + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.fullMatch = false; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm instance + */ + QueryTerm.create = function create(properties) { + return new QueryTerm(properties); + }; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); + return writer; + }; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.QueryTerm.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition.QueryTerm(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.fullMatch = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTerm message. + * @function verify + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTerm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + if (typeof message.fullMatch !== "boolean") + return "fullMatch: boolean expected"; + return null; + }; + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Condition.QueryTerm} QueryTerm + */ + QueryTerm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Condition.QueryTerm) + return object; + var message = new $root.google.cloud.retail.v2beta.Condition.QueryTerm(); + if (object.value != null) + message.value = String(object.value); + if (object.fullMatch != null) + message.fullMatch = Boolean(object.fullMatch); + return message; + }; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2beta.Condition.QueryTerm} message QueryTerm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTerm.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.fullMatch = false; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + object.fullMatch = message.fullMatch; + return object; + }; + + /** + * Converts this QueryTerm to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @instance + * @returns {Object.} JSON object + */ + QueryTerm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTerm; + })(); + + Condition.TimeRange = (function() { + + /** + * Properties of a TimeRange. + * @memberof google.cloud.retail.v2beta.Condition + * @interface ITimeRange + * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime + */ + + /** + * Constructs a new TimeRange. + * @memberof google.cloud.retail.v2beta.Condition + * @classdesc Represents a TimeRange. + * @implements ITimeRange + * @constructor + * @param {google.cloud.retail.v2beta.Condition.ITimeRange=} [properties] Properties to set + */ + function TimeRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeRange startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @instance + */ + TimeRange.prototype.startTime = null; + + /** + * TimeRange endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @instance + */ + TimeRange.prototype.endTime = null; + + /** + * Creates a new TimeRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.ITimeRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange instance + */ + TimeRange.create = function create(properties) { + return new TimeRange(properties); + }; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Condition.TimeRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Condition.TimeRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeRange message. + * @function verify + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Condition.TimeRange} TimeRange + */ + TimeRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Condition.TimeRange) + return object; + var message = new $root.google.cloud.retail.v2beta.Condition.TimeRange(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.TimeRange.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Condition.TimeRange.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2beta.Condition.TimeRange} message TimeRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this TimeRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @instance + * @returns {Object.} JSON object + */ + TimeRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimeRange; + })(); + + return Condition; + })(); + + v2beta.Rule = (function() { + + /** + * Properties of a Rule. + * @memberof google.cloud.retail.v2beta + * @interface IRule + * @property {google.cloud.retail.v2beta.Rule.IBoostAction|null} [boostAction] Rule boostAction + * @property {google.cloud.retail.v2beta.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction + * @property {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction + * @property {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction + * @property {google.cloud.retail.v2beta.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction + * @property {google.cloud.retail.v2beta.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction + * @property {google.cloud.retail.v2beta.Rule.IFilterAction|null} [filterAction] Rule filterAction + * @property {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction + * @property {google.cloud.retail.v2beta.ICondition|null} [condition] Rule condition + */ + + /** + * Constructs a new Rule. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Rule. + * @implements IRule + * @constructor + * @param {google.cloud.retail.v2beta.IRule=} [properties] Properties to set + */ + function Rule(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58730,154 +57135,193 @@ } /** - * BigQuerySource partitionDate. - * @member {google.type.IDate|null|undefined} partitionDate - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule boostAction. + * @member {google.cloud.retail.v2beta.Rule.IBoostAction|null|undefined} boostAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - BigQuerySource.prototype.partitionDate = null; + Rule.prototype.boostAction = null; /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule redirectAction. + * @member {google.cloud.retail.v2beta.Rule.IRedirectAction|null|undefined} redirectAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - BigQuerySource.prototype.projectId = ""; + Rule.prototype.redirectAction = null; /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule onewaySynonymsAction. + * @member {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - BigQuerySource.prototype.datasetId = ""; + Rule.prototype.onewaySynonymsAction = null; /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule doNotAssociateAction. + * @member {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - BigQuerySource.prototype.tableId = ""; + Rule.prototype.doNotAssociateAction = null; /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule replacementAction. + * @member {google.cloud.retail.v2beta.Rule.IReplacementAction|null|undefined} replacementAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - BigQuerySource.prototype.gcsStagingDir = ""; + Rule.prototype.replacementAction = null; /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule ignoreAction. + * @member {google.cloud.retail.v2beta.Rule.IIgnoreAction|null|undefined} ignoreAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - BigQuerySource.prototype.dataSchema = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + Rule.prototype.ignoreAction = null; /** - * BigQuerySource partition. - * @member {"partitionDate"|undefined} partition - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule filterAction. + * @member {google.cloud.retail.v2beta.Rule.IFilterAction|null|undefined} filterAction + * @memberof google.cloud.retail.v2beta.Rule * @instance */ - Object.defineProperty(BigQuerySource.prototype, "partition", { - get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), - set: $util.oneOfSetter($oneOfFields) - }); + Rule.prototype.filterAction = null; /** - * Creates a new BigQuerySource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.BigQuerySource - * @static - * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource instance + * Rule twowaySynonymsAction. + * @member {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction + * @memberof google.cloud.retail.v2beta.Rule + * @instance */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); - }; + Rule.prototype.twowaySynonymsAction = null; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.BigQuerySource + * Rule condition. + * @member {google.cloud.retail.v2beta.ICondition|null|undefined} condition + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Rule.prototype.condition = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Rule action. + * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action + * @memberof google.cloud.retail.v2beta.Rule + * @instance + */ + Object.defineProperty(Rule.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Rule instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule * @static - * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2beta.IRule=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule} Rule instance + */ + Rule.create = function create(properties) { + return new Rule(properties); + }; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {google.cloud.retail.v2beta.IRule} message Rule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encode = function encode(message, writer) { + Rule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); - if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) - $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.cloud.retail.v2beta.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) + $root.google.cloud.retail.v2beta.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) + $root.google.cloud.retail.v2beta.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) + $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) + $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) + $root.google.cloud.retail.v2beta.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) + $root.google.cloud.retail.v2beta.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) + $root.google.cloud.retail.v2beta.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) + $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @static - * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2beta.IRule} message Rule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + Rule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a Rule message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2beta.Rule} Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + Rule.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 2: + message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.decode(reader, reader.uint32()); + break; + case 3: + message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.decode(reader, reader.uint32()); + break; case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); break; - case 5: - message.projectId = reader.string(); + case 7: + message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); break; - case 1: - message.datasetId = reader.string(); + case 8: + message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.decode(reader, reader.uint32()); break; - case 2: - message.tableId = reader.string(); + case 9: + message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.decode(reader, reader.uint32()); break; - case 3: - message.gcsStagingDir = reader.string(); + case 10: + message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.decode(reader, reader.uint32()); break; - case 4: - message.dataSchema = reader.string(); + case 11: + message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + case 1: + message.condition = $root.google.cloud.retail.v2beta.Condition.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -58888,1746 +57332,2168 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a Rule message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2beta.Rule} Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + Rule.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies a Rule message. * @function verify - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + Rule.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - properties.partition = 1; + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + properties.action = 1; { - var error = $root.google.type.Date.verify(message.partitionDate); + var error = $root.google.cloud.retail.v2beta.Rule.BoostAction.verify(message.boostAction); if (error) - return "partitionDate." + error; + return "boostAction." + error; } } - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.RedirectAction.verify(message.redirectAction); + if (error) + return "redirectAction." + error; + } + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); + if (error) + return "onewaySynonymsAction." + error; + } + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); + if (error) + return "doNotAssociateAction." + error; + } + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.verify(message.replacementAction); + if (error) + return "replacementAction." + error; + } + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.verify(message.ignoreAction); + if (error) + return "ignoreAction." + error; + } + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.FilterAction.verify(message.filterAction); + if (error) + return "filterAction." + error; + } + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (error) + return "twowaySynonymsAction." + error; + } + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.cloud.retail.v2beta.Condition.verify(message.condition); + if (error) + return "condition." + error; + } return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a Rule message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2beta.Rule} Rule */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.BigQuerySource) + Rule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule) return object; - var message = new $root.google.cloud.retail.v2beta.BigQuerySource(); - if (object.partitionDate != null) { - if (typeof object.partitionDate !== "object") - throw TypeError(".google.cloud.retail.v2beta.BigQuerySource.partitionDate: object expected"); - message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); + var message = new $root.google.cloud.retail.v2beta.Rule(); + if (object.boostAction != null) { + if (typeof object.boostAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.boostAction: object expected"); + message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.fromObject(object.boostAction); + } + if (object.redirectAction != null) { + if (typeof object.redirectAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.redirectAction: object expected"); + message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.fromObject(object.redirectAction); + } + if (object.onewaySynonymsAction != null) { + if (typeof object.onewaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.onewaySynonymsAction: object expected"); + message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + } + if (object.doNotAssociateAction != null) { + if (typeof object.doNotAssociateAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.doNotAssociateAction: object expected"); + message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); + } + if (object.replacementAction != null) { + if (typeof object.replacementAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.replacementAction: object expected"); + message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.fromObject(object.replacementAction); + } + if (object.ignoreAction != null) { + if (typeof object.ignoreAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.ignoreAction: object expected"); + message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.fromObject(object.ignoreAction); + } + if (object.filterAction != null) { + if (typeof object.filterAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.filterAction: object expected"); + message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.fromObject(object.filterAction); + } + if (object.twowaySynonymsAction != null) { + if (typeof object.twowaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.twowaySynonymsAction: object expected"); + message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.cloud.retail.v2beta.Rule.condition: object expected"); + message.condition = $root.google.cloud.retail.v2beta.Condition.fromObject(object.condition); } - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from a Rule message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @static - * @param {google.cloud.retail.v2beta.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2beta.Rule} message Rule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + Rule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; + if (options.defaults) + object.condition = null; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.cloud.retail.v2beta.Condition.toObject(message.condition, options); + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + object.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.toObject(message.boostAction, options); + if (options.oneofs) + object.action = "boostAction"; } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + object.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.toObject(message.redirectAction, options); if (options.oneofs) - object.partition = "partitionDate"; + object.action = "redirectAction"; + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + object.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); + if (options.oneofs) + object.action = "onewaySynonymsAction"; + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + object.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); + if (options.oneofs) + object.action = "doNotAssociateAction"; + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + object.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.toObject(message.replacementAction, options); + if (options.oneofs) + object.action = "replacementAction"; + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + object.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.toObject(message.ignoreAction, options); + if (options.oneofs) + object.action = "ignoreAction"; + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + object.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.toObject(message.filterAction, options); + if (options.oneofs) + object.action = "filterAction"; + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + object.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); + if (options.oneofs) + object.action = "twowaySynonymsAction"; } return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this Rule to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.BigQuerySource + * @memberof google.cloud.retail.v2beta.Rule * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + Rule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BigQuerySource; - })(); + Rule.BoostAction = (function() { - v2beta.ProductInlineSource = (function() { + /** + * Properties of a BoostAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IBoostAction + * @property {number|null} [boost] BoostAction boost + * @property {string|null} [productsFilter] BoostAction productsFilter + */ - /** - * Properties of a ProductInlineSource. - * @memberof google.cloud.retail.v2beta - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products - */ + /** + * Constructs a new BoostAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a BoostAction. + * @implements IBoostAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IBoostAction=} [properties] Properties to set + */ + function BoostAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ProductInlineSource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource - * @constructor - * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set - */ - function ProductInlineSource(properties) { - this.products = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * BoostAction boost. + * @member {number} boost + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @instance + */ + BoostAction.prototype.boost = 0; - /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @instance - */ - ProductInlineSource.prototype.products = $util.emptyArray; + /** + * BoostAction productsFilter. + * @member {string} productsFilter + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @instance + */ + BoostAction.prototype.productsFilter = ""; - /** - * Creates a new ProductInlineSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource instance - */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); - }; + /** + * Creates a new BoostAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IBoostAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction instance + */ + BoostAction.create = function create(properties) { + return new BoostAction(properties); + }; - /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductInlineSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); + if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + return writer; + }; - /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.BoostAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ProductInlineSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductInlineSource.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.BoostAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.boost = reader.float(); + break; + case 2: + message.productsFilter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ProductInlineSource message. - * @function verify - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductInlineSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - return null; - }; + /** + * Verifies a BoostAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + if (!$util.isString(message.productsFilter)) + return "productsFilter: string expected"; + return null; + }; - /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource - */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductInlineSource) - return object; - var message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); - } - } - return message; - }; + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.BoostAction} BoostAction + */ + BoostAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.BoostAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.BoostAction(); + if (object.boost != null) + message.boost = Number(object.boost); + if (object.productsFilter != null) + message.productsFilter = String(object.productsFilter); + return message; + }; - /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @static - * @param {google.cloud.retail.v2beta.ProductInlineSource} message ProductInlineSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); - } - return object; - }; + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2beta.Rule.BoostAction} message BoostAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.boost = 0; + object.productsFilter = ""; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + object.productsFilter = message.productsFilter; + return object; + }; - /** - * Converts this ProductInlineSource to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductInlineSource - * @instance - * @returns {Object.} JSON object - */ - ProductInlineSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this BoostAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @instance + * @returns {Object.} JSON object + */ + BoostAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return ProductInlineSource; - })(); + return BoostAction; + })(); - v2beta.UserEventInlineSource = (function() { + Rule.FilterAction = (function() { - /** - * Properties of a UserEventInlineSource. - * @memberof google.cloud.retail.v2beta - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents - */ + /** + * Properties of a FilterAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IFilterAction + * @property {string|null} [filter] FilterAction filter + */ - /** - * Constructs a new UserEventInlineSource. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource - * @constructor - * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set - */ - function UserEventInlineSource(properties) { - this.userEvents = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new FilterAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a FilterAction. + * @implements IFilterAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IFilterAction=} [properties] Properties to set + */ + function FilterAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @instance - */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; + /** + * FilterAction filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @instance + */ + FilterAction.prototype.filter = ""; - /** - * Creates a new UserEventInlineSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource instance - */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); - }; + /** + * Creates a new FilterAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IFilterAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction instance + */ + FilterAction.create = function create(properties) { + return new FilterAction(properties); + }; - /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventInlineSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + return writer; + }; - /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.FilterAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventInlineSource.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.FilterAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; - - /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a UserEventInlineSource message. - * @function verify - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UserEventInlineSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvents[i]); - if (error) - return "userEvents." + error; - } - } - return null; - }; + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource - */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEventInlineSource) - return object; - var message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvents[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2beta.UserEventInlineSource} message UserEventInlineSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserEventInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvents[j], options); - } - return object; - }; + /** + * Verifies a FilterAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilterAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; - /** - * Converts this UserEventInlineSource to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEventInlineSource - * @instance - * @returns {Object.} JSON object - */ - UserEventInlineSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.FilterAction} FilterAction + */ + FilterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.FilterAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.FilterAction(); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; - return UserEventInlineSource; - })(); + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2beta.Rule.FilterAction} message FilterAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilterAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.filter = ""; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; - v2beta.ImportErrorsConfig = (function() { + /** + * Converts this FilterAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @instance + * @returns {Object.} JSON object + */ + FilterAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of an ImportErrorsConfig. - * @memberof google.cloud.retail.v2beta - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix - */ + return FilterAction; + })(); - /** - * Constructs a new ImportErrorsConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig - * @constructor - * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set - */ - function ImportErrorsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Rule.RedirectAction = (function() { - /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @instance - */ - ImportErrorsConfig.prototype.gcsPrefix = null; + /** + * Properties of a RedirectAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IRedirectAction + * @property {string|null} [redirectUri] RedirectAction redirectUri + */ - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Constructs a new RedirectAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a RedirectAction. + * @implements IRedirectAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction=} [properties] Properties to set + */ + function RedirectAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @instance - */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * RedirectAction redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @instance + */ + RedirectAction.prototype.redirectUri = ""; - /** - * Creates a new ImportErrorsConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig instance - */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); - }; + /** + * Creates a new RedirectAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction instance + */ + RedirectAction.create = function create(properties) { + return new RedirectAction(properties); + }; - /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportErrorsConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); - return writer; - }; + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); + return writer; + }; - /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.RedirectAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportErrorsConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.RedirectAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redirectUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an ImportErrorsConfig message. - * @function verify - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportErrorsConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } - return null; - }; + /** + * Verifies a RedirectAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedirectAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; - /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig - */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportErrorsConfig) + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.RedirectAction} RedirectAction + */ + RedirectAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.RedirectAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.RedirectAction(); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2beta.Rule.RedirectAction} message RedirectAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedirectAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.redirectUri = ""; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; return object; - var message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); - return message; - }; + }; - /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2beta.ImportErrorsConfig} message ImportErrorsConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportErrorsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; - } - return object; - }; + /** + * Converts this RedirectAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @instance + * @returns {Object.} JSON object + */ + RedirectAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this ImportErrorsConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportErrorsConfig - * @instance - * @returns {Object.} JSON object - */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return RedirectAction; + })(); - return ImportErrorsConfig; - })(); + Rule.TwowaySynonymsAction = (function() { - v2beta.ImportProductsRequest = (function() { + /** + * Properties of a TwowaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface ITwowaySynonymsAction + * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms + */ - /** - * Properties of an ImportProductsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {string|null} [requestId] ImportProductsRequest requestId - * @property {google.cloud.retail.v2beta.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask - * @property {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode - * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic - */ + /** + * Constructs a new TwowaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a TwowaySynonymsAction. + * @implements ITwowaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction=} [properties] Properties to set + */ + function TwowaySynonymsAction(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ImportProductsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest - * @constructor - * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set - */ - function ImportProductsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ImportProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.parent = ""; - - /** - * ImportProductsRequest requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.requestId = ""; - - /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2beta.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.inputConfig = null; - - /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.errorsConfig = null; - - /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.updateMask = null; + /** + * TwowaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @instance + */ + TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; - /** - * ImportProductsRequest reconciliationMode. - * @member {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode} reconciliationMode - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.reconciliationMode = 0; + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance + */ + TwowaySynonymsAction.create = function create(properties) { + return new TwowaySynonymsAction(properties); + }; - /** - * ImportProductsRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.notificationPubsubTopic = ""; + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); + return writer; + }; - /** - * Creates a new ImportProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest instance - */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); - }; + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2beta.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); - return writer; - }; + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.reconciliationMode = reader.int32(); - break; - case 7: - message.notificationPubsubTopic = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Verifies a TwowaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TwowaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; } - } - return message; - }; - - /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return null; + }; - /** - * Verifies an ImportProductsRequest message. - * @function verify - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2beta.ProductInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - switch (message.reconciliationMode) { - default: - return "reconciliationMode: enum value expected"; - case 0: - case 1: - case 2: - break; + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} TwowaySynonymsAction + */ + TwowaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction(); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; - return null; - }; + return message; + }; - /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest - */ - ImportProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsRequest) + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.TwowaySynonymsAction} message TwowaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TwowaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } return object; - var message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - switch (object.reconciliationMode) { - case "RECONCILIATION_MODE_UNSPECIFIED": - case 0: - message.reconciliationMode = 0; - break; - case "INCREMENTAL": - case 1: - message.reconciliationMode = 1; - break; - case "FULL": - case 2: - message.reconciliationMode = 2; - break; - } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); - return message; - }; - - /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2beta.ImportProductsRequest} message ImportProductsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - object.updateMask = null; - object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; - return object; - }; + }; - /** - * Converts this ImportProductsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportProductsRequest - * @instance - * @returns {Object.} JSON object - */ - ImportProductsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this TwowaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + TwowaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * ReconciliationMode enum. - * @name google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode - * @enum {number} - * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value - * @property {number} INCREMENTAL=1 INCREMENTAL value - * @property {number} FULL=2 FULL value - */ - ImportProductsRequest.ReconciliationMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INCREMENTAL"] = 1; - values[valuesById[2] = "FULL"] = 2; - return values; + return TwowaySynonymsAction; })(); - return ImportProductsRequest; - })(); - - v2beta.ImportUserEventsRequest = (function() { + Rule.OnewaySynonymsAction = (function() { - /** - * Properties of an ImportUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IImportUserEventsRequest - * @property {string|null} [parent] ImportUserEventsRequest parent - * @property {google.cloud.retail.v2beta.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig - */ + /** + * Properties of an OnewaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IOnewaySynonymsAction + * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms + * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms + * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms + */ - /** - * Constructs a new ImportUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportUserEventsRequest. - * @implements IImportUserEventsRequest - * @constructor - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set - */ - function ImportUserEventsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new OnewaySynonymsAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents an OnewaySynonymsAction. + * @implements IOnewaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction=} [properties] Properties to set + */ + function OnewaySynonymsAction(properties) { + this.queryTerms = []; + this.synonyms = []; + this.onewayTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ImportUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @instance - */ - ImportUserEventsRequest.prototype.parent = ""; + /** + * OnewaySynonymsAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; - /** - * ImportUserEventsRequest inputConfig. - * @member {google.cloud.retail.v2beta.IUserEventInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @instance - */ - ImportUserEventsRequest.prototype.inputConfig = null; + /** + * OnewaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; - /** - * ImportUserEventsRequest errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @instance - */ - ImportUserEventsRequest.prototype.errorsConfig = null; + /** + * OnewaySynonymsAction onewayTerms. + * @member {Array.} onewayTerms + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; - /** - * Creates a new ImportUserEventsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest instance - */ - ImportUserEventsRequest.create = function create(properties) { - return new ImportUserEventsRequest(properties); - }; + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + */ + OnewaySynonymsAction.create = function create(properties) { + return new OnewaySynonymsAction(properties); + }; - /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportUserEventsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2beta.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.onewayTerms != null && message.onewayTerms.length) + for (var i = 0; i < message.onewayTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + return writer; + }; - /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportUserEventsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 4: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + case 2: + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an ImportUserEventsRequest message. - * @function verify - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportUserEventsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2beta.UserEventInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - return null; - }; + /** + * Verifies an OnewaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnewaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { + if (!Array.isArray(message.onewayTerms)) + return "onewayTerms: array expected"; + for (var i = 0; i < message.onewayTerms.length; ++i) + if (!$util.isString(message.onewayTerms[i])) + return "onewayTerms: string[] expected"; + } + return null; + }; - /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest - */ - ImportUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsRequest) + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} OnewaySynonymsAction + */ + OnewaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + if (object.onewayTerms) { + if (!Array.isArray(object.onewayTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.onewayTerms: array expected"); + message.onewayTerms = []; + for (var i = 0; i < object.onewayTerms.length; ++i) + message.onewayTerms[i] = String(object.onewayTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2beta.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnewaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.onewayTerms = []; + object.queryTerms = []; + object.synonyms = []; + } + if (message.onewayTerms && message.onewayTerms.length) { + object.onewayTerms = []; + for (var j = 0; j < message.onewayTerms.length; ++j) + object.onewayTerms[j] = message.onewayTerms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } return object; - var message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } - return message; - }; + }; - /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @static - * @param {google.cloud.retail.v2beta.ImportUserEventsRequest} message ImportUserEventsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportUserEventsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); - return object; - }; + /** + * Converts this OnewaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + OnewaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this ImportUserEventsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest - * @instance - * @returns {Object.} JSON object - */ - ImportUserEventsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return OnewaySynonymsAction; + })(); - return ImportUserEventsRequest; - })(); + Rule.DoNotAssociateAction = (function() { - v2beta.ImportCompletionDataRequest = (function() { + /** + * Properties of a DoNotAssociateAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IDoNotAssociateAction + * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms + * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms + * @property {Array.|null} [terms] DoNotAssociateAction terms + */ - /** - * Properties of an ImportCompletionDataRequest. - * @memberof google.cloud.retail.v2beta - * @interface IImportCompletionDataRequest - * @property {string|null} [parent] ImportCompletionDataRequest parent - * @property {google.cloud.retail.v2beta.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig - * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic - */ + /** + * Constructs a new DoNotAssociateAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a DoNotAssociateAction. + * @implements IDoNotAssociateAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction=} [properties] Properties to set + */ + function DoNotAssociateAction(properties) { + this.queryTerms = []; + this.doNotAssociateTerms = []; + this.terms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ImportCompletionDataRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportCompletionDataRequest. - * @implements IImportCompletionDataRequest - * @constructor - * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest=} [properties] Properties to set - */ - function ImportCompletionDataRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ImportCompletionDataRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @instance - */ - ImportCompletionDataRequest.prototype.parent = ""; + /** + * DoNotAssociateAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; - /** - * ImportCompletionDataRequest inputConfig. - * @member {google.cloud.retail.v2beta.ICompletionDataInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @instance - */ - ImportCompletionDataRequest.prototype.inputConfig = null; + /** + * DoNotAssociateAction doNotAssociateTerms. + * @member {Array.} doNotAssociateTerms + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; - /** - * ImportCompletionDataRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @instance - */ - ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + /** + * DoNotAssociateAction terms. + * @member {Array.} terms + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.terms = $util.emptyArray; - /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest instance - */ - ImportCompletionDataRequest.create = function create(properties) { - return new ImportCompletionDataRequest(properties); - }; + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction instance + */ + DoNotAssociateAction.create = function create(properties) { + return new DoNotAssociateAction(properties); + }; - /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportCompletionDataRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2beta.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); - return writer; - }; + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.terms != null && message.terms.length) + for (var i = 0; i < message.terms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + return writer; + }; - /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportCompletionDataRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportCompletionDataRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.notificationPubsubTopic = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + case 1: + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an ImportCompletionDataRequest message. - * @function verify - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportCompletionDataRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; - return null; - }; + /** + * Verifies a DoNotAssociateAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoNotAssociateAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { + if (!Array.isArray(message.doNotAssociateTerms)) + return "doNotAssociateTerms: array expected"; + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + if (!$util.isString(message.doNotAssociateTerms[i])) + return "doNotAssociateTerms: string[] expected"; + } + if (message.terms != null && message.hasOwnProperty("terms")) { + if (!Array.isArray(message.terms)) + return "terms: array expected"; + for (var i = 0; i < message.terms.length; ++i) + if (!$util.isString(message.terms[i])) + return "terms: string[] expected"; + } + return null; + }; - /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest - */ - ImportCompletionDataRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportCompletionDataRequest) + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} DoNotAssociateAction + */ + DoNotAssociateAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.doNotAssociateTerms) { + if (!Array.isArray(object.doNotAssociateTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); + message.doNotAssociateTerms = []; + for (var i = 0; i < object.doNotAssociateTerms.length; ++i) + message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); + } + if (object.terms) { + if (!Array.isArray(object.terms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.DoNotAssociateAction.terms: array expected"); + message.terms = []; + for (var i = 0; i < object.terms.length; ++i) + message.terms[i] = String(object.terms[i]); + } + return message; + }; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2beta.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoNotAssociateAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.terms = []; + object.queryTerms = []; + object.doNotAssociateTerms = []; + } + if (message.terms && message.terms.length) { + object.terms = []; + for (var j = 0; j < message.terms.length; ++j) + object.terms[j] = message.terms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { + object.doNotAssociateTerms = []; + for (var j = 0; j < message.doNotAssociateTerms.length; ++j) + object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; + } return object; - var message = new $root.google.cloud.retail.v2beta.ImportCompletionDataRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.fromObject(object.inputConfig); - } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); - return message; - }; + }; - /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @static - * @param {google.cloud.retail.v2beta.ImportCompletionDataRequest} message ImportCompletionDataRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportCompletionDataRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.notificationPubsubTopic = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.toObject(message.inputConfig, options); - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; - return object; - }; + /** + * Converts this DoNotAssociateAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @instance + * @returns {Object.} JSON object + */ + DoNotAssociateAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this ImportCompletionDataRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest - * @instance - * @returns {Object.} JSON object - */ - ImportCompletionDataRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return DoNotAssociateAction; + })(); - return ImportCompletionDataRequest; - })(); + Rule.ReplacementAction = (function() { - v2beta.ProductInputConfig = (function() { + /** + * Properties of a ReplacementAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IReplacementAction + * @property {Array.|null} [queryTerms] ReplacementAction queryTerms + * @property {string|null} [replacementTerm] ReplacementAction replacementTerm + * @property {string|null} [term] ReplacementAction term + */ - /** - * Properties of a ProductInputConfig. - * @memberof google.cloud.retail.v2beta - * @interface IProductInputConfig - * @property {google.cloud.retail.v2beta.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource - */ + /** + * Constructs a new ReplacementAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents a ReplacementAction. + * @implements IReplacementAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction=} [properties] Properties to set + */ + function ReplacementAction(properties) { + this.queryTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ProductInputConfig. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig - * @constructor - * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set - */ - function ProductInputConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * ReplacementAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.queryTerms = $util.emptyArray; - /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2beta.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2beta.ProductInputConfig - * @instance - */ - ProductInputConfig.prototype.productInlineSource = null; + /** + * ReplacementAction replacementTerm. + * @member {string} replacementTerm + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.replacementTerm = ""; - /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2beta.ProductInputConfig - * @instance + /** + * ReplacementAction term. + * @member {string} term + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.term = ""; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction instance + */ + ReplacementAction.create = function create(properties) { + return new ReplacementAction(properties); + }; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.term != null && Object.hasOwnProperty.call(message, "term")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + return writer; + }; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.ReplacementAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.ReplacementAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + message.replacementTerm = reader.string(); + break; + case 1: + message.term = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplacementAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplacementAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + if (!$util.isString(message.replacementTerm)) + return "replacementTerm: string expected"; + if (message.term != null && message.hasOwnProperty("term")) + if (!$util.isString(message.term)) + return "term: string expected"; + return null; + }; + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.ReplacementAction} ReplacementAction + */ + ReplacementAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.ReplacementAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.ReplacementAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.ReplacementAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.replacementTerm != null) + message.replacementTerm = String(object.replacementTerm); + if (object.term != null) + message.term = String(object.term); + return message; + }; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2beta.Rule.ReplacementAction} message ReplacementAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplacementAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.queryTerms = []; + if (options.defaults) { + object.term = ""; + object.replacementTerm = ""; + } + if (message.term != null && message.hasOwnProperty("term")) + object.term = message.term; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + object.replacementTerm = message.replacementTerm; + return object; + }; + + /** + * Converts this ReplacementAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @instance + * @returns {Object.} JSON object + */ + ReplacementAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReplacementAction; + })(); + + Rule.IgnoreAction = (function() { + + /** + * Properties of an IgnoreAction. + * @memberof google.cloud.retail.v2beta.Rule + * @interface IIgnoreAction + * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + */ + + /** + * Constructs a new IgnoreAction. + * @memberof google.cloud.retail.v2beta.Rule + * @classdesc Represents an IgnoreAction. + * @implements IIgnoreAction + * @constructor + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction=} [properties] Properties to set + */ + function IgnoreAction(properties) { + this.ignoreTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IgnoreAction ignoreTerms. + * @member {Array.} ignoreTerms + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @instance + */ + IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction instance + */ + IgnoreAction.create = function create(properties) { + return new IgnoreAction(properties); + }; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ignoreTerms != null && message.ignoreTerms.length) + for (var i = 0; i < message.ignoreTerms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + return writer; + }; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rule.IgnoreAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rule.IgnoreAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IgnoreAction message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IgnoreAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { + if (!Array.isArray(message.ignoreTerms)) + return "ignoreTerms: array expected"; + for (var i = 0; i < message.ignoreTerms.length; ++i) + if (!$util.isString(message.ignoreTerms[i])) + return "ignoreTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rule.IgnoreAction} IgnoreAction + */ + IgnoreAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rule.IgnoreAction) + return object; + var message = new $root.google.cloud.retail.v2beta.Rule.IgnoreAction(); + if (object.ignoreTerms) { + if (!Array.isArray(object.ignoreTerms)) + throw TypeError(".google.cloud.retail.v2beta.Rule.IgnoreAction.ignoreTerms: array expected"); + message.ignoreTerms = []; + for (var i = 0; i < object.ignoreTerms.length; ++i) + message.ignoreTerms[i] = String(object.ignoreTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2beta.Rule.IgnoreAction} message IgnoreAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IgnoreAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreTerms = []; + if (message.ignoreTerms && message.ignoreTerms.length) { + object.ignoreTerms = []; + for (var j = 0; j < message.ignoreTerms.length; ++j) + object.ignoreTerms[j] = message.ignoreTerms[j]; + } + return object; + }; + + /** + * Converts this IgnoreAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @instance + * @returns {Object.} JSON object + */ + IgnoreAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IgnoreAction; + })(); + + return Rule; + })(); + + v2beta.Audience = (function() { + + /** + * Properties of an Audience. + * @memberof google.cloud.retail.v2beta + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups */ - ProductInputConfig.prototype.gcsSource = null; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2beta.ProductInputConfig - * @instance + * Constructs a new Audience. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an Audience. + * @implements IAudience + * @constructor + * @param {google.cloud.retail.v2beta.IAudience=} [properties] Properties to set */ - ProductInputConfig.prototype.bigQuerySource = null; + function Audience(properties) { + this.genders = []; + this.ageGroups = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2beta.Audience + * @instance + */ + Audience.prototype.genders = $util.emptyArray; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2beta.Audience * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + Audience.prototype.ageGroups = $util.emptyArray; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static - * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2beta.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Audience} Audience instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + Audience.create = function create(properties) { + return new Audience(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static - * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + Audience.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2beta.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Audience.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static - * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + Audience.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2beta.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + Audience.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Audience(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + case 2: + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -60638,159 +59504,143 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2beta.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + Audience.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies an Audience message. * @function verify - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + Audience.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; } return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2beta.Audience} Audience */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductInputConfig) + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Audience) return object; - var message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.fromObject(object.productInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.retail.v2beta.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2beta.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2beta.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); } return message; }; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * Creates a plain object from an Audience message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @static - * @param {google.cloud.retail.v2beta.ProductInputConfig} message ProductInputConfig + * @param {google.cloud.retail.v2beta.Audience} message Audience * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInputConfig.toObject = function toObject(message, options) { + Audience.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; } return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this Audience to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @memberof google.cloud.retail.v2beta.Audience * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + Audience.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; + return Audience; })(); - v2beta.UserEventInputConfig = (function() { + v2beta.ColorInfo = (function() { /** - * Properties of a UserEventInputConfig. + * Properties of a ColorInfo. * @memberof google.cloud.retail.v2beta - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2beta.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors */ /** - * Constructs a new UserEventInputConfig. + * Constructs a new ColorInfo. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IColorInfo=} [properties] Properties to set */ - function UserEventInputConfig(properties) { + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -60798,115 +59648,94 @@ } /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2beta.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2beta.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.userEventInlineSource = null; - - /** - * UserEventInputConfig gcsSource. - * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2beta.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.gcsSource = null; - - /** - * UserEventInputConfig bigQuerySource. - * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2beta.ColorInfo * @instance */ - UserEventInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ColorInfo.prototype.colorFamilies = $util.emptyArray; /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2beta.ColorInfo * @instance */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + ColorInfo.prototype.colors = $util.emptyArray; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static - * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig instance + * @param {google.cloud.retail.v2beta.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo instance */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static - * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2beta.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); return writer; }; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static - * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decode = function decode(reader, length) { + ColorInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -60917,157 +59746,145 @@ }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInputConfig message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInputConfig.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.UserEventInlineSource.verify(message.userEventInlineSource); - if (error) - return "userEventInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; } return null; }; /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2beta.ColorInfo} ColorInfo */ - UserEventInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEventInputConfig) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ColorInfo) return object; - var message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); - if (object.userEventInlineSource != null) { - if (typeof object.userEventInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.userEventInlineSource: object expected"); - message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.fromObject(object.userEventInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.retail.v2beta.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2beta.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2beta.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); } return message; }; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @static - * @param {google.cloud.retail.v2beta.UserEventInputConfig} message UserEventInputConfig + * @param {google.cloud.retail.v2beta.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInputConfig.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - object.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.toObject(message.userEventInlineSource, options); - if (options.oneofs) - object.source = "userEventInlineSource"; + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; } return object; }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @memberof google.cloud.retail.v2beta.ColorInfo * @instance * @returns {Object.} JSON object */ - UserEventInputConfig.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInputConfig; + return ColorInfo; })(); - v2beta.CompletionDataInputConfig = (function() { + v2beta.CustomAttribute = (function() { /** - * Properties of a CompletionDataInputConfig. + * Properties of a CustomAttribute. * @memberof google.cloud.retail.v2beta - * @interface ICompletionDataInputConfig - * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable */ /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new CustomAttribute. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CompletionDataInputConfig. - * @implements ICompletionDataInputConfig + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute * @constructor - * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set */ - function CompletionDataInputConfig(properties) { + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -61075,89 +59892,153 @@ } /** - * CompletionDataInputConfig bigQuerySource. - * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2beta.CustomAttribute * @instance */ - CompletionDataInputConfig.prototype.bigQuerySource = null; + CustomAttribute.prototype.text = $util.emptyArray; + + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; + + /** + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.searchable = null; + + /** + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + CustomAttribute.prototype.indexable = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * CompletionDataInputConfig source. - * @member {"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2beta.CustomAttribute * @instance */ - Object.defineProperty(CompletionDataInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static - * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig instance + * @param {google.cloud.retail.v2beta.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute instance */ - CompletionDataInputConfig.create = function create(properties) { - return new CompletionDataInputConfig(properties); + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); }; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static - * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encode = function encode(message, writer) { + CustomAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CustomAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static - * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decode = function decode(reader, length) { + CustomAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionDataInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CustomAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + case 2: + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + case 3: + message.searchable = reader.bool(); + break; + case 4: + message.indexable = reader.bool(); break; default: reader.skipType(tag & 7); @@ -61168,122 +60049,167 @@ }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a CustomAttribute message. * @function verify - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompletionDataInputConfig.verify = function verify(message) { + CustomAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; } return null; }; /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2beta.CustomAttribute} CustomAttribute */ - CompletionDataInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CompletionDataInputConfig) + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CustomAttribute) return object; - var message = new $root.google.cloud.retail.v2beta.CompletionDataInputConfig(); - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2beta.CompletionDataInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2beta.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2beta.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); return message; }; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @static - * @param {google.cloud.retail.v2beta.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {google.cloud.retail.v2beta.CustomAttribute} message CustomAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompletionDataInputConfig.toObject = function toObject(message, options) { + CustomAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; if (options.oneofs) - object.source = "bigQuerySource"; + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; } return object; }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this CustomAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @memberof google.cloud.retail.v2beta.CustomAttribute * @instance * @returns {Object.} JSON object */ - CompletionDataInputConfig.prototype.toJSON = function toJSON() { + CustomAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompletionDataInputConfig; + return CustomAttribute; })(); - v2beta.ImportMetadata = (function() { + v2beta.FulfillmentInfo = (function() { /** - * Properties of an ImportMetadata. + * Properties of a FulfillmentInfo. * @memberof google.cloud.retail.v2beta - * @interface IImportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime - * @property {number|Long|null} [successCount] ImportMetadata successCount - * @property {number|Long|null} [failureCount] ImportMetadata failureCount - * @property {string|null} [requestId] ImportMetadata requestId - * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds */ /** - * Constructs a new ImportMetadata. + * Constructs a new FulfillmentInfo. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportMetadata. - * @implements IImportMetadata + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo * @constructor - * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IFulfillmentInfo=} [properties] Properties to set */ - function ImportMetadata(properties) { + function FulfillmentInfo(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -61291,140 +60217,91 @@ } /** - * ImportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2beta.ImportMetadata - * @instance - */ - ImportMetadata.prototype.createTime = null; - - /** - * ImportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2beta.ImportMetadata - * @instance - */ - ImportMetadata.prototype.updateTime = null; - - /** - * ImportMetadata successCount. - * @member {number|Long} successCount - * @memberof google.cloud.retail.v2beta.ImportMetadata - * @instance - */ - ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ImportMetadata failureCount. - * @member {number|Long} failureCount - * @memberof google.cloud.retail.v2beta.ImportMetadata - * @instance - */ - ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ImportMetadata requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2beta.ImportMetadata + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @instance */ - ImportMetadata.prototype.requestId = ""; + FulfillmentInfo.prototype.type = ""; /** - * ImportMetadata notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2beta.ImportMetadata + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @instance */ - ImportMetadata.prototype.notificationPubsubTopic = ""; + FulfillmentInfo.prototype.placeIds = $util.emptyArray; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static - * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata instance + * @param {google.cloud.retail.v2beta.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo instance */ - ImportMetadata.create = function create(properties) { - return new ImportMetadata(properties); + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); }; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static - * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encode = function encode(message, writer) { + FulfillmentInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); - if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); return writer; }; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.FulfillmentInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static - * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decode = function decode(reader, length) { + FulfillmentInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.FulfillmentInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.type = reader.string(); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -61435,188 +60312,130 @@ }; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportMetadata message. + * Verifies a FulfillmentInfo message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportMetadata.verify = function verify(message) { + FulfillmentInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; } - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) - return "successCount: integer|Long expected"; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) - return "failureCount: integer|Long expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2beta.FulfillmentInfo} FulfillmentInfo */ - ImportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportMetadata) + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.FulfillmentInfo) return object; - var message = new $root.google.cloud.retail.v2beta.ImportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.retail.v2beta.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2beta.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); } - if (object.successCount != null) - if ($util.Long) - (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; - else if (typeof object.successCount === "string") - message.successCount = parseInt(object.successCount, 10); - else if (typeof object.successCount === "number") - message.successCount = object.successCount; - else if (typeof object.successCount === "object") - message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); - if (object.failureCount != null) - if ($util.Long) - (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; - else if (typeof object.failureCount === "string") - message.failureCount = parseInt(object.failureCount, 10); - else if (typeof object.failureCount === "number") - message.failureCount = object.failureCount; - else if (typeof object.failureCount === "object") - message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @static - * @param {google.cloud.retail.v2beta.ImportMetadata} message ImportMetadata + * @param {google.cloud.retail.v2beta.FulfillmentInfo} message FulfillmentInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportMetadata.toObject = function toObject(message, options) { + FulfillmentInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.createTime = null; - object.updateTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.successCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failureCount = options.longs === String ? "0" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (typeof message.successCount === "number") - object.successCount = options.longs === String ? String(message.successCount) : message.successCount; - else - object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (typeof message.failureCount === "number") - object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; - else - object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportMetadata to JSON. + * Converts this FulfillmentInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportMetadata + * @memberof google.cloud.retail.v2beta.FulfillmentInfo * @instance * @returns {Object.} JSON object */ - ImportMetadata.prototype.toJSON = function toJSON() { + FulfillmentInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportMetadata; + return FulfillmentInfo; })(); - v2beta.ImportProductsResponse = (function() { + v2beta.Image = (function() { /** - * Properties of an ImportProductsResponse. + * Properties of an Image. * @memberof google.cloud.retail.v2beta - * @interface IImportProductsResponse - * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width */ /** - * Constructs a new ImportProductsResponse. + * Constructs a new Image. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportProductsResponse. - * @implements IImportProductsResponse + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set */ - function ImportProductsResponse(properties) { - this.errorSamples = []; + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -61624,91 +60443,101 @@ } /** - * ImportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.Image * @instance */ - ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + Image.prototype.uri = ""; /** - * ImportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2beta.Image * @instance */ - ImportProductsResponse.prototype.errorsConfig = null; + Image.prototype.height = 0; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2beta.Image + * @instance + */ + Image.prototype.width = 0; + + /** + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static - * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse instance + * @param {google.cloud.retail.v2beta.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Image} Image instance */ - ImportProductsResponse.create = function create(properties) { - return new ImportProductsResponse(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static - * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); return writer; }; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static - * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2beta.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decode = function decode(reader, length) { + Image.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.uri = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + message.height = reader.int32(); + break; + case 3: + message.width = reader.int32(); break; default: reader.skipType(tag & 7); @@ -61719,141 +60548,127 @@ }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2beta.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsResponse message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsResponse.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; return null; }; /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2beta.Image} Image */ - ImportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsResponse) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Image) return object; - var message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2beta.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; return message; }; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @static - * @param {google.cloud.retail.v2beta.ImportProductsResponse} message ImportProductsResponse + * @param {google.cloud.retail.v2beta.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsResponse.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.uri = ""; + object.height = 0; + object.width = 0; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; return object; }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @memberof google.cloud.retail.v2beta.Image * @instance * @returns {Object.} JSON object */ - ImportProductsResponse.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsResponse; + return Image; })(); - v2beta.ImportUserEventsResponse = (function() { + v2beta.Interval = (function() { /** - * Properties of an ImportUserEventsResponse. + * Properties of an Interval. * @memberof google.cloud.retail.v2beta - * @interface IImportUserEventsResponse - * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig - * @property {google.cloud.retail.v2beta.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum */ /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new Interval. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportUserEventsResponse. - * @implements IImportUserEventsResponse + * @classdesc Represents an Interval. + * @implements IInterval * @constructor - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IInterval=} [properties] Properties to set */ - function ImportUserEventsResponse(properties) { - this.errorSamples = []; + function Interval(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -61861,104 +60676,139 @@ } /** - * ImportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2beta.Interval * @instance */ - ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + Interval.prototype.minimum = null; /** - * ImportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2beta.Interval * @instance */ - ImportUserEventsResponse.prototype.errorsConfig = null; + Interval.prototype.exclusiveMinimum = null; /** - * ImportUserEventsResponse importSummary. - * @member {google.cloud.retail.v2beta.IUserEventImportSummary|null|undefined} importSummary - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2beta.Interval * @instance */ - ImportUserEventsResponse.prototype.importSummary = null; + Interval.prototype.maximum = null; /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2beta.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Interval instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse instance + * @param {google.cloud.retail.v2beta.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Interval} Interval instance */ - ImportUserEventsResponse.create = function create(properties) { - return new ImportUserEventsResponse(properties); + Interval.create = function create(properties) { + return new Interval(properties); }; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encode = function encode(message, writer) { + Interval.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) - $root.google.cloud.retail.v2beta.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); return writer; }; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Interval.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static - * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + Interval.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2beta.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decode = function decode(reader, length) { + Interval.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Interval(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.minimum = reader.double(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + message.exclusiveMinimum = reader.double(); break; case 3: - message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); + message.maximum = reader.double(); + break; + case 4: + message.exclusiveMaximum = reader.double(); break; default: reader.skipType(tag & 7); @@ -61969,153 +60819,157 @@ }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2beta.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + Interval.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsResponse message. + * Verifies an Interval message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsResponse.verify = function verify(message) { + Interval.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; } - if (message.importSummary != null && message.hasOwnProperty("importSummary")) { - var error = $root.google.cloud.retail.v2beta.UserEventImportSummary.verify(message.importSummary); - if (error) - return "importSummary." + error; + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; } return null; }; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2beta.Interval} Interval */ - ImportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsResponse) + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Interval) return object; - var message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.importSummary != null) { - if (typeof object.importSummary !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.importSummary: object expected"); - message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.fromObject(object.importSummary); - } + var message = new $root.google.cloud.retail.v2beta.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); return message; }; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from an Interval message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @static - * @param {google.cloud.retail.v2beta.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {google.cloud.retail.v2beta.Interval} message Interval * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsResponse.toObject = function toObject(message, options) { + Interval.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) { - object.errorsConfig = null; - object.importSummary = null; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; } - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.importSummary != null && message.hasOwnProperty("importSummary")) - object.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this Interval to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @memberof google.cloud.retail.v2beta.Interval * @instance * @returns {Object.} JSON object */ - ImportUserEventsResponse.prototype.toJSON = function toJSON() { + Interval.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsResponse; + return Interval; })(); - v2beta.UserEventImportSummary = (function() { + v2beta.PriceInfo = (function() { /** - * Properties of a UserEventImportSummary. + * Properties of a PriceInfo. * @memberof google.cloud.retail.v2beta - * @interface IUserEventImportSummary - * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount - * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2beta.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange */ /** - * Constructs a new UserEventImportSummary. + * Constructs a new PriceInfo. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEventImportSummary. - * @implements IUserEventImportSummary + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo * @constructor - * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set */ - function UserEventImportSummary(properties) { + function PriceInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -62123,316 +60977,153 @@ } /** - * UserEventImportSummary joinedEventsCount. - * @member {number|Long} joinedEventsCount - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2beta.PriceInfo * @instance */ - UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + PriceInfo.prototype.currencyCode = ""; /** - * UserEventImportSummary unjoinedEventsCount. - * @member {number|Long} unjoinedEventsCount - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2beta.PriceInfo * @instance */ - UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + PriceInfo.prototype.price = 0; /** - * Creates a new UserEventImportSummary instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary instance + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance */ - UserEventImportSummary.create = function create(properties) { - return new UserEventImportSummary(properties); - }; + PriceInfo.prototype.originalPrice = 0; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance */ - UserEventImportSummary.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); - if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); - return writer; - }; + PriceInfo.prototype.cost = 0; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventImportSummary.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.joinedEventsCount = reader.int64(); - break; - case 2: - message.unjoinedEventsCount = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UserEventImportSummary message. - * @function verify - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UserEventImportSummary.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) - return "joinedEventsCount: integer|Long expected"; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) - return "unjoinedEventsCount: integer|Long expected"; - return null; - }; - - /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary - */ - UserEventImportSummary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEventImportSummary) - return object; - var message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); - if (object.joinedEventsCount != null) - if ($util.Long) - (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; - else if (typeof object.joinedEventsCount === "string") - message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); - else if (typeof object.joinedEventsCount === "number") - message.joinedEventsCount = object.joinedEventsCount; - else if (typeof object.joinedEventsCount === "object") - message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); - if (object.unjoinedEventsCount != null) - if ($util.Long) - (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; - else if (typeof object.unjoinedEventsCount === "string") - message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); - else if (typeof object.unjoinedEventsCount === "number") - message.unjoinedEventsCount = object.unjoinedEventsCount; - else if (typeof object.unjoinedEventsCount === "object") - message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.UserEventImportSummary - * @static - * @param {google.cloud.retail.v2beta.UserEventImportSummary} message UserEventImportSummary - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserEventImportSummary.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.joinedEventsCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.unjoinedEventsCount = options.longs === String ? "0" : 0; - } - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (typeof message.joinedEventsCount === "number") - object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; - else - object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (typeof message.unjoinedEventsCount === "number") - object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; - else - object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; - return object; - }; - - /** - * Converts this UserEventImportSummary to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2beta.PriceInfo * @instance - * @returns {Object.} JSON object - */ - UserEventImportSummary.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UserEventImportSummary; - })(); - - v2beta.ImportCompletionDataResponse = (function() { - - /** - * Properties of an ImportCompletionDataResponse. - * @memberof google.cloud.retail.v2beta - * @interface IImportCompletionDataResponse - * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples */ + PriceInfo.prototype.priceEffectiveTime = null; /** - * Constructs a new ImportCompletionDataResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ImportCompletionDataResponse. - * @implements IImportCompletionDataResponse - * @constructor - * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse=} [properties] Properties to set + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2beta.PriceInfo + * @instance */ - function ImportCompletionDataResponse(properties) { - this.errorSamples = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + PriceInfo.prototype.priceExpireTime = null; /** - * ImportCompletionDataResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * PriceInfo priceRange. + * @member {google.cloud.retail.v2beta.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2beta.PriceInfo * @instance */ - ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + PriceInfo.prototype.priceRange = null; /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. + * Creates a new PriceInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static - * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse instance + * @param {google.cloud.retail.v2beta.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo instance */ - ImportCompletionDataResponse.create = function create(properties) { - return new ImportCompletionDataResponse(properties); + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); }; /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static - * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encode = function encode(message, writer) { + PriceInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static - * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decode = function decode(reader, length) { + PriceInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportCompletionDataResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -62443,638 +61134,1022 @@ }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + PriceInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportCompletionDataResponse message. + * Verifies a PriceInfo message. * @function verify - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportCompletionDataResponse.verify = function verify(message) { + PriceInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; } return null; }; /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2beta.PriceInfo} PriceInfo */ - ImportCompletionDataResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ImportCompletionDataResponse) + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo) return object; - var message = new $root.google.cloud.retail.v2beta.ImportCompletionDataResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } + var message = new $root.google.cloud.retail.v2beta.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.fromObject(object.priceRange); } return message; }; /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @static - * @param {google.cloud.retail.v2beta.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {google.cloud.retail.v2beta.PriceInfo} message PriceInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportCompletionDataResponse.toObject = function toObject(message, options) { + PriceInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; /** - * Converts this ImportCompletionDataResponse to JSON. + * Converts this PriceInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2beta.PriceInfo * @instance * @returns {Object.} JSON object */ - ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + PriceInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportCompletionDataResponse; - })(); - - v2beta.Product = (function() { + PriceInfo.PriceRange = (function() { - /** - * Properties of a Product. - * @memberof google.cloud.retail.v2beta - * @interface IProduct - * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime - * @property {google.protobuf.IDuration|null} [ttl] Product ttl - * @property {string|null} [name] Product name - * @property {string|null} [id] Product id - * @property {google.cloud.retail.v2beta.Product.Type|null} [type] Product type - * @property {string|null} [primaryProductId] Product primaryProductId - * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds - * @property {string|null} [gtin] Product gtin - * @property {Array.|null} [categories] Product categories - * @property {string|null} [title] Product title - * @property {Array.|null} [brands] Product brands - * @property {string|null} [description] Product description - * @property {string|null} [languageCode] Product languageCode - * @property {Object.|null} [attributes] Product attributes - * @property {Array.|null} [tags] Product tags - * @property {google.cloud.retail.v2beta.IPriceInfo|null} [priceInfo] Product priceInfo - * @property {google.cloud.retail.v2beta.IRating|null} [rating] Product rating - * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime - * @property {google.cloud.retail.v2beta.Product.Availability|null} [availability] Product availability - * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity - * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo - * @property {string|null} [uri] Product uri - * @property {Array.|null} [images] Product images - * @property {google.cloud.retail.v2beta.IAudience|null} [audience] Product audience - * @property {google.cloud.retail.v2beta.IColorInfo|null} [colorInfo] Product colorInfo - * @property {Array.|null} [sizes] Product sizes - * @property {Array.|null} [materials] Product materials - * @property {Array.|null} [patterns] Product patterns - * @property {Array.|null} [conditions] Product conditions - * @property {Array.|null} [promotions] Product promotions - * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime - * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields - * @property {Array.|null} [variants] Product variants - */ + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2beta.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2beta.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2beta.IInterval|null} [originalPrice] PriceRange originalPrice + */ - /** - * Constructs a new Product. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a Product. - * @implements IProduct - * @constructor - * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set - */ - function Product(properties) { - this.collectionMemberIds = []; - this.categories = []; - this.brands = []; - this.attributes = {}; - this.tags = []; - this.fulfillmentInfo = []; - this.images = []; - this.sizes = []; - this.materials = []; - this.patterns = []; - this.conditions = []; - this.promotions = []; - this.variants = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2beta.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Product expireTime. - * @member {google.protobuf.ITimestamp|null|undefined} expireTime - * @memberof google.cloud.retail.v2beta.Product - * @instance - */ - Product.prototype.expireTime = null; + /** + * PriceRange price. + * @member {google.cloud.retail.v2beta.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; - /** - * Product ttl. - * @member {google.protobuf.IDuration|null|undefined} ttl - * @memberof google.cloud.retail.v2beta.Product - * @instance + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2beta.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; + + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2beta.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2beta.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2beta.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2beta.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2beta.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2beta.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2beta.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2beta.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2beta.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + + return PriceInfo; + })(); + + v2beta.Rating = (function() { + + /** + * Properties of a Rating. + * @memberof google.cloud.retail.v2beta + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram */ - Product.prototype.ttl = null; /** - * Product name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Constructs a new Rating. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Rating. + * @implements IRating + * @constructor + * @param {google.cloud.retail.v2beta.IRating=} [properties] Properties to set */ - Product.prototype.name = ""; + function Rating(properties) { + this.ratingHistogram = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Product id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.Product + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2beta.Rating * @instance */ - Product.prototype.id = ""; + Rating.prototype.ratingCount = 0; /** - * Product type. - * @member {google.cloud.retail.v2beta.Product.Type} type - * @memberof google.cloud.retail.v2beta.Product + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2beta.Rating * @instance */ - Product.prototype.type = 0; + Rating.prototype.averageRating = 0; /** - * Product primaryProductId. - * @member {string} primaryProductId - * @memberof google.cloud.retail.v2beta.Product + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2beta.Rating * @instance */ - Product.prototype.primaryProductId = ""; + Rating.prototype.ratingHistogram = $util.emptyArray; /** - * Product collectionMemberIds. - * @member {Array.} collectionMemberIds - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a new Rating instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Rating} Rating instance */ - Product.prototype.collectionMemberIds = $util.emptyArray; + Rating.create = function create(properties) { + return new Rating(properties); + }; /** - * Product gtin. - * @member {string} gtin - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.IRating} message Rating message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.gtin = ""; + Rating.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } + return writer; + }; /** - * Product categories. - * @member {Array.} categories - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Rating.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.IRating} message Rating message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.categories = $util.emptyArray; + Rating.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product title. - * @member {string} title - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Decodes a Rating message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Rating} Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.title = ""; + Rating.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Rating(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ratingCount = reader.int32(); + break; + case 2: + message.averageRating = reader.float(); + break; + case 3: + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product brands. - * @member {Array.} brands - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Rating} Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.brands = $util.emptyArray; + Rating.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product description. - * @member {string} description - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Verifies a Rating message. + * @function verify + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.description = ""; + Rating.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; + } + return null; + }; /** - * Product languageCode. - * @member {string} languageCode - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Rating} Rating */ - Product.prototype.languageCode = ""; + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Rating) + return object; + var message = new $root.google.cloud.retail.v2beta.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2beta.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; + } + return message; + }; /** - * Product attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {google.cloud.retail.v2beta.Rating} message Rating + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.attributes = $util.emptyObject; + Rating.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ratingHistogram = []; + if (options.defaults) { + object.ratingCount = 0; + object.averageRating = 0; + } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; + } + return object; + }; /** - * Product tags. - * @member {Array.} tags - * @memberof google.cloud.retail.v2beta.Product + * Converts this Rating to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Rating * @instance + * @returns {Object.} JSON object */ - Product.prototype.tags = $util.emptyArray; + Rating.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Rating; + })(); + + v2beta.UserInfo = (function() { /** - * Product priceInfo. - * @member {google.cloud.retail.v2beta.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Properties of a UserInfo. + * @memberof google.cloud.retail.v2beta + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest */ - Product.prototype.priceInfo = null; /** - * Product rating. - * @member {google.cloud.retail.v2beta.IRating|null|undefined} rating - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Constructs a new UserInfo. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserInfo. + * @implements IUserInfo + * @constructor + * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set */ - Product.prototype.rating = null; + function UserInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Product availableTime. - * @member {google.protobuf.ITimestamp|null|undefined} availableTime - * @memberof google.cloud.retail.v2beta.Product + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2beta.UserInfo * @instance */ - Product.prototype.availableTime = null; + UserInfo.prototype.userId = ""; /** - * Product availability. - * @member {google.cloud.retail.v2beta.Product.Availability} availability - * @memberof google.cloud.retail.v2beta.Product + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2beta.UserInfo * @instance */ - Product.prototype.availability = 0; + UserInfo.prototype.ipAddress = ""; /** - * Product availableQuantity. - * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity - * @memberof google.cloud.retail.v2beta.Product + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2beta.UserInfo * @instance */ - Product.prototype.availableQuantity = null; + UserInfo.prototype.userAgent = ""; /** - * Product fulfillmentInfo. - * @member {Array.} fulfillmentInfo - * @memberof google.cloud.retail.v2beta.Product + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2beta.UserInfo * @instance */ - Product.prototype.fulfillmentInfo = $util.emptyArray; + UserInfo.prototype.directUserRequest = false; /** - * Product uri. - * @member {string} uri - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a new UserInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo instance */ - Product.prototype.uri = ""; + UserInfo.create = function create(properties) { + return new UserInfo(properties); + }; /** - * Product images. - * @member {Array.} images - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.images = $util.emptyArray; + UserInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + return writer; + }; /** - * Product audience. - * @member {google.cloud.retail.v2beta.IAudience|null|undefined} audience - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.IUserInfo} message UserInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.audience = null; + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product colorInfo. - * @member {google.cloud.retail.v2beta.IColorInfo|null|undefined} colorInfo - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Decodes a UserInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.colorInfo = null; + UserInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userId = reader.string(); + break; + case 2: + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product sizes. - * @member {Array.} sizes - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.sizes = $util.emptyArray; + UserInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product materials. - * @member {Array.} materials - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Verifies a UserInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.materials = $util.emptyArray; + UserInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; + return null; + }; /** - * Product patterns. - * @member {Array.} patterns - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserInfo} UserInfo */ - Product.prototype.patterns = $util.emptyArray; + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); + return message; + }; /** - * Product conditions. - * @member {Array.} conditions - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {google.cloud.retail.v2beta.UserInfo} message UserInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.conditions = $util.emptyArray; + UserInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; + } + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; + return object; + }; /** - * Product promotions. - * @member {Array.} promotions - * @memberof google.cloud.retail.v2beta.Product + * Converts this UserInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserInfo * @instance + * @returns {Object.} JSON object */ - Product.prototype.promotions = $util.emptyArray; + UserInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserInfo; + })(); + + v2beta.LocalInventory = (function() { /** - * Product publishTime. - * @member {google.protobuf.ITimestamp|null|undefined} publishTime - * @memberof google.cloud.retail.v2beta.Product - * @instance + * Properties of a LocalInventory. + * @memberof google.cloud.retail.v2beta + * @interface ILocalInventory + * @property {string|null} [placeId] LocalInventory placeId + * @property {google.cloud.retail.v2beta.IPriceInfo|null} [priceInfo] LocalInventory priceInfo + * @property {Object.|null} [attributes] LocalInventory attributes + * @property {Array.|null} [fulfillmentTypes] LocalInventory fulfillmentTypes */ - Product.prototype.publishTime = null; /** - * Product retrievableFields. - * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields - * @memberof google.cloud.retail.v2beta.Product + * Constructs a new LocalInventory. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a LocalInventory. + * @implements ILocalInventory + * @constructor + * @param {google.cloud.retail.v2beta.ILocalInventory=} [properties] Properties to set + */ + function LocalInventory(properties) { + this.attributes = {}; + this.fulfillmentTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocalInventory placeId. + * @member {string} placeId + * @memberof google.cloud.retail.v2beta.LocalInventory * @instance */ - Product.prototype.retrievableFields = null; + LocalInventory.prototype.placeId = ""; /** - * Product variants. - * @member {Array.} variants - * @memberof google.cloud.retail.v2beta.Product + * LocalInventory priceInfo. + * @member {google.cloud.retail.v2beta.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2beta.LocalInventory * @instance */ - Product.prototype.variants = $util.emptyArray; + LocalInventory.prototype.priceInfo = null; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * LocalInventory attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.LocalInventory + * @instance + */ + LocalInventory.prototype.attributes = $util.emptyObject; /** - * Product expiration. - * @member {"expireTime"|"ttl"|undefined} expiration - * @memberof google.cloud.retail.v2beta.Product + * LocalInventory fulfillmentTypes. + * @member {Array.} fulfillmentTypes + * @memberof google.cloud.retail.v2beta.LocalInventory * @instance */ - Object.defineProperty(Product.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), - set: $util.oneOfSetter($oneOfFields) - }); + LocalInventory.prototype.fulfillmentTypes = $util.emptyArray; /** - * Creates a new Product instance using the specified properties. + * Creates a new LocalInventory instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static - * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.Product} Product instance + * @param {google.cloud.retail.v2beta.ILocalInventory=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.LocalInventory} LocalInventory instance */ - Product.create = function create(properties) { - return new Product(properties); + LocalInventory.create = function create(properties) { + return new LocalInventory(properties); }; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2beta.LocalInventory.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static - * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2beta.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encode = function encode(message, writer) { + LocalInventory.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); - if (message.collectionMemberIds != null && message.collectionMemberIds.length) - for (var i = 0; i < message.collectionMemberIds.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); - if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); - if (message.brands != null && message.brands.length) - for (var i = 0; i < message.brands.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2beta.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2beta.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) - $root.google.cloud.retail.v2beta.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) - $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) - $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) - $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); - if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) - $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) - for (var i = 0; i < message.fulfillmentInfo.length; ++i) - $root.google.cloud.retail.v2beta.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); - if (message.images != null && message.images.length) - for (var i = 0; i < message.images.length; ++i) - $root.google.cloud.retail.v2beta.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); - if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) - $root.google.cloud.retail.v2beta.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) - $root.google.cloud.retail.v2beta.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.sizes != null && message.sizes.length) - for (var i = 0; i < message.sizes.length; ++i) - writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); - if (message.materials != null && message.materials.length) - for (var i = 0; i < message.materials.length; ++i) - writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); - if (message.patterns != null && message.patterns.length) - for (var i = 0; i < message.patterns.length; ++i) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); - if (message.conditions != null && message.conditions.length) - for (var i = 0; i < message.conditions.length; ++i) - writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); - if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) - $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); - if (message.variants != null && message.variants.length) - for (var i = 0; i < message.variants.length; ++i) - $root.google.cloud.retail.v2beta.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); - if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) - $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); - if (message.promotions != null && message.promotions.length) - for (var i = 0; i < message.promotions.length; ++i) - $root.google.cloud.retail.v2beta.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.fulfillmentTypes != null && message.fulfillmentTypes.length) + for (var i = 0; i < message.fulfillmentTypes.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fulfillmentTypes[i]); return writer; }; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.LocalInventory.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static - * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {google.cloud.retail.v2beta.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Product.encodeDelimited = function encodeDelimited(message, writer) { + LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.Product} Product + * @returns {google.cloud.retail.v2beta.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decode = function decode(reader, length) { + LocalInventory.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Product(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.LocalInventory(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 16: - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 17: - message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; case 1: - message.name = reader.string(); + message.placeId = reader.string(); break; case 2: - message.id = reader.string(); + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); break; case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 5: - if (!(message.collectionMemberIds && message.collectionMemberIds.length)) - message.collectionMemberIds = []; - message.collectionMemberIds.push(reader.string()); - break; - case 6: - message.gtin = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 9: - if (!(message.brands && message.brands.length)) - message.brands = []; - message.brands.push(reader.string()); - break; - case 10: - message.description = reader.string(); - break; - case 11: - message.languageCode = reader.string(); - break; - case 12: if (message.attributes === $util.emptyObject) message.attributes = {}; var end2 = reader.uint32() + reader.pos; @@ -63096,80 +62171,10 @@ } message.attributes[key] = value; break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); - break; - case 15: - message.rating = $root.google.cloud.retail.v2beta.Rating.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 21: - if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) - message.fulfillmentInfo = []; - message.fulfillmentInfo.push($root.google.cloud.retail.v2beta.FulfillmentInfo.decode(reader, reader.uint32())); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); - break; - case 24: - message.audience = $root.google.cloud.retail.v2beta.Audience.decode(reader, reader.uint32()); - break; - case 25: - message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.decode(reader, reader.uint32()); - break; - case 26: - if (!(message.sizes && message.sizes.length)) - message.sizes = []; - message.sizes.push(reader.string()); - break; - case 27: - if (!(message.materials && message.materials.length)) - message.materials = []; - message.materials.push(reader.string()); - break; - case 28: - if (!(message.patterns && message.patterns.length)) - message.patterns = []; - message.patterns.push(reader.string()); - break; - case 29: - if (!(message.conditions && message.conditions.length)) - message.conditions = []; - message.conditions.push(reader.string()); - break; - case 34: - if (!(message.promotions && message.promotions.length)) - message.promotions = []; - message.promotions.push($root.google.cloud.retail.v2beta.Promotion.decode(reader, reader.uint32())); - break; - case 33: - message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 30: - message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 31: - if (!(message.variants && message.variants.length)) - message.variants = []; - message.variants.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + case 4: + if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) + message.fulfillmentTypes = []; + message.fulfillmentTypes.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -63180,103 +62185,40 @@ }; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.Product} Product + * @returns {google.cloud.retail.v2beta.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.decodeDelimited = function decodeDelimited(reader) { + LocalInventory.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Product message. + * Verifies a LocalInventory message. * @function verify - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.verify = function verify(message) { + LocalInventory.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - properties.expiration = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.expireTime); - if (error) - return "expireTime." + error; - } - } - if (message.ttl != null && message.hasOwnProperty("ttl")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; - { - var error = $root.google.protobuf.Duration.verify(message.ttl); - if (error) - return "ttl." + error; - } - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - if (!$util.isString(message.primaryProductId)) - return "primaryProductId: string expected"; - if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { - if (!Array.isArray(message.collectionMemberIds)) - return "collectionMemberIds: array expected"; - for (var i = 0; i < message.collectionMemberIds.length; ++i) - if (!$util.isString(message.collectionMemberIds[i])) - return "collectionMemberIds: string[] expected"; - } - if (message.gtin != null && message.hasOwnProperty("gtin")) - if (!$util.isString(message.gtin)) - return "gtin: string expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) - if (!$util.isString(message.categories[i])) - return "categories: string[] expected"; - } - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.brands != null && message.hasOwnProperty("brands")) { - if (!Array.isArray(message.brands)) - return "brands: array expected"; - for (var i = 0; i < message.brands.length; ++i) - if (!$util.isString(message.brands[i])) - return "brands: string[] expected"; + if (message.placeId != null && message.hasOwnProperty("placeId")) + if (!$util.isString(message.placeId)) + return "placeId: string expected"; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2beta.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; if (message.attributes != null && message.hasOwnProperty("attributes")) { if (!$util.isObject(message.attributes)) return "attributes: object expected"; @@ -63287,618 +62229,14529 @@ return "attributes." + error; } } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2beta.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; - } - if (message.rating != null && message.hasOwnProperty("rating")) { - var error = $root.google.cloud.retail.v2beta.Rating.verify(message.rating); - if (error) - return "rating." + error; - } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.availableTime); - if (error) - return "availableTime." + error; - } - if (message.availability != null && message.hasOwnProperty("availability")) - switch (message.availability) { - default: - return "availability: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); - if (error) - return "availableQuantity." + error; - } - if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { - if (!Array.isArray(message.fulfillmentInfo)) - return "fulfillmentInfo: array expected"; - for (var i = 0; i < message.fulfillmentInfo.length; ++i) { - var error = $root.google.cloud.retail.v2beta.FulfillmentInfo.verify(message.fulfillmentInfo[i]); - if (error) - return "fulfillmentInfo." + error; - } - } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.images != null && message.hasOwnProperty("images")) { - if (!Array.isArray(message.images)) - return "images: array expected"; - for (var i = 0; i < message.images.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Image.verify(message.images[i]); - if (error) - return "images." + error; - } - } - if (message.audience != null && message.hasOwnProperty("audience")) { - var error = $root.google.cloud.retail.v2beta.Audience.verify(message.audience); - if (error) - return "audience." + error; - } - if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { - var error = $root.google.cloud.retail.v2beta.ColorInfo.verify(message.colorInfo); - if (error) - return "colorInfo." + error; - } - if (message.sizes != null && message.hasOwnProperty("sizes")) { - if (!Array.isArray(message.sizes)) - return "sizes: array expected"; - for (var i = 0; i < message.sizes.length; ++i) - if (!$util.isString(message.sizes[i])) - return "sizes: string[] expected"; - } - if (message.materials != null && message.hasOwnProperty("materials")) { - if (!Array.isArray(message.materials)) - return "materials: array expected"; - for (var i = 0; i < message.materials.length; ++i) - if (!$util.isString(message.materials[i])) - return "materials: string[] expected"; - } - if (message.patterns != null && message.hasOwnProperty("patterns")) { - if (!Array.isArray(message.patterns)) - return "patterns: array expected"; - for (var i = 0; i < message.patterns.length; ++i) - if (!$util.isString(message.patterns[i])) - return "patterns: string[] expected"; - } - if (message.conditions != null && message.hasOwnProperty("conditions")) { - if (!Array.isArray(message.conditions)) - return "conditions: array expected"; - for (var i = 0; i < message.conditions.length; ++i) - if (!$util.isString(message.conditions[i])) - return "conditions: string[] expected"; - } - if (message.promotions != null && message.hasOwnProperty("promotions")) { - if (!Array.isArray(message.promotions)) - return "promotions: array expected"; - for (var i = 0; i < message.promotions.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Promotion.verify(message.promotions[i]); - if (error) - return "promotions." + error; - } - } - if (message.publishTime != null && message.hasOwnProperty("publishTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.publishTime); - if (error) - return "publishTime." + error; - } - if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { - var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); - if (error) - return "retrievableFields." + error; - } - if (message.variants != null && message.hasOwnProperty("variants")) { - if (!Array.isArray(message.variants)) - return "variants: array expected"; - for (var i = 0; i < message.variants.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.variants[i]); - if (error) - return "variants." + error; - } + if (message.fulfillmentTypes != null && message.hasOwnProperty("fulfillmentTypes")) { + if (!Array.isArray(message.fulfillmentTypes)) + return "fulfillmentTypes: array expected"; + for (var i = 0; i < message.fulfillmentTypes.length; ++i) + if (!$util.isString(message.fulfillmentTypes[i])) + return "fulfillmentTypes: string[] expected"; } return null; }; /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.Product} Product + * @returns {google.cloud.retail.v2beta.LocalInventory} LocalInventory */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.Product) + LocalInventory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.LocalInventory) return object; - var message = new $root.google.cloud.retail.v2beta.Product(); - if (object.expireTime != null) { - if (typeof object.expireTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.expireTime: object expected"); - message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); - } - if (object.ttl != null) { - if (typeof object.ttl !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.ttl: object expected"); - message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); - } - if (object.name != null) - message.name = String(object.name); - if (object.id != null) - message.id = String(object.id); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "VARIANT": - case 2: - message.type = 2; - break; - case "COLLECTION": - case 3: - message.type = 3; - break; - } - if (object.primaryProductId != null) - message.primaryProductId = String(object.primaryProductId); - if (object.collectionMemberIds) { - if (!Array.isArray(object.collectionMemberIds)) - throw TypeError(".google.cloud.retail.v2beta.Product.collectionMemberIds: array expected"); - message.collectionMemberIds = []; - for (var i = 0; i < object.collectionMemberIds.length; ++i) - message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); - } - if (object.gtin != null) - message.gtin = String(object.gtin); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.retail.v2beta.Product.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) - message.categories[i] = String(object.categories[i]); - } - if (object.title != null) - message.title = String(object.title); - if (object.brands) { - if (!Array.isArray(object.brands)) - throw TypeError(".google.cloud.retail.v2beta.Product.brands: array expected"); - message.brands = []; - for (var i = 0; i < object.brands.length; ++i) - message.brands[i] = String(object.brands[i]); + var message = new $root.google.cloud.retail.v2beta.LocalInventory(); + if (object.placeId != null) + message.placeId = String(object.placeId); + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.LocalInventory.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.fromObject(object.priceInfo); } - if (object.description != null) - message.description = String(object.description); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); if (object.attributes) { if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + throw TypeError(".google.cloud.retail.v2beta.LocalInventory.attributes: object expected"); message.attributes = {}; for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + throw TypeError(".google.cloud.retail.v2beta.LocalInventory.attributes: object expected"); message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); } } - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.retail.v2beta.Product.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.fromObject(object.priceInfo); - } - if (object.rating != null) { - if (typeof object.rating !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.rating: object expected"); - message.rating = $root.google.cloud.retail.v2beta.Rating.fromObject(object.rating); - } - if (object.availableTime != null) { - if (typeof object.availableTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.availableTime: object expected"); - message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); - } - switch (object.availability) { - case "AVAILABILITY_UNSPECIFIED": - case 0: - message.availability = 0; - break; - case "IN_STOCK": - case 1: - message.availability = 1; - break; - case "OUT_OF_STOCK": - case 2: - message.availability = 2; - break; - case "PREORDER": - case 3: - message.availability = 3; - break; - case "BACKORDER": - case 4: - message.availability = 4; - break; - } - if (object.availableQuantity != null) { - if (typeof object.availableQuantity !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.availableQuantity: object expected"); - message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); - } - if (object.fulfillmentInfo) { - if (!Array.isArray(object.fulfillmentInfo)) - throw TypeError(".google.cloud.retail.v2beta.Product.fulfillmentInfo: array expected"); - message.fulfillmentInfo = []; - for (var i = 0; i < object.fulfillmentInfo.length; ++i) { - if (typeof object.fulfillmentInfo[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.fulfillmentInfo: object expected"); - message.fulfillmentInfo[i] = $root.google.cloud.retail.v2beta.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); - } - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.images) { - if (!Array.isArray(object.images)) - throw TypeError(".google.cloud.retail.v2beta.Product.images: array expected"); - message.images = []; - for (var i = 0; i < object.images.length; ++i) { - if (typeof object.images[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.images: object expected"); - message.images[i] = $root.google.cloud.retail.v2beta.Image.fromObject(object.images[i]); - } - } - if (object.audience != null) { - if (typeof object.audience !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.audience: object expected"); - message.audience = $root.google.cloud.retail.v2beta.Audience.fromObject(object.audience); - } - if (object.colorInfo != null) { - if (typeof object.colorInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.colorInfo: object expected"); - message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.fromObject(object.colorInfo); - } - if (object.sizes) { - if (!Array.isArray(object.sizes)) - throw TypeError(".google.cloud.retail.v2beta.Product.sizes: array expected"); - message.sizes = []; - for (var i = 0; i < object.sizes.length; ++i) - message.sizes[i] = String(object.sizes[i]); - } - if (object.materials) { - if (!Array.isArray(object.materials)) - throw TypeError(".google.cloud.retail.v2beta.Product.materials: array expected"); - message.materials = []; - for (var i = 0; i < object.materials.length; ++i) - message.materials[i] = String(object.materials[i]); - } - if (object.patterns) { - if (!Array.isArray(object.patterns)) - throw TypeError(".google.cloud.retail.v2beta.Product.patterns: array expected"); - message.patterns = []; - for (var i = 0; i < object.patterns.length; ++i) - message.patterns[i] = String(object.patterns[i]); - } - if (object.conditions) { - if (!Array.isArray(object.conditions)) - throw TypeError(".google.cloud.retail.v2beta.Product.conditions: array expected"); - message.conditions = []; - for (var i = 0; i < object.conditions.length; ++i) - message.conditions[i] = String(object.conditions[i]); - } - if (object.promotions) { - if (!Array.isArray(object.promotions)) - throw TypeError(".google.cloud.retail.v2beta.Product.promotions: array expected"); - message.promotions = []; - for (var i = 0; i < object.promotions.length; ++i) { - if (typeof object.promotions[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.promotions: object expected"); - message.promotions[i] = $root.google.cloud.retail.v2beta.Promotion.fromObject(object.promotions[i]); - } - } - if (object.publishTime != null) { - if (typeof object.publishTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.publishTime: object expected"); - message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); - } - if (object.retrievableFields != null) { - if (typeof object.retrievableFields !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.retrievableFields: object expected"); - message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); - } - if (object.variants) { - if (!Array.isArray(object.variants)) - throw TypeError(".google.cloud.retail.v2beta.Product.variants: array expected"); - message.variants = []; - for (var i = 0; i < object.variants.length; ++i) { - if (typeof object.variants[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.Product.variants: object expected"); - message.variants[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.variants[i]); - } + if (object.fulfillmentTypes) { + if (!Array.isArray(object.fulfillmentTypes)) + throw TypeError(".google.cloud.retail.v2beta.LocalInventory.fulfillmentTypes: array expected"); + message.fulfillmentTypes = []; + for (var i = 0; i < object.fulfillmentTypes.length; ++i) + message.fulfillmentTypes[i] = String(object.fulfillmentTypes[i]); } return message; }; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.Product + * @memberof google.cloud.retail.v2beta.LocalInventory * @static - * @param {google.cloud.retail.v2beta.Product} message Product + * @param {google.cloud.retail.v2beta.LocalInventory} message LocalInventory * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Product.toObject = function toObject(message, options) { + LocalInventory.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.collectionMemberIds = []; - object.categories = []; - object.brands = []; - object.tags = []; - object.fulfillmentInfo = []; - object.images = []; - object.sizes = []; - object.materials = []; - object.patterns = []; - object.conditions = []; - object.variants = []; - object.promotions = []; - } + if (options.arrays || options.defaults) + object.fulfillmentTypes = []; if (options.objects || options.defaults) object.attributes = {}; if (options.defaults) { - object.name = ""; - object.id = ""; - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.primaryProductId = ""; - object.gtin = ""; - object.title = ""; - object.description = ""; - object.languageCode = ""; + object.placeId = ""; object.priceInfo = null; - object.rating = null; - object.availableTime = null; - object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; - object.availableQuantity = null; - object.uri = ""; - object.audience = null; - object.colorInfo = null; - object.retrievableFields = null; - object.publishTime = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; - if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) - object.primaryProductId = message.primaryProductId; - if (message.collectionMemberIds && message.collectionMemberIds.length) { - object.collectionMemberIds = []; - for (var j = 0; j < message.collectionMemberIds.length; ++j) - object.collectionMemberIds[j] = message.collectionMemberIds[j]; - } - if (message.gtin != null && message.hasOwnProperty("gtin")) - object.gtin = message.gtin; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = message.categories[j]; } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.brands && message.brands.length) { - object.brands = []; - for (var j = 0; j < message.brands.length; ++j) - object.brands[j] = message.brands[j]; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; + if (message.placeId != null && message.hasOwnProperty("placeId")) + object.placeId = message.placeId; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.toObject(message.priceInfo, options); var keys2; if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { object.attributes = {}; for (var j = 0; j < keys2.length; ++j) object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); } - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.toObject(message.priceInfo, options); - if (message.rating != null && message.hasOwnProperty("rating")) - object.rating = $root.google.cloud.retail.v2beta.Rating.toObject(message.rating, options); - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); - if (options.oneofs) - object.expiration = "expireTime"; + if (message.fulfillmentTypes && message.fulfillmentTypes.length) { + object.fulfillmentTypes = []; + for (var j = 0; j < message.fulfillmentTypes.length; ++j) + object.fulfillmentTypes[j] = message.fulfillmentTypes[j]; } - if (message.ttl != null && message.hasOwnProperty("ttl")) { - object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); - if (options.oneofs) - object.expiration = "ttl"; - } - if (message.availableTime != null && message.hasOwnProperty("availableTime")) - object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); - if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; - if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) - object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); - if (message.fulfillmentInfo && message.fulfillmentInfo.length) { - object.fulfillmentInfo = []; - for (var j = 0; j < message.fulfillmentInfo.length; ++j) - object.fulfillmentInfo[j] = $root.google.cloud.retail.v2beta.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.images && message.images.length) { - object.images = []; - for (var j = 0; j < message.images.length; ++j) - object.images[j] = $root.google.cloud.retail.v2beta.Image.toObject(message.images[j], options); - } - if (message.audience != null && message.hasOwnProperty("audience")) - object.audience = $root.google.cloud.retail.v2beta.Audience.toObject(message.audience, options); - if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) - object.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.toObject(message.colorInfo, options); - if (message.sizes && message.sizes.length) { - object.sizes = []; - for (var j = 0; j < message.sizes.length; ++j) - object.sizes[j] = message.sizes[j]; - } - if (message.materials && message.materials.length) { - object.materials = []; - for (var j = 0; j < message.materials.length; ++j) - object.materials[j] = message.materials[j]; - } - if (message.patterns && message.patterns.length) { - object.patterns = []; - for (var j = 0; j < message.patterns.length; ++j) - object.patterns[j] = message.patterns[j]; + return object; + }; + + /** + * Converts this LocalInventory to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.LocalInventory + * @instance + * @returns {Object.} JSON object + */ + LocalInventory.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocalInventory; + })(); + + v2beta.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.retail.v2beta + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + */ + function GcsSource(properties) { + this.inputUris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + */ + GcsSource.prototype.inputUris = $util.emptyArray; + + /** + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + case 2: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - if (message.conditions && message.conditions.length) { - object.conditions = []; - for (var j = 0; j < message.conditions.length; ++j) - object.conditions[j] = message.conditions[j]; + return message; + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; } - if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) - object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); - if (message.variants && message.variants.length) { - object.variants = []; - for (var j = 0; j < message.variants.length; ++j) - object.variants[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.variants[j], options); + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GcsSource) + return object; + var message = new $root.google.cloud.retail.v2beta.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2beta.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); } - if (message.publishTime != null && message.hasOwnProperty("publishTime")) - object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); - if (message.promotions && message.promotions.length) { - object.promotions = []; - for (var j = 0; j < message.promotions.length; ++j) - object.promotions[j] = $root.google.cloud.retail.v2beta.Promotion.toObject(message.promotions[j], options); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {google.cloud.retail.v2beta.GcsSource} message GcsSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; return object; }; - /** - * Converts this Product to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.Product - * @instance - * @returns {Object.} JSON object - */ - Product.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsSource; + })(); + + v2beta.BigQuerySource = (function() { + + /** + * Properties of a BigQuerySource. + * @memberof google.cloud.retail.v2beta + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema + */ + + /** + * Constructs a new BigQuerySource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource + * @constructor + * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + */ + function BigQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.partitionDate = null; + + /** + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.projectId = ""; + + /** + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.datasetId = ""; + + /** + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + */ + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource instance + */ + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); + }; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 5: + message.projectId = reader.string(); + break; + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQuerySource message. + * @function verify + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; + { + var error = $root.google.type.Date.verify(message.partitionDate); + if (error) + return "partitionDate." + error; + } + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.BigQuerySource} BigQuerySource + */ + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.BigQuerySource) + return object; + var message = new $root.google.cloud.retail.v2beta.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2beta.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); + } + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {google.cloud.retail.v2beta.BigQuerySource} message BigQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (options.oneofs) + object.partition = "partitionDate"; + } + return object; + }; + + /** + * Converts this BigQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @instance + * @returns {Object.} JSON object + */ + BigQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQuerySource; + })(); + + v2beta.ProductInlineSource = (function() { + + /** + * Properties of a ProductInlineSource. + * @memberof google.cloud.retail.v2beta + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products + */ + + /** + * Constructs a new ProductInlineSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource + * @constructor + * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + */ + function ProductInlineSource(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @instance + */ + ProductInlineSource.prototype.products = $util.emptyArray; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource instance + */ + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); + }; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + return null; + }; + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductInlineSource} ProductInlineSource + */ + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductInlineSource) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {google.cloud.retail.v2beta.ProductInlineSource} message ProductInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); + } + return object; + }; + + /** + * Converts this ProductInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @instance + * @returns {Object.} JSON object + */ + ProductInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInlineSource; + })(); + + v2beta.UserEventInlineSource = (function() { + + /** + * Properties of a UserEventInlineSource. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + */ + + /** + * Constructs a new UserEventInlineSource. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + */ + function UserEventInlineSource(properties) { + this.userEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource instance + */ + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); + }; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInlineSource message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInlineSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventInlineSource} UserEventInlineSource + */ + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventInlineSource) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2beta.UserEventInlineSource} message UserEventInlineSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInlineSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvents[j], options); + } + return object; + }; + + /** + * Converts this UserEventInlineSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @instance + * @returns {Object.} JSON object + */ + UserEventInlineSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInlineSource; + })(); + + v2beta.ImportErrorsConfig = (function() { + + /** + * Properties of an ImportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ImportErrorsConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + */ + function ImportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + */ + ImportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + */ + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig instance + */ + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); + }; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportErrorsConfig} ImportErrorsConfig + */ + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {google.cloud.retail.v2beta.ImportErrorsConfig} message ImportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ImportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportErrorsConfig; + })(); + + v2beta.ImportProductsRequest = (function() { + + /** + * Properties of an ImportProductsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2beta.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + */ + + /** + * Constructs a new ImportProductsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + */ + function ImportProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.parent = ""; + + /** + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.requestId = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2beta.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest instance + */ + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); + }; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); + return writer; + }; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 6: + message.requestId = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.ProductInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportProductsRequest} ImportProductsRequest + */ + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {google.cloud.retail.v2beta.ImportProductsRequest} message ImportProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; + + /** + * Converts this ImportProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ReconciliationMode enum. + * @name google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value + */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); + + return ImportProductsRequest; + })(); + + v2beta.ImportUserEventsRequest = (function() { + + /** + * Properties of an ImportUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2beta.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + */ + + /** + * Constructs a new ImportUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + */ + function ImportUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.parent = ""; + + /** + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2beta.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.inputConfig = null; + + /** + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + */ + ImportUserEventsRequest.prototype.errorsConfig = null; + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest instance + */ + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); + }; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportUserEventsRequest} ImportUserEventsRequest + */ + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsRequest; + })(); + + v2beta.ImportCompletionDataRequest = (function() { + + /** + * Properties of an ImportCompletionDataRequest. + * @memberof google.cloud.retail.v2beta + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2beta.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic + */ + + /** + * Constructs a new ImportCompletionDataRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest + * @constructor + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest=} [properties] Properties to set + */ + function ImportCompletionDataRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.parent = ""; + + /** + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2beta.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.inputConfig = null; + + /** + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + */ + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest instance + */ + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); + }; + + /** + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2beta.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); + return writer; + }; + + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportCompletionDataRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 3: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportCompletionDataRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportCompletionDataRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; + + /** + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportCompletionDataRequest} ImportCompletionDataRequest + */ + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportCompletionDataRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.fromObject(object.inputConfig); + } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; + + /** + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {google.cloud.retail.v2beta.ImportCompletionDataRequest} message ImportCompletionDataRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCompletionDataRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; + + /** + * Converts this ImportCompletionDataRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @instance + * @returns {Object.} JSON object + */ + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportCompletionDataRequest; + })(); + + v2beta.ProductInputConfig = (function() { + + /** + * Properties of a ProductInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface IProductInputConfig + * @property {google.cloud.retail.v2beta.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + */ + + /** + * Constructs a new ProductInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + */ + function ProductInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2beta.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.productInlineSource = null; + + /** + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + */ + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig instance + */ + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); + }; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2beta.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.ProductInlineSource.verify(message.productInlineSource); + if (error) + return "productInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductInputConfig} ProductInputConfig + */ + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {google.cloud.retail.v2beta.ProductInputConfig} message ProductInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this ProductInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @instance + * @returns {Object.} JSON object + */ + ProductInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductInputConfig; + })(); + + v2beta.UserEventInputConfig = (function() { + + /** + * Properties of a UserEventInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2beta.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2beta.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + */ + + /** + * Constructs a new UserEventInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + */ + function UserEventInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2beta.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.userEventInlineSource = null; + + /** + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2beta.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.gcsSource = null; + + /** + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + UserEventInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + */ + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig instance + */ + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); + }; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2beta.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2beta.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventInputConfig} UserEventInputConfig + */ + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.fromObject(object.userEventInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {google.cloud.retail.v2beta.UserEventInputConfig} message UserEventInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this UserEventInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @instance + * @returns {Object.} JSON object + */ + UserEventInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventInputConfig; + })(); + + v2beta.CompletionDataInputConfig = (function() { + + /** + * Properties of a CompletionDataInputConfig. + * @memberof google.cloud.retail.v2beta + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2beta.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + */ + + /** + * Constructs a new CompletionDataInputConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig + * @constructor + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig=} [properties] Properties to set + */ + function CompletionDataInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2beta.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @instance + */ + CompletionDataInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @instance + */ + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig instance + */ + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); + }; + + /** + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDataInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2beta.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDataInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDataInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionDataInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionDataInputConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDataInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2beta.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; + }; + + /** + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompletionDataInputConfig} CompletionDataInputConfig + */ + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompletionDataInputConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.fromObject(object.bigQuerySource); + } + return message; + }; + + /** + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {google.cloud.retail.v2beta.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionDataInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; + } + return object; + }; + + /** + * Converts this CompletionDataInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @instance + * @returns {Object.} JSON object + */ + CompletionDataInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDataInputConfig; + })(); + + v2beta.ImportMetadata = (function() { + + /** + * Properties of an ImportMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic + */ + + /** + * Constructs a new ImportMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + */ + function ImportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.createTime = null; + + /** + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.updateTime = null; + + /** + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.requestId = ""; + + /** + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + */ + ImportMetadata.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata instance + */ + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); + }; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); + return writer; + }; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + case 5: + message.requestId = reader.string(); + break; + case 6: + message.notificationPubsubTopic = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; + return null; + }; + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportMetadata} ImportMetadata + */ + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportMetadata) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); + return message; + }; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {google.cloud.retail.v2beta.ImportMetadata} message ImportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; + return object; + }; + + /** + * Converts this ImportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportMetadata; + })(); + + v2beta.ImportProductsResponse = (function() { + + /** + * Properties of an ImportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + */ + + /** + * Constructs a new ImportProductsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + */ + function ImportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + */ + ImportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse instance + */ + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); + }; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportProductsResponse} ImportProductsResponse + */ + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {google.cloud.retail.v2beta.ImportProductsResponse} message ImportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ImportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportProductsResponse; + })(); + + v2beta.ImportUserEventsResponse = (function() { + + /** + * Properties of an ImportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2beta.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2beta.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + */ + + /** + * Constructs a new ImportUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + */ + function ImportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2beta.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse instance + */ + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2beta.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2beta.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } + return null; + }; + + /** + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportUserEventsResponse} ImportUserEventsResponse + */ + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.fromObject(object.importSummary); + } + return message; + }; + + /** + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.toObject(message.importSummary, options); + return object; + }; + + /** + * Converts this ImportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportUserEventsResponse; + })(); + + v2beta.UserEventImportSummary = (function() { + + /** + * Properties of a UserEventImportSummary. + * @memberof google.cloud.retail.v2beta + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + */ + + /** + * Constructs a new UserEventImportSummary. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary + * @constructor + * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + */ + function UserEventImportSummary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + */ + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new UserEventImportSummary instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary instance + */ + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); + }; + + /** + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + return writer; + }; + + /** + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEventImportSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.joinedEventsCount = reader.int64(); + break; + case 2: + message.unjoinedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEventImportSummary message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEventImportSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEventImportSummary} UserEventImportSummary + */ + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEventImportSummary) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2beta.UserEventImportSummary} message UserEventImportSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEventImportSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; + } + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + return object; + }; + + /** + * Converts this UserEventImportSummary to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @instance + * @returns {Object.} JSON object + */ + UserEventImportSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEventImportSummary; + })(); + + v2beta.ImportCompletionDataResponse = (function() { + + /** + * Properties of an ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2beta + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples + */ + + /** + * Constructs a new ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse + * @constructor + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse=} [properties] Properties to set + */ + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @instance + */ + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + + /** + * Creates a new ImportCompletionDataResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse instance + */ + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); + }; + + /** + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ImportCompletionDataResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ImportCompletionDataResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportCompletionDataResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportCompletionDataResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + return null; + }; + + /** + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ImportCompletionDataResponse} ImportCompletionDataResponse + */ + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ImportCompletionDataResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2beta.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCompletionDataResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + return object; + }; + + /** + * Converts this ImportCompletionDataResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @instance + * @returns {Object.} JSON object + */ + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportCompletionDataResponse; + })(); + + v2beta.Product = (function() { + + /** + * Properties of a Product. + * @memberof google.cloud.retail.v2beta + * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2beta.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands + * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2beta.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2beta.IRating|null} [rating] Product rating + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2beta.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2beta.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2beta.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants + */ + + /** + * Constructs a new Product. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + */ + function Product(properties) { + this.collectionMemberIds = []; + this.categories = []; + this.brands = []; + this.attributes = {}; + this.tags = []; + this.fulfillmentInfo = []; + this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.expireTime = null; + + /** + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.ttl = null; + + /** + * Product name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.name = ""; + + /** + * Product id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.id = ""; + + /** + * Product type. + * @member {google.cloud.retail.v2beta.Product.Type} type + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.type = 0; + + /** + * Product primaryProductId. + * @member {string} primaryProductId + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.primaryProductId = ""; + + /** + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.collectionMemberIds = $util.emptyArray; + + /** + * Product gtin. + * @member {string} gtin + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.gtin = ""; + + /** + * Product categories. + * @member {Array.} categories + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.categories = $util.emptyArray; + + /** + * Product title. + * @member {string} title + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.title = ""; + + /** + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.brands = $util.emptyArray; + + /** + * Product description. + * @member {string} description + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.description = ""; + + /** + * Product languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.languageCode = ""; + + /** + * Product attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2beta.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product rating. + * @member {google.cloud.retail.v2beta.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.rating = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availableTime = null; + + /** + * Product availability. + * @member {google.cloud.retail.v2beta.Product.Availability} availability + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availability = 0; + + /** + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.availableQuantity = null; + + /** + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.fulfillmentInfo = $util.emptyArray; + + /** + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.uri = ""; + + /** + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.images = $util.emptyArray; + + /** + * Product audience. + * @member {google.cloud.retail.v2beta.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.audience = null; + + /** + * Product colorInfo. + * @member {google.cloud.retail.v2beta.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.colorInfo = null; + + /** + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.sizes = $util.emptyArray; + + /** + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.materials = $util.emptyArray; + + /** + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.patterns = $util.emptyArray; + + /** + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.conditions = $util.emptyArray; + + /** + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.promotions = $util.emptyArray; + + /** + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.publishTime = null; + + /** + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.retrievableFields = null; + + /** + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.variants = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2beta.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2beta.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) + $root.google.cloud.retail.v2beta.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); + if (message.images != null && message.images.length) + for (var i = 0; i < message.images.length; ++i) + $root.google.cloud.retail.v2beta.Image.encode(message.images[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) + $root.google.cloud.retail.v2beta.Audience.encode(message.audience, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.colorInfo != null && Object.hasOwnProperty.call(message, "colorInfo")) + $root.google.cloud.retail.v2beta.ColorInfo.encode(message.colorInfo, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.sizes != null && message.sizes.length) + for (var i = 0; i < message.sizes.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.sizes[i]); + if (message.materials != null && message.materials.length) + for (var i = 0; i < message.materials.length; ++i) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.materials[i]); + if (message.patterns != null && message.patterns.length) + for (var i = 0; i < message.patterns.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.patterns[i]); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.conditions[i]); + if (message.retrievableFields != null && Object.hasOwnProperty.call(message, "retrievableFields")) + $root.google.protobuf.FieldMask.encode(message.retrievableFields, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.variants != null && message.variants.length) + for (var i = 0; i < message.variants.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.variants[i], writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.promotions != null && message.promotions.length) + for (var i = 0; i < message.promotions.length; ++i) + $root.google.cloud.retail.v2beta.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Product.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Product message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Product(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 16: + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 17: + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.primaryProductId = reader.string(); + break; + case 5: + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + case 6: + message.gtin = reader.string(); + break; + case 7: + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + case 8: + message.title = reader.string(); + break; + case 9: + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + case 10: + message.description = reader.string(); + break; + case 11: + message.languageCode = reader.string(); + break; + case 12: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 13: + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + case 14: + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); + break; + case 15: + message.rating = $root.google.cloud.retail.v2beta.Rating.decode(reader, reader.uint32()); + break; + case 18: + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 19: + message.availability = reader.int32(); + break; + case 20: + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + case 21: + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2beta.FulfillmentInfo.decode(reader, reader.uint32())); + break; + case 22: + message.uri = reader.string(); + break; + case 23: + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); + break; + case 24: + message.audience = $root.google.cloud.retail.v2beta.Audience.decode(reader, reader.uint32()); + break; + case 25: + message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.decode(reader, reader.uint32()); + break; + case 26: + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + case 27: + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + case 28: + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + case 29: + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + case 34: + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2beta.Promotion.decode(reader, reader.uint32())); + break; + case 33: + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 30: + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 31: + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Product message. + * @function verify + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Product.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.ttl); + if (error) + return "ttl." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + if (!$util.isString(message.primaryProductId)) + return "primaryProductId: string expected"; + if (message.collectionMemberIds != null && message.hasOwnProperty("collectionMemberIds")) { + if (!Array.isArray(message.collectionMemberIds)) + return "collectionMemberIds: array expected"; + for (var i = 0; i < message.collectionMemberIds.length; ++i) + if (!$util.isString(message.collectionMemberIds[i])) + return "collectionMemberIds: string[] expected"; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + if (!$util.isString(message.gtin)) + return "gtin: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) + if (!$util.isString(message.categories[i])) + return "categories: string[] expected"; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.brands != null && message.hasOwnProperty("brands")) { + if (!Array.isArray(message.brands)) + return "brands: array expected"; + for (var i = 0; i < message.brands.length; ++i) + if (!$util.isString(message.brands[i])) + return "brands: string[] expected"; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2beta.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.rating != null && message.hasOwnProperty("rating")) { + var error = $root.google.cloud.retail.v2beta.Rating.verify(message.rating); + if (error) + return "rating." + error; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.availableTime); + if (error) + return "availableTime." + error; + } + if (message.availability != null && message.hasOwnProperty("availability")) + switch (message.availability) { + default: + return "availability: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.availableQuantity); + if (error) + return "availableQuantity." + error; + } + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + if (!Array.isArray(message.fulfillmentInfo)) + return "fulfillmentInfo: array expected"; + for (var i = 0; i < message.fulfillmentInfo.length; ++i) { + var error = $root.google.cloud.retail.v2beta.FulfillmentInfo.verify(message.fulfillmentInfo[i]); + if (error) + return "fulfillmentInfo." + error; + } + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.images != null && message.hasOwnProperty("images")) { + if (!Array.isArray(message.images)) + return "images: array expected"; + for (var i = 0; i < message.images.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Image.verify(message.images[i]); + if (error) + return "images." + error; + } + } + if (message.audience != null && message.hasOwnProperty("audience")) { + var error = $root.google.cloud.retail.v2beta.Audience.verify(message.audience); + if (error) + return "audience." + error; + } + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) { + var error = $root.google.cloud.retail.v2beta.ColorInfo.verify(message.colorInfo); + if (error) + return "colorInfo." + error; + } + if (message.sizes != null && message.hasOwnProperty("sizes")) { + if (!Array.isArray(message.sizes)) + return "sizes: array expected"; + for (var i = 0; i < message.sizes.length; ++i) + if (!$util.isString(message.sizes[i])) + return "sizes: string[] expected"; + } + if (message.materials != null && message.hasOwnProperty("materials")) { + if (!Array.isArray(message.materials)) + return "materials: array expected"; + for (var i = 0; i < message.materials.length; ++i) + if (!$util.isString(message.materials[i])) + return "materials: string[] expected"; + } + if (message.patterns != null && message.hasOwnProperty("patterns")) { + if (!Array.isArray(message.patterns)) + return "patterns: array expected"; + for (var i = 0; i < message.patterns.length; ++i) + if (!$util.isString(message.patterns[i])) + return "patterns: string[] expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) + if (!$util.isString(message.conditions[i])) + return "conditions: string[] expected"; + } + if (message.promotions != null && message.hasOwnProperty("promotions")) { + if (!Array.isArray(message.promotions)) + return "promotions: array expected"; + for (var i = 0; i < message.promotions.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Promotion.verify(message.promotions[i]); + if (error) + return "promotions." + error; + } + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.publishTime); + if (error) + return "publishTime." + error; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) { + var error = $root.google.protobuf.FieldMask.verify(message.retrievableFields); + if (error) + return "retrievableFields." + error; + } + if (message.variants != null && message.hasOwnProperty("variants")) { + if (!Array.isArray(message.variants)) + return "variants: array expected"; + for (var i = 0; i < message.variants.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.variants[i]); + if (error) + return "variants." + error; + } + } + return null; + }; + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Product} Product + */ + Product.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Product) + return object; + var message = new $root.google.cloud.retail.v2beta.Product(); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + if (object.ttl != null) { + if (typeof object.ttl !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.ttl: object expected"); + message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl); + } + if (object.name != null) + message.name = String(object.name); + if (object.id != null) + message.id = String(object.id); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "VARIANT": + case 2: + message.type = 2; + break; + case "COLLECTION": + case 3: + message.type = 3; + break; + } + if (object.primaryProductId != null) + message.primaryProductId = String(object.primaryProductId); + if (object.collectionMemberIds) { + if (!Array.isArray(object.collectionMemberIds)) + throw TypeError(".google.cloud.retail.v2beta.Product.collectionMemberIds: array expected"); + message.collectionMemberIds = []; + for (var i = 0; i < object.collectionMemberIds.length; ++i) + message.collectionMemberIds[i] = String(object.collectionMemberIds[i]); + } + if (object.gtin != null) + message.gtin = String(object.gtin); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.retail.v2beta.Product.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) + message.categories[i] = String(object.categories[i]); + } + if (object.title != null) + message.title = String(object.title); + if (object.brands) { + if (!Array.isArray(object.brands)) + throw TypeError(".google.cloud.retail.v2beta.Product.brands: array expected"); + message.brands = []; + for (var i = 0; i < object.brands.length; ++i) + message.brands[i] = String(object.brands[i]); + } + if (object.description != null) + message.description = String(object.description); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.retail.v2beta.Product.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.fromObject(object.priceInfo); + } + if (object.rating != null) { + if (typeof object.rating !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.rating: object expected"); + message.rating = $root.google.cloud.retail.v2beta.Rating.fromObject(object.rating); + } + if (object.availableTime != null) { + if (typeof object.availableTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.availableTime: object expected"); + message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); + } + switch (object.availability) { + case "AVAILABILITY_UNSPECIFIED": + case 0: + message.availability = 0; + break; + case "IN_STOCK": + case 1: + message.availability = 1; + break; + case "OUT_OF_STOCK": + case 2: + message.availability = 2; + break; + case "PREORDER": + case 3: + message.availability = 3; + break; + case "BACKORDER": + case 4: + message.availability = 4; + break; + } + if (object.availableQuantity != null) { + if (typeof object.availableQuantity !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.availableQuantity: object expected"); + message.availableQuantity = $root.google.protobuf.Int32Value.fromObject(object.availableQuantity); + } + if (object.fulfillmentInfo) { + if (!Array.isArray(object.fulfillmentInfo)) + throw TypeError(".google.cloud.retail.v2beta.Product.fulfillmentInfo: array expected"); + message.fulfillmentInfo = []; + for (var i = 0; i < object.fulfillmentInfo.length; ++i) { + if (typeof object.fulfillmentInfo[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.fulfillmentInfo: object expected"); + message.fulfillmentInfo[i] = $root.google.cloud.retail.v2beta.FulfillmentInfo.fromObject(object.fulfillmentInfo[i]); + } + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.images) { + if (!Array.isArray(object.images)) + throw TypeError(".google.cloud.retail.v2beta.Product.images: array expected"); + message.images = []; + for (var i = 0; i < object.images.length; ++i) { + if (typeof object.images[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.images: object expected"); + message.images[i] = $root.google.cloud.retail.v2beta.Image.fromObject(object.images[i]); + } + } + if (object.audience != null) { + if (typeof object.audience !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.audience: object expected"); + message.audience = $root.google.cloud.retail.v2beta.Audience.fromObject(object.audience); + } + if (object.colorInfo != null) { + if (typeof object.colorInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.colorInfo: object expected"); + message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.fromObject(object.colorInfo); + } + if (object.sizes) { + if (!Array.isArray(object.sizes)) + throw TypeError(".google.cloud.retail.v2beta.Product.sizes: array expected"); + message.sizes = []; + for (var i = 0; i < object.sizes.length; ++i) + message.sizes[i] = String(object.sizes[i]); + } + if (object.materials) { + if (!Array.isArray(object.materials)) + throw TypeError(".google.cloud.retail.v2beta.Product.materials: array expected"); + message.materials = []; + for (var i = 0; i < object.materials.length; ++i) + message.materials[i] = String(object.materials[i]); + } + if (object.patterns) { + if (!Array.isArray(object.patterns)) + throw TypeError(".google.cloud.retail.v2beta.Product.patterns: array expected"); + message.patterns = []; + for (var i = 0; i < object.patterns.length; ++i) + message.patterns[i] = String(object.patterns[i]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.cloud.retail.v2beta.Product.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) + message.conditions[i] = String(object.conditions[i]); + } + if (object.promotions) { + if (!Array.isArray(object.promotions)) + throw TypeError(".google.cloud.retail.v2beta.Product.promotions: array expected"); + message.promotions = []; + for (var i = 0; i < object.promotions.length; ++i) { + if (typeof object.promotions[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.promotions: object expected"); + message.promotions[i] = $root.google.cloud.retail.v2beta.Promotion.fromObject(object.promotions[i]); + } + } + if (object.publishTime != null) { + if (typeof object.publishTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.publishTime: object expected"); + message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime); + } + if (object.retrievableFields != null) { + if (typeof object.retrievableFields !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.retrievableFields: object expected"); + message.retrievableFields = $root.google.protobuf.FieldMask.fromObject(object.retrievableFields); + } + if (object.variants) { + if (!Array.isArray(object.variants)) + throw TypeError(".google.cloud.retail.v2beta.Product.variants: array expected"); + message.variants = []; + for (var i = 0; i < object.variants.length; ++i) { + if (typeof object.variants[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.variants: object expected"); + message.variants[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.variants[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {google.cloud.retail.v2beta.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.collectionMemberIds = []; + object.categories = []; + object.brands = []; + object.tags = []; + object.fulfillmentInfo = []; + object.images = []; + object.sizes = []; + object.materials = []; + object.patterns = []; + object.conditions = []; + object.variants = []; + object.promotions = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.name = ""; + object.id = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.primaryProductId = ""; + object.gtin = ""; + object.title = ""; + object.description = ""; + object.languageCode = ""; + object.priceInfo = null; + object.rating = null; + object.availableTime = null; + object.availability = options.enums === String ? "AVAILABILITY_UNSPECIFIED" : 0; + object.availableQuantity = null; + object.uri = ""; + object.audience = null; + object.colorInfo = null; + object.retrievableFields = null; + object.publishTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; + if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) + object.primaryProductId = message.primaryProductId; + if (message.collectionMemberIds && message.collectionMemberIds.length) { + object.collectionMemberIds = []; + for (var j = 0; j < message.collectionMemberIds.length; ++j) + object.collectionMemberIds[j] = message.collectionMemberIds[j]; + } + if (message.gtin != null && message.hasOwnProperty("gtin")) + object.gtin = message.gtin; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = message.categories[j]; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.brands && message.brands.length) { + object.brands = []; + for (var j = 0; j < message.brands.length; ++j) + object.brands[j] = message.brands[j]; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.toObject(message.priceInfo, options); + if (message.rating != null && message.hasOwnProperty("rating")) + object.rating = $root.google.cloud.retail.v2beta.Rating.toObject(message.rating, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (options.oneofs) + object.expiration = "expireTime"; + } + if (message.ttl != null && message.hasOwnProperty("ttl")) { + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (options.oneofs) + object.expiration = "ttl"; + } + if (message.availableTime != null && message.hasOwnProperty("availableTime")) + object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); + if (message.availability != null && message.hasOwnProperty("availability")) + object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; + if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) + object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); + if (message.fulfillmentInfo && message.fulfillmentInfo.length) { + object.fulfillmentInfo = []; + for (var j = 0; j < message.fulfillmentInfo.length; ++j) + object.fulfillmentInfo[j] = $root.google.cloud.retail.v2beta.FulfillmentInfo.toObject(message.fulfillmentInfo[j], options); + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.images && message.images.length) { + object.images = []; + for (var j = 0; j < message.images.length; ++j) + object.images[j] = $root.google.cloud.retail.v2beta.Image.toObject(message.images[j], options); + } + if (message.audience != null && message.hasOwnProperty("audience")) + object.audience = $root.google.cloud.retail.v2beta.Audience.toObject(message.audience, options); + if (message.colorInfo != null && message.hasOwnProperty("colorInfo")) + object.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.toObject(message.colorInfo, options); + if (message.sizes && message.sizes.length) { + object.sizes = []; + for (var j = 0; j < message.sizes.length; ++j) + object.sizes[j] = message.sizes[j]; + } + if (message.materials && message.materials.length) { + object.materials = []; + for (var j = 0; j < message.materials.length; ++j) + object.materials[j] = message.materials[j]; + } + if (message.patterns && message.patterns.length) { + object.patterns = []; + for (var j = 0; j < message.patterns.length; ++j) + object.patterns[j] = message.patterns[j]; + } + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = message.conditions[j]; + } + if (message.retrievableFields != null && message.hasOwnProperty("retrievableFields")) + object.retrievableFields = $root.google.protobuf.FieldMask.toObject(message.retrievableFields, options); + if (message.variants && message.variants.length) { + object.variants = []; + for (var j = 0; j < message.variants.length; ++j) + object.variants[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.variants[j], options); + } + if (message.publishTime != null && message.hasOwnProperty("publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); + if (message.promotions && message.promotions.length) { + object.promotions = []; + for (var j = 0; j < message.promotions.length; ++j) + object.promotions[j] = $root.google.cloud.retail.v2beta.Promotion.toObject(message.promotions[j], options); + } + return object; + }; + + /** + * Converts this Product to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Product + * @instance + * @returns {Object.} JSON object + */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.retail.v2beta.Product.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} VARIANT=2 VARIANT value + * @property {number} COLLECTION=3 COLLECTION value + */ + Product.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "VARIANT"] = 2; + values[valuesById[3] = "COLLECTION"] = 3; + return values; + })(); + + /** + * Availability enum. + * @name google.cloud.retail.v2beta.Product.Availability + * @enum {number} + * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value + * @property {number} IN_STOCK=1 IN_STOCK value + * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value + * @property {number} PREORDER=3 PREORDER value + * @property {number} BACKORDER=4 BACKORDER value + */ + Product.Availability = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_STOCK"] = 1; + values[valuesById[2] = "OUT_OF_STOCK"] = 2; + values[valuesById[3] = "PREORDER"] = 3; + values[valuesById[4] = "BACKORDER"] = 4; + return values; + })(); + + return Product; + })(); + + v2beta.Promotion = (function() { + + /** + * Properties of a Promotion. + * @memberof google.cloud.retail.v2beta + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId + */ + + /** + * Constructs a new Promotion. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Promotion. + * @implements IPromotion + * @constructor + * @param {google.cloud.retail.v2beta.IPromotion=} [properties] Properties to set + */ + function Promotion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2beta.Promotion + * @instance + */ + Promotion.prototype.promotionId = ""; + + /** + * Creates a new Promotion instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Promotion} Promotion instance + */ + Promotion.create = function create(properties) { + return new Promotion(properties); + }; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + return writer; + }; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Promotion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Promotion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.promotionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Promotion message. + * @function verify + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Promotion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; + return null; + }; + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Promotion} Promotion + */ + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Promotion) + return object; + var message = new $root.google.cloud.retail.v2beta.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); + return message; + }; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {google.cloud.retail.v2beta.Promotion} message Promotion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Promotion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; + return object; + }; + + /** + * Converts this Promotion to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Promotion + * @instance + * @returns {Object.} JSON object + */ + Promotion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Promotion; + })(); + + v2beta.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2beta + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2beta.ICompletionDetail|null} [completionDetail] UserEvent completionDetail + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId + * @property {google.cloud.retail.v2beta.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction + * @property {string|null} [searchQuery] UserEvent searchQuery + * @property {string|null} [filter] UserEvent filter + * @property {string|null} [orderBy] UserEvent orderBy + * @property {number|null} [offset] UserEvent offset + * @property {Array.|null} [pageCategories] UserEvent pageCategories + * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] UserEvent userInfo + * @property {string|null} [uri] UserEvent uri + * @property {string|null} [referrerUri] UserEvent referrerUri + * @property {string|null} [pageViewId] UserEvent pageViewId + */ + + /** + * Constructs a new UserEvent. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a UserEvent. + * @implements IUserEvent + * @constructor + * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + */ + function UserEvent(properties) { + this.experimentIds = []; + this.productDetails = []; + this.attributes = {}; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserEvent eventType. + * @member {string} eventType + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.eventType = ""; + + /** + * UserEvent visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.visitorId = ""; + + /** + * UserEvent sessionId. + * @member {string} sessionId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.sessionId = ""; + + /** + * UserEvent eventTime. + * @member {google.protobuf.ITimestamp|null|undefined} eventTime + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.eventTime = null; + + /** + * UserEvent experimentIds. + * @member {Array.} experimentIds + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.experimentIds = $util.emptyArray; + + /** + * UserEvent attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.attributionToken = ""; + + /** + * UserEvent productDetails. + * @member {Array.} productDetails + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.productDetails = $util.emptyArray; + + /** + * UserEvent completionDetail. + * @member {google.cloud.retail.v2beta.ICompletionDetail|null|undefined} completionDetail + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.completionDetail = null; + + /** + * UserEvent attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.attributes = $util.emptyObject; + + /** + * UserEvent cartId. + * @member {string} cartId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.cartId = ""; + + /** + * UserEvent purchaseTransaction. + * @member {google.cloud.retail.v2beta.IPurchaseTransaction|null|undefined} purchaseTransaction + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.purchaseTransaction = null; + + /** + * UserEvent searchQuery. + * @member {string} searchQuery + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.searchQuery = ""; + + /** + * UserEvent filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.filter = ""; + + /** + * UserEvent orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.orderBy = ""; + + /** + * UserEvent offset. + * @member {number} offset + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.offset = 0; + + /** + * UserEvent pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.pageCategories = $util.emptyArray; + + /** + * UserEvent userInfo. + * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.userInfo = null; + + /** + * UserEvent uri. + * @member {string} uri + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.uri = ""; + + /** + * UserEvent referrerUri. + * @member {string} referrerUri + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.referrerUri = ""; + + /** + * UserEvent pageViewId. + * @member {string} pageViewId + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + */ + UserEvent.prototype.pageViewId = ""; + + /** + * Creates a new UserEvent instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent instance + */ + UserEvent.create = function create(properties) { + return new UserEvent(properties); + }; + + /** + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); + if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) + $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.experimentIds != null && message.experimentIds.length) + for (var i = 0; i < message.experimentIds.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.productDetails != null && message.productDetails.length) + for (var i = 0; i < message.productDetails.length; ++i) + $root.google.cloud.retail.v2beta.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); + if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) + $root.google.cloud.retail.v2beta.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); + if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); + if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); + if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) + $root.google.cloud.retail.v2beta.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEvent(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventType = reader.string(); + break; + case 2: + message.visitorId = reader.string(); + break; + case 21: + message.sessionId = reader.string(); + break; + case 3: + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); + break; + case 22: + message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.decode(reader, reader.uint32()); + break; + case 7: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + case 8: + message.cartId = reader.string(); + break; + case 9: + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); + break; + case 10: + message.searchQuery = reader.string(); + break; + case 16: + message.filter = reader.string(); + break; + case 17: + message.orderBy = reader.string(); + break; + case 18: + message.offset = reader.int32(); + break; + case 11: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 12: + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + case 13: + message.uri = reader.string(); + break; + case 14: + message.referrerUri = reader.string(); + break; + case 15: + message.pageViewId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserEvent message. + * @function verify + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isString(message.sessionId)) + return "sessionId: string expected"; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.eventTime); + if (error) + return "eventTime." + error; + } + if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { + if (!Array.isArray(message.experimentIds)) + return "experimentIds: array expected"; + for (var i = 0; i < message.experimentIds.length; ++i) + if (!$util.isString(message.experimentIds[i])) + return "experimentIds: string[] expected"; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.productDetails != null && message.hasOwnProperty("productDetails")) { + if (!Array.isArray(message.productDetails)) + return "productDetails: array expected"; + for (var i = 0; i < message.productDetails.length; ++i) { + var error = $root.google.cloud.retail.v2beta.ProductDetail.verify(message.productDetails[i]); + if (error) + return "productDetails." + error; + } + } + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { + var error = $root.google.cloud.retail.v2beta.CompletionDetail.verify(message.completionDetail); + if (error) + return "completionDetail." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + if (!$util.isString(message.cartId)) + return "cartId: string expected"; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { + var error = $root.google.cloud.retail.v2beta.PurchaseTransaction.verify(message.purchaseTransaction); + if (error) + return "purchaseTransaction." + error; + } + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + if (!$util.isString(message.searchQuery)) + return "searchQuery: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + if (!$util.isString(message.referrerUri)) + return "referrerUri: string expected"; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + if (!$util.isString(message.pageViewId)) + return "pageViewId: string expected"; + return null; + }; + + /** + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + */ + UserEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UserEvent) + return object; + var message = new $root.google.cloud.retail.v2beta.UserEvent(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.sessionId != null) + message.sessionId = String(object.sessionId); + if (object.eventTime != null) { + if (typeof object.eventTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.eventTime: object expected"); + message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); + } + if (object.experimentIds) { + if (!Array.isArray(object.experimentIds)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.experimentIds: array expected"); + message.experimentIds = []; + for (var i = 0; i < object.experimentIds.length; ++i) + message.experimentIds[i] = String(object.experimentIds[i]); + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.productDetails) { + if (!Array.isArray(object.productDetails)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: array expected"); + message.productDetails = []; + for (var i = 0; i < object.productDetails.length; ++i) { + if (typeof object.productDetails[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: object expected"); + message.productDetails[i] = $root.google.cloud.retail.v2beta.ProductDetail.fromObject(object.productDetails[i]); + } + } + if (object.completionDetail != null) { + if (typeof object.completionDetail !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.completionDetail: object expected"); + message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.fromObject(object.completionDetail); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.cartId != null) + message.cartId = String(object.cartId); + if (object.purchaseTransaction != null) { + if (typeof object.purchaseTransaction !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.purchaseTransaction: object expected"); + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.fromObject(object.purchaseTransaction); + } + if (object.searchQuery != null) + message.searchQuery = String(object.searchQuery); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2beta.UserEvent.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.UserEvent.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.referrerUri != null) + message.referrerUri = String(object.referrerUri); + if (object.pageViewId != null) + message.pageViewId = String(object.pageViewId); + return message; + }; + + /** + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {google.cloud.retail.v2beta.UserEvent} message UserEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.experimentIds = []; + object.productDetails = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) { + object.eventType = ""; + object.visitorId = ""; + object.eventTime = null; + object.attributionToken = ""; + object.cartId = ""; + object.purchaseTransaction = null; + object.searchQuery = ""; + object.userInfo = null; + object.uri = ""; + object.referrerUri = ""; + object.pageViewId = ""; + object.filter = ""; + object.orderBy = ""; + object.offset = 0; + object.sessionId = ""; + object.completionDetail = null; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.eventTime != null && message.hasOwnProperty("eventTime")) + object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); + if (message.experimentIds && message.experimentIds.length) { + object.experimentIds = []; + for (var j = 0; j < message.experimentIds.length; ++j) + object.experimentIds[j] = message.experimentIds[j]; + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.productDetails && message.productDetails.length) { + object.productDetails = []; + for (var j = 0; j < message.productDetails.length; ++j) + object.productDetails[j] = $root.google.cloud.retail.v2beta.ProductDetail.toObject(message.productDetails[j], options); + } + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.cartId != null && message.hasOwnProperty("cartId")) + object.cartId = message.cartId; + if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) + object.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.toObject(message.purchaseTransaction, options); + if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) + object.searchQuery = message.searchQuery; + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) + object.referrerUri = message.referrerUri; + if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) + object.pageViewId = message.pageViewId; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) + object.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.toObject(message.completionDetail, options); + return object; + }; + + /** + * Converts this UserEvent to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UserEvent + * @instance + * @returns {Object.} JSON object + */ + UserEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserEvent; + })(); + + v2beta.ProductDetail = (function() { + + /** + * Properties of a ProductDetail. + * @memberof google.cloud.retail.v2beta + * @interface IProductDetail + * @property {google.cloud.retail.v2beta.IProduct|null} [product] ProductDetail product + * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity + */ + + /** + * Constructs a new ProductDetail. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ProductDetail. + * @implements IProductDetail + * @constructor + * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + */ + function ProductDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductDetail product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + */ + ProductDetail.prototype.product = null; + + /** + * ProductDetail quantity. + * @member {google.protobuf.IInt32Value|null|undefined} quantity + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + */ + ProductDetail.prototype.quantity = null; + + /** + * Creates a new ProductDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail instance + */ + ProductDetail.create = function create(properties) { + return new ProductDetail(properties); + }; + + /** + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) + $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductDetail message. + * @function verify + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.quantity != null && message.hasOwnProperty("quantity")) { + var error = $root.google.protobuf.Int32Value.verify(message.quantity); + if (error) + return "quantity." + error; + } + return null; + }; + + /** + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail + */ + ProductDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ProductDetail) + return object; + var message = new $root.google.cloud.retail.v2beta.ProductDetail(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductDetail.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.quantity != null) { + if (typeof object.quantity !== "object") + throw TypeError(".google.cloud.retail.v2beta.ProductDetail.quantity: object expected"); + message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); + } + return message; + }; + + /** + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {google.cloud.retail.v2beta.ProductDetail} message ProductDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.quantity = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.quantity != null && message.hasOwnProperty("quantity")) + object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); + return object; + }; + + /** + * Converts this ProductDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ProductDetail + * @instance + * @returns {Object.} JSON object + */ + ProductDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductDetail; + })(); + + v2beta.CompletionDetail = (function() { + + /** + * Properties of a CompletionDetail. + * @memberof google.cloud.retail.v2beta + * @interface ICompletionDetail + * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken + * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion + * @property {number|null} [selectedPosition] CompletionDetail selectedPosition + */ + + /** + * Constructs a new CompletionDetail. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompletionDetail. + * @implements ICompletionDetail + * @constructor + * @param {google.cloud.retail.v2beta.ICompletionDetail=} [properties] Properties to set + */ + function CompletionDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionDetail completionAttributionToken. + * @member {string} completionAttributionToken + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + */ + CompletionDetail.prototype.completionAttributionToken = ""; + + /** + * CompletionDetail selectedSuggestion. + * @member {string} selectedSuggestion + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedSuggestion = ""; + + /** + * CompletionDetail selectedPosition. + * @member {number} selectedPosition + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + */ + CompletionDetail.prototype.selectedPosition = 0; + + /** + * Creates a new CompletionDetail instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.ICompletionDetail=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail instance + */ + CompletionDetail.create = function create(properties) { + return new CompletionDetail(properties); + }; + + /** + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); + if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); + if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); + return writer; + }; + + /** + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.ICompletionDetail} message CompletionDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDetail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionAttributionToken = reader.string(); + break; + case 2: + message.selectedSuggestion = reader.string(); + break; + case 3: + message.selectedPosition = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionDetail message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + if (!$util.isString(message.completionAttributionToken)) + return "completionAttributionToken: string expected"; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + if (!$util.isString(message.selectedSuggestion)) + return "selectedSuggestion: string expected"; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + if (!$util.isInteger(message.selectedPosition)) + return "selectedPosition: integer expected"; + return null; + }; + + /** + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail + */ + CompletionDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompletionDetail) + return object; + var message = new $root.google.cloud.retail.v2beta.CompletionDetail(); + if (object.completionAttributionToken != null) + message.completionAttributionToken = String(object.completionAttributionToken); + if (object.selectedSuggestion != null) + message.selectedSuggestion = String(object.selectedSuggestion); + if (object.selectedPosition != null) + message.selectedPosition = object.selectedPosition | 0; + return message; + }; + + /** + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {google.cloud.retail.v2beta.CompletionDetail} message CompletionDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.completionAttributionToken = ""; + object.selectedSuggestion = ""; + object.selectedPosition = 0; + } + if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) + object.completionAttributionToken = message.completionAttributionToken; + if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) + object.selectedSuggestion = message.selectedSuggestion; + if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) + object.selectedPosition = message.selectedPosition; + return object; + }; + + /** + * Converts this CompletionDetail to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @instance + * @returns {Object.} JSON object + */ + CompletionDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionDetail; + })(); + + v2beta.PurchaseTransaction = (function() { + + /** + * Properties of a PurchaseTransaction. + * @memberof google.cloud.retail.v2beta + * @interface IPurchaseTransaction + * @property {string|null} [id] PurchaseTransaction id + * @property {number|null} [revenue] PurchaseTransaction revenue + * @property {number|null} [tax] PurchaseTransaction tax + * @property {number|null} [cost] PurchaseTransaction cost + * @property {string|null} [currencyCode] PurchaseTransaction currencyCode + */ + + /** + * Constructs a new PurchaseTransaction. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurchaseTransaction. + * @implements IPurchaseTransaction + * @constructor + * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + */ + function PurchaseTransaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurchaseTransaction id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.id = ""; + + /** + * PurchaseTransaction revenue. + * @member {number} revenue + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.revenue = 0; + + /** + * PurchaseTransaction tax. + * @member {number} tax + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.tax = 0; + + /** + * PurchaseTransaction cost. + * @member {number} cost + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.cost = 0; + + /** + * PurchaseTransaction currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + */ + PurchaseTransaction.prototype.currencyCode = ""; + + /** + * Creates a new PurchaseTransaction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction instance + */ + PurchaseTransaction.create = function create(properties) { + return new PurchaseTransaction(properties); + }; + + /** + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); + if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + return writer; + }; + + /** + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.revenue = reader.float(); + break; + case 3: + message.tax = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurchaseTransaction message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurchaseTransaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.revenue != null && message.hasOwnProperty("revenue")) + if (typeof message.revenue !== "number") + return "revenue: number expected"; + if (message.tax != null && message.hasOwnProperty("tax")) + if (typeof message.tax !== "number") + return "tax: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; + + /** + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction + */ + PurchaseTransaction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurchaseTransaction) + return object; + var message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); + if (object.id != null) + message.id = String(object.id); + if (object.revenue != null) + message.revenue = Number(object.revenue); + if (object.tax != null) + message.tax = Number(object.tax); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; + + /** + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {google.cloud.retail.v2beta.PurchaseTransaction} message PurchaseTransaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurchaseTransaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.revenue = 0; + object.tax = 0; + object.cost = 0; + object.currencyCode = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.revenue != null && message.hasOwnProperty("revenue")) + object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; + if (message.tax != null && message.hasOwnProperty("tax")) + object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; + + /** + * Converts this PurchaseTransaction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @instance + * @returns {Object.} JSON object + */ + PurchaseTransaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurchaseTransaction; + })(); + + v2beta.CatalogService = (function() { + + /** + * Constructs a new CatalogService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CatalogService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + + /** + * Creates new CatalogService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.CatalogService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + */ + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef ListCatalogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListCatalogsResponse} [response] ListCatalogsResponse + */ + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2beta.ListCatalogsRequest, $root.google.cloud.retail.v2beta.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); + + /** + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Catalog} [response] Catalog + */ + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2beta.UpdateCatalogRequest, $root.google.cloud.retail.v2beta.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); + + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2beta.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); + + /** + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + */ + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2beta.GetDefaultBranchRequest, $root.google.cloud.retail.v2beta.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getCompletionConfig}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef GetCompletionConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.CompletionConfig} [response] CompletionConfig + */ + + /** + * Calls GetCompletionConfig. + * @function getCompletionConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetCompletionConfigRequest} request GetCompletionConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.GetCompletionConfigCallback} callback Node-style callback called with the error, if any, and CompletionConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getCompletionConfig = function getCompletionConfig(request, callback) { + return this.rpcCall(getCompletionConfig, $root.google.cloud.retail.v2beta.GetCompletionConfigRequest, $root.google.cloud.retail.v2beta.CompletionConfig, request, callback); + }, "name", { value: "GetCompletionConfig" }); + + /** + * Calls GetCompletionConfig. + * @function getCompletionConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetCompletionConfigRequest} request GetCompletionConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCompletionConfig}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef UpdateCompletionConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.CompletionConfig} [response] CompletionConfig + */ + + /** + * Calls UpdateCompletionConfig. + * @function updateCompletionConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCompletionConfigRequest} request UpdateCompletionConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfigCallback} callback Node-style callback called with the error, if any, and CompletionConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCompletionConfig = function updateCompletionConfig(request, callback) { + return this.rpcCall(updateCompletionConfig, $root.google.cloud.retail.v2beta.UpdateCompletionConfigRequest, $root.google.cloud.retail.v2beta.CompletionConfig, request, callback); + }, "name", { value: "UpdateCompletionConfig" }); + + /** + * Calls UpdateCompletionConfig. + * @function updateCompletionConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateCompletionConfigRequest} request UpdateCompletionConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getAttributesConfig}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef GetAttributesConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls GetAttributesConfig. + * @function getAttributesConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetAttributesConfigRequest} request GetAttributesConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.GetAttributesConfigCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getAttributesConfig = function getAttributesConfig(request, callback) { + return this.rpcCall(getAttributesConfig, $root.google.cloud.retail.v2beta.GetAttributesConfigRequest, $root.google.cloud.retail.v2beta.AttributesConfig, request, callback); + }, "name", { value: "GetAttributesConfig" }); + + /** + * Calls GetAttributesConfig. + * @function getAttributesConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IGetAttributesConfigRequest} request GetAttributesConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateAttributesConfig}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef UpdateAttributesConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls UpdateAttributesConfig. + * @function updateAttributesConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateAttributesConfigRequest} request UpdateAttributesConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfigCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateAttributesConfig = function updateAttributesConfig(request, callback) { + return this.rpcCall(updateAttributesConfig, $root.google.cloud.retail.v2beta.UpdateAttributesConfigRequest, $root.google.cloud.retail.v2beta.AttributesConfig, request, callback); + }, "name", { value: "UpdateAttributesConfig" }); + + /** + * Calls UpdateAttributesConfig. + * @function updateAttributesConfig + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateAttributesConfigRequest} request UpdateAttributesConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#addCatalogAttribute}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef AddCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls AddCatalogAttribute. + * @function addCatalogAttribute + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IAddCatalogAttributeRequest} request AddCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.AddCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.addCatalogAttribute = function addCatalogAttribute(request, callback) { + return this.rpcCall(addCatalogAttribute, $root.google.cloud.retail.v2beta.AddCatalogAttributeRequest, $root.google.cloud.retail.v2beta.AttributesConfig, request, callback); + }, "name", { value: "AddCatalogAttribute" }); + + /** + * Calls AddCatalogAttribute. + * @function addCatalogAttribute + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IAddCatalogAttributeRequest} request AddCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#removeCatalogAttribute}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef RemoveCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls RemoveCatalogAttribute. + * @function removeCatalogAttribute + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest} request RemoveCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.removeCatalogAttribute = function removeCatalogAttribute(request, callback) { + return this.rpcCall(removeCatalogAttribute, $root.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest, $root.google.cloud.retail.v2beta.AttributesConfig, request, callback); + }, "name", { value: "RemoveCatalogAttribute" }); + + /** + * Calls RemoveCatalogAttribute. + * @function removeCatalogAttribute + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest} request RemoveCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#replaceCatalogAttribute}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef ReplaceCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls ReplaceCatalogAttribute. + * @function replaceCatalogAttribute + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest} request ReplaceCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.replaceCatalogAttribute = function replaceCatalogAttribute(request, callback) { + return this.rpcCall(replaceCatalogAttribute, $root.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest, $root.google.cloud.retail.v2beta.AttributesConfig, request, callback); + }, "name", { value: "ReplaceCatalogAttribute" }); + + /** + * Calls ReplaceCatalogAttribute. + * @function replaceCatalogAttribute + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest} request ReplaceCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2beta.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest instance + */ + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); + }; + + /** + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + */ + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {google.cloud.retail.v2beta.ListCatalogsRequest} message ListCatalogsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListCatalogsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsRequest; + })(); + + v2beta.ListCatalogsResponse = (function() { + + /** + * Properties of a ListCatalogsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + */ + + /** + * Constructs a new ListCatalogsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + */ + function ListCatalogsResponse(properties) { + this.catalogs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + + /** + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + */ + ListCatalogsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListCatalogsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse instance + */ + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); + }; + + /** + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2beta.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCatalogsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCatalogsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalogs[i]); + if (error) + return "catalogs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse + */ + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalogs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {google.cloud.retail.v2beta.ListCatalogsResponse} message ListCatalogsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCatalogsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalogs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListCatalogsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCatalogsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListCatalogsResponse; + })(); + + v2beta.UpdateCatalogRequest = (function() { + + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2beta.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ + + /** + * Constructs a new UpdateCatalogRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + */ + function UpdateCatalogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2beta.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.catalog = null; + + /** + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + */ + UpdateCatalogRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCatalogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest instance + */ + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); + }; + + /** + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2beta.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCatalogRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCatalogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + */ + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateCatalogRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCatalogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = null; + object.updateMask = null; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCatalogRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCatalogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCatalogRequest; + })(); + + v2beta.SetDefaultBranchRequest = (function() { + + /** + * Properties of a SetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note + * @property {boolean|null} [force] SetDefaultBranchRequest force + */ + + /** + * Constructs a new SetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest + * @constructor + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest=} [properties] Properties to set + */ + function SetDefaultBranchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.catalog = ""; + + /** + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.branchId = ""; + + /** + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.note = ""; + + /** + * SetDefaultBranchRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.force = false; + + /** + * Creates a new SetDefaultBranchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest instance + */ + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); + }; + + /** + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultBranchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); + return writer; + }; + + /** + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultBranchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetDefaultBranchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + case 2: + message.branchId = reader.string(); + break; + case 3: + message.note = reader.string(); + break; + case 4: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultBranchRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultBranchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + */ + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetDefaultBranchRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.SetDefaultBranchRequest} message SetDefaultBranchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultBranchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalog = ""; + object.branchId = ""; + object.note = ""; + object.force = false; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this SetDefaultBranchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @instance + * @returns {Object.} JSON object + */ + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultBranchRequest; + })(); + + v2beta.GetDefaultBranchRequest = (function() { + + /** + * Properties of a GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog + */ + + /** + * Constructs a new GetDefaultBranchRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest=} [properties] Properties to set + */ + function GetDefaultBranchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @instance + */ + GetDefaultBranchRequest.prototype.catalog = ""; + + /** + * Creates a new GetDefaultBranchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest instance + */ + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); + }; + + /** + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + return writer; + }; + + /** + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetDefaultBranchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDefaultBranchRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDefaultBranchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + return null; + }; + + /** + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + */ + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetDefaultBranchRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + return message; + }; + + /** + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {google.cloud.retail.v2beta.GetDefaultBranchRequest} message GetDefaultBranchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDefaultBranchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + return object; + }; + + /** + * Converts this GetDefaultBranchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @instance + * @returns {Object.} JSON object + */ + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDefaultBranchRequest; + })(); + + v2beta.GetDefaultBranchResponse = (function() { + + /** + * Properties of a GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2beta + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note + */ + + /** + * Constructs a new GetDefaultBranchResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse + * @constructor + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse=} [properties] Properties to set + */ + function GetDefaultBranchResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.branch = ""; + + /** + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.setTime = null; + + /** + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.note = ""; + + /** + * Creates a new GetDefaultBranchResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse instance + */ + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); + }; + + /** + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + return writer; + }; + + /** + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetDefaultBranchResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.branch = reader.string(); + break; + case 2: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.note = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDefaultBranchResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDefaultBranchResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; + return null; + }; + + /** + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + */ + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetDefaultBranchResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.note != null) + message.note = String(object.note); + return message; + }; + + /** + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {google.cloud.retail.v2beta.GetDefaultBranchResponse} message GetDefaultBranchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDefaultBranchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.branch = ""; + object.setTime = null; + object.note = ""; + } + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; + return object; + }; + + /** + * Converts this GetDefaultBranchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @instance + * @returns {Object.} JSON object + */ + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetDefaultBranchResponse; + })(); + + v2beta.GetCompletionConfigRequest = (function() { + + /** + * Properties of a GetCompletionConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetCompletionConfigRequest + * @property {string|null} [name] GetCompletionConfigRequest name + */ + + /** + * Constructs a new GetCompletionConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetCompletionConfigRequest. + * @implements IGetCompletionConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetCompletionConfigRequest=} [properties] Properties to set + */ + function GetCompletionConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetCompletionConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @instance + */ + GetCompletionConfigRequest.prototype.name = ""; + + /** + * Creates a new GetCompletionConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetCompletionConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetCompletionConfigRequest} GetCompletionConfigRequest instance + */ + GetCompletionConfigRequest.create = function create(properties) { + return new GetCompletionConfigRequest(properties); + }; + + /** + * Encodes the specified GetCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetCompletionConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetCompletionConfigRequest} message GetCompletionConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCompletionConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetCompletionConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetCompletionConfigRequest} message GetCompletionConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCompletionConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetCompletionConfigRequest} GetCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCompletionConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetCompletionConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetCompletionConfigRequest} GetCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCompletionConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetCompletionConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetCompletionConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetCompletionConfigRequest} GetCompletionConfigRequest + */ + GetCompletionConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetCompletionConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetCompletionConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetCompletionConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.GetCompletionConfigRequest} message GetCompletionConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetCompletionConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetCompletionConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetCompletionConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetCompletionConfigRequest; + })(); + + v2beta.UpdateCompletionConfigRequest = (function() { + + /** + * Properties of an UpdateCompletionConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateCompletionConfigRequest + * @property {google.cloud.retail.v2beta.ICompletionConfig|null} [completionConfig] UpdateCompletionConfigRequest completionConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCompletionConfigRequest updateMask + */ + + /** + * Constructs a new UpdateCompletionConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateCompletionConfigRequest. + * @implements IUpdateCompletionConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateCompletionConfigRequest=} [properties] Properties to set + */ + function UpdateCompletionConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCompletionConfigRequest completionConfig. + * @member {google.cloud.retail.v2beta.ICompletionConfig|null|undefined} completionConfig + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @instance + */ + UpdateCompletionConfigRequest.prototype.completionConfig = null; + + /** + * UpdateCompletionConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @instance + */ + UpdateCompletionConfigRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCompletionConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCompletionConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest instance + */ + UpdateCompletionConfigRequest.create = function create(properties) { + return new UpdateCompletionConfigRequest(properties); + }; + + /** + * Encodes the specified UpdateCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCompletionConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCompletionConfigRequest} message UpdateCompletionConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCompletionConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completionConfig != null && Object.hasOwnProperty.call(message, "completionConfig")) + $root.google.cloud.retail.v2beta.CompletionConfig.encode(message.completionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCompletionConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateCompletionConfigRequest} message UpdateCompletionConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCompletionConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCompletionConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateCompletionConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionConfig = $root.google.cloud.retail.v2beta.CompletionConfig.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCompletionConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCompletionConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCompletionConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionConfig != null && message.hasOwnProperty("completionConfig")) { + var error = $root.google.cloud.retail.v2beta.CompletionConfig.verify(message.completionConfig); + if (error) + return "completionConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest + */ + UpdateCompletionConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateCompletionConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateCompletionConfigRequest(); + if (object.completionConfig != null) { + if (typeof object.completionConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCompletionConfigRequest.completionConfig: object expected"); + message.completionConfig = $root.google.cloud.retail.v2beta.CompletionConfig.fromObject(object.completionConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateCompletionConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCompletionConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateCompletionConfigRequest} message UpdateCompletionConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCompletionConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.completionConfig = null; + object.updateMask = null; + } + if (message.completionConfig != null && message.hasOwnProperty("completionConfig")) + object.completionConfig = $root.google.cloud.retail.v2beta.CompletionConfig.toObject(message.completionConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCompletionConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCompletionConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateCompletionConfigRequest; + })(); + + v2beta.GetAttributesConfigRequest = (function() { + + /** + * Properties of a GetAttributesConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetAttributesConfigRequest + * @property {string|null} [name] GetAttributesConfigRequest name + */ + + /** + * Constructs a new GetAttributesConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetAttributesConfigRequest. + * @implements IGetAttributesConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetAttributesConfigRequest=} [properties] Properties to set + */ + function GetAttributesConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetAttributesConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @instance + */ + GetAttributesConfigRequest.prototype.name = ""; + + /** + * Creates a new GetAttributesConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetAttributesConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetAttributesConfigRequest} GetAttributesConfigRequest instance + */ + GetAttributesConfigRequest.create = function create(properties) { + return new GetAttributesConfigRequest(properties); + }; + + /** + * Encodes the specified GetAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetAttributesConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetAttributesConfigRequest} message GetAttributesConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAttributesConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetAttributesConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetAttributesConfigRequest} message GetAttributesConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAttributesConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetAttributesConfigRequest} GetAttributesConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAttributesConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetAttributesConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetAttributesConfigRequest} GetAttributesConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAttributesConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAttributesConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAttributesConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetAttributesConfigRequest} GetAttributesConfigRequest + */ + GetAttributesConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetAttributesConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetAttributesConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetAttributesConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.GetAttributesConfigRequest} message GetAttributesConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAttributesConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetAttributesConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetAttributesConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetAttributesConfigRequest; + })(); + + v2beta.UpdateAttributesConfigRequest = (function() { + + /** + * Properties of an UpdateAttributesConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateAttributesConfigRequest + * @property {google.cloud.retail.v2beta.IAttributesConfig|null} [attributesConfig] UpdateAttributesConfigRequest attributesConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAttributesConfigRequest updateMask + */ + + /** + * Constructs a new UpdateAttributesConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateAttributesConfigRequest. + * @implements IUpdateAttributesConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateAttributesConfigRequest=} [properties] Properties to set + */ + function UpdateAttributesConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateAttributesConfigRequest attributesConfig. + * @member {google.cloud.retail.v2beta.IAttributesConfig|null|undefined} attributesConfig + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @instance + */ + UpdateAttributesConfigRequest.prototype.attributesConfig = null; + + /** + * UpdateAttributesConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @instance + */ + UpdateAttributesConfigRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateAttributesConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateAttributesConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest instance + */ + UpdateAttributesConfigRequest.create = function create(properties) { + return new UpdateAttributesConfigRequest(properties); + }; + + /** + * Encodes the specified UpdateAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateAttributesConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateAttributesConfigRequest} message UpdateAttributesConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAttributesConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + $root.google.cloud.retail.v2beta.AttributesConfig.encode(message.attributesConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateAttributesConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateAttributesConfigRequest} message UpdateAttributesConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAttributesConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAttributesConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateAttributesConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributesConfig = $root.google.cloud.retail.v2beta.AttributesConfig.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAttributesConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateAttributesConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateAttributesConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) { + var error = $root.google.cloud.retail.v2beta.AttributesConfig.verify(message.attributesConfig); + if (error) + return "attributesConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest + */ + UpdateAttributesConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateAttributesConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateAttributesConfigRequest(); + if (object.attributesConfig != null) { + if (typeof object.attributesConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateAttributesConfigRequest.attributesConfig: object expected"); + message.attributesConfig = $root.google.cloud.retail.v2beta.AttributesConfig.fromObject(object.attributesConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateAttributesConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateAttributesConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateAttributesConfigRequest} message UpdateAttributesConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateAttributesConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = null; + object.updateMask = null; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = $root.google.cloud.retail.v2beta.AttributesConfig.toObject(message.attributesConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateAttributesConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateAttributesConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateAttributesConfigRequest; + })(); + + v2beta.AddCatalogAttributeRequest = (function() { + + /** + * Properties of an AddCatalogAttributeRequest. + * @memberof google.cloud.retail.v2beta + * @interface IAddCatalogAttributeRequest + * @property {string|null} [attributesConfig] AddCatalogAttributeRequest attributesConfig + * @property {google.cloud.retail.v2beta.ICatalogAttribute|null} [catalogAttribute] AddCatalogAttributeRequest catalogAttribute + */ + + /** + * Constructs a new AddCatalogAttributeRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an AddCatalogAttributeRequest. + * @implements IAddCatalogAttributeRequest + * @constructor + * @param {google.cloud.retail.v2beta.IAddCatalogAttributeRequest=} [properties] Properties to set + */ + function AddCatalogAttributeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @instance + */ + AddCatalogAttributeRequest.prototype.attributesConfig = ""; + + /** + * AddCatalogAttributeRequest catalogAttribute. + * @member {google.cloud.retail.v2beta.ICatalogAttribute|null|undefined} catalogAttribute + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @instance + */ + AddCatalogAttributeRequest.prototype.catalogAttribute = null; + + /** + * Creates a new AddCatalogAttributeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IAddCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddCatalogAttributeRequest} AddCatalogAttributeRequest instance + */ + AddCatalogAttributeRequest.create = function create(properties) { + return new AddCatalogAttributeRequest(properties); + }; + + /** + * Encodes the specified AddCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddCatalogAttributeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IAddCatalogAttributeRequest} message AddCatalogAttributeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddCatalogAttributeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.catalogAttribute != null && Object.hasOwnProperty.call(message, "catalogAttribute")) + $root.google.cloud.retail.v2beta.CatalogAttribute.encode(message.catalogAttribute, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AddCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddCatalogAttributeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IAddCatalogAttributeRequest} message AddCatalogAttributeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.AddCatalogAttributeRequest} AddCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddCatalogAttributeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddCatalogAttributeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributesConfig = reader.string(); + break; + case 2: + message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.AddCatalogAttributeRequest} AddCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddCatalogAttributeRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddCatalogAttributeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) { + var error = $root.google.cloud.retail.v2beta.CatalogAttribute.verify(message.catalogAttribute); + if (error) + return "catalogAttribute." + error; + } + return null; + }; + + /** + * Creates an AddCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.AddCatalogAttributeRequest} AddCatalogAttributeRequest + */ + AddCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddCatalogAttributeRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.AddCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.catalogAttribute != null) { + if (typeof object.catalogAttribute !== "object") + throw TypeError(".google.cloud.retail.v2beta.AddCatalogAttributeRequest.catalogAttribute: object expected"); + message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.fromObject(object.catalogAttribute); + } + return message; + }; + + /** + * Creates a plain object from an AddCatalogAttributeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.AddCatalogAttributeRequest} message AddCatalogAttributeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddCatalogAttributeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = ""; + object.catalogAttribute = null; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) + object.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.toObject(message.catalogAttribute, options); + return object; + }; + + /** + * Converts this AddCatalogAttributeRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @instance + * @returns {Object.} JSON object + */ + AddCatalogAttributeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AddCatalogAttributeRequest; + })(); + + v2beta.RemoveCatalogAttributeRequest = (function() { + + /** + * Properties of a RemoveCatalogAttributeRequest. + * @memberof google.cloud.retail.v2beta + * @interface IRemoveCatalogAttributeRequest + * @property {string|null} [attributesConfig] RemoveCatalogAttributeRequest attributesConfig + * @property {string|null} [key] RemoveCatalogAttributeRequest key + */ + + /** + * Constructs a new RemoveCatalogAttributeRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RemoveCatalogAttributeRequest. + * @implements IRemoveCatalogAttributeRequest + * @constructor + * @param {google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest=} [properties] Properties to set + */ + function RemoveCatalogAttributeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @instance + */ + RemoveCatalogAttributeRequest.prototype.attributesConfig = ""; + + /** + * RemoveCatalogAttributeRequest key. + * @member {string} key + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @instance + */ + RemoveCatalogAttributeRequest.prototype.key = ""; + + /** + * Creates a new RemoveCatalogAttributeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest instance + */ + RemoveCatalogAttributeRequest.create = function create(properties) { + return new RemoveCatalogAttributeRequest(properties); + }; + + /** + * Encodes the specified RemoveCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveCatalogAttributeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveCatalogAttributeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); + return writer; + }; + + /** + * Encodes the specified RemoveCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveCatalogAttributeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveCatalogAttributeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributesConfig = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveCatalogAttributeRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveCatalogAttributeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + return null; + }; + + /** + * Creates a RemoveCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest + */ + RemoveCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.key != null) + message.key = String(object.key); + return message; + }; + + /** + * Creates a plain object from a RemoveCatalogAttributeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.RemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveCatalogAttributeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = ""; + object.key = ""; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + return object; + }; + + /** + * Converts this RemoveCatalogAttributeRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveCatalogAttributeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveCatalogAttributeRequest; + })(); + + v2beta.ReplaceCatalogAttributeRequest = (function() { + + /** + * Properties of a ReplaceCatalogAttributeRequest. + * @memberof google.cloud.retail.v2beta + * @interface IReplaceCatalogAttributeRequest + * @property {string|null} [attributesConfig] ReplaceCatalogAttributeRequest attributesConfig + * @property {google.cloud.retail.v2beta.ICatalogAttribute|null} [catalogAttribute] ReplaceCatalogAttributeRequest catalogAttribute + * @property {google.protobuf.IFieldMask|null} [updateMask] ReplaceCatalogAttributeRequest updateMask + */ + + /** + * Constructs a new ReplaceCatalogAttributeRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ReplaceCatalogAttributeRequest. + * @implements IReplaceCatalogAttributeRequest + * @constructor + * @param {google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest=} [properties] Properties to set + */ + function ReplaceCatalogAttributeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplaceCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.attributesConfig = ""; + + /** + * ReplaceCatalogAttributeRequest catalogAttribute. + * @member {google.cloud.retail.v2beta.ICatalogAttribute|null|undefined} catalogAttribute + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.catalogAttribute = null; + + /** + * ReplaceCatalogAttributeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.updateMask = null; + + /** + * Creates a new ReplaceCatalogAttributeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest instance + */ + ReplaceCatalogAttributeRequest.create = function create(properties) { + return new ReplaceCatalogAttributeRequest(properties); + }; + + /** + * Encodes the specified ReplaceCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplaceCatalogAttributeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.catalogAttribute != null && Object.hasOwnProperty.call(message, "catalogAttribute")) + $root.google.cloud.retail.v2beta.CatalogAttribute.encode(message.catalogAttribute, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReplaceCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplaceCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplaceCatalogAttributeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attributesConfig = reader.string(); + break; + case 2: + message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); + break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplaceCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplaceCatalogAttributeRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplaceCatalogAttributeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) { + var error = $root.google.cloud.retail.v2beta.CatalogAttribute.verify(message.catalogAttribute); + if (error) + return "catalogAttribute." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates a ReplaceCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest + */ + ReplaceCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.catalogAttribute != null) { + if (typeof object.catalogAttribute !== "object") + throw TypeError(".google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest.catalogAttribute: object expected"); + message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.fromObject(object.catalogAttribute); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a ReplaceCatalogAttributeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplaceCatalogAttributeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = ""; + object.catalogAttribute = null; + object.updateMask = null; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) + object.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.toObject(message.catalogAttribute, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this ReplaceCatalogAttributeRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @instance + * @returns {Object.} JSON object + */ + ReplaceCatalogAttributeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReplaceCatalogAttributeRequest; + })(); + + v2beta.CompletionService = (function() { + + /** + * Constructs a new CompletionService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + + /** + * Creates new CompletionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.CompletionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. + */ + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2beta.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.CompleteQueryResponse} [response] CompleteQueryResponse + */ + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2beta.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2beta.CompleteQueryRequest, $root.google.cloud.retail.v2beta.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + + /** + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2beta.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2beta.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2beta.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2beta.CompletionService + * @instance + * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; + })(); + + v2beta.CompleteQueryRequest = (function() { + + /** + * Properties of a CompleteQueryRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + */ + + /** + * Constructs a new CompleteQueryRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest=} [properties] Properties to set + */ + function CompleteQueryRequest(properties) { + this.languageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.catalog = ""; + + /** + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.query = ""; + + /** + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.visitorId = ""; + + /** + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + + /** + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.deviceType = ""; + + /** + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.dataset = ""; + + /** + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.maxSuggestions = 0; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest instance + */ + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); + }; + + /** + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + return writer; + }; + + /** + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalog = reader.string(); + break; + case 2: + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); + break; + case 3: + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + case 4: + message.deviceType = reader.string(); + break; + case 6: + message.dataset = reader.string(); + break; + case 5: + message.maxSuggestions = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompleteQueryRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompleteQueryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; + return null; + }; + + /** + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + */ + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; + return message; + }; + + /** + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryRequest} message CompleteQueryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompleteQueryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (options.defaults) { + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + return object; + }; + + /** + * Converts this CompleteQueryRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @instance + * @returns {Object.} JSON object + */ + CompleteQueryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompleteQueryRequest; + })(); + + v2beta.CompleteQueryResponse = (function() { + + /** + * Properties of a CompleteQueryResponse. + * @memberof google.cloud.retail.v2beta + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + */ + + /** + * Constructs a new CompleteQueryResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse + * @constructor + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse=} [properties] Properties to set + */ + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; + + /** + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.attributionToken = ""; + + /** + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + + /** + * Creates a new CompleteQueryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse instance + */ + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); + }; + + /** + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompleteQueryResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompleteQueryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } + } + return null; + }; + + /** + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + */ + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse} message CompleteQueryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompleteQueryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + } + return object; + }; + + /** + * Converts this CompleteQueryResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @instance + * @returns {Object.} JSON object + */ + CompleteQueryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + CompleteQueryResponse.CompletionResult = (function() { + + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ + + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; + + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.suggestion = reader.string(); + break; + case 2: + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompletionResult; + })(); + + CompleteQueryResponse.RecentSearchResult = (function() { + + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ + + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; + })(); + + v2beta.Control = (function() { + + /** + * Properties of a Control. + * @memberof google.cloud.retail.v2beta + * @interface IControl + * @property {google.cloud.retail.v2beta.SearchRequest.IFacetSpec|null} [facetSpec] Control facetSpec + * @property {google.cloud.retail.v2beta.IRule|null} [rule] Control rule + * @property {string|null} [name] Control name + * @property {string|null} [displayName] Control displayName + * @property {Array.|null} [associatedServingConfigIds] Control associatedServingConfigIds + * @property {Array.|null} [solutionTypes] Control solutionTypes + */ + + /** + * Constructs a new Control. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Control. + * @implements IControl + * @constructor + * @param {google.cloud.retail.v2beta.IControl=} [properties] Properties to set + */ + function Control(properties) { + this.associatedServingConfigIds = []; + this.solutionTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Control facetSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IFacetSpec|null|undefined} facetSpec + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.facetSpec = null; + + /** + * Control rule. + * @member {google.cloud.retail.v2beta.IRule|null|undefined} rule + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.rule = null; + + /** + * Control name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.name = ""; + + /** + * Control displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.displayName = ""; + + /** + * Control associatedServingConfigIds. + * @member {Array.} associatedServingConfigIds + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.associatedServingConfigIds = $util.emptyArray; + + /** + * Control solutionTypes. + * @member {Array.} solutionTypes + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.solutionTypes = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Control control. + * @member {"facetSpec"|"rule"|undefined} control + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Object.defineProperty(Control.prototype, "control", { + get: $util.oneOfGetter($oneOfFields = ["facetSpec", "rule"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Control instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {google.cloud.retail.v2beta.IControl=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Control} Control instance + */ + Control.create = function create(properties) { + return new Control(properties); + }; + + /** + * Encodes the specified Control message. Does not implicitly {@link google.cloud.retail.v2beta.Control.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {google.cloud.retail.v2beta.IControl} message Control message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Control.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.facetSpec != null && Object.hasOwnProperty.call(message, "facetSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.encode(message.facetSpec, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rule != null && Object.hasOwnProperty.call(message, "rule")) + $root.google.cloud.retail.v2beta.Rule.encode(message.rule, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.associatedServingConfigIds != null && message.associatedServingConfigIds.length) + for (var i = 0; i < message.associatedServingConfigIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.associatedServingConfigIds[i]); + if (message.solutionTypes != null && message.solutionTypes.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.solutionTypes.length; ++i) + writer.int32(message.solutionTypes[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Control message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Control.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {google.cloud.retail.v2beta.IControl} message Control message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Control.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Control message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Control} Control + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Control.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Control(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.facetSpec = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32()); + break; + case 4: + message.rule = $root.google.cloud.retail.v2beta.Rule.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 5: + if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) + message.associatedServingConfigIds = []; + message.associatedServingConfigIds.push(reader.string()); + break; + case 6: + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else + message.solutionTypes.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Control message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Control} Control + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Control.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Control message. + * @function verify + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Control.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.facetSpec != null && message.hasOwnProperty("facetSpec")) { + properties.control = 1; + { + var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify(message.facetSpec); + if (error) + return "facetSpec." + error; + } + } + if (message.rule != null && message.hasOwnProperty("rule")) { + if (properties.control === 1) + return "control: multiple values"; + properties.control = 1; + { + var error = $root.google.cloud.retail.v2beta.Rule.verify(message.rule); + if (error) + return "rule." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.associatedServingConfigIds != null && message.hasOwnProperty("associatedServingConfigIds")) { + if (!Array.isArray(message.associatedServingConfigIds)) + return "associatedServingConfigIds: array expected"; + for (var i = 0; i < message.associatedServingConfigIds.length; ++i) + if (!$util.isString(message.associatedServingConfigIds[i])) + return "associatedServingConfigIds: string[] expected"; + } + if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { + if (!Array.isArray(message.solutionTypes)) + return "solutionTypes: array expected"; + for (var i = 0; i < message.solutionTypes.length; ++i) + switch (message.solutionTypes[i]) { + default: + return "solutionTypes: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a Control message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Control} Control + */ + Control.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Control) + return object; + var message = new $root.google.cloud.retail.v2beta.Control(); + if (object.facetSpec != null) { + if (typeof object.facetSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.Control.facetSpec: object expected"); + message.facetSpec = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.fromObject(object.facetSpec); + } + if (object.rule != null) { + if (typeof object.rule !== "object") + throw TypeError(".google.cloud.retail.v2beta.Control.rule: object expected"); + message.rule = $root.google.cloud.retail.v2beta.Rule.fromObject(object.rule); + } + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.associatedServingConfigIds) { + if (!Array.isArray(object.associatedServingConfigIds)) + throw TypeError(".google.cloud.retail.v2beta.Control.associatedServingConfigIds: array expected"); + message.associatedServingConfigIds = []; + for (var i = 0; i < object.associatedServingConfigIds.length; ++i) + message.associatedServingConfigIds[i] = String(object.associatedServingConfigIds[i]); + } + if (object.solutionTypes) { + if (!Array.isArray(object.solutionTypes)) + throw TypeError(".google.cloud.retail.v2beta.Control.solutionTypes: array expected"); + message.solutionTypes = []; + for (var i = 0; i < object.solutionTypes.length; ++i) + switch (object.solutionTypes[i]) { + default: + case "SOLUTION_TYPE_UNSPECIFIED": + case 0: + message.solutionTypes[i] = 0; + break; + case "SOLUTION_TYPE_RECOMMENDATION": + case 1: + message.solutionTypes[i] = 1; + break; + case "SOLUTION_TYPE_SEARCH": + case 2: + message.solutionTypes[i] = 2; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a Control message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {google.cloud.retail.v2beta.Control} message Control + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Control.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.associatedServingConfigIds = []; + object.solutionTypes = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.facetSpec != null && message.hasOwnProperty("facetSpec")) { + object.facetSpec = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.toObject(message.facetSpec, options); + if (options.oneofs) + object.control = "facetSpec"; + } + if (message.rule != null && message.hasOwnProperty("rule")) { + object.rule = $root.google.cloud.retail.v2beta.Rule.toObject(message.rule, options); + if (options.oneofs) + object.control = "rule"; + } + if (message.associatedServingConfigIds && message.associatedServingConfigIds.length) { + object.associatedServingConfigIds = []; + for (var j = 0; j < message.associatedServingConfigIds.length; ++j) + object.associatedServingConfigIds[j] = message.associatedServingConfigIds[j]; + } + if (message.solutionTypes && message.solutionTypes.length) { + object.solutionTypes = []; + for (var j = 0; j < message.solutionTypes.length; ++j) + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + } + return object; + }; + + /** + * Converts this Control to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Control + * @instance + * @returns {Object.} JSON object + */ + Control.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Control; + })(); + + v2beta.SearchService = (function() { + + /** + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; + + /** + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. + * @memberof google.cloud.retail.v2beta.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.SearchResponse} [response] SearchResponse + */ + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2beta.SearchService + * @instance + * @param {google.cloud.retail.v2beta.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2beta.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2beta.SearchRequest, $root.google.cloud.retail.v2beta.SearchResponse, request, callback); + }, "name", { value: "Search" }); + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2beta.SearchService + * @instance + * @param {google.cloud.retail.v2beta.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SearchService; + })(); + + v2beta.SearchRequest = (function() { + + /** + * Properties of a SearchRequest. + * @memberof google.cloud.retail.v2beta + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2beta.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + * @property {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec + */ + + /** + * Constructs a new SearchRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest + * @constructor + * @param {google.cloud.retail.v2beta.ISearchRequest=} [properties] Properties to set + */ + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.placement = ""; + + /** + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.branch = ""; + + /** + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.query = ""; + + /** + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.visitorId = ""; + + /** + * SearchRequest userInfo. + * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.userInfo = null; + + /** + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.pageSize = 0; + + /** + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.pageToken = ""; + + /** + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.offset = 0; + + /** + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.filter = ""; + + /** + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.canonicalFilter = ""; + + /** + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.orderBy = ""; + + /** + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.facetSpecs = $util.emptyArray; + + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; + + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; + + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; + + /** + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + + /** + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2beta.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + + /** + * SearchRequest personalizationSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.personalizationSpec = null; + + /** + * Creates a new SearchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest instance + */ + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); + }; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); + if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.branch = reader.string(); + break; + case 3: + message.query = reader.string(); + break; + case 4: + message.visitorId = reader.string(); + break; + case 5: + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); + break; + case 10: + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 31: + message.searchMode = reader.int32(); + break; + case 32: + message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (error) + return "facetSpecs." + error; + } + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); + if (error) + return "personalizationSpec." + error; + } + return null; + }; + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + */ + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } + if (object.personalizationSpec != null) { + if (typeof object.personalizationSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.personalizationSpec: object expected"); + message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); + } + return message; + }; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {google.cloud.retail.v2beta.SearchRequest} message SearchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; + } + if (options.defaults) { + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; + object.personalizationSpec = null; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) + object.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + return object; + }; + + /** + * Converts this SearchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + * @returns {Object.} JSON object + */ + SearchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchRequest.FacetSpec = (function() { + + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ + + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; + + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; + + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + case 2: + message.limit = reader.int32(); + break; + case 3: + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + case 4: + message.enableDynamicPosition = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); + if (error) + return "facetKey." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); + } + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; + } + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; + return object; + }; + + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + FacetSpec.FacetKey = (function() { + + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ + + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; + + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; + + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; + + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; + + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; + + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; + + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; + + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2beta.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + return writer; + }; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + return null; + }; + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2beta.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + return message; + }; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2beta.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + return object; + }; + + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetKey; + })(); + + return FacetSpec; + })(); + + SearchRequest.DynamicFacetSpec = (function() { + + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ + + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); + + return DynamicFacetSpec; + })(); + + SearchRequest.BoostSpec = (function() { + + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + * @property {boolean|null} [skipBoostSpecValidation] BoostSpec skipBoostSpecValidation + */ + + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + + /** + * BoostSpec skipBoostSpecValidation. + * @member {boolean|null|undefined} skipBoostSpecValidation + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.skipBoostSpecValidation = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BoostSpec _skipBoostSpecValidation. + * @member {"skipBoostSpecValidation"|undefined} _skipBoostSpecValidation + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @instance + */ + Object.defineProperty(BoostSpec.prototype, "_skipBoostSpecValidation", { + get: $util.oneOfGetter($oneOfFields = ["skipBoostSpecValidation"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.skipBoostSpecValidation != null && Object.hasOwnProperty.call(message, "skipBoostSpecValidation")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.skipBoostSpecValidation); + return writer; + }; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + case 2: + message.skipBoostSpecValidation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + properties._skipBoostSpecValidation = 1; + if (typeof message.skipBoostSpecValidation !== "boolean") + return "skipBoostSpecValidation: boolean expected"; + } + return null; + }; + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + if (object.skipBoostSpecValidation != null) + message.skipBoostSpecValidation = Boolean(object.skipBoostSpecValidation); + return message; + }; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + object.skipBoostSpecValidation = message.skipBoostSpecValidation; + if (options.oneofs) + object._skipBoostSpecValidation = "skipBoostSpecValidation"; + } + return object; + }; + + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BoostSpec.ConditionBoostSpec = (function() { + + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ + + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; + + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConditionBoostSpec; + })(); + + return BoostSpec; + })(); + + SearchRequest.QueryExpansionSpec = (function() { + + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults + */ + + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; + + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); + return writer; + }; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.int32(); + break; + case 2: + message.pinUnexpandedResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; + } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; + return object; + }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Condition enum. + * @name google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; + })(); + + SearchRequest.PersonalizationSpec = (function() { + + /** + * Properties of a PersonalizationSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface IPersonalizationSpec + * @property {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode|null} [mode] PersonalizationSpec mode + */ + + /** + * Constructs a new PersonalizationSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a PersonalizationSpec. + * @implements IPersonalizationSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + */ + function PersonalizationSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PersonalizationSpec mode. + * @member {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode} mode + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @instance + */ + PersonalizationSpec.prototype.mode = 0; + + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} PersonalizationSpec instance + */ + PersonalizationSpec.create = function create(properties) { + return new PersonalizationSpec(properties); + }; + + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PersonalizationSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersonalizationSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} PersonalizationSpec + */ + PersonalizationSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "AUTO": + case 1: + message.mode = 1; + break; + case "DISABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} message PersonalizationSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersonalizationSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this PersonalizationSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @instance + * @returns {Object.} JSON object + */ + PersonalizationSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} AUTO=1 AUTO value + * @property {number} DISABLED=2 DISABLED value + */ + PersonalizationSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); - /** - * Type enum. - * @name google.cloud.retail.v2beta.Product.Type - * @enum {number} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} VARIANT=2 VARIANT value - * @property {number} COLLECTION=3 COLLECTION value - */ - Product.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "VARIANT"] = 2; - values[valuesById[3] = "COLLECTION"] = 3; - return values; + return PersonalizationSpec; })(); /** - * Availability enum. - * @name google.cloud.retail.v2beta.Product.Availability + * SearchMode enum. + * @name google.cloud.retail.v2beta.SearchRequest.SearchMode * @enum {number} - * @property {number} AVAILABILITY_UNSPECIFIED=0 AVAILABILITY_UNSPECIFIED value - * @property {number} IN_STOCK=1 IN_STOCK value - * @property {number} OUT_OF_STOCK=2 OUT_OF_STOCK value - * @property {number} PREORDER=3 PREORDER value - * @property {number} BACKORDER=4 BACKORDER value + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value */ - Product.Availability = (function() { + SearchRequest.SearchMode = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AVAILABILITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "IN_STOCK"] = 1; - values[valuesById[2] = "OUT_OF_STOCK"] = 2; - values[valuesById[3] = "PREORDER"] = 3; - values[valuesById[4] = "BACKORDER"] = 4; + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; return values; })(); - return Product; + return SearchRequest; })(); - v2beta.UserEvent = (function() { + v2beta.SearchResponse = (function() { /** - * Properties of a UserEvent. + * Properties of a SearchResponse. * @memberof google.cloud.retail.v2beta - * @interface IUserEvent - * @property {string|null} [eventType] UserEvent eventType - * @property {string|null} [visitorId] UserEvent visitorId - * @property {string|null} [sessionId] UserEvent sessionId - * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime - * @property {Array.|null} [experimentIds] UserEvent experimentIds - * @property {string|null} [attributionToken] UserEvent attributionToken - * @property {Array.|null} [productDetails] UserEvent productDetails - * @property {google.cloud.retail.v2beta.ICompletionDetail|null} [completionDetail] UserEvent completionDetail - * @property {Object.|null} [attributes] UserEvent attributes - * @property {string|null} [cartId] UserEvent cartId - * @property {google.cloud.retail.v2beta.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction - * @property {string|null} [searchQuery] UserEvent searchQuery - * @property {string|null} [filter] UserEvent filter - * @property {string|null} [orderBy] UserEvent orderBy - * @property {number|null} [offset] UserEvent offset - * @property {Array.|null} [pageCategories] UserEvent pageCategories - * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] UserEvent userInfo - * @property {string|null} [uri] UserEvent uri - * @property {string|null} [referrerUri] UserEvent referrerUri - * @property {string|null} [pageViewId] UserEvent pageViewId + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * @property {Array.|null} [invalidConditionBoostSpecs] SearchResponse invalidConditionBoostSpecs */ /** - * Constructs a new UserEvent. + * Constructs a new SearchResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a UserEvent. - * @implements IUserEvent + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse * @constructor - * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ISearchResponse=} [properties] Properties to set */ - function UserEvent(properties) { - this.experimentIds = []; - this.productDetails = []; - this.attributes = {}; - this.pageCategories = []; + function SearchResponse(properties) { + this.results = []; + this.facets = []; + this.appliedControls = []; + this.invalidConditionBoostSpecs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63906,353 +76759,204 @@ } /** - * UserEvent eventType. - * @member {string} eventType - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.eventType = ""; - - /** - * UserEvent visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.visitorId = ""; + SearchResponse.prototype.results = $util.emptyArray; /** - * UserEvent sessionId. - * @member {string} sessionId - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.sessionId = ""; + SearchResponse.prototype.facets = $util.emptyArray; /** - * UserEvent eventTime. - * @member {google.protobuf.ITimestamp|null|undefined} eventTime - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.eventTime = null; + SearchResponse.prototype.totalSize = 0; /** - * UserEvent experimentIds. - * @member {Array.} experimentIds - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.experimentIds = $util.emptyArray; + SearchResponse.prototype.correctedQuery = ""; /** - * UserEvent attributionToken. + * SearchResponse attributionToken. * @member {string} attributionToken - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.attributionToken = ""; - - /** - * UserEvent productDetails. - * @member {Array.} productDetails - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.productDetails = $util.emptyArray; - - /** - * UserEvent completionDetail. - * @member {google.cloud.retail.v2beta.ICompletionDetail|null|undefined} completionDetail - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.completionDetail = null; - - /** - * UserEvent attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.attributes = $util.emptyObject; - - /** - * UserEvent cartId. - * @member {string} cartId - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.cartId = ""; - - /** - * UserEvent purchaseTransaction. - * @member {google.cloud.retail.v2beta.IPurchaseTransaction|null|undefined} purchaseTransaction - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.purchaseTransaction = null; - - /** - * UserEvent searchQuery. - * @member {string} searchQuery - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.searchQuery = ""; - - /** - * UserEvent filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.filter = ""; - - /** - * UserEvent orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - */ - UserEvent.prototype.orderBy = ""; - - /** - * UserEvent offset. - * @member {number} offset - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.offset = 0; + SearchResponse.prototype.attributionToken = ""; /** - * UserEvent pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.pageCategories = $util.emptyArray; + SearchResponse.prototype.nextPageToken = ""; /** - * UserEvent userInfo. - * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.userInfo = null; + SearchResponse.prototype.queryExpansionInfo = null; /** - * UserEvent uri. - * @member {string} uri - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.uri = ""; + SearchResponse.prototype.redirectUri = ""; /** - * UserEvent referrerUri. - * @member {string} referrerUri - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.referrerUri = ""; + SearchResponse.prototype.appliedControls = $util.emptyArray; /** - * UserEvent pageViewId. - * @member {string} pageViewId - * @memberof google.cloud.retail.v2beta.UserEvent + * SearchResponse invalidConditionBoostSpecs. + * @member {Array.} invalidConditionBoostSpecs + * @memberof google.cloud.retail.v2beta.SearchResponse * @instance */ - UserEvent.prototype.pageViewId = ""; + SearchResponse.prototype.invalidConditionBoostSpecs = $util.emptyArray; /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static - * @param {google.cloud.retail.v2beta.IUserEvent=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent instance + * @param {google.cloud.retail.v2beta.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse instance */ - UserEvent.create = function create(properties) { - return new UserEvent(properties); + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); }; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static - * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2beta.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encode = function encode(message, writer) { + SearchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.visitorId); - if (message.eventTime != null && Object.hasOwnProperty.call(message, "eventTime")) - $root.google.protobuf.Timestamp.encode(message.eventTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.experimentIds != null && message.experimentIds.length) - for (var i = 0; i < message.experimentIds.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.experimentIds[i]); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2beta.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.productDetails != null && message.productDetails.length) - for (var i = 0; i < message.productDetails.length; ++i) - $root.google.cloud.retail.v2beta.ProductDetail.encode(message.productDetails[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.cartId != null && Object.hasOwnProperty.call(message, "cartId")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.cartId); - if (message.purchaseTransaction != null && Object.hasOwnProperty.call(message, "purchaseTransaction")) - $root.google.cloud.retail.v2beta.PurchaseTransaction.encode(message.purchaseTransaction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.searchQuery != null && Object.hasOwnProperty.call(message, "searchQuery")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.searchQuery); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.pageCategories[i]); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.uri); - if (message.referrerUri != null && Object.hasOwnProperty.call(message, "referrerUri")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.referrerUri); - if (message.pageViewId != null && Object.hasOwnProperty.call(message, "pageViewId")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.pageViewId); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.orderBy); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 18, wireType 0 =*/144).int32(message.offset); - if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) - writer.uint32(/* id 21, wireType 2 =*/170).string(message.sessionId); - if (message.completionDetail != null && Object.hasOwnProperty.call(message, "completionDetail")) - $root.google.cloud.retail.v2beta.CompletionDetail.encode(message.completionDetail, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + if (message.invalidConditionBoostSpecs != null && message.invalidConditionBoostSpecs.length) + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.invalidConditionBoostSpecs[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UserEvent.verify|verify} messages. + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static - * @param {google.cloud.retail.v2beta.IUserEvent} message UserEvent message or plain object to encode + * @param {google.cloud.retail.v2beta.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEvent.encodeDelimited = function encodeDelimited(message, writer) { + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decode = function decode(reader, length) { + SearchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UserEvent(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.eventType = reader.string(); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.SearchResponse.SearchResult.decode(reader, reader.uint32())); break; case 2: - message.visitorId = reader.string(); - break; - case 21: - message.sessionId = reader.string(); + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.decode(reader, reader.uint32())); break; case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.totalSize = reader.int32(); break; case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); + message.correctedQuery = reader.string(); break; case 5: message.attributionToken = reader.string(); break; case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); - break; - case 22: - message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); + message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); break; case 10: - message.searchQuery = reader.string(); - break; - case 16: - message.filter = reader.string(); - break; - case 17: - message.orderBy = reader.string(); - break; - case 18: - message.offset = reader.int32(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); + message.redirectUri = reader.string(); break; case 12: - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); break; case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -64263,1240 +76967,1572 @@ }; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEvent.decodeDelimited = function decodeDelimited(reader) { + SearchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEvent message. + * Verifies a SearchResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEvent.verify = function verify(message) { + SearchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.eventType != null && message.hasOwnProperty("eventType")) - if (!$util.isString(message.eventType)) - return "eventType: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.sessionId != null && message.hasOwnProperty("sessionId")) - if (!$util.isString(message.sessionId)) - return "sessionId: string expected"; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.eventTime); - if (error) - return "eventTime." + error; - } - if (message.experimentIds != null && message.hasOwnProperty("experimentIds")) { - if (!Array.isArray(message.experimentIds)) - return "experimentIds: array expected"; - for (var i = 0; i < message.experimentIds.length; ++i) - if (!$util.isString(message.experimentIds[i])) - return "experimentIds: string[] expected"; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.productDetails != null && message.hasOwnProperty("productDetails")) { - if (!Array.isArray(message.productDetails)) - return "productDetails: array expected"; - for (var i = 0; i < message.productDetails.length; ++i) { - var error = $root.google.cloud.retail.v2beta.ProductDetail.verify(message.productDetails[i]); + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.verify(message.results[i]); if (error) - return "productDetails." + error; + return "results." + error; } } - if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) { - var error = $root.google.cloud.retail.v2beta.CompletionDetail.verify(message.completionDetail); - if (error) - return "completionDetail." + error; - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.Facet.verify(message.facets[i]); if (error) - return "attributes." + error; + return "facets." + error; } } - if (message.cartId != null && message.hasOwnProperty("cartId")) - if (!$util.isString(message.cartId)) - return "cartId: string expected"; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) { - var error = $root.google.cloud.retail.v2beta.PurchaseTransaction.verify(message.purchaseTransaction); + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); if (error) - return "purchaseTransaction." + error; + return "queryExpansionInfo." + error; } - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - if (!$util.isString(message.searchQuery)) - return "searchQuery: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; + if (message.invalidConditionBoostSpecs != null && message.hasOwnProperty("invalidConditionBoostSpecs")) { + if (!Array.isArray(message.invalidConditionBoostSpecs)) + return "invalidConditionBoostSpecs: array expected"; + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.invalidConditionBoostSpecs[i]); + if (error) + return "invalidConditionBoostSpecs." + error; + } } - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - if (!$util.isString(message.referrerUri)) - return "referrerUri: string expected"; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - if (!$util.isString(message.pageViewId)) - return "pageViewId: string expected"; return null; }; /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UserEvent + * @memberof google.cloud.retail.v2beta.SearchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UserEvent} UserEvent + * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse */ - UserEvent.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UserEvent) + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse) return object; - var message = new $root.google.cloud.retail.v2beta.UserEvent(); - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.sessionId != null) - message.sessionId = String(object.sessionId); - if (object.eventTime != null) { - if (typeof object.eventTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.eventTime: object expected"); - message.eventTime = $root.google.protobuf.Timestamp.fromObject(object.eventTime); + var message = new $root.google.cloud.retail.v2beta.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.fromObject(object.results[i]); + } } - if (object.experimentIds) { - if (!Array.isArray(object.experimentIds)) - throw TypeError(".google.cloud.retail.v2beta.UserEvent.experimentIds: array expected"); - message.experimentIds = []; - for (var i = 0; i < object.experimentIds.length; ++i) - message.experimentIds[i] = String(object.experimentIds[i]); + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.fromObject(object.facets[i]); + } } + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); if (object.attributionToken != null) message.attributionToken = String(object.attributionToken); - if (object.productDetails) { - if (!Array.isArray(object.productDetails)) - throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: array expected"); - message.productDetails = []; - for (var i = 0; i < object.productDetails.length; ++i) { - if (typeof object.productDetails[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.productDetails: object expected"); - message.productDetails[i] = $root.google.cloud.retail.v2beta.ProductDetail.fromObject(object.productDetails[i]); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); + } + if (object.invalidConditionBoostSpecs) { + if (!Array.isArray(object.invalidConditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.invalidConditionBoostSpecs: array expected"); + message.invalidConditionBoostSpecs = []; + for (var i = 0; i < object.invalidConditionBoostSpecs.length; ++i) { + if (typeof object.invalidConditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.invalidConditionBoostSpecs: object expected"); + message.invalidConditionBoostSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.invalidConditionBoostSpecs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {google.cloud.retail.v2beta.SearchResponse} message SearchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + object.appliedControls = []; + object.invalidConditionBoostSpecs = []; + } + if (options.defaults) { + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; + } + if (message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length) { + object.invalidConditionBoostSpecs = []; + for (var j = 0; j < message.invalidConditionBoostSpecs.length; ++j) + object.invalidConditionBoostSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.invalidConditionBoostSpecs[j], options); + } + return object; + }; + + /** + * Converts this SearchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse + * @instance + * @returns {Object.} JSON object + */ + SearchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchResponse.SearchResult = (function() { + + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2beta.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + */ + + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; + + /** + * SearchResult product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; + + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; + + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; + + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; + + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + return null; + }; + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } } - } - if (object.completionDetail != null) { - if (typeof object.completionDetail !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.completionDetail: object expected"); - message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.fromObject(object.completionDetail); - } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); + return message; + }; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; } - } - if (object.cartId != null) - message.cartId = String(object.cartId); - if (object.purchaseTransaction != null) { - if (typeof object.purchaseTransaction !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.purchaseTransaction: object expected"); - message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.fromObject(object.purchaseTransaction); - } - if (object.searchQuery != null) - message.searchQuery = String(object.searchQuery); - if (object.filter != null) - message.filter = String(object.filter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2beta.UserEvent.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.UserEvent.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); - } - if (object.uri != null) - message.uri = String(object.uri); - if (object.referrerUri != null) - message.referrerUri = String(object.referrerUri); - if (object.pageViewId != null) - message.pageViewId = String(object.pageViewId); - return message; - }; + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } + return object; + }; - /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.UserEvent - * @static - * @param {google.cloud.retail.v2beta.UserEvent} message UserEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.experimentIds = []; - object.productDetails = []; - object.pageCategories = []; - } - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) { - object.eventType = ""; - object.visitorId = ""; - object.eventTime = null; - object.attributionToken = ""; - object.cartId = ""; - object.purchaseTransaction = null; - object.searchQuery = ""; - object.userInfo = null; - object.uri = ""; - object.referrerUri = ""; - object.pageViewId = ""; - object.filter = ""; - object.orderBy = ""; - object.offset = 0; - object.sessionId = ""; - object.completionDetail = null; - } - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.eventTime != null && message.hasOwnProperty("eventTime")) - object.eventTime = $root.google.protobuf.Timestamp.toObject(message.eventTime, options); - if (message.experimentIds && message.experimentIds.length) { - object.experimentIds = []; - for (var j = 0; j < message.experimentIds.length; ++j) - object.experimentIds[j] = message.experimentIds[j]; - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.productDetails && message.productDetails.length) { - object.productDetails = []; - for (var j = 0; j < message.productDetails.length; ++j) - object.productDetails[j] = $root.google.cloud.retail.v2beta.ProductDetail.toObject(message.productDetails[j], options); - } - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - if (message.cartId != null && message.hasOwnProperty("cartId")) - object.cartId = message.cartId; - if (message.purchaseTransaction != null && message.hasOwnProperty("purchaseTransaction")) - object.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.toObject(message.purchaseTransaction, options); - if (message.searchQuery != null && message.hasOwnProperty("searchQuery")) - object.searchQuery = message.searchQuery; - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; - } - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.referrerUri != null && message.hasOwnProperty("referrerUri")) - object.referrerUri = message.referrerUri; - if (message.pageViewId != null && message.hasOwnProperty("pageViewId")) - object.pageViewId = message.pageViewId; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.sessionId != null && message.hasOwnProperty("sessionId")) - object.sessionId = message.sessionId; - if (message.completionDetail != null && message.hasOwnProperty("completionDetail")) - object.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.toObject(message.completionDetail, options); - return object; - }; + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this UserEvent to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.UserEvent - * @instance - * @returns {Object.} JSON object - */ - UserEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return SearchResult; + })(); - return UserEvent; - })(); + SearchResponse.Facet = (function() { - v2beta.ProductDetail = (function() { + /** + * Properties of a Facet. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet + */ - /** - * Properties of a ProductDetail. - * @memberof google.cloud.retail.v2beta - * @interface IProductDetail - * @property {google.cloud.retail.v2beta.IProduct|null} [product] ProductDetail product - * @property {google.protobuf.IInt32Value|null} [quantity] ProductDetail quantity - */ + /** + * Constructs a new Facet. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet=} [properties] Properties to set + */ + function Facet(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ProductDetail. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductDetail. - * @implements IProductDetail - * @constructor - * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set - */ - function ProductDetail(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + */ + Facet.prototype.key = ""; - /** - * ProductDetail product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.ProductDetail - * @instance - */ - ProductDetail.prototype.product = null; + /** + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; - /** - * ProductDetail quantity. - * @member {google.protobuf.IInt32Value|null|undefined} quantity - * @memberof google.cloud.retail.v2beta.ProductDetail - * @instance - */ - ProductDetail.prototype.quantity = null; + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; - /** - * Creates a new ProductDetail instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {google.cloud.retail.v2beta.IProductDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail instance - */ - ProductDetail.create = function create(properties) { - return new ProductDetail(properties); - }; + /** + * Creates a new Facet instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet instance + */ + Facet.create = function create(properties) { + return new Facet(properties); + }; - /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductDetail.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.quantity != null && Object.hasOwnProperty.call(message, "quantity")) - $root.google.protobuf.Int32Value.encode(message.quantity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); + return writer; + }; - /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ProductDetail.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {google.cloud.retail.v2beta.IProductDetail} message ProductDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductDetail.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ProductDetail message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductDetail.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ProductDetail(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a Facet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; - - /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductDetail.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductDetail message. - * @function verify - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductDetail.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.quantity != null && message.hasOwnProperty("quantity")) { - var error = $root.google.protobuf.Int32Value.verify(message.quantity); - if (error) - return "quantity." + error; - } - return null; - }; + return message; + }; - /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ProductDetail} ProductDetail - */ - ProductDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ProductDetail) - return object; - var message = new $root.google.cloud.retail.v2beta.ProductDetail(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductDetail.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); - } - if (object.quantity != null) { - if (typeof object.quantity !== "object") - throw TypeError(".google.cloud.retail.v2beta.ProductDetail.quantity: object expected"); - message.quantity = $root.google.protobuf.Int32Value.fromObject(object.quantity); - } - return message; - }; + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ProductDetail - * @static - * @param {google.cloud.retail.v2beta.ProductDetail} message ProductDetail - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductDetail.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.quantity = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.quantity != null && message.hasOwnProperty("quantity")) - object.quantity = $root.google.protobuf.Int32Value.toObject(message.quantity, options); - return object; - }; + /** + * Verifies a Facet message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Facet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; + return null; + }; - /** - * Converts this ProductDetail to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ProductDetail - * @instance - * @returns {Object.} JSON object - */ - ProductDetail.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet + */ + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.Facet) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); + return message; + }; - return ProductDetail; - })(); + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet} message Facet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Facet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; + return object; + }; - v2beta.CompletionDetail = (function() { + /** + * Converts this Facet to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @instance + * @returns {Object.} JSON object + */ + Facet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a CompletionDetail. - * @memberof google.cloud.retail.v2beta - * @interface ICompletionDetail - * @property {string|null} [completionAttributionToken] CompletionDetail completionAttributionToken - * @property {string|null} [selectedSuggestion] CompletionDetail selectedSuggestion - * @property {number|null} [selectedPosition] CompletionDetail selectedPosition - */ + Facet.FacetValue = (function() { - /** - * Constructs a new CompletionDetail. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CompletionDetail. - * @implements ICompletionDetail - * @constructor - * @param {google.cloud.retail.v2beta.ICompletionDetail=} [properties] Properties to set - */ - function CompletionDetail(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2beta.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ - /** - * CompletionDetail completionAttributionToken. - * @member {string} completionAttributionToken - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @instance - */ - CompletionDetail.prototype.completionAttributionToken = ""; + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CompletionDetail selectedSuggestion. - * @member {string} selectedSuggestion - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @instance - */ - CompletionDetail.prototype.selectedSuggestion = ""; + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; - /** - * CompletionDetail selectedPosition. - * @member {number} selectedPosition - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @instance - */ - CompletionDetail.prototype.selectedPosition = 0; + /** + * FacetValue interval. + * @member {google.cloud.retail.v2beta.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; - /** - * Creates a new CompletionDetail instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {google.cloud.retail.v2beta.ICompletionDetail=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail instance - */ - CompletionDetail.create = function create(properties) { - return new CompletionDetail(properties); - }; + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {google.cloud.retail.v2beta.ICompletionDetail} message CompletionDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionDetail.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.completionAttributionToken != null && Object.hasOwnProperty.call(message, "completionAttributionToken")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.completionAttributionToken); - if (message.selectedSuggestion != null && Object.hasOwnProperty.call(message, "selectedSuggestion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedSuggestion); - if (message.selectedPosition != null && Object.hasOwnProperty.call(message, "selectedPosition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.selectedPosition); - return writer; - }; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompletionDetail.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {google.cloud.retail.v2beta.ICompletionDetail} message CompletionDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionDetail.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Decodes a CompletionDetail message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionDetail.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompletionDetail(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.completionAttributionToken = reader.string(); - break; - case 2: - message.selectedSuggestion = reader.string(); - break; - case 3: - message.selectedPosition = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; - /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionDetail.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2beta.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; - /** - * Verifies a CompletionDetail message. - * @function verify - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompletionDetail.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) - if (!$util.isString(message.completionAttributionToken)) - return "completionAttributionToken: string expected"; - if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) - if (!$util.isString(message.selectedSuggestion)) - return "selectedSuggestion: string expected"; - if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) - if (!$util.isInteger(message.selectedPosition)) - return "selectedPosition: integer expected"; - return null; - }; + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CompletionDetail} CompletionDetail - */ - CompletionDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CompletionDetail) - return object; - var message = new $root.google.cloud.retail.v2beta.CompletionDetail(); - if (object.completionAttributionToken != null) - message.completionAttributionToken = String(object.completionAttributionToken); - if (object.selectedSuggestion != null) - message.selectedSuggestion = String(object.selectedSuggestion); - if (object.selectedPosition != null) - message.selectedPosition = object.selectedPosition | 0; - return message; - }; + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @static - * @param {google.cloud.retail.v2beta.CompletionDetail} message CompletionDetail - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompletionDetail.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.completionAttributionToken = ""; - object.selectedSuggestion = ""; - object.selectedPosition = 0; - } - if (message.completionAttributionToken != null && message.hasOwnProperty("completionAttributionToken")) - object.completionAttributionToken = message.completionAttributionToken; - if (message.selectedSuggestion != null && message.hasOwnProperty("selectedSuggestion")) - object.selectedSuggestion = message.selectedSuggestion; - if (message.selectedPosition != null && message.hasOwnProperty("selectedPosition")) - object.selectedPosition = message.selectedPosition; - return object; - }; + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2beta.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; - /** - * Converts this CompletionDetail to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.CompletionDetail - * @instance - * @returns {Object.} JSON object - */ - CompletionDetail.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2beta.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; - return CompletionDetail; - })(); + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2beta.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; - v2beta.PurchaseTransaction = (function() { + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a PurchaseTransaction. - * @memberof google.cloud.retail.v2beta - * @interface IPurchaseTransaction - * @property {string|null} [id] PurchaseTransaction id - * @property {number|null} [revenue] PurchaseTransaction revenue - * @property {number|null} [tax] PurchaseTransaction tax - * @property {number|null} [cost] PurchaseTransaction cost - * @property {string|null} [currencyCode] PurchaseTransaction currencyCode - */ + return FacetValue; + })(); - /** - * Constructs a new PurchaseTransaction. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurchaseTransaction. - * @implements IPurchaseTransaction - * @constructor - * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set - */ - function PurchaseTransaction(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return Facet; + })(); - /** - * PurchaseTransaction id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.id = ""; + SearchResponse.QueryExpansionInfo = (function() { - /** - * PurchaseTransaction revenue. - * @member {number} revenue - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.revenue = 0; + /** + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount + */ - /** - * PurchaseTransaction tax. - * @member {number} tax - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.tax = 0; + /** + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2beta.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo + * @constructor + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + */ + function QueryExpansionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PurchaseTransaction cost. - * @member {number} cost - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.cost = 0; + /** + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.expandedQuery = false; - /** - * PurchaseTransaction currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - */ - PurchaseTransaction.prototype.currencyCode = ""; + /** + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * Creates a new PurchaseTransaction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {google.cloud.retail.v2beta.IPurchaseTransaction=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction instance - */ - PurchaseTransaction.create = function create(properties) { - return new PurchaseTransaction(properties); - }; + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + */ + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); + }; - /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurchaseTransaction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.revenue != null && Object.hasOwnProperty.call(message, "revenue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.revenue); - if (message.tax != null && Object.hasOwnProperty.call(message, "tax")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.tax); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); - return writer; - }; + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); + return writer; + }; - /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurchaseTransaction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {google.cloud.retail.v2beta.IPurchaseTransaction} message PurchaseTransaction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurchaseTransaction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurchaseTransaction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.revenue = reader.float(); - break; - case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expandedQuery = reader.bool(); + break; + case 2: + message.pinnedResultCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurchaseTransaction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a PurchaseTransaction message. - * @function verify - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurchaseTransaction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.revenue != null && message.hasOwnProperty("revenue")) - if (typeof message.revenue !== "number") - return "revenue: number expected"; - if (message.tax != null && message.hasOwnProperty("tax")) - if (typeof message.tax !== "number") - return "tax: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - return null; - }; + /** + * Verifies a QueryExpansionInfo message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; + return null; + }; - /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurchaseTransaction} PurchaseTransaction - */ - PurchaseTransaction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurchaseTransaction) - return object; - var message = new $root.google.cloud.retail.v2beta.PurchaseTransaction(); - if (object.id != null) - message.id = String(object.id); - if (object.revenue != null) - message.revenue = Number(object.revenue); - if (object.tax != null) - message.tax = Number(object.tax); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - return message; - }; + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + */ + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + return object; + }; - /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @static - * @param {google.cloud.retail.v2beta.PurchaseTransaction} message PurchaseTransaction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurchaseTransaction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.id = ""; - object.revenue = 0; - object.tax = 0; - object.cost = 0; - object.currencyCode = ""; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.revenue != null && message.hasOwnProperty("revenue")) - object.revenue = options.json && !isFinite(message.revenue) ? String(message.revenue) : message.revenue; - if (message.tax != null && message.hasOwnProperty("tax")) - object.tax = options.json && !isFinite(message.tax) ? String(message.tax) : message.tax; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - return object; - }; + /** + * Converts this QueryExpansionInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this PurchaseTransaction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PurchaseTransaction - * @instance - * @returns {Object.} JSON object - */ - PurchaseTransaction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return QueryExpansionInfo; + })(); - return PurchaseTransaction; + return SearchResponse; })(); - v2beta.CatalogService = (function() { + v2beta.ControlService = (function() { /** - * Constructs a new CatalogService service. + * Constructs a new ControlService service. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CatalogService + * @classdesc Represents a ControlService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { + function ControlService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; + (ControlService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ControlService; /** - * Creates new CatalogService service using the specified rpc implementation. + * Creates new ControlService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2beta.CatalogService + * @memberof google.cloud.retail.v2beta.ControlService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. + * @returns {ControlService} RPC service. Useful where requests and/or responses are streamed. */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + ControlService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. - * @memberof google.cloud.retail.v2beta.CatalogService - * @typedef ListCatalogsCallback + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#createControl}. + * @memberof google.cloud.retail.v2beta.ControlService + * @typedef CreateControlCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.ListCatalogsResponse} [response] ListCatalogsResponse + * @param {google.cloud.retail.v2beta.Control} [response] Control */ /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls CreateControl. + * @function createControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2beta.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse + * @param {google.cloud.retail.v2beta.ICreateControlRequest} request CreateControlRequest message or plain object + * @param {google.cloud.retail.v2beta.ControlService.CreateControlCallback} callback Node-style callback called with the error, if any, and Control * @returns {undefined} * @variation 1 */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2beta.ListCatalogsRequest, $root.google.cloud.retail.v2beta.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); + Object.defineProperty(ControlService.prototype.createControl = function createControl(request, callback) { + return this.rpcCall(createControl, $root.google.cloud.retail.v2beta.CreateControlRequest, $root.google.cloud.retail.v2beta.Control, request, callback); + }, "name", { value: "CreateControl" }); /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls CreateControl. + * @function createControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2beta.ICreateControlRequest} request CreateControlRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. - * @memberof google.cloud.retail.v2beta.CatalogService - * @typedef UpdateCatalogCallback + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#deleteControl}. + * @memberof google.cloud.retail.v2beta.ControlService + * @typedef DeleteControlCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Catalog} [response] Catalog + * @param {google.protobuf.Empty} [response] Empty */ /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls DeleteControl. + * @function deleteControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2beta.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @param {google.cloud.retail.v2beta.IDeleteControlRequest} request DeleteControlRequest message or plain object + * @param {google.cloud.retail.v2beta.ControlService.DeleteControlCallback} callback Node-style callback called with the error, if any, and Empty * @returns {undefined} * @variation 1 */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2beta.UpdateCatalogRequest, $root.google.cloud.retail.v2beta.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); + Object.defineProperty(ControlService.prototype.deleteControl = function deleteControl(request, callback) { + return this.rpcCall(deleteControl, $root.google.cloud.retail.v2beta.DeleteControlRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteControl" }); /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls DeleteControl. + * @function deleteControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2beta.IDeleteControlRequest} request DeleteControlRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. - * @memberof google.cloud.retail.v2beta.CatalogService - * @typedef SetDefaultBranchCallback + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#updateControl}. + * @memberof google.cloud.retail.v2beta.ControlService + * @typedef UpdateControlCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty + * @param {google.cloud.retail.v2beta.Control} [response] Control */ /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls UpdateControl. + * @function updateControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2beta.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @param {google.cloud.retail.v2beta.IUpdateControlRequest} request UpdateControlRequest message or plain object + * @param {google.cloud.retail.v2beta.ControlService.UpdateControlCallback} callback Node-style callback called with the error, if any, and Control * @returns {undefined} * @variation 1 */ - Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { - return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2beta.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "SetDefaultBranch" }); + Object.defineProperty(ControlService.prototype.updateControl = function updateControl(request, callback) { + return this.rpcCall(updateControl, $root.google.cloud.retail.v2beta.UpdateControlRequest, $root.google.cloud.retail.v2beta.Control, request, callback); + }, "name", { value: "UpdateControl" }); /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls UpdateControl. + * @function updateControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2beta.IUpdateControlRequest} request UpdateControlRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. - * @memberof google.cloud.retail.v2beta.CatalogService - * @typedef GetDefaultBranchCallback + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#getControl}. + * @memberof google.cloud.retail.v2beta.ControlService + * @typedef GetControlCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + * @param {google.cloud.retail.v2beta.Control} [response] Control */ /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls GetControl. + * @function getControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2beta.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @param {google.cloud.retail.v2beta.IGetControlRequest} request GetControlRequest message or plain object + * @param {google.cloud.retail.v2beta.ControlService.GetControlCallback} callback Node-style callback called with the error, if any, and Control * @returns {undefined} * @variation 1 */ - Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { - return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2beta.GetDefaultBranchRequest, $root.google.cloud.retail.v2beta.GetDefaultBranchResponse, request, callback); - }, "name", { value: "GetDefaultBranch" }); + Object.defineProperty(ControlService.prototype.getControl = function getControl(request, callback) { + return this.rpcCall(getControl, $root.google.cloud.retail.v2beta.GetControlRequest, $root.google.cloud.retail.v2beta.Control, request, callback); + }, "name", { value: "GetControl" }); /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2beta.CatalogService + * Calls GetControl. + * @function getControl + * @memberof google.cloud.retail.v2beta.ControlService * @instance - * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2beta.IGetControlRequest} request GetControlRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return CatalogService; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ControlService#listControls}. + * @memberof google.cloud.retail.v2beta.ControlService + * @typedef ListControlsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListControlsResponse} [response] ListControlsResponse + */ + + /** + * Calls ListControls. + * @function listControls + * @memberof google.cloud.retail.v2beta.ControlService + * @instance + * @param {google.cloud.retail.v2beta.IListControlsRequest} request ListControlsRequest message or plain object + * @param {google.cloud.retail.v2beta.ControlService.ListControlsCallback} callback Node-style callback called with the error, if any, and ListControlsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.listControls = function listControls(request, callback) { + return this.rpcCall(listControls, $root.google.cloud.retail.v2beta.ListControlsRequest, $root.google.cloud.retail.v2beta.ListControlsResponse, request, callback); + }, "name", { value: "ListControls" }); + + /** + * Calls ListControls. + * @function listControls + * @memberof google.cloud.retail.v2beta.ControlService + * @instance + * @param {google.cloud.retail.v2beta.IListControlsRequest} request ListControlsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ControlService; })(); - v2beta.ListCatalogsRequest = (function() { + v2beta.CreateControlRequest = (function() { /** - * Properties of a ListCatalogsRequest. + * Properties of a CreateControlRequest. * @memberof google.cloud.retail.v2beta - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * @interface ICreateControlRequest + * @property {string|null} [parent] CreateControlRequest parent + * @property {google.cloud.retail.v2beta.IControl|null} [control] CreateControlRequest control + * @property {string|null} [controlId] CreateControlRequest controlId */ /** - * Constructs a new ListCatalogsRequest. + * Constructs a new CreateControlRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * @classdesc Represents a CreateControlRequest. + * @implements ICreateControlRequest * @constructor - * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICreateControlRequest=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function CreateControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -65504,90 +78540,90 @@ } /** - * ListCatalogsRequest parent. + * CreateControlRequest parent. * @member {string} parent - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @instance */ - ListCatalogsRequest.prototype.parent = ""; + CreateControlRequest.prototype.parent = ""; /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * CreateControlRequest control. + * @member {google.cloud.retail.v2beta.IControl|null|undefined} control + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @instance */ - ListCatalogsRequest.prototype.pageSize = 0; + CreateControlRequest.prototype.control = null; /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * CreateControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + CreateControlRequest.prototype.controlId = ""; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new CreateControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2beta.ICreateControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateControlRequest} CreateControlRequest instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + CreateControlRequest.create = function create(properties) { + return new CreateControlRequest(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified CreateControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.ICreateControlRequest} message CreateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + CreateControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.control != null && Object.hasOwnProperty.call(message, "control")) + $root.google.cloud.retail.v2beta.Control.encode(message.control, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.controlId); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified CreateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static - * @param {google.cloud.retail.v2beta.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.ICreateControlRequest} message CreateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + CreateControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a CreateControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2beta.CreateControlRequest} CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + CreateControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -65595,10 +78631,10 @@ message.parent = reader.string(); break; case 2: - message.pageSize = reader.int32(); + message.control = $root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32()); break; case 3: - message.pageToken = reader.string(); + message.controlId = reader.string(); break; default: reader.skipType(tag & 7); @@ -65609,356 +78645,130 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2beta.CreateControlRequest} CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + CreateControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies a CreateControlRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + CreateControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.control != null && message.hasOwnProperty("control")) { + var error = $root.google.cloud.retail.v2beta.Control.verify(message.control); + if (error) + return "control." + error; + } + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2beta.CreateControlRequest} CreateControlRequest */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsRequest) + CreateControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateControlRequest) return object; - var message = new $root.google.cloud.retail.v2beta.ListCatalogsRequest(); + var message = new $root.google.cloud.retail.v2beta.CreateControlRequest(); if (object.parent != null) message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + if (object.control != null) { + if (typeof object.control !== "object") + throw TypeError(".google.cloud.retail.v2beta.CreateControlRequest.control: object expected"); + message.control = $root.google.cloud.retail.v2beta.Control.fromObject(object.control); + } + if (object.controlId != null) + message.controlId = String(object.controlId); return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from a CreateControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @static - * @param {google.cloud.retail.v2beta.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2beta.CreateControlRequest} message CreateControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + CreateControlRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; + object.control = null; + object.controlId = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListCatalogsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.ListCatalogsRequest - * @instance - * @returns {Object.} JSON object - */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListCatalogsRequest; - })(); - - v2beta.ListCatalogsResponse = (function() { - - /** - * Properties of a ListCatalogsResponse. - * @memberof google.cloud.retail.v2beta - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken - */ - - /** - * Constructs a new ListCatalogsResponse. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse - * @constructor - * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set - */ - function ListCatalogsResponse(properties) { - this.catalogs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @instance - */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; - - /** - * ListCatalogsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @instance - */ - ListCatalogsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListCatalogsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2beta.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse instance - */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); - }; - - /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListCatalogsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2beta.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListCatalogsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2beta.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListCatalogsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListCatalogsResponse message. - * @function verify - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListCatalogsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalogs[i]); - if (error) - return "catalogs." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ListCatalogsResponse} ListCatalogsResponse - */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ListCatalogsResponse) - return object; - var message = new $root.google.cloud.retail.v2beta.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalogs[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse - * @static - * @param {google.cloud.retail.v2beta.ListCatalogsResponse} message ListCatalogsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListCatalogsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.catalogs = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalogs[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; + if (message.control != null && message.hasOwnProperty("control")) + object.control = $root.google.cloud.retail.v2beta.Control.toObject(message.control, options); + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; return object; }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this CreateControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @memberof google.cloud.retail.v2beta.CreateControlRequest * @instance * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { + CreateControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListCatalogsResponse; + return CreateControlRequest; })(); - v2beta.UpdateCatalogRequest = (function() { + v2beta.UpdateControlRequest = (function() { /** - * Properties of an UpdateCatalogRequest. + * Properties of an UpdateControlRequest. * @memberof google.cloud.retail.v2beta - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2beta.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * @interface IUpdateControlRequest + * @property {google.cloud.retail.v2beta.IControl|null} [control] UpdateControlRequest control + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateControlRequest updateMask */ /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new UpdateControlRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest + * @classdesc Represents an UpdateControlRequest. + * @implements IUpdateControlRequest * @constructor - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IUpdateControlRequest=} [properties] Properties to set */ - function UpdateCatalogRequest(properties) { + function UpdateControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -65966,85 +78776,85 @@ } /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2beta.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * UpdateControlRequest control. + * @member {google.cloud.retail.v2beta.IControl|null|undefined} control + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + UpdateControlRequest.prototype.control = null; /** - * UpdateCatalogRequest updateMask. + * UpdateControlRequest updateMask. * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + UpdateControlRequest.prototype.updateMask = null; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new UpdateControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest instance + * @param {google.cloud.retail.v2beta.IUpdateControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateControlRequest} UpdateControlRequest instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); + UpdateControlRequest.create = function create(properties) { + return new UpdateControlRequest(properties); }; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified UpdateControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IUpdateControlRequest} message UpdateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encode = function encode(message, writer) { + UpdateControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2beta.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.control != null && Object.hasOwnProperty.call(message, "control")) + $root.google.cloud.retail.v2beta.Control.encode(message.control, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified UpdateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static - * @param {google.cloud.retail.v2beta.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IUpdateControlRequest} message UpdateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes an UpdateControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2beta.UpdateControlRequest} UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decode = function decode(reader, length) { + UpdateControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); + message.control = $root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32()); break; case 2: message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); @@ -66058,36 +78868,36 @@ }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2beta.UpdateControlRequest} UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateCatalogRequest message. + * Verifies an UpdateControlRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateCatalogRequest.verify = function verify(message) { + UpdateControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2beta.Catalog.verify(message.catalog); + if (message.control != null && message.hasOwnProperty("control")) { + var error = $root.google.cloud.retail.v2beta.Control.verify(message.control); if (error) - return "catalog." + error; + return "control." + error; } if (message.updateMask != null && message.hasOwnProperty("updateMask")) { var error = $root.google.protobuf.FieldMask.verify(message.updateMask); @@ -66098,88 +78908,86 @@ }; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2beta.UpdateControlRequest} UpdateControlRequest */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UpdateCatalogRequest) + UpdateControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateControlRequest) return object; - var message = new $root.google.cloud.retail.v2beta.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2beta.Catalog.fromObject(object.catalog); + var message = new $root.google.cloud.retail.v2beta.UpdateControlRequest(); + if (object.control != null) { + if (typeof object.control !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateControlRequest.control: object expected"); + message.control = $root.google.cloud.retail.v2beta.Control.fromObject(object.control); } if (object.updateMask != null) { if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateCatalogRequest.updateMask: object expected"); + throw TypeError(".google.cloud.retail.v2beta.UpdateControlRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } return message; }; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @static - * @param {google.cloud.retail.v2beta.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {google.cloud.retail.v2beta.UpdateControlRequest} message UpdateControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateCatalogRequest.toObject = function toObject(message, options) { + UpdateControlRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.catalog = null; + object.control = null; object.updateMask = null; } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2beta.Catalog.toObject(message.catalog, options); + if (message.control != null && message.hasOwnProperty("control")) + object.control = $root.google.cloud.retail.v2beta.Control.toObject(message.control, options); if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this UpdateControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @memberof google.cloud.retail.v2beta.UpdateControlRequest * @instance * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { + UpdateControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateCatalogRequest; + return UpdateControlRequest; })(); - v2beta.SetDefaultBranchRequest = (function() { + v2beta.DeleteControlRequest = (function() { /** - * Properties of a SetDefaultBranchRequest. + * Properties of a DeleteControlRequest. * @memberof google.cloud.retail.v2beta - * @interface ISetDefaultBranchRequest - * @property {string|null} [catalog] SetDefaultBranchRequest catalog - * @property {string|null} [branchId] SetDefaultBranchRequest branchId - * @property {string|null} [note] SetDefaultBranchRequest note + * @interface IDeleteControlRequest + * @property {string|null} [name] DeleteControlRequest name */ /** - * Constructs a new SetDefaultBranchRequest. + * Constructs a new DeleteControlRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SetDefaultBranchRequest. - * @implements ISetDefaultBranchRequest + * @classdesc Represents a DeleteControlRequest. + * @implements IDeleteControlRequest * @constructor - * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IDeleteControlRequest=} [properties] Properties to set */ - function SetDefaultBranchRequest(properties) { + function DeleteControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -66187,101 +78995,75 @@ } /** - * SetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest - * @instance - */ - SetDefaultBranchRequest.prototype.catalog = ""; - - /** - * SetDefaultBranchRequest branchId. - * @member {string} branchId - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest - * @instance - */ - SetDefaultBranchRequest.prototype.branchId = ""; - - /** - * SetDefaultBranchRequest note. - * @member {string} note - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * DeleteControlRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @instance */ - SetDefaultBranchRequest.prototype.note = ""; + DeleteControlRequest.prototype.name = ""; /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. + * Creates a new DeleteControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static - * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest instance + * @param {google.cloud.retail.v2beta.IDeleteControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.DeleteControlRequest} DeleteControlRequest instance */ - SetDefaultBranchRequest.create = function create(properties) { - return new SetDefaultBranchRequest(properties); + DeleteControlRequest.create = function create(properties) { + return new DeleteControlRequest(properties); }; /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified DeleteControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static - * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IDeleteControlRequest} message DeleteControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetDefaultBranchRequest.encode = function encode(message, writer) { + DeleteControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified DeleteControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static - * @param {google.cloud.retail.v2beta.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IDeleteControlRequest} message DeleteControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a DeleteControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2beta.DeleteControlRequest} DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetDefaultBranchRequest.decode = function decode(reader, length) { + DeleteControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetDefaultBranchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = reader.string(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - message.note = reader.string(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -66292,124 +79074,107 @@ }; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2beta.DeleteControlRequest} DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetDefaultBranchRequest message. + * Verifies a DeleteControlRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetDefaultBranchRequest.verify = function verify(message) { + DeleteControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.branchId != null && message.hasOwnProperty("branchId")) - if (!$util.isString(message.branchId)) - return "branchId: string expected"; - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2beta.DeleteControlRequest} DeleteControlRequest */ - SetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SetDefaultBranchRequest) + DeleteControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.DeleteControlRequest) return object; - var message = new $root.google.cloud.retail.v2beta.SetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.branchId != null) - message.branchId = String(object.branchId); - if (object.note != null) - message.note = String(object.note); + var message = new $root.google.cloud.retail.v2beta.DeleteControlRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @static - * @param {google.cloud.retail.v2beta.SetDefaultBranchRequest} message SetDefaultBranchRequest + * @param {google.cloud.retail.v2beta.DeleteControlRequest} message DeleteControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetDefaultBranchRequest.toObject = function toObject(message, options) { + DeleteControlRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.catalog = ""; - object.branchId = ""; - object.note = ""; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.branchId != null && message.hasOwnProperty("branchId")) - object.branchId = message.branchId; - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this SetDefaultBranchRequest to JSON. + * Converts this DeleteControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.DeleteControlRequest * @instance * @returns {Object.} JSON object */ - SetDefaultBranchRequest.prototype.toJSON = function toJSON() { + DeleteControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetDefaultBranchRequest; + return DeleteControlRequest; })(); - v2beta.GetDefaultBranchRequest = (function() { + v2beta.GetControlRequest = (function() { /** - * Properties of a GetDefaultBranchRequest. + * Properties of a GetControlRequest. * @memberof google.cloud.retail.v2beta - * @interface IGetDefaultBranchRequest - * @property {string|null} [catalog] GetDefaultBranchRequest catalog + * @interface IGetControlRequest + * @property {string|null} [name] GetControlRequest name */ /** - * Constructs a new GetDefaultBranchRequest. + * Constructs a new GetControlRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a GetDefaultBranchRequest. - * @implements IGetDefaultBranchRequest + * @classdesc Represents a GetControlRequest. + * @implements IGetControlRequest * @constructor - * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IGetControlRequest=} [properties] Properties to set */ - function GetDefaultBranchRequest(properties) { + function GetControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -66417,75 +79182,75 @@ } /** - * GetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * GetControlRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetControlRequest * @instance */ - GetDefaultBranchRequest.prototype.catalog = ""; + GetControlRequest.prototype.name = ""; /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. + * Creates a new GetControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static - * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest instance + * @param {google.cloud.retail.v2beta.IGetControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetControlRequest} GetControlRequest instance */ - GetDefaultBranchRequest.create = function create(properties) { - return new GetDefaultBranchRequest(properties); + GetControlRequest.create = function create(properties) { + return new GetControlRequest(properties); }; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified GetControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static - * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IGetControlRequest} message GetControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchRequest.encode = function encode(message, writer) { + GetControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified GetControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static - * @param {google.cloud.retail.v2beta.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IGetControlRequest} message GetControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a GetControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2beta.GetControlRequest} GetControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchRequest.decode = function decode(reader, length) { + GetControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetDefaultBranchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = reader.string(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -66496,109 +79261,110 @@ }; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a GetControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2beta.GetControlRequest} GetControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + GetControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDefaultBranchRequest message. + * Verifies a GetControlRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDefaultBranchRequest.verify = function verify(message) { + GetControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2beta.GetControlRequest} GetControlRequest */ - GetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.GetDefaultBranchRequest) + GetControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetControlRequest) return object; - var message = new $root.google.cloud.retail.v2beta.GetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); + var message = new $root.google.cloud.retail.v2beta.GetControlRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @static - * @param {google.cloud.retail.v2beta.GetDefaultBranchRequest} message GetDefaultBranchRequest + * @param {google.cloud.retail.v2beta.GetControlRequest} message GetControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDefaultBranchRequest.toObject = function toObject(message, options) { + GetControlRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.catalog = ""; - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this GetDefaultBranchRequest to JSON. + * Converts this GetControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2beta.GetControlRequest * @instance * @returns {Object.} JSON object */ - GetDefaultBranchRequest.prototype.toJSON = function toJSON() { + GetControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetDefaultBranchRequest; + return GetControlRequest; })(); - v2beta.GetDefaultBranchResponse = (function() { + v2beta.ListControlsRequest = (function() { /** - * Properties of a GetDefaultBranchResponse. + * Properties of a ListControlsRequest. * @memberof google.cloud.retail.v2beta - * @interface IGetDefaultBranchResponse - * @property {string|null} [branch] GetDefaultBranchResponse branch - * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime - * @property {string|null} [note] GetDefaultBranchResponse note + * @interface IListControlsRequest + * @property {string|null} [parent] ListControlsRequest parent + * @property {number|null} [pageSize] ListControlsRequest pageSize + * @property {string|null} [pageToken] ListControlsRequest pageToken + * @property {string|null} [filter] ListControlsRequest filter */ /** - * Constructs a new GetDefaultBranchResponse. + * Constructs a new ListControlsRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a GetDefaultBranchResponse. - * @implements IGetDefaultBranchResponse + * @classdesc Represents a ListControlsRequest. + * @implements IListControlsRequest * @constructor - * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IListControlsRequest=} [properties] Properties to set */ - function GetDefaultBranchResponse(properties) { + function ListControlsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -66606,101 +79372,114 @@ } /** - * GetDefaultBranchResponse branch. - * @member {string} branch - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * ListControlsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @instance */ - GetDefaultBranchResponse.prototype.branch = ""; + ListControlsRequest.prototype.parent = ""; /** - * GetDefaultBranchResponse setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * ListControlsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @instance */ - GetDefaultBranchResponse.prototype.setTime = null; + ListControlsRequest.prototype.pageSize = 0; /** - * GetDefaultBranchResponse note. - * @member {string} note - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * ListControlsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @instance */ - GetDefaultBranchResponse.prototype.note = ""; + ListControlsRequest.prototype.pageToken = ""; /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. + * ListControlsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.filter = ""; + + /** + * Creates a new ListControlsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static - * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse instance + * @param {google.cloud.retail.v2beta.IListControlsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListControlsRequest} ListControlsRequest instance */ - GetDefaultBranchResponse.create = function create(properties) { - return new GetDefaultBranchResponse(properties); + ListControlsRequest.create = function create(properties) { + return new ListControlsRequest(properties); }; /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * Encodes the specified ListControlsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static - * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IListControlsRequest} message ListControlsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchResponse.encode = function encode(message, writer) { + ListControlsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); return writer; }; /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetDefaultBranchResponse.verify|verify} messages. + * Encodes the specified ListControlsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static - * @param {google.cloud.retail.v2beta.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IListControlsRequest} message ListControlsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListControlsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * Decodes a ListControlsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2beta.ListControlsRequest} ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchResponse.decode = function decode(reader, length) { + ListControlsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetDefaultBranchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListControlsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.branch = reader.string(); + message.parent = reader.string(); break; case 2: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); break; case 3: - message.note = reader.string(); + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); break; default: reader.skipType(tag & 7); @@ -66711,237 +79490,363 @@ }; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * Decodes a ListControlsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2beta.ListControlsRequest} ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { + ListControlsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDefaultBranchResponse message. + * Verifies a ListControlsRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDefaultBranchResponse.verify = function verify(message) { + ListControlsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); - if (error) - return "setTime." + error; - } - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; return null; }; /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListControlsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.GetDefaultBranchResponse} GetDefaultBranchResponse + * @returns {google.cloud.retail.v2beta.ListControlsRequest} ListControlsRequest */ - GetDefaultBranchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.GetDefaultBranchResponse) + ListControlsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListControlsRequest) return object; - var message = new $root.google.cloud.retail.v2beta.GetDefaultBranchResponse(); - if (object.branch != null) - message.branch = String(object.branch); - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.GetDefaultBranchResponse.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); - } - if (object.note != null) - message.note = String(object.note); + var message = new $root.google.cloud.retail.v2beta.ListControlsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); return message; }; /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListControlsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @static - * @param {google.cloud.retail.v2beta.GetDefaultBranchResponse} message GetDefaultBranchResponse + * @param {google.cloud.retail.v2beta.ListControlsRequest} message ListControlsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDefaultBranchResponse.toObject = function toObject(message, options) { + ListControlsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.branch = ""; - object.setTime = null; - object.note = ""; + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; } - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; return object; }; /** - * Converts this GetDefaultBranchResponse to JSON. + * Converts this ListControlsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @memberof google.cloud.retail.v2beta.ListControlsRequest * @instance * @returns {Object.} JSON object */ - GetDefaultBranchResponse.prototype.toJSON = function toJSON() { + ListControlsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetDefaultBranchResponse; + return ListControlsRequest; })(); - v2beta.CompletionService = (function() { + v2beta.ListControlsResponse = (function() { /** - * Constructs a new CompletionService service. + * Properties of a ListControlsResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CompletionService - * @extends $protobuf.rpc.Service + * @interface IListControlsResponse + * @property {Array.|null} [controls] ListControlsResponse controls + * @property {string|null} [nextPageToken] ListControlsResponse nextPageToken + */ + + /** + * Constructs a new ListControlsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListControlsResponse. + * @implements IListControlsResponse * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.retail.v2beta.IListControlsResponse=} [properties] Properties to set */ - function CompletionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function ListControlsResponse(properties) { + this.controls = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + /** + * ListControlsResponse controls. + * @member {Array.} controls + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @instance + */ + ListControlsResponse.prototype.controls = $util.emptyArray; /** - * Creates new CompletionService service using the specified rpc implementation. + * ListControlsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @instance + */ + ListControlsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListControlsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CompletionService + * @memberof google.cloud.retail.v2beta.ListControlsResponse * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.retail.v2beta.IListControlsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListControlsResponse} ListControlsResponse instance */ - CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + ListControlsResponse.create = function create(properties) { + return new ListControlsResponse(properties); }; /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. - * @memberof google.cloud.retail.v2beta.CompletionService - * @typedef CompleteQueryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.CompleteQueryResponse} [response] CompleteQueryResponse + * Encodes the specified ListControlsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {google.cloud.retail.v2beta.IListControlsResponse} message ListControlsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + ListControlsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.controls != null && message.controls.length) + for (var i = 0; i < message.controls.length; ++i) + $root.google.cloud.retail.v2beta.Control.encode(message.controls[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2beta.CompletionService - * @instance - * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @param {google.cloud.retail.v2beta.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified ListControlsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListControlsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {google.cloud.retail.v2beta.IListControlsResponse} message ListControlsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { - return this.rpcCall(completeQuery, $root.google.cloud.retail.v2beta.CompleteQueryRequest, $root.google.cloud.retail.v2beta.CompleteQueryResponse, request, callback); - }, "name", { value: "CompleteQuery" }); + ListControlsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2beta.CompletionService - * @instance - * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a ListControlsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListControlsResponse} ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListControlsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.controls && message.controls.length)) + message.controls = []; + message.controls.push($root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListControlsResponse} ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListControlsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ + ListControlsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.controls != null && message.hasOwnProperty("controls")) { + if (!Array.isArray(message.controls)) + return "controls: array expected"; + for (var i = 0; i < message.controls.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Control.verify(message.controls[i]); + if (error) + return "controls." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. - * @memberof google.cloud.retail.v2beta.CompletionService - * @typedef ImportCompletionDataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Creates a ListControlsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListControlsResponse} ListControlsResponse */ + ListControlsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListControlsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListControlsResponse(); + if (object.controls) { + if (!Array.isArray(object.controls)) + throw TypeError(".google.cloud.retail.v2beta.ListControlsResponse.controls: array expected"); + message.controls = []; + for (var i = 0; i < object.controls.length; ++i) { + if (typeof object.controls[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListControlsResponse.controls: object expected"); + message.controls[i] = $root.google.cloud.retail.v2beta.Control.fromObject(object.controls[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2beta.CompletionService - * @instance - * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @param {google.cloud.retail.v2beta.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Creates a plain object from a ListControlsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {google.cloud.retail.v2beta.ListControlsResponse} message ListControlsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { - return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2beta.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportCompletionData" }); + ListControlsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.controls = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.controls && message.controls.length) { + object.controls = []; + for (var j = 0; j < message.controls.length; ++j) + object.controls[j] = $root.google.cloud.retail.v2beta.Control.toObject(message.controls[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2beta.CompletionService + * Converts this ListControlsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListControlsResponse * @instance - * @param {google.cloud.retail.v2beta.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + ListControlsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return CompletionService; + return ListControlsResponse; })(); - v2beta.CompleteQueryRequest = (function() { + v2beta.ExportErrorsConfig = (function() { /** - * Properties of a CompleteQueryRequest. + * Properties of an ExportErrorsConfig. * @memberof google.cloud.retail.v2beta - * @interface ICompleteQueryRequest - * @property {string|null} [catalog] CompleteQueryRequest catalog - * @property {string|null} [query] CompleteQueryRequest query - * @property {string|null} [visitorId] CompleteQueryRequest visitorId - * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes - * @property {string|null} [deviceType] CompleteQueryRequest deviceType - * @property {string|null} [dataset] CompleteQueryRequest dataset - * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + * @interface IExportErrorsConfig + * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix */ /** - * Constructs a new CompleteQueryRequest. + * Constructs a new ExportErrorsConfig. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CompleteQueryRequest. - * @implements ICompleteQueryRequest + * @classdesc Represents an ExportErrorsConfig. + * @implements IExportErrorsConfig * @constructor - * @param {google.cloud.retail.v2beta.ICompleteQueryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IExportErrorsConfig=} [properties] Properties to set */ - function CompleteQueryRequest(properties) { - this.languageCodes = []; + function ExportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -66949,156 +79854,89 @@ } /** - * CompleteQueryRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.catalog = ""; - - /** - * CompleteQueryRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.query = ""; - - /** - * CompleteQueryRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.visitorId = ""; - - /** - * CompleteQueryRequest languageCodes. - * @member {Array.} languageCodes - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; - - /** - * CompleteQueryRequest deviceType. - * @member {string} deviceType - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @instance */ - CompleteQueryRequest.prototype.deviceType = ""; + ExportErrorsConfig.prototype.gcsPrefix = null; - /** - * CompleteQueryRequest dataset. - * @member {string} dataset - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.dataset = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * CompleteQueryRequest maxSuggestions. - * @member {number} maxSuggestions - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @instance */ - CompleteQueryRequest.prototype.maxSuggestions = 0; + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new ExportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.ICompleteQueryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest instance + * @param {google.cloud.retail.v2beta.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig instance */ - CompleteQueryRequest.create = function create(properties) { - return new CompleteQueryRequest(properties); + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); }; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encode = function encode(message, writer) { + ExportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); - if (message.languageCodes != null && message.languageCodes.length) - for (var i = 0; i < message.languageCodes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); - if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); - if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); - if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes an ExportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decode = function decode(reader, length) { + ExportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = reader.string(); - break; - case 2: - message.query = reader.string(); - break; - case 7: - message.visitorId = reader.string(); - break; - case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - case 4: - message.deviceType = reader.string(); - break; - case 6: - message.dataset = reader.string(); - break; - case 5: - message.maxSuggestions = reader.int32(); + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -67109,173 +79947,112 @@ }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryRequest message. + * Verifies an ExportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryRequest.verify = function verify(message) { + ExportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { - if (!Array.isArray(message.languageCodes)) - return "languageCodes: array expected"; - for (var i = 0; i < message.languageCodes.length; ++i) - if (!$util.isString(message.languageCodes[i])) - return "languageCodes: string[] expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - if (!$util.isString(message.deviceType)) - return "deviceType: string expected"; - if (message.dataset != null && message.hasOwnProperty("dataset")) - if (!$util.isString(message.dataset)) - return "dataset: string expected"; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - if (!$util.isInteger(message.maxSuggestions)) - return "maxSuggestions: integer expected"; return null; }; /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig */ - CompleteQueryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryRequest) + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2beta.CompleteQueryRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.languageCodes) { - if (!Array.isArray(object.languageCodes)) - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryRequest.languageCodes: array expected"); - message.languageCodes = []; - for (var i = 0; i < object.languageCodes.length; ++i) - message.languageCodes[i] = String(object.languageCodes[i]); - } - if (object.deviceType != null) - message.deviceType = String(object.deviceType); - if (object.dataset != null) - message.dataset = String(object.dataset); - if (object.maxSuggestions != null) - message.maxSuggestions = object.maxSuggestions | 0; + var message = new $root.google.cloud.retail.v2beta.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @static - * @param {google.cloud.retail.v2beta.CompleteQueryRequest} message CompleteQueryRequest + * @param {google.cloud.retail.v2beta.ExportErrorsConfig} message ExportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryRequest.toObject = function toObject(message, options) { + ExportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.languageCodes = []; - if (options.defaults) { - object.catalog = ""; - object.query = ""; - object.deviceType = ""; - object.maxSuggestions = 0; - object.dataset = ""; - object.visitorId = ""; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.languageCodes && message.languageCodes.length) { - object.languageCodes = []; - for (var j = 0; j < message.languageCodes.length; ++j) - object.languageCodes[j] = message.languageCodes[j]; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - object.deviceType = message.deviceType; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - object.maxSuggestions = message.maxSuggestions; - if (message.dataset != null && message.hasOwnProperty("dataset")) - object.dataset = message.dataset; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; return object; }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this ExportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig * @instance * @returns {Object.} JSON object */ - CompleteQueryRequest.prototype.toJSON = function toJSON() { + ExportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompleteQueryRequest; + return ExportErrorsConfig; })(); - v2beta.CompleteQueryResponse = (function() { + v2beta.ExportMetadata = (function() { /** - * Properties of a CompleteQueryResponse. + * Properties of an ExportMetadata. * @memberof google.cloud.retail.v2beta - * @interface ICompleteQueryResponse - * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults - * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken - * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime */ /** - * Constructs a new CompleteQueryResponse. + * Constructs a new ExportMetadata. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CompleteQueryResponse. - * @implements ICompleteQueryResponse + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata * @constructor - * @param {google.cloud.retail.v2beta.ICompleteQueryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IExportMetadata=} [properties] Properties to set */ - function CompleteQueryResponse(properties) { - this.completionResults = []; - this.recentSearchResults = []; + function ExportMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -67283,107 +80060,88 @@ } /** - * CompleteQueryResponse completionResults. - * @member {Array.} completionResults - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse - * @instance - */ - CompleteQueryResponse.prototype.completionResults = $util.emptyArray; - - /** - * CompleteQueryResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2beta.ExportMetadata * @instance */ - CompleteQueryResponse.prototype.attributionToken = ""; + ExportMetadata.prototype.createTime = null; /** - * CompleteQueryResponse recentSearchResults. - * @member {Array.} recentSearchResults - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2beta.ExportMetadata * @instance */ - CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + ExportMetadata.prototype.updateTime = null; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new ExportMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static - * @param {google.cloud.retail.v2beta.ICompleteQueryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse instance + * @param {google.cloud.retail.v2beta.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata instance */ - CompleteQueryResponse.create = function create(properties) { - return new CompleteQueryResponse(properties); + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); }; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static - * @param {google.cloud.retail.v2beta.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportMetadata} message ExportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encode = function encode(message, writer) { + ExportMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionResults != null && message.completionResults.length) - for (var i = 0; i < message.completionResults.length; ++i) - $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.recentSearchResults != null && message.recentSearchResults.length) - for (var i = 0; i < message.recentSearchResults.length; ++i) - $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static - * @param {google.cloud.retail.v2beta.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportMetadata} message ExportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes an ExportMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decode = function decode(reader, length) { + ExportMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -67394,598 +80152,128 @@ }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryResponse message. + * Verifies an ExportMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryResponse.verify = function verify(message) { + ExportMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.completionResults != null && message.hasOwnProperty("completionResults")) { - if (!Array.isArray(message.completionResults)) - return "completionResults: array expected"; - for (var i = 0; i < message.completionResults.length; ++i) { - var error = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); - if (error) - return "completionResults." + error; - } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { - if (!Array.isArray(message.recentSearchResults)) - return "recentSearchResults: array expected"; - for (var i = 0; i < message.recentSearchResults.length; ++i) { - var error = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); - if (error) - return "recentSearchResults." + error; - } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; } return null; }; /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata */ - CompleteQueryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse) + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportMetadata) return object; - var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse(); - if (object.completionResults) { - if (!Array.isArray(object.completionResults)) - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.completionResults: array expected"); - message.completionResults = []; - for (var i = 0; i < object.completionResults.length; ++i) { - if (typeof object.completionResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.completionResults: object expected"); - message.completionResults[i] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); - } + var message = new $root.google.cloud.retail.v2beta.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.recentSearchResults) { - if (!Array.isArray(object.recentSearchResults)) - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.recentSearchResults: array expected"); - message.recentSearchResults = []; - for (var i = 0; i < object.recentSearchResults.length; ++i) { - if (typeof object.recentSearchResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.recentSearchResults: object expected"); - message.recentSearchResults[i] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); - } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } return message; }; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse} message CompleteQueryResponse + * @param {google.cloud.retail.v2beta.ExportMetadata} message ExportMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryResponse.toObject = function toObject(message, options) { + ExportMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.completionResults = []; - object.recentSearchResults = []; - } - if (options.defaults) - object.attributionToken = ""; - if (message.completionResults && message.completionResults.length) { - object.completionResults = []; - for (var j = 0; j < message.completionResults.length; ++j) - object.completionResults[j] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.recentSearchResults && message.recentSearchResults.length) { - object.recentSearchResults = []; - for (var j = 0; j < message.recentSearchResults.length; ++j) - object.recentSearchResults[j] = $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + if (options.defaults) { + object.createTime = null; + object.updateTime = null; } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this ExportMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @memberof google.cloud.retail.v2beta.ExportMetadata * @instance * @returns {Object.} JSON object */ - CompleteQueryResponse.prototype.toJSON = function toJSON() { + ExportMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - CompleteQueryResponse.CompletionResult = (function() { - - /** - * Properties of a CompletionResult. - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse - * @interface ICompletionResult - * @property {string|null} [suggestion] CompletionResult suggestion - * @property {Object.|null} [attributes] CompletionResult attributes - */ - - /** - * Constructs a new CompletionResult. - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse - * @classdesc Represents a CompletionResult. - * @implements ICompletionResult - * @constructor - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - */ - function CompletionResult(properties) { - this.attributes = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompletionResult suggestion. - * @member {string} suggestion - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.suggestion = ""; - - /** - * CompletionResult attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.attributes = $util.emptyObject; - - /** - * Creates a new CompletionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult instance - */ - CompletionResult.create = function create(properties) { - return new CompletionResult(properties); - }; - - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2beta.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompletionResult message. - * @function verify - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompletionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - if (!$util.isString(message.suggestion)) - return "suggestion: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2beta.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - return null; - }; - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} CompletionResult - */ - CompletionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult) - return object; - var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult(); - if (object.suggestion != null) - message.suggestion = String(object.suggestion); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2beta.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult} message CompletionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompletionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) - object.suggestion = ""; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - object.suggestion = message.suggestion; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2beta.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - return object; - }; - - /** - * Converts this CompletionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult - * @instance - * @returns {Object.} JSON object - */ - CompletionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompletionResult; - })(); - - CompleteQueryResponse.RecentSearchResult = (function() { - - /** - * Properties of a RecentSearchResult. - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse - * @interface IRecentSearchResult - * @property {string|null} [recentSearch] RecentSearchResult recentSearch - */ - - /** - * Constructs a new RecentSearchResult. - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse - * @classdesc Represents a RecentSearchResult. - * @implements IRecentSearchResult - * @constructor - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - */ - function RecentSearchResult(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RecentSearchResult recentSearch. - * @member {string} recentSearch - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @instance - */ - RecentSearchResult.prototype.recentSearch = ""; - - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance - */ - RecentSearchResult.create = function create(properties) { - return new RecentSearchResult(properties); - }; - - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); - return writer; - }; - - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RecentSearchResult message. - * @function verify - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RecentSearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - if (!$util.isString(message.recentSearch)) - return "recentSearch: string expected"; - return null; - }; - - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - */ - RecentSearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult) - return object; - var message = new $root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult(); - if (object.recentSearch != null) - message.recentSearch = String(object.recentSearch); - return message; - }; - - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RecentSearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.recentSearch = ""; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - object.recentSearch = message.recentSearch; - return object; - }; - - /** - * Converts this RecentSearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult - * @instance - * @returns {Object.} JSON object - */ - RecentSearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RecentSearchResult; - })(); - - return CompleteQueryResponse; + return ExportMetadata; })(); - v2beta.ExportErrorsConfig = (function() { + v2beta.ExportProductsResponse = (function() { /** - * Properties of an ExportErrorsConfig. + * Properties of an ExportProductsResponse. * @memberof google.cloud.retail.v2beta - * @interface IExportErrorsConfig - * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix + * @interface IExportProductsResponse + * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples + * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig */ /** - * Constructs a new ExportErrorsConfig. + * Constructs a new ExportProductsResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ExportErrorsConfig. - * @implements IExportErrorsConfig + * @classdesc Represents an ExportProductsResponse. + * @implements IExportProductsResponse * @constructor - * @param {google.cloud.retail.v2beta.IExportErrorsConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IExportProductsResponse=} [properties] Properties to set */ - function ExportErrorsConfig(properties) { + function ExportProductsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -67993,89 +80281,91 @@ } /** - * ExportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * ExportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @instance */ - ExportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ExportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * ExportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * ExportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @instance */ - Object.defineProperty(ExportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + ExportProductsResponse.prototype.errorsConfig = null; /** - * Creates a new ExportErrorsConfig instance using the specified properties. + * Creates a new ExportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IExportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig instance + * @param {google.cloud.retail.v2beta.IExportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse instance */ - ExportErrorsConfig.create = function create(properties) { - return new ExportErrorsConfig(properties); + ExportProductsResponse.create = function create(properties) { + return new ExportProductsResponse(properties); }; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportProductsResponse} message ExportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encode = function encode(message, writer) { + ExportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportProductsResponse} message ExportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * Decodes an ExportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decode = function decode(reader, length) { + ExportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -68086,112 +80376,140 @@ }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportErrorsConfig message. + * Verifies an ExportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportErrorsConfig.verify = function verify(message) { + ExportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; } return null; }; /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse */ - ExportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ExportErrorsConfig) + ExportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.ExportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); + var message = new $root.google.cloud.retail.v2beta.ExportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); + } return message; }; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @static - * @param {google.cloud.retail.v2beta.ExportErrorsConfig} message ExportErrorsConfig + * @param {google.cloud.retail.v2beta.ExportProductsResponse} message ExportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportErrorsConfig.toObject = function toObject(message, options) { + ExportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ExportErrorsConfig to JSON. + * Converts this ExportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @memberof google.cloud.retail.v2beta.ExportProductsResponse * @instance * @returns {Object.} JSON object */ - ExportErrorsConfig.prototype.toJSON = function toJSON() { + ExportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportErrorsConfig; + return ExportProductsResponse; })(); - v2beta.ExportMetadata = (function() { + v2beta.ExportUserEventsResponse = (function() { /** - * Properties of an ExportMetadata. + * Properties of an ExportUserEventsResponse. * @memberof google.cloud.retail.v2beta - * @interface IExportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + * @interface IExportUserEventsResponse + * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig */ /** - * Constructs a new ExportMetadata. + * Constructs a new ExportUserEventsResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ExportMetadata. - * @implements IExportMetadata + * @classdesc Represents an ExportUserEventsResponse. + * @implements IExportUserEventsResponse * @constructor - * @param {google.cloud.retail.v2beta.IExportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse=} [properties] Properties to set */ - function ExportMetadata(properties) { + function ExportUserEventsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -68199,88 +80517,91 @@ } /** - * ExportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2beta.ExportMetadata + * ExportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @instance */ - ExportMetadata.prototype.createTime = null; + ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; /** - * ExportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2beta.ExportMetadata + * ExportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2beta.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @instance */ - ExportMetadata.prototype.updateTime = null; + ExportUserEventsResponse.prototype.errorsConfig = null; /** - * Creates a new ExportMetadata instance using the specified properties. + * Creates a new ExportUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IExportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata instance + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse instance */ - ExportMetadata.create = function create(properties) { - return new ExportMetadata(properties); + ExportUserEventsResponse.create = function create(properties) { + return new ExportUserEventsResponse(properties); }; /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encode = function encode(message, writer) { + ExportUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportMetadata.verify|verify} messages. + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportMetadata message from the specified reader or buffer. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decode = function decode(reader, length) { + ExportUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -68291,128 +80612,215 @@ }; /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportMetadata message. + * Verifies an ExportUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportMetadata.verify = function verify(message) { + ExportUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2beta.ExportErrorsConfig.verify(message.errorsConfig); if (error) - return "updateTime." + error; + return "errorsConfig." + error; } return null; }; /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse */ - ExportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ExportMetadata) + ExportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ExportUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.ExportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.ExportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + var message = new $root.google.cloud.retail.v2beta.ExportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.ExportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); } return message; }; /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @static - * @param {google.cloud.retail.v2beta.ExportMetadata} message ExportMetadata + * @param {google.cloud.retail.v2beta.ExportUserEventsResponse} message ExportUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportMetadata.toObject = function toObject(message, options) { + ExportUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.createTime = null; - object.updateTime = null; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ExportMetadata to JSON. + * Converts this ExportUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ExportMetadata + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse * @instance * @returns {Object.} JSON object */ - ExportMetadata.prototype.toJSON = function toJSON() { + ExportUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportMetadata; + return ExportUserEventsResponse; })(); - v2beta.ExportProductsResponse = (function() { + v2beta.PredictionService = (function() { /** - * Properties of an ExportProductsResponse. + * Constructs a new PredictionService service. * @memberof google.cloud.retail.v2beta - * @interface IExportProductsResponse - * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples - * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; /** - * Constructs a new ExportProductsResponse. + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * @memberof google.cloud.retail.v2beta.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2beta.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ExportProductsResponse. - * @implements IExportProductsResponse + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest * @constructor - * @param {google.cloud.retail.v2beta.IExportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set */ - function ExportProductsResponse(properties) { - this.errorSamples = []; + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -68420,91 +80828,208 @@ } /** - * ExportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2beta.PredictRequest * @instance */ - ExportProductsResponse.prototype.errorSamples = $util.emptyArray; + PredictRequest.prototype.placement = ""; /** - * ExportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2beta.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * PredictRequest userEvent. + * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2beta.PredictRequest * @instance */ - ExportProductsResponse.prototype.errorsConfig = null; + PredictRequest.prototype.labels = $util.emptyObject; /** - * Creates a new ExportProductsResponse instance using the specified properties. + * Creates a new PredictRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static - * @param {google.cloud.retail.v2beta.IExportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse instance + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance */ - ExportProductsResponse.create = function create(properties) { - return new ExportProductsResponse(properties); + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); }; /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static - * @param {google.cloud.retail.v2beta.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encode = function encode(message, writer) { + PredictRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); return writer; }; /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportProductsResponse.verify|verify} messages. + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static - * @param {google.cloud.retail.v2beta.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. + * Decodes a PredictRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decode = function decode(reader, length) { + PredictRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.placement = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; break; default: reader.skipType(tag & 7); @@ -68515,140 +81040,208 @@ }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + PredictRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportProductsResponse message. + * Verifies a PredictRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportProductsResponse.verify = function verify(message) { + PredictRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); if (error) - return "errorSamples." + error; + return "params." + error; } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; } return null; }; /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest */ - ExportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ExportProductsResponse) + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictRequest) return object; - var message = new $root.google.cloud.retail.v2beta.ExportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + var message = new $root.google.cloud.retail.v2beta.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); } } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); } return message; }; /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @static - * @param {google.cloud.retail.v2beta.ExportProductsResponse} message ExportProductsResponse + * @param {google.cloud.retail.v2beta.PredictRequest} message PredictRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportProductsResponse.toObject = function toObject(message, options) { + PredictRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ExportProductsResponse to JSON. + * Converts this PredictRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @memberof google.cloud.retail.v2beta.PredictRequest * @instance * @returns {Object.} JSON object */ - ExportProductsResponse.prototype.toJSON = function toJSON() { + PredictRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportProductsResponse; + return PredictRequest; })(); - v2beta.ExportUserEventsResponse = (function() { + v2beta.PredictResponse = (function() { /** - * Properties of an ExportUserEventsResponse. + * Properties of a PredictResponse. * @memberof google.cloud.retail.v2beta - * @interface IExportUserEventsResponse - * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly */ /** - * Constructs a new ExportUserEventsResponse. + * Constructs a new PredictResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an ExportUserEventsResponse. - * @implements IExportUserEventsResponse + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse * @constructor - * @param {google.cloud.retail.v2beta.IExportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set */ - function ExportUserEventsResponse(properties) { - this.errorSamples = []; + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -68656,91 +81249,120 @@ } /** - * ExportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2beta.PredictResponse * @instance */ - ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + PredictResponse.prototype.results = $util.emptyArray; /** - * ExportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2beta.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2beta.PredictResponse * @instance */ - ExportUserEventsResponse.prototype.errorsConfig = null; + PredictResponse.prototype.attributionToken = ""; /** - * Creates a new ExportUserEventsResponse instance using the specified properties. + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static - * @param {google.cloud.retail.v2beta.IExportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse instance + * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse instance */ - ExportUserEventsResponse.create = function create(properties) { - return new ExportUserEventsResponse(properties); + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); }; /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static - * @param {google.cloud.retail.v2beta.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encode = function encode(message, writer) { + PredictResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); return writer; }; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static - * @param {google.cloud.retail.v2beta.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a PredictResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decode = function decode(reader, length) { + PredictResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ExportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); break; default: reader.skipType(tag & 7); @@ -68751,636 +81373,815 @@ }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + PredictResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a PredictResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportUserEventsResponse.verify = function verify(message) { + PredictResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify(message.results[i]); if (error) - return "errorSamples." + error; + return "results." + error; } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2beta.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; return null; }; /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse */ - ExportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ExportUserEventsResponse) + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse) return object; - var message = new $root.google.cloud.retail.v2beta.ExportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + var message = new $root.google.cloud.retail.v2beta.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.fromObject(object.results[i]); } } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @static - * @param {google.cloud.retail.v2beta.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {google.cloud.retail.v2beta.PredictResponse} message PredictResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportUserEventsResponse.toObject = function toObject(message, options) { + PredictResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; return object; }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this PredictResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @memberof google.cloud.retail.v2beta.PredictResponse * @instance * @returns {Object.} JSON object */ - ExportUserEventsResponse.prototype.toJSON = function toJSON() { + PredictResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportUserEventsResponse; + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2beta.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2beta.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2beta.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; })(); - v2beta.PredictionService = (function() { + v2beta.ProductService = (function() { /** - * Constructs a new PredictionService service. + * Constructs a new ProductService service. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictionService + * @classdesc Represents a ProductService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + function ProductService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; /** - * Creates new PredictionService service using the specified rpc implementation. + * Creates new ProductService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2beta.PredictionService + * @memberof google.cloud.retail.v2beta.ProductService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. - * @memberof google.cloud.retail.v2beta.PredictionService - * @typedef PredictCallback + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef CreateProductCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse + * @param {google.cloud.retail.v2beta.Product} [response] Product */ /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2beta.PredictionService + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2beta.ProductService * @instance - * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product * @returns {undefined} * @variation 1 */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); - }, "name", { value: "Predict" }); + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2beta.CreateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "CreateProduct" }); /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2beta.PredictionService + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2beta.ProductService * @instance - * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return PredictionService; - })(); + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ - v2beta.PredictRequest = (function() { + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2beta.GetProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "GetProduct" }); /** - * Properties of a PredictRequest. - * @memberof google.cloud.retail.v2beta - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ /** - * Constructs a new PredictRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest - * @constructor - * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListProductsResponse} [response] ListProductsResponse + */ + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2beta.ListProductsRequest, $root.google.cloud.retail.v2beta.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2beta.UpdateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2beta.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2beta.ProductService * @instance + * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.placement = ""; + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2beta.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2beta.ProductService * @instance + * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.userEvent = null; /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - PredictRequest.prototype.pageSize = 0; /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2beta.ProductService * @instance + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.pageToken = ""; + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2beta.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2beta.ProductService * @instance + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.filter = ""; /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2beta.PredictRequest - * @instance + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - PredictRequest.prototype.validateOnly = false; /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService * @instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.params = $util.emptyObject; + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService * @instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.labels = $util.emptyObject; /** - * Creates a new PredictRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); - }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - PredictRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); - return writer; - }; + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; /** - * Decodes a PredictRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addLocalInventories}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - PredictRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); - break; - case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2beta.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); /** - * Verifies a PredictRequest message. - * @function verify - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; - } - return null; - }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeLocalInventories}. + * @memberof google.cloud.retail.v2beta.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PredictRequest) - return object; - var message = new $root.google.cloud.retail.v2beta.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.fromObject(object.userEvent); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); - } - return message; - }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {google.cloud.retail.v2beta.PredictRequest} message PredictRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2beta.ProductService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2beta.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - PredictRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } - if (options.defaults) { - object.placement = ""; - object.userEvent = null; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2beta.UserEvent.toObject(message.userEvent, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); - } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; - } - return object; - }; + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); /** - * Converts this PredictRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PredictRequest + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2beta.ProductService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - return PredictRequest; + return ProductService; })(); - v2beta.PredictResponse = (function() { + v2beta.CreateProductRequest = (function() { /** - * Properties of a PredictResponse. + * Properties of a CreateProductRequest. * @memberof google.cloud.retail.v2beta - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2beta.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId */ /** - * Constructs a new PredictResponse. + * Constructs a new CreateProductRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest * @constructor - * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function CreateProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -69388,120 +82189,101 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2beta.PredictResponse - * @instance - */ - PredictResponse.prototype.results = $util.emptyArray; - - /** - * PredictResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2beta.PredictResponse + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @instance */ - PredictResponse.prototype.attributionToken = ""; + CreateProductRequest.prototype.parent = ""; /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2beta.PredictResponse + * CreateProductRequest product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @instance */ - PredictResponse.prototype.missingIds = $util.emptyArray; + CreateProductRequest.prototype.product = null; /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2beta.PredictResponse + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @instance */ - PredictResponse.prototype.validateOnly = false; + CreateProductRequest.prototype.productId = ""; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new CreateProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + CreateProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.verify|verify} messages. + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a CreateProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + CreateProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.attributionToken = reader.string(); + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); break; case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); + message.productId = reader.string(); break; default: reader.skipType(tag & 7); @@ -69512,749 +82294,558 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies a CreateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + CreateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse) + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateProductRequest) return object; - var message = new $root.google.cloud.retail.v2beta.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.fromObject(object.results[i]); - } - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); + var message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); + if (object.productId != null) + message.productId = String(object.productId); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @static - * @param {google.cloud.retail.v2beta.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2beta.CreateProductRequest} message CreateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + CreateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; - } if (options.defaults) { - object.attributionToken = ""; - object.validateOnly = false; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.toObject(message.results[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + object.parent = ""; + object.product = null; + object.productId = ""; } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this CreateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PredictResponse + * @memberof google.cloud.retail.v2beta.CreateProductRequest * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + CreateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PredictResponse.PredictionResult = (function() { - - /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2beta.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata - */ - - /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2beta.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.id = ""; - - /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.metadata = $util.emptyObject; - - /** - * Creates a new PredictionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult instance - */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); - }; - - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictResponse.PredictionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PredictionResult message. - * @function verify - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PredictionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); - if (error) - return "metadata." + error; - } - } - return null; - }; - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictResponse.PredictionResult} PredictionResult - */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult) - return object; - var message = new $root.google.cloud.retail.v2beta.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2beta.PredictResponse.PredictionResult} message PredictionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PredictionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.metadata = {}; - if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); - } - return object; - }; - - /** - * Converts this PredictionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult - * @instance - * @returns {Object.} JSON object - */ - PredictionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PredictionResult; - })(); - - return PredictResponse; + return CreateProductRequest; })(); - v2beta.ProductService = (function() { + v2beta.GetProductRequest = (function() { /** - * Constructs a new ProductService service. + * Properties of a GetProductRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ProductService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; - - /** - * Creates new ProductService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2beta.ProductService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. - */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2beta.CreateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); - }, "name", { value: "CreateProduct" }); - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Product} [response] Product + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2beta.ProductService + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetProductRequest * @instance - * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2beta.GetProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); - }, "name", { value: "GetProduct" }); + GetProductRequest.prototype.name = ""; /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest instance */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.ListProductsResponse} [response] ListProductsResponse + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.retail.v2beta.ListProductsRequest, $root.google.cloud.retail.v2beta.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.Product} [response] Product + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2beta.UpdateProductRequest, $root.google.cloud.retail.v2beta.Product, request, callback); - }, "name", { value: "UpdateProduct" }); + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {google.cloud.retail.v2beta.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2beta.ProductService + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetProductRequest * @instance - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 + * @returns {Object.} JSON object */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2beta.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProductRequest; + })(); + + v2beta.UpdateProductRequest = (function() { /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2beta.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2beta.ProductService + * UpdateProductRequest product. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2beta.UpdateProductRequest * @instance - * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2beta.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); + UpdateProductRequest.prototype.product = null; /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2beta.ProductService + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateProductRequest * @instance - * @param {google.cloud.retail.v2beta.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + UpdateProductRequest.prototype.updateMask = null; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef SetInventoryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * UpdateProductRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @instance */ + UpdateProductRequest.prototype.allowMissing = false; /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest instance */ - Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { - return this.rpcCall(setInventory, $root.google.cloud.retail.v2beta.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "SetInventory" }); + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + return writer; + }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef AddFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { - return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddFulfillmentPlaces" }); + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. - * @memberof google.cloud.retail.v2beta.ProductService - * @typedef RemoveFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Verifies an UpdateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest */ + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2beta.ProductService - * @instance - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateProductRequest} message UpdateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { - return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveFulfillmentPlaces" }); + UpdateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.updateMask = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2beta.ProductService + * Converts this UpdateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateProductRequest * @instance - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + UpdateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return ProductService; + return UpdateProductRequest; })(); - v2beta.CreateProductRequest = (function() { + v2beta.DeleteProductRequest = (function() { /** - * Properties of a CreateProductRequest. + * Properties of a DeleteProductRequest. * @memberof google.cloud.retail.v2beta - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2beta.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name */ /** - * Constructs a new CreateProductRequest. + * Constructs a new DeleteProductRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest * @constructor - * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set */ - function CreateProductRequest(properties) { + function DeleteProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -70262,101 +82853,75 @@ } /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.product = null; - - /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @instance */ - CreateProductRequest.prototype.productId = ""; + DeleteProductRequest.prototype.name = ""; /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new DeleteProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest instance + * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest instance */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); }; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encode = function encode(message, writer) { + DeleteProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateProductRequest.verify|verify} messages. + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decode = function decode(reader, length) { + DeleteProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 3: - message.productId = reader.string(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -70367,129 +82932,111 @@ }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProductRequest message. + * Verifies a DeleteProductRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProductRequest.verify = function verify(message) { + DeleteProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.CreateProductRequest) + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.DeleteProductRequest) return object; - var message = new $root.google.cloud.retail.v2beta.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); - } - if (object.productId != null) - message.productId = String(object.productId); + var message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @static - * @param {google.cloud.retail.v2beta.CreateProductRequest} message CreateProductRequest + * @param {google.cloud.retail.v2beta.DeleteProductRequest} message DeleteProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProductRequest.toObject = function toObject(message, options) { + DeleteProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this CreateProductRequest to JSON. + * Converts this DeleteProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @memberof google.cloud.retail.v2beta.DeleteProductRequest * @instance * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { + DeleteProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateProductRequest; + return DeleteProductRequest; })(); - v2beta.GetProductRequest = (function() { + v2beta.ListProductsRequest = (function() { /** - * Properties of a GetProductRequest. + * Properties of a ListProductsRequest. * @memberof google.cloud.retail.v2beta - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask */ /** - * Constructs a new GetProductRequest. + * Constructs a new ListProductsRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest * @constructor - * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IListProductsRequest=} [properties] Properties to set */ - function GetProductRequest(properties) { + function ListProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -70497,75 +83044,127 @@ } /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.GetProductRequest + * ListProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @instance */ - GetProductRequest.prototype.name = ""; + ListProductsRequest.prototype.parent = ""; /** - * Creates a new GetProductRequest instance using the specified properties. + * ListProductsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageSize = 0; + + /** + * ListProductsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageToken = ""; + + /** + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.filter = ""; + + /** + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * Creates a new ListProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static - * @param {google.cloud.retail.v2beta.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest instance + * @param {google.cloud.retail.v2beta.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest instance */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static - * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encode = function encode(message, writer) { + ListProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetProductRequest.verify|verify} messages. + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static - * @param {google.cloud.retail.v2beta.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a ListProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + ListProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -70576,109 +83175,147 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a ListProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + ListProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (error) + return "readMask." + error; + } return null; }; /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.GetProductRequest) + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListProductsRequest) return object; - var message = new $root.google.cloud.retail.v2beta.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2beta.ListProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + } return message; }; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @static - * @param {google.cloud.retail.v2beta.GetProductRequest} message GetProductRequest + * @param {google.cloud.retail.v2beta.ListProductsRequest} message ListProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProductRequest.toObject = function toObject(message, options) { + ListProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.readMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); return object; }; /** - * Converts this GetProductRequest to JSON. + * Converts this ListProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.GetProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsRequest * @instance * @returns {Object.} JSON object */ - GetProductRequest.prototype.toJSON = function toJSON() { + ListProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetProductRequest; + return ListProductsRequest; })(); - v2beta.UpdateProductRequest = (function() { + v2beta.ListProductsResponse = (function() { /** - * Properties of an UpdateProductRequest. + * Properties of a ListProductsResponse. * @memberof google.cloud.retail.v2beta - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2beta.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken */ /** - * Constructs a new UpdateProductRequest. + * Constructs a new ListProductsResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse * @constructor - * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IListProductsResponse=} [properties] Properties to set */ - function UpdateProductRequest(properties) { + function ListProductsResponse(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -70686,101 +83323,91 @@ } /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @instance */ - UpdateProductRequest.prototype.updateMask = null; + ListProductsResponse.prototype.products = $util.emptyArray; /** - * UpdateProductRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * ListProductsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @instance */ - UpdateProductRequest.prototype.allowMissing = false; + ListProductsResponse.prototype.nextPageToken = ""; /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new ListProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static - * @param {google.cloud.retail.v2beta.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest instance + * @param {google.cloud.retail.v2beta.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse instance */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); }; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encode = function encode(message, writer) { + ListProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateProductRequest.verify|verify} messages. + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static - * @param {google.cloud.retail.v2beta.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a ListProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decode = function decode(reader, length) { + ListProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -70791,134 +83418,136 @@ }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateProductRequest message. + * Verifies a ListProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateProductRequest.verify = function verify(message) { + ListProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); + if (error) + return "products." + error; + } } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.UpdateProductRequest) + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListProductsResponse) return object; - var message = new $root.google.cloud.retail.v2beta.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + var message = new $root.google.cloud.retail.v2beta.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2beta.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); + } } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @static - * @param {google.cloud.retail.v2beta.UpdateProductRequest} message UpdateProductRequest + * @param {google.cloud.retail.v2beta.ListProductsResponse} message ListProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateProductRequest.toObject = function toObject(message, options) { + ListProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - object.allowMissing = false; + if (options.arrays || options.defaults) + object.products = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this ListProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @memberof google.cloud.retail.v2beta.ListProductsResponse * @instance * @returns {Object.} JSON object */ - UpdateProductRequest.prototype.toJSON = function toJSON() { + ListProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateProductRequest; + return ListProductsResponse; })(); - v2beta.DeleteProductRequest = (function() { + v2beta.SetInventoryRequest = (function() { /** - * Properties of a DeleteProductRequest. + * Properties of a SetInventoryRequest. * @memberof google.cloud.retail.v2beta - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2beta.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing */ /** - * Constructs a new DeleteProductRequest. + * Constructs a new SetInventoryRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest * @constructor - * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ISetInventoryRequest=} [properties] Properties to set */ - function DeleteProductRequest(properties) { + function SetInventoryRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -70926,75 +83555,114 @@ } /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2beta.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @instance */ - DeleteProductRequest.prototype.name = ""; + SetInventoryRequest.prototype.inventory = null; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setMask = null; + + /** + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static - * @param {google.cloud.retail.v2beta.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest instance + * @param {google.cloud.retail.v2beta.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest instance */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); }; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encode = function encode(message, writer) { + SetInventoryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2beta.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); return writer; }; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteProductRequest.verify|verify} messages. + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static - * @param {google.cloud.retail.v2beta.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decode = function decode(reader, length) { + SetInventoryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.inventory = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + case 2: + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -71005,111 +83673,146 @@ }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProductRequest message. + * Verifies a SetInventoryRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProductRequest.verify = function verify(message) { + SetInventoryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2beta.Product.verify(message.inventory); + if (error) + return "inventory." + error; + } + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); + if (error) + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.DeleteProductRequest) + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryRequest) return object; - var message = new $root.google.cloud.retail.v2beta.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2beta.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2beta.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @static - * @param {google.cloud.retail.v2beta.DeleteProductRequest} message DeleteProductRequest + * @param {google.cloud.retail.v2beta.SetInventoryRequest} message SetInventoryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProductRequest.toObject = function toObject(message, options) { + SetInventoryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2beta.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this SetInventoryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @memberof google.cloud.retail.v2beta.SetInventoryRequest * @instance * @returns {Object.} JSON object */ - DeleteProductRequest.prototype.toJSON = function toJSON() { + SetInventoryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteProductRequest; + return SetInventoryRequest; })(); - v2beta.ListProductsRequest = (function() { + v2beta.SetInventoryMetadata = (function() { /** - * Properties of a ListProductsRequest. + * Properties of a SetInventoryMetadata. * @memberof google.cloud.retail.v2beta - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - * @property {string|null} [filter] ListProductsRequest filter - * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + * @interface ISetInventoryMetadata */ /** - * Constructs a new ListProductsRequest. + * Constructs a new SetInventoryMetadata. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata * @constructor - * @param {google.cloud.retail.v2beta.IListProductsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata=} [properties] Properties to set */ - function ListProductsRequest(properties) { + function SetInventoryMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -71117,128 +83820,63 @@ } /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; - - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; - - /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageToken = ""; - - /** - * ListProductsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.filter = ""; - - /** - * ListProductsRequest readMask. - * @member {google.protobuf.IFieldMask|null|undefined} readMask - * @memberof google.cloud.retail.v2beta.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.readMask = null; - - /** - * Creates a new ListProductsRequest instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2beta.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest instance + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata instance */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); }; /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2beta.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsRequest.encode = function encode(message, writer) { + SetInventoryMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) - $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsRequest.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2beta.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decode = function decode(reader, length) { + SetInventoryMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -71248,147 +83886,93 @@ }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsRequest message. + * Verifies a SetInventoryMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsRequest.verify = function verify(message) { + SetInventoryMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.readMask != null && message.hasOwnProperty("readMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.readMask); - if (error) - return "readMask." + error; - } return null; }; /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ListProductsRequest} ListProductsRequest - */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ListProductsRequest) - return object; - var message = new $root.google.cloud.retail.v2beta.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.readMask != null) { - if (typeof object.readMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.ListProductsRequest.readMask: object expected"); - message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); - } - return message; + * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + */ + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryMetadata) + return object; + return new $root.google.cloud.retail.v2beta.SetInventoryMetadata(); }; /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2beta.ListProductsRequest} message ListProductsRequest + * @param {google.cloud.retail.v2beta.SetInventoryMetadata} message SetInventoryMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.readMask = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.readMask != null && message.hasOwnProperty("readMask")) - object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); - return object; + SetInventoryMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this ListProductsRequest to JSON. + * Converts this SetInventoryMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata * @instance * @returns {Object.} JSON object */ - ListProductsRequest.prototype.toJSON = function toJSON() { + SetInventoryMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProductsRequest; + return SetInventoryMetadata; })(); - v2beta.ListProductsResponse = (function() { + v2beta.SetInventoryResponse = (function() { /** - * Properties of a ListProductsResponse. + * Properties of a SetInventoryResponse. * @memberof google.cloud.retail.v2beta - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + * @interface ISetInventoryResponse */ /** - * Constructs a new ListProductsResponse. + * Constructs a new SetInventoryResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse * @constructor - * @param {google.cloud.retail.v2beta.IListProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.ISetInventoryResponse=} [properties] Properties to set */ - function ListProductsResponse(properties) { - this.products = []; + function SetInventoryResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -71396,92 +83980,63 @@ } /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.retail.v2beta.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2beta.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsResponse instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static - * @param {google.cloud.retail.v2beta.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse instance + * @param {google.cloud.retail.v2beta.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse instance */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); }; /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static - * @param {google.cloud.retail.v2beta.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encode = function encode(message, writer) { + SetInventoryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2beta.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListProductsResponse.verify|verify} messages. + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static - * @param {google.cloud.retail.v2beta.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decode = function decode(reader, length) { + SetInventoryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -71491,136 +84046,99 @@ }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsResponse message. + * Verifies a SetInventoryResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsResponse.verify = function verify(message) { + SetInventoryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; return null; }; /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.ListProductsResponse) + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryResponse) return object; - var message = new $root.google.cloud.retail.v2beta.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2beta.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; + return new $root.google.cloud.retail.v2beta.SetInventoryResponse(); }; /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @static - * @param {google.cloud.retail.v2beta.ListProductsResponse} message ListProductsResponse + * @param {google.cloud.retail.v2beta.SetInventoryResponse} message SetInventoryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2beta.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; + SetInventoryResponse.toObject = function toObject() { + return {}; }; /** - * Converts this ListProductsResponse to JSON. + * Converts this SetInventoryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @memberof google.cloud.retail.v2beta.SetInventoryResponse * @instance * @returns {Object.} JSON object */ - ListProductsResponse.prototype.toJSON = function toJSON() { + SetInventoryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProductsResponse; + return SetInventoryResponse; })(); - v2beta.SetInventoryRequest = (function() { + v2beta.AddFulfillmentPlacesRequest = (function() { /** - * Properties of a SetInventoryRequest. + * Properties of an AddFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2beta - * @interface ISetInventoryRequest - * @property {google.cloud.retail.v2beta.IProduct|null} [inventory] SetInventoryRequest inventory - * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask - * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime - * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new SetInventoryRequest. + * Constructs a new AddFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SetInventoryRequest. - * @implements ISetInventoryRequest + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2beta.ISetInventoryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest=} [properties] Properties to set */ - function SetInventoryRequest(properties) { + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -71628,113 +84146,129 @@ } /** - * SetInventoryRequest inventory. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} inventory - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @instance */ - SetInventoryRequest.prototype.inventory = null; + AddFulfillmentPlacesRequest.prototype.product = ""; /** - * SetInventoryRequest setMask. - * @member {google.protobuf.IFieldMask|null|undefined} setMask - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @instance */ - SetInventoryRequest.prototype.setMask = null; + AddFulfillmentPlacesRequest.prototype.type = ""; /** - * SetInventoryRequest setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @instance */ - SetInventoryRequest.prototype.setTime = null; + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * SetInventoryRequest allowMissing. + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.addTime = null; + + /** + * AddFulfillmentPlacesRequest allowMissing. * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @instance */ - SetInventoryRequest.prototype.allowMissing = false; + AddFulfillmentPlacesRequest.prototype.allowMissing = false; /** - * Creates a new SetInventoryRequest instance using the specified properties. + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.ISetInventoryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance */ - SetInventoryRequest.create = function create(properties) { - return new SetInventoryRequest(properties); + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encode = function encode(message, writer) { + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) - $root.google.cloud.retail.v2beta.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) - $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryRequest.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decode = function decode(reader, length) { + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inventory = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + message.product = reader.string(); break; case 2: - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.type = reader.string(); break; case 3: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; case 4: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: message.allowMissing = reader.bool(); break; default: @@ -71746,46 +84280,49 @@ }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryRequest message. + * Verifies an AddFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryRequest.verify = function verify(message) { + AddFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inventory != null && message.hasOwnProperty("inventory")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.inventory); - if (error) - return "inventory." + error; - } - if (message.setMask != null && message.hasOwnProperty("setMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.setMask); - if (error) - return "setMask." + error; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; } - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); if (error) - return "setTime." + error; + return "addTime." + error; } if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) if (typeof message.allowMissing !== "boolean") @@ -71794,31 +84331,32 @@ }; /** - * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest */ - SetInventoryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryRequest) + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest) return object; - var message = new $root.google.cloud.retail.v2beta.SetInventoryRequest(); - if (object.inventory != null) { - if (typeof object.inventory !== "object") - throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.inventory: object expected"); - message.inventory = $root.google.cloud.retail.v2beta.Product.fromObject(object.inventory); - } - if (object.setMask != null) { - if (typeof object.setMask !== "object") - throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.setMask: object expected"); - message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + var message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); } - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.SetInventoryRequest.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); } if (object.allowMissing != null) message.allowMissing = Boolean(object.allowMissing); @@ -71826,66 +84364,73 @@ }; /** - * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.SetInventoryRequest} message SetInventoryRequest + * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryRequest.toObject = function toObject(message, options) { + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) { - object.inventory = null; - object.setMask = null; - object.setTime = null; + object.product = ""; + object.type = ""; + object.addTime = null; object.allowMissing = false; } - if (message.inventory != null && message.hasOwnProperty("inventory")) - object.inventory = $root.google.cloud.retail.v2beta.Product.toObject(message.inventory, options); - if (message.setMask != null && message.hasOwnProperty("setMask")) - object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) object.allowMissing = message.allowMissing; return object; }; /** - * Converts this SetInventoryRequest to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - SetInventoryRequest.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryRequest; + return AddFulfillmentPlacesRequest; })(); - v2beta.SetInventoryMetadata = (function() { + v2beta.AddFulfillmentPlacesMetadata = (function() { /** - * Properties of a SetInventoryMetadata. + * Properties of an AddFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2beta - * @interface ISetInventoryMetadata + * @interface IAddFulfillmentPlacesMetadata */ /** - * Constructs a new SetInventoryMetadata. + * Constructs a new AddFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SetInventoryMetadata. - * @implements ISetInventoryMetadata + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2beta.ISetInventoryMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata=} [properties] Properties to set */ - function SetInventoryMetadata(properties) { + function AddFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -71893,60 +84438,60 @@ } /** - * Creates a new SetInventoryMetadata instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.ISetInventoryMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance */ - SetInventoryMetadata.create = function create(properties) { - return new SetInventoryMetadata(properties); + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encode = function encode(message, writer) { + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decode = function decode(reader, length) { + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -71959,93 +84504,93 @@ }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryMetadata message. + * Verifies an AddFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryMetadata.verify = function verify(message) { + AddFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata */ - SetInventoryMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryMetadata) + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata) return object; - return new $root.google.cloud.retail.v2beta.SetInventoryMetadata(); + return new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.SetInventoryMetadata} message SetInventoryMetadata + * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryMetadata.toObject = function toObject() { + AddFulfillmentPlacesMetadata.toObject = function toObject() { return {}; }; /** - * Converts this SetInventoryMetadata to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - SetInventoryMetadata.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryMetadata; + return AddFulfillmentPlacesMetadata; })(); - v2beta.SetInventoryResponse = (function() { + v2beta.AddFulfillmentPlacesResponse = (function() { /** - * Properties of a SetInventoryResponse. + * Properties of an AddFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2beta - * @interface ISetInventoryResponse + * @interface IAddFulfillmentPlacesResponse */ /** - * Constructs a new SetInventoryResponse. + * Constructs a new AddFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SetInventoryResponse. - * @implements ISetInventoryResponse + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse * @constructor - * @param {google.cloud.retail.v2beta.ISetInventoryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse=} [properties] Properties to set */ - function SetInventoryResponse(properties) { + function AddFulfillmentPlacesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -72053,60 +84598,60 @@ } /** - * Creates a new SetInventoryResponse instance using the specified properties. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.ISetInventoryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse instance + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance */ - SetInventoryResponse.create = function create(properties) { - return new SetInventoryResponse(properties); + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); }; /** - * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryResponse.encode = function encode(message, writer) { + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SetInventoryResponse.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryResponse.decode = function decode(reader, length) { + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SetInventoryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -72119,99 +84664,99 @@ }; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryResponse message. + * Verifies an AddFulfillmentPlacesResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryResponse.verify = function verify(message) { + AddFulfillmentPlacesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse */ - SetInventoryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SetInventoryResponse) + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse) return object; - return new $root.google.cloud.retail.v2beta.SetInventoryResponse(); + return new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse(); }; /** - * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.SetInventoryResponse} message SetInventoryResponse + * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryResponse.toObject = function toObject() { + AddFulfillmentPlacesResponse.toObject = function toObject() { return {}; }; /** - * Converts this SetInventoryResponse to JSON. + * Converts this AddFulfillmentPlacesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse * @instance * @returns {Object.} JSON object */ - SetInventoryResponse.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryResponse; + return AddFulfillmentPlacesResponse; })(); - v2beta.AddFulfillmentPlacesRequest = (function() { + v2beta.AddLocalInventoriesRequest = (function() { /** - * Properties of an AddFulfillmentPlacesRequest. + * Properties of an AddLocalInventoriesRequest. * @memberof google.cloud.retail.v2beta - * @interface IAddFulfillmentPlacesRequest - * @property {string|null} [product] AddFulfillmentPlacesRequest product - * @property {string|null} [type] AddFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime - * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing */ /** - * Constructs a new AddFulfillmentPlacesRequest. + * Constructs a new AddLocalInventoriesRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an AddFulfillmentPlacesRequest. - * @implements IAddFulfillmentPlacesRequest + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest * @constructor - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesRequest=} [properties] Properties to set */ - function AddFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -72219,111 +84764,111 @@ } /** - * AddFulfillmentPlacesRequest product. + * AddLocalInventoriesRequest product. * @member {string} product - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.product = ""; + AddLocalInventoriesRequest.prototype.product = ""; /** - * AddFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.type = ""; + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; /** - * AddFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + AddLocalInventoriesRequest.prototype.addMask = null; /** - * AddFulfillmentPlacesRequest addTime. + * AddLocalInventoriesRequest addTime. * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.addTime = null; + AddLocalInventoriesRequest.prototype.addTime = null; /** - * AddFulfillmentPlacesRequest allowMissing. + * AddLocalInventoriesRequest allowMissing. * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.allowMissing = false; + AddLocalInventoriesRequest.prototype.allowMissing = false; /** - * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * Creates a new AddLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance */ - AddFulfillmentPlacesRequest.create = function create(properties) { - return new AddFulfillmentPlacesRequest(properties); + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); }; /** - * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + AddLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.product != null && Object.hasOwnProperty.call(message, "product")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2beta.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + AddLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -72331,17 +84876,17 @@ message.product = reader.string(); break; case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2beta.LocalInventory.decode(reader, reader.uint32())); break; case 4: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; case 5: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: message.allowMissing = reader.bool(); break; default: @@ -72353,44 +84898,48 @@ }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesRequest message. + * Verifies an AddLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesRequest.verify = function verify(message) { + AddLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.product != null && message.hasOwnProperty("product")) if (!$util.isString(message.product)) return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2beta.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); + if (error) + return "addMask." + error; } if (message.addTime != null && message.hasOwnProperty("addTime")) { var error = $root.google.protobuf.Timestamp.verify(message.addTime); @@ -72404,31 +84953,37 @@ }; /** - * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesRequest} AddLocalInventoriesRequest */ - AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest) + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddLocalInventoriesRequest) return object; - var message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest(); + var message = new $root.google.cloud.retail.v2beta.AddLocalInventoriesRequest(); if (object.product != null) message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2beta.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2beta.LocalInventory.fromObject(object.localInventories[i]); + } + } + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); } if (object.addTime != null) { if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.addTime: object expected"); + throw TypeError(".google.cloud.retail.v2beta.AddLocalInventoriesRequest.addTime: object expected"); message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); } if (object.allowMissing != null) @@ -72437,35 +84992,35 @@ }; /** - * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {google.cloud.retail.v2beta.AddLocalInventoriesRequest} message AddLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + AddLocalInventoriesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.placeIds = []; + object.localInventories = []; if (options.defaults) { object.product = ""; - object.type = ""; + object.addMask = null; object.addTime = null; object.allowMissing = false; } if (message.product != null && message.hasOwnProperty("product")) object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2beta.LocalInventory.toObject(message.localInventories[j], options); } + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); if (message.addTime != null && message.hasOwnProperty("addTime")) object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) @@ -72474,36 +85029,36 @@ }; /** - * Converts this AddFulfillmentPlacesRequest to JSON. + * Converts this AddLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesRequest; + return AddLocalInventoriesRequest; })(); - v2beta.AddFulfillmentPlacesMetadata = (function() { + v2beta.AddLocalInventoriesMetadata = (function() { /** - * Properties of an AddFulfillmentPlacesMetadata. + * Properties of an AddLocalInventoriesMetadata. * @memberof google.cloud.retail.v2beta - * @interface IAddFulfillmentPlacesMetadata + * @interface IAddLocalInventoriesMetadata */ /** - * Constructs a new AddFulfillmentPlacesMetadata. + * Constructs a new AddLocalInventoriesMetadata. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an AddFulfillmentPlacesMetadata. - * @implements IAddFulfillmentPlacesMetadata + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata * @constructor - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesMetadata=} [properties] Properties to set */ - function AddFulfillmentPlacesMetadata(properties) { + function AddLocalInventoriesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -72511,60 +85066,60 @@ } /** - * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance */ - AddFulfillmentPlacesMetadata.create = function create(properties) { - return new AddFulfillmentPlacesMetadata(properties); + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); }; /** - * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { + AddLocalInventoriesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { + AddLocalInventoriesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddLocalInventoriesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -72577,93 +85132,93 @@ }; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesMetadata message. + * Verifies an AddLocalInventoriesMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesMetadata.verify = function verify(message) { + AddLocalInventoriesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata */ - AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata) + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddLocalInventoriesMetadata) return object; - return new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata(); + return new $root.google.cloud.retail.v2beta.AddLocalInventoriesMetadata(); }; /** - * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2beta.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesMetadata.toObject = function toObject() { + AddLocalInventoriesMetadata.toObject = function toObject() { return {}; }; /** - * Converts this AddFulfillmentPlacesMetadata to JSON. + * Converts this AddLocalInventoriesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesMetadata; + return AddLocalInventoriesMetadata; })(); - v2beta.AddFulfillmentPlacesResponse = (function() { + v2beta.AddLocalInventoriesResponse = (function() { /** - * Properties of an AddFulfillmentPlacesResponse. + * Properties of an AddLocalInventoriesResponse. * @memberof google.cloud.retail.v2beta - * @interface IAddFulfillmentPlacesResponse + * @interface IAddLocalInventoriesResponse */ /** - * Constructs a new AddFulfillmentPlacesResponse. + * Constructs a new AddLocalInventoriesResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents an AddFulfillmentPlacesResponse. - * @implements IAddFulfillmentPlacesResponse + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse * @constructor - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesResponse=} [properties] Properties to set */ - function AddFulfillmentPlacesResponse(properties) { + function AddLocalInventoriesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -72671,60 +85226,60 @@ } /** - * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * Creates a new AddLocalInventoriesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance */ - AddFulfillmentPlacesResponse.create = function create(properties) { - return new AddFulfillmentPlacesResponse(properties); + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); }; /** - * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + AddLocalInventoriesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddLocalInventoriesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesResponse} AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + AddLocalInventoriesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddLocalInventoriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -72737,211 +85292,200 @@ }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesResponse} AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesResponse message. + * Verifies an AddLocalInventoriesResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesResponse.verify = function verify(message) { + AddLocalInventoriesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2beta.AddLocalInventoriesResponse} AddLocalInventoriesResponse */ - AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse) + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddLocalInventoriesResponse) return object; - return new $root.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse(); + return new $root.google.cloud.retail.v2beta.AddLocalInventoriesResponse(); }; /** - * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {google.cloud.retail.v2beta.AddLocalInventoriesResponse} message AddLocalInventoriesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesResponse.toObject = function toObject() { + AddLocalInventoriesResponse.toObject = function toObject() { return {}; }; /** - * Converts this AddFulfillmentPlacesResponse to JSON. + * Converts this AddLocalInventoriesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesResponse; + return AddLocalInventoriesResponse; })(); - v2beta.RemoveFulfillmentPlacesRequest = (function() { + v2beta.RemoveLocalInventoriesRequest = (function() { /** - * Properties of a RemoveFulfillmentPlacesRequest. + * Properties of a RemoveLocalInventoriesRequest. * @memberof google.cloud.retail.v2beta - * @interface IRemoveFulfillmentPlacesRequest - * @property {string|null} [product] RemoveFulfillmentPlacesRequest product - * @property {string|null} [type] RemoveFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing */ /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new RemoveLocalInventoriesRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a RemoveFulfillmentPlacesRequest. - * @implements IRemoveFulfillmentPlacesRequest + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest * @constructor - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest=} [properties] Properties to set */ - function RemoveFulfillmentPlacesRequest(properties) { + function RemoveLocalInventoriesRequest(properties) { this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; - } - - /** - * RemoveFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.product = ""; + } /** - * RemoveFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.type = ""; + RemoveLocalInventoriesRequest.prototype.product = ""; /** - * RemoveFulfillmentPlacesRequest placeIds. + * RemoveLocalInventoriesRequest placeIds. * @member {Array.} placeIds - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; /** - * RemoveFulfillmentPlacesRequest removeTime. + * RemoveLocalInventoriesRequest removeTime. * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + RemoveLocalInventoriesRequest.prototype.removeTime = null; /** - * RemoveFulfillmentPlacesRequest allowMissing. + * RemoveLocalInventoriesRequest allowMissing. * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + RemoveLocalInventoriesRequest.prototype.allowMissing = false; /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance */ - RemoveFulfillmentPlacesRequest.create = function create(properties) { - return new RemoveFulfillmentPlacesRequest(properties); + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.product != null && Object.hasOwnProperty.call(message, "product")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); if (message.placeIds != null && message.placeIds.length) for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -72949,17 +85493,14 @@ message.product = reader.string(); break; case 2: - message.type = reader.string(); - break; - case 3: if (!(message.placeIds && message.placeIds.length)) message.placeIds = []; message.placeIds.push(reader.string()); break; - case 4: + case 5: message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; - case 5: + case 3: message.allowMissing = reader.bool(); break; default: @@ -72971,38 +85512,35 @@ }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies a RemoveLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesRequest.verify = function verify(message) { + RemoveLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.product != null && message.hasOwnProperty("product")) if (!$util.isString(message.product)) return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; if (message.placeIds != null && message.hasOwnProperty("placeIds")) { if (!Array.isArray(message.placeIds)) return "placeIds: array expected"; @@ -73022,31 +85560,29 @@ }; /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest */ - RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest) + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest) return object; - var message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest(); + var message = new $root.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest(); if (object.product != null) message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); if (object.placeIds) { if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + throw TypeError(".google.cloud.retail.v2beta.RemoveLocalInventoriesRequest.placeIds: array expected"); message.placeIds = []; for (var i = 0; i < object.placeIds.length; ++i) message.placeIds[i] = String(object.placeIds[i]); } if (object.removeTime != null) { if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + throw TypeError(".google.cloud.retail.v2beta.RemoveLocalInventoriesRequest.removeTime: object expected"); message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); } if (object.allowMissing != null) @@ -73055,15 +85591,15 @@ }; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {google.cloud.retail.v2beta.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -73071,57 +85607,54 @@ object.placeIds = []; if (options.defaults) { object.product = ""; - object.type = ""; - object.removeTime = null; object.allowMissing = false; + object.removeTime = null; } if (message.product != null && message.hasOwnProperty("product")) object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; if (message.placeIds && message.placeIds.length) { object.placeIds = []; for (var j = 0; j < message.placeIds.length; ++j) object.placeIds[j] = message.placeIds[j]; } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); return object; }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this RemoveLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesRequest; + return RemoveLocalInventoriesRequest; })(); - v2beta.RemoveFulfillmentPlacesMetadata = (function() { + v2beta.RemoveLocalInventoriesMetadata = (function() { /** - * Properties of a RemoveFulfillmentPlacesMetadata. + * Properties of a RemoveLocalInventoriesMetadata. * @memberof google.cloud.retail.v2beta - * @interface IRemoveFulfillmentPlacesMetadata + * @interface IRemoveLocalInventoriesMetadata */ /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new RemoveLocalInventoriesMetadata. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a RemoveFulfillmentPlacesMetadata. - * @implements IRemoveFulfillmentPlacesMetadata + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata * @constructor - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata=} [properties] Properties to set */ - function RemoveFulfillmentPlacesMetadata(properties) { + function RemoveLocalInventoriesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73129,60 +85662,60 @@ } /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance */ - RemoveFulfillmentPlacesMetadata.create = function create(properties) { - return new RemoveFulfillmentPlacesMetadata(properties); + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -73195,93 +85728,93 @@ }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesMetadata message. + * Verifies a RemoveLocalInventoriesMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + RemoveLocalInventoriesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata */ - RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata) + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata) return object; - return new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata(); + return new $root.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + RemoveLocalInventoriesMetadata.toObject = function toObject() { return {}; }; /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * Converts this RemoveLocalInventoriesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesMetadata; + return RemoveLocalInventoriesMetadata; })(); - v2beta.RemoveFulfillmentPlacesResponse = (function() { + v2beta.RemoveLocalInventoriesResponse = (function() { /** - * Properties of a RemoveFulfillmentPlacesResponse. + * Properties of a RemoveLocalInventoriesResponse. * @memberof google.cloud.retail.v2beta - * @interface IRemoveFulfillmentPlacesResponse + * @interface IRemoveLocalInventoriesResponse */ /** - * Constructs a new RemoveFulfillmentPlacesResponse. + * Constructs a new RemoveLocalInventoriesResponse. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a RemoveFulfillmentPlacesResponse. - * @implements IRemoveFulfillmentPlacesResponse + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse * @constructor - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse=} [properties] Properties to set */ - function RemoveFulfillmentPlacesResponse(properties) { + function RemoveLocalInventoriesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73289,60 +85822,60 @@ } /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance */ - RemoveFulfillmentPlacesResponse.create = function create(properties) { - return new RemoveFulfillmentPlacesResponse(properties); + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveLocalInventoriesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -73355,93 +85888,99 @@ }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesResponse message. + * Verifies a RemoveLocalInventoriesResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesResponse.verify = function verify(message) { + RemoveLocalInventoriesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2beta.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse */ - RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse) + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse) return object; - return new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse(); + return new $root.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {google.cloud.retail.v2beta.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesResponse.toObject = function toObject() { + RemoveLocalInventoriesResponse.toObject = function toObject() { return {}; }; /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. + * Converts this RemoveLocalInventoriesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesResponse; + return RemoveLocalInventoriesResponse; })(); - v2beta.PurgeMetadata = (function() { + v2beta.RemoveFulfillmentPlacesRequest = (function() { /** - * Properties of a PurgeMetadata. + * Properties of a RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2beta - * @interface IPurgeMetadata + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new PurgeMetadata. + * Constructs a new RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73449,264 +85988,130 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata instance - */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); - }; - - /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PurgeMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PurgeMetadata message. - * @function verify - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata - */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurgeMetadata) - return object; - return new $root.google.cloud.retail.v2beta.PurgeMetadata(); - }; - - /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PurgeMetadata - * @static - * @param {google.cloud.retail.v2beta.PurgeMetadata} message PurgeMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeMetadata.toObject = function toObject() { - return {}; - }; - - /** - * Converts this PurgeMetadata to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PurgeMetadata + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @instance - * @returns {Object.} JSON object - */ - PurgeMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PurgeMetadata; - })(); - - v2beta.PurgeUserEventsRequest = (function() { - - /** - * Properties of a PurgeUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force */ + RemoveFulfillmentPlacesRequest.prototype.product = ""; /** - * Constructs a new PurgeUserEventsRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest - * @constructor - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @instance */ - function PurgeUserEventsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + RemoveFulfillmentPlacesRequest.prototype.type = ""; /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @instance */ - PurgeUserEventsRequest.prototype.parent = ""; + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @instance */ - PurgeUserEventsRequest.prototype.filter = ""; + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @instance */ - PurgeUserEventsRequest.prototype.force = false; + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.product = reader.string(); break; case 2: - message.filter = reader.string(); + message.type = reader.string(); break; case 3: - message.force = reader.bool(); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); break; default: reader.skipType(tag & 7); @@ -73717,124 +86122,157 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a RemoveFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + RemoveFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsRequest) + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest) return object; - var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); + var message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2beta.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Converts this RemoveFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + return RemoveFulfillmentPlacesRequest; })(); - v2beta.PurgeUserEventsResponse = (function() { + v2beta.RemoveFulfillmentPlacesMetadata = (function() { /** - * Properties of a PurgeUserEventsResponse. + * Properties of a RemoveFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2beta - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * @interface IRemoveFulfillmentPlacesMetadata */ /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new RemoveFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function RemoveFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73842,76 +86280,63 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse - * @instance - */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encode = function encode(message, writer) { + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); return writer; }; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; default: reader.skipType(tag & 7); break; @@ -73921,516 +86346,157 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a RemoveFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeUserEventsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; - return null; - }; - - /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse - */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsResponse) - return object; - var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2beta.PurgeUserEventsResponse} message PurgeUserEventsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; - return object; - }; - - /** - * Converts this PurgeUserEventsResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse - * @instance - * @returns {Object.} JSON object - */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PurgeUserEventsResponse; - })(); - - v2beta.SearchService = (function() { - - /** - * Constructs a new SearchService service. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SearchService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SearchService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; - - /** - * Creates new SearchService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2beta.SearchService + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. - */ - SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. - * @memberof google.cloud.retail.v2beta.SearchService - * @typedef SearchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.SearchResponse} [response] SearchResponse - */ - - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2beta.SearchService - * @instance - * @param {google.cloud.retail.v2beta.ISearchRequest} request SearchRequest message or plain object - * @param {google.cloud.retail.v2beta.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SearchService.prototype.search = function search(request, callback) { - return this.rpcCall(search, $root.google.cloud.retail.v2beta.SearchRequest, $root.google.cloud.retail.v2beta.SearchResponse, request, callback); - }, "name", { value: "Search" }); - - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2beta.SearchService - * @instance - * @param {google.cloud.retail.v2beta.ISearchRequest} request SearchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SearchService; - })(); - - v2beta.SearchRequest = (function() { - - /** - * Properties of a SearchRequest. - * @memberof google.cloud.retail.v2beta - * @interface ISearchRequest - * @property {string|null} [placement] SearchRequest placement - * @property {string|null} [branch] SearchRequest branch - * @property {string|null} [query] SearchRequest query - * @property {string|null} [visitorId] SearchRequest visitorId - * @property {google.cloud.retail.v2beta.IUserInfo|null} [userInfo] SearchRequest userInfo - * @property {number|null} [pageSize] SearchRequest pageSize - * @property {string|null} [pageToken] SearchRequest pageToken - * @property {number|null} [offset] SearchRequest offset - * @property {string|null} [filter] SearchRequest filter - * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter - * @property {string|null} [orderBy] SearchRequest orderBy - * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs - * @property {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec - * @property {google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec - * @property {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec - * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys - * @property {Array.|null} [pageCategories] SearchRequest pageCategories - * @property {google.cloud.retail.v2beta.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode - */ - - /** - * Constructs a new SearchRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SearchRequest. - * @implements ISearchRequest - * @constructor - * @param {google.cloud.retail.v2beta.ISearchRequest=} [properties] Properties to set - */ - function SearchRequest(properties) { - this.facetSpecs = []; - this.variantRollupKeys = []; - this.pageCategories = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SearchRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.placement = ""; - - /** - * SearchRequest branch. - * @member {string} branch - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.branch = ""; - - /** - * SearchRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.query = ""; - - /** - * SearchRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.visitorId = ""; - - /** - * SearchRequest userInfo. - * @member {google.cloud.retail.v2beta.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.userInfo = null; - - /** - * SearchRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.pageSize = 0; - - /** - * SearchRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.pageToken = ""; - - /** - * SearchRequest offset. - * @member {number} offset - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.offset = 0; - - /** - * SearchRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.filter = ""; - - /** - * SearchRequest canonicalFilter. - * @member {string} canonicalFilter - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.canonicalFilter = ""; - - /** - * SearchRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.orderBy = ""; - - /** - * SearchRequest facetSpecs. - * @member {Array.} facetSpecs - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.prototype.facetSpecs = $util.emptyArray; + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; /** - * SearchRequest dynamicFacetSpec. - * @member {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata */ - SearchRequest.prototype.dynamicFacetSpec = null; + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata(); + }; /** - * SearchRequest boostSpec. - * @member {google.cloud.retail.v2beta.SearchRequest.IBoostSpec|null|undefined} boostSpec - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchRequest.prototype.boostSpec = null; + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; /** - * SearchRequest queryExpansionSpec. - * @member {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec - * @memberof google.cloud.retail.v2beta.SearchRequest + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata * @instance + * @returns {Object.} JSON object */ - SearchRequest.prototype.queryExpansionSpec = null; + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * SearchRequest variantRollupKeys. - * @member {Array.} variantRollupKeys - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance - */ - SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + return RemoveFulfillmentPlacesMetadata; + })(); + + v2beta.RemoveFulfillmentPlacesResponse = (function() { /** - * SearchRequest pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2beta + * @interface IRemoveFulfillmentPlacesResponse */ - SearchRequest.prototype.pageCategories = $util.emptyArray; /** - * SearchRequest searchMode. - * @member {google.cloud.retail.v2beta.SearchRequest.SearchMode} searchMode - * @memberof google.cloud.retail.v2beta.SearchRequest - * @instance + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set */ - SearchRequest.prototype.searchMode = 0; + function RemoveFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.ISearchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest instance + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance */ - SearchRequest.create = function create(properties) { - return new SearchRequest(properties); + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); }; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encode = function encode(message, writer) { + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2beta.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); - if (message.facetSpecs != null && message.facetSpecs.length) - for (var i = 0; i < message.facetSpecs.length; ++i) - $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) - $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) - $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.variantRollupKeys != null && message.variantRollupKeys.length) - for (var i = 0; i < message.variantRollupKeys.length; ++i) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); - if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) - $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); - if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); - if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); return writer; }; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2beta.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decode = function decode(reader, length) { + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); - break; - case 4: - message.visitorId = reader.string(); - break; - case 5: - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: - message.filter = reader.string(); - break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 31: - message.searchMode = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -74440,1902 +86506,1926 @@ }; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchRequest message. + * Verifies a RemoveFulfillmentPlacesResponse message. * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.verify = function verify(message) { + RemoveFulfillmentPlacesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2beta.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - if (!$util.isString(message.canonicalFilter)) - return "canonicalFilter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { - if (!Array.isArray(message.facetSpecs)) - return "facetSpecs: array expected"; - for (var i = 0; i < message.facetSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); - if (error) - return "facetSpecs." + error; - } - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { - var error = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); - if (error) - return "dynamicFacetSpec." + error; - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { - var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify(message.boostSpec); - if (error) - return "boostSpec." + error; - } - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { - var error = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); - if (error) - return "queryExpansionSpec." + error; - } - if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { - if (!Array.isArray(message.variantRollupKeys)) - return "variantRollupKeys: array expected"; - for (var i = 0; i < message.variantRollupKeys.length; ++i) - if (!$util.isString(message.variantRollupKeys[i])) - return "variantRollupKeys: string[] expected"; - } - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; - } - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - switch (message.searchMode) { - default: - return "searchMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } return null; }; /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse */ - SearchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest) + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse) return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.branch != null) - message.branch = String(object.branch); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.fromObject(object.userInfo); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.filter != null) - message.filter = String(object.filter); - if (object.canonicalFilter != null) - message.canonicalFilter = String(object.canonicalFilter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.facetSpecs) { - if (!Array.isArray(object.facetSpecs)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.facetSpecs: array expected"); - message.facetSpecs = []; - for (var i = 0; i < object.facetSpecs.length; ++i) { - if (typeof object.facetSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.facetSpecs: object expected"); - message.facetSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); - } - } - if (object.dynamicFacetSpec != null) { - if (typeof object.dynamicFacetSpec !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.dynamicFacetSpec: object expected"); - message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); - } - if (object.boostSpec != null) { - if (typeof object.boostSpec !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.boostSpec: object expected"); - message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.fromObject(object.boostSpec); - } - if (object.queryExpansionSpec != null) { - if (typeof object.queryExpansionSpec !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.queryExpansionSpec: object expected"); - message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); - } - if (object.variantRollupKeys) { - if (!Array.isArray(object.variantRollupKeys)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.variantRollupKeys: array expected"); - message.variantRollupKeys = []; - for (var i = 0; i < object.variantRollupKeys.length; ++i) - message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); - } - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - switch (object.searchMode) { - case "SEARCH_MODE_UNSPECIFIED": - case 0: - message.searchMode = 0; - break; - case "PRODUCT_SEARCH_ONLY": - case 1: - message.searchMode = 1; - break; - case "FACETED_SEARCH_ONLY": - case 2: - message.searchMode = 2; - break; + return new $root.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveFulfillmentPlacesResponse; + })(); + + v2beta.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {google.cloud.retail.v2beta.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } } return message; }; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2beta.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.PurgeMetadata * @static - * @param {google.cloud.retail.v2beta.SearchRequest} message SearchRequest + * @param {google.cloud.retail.v2beta.PurgeMetadata} message PurgeMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.facetSpecs = []; - object.variantRollupKeys = []; - object.pageCategories = []; - } - if (options.defaults) { - object.placement = ""; - object.branch = ""; - object.query = ""; - object.visitorId = ""; - object.userInfo = null; - object.pageSize = 0; - object.pageToken = ""; - object.offset = 0; - object.filter = ""; - object.orderBy = ""; - object.boostSpec = null; - object.queryExpansionSpec = null; - object.dynamicFacetSpec = null; - object.canonicalFilter = ""; - object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2beta.UserInfo.toObject(message.userInfo, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.facetSpecs && message.facetSpecs.length) { - object.facetSpecs = []; - for (var j = 0; j < message.facetSpecs.length; ++j) - object.facetSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) - object.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.toObject(message.boostSpec, options); - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) - object.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); - if (message.variantRollupKeys && message.variantRollupKeys.length) { - object.variantRollupKeys = []; - for (var j = 0; j < message.variantRollupKeys.length; ++j) - object.variantRollupKeys[j] = message.variantRollupKeys[j]; - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) - object.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; - } - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - object.canonicalFilter = message.canonicalFilter; - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] : message.searchMode; - return object; + PurgeMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this SearchRequest to JSON. + * Converts this PurgeMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest + * @memberof google.cloud.retail.v2beta.PurgeMetadata * @instance * @returns {Object.} JSON object */ - SearchRequest.prototype.toJSON = function toJSON() { + PurgeMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchRequest.FacetSpec = (function() { + return PurgeMetadata; + })(); - /** - * Properties of a FacetSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @interface IFacetSpec - * @property {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey - * @property {number|null} [limit] FacetSpec limit - * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys - * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition - */ + v2beta.PurgeUserEventsRequest = (function() { - /** - * Constructs a new FacetSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @classdesc Represents a FacetSpec. - * @implements IFacetSpec - * @constructor - * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec=} [properties] Properties to set - */ - function FacetSpec(properties) { - this.excludedFilterKeys = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ - /** - * FacetSpec facetKey. - * @member {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.facetKey = null; + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FacetSpec limit. - * @member {number} limit - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.limit = 0; + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; - /** - * FacetSpec excludedFilterKeys. - * @member {Array.} excludedFilterKeys - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; - /** - * FacetSpec enableDynamicPosition. - * @member {boolean} enableDynamicPosition - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.enableDynamicPosition = false; + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; - /** - * Creates a new FacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec instance - */ - FacetSpec.create = function create(properties) { - return new FacetSpec(properties); - }; + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) - $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); - if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); - if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); - return writer; - }; + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a FacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.facetKey != null && message.hasOwnProperty("facetKey")) { - var error = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); - if (error) - return "facetKey." + error; - } - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit)) - return "limit: integer expected"; - if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { - if (!Array.isArray(message.excludedFilterKeys)) - return "excludedFilterKeys: array expected"; - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - if (!$util.isString(message.excludedFilterKeys[i])) - return "excludedFilterKeys: string[] expected"; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - if (typeof message.enableDynamicPosition !== "boolean") - return "enableDynamicPosition: boolean expected"; - return null; - }; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec} FacetSpec - */ - FacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec(); - if (object.facetKey != null) { - if (typeof object.facetKey !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.facetKey: object expected"); - message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); - } - if (object.limit != null) - message.limit = object.limit | 0; - if (object.excludedFilterKeys) { - if (!Array.isArray(object.excludedFilterKeys)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); - message.excludedFilterKeys = []; - for (var i = 0; i < object.excludedFilterKeys.length; ++i) - message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); - } - if (object.enableDynamicPosition != null) - message.enableDynamicPosition = Boolean(object.enableDynamicPosition); - return message; - }; + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec} message FacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.excludedFilterKeys = []; - if (options.defaults) { - object.facetKey = null; - object.limit = 0; - object.enableDynamicPosition = false; - } - if (message.facetKey != null && message.hasOwnProperty("facetKey")) - object.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = message.limit; - if (message.excludedFilterKeys && message.excludedFilterKeys.length) { - object.excludedFilterKeys = []; - for (var j = 0; j < message.excludedFilterKeys.length; ++j) - object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - object.enableDynamicPosition = message.enableDynamicPosition; + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsRequest) return object; - }; + var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; - /** - * Converts this FacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @instance - * @returns {Object.} JSON object - */ - FacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2beta.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; - FacetSpec.FacetKey = (function() { + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a FacetKey. - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @interface IFacetKey - * @property {string|null} [key] FacetKey key - * @property {Array.|null} [intervals] FacetKey intervals - * @property {Array.|null} [restrictedValues] FacetKey restrictedValues - * @property {Array.|null} [prefixes] FacetKey prefixes - * @property {Array.|null} [contains] FacetKey contains - * @property {string|null} [orderBy] FacetKey orderBy - * @property {string|null} [query] FacetKey query - */ + return PurgeUserEventsRequest; + })(); - /** - * Constructs a new FacetKey. - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec - * @classdesc Represents a FacetKey. - * @implements IFacetKey - * @constructor - * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - */ - function FacetKey(properties) { - this.intervals = []; - this.restrictedValues = []; - this.prefixes = []; - this.contains = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2beta.PurgeUserEventsResponse = (function() { - /** - * FacetKey key. - * @member {string} key - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.key = ""; + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ - /** - * FacetKey intervals. - * @member {Array.} intervals - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.intervals = $util.emptyArray; + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FacetKey restrictedValues. - * @member {Array.} restrictedValues - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.restrictedValues = $util.emptyArray; + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * FacetKey prefixes. - * @member {Array.} prefixes - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.prefixes = $util.emptyArray; + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; - /** - * FacetKey contains. - * @member {Array.} contains - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.contains = $util.emptyArray; + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; - /** - * FacetKey orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.orderBy = ""; + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * FacetKey query. - * @member {string} query - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.query = ""; + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new FacetKey instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey instance - */ - FacetKey.create = function create(properties) { - return new FacetKey(properties); - }; + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.intervals != null && message.intervals.length) - for (var i = 0; i < message.intervals.length; ++i) - $root.google.cloud.retail.v2beta.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.restrictedValues != null && message.restrictedValues.length) - for (var i = 0; i < message.restrictedValues.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); - if (message.prefixes != null && message.prefixes.length) - for (var i = 0; i < message.prefixes.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); - if (message.contains != null && message.contains.length) - for (var i = 0; i < message.contains.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); - return writer; - }; + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2beta.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeUserEventsResponse; + })(); + + v2beta.ServingConfig = (function() { + + /** + * Properties of a ServingConfig. + * @memberof google.cloud.retail.v2beta + * @interface IServingConfig + * @property {string|null} [name] ServingConfig name + * @property {string|null} [displayName] ServingConfig displayName + * @property {string|null} [modelId] ServingConfig modelId + * @property {string|null} [priceRerankingLevel] ServingConfig priceRerankingLevel + * @property {Array.|null} [facetControlIds] ServingConfig facetControlIds + * @property {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] ServingConfig dynamicFacetSpec + * @property {Array.|null} [boostControlIds] ServingConfig boostControlIds + * @property {Array.|null} [filterControlIds] ServingConfig filterControlIds + * @property {Array.|null} [redirectControlIds] ServingConfig redirectControlIds + * @property {Array.|null} [twowaySynonymsControlIds] ServingConfig twowaySynonymsControlIds + * @property {Array.|null} [onewaySynonymsControlIds] ServingConfig onewaySynonymsControlIds + * @property {Array.|null} [doNotAssociateControlIds] ServingConfig doNotAssociateControlIds + * @property {Array.|null} [replacementControlIds] ServingConfig replacementControlIds + * @property {Array.|null} [ignoreControlIds] ServingConfig ignoreControlIds + * @property {string|null} [diversityLevel] ServingConfig diversityLevel + * @property {string|null} [enableCategoryFilterLevel] ServingConfig enableCategoryFilterLevel + * @property {Array.|null} [solutionTypes] ServingConfig solutionTypes + */ + + /** + * Constructs a new ServingConfig. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ServingConfig. + * @implements IServingConfig + * @constructor + * @param {google.cloud.retail.v2beta.IServingConfig=} [properties] Properties to set + */ + function ServingConfig(properties) { + this.facetControlIds = []; + this.boostControlIds = []; + this.filterControlIds = []; + this.redirectControlIds = []; + this.twowaySynonymsControlIds = []; + this.onewaySynonymsControlIds = []; + this.doNotAssociateControlIds = []; + this.replacementControlIds = []; + this.ignoreControlIds = []; + this.solutionTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServingConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.name = ""; + + /** + * ServingConfig displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.displayName = ""; - /** - * Verifies a FacetKey message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.intervals != null && message.hasOwnProperty("intervals")) { - if (!Array.isArray(message.intervals)) - return "intervals: array expected"; - for (var i = 0; i < message.intervals.length; ++i) { - var error = $root.google.cloud.retail.v2beta.Interval.verify(message.intervals[i]); - if (error) - return "intervals." + error; - } - } - if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { - if (!Array.isArray(message.restrictedValues)) - return "restrictedValues: array expected"; - for (var i = 0; i < message.restrictedValues.length; ++i) - if (!$util.isString(message.restrictedValues[i])) - return "restrictedValues: string[] expected"; - } - if (message.prefixes != null && message.hasOwnProperty("prefixes")) { - if (!Array.isArray(message.prefixes)) - return "prefixes: array expected"; - for (var i = 0; i < message.prefixes.length; ++i) - if (!$util.isString(message.prefixes[i])) - return "prefixes: string[] expected"; - } - if (message.contains != null && message.hasOwnProperty("contains")) { - if (!Array.isArray(message.contains)) - return "contains: array expected"; - for (var i = 0; i < message.contains.length; ++i) - if (!$util.isString(message.contains[i])) - return "contains: string[] expected"; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - return null; - }; + /** + * ServingConfig modelId. + * @member {string} modelId + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.modelId = ""; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} FacetKey - */ - FacetKey.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey(); - if (object.key != null) - message.key = String(object.key); - if (object.intervals) { - if (!Array.isArray(object.intervals)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); - message.intervals = []; - for (var i = 0; i < object.intervals.length; ++i) { - if (typeof object.intervals[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); - message.intervals[i] = $root.google.cloud.retail.v2beta.Interval.fromObject(object.intervals[i]); - } - } - if (object.restrictedValues) { - if (!Array.isArray(object.restrictedValues)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); - message.restrictedValues = []; - for (var i = 0; i < object.restrictedValues.length; ++i) - message.restrictedValues[i] = String(object.restrictedValues[i]); - } - if (object.prefixes) { - if (!Array.isArray(object.prefixes)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); - message.prefixes = []; - for (var i = 0; i < object.prefixes.length; ++i) - message.prefixes[i] = String(object.prefixes[i]); - } - if (object.contains) { - if (!Array.isArray(object.contains)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.contains: array expected"); - message.contains = []; - for (var i = 0; i < object.contains.length; ++i) - message.contains[i] = String(object.contains[i]); - } - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.query != null) - message.query = String(object.query); - return message; - }; + /** + * ServingConfig priceRerankingLevel. + * @member {string} priceRerankingLevel + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.priceRerankingLevel = ""; - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey} message FacetKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.intervals = []; - object.restrictedValues = []; - object.prefixes = []; - object.contains = []; - } - if (options.defaults) { - object.key = ""; - object.orderBy = ""; - object.query = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.intervals && message.intervals.length) { - object.intervals = []; - for (var j = 0; j < message.intervals.length; ++j) - object.intervals[j] = $root.google.cloud.retail.v2beta.Interval.toObject(message.intervals[j], options); - } - if (message.restrictedValues && message.restrictedValues.length) { - object.restrictedValues = []; - for (var j = 0; j < message.restrictedValues.length; ++j) - object.restrictedValues[j] = message.restrictedValues[j]; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.prefixes && message.prefixes.length) { - object.prefixes = []; - for (var j = 0; j < message.prefixes.length; ++j) - object.prefixes[j] = message.prefixes[j]; - } - if (message.contains && message.contains.length) { - object.contains = []; - for (var j = 0; j < message.contains.length; ++j) - object.contains[j] = message.contains[j]; - } - return object; - }; + /** + * ServingConfig facetControlIds. + * @member {Array.} facetControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.facetControlIds = $util.emptyArray; - /** - * Converts this FacetKey to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey - * @instance - * @returns {Object.} JSON object - */ - FacetKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * ServingConfig dynamicFacetSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.dynamicFacetSpec = null; - return FacetKey; - })(); + /** + * ServingConfig boostControlIds. + * @member {Array.} boostControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.boostControlIds = $util.emptyArray; - return FacetSpec; - })(); + /** + * ServingConfig filterControlIds. + * @member {Array.} filterControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.filterControlIds = $util.emptyArray; - SearchRequest.DynamicFacetSpec = (function() { + /** + * ServingConfig redirectControlIds. + * @member {Array.} redirectControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.redirectControlIds = $util.emptyArray; - /** - * Properties of a DynamicFacetSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @interface IDynamicFacetSpec - * @property {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode - */ + /** + * ServingConfig twowaySynonymsControlIds. + * @member {Array.} twowaySynonymsControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.twowaySynonymsControlIds = $util.emptyArray; - /** - * Constructs a new DynamicFacetSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @classdesc Represents a DynamicFacetSpec. - * @implements IDynamicFacetSpec - * @constructor - * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - */ - function DynamicFacetSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * ServingConfig onewaySynonymsControlIds. + * @member {Array.} onewaySynonymsControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.onewaySynonymsControlIds = $util.emptyArray; - /** - * DynamicFacetSpec mode. - * @member {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode} mode - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @instance - */ - DynamicFacetSpec.prototype.mode = 0; + /** + * ServingConfig doNotAssociateControlIds. + * @member {Array.} doNotAssociateControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.doNotAssociateControlIds = $util.emptyArray; - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance - */ - DynamicFacetSpec.create = function create(properties) { - return new DynamicFacetSpec(properties); - }; + /** + * ServingConfig replacementControlIds. + * @member {Array.} replacementControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.replacementControlIds = $util.emptyArray; - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; + /** + * ServingConfig ignoreControlIds. + * @member {Array.} ignoreControlIds + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.ignoreControlIds = $util.emptyArray; - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ServingConfig diversityLevel. + * @member {string} diversityLevel + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.diversityLevel = ""; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * ServingConfig enableCategoryFilterLevel. + * @member {string} enableCategoryFilterLevel + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.enableCategoryFilterLevel = ""; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * ServingConfig solutionTypes. + * @member {Array.} solutionTypes + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.solutionTypes = $util.emptyArray; - /** - * Verifies a DynamicFacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DynamicFacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; + /** + * Creates a new ServingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {google.cloud.retail.v2beta.IServingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ServingConfig} ServingConfig instance + */ + ServingConfig.create = function create(properties) { + return new ServingConfig(properties); + }; - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - */ - DynamicFacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "DISABLED": + /** + * Encodes the specified ServingConfig message. Does not implicitly {@link google.cloud.retail.v2beta.ServingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {google.cloud.retail.v2beta.IServingConfig} message ServingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.modelId != null && Object.hasOwnProperty.call(message, "modelId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelId); + if (message.priceRerankingLevel != null && Object.hasOwnProperty.call(message, "priceRerankingLevel")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.priceRerankingLevel); + if (message.facetControlIds != null && message.facetControlIds.length) + for (var i = 0; i < message.facetControlIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.facetControlIds[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.boostControlIds != null && message.boostControlIds.length) + for (var i = 0; i < message.boostControlIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.boostControlIds[i]); + if (message.diversityLevel != null && Object.hasOwnProperty.call(message, "diversityLevel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.diversityLevel); + if (message.filterControlIds != null && message.filterControlIds.length) + for (var i = 0; i < message.filterControlIds.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.filterControlIds[i]); + if (message.redirectControlIds != null && message.redirectControlIds.length) + for (var i = 0; i < message.redirectControlIds.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectControlIds[i]); + if (message.onewaySynonymsControlIds != null && message.onewaySynonymsControlIds.length) + for (var i = 0; i < message.onewaySynonymsControlIds.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.onewaySynonymsControlIds[i]); + if (message.doNotAssociateControlIds != null && message.doNotAssociateControlIds.length) + for (var i = 0; i < message.doNotAssociateControlIds.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.doNotAssociateControlIds[i]); + if (message.replacementControlIds != null && message.replacementControlIds.length) + for (var i = 0; i < message.replacementControlIds.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.replacementControlIds[i]); + if (message.ignoreControlIds != null && message.ignoreControlIds.length) + for (var i = 0; i < message.ignoreControlIds.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.ignoreControlIds[i]); + if (message.enableCategoryFilterLevel != null && Object.hasOwnProperty.call(message, "enableCategoryFilterLevel")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.enableCategoryFilterLevel); + if (message.twowaySynonymsControlIds != null && message.twowaySynonymsControlIds.length) + for (var i = 0; i < message.twowaySynonymsControlIds.length; ++i) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.twowaySynonymsControlIds[i]); + if (message.solutionTypes != null && message.solutionTypes.length) { + writer.uint32(/* id 19, wireType 2 =*/154).fork(); + for (var i = 0; i < message.solutionTypes.length; ++i) + writer.int32(message.solutionTypes[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ServingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ServingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {google.cloud.retail.v2beta.IServingConfig} message ServingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ServingConfig} ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ServingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - message.mode = 1; + message.name = reader.string(); break; - case "ENABLED": case 2: - message.mode = 2; + message.displayName = reader.string(); + break; + case 3: + message.modelId = reader.string(); + break; + case 4: + message.priceRerankingLevel = reader.string(); + break; + case 5: + if (!(message.facetControlIds && message.facetControlIds.length)) + message.facetControlIds = []; + message.facetControlIds.push(reader.string()); + break; + case 6: + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 7: + if (!(message.boostControlIds && message.boostControlIds.length)) + message.boostControlIds = []; + message.boostControlIds.push(reader.string()); + break; + case 9: + if (!(message.filterControlIds && message.filterControlIds.length)) + message.filterControlIds = []; + message.filterControlIds.push(reader.string()); + break; + case 10: + if (!(message.redirectControlIds && message.redirectControlIds.length)) + message.redirectControlIds = []; + message.redirectControlIds.push(reader.string()); + break; + case 18: + if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) + message.twowaySynonymsControlIds = []; + message.twowaySynonymsControlIds.push(reader.string()); + break; + case 12: + if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) + message.onewaySynonymsControlIds = []; + message.onewaySynonymsControlIds.push(reader.string()); + break; + case 13: + if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) + message.doNotAssociateControlIds = []; + message.doNotAssociateControlIds.push(reader.string()); + break; + case 14: + if (!(message.replacementControlIds && message.replacementControlIds.length)) + message.replacementControlIds = []; + message.replacementControlIds.push(reader.string()); + break; + case 15: + if (!(message.ignoreControlIds && message.ignoreControlIds.length)) + message.ignoreControlIds = []; + message.ignoreControlIds.push(reader.string()); + break; + case 8: + message.diversityLevel = reader.string(); + break; + case 16: + message.enableCategoryFilterLevel = reader.string(); + break; + case 19: + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else + message.solutionTypes.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); break; } - return message; - }; - - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DynamicFacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; - return object; - }; - - /** - * Converts this DynamicFacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec - * @instance - * @returns {Object.} JSON object - */ - DynamicFacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Mode enum. - * @name google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} ENABLED=2 ENABLED value - */ - DynamicFacetSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[2] = "ENABLED"] = 2; - return values; - })(); + } + return message; + }; - return DynamicFacetSpec; - })(); + /** + * Decodes a ServingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ServingConfig} ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - SearchRequest.BoostSpec = (function() { + /** + * Verifies a ServingConfig message. + * @function verify + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.modelId != null && message.hasOwnProperty("modelId")) + if (!$util.isString(message.modelId)) + return "modelId: string expected"; + if (message.priceRerankingLevel != null && message.hasOwnProperty("priceRerankingLevel")) + if (!$util.isString(message.priceRerankingLevel)) + return "priceRerankingLevel: string expected"; + if (message.facetControlIds != null && message.hasOwnProperty("facetControlIds")) { + if (!Array.isArray(message.facetControlIds)) + return "facetControlIds: array expected"; + for (var i = 0; i < message.facetControlIds.length; ++i) + if (!$util.isString(message.facetControlIds[i])) + return "facetControlIds: string[] expected"; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostControlIds != null && message.hasOwnProperty("boostControlIds")) { + if (!Array.isArray(message.boostControlIds)) + return "boostControlIds: array expected"; + for (var i = 0; i < message.boostControlIds.length; ++i) + if (!$util.isString(message.boostControlIds[i])) + return "boostControlIds: string[] expected"; + } + if (message.filterControlIds != null && message.hasOwnProperty("filterControlIds")) { + if (!Array.isArray(message.filterControlIds)) + return "filterControlIds: array expected"; + for (var i = 0; i < message.filterControlIds.length; ++i) + if (!$util.isString(message.filterControlIds[i])) + return "filterControlIds: string[] expected"; + } + if (message.redirectControlIds != null && message.hasOwnProperty("redirectControlIds")) { + if (!Array.isArray(message.redirectControlIds)) + return "redirectControlIds: array expected"; + for (var i = 0; i < message.redirectControlIds.length; ++i) + if (!$util.isString(message.redirectControlIds[i])) + return "redirectControlIds: string[] expected"; + } + if (message.twowaySynonymsControlIds != null && message.hasOwnProperty("twowaySynonymsControlIds")) { + if (!Array.isArray(message.twowaySynonymsControlIds)) + return "twowaySynonymsControlIds: array expected"; + for (var i = 0; i < message.twowaySynonymsControlIds.length; ++i) + if (!$util.isString(message.twowaySynonymsControlIds[i])) + return "twowaySynonymsControlIds: string[] expected"; + } + if (message.onewaySynonymsControlIds != null && message.hasOwnProperty("onewaySynonymsControlIds")) { + if (!Array.isArray(message.onewaySynonymsControlIds)) + return "onewaySynonymsControlIds: array expected"; + for (var i = 0; i < message.onewaySynonymsControlIds.length; ++i) + if (!$util.isString(message.onewaySynonymsControlIds[i])) + return "onewaySynonymsControlIds: string[] expected"; + } + if (message.doNotAssociateControlIds != null && message.hasOwnProperty("doNotAssociateControlIds")) { + if (!Array.isArray(message.doNotAssociateControlIds)) + return "doNotAssociateControlIds: array expected"; + for (var i = 0; i < message.doNotAssociateControlIds.length; ++i) + if (!$util.isString(message.doNotAssociateControlIds[i])) + return "doNotAssociateControlIds: string[] expected"; + } + if (message.replacementControlIds != null && message.hasOwnProperty("replacementControlIds")) { + if (!Array.isArray(message.replacementControlIds)) + return "replacementControlIds: array expected"; + for (var i = 0; i < message.replacementControlIds.length; ++i) + if (!$util.isString(message.replacementControlIds[i])) + return "replacementControlIds: string[] expected"; + } + if (message.ignoreControlIds != null && message.hasOwnProperty("ignoreControlIds")) { + if (!Array.isArray(message.ignoreControlIds)) + return "ignoreControlIds: array expected"; + for (var i = 0; i < message.ignoreControlIds.length; ++i) + if (!$util.isString(message.ignoreControlIds[i])) + return "ignoreControlIds: string[] expected"; + } + if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) + if (!$util.isString(message.diversityLevel)) + return "diversityLevel: string expected"; + if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) + if (!$util.isString(message.enableCategoryFilterLevel)) + return "enableCategoryFilterLevel: string expected"; + if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { + if (!Array.isArray(message.solutionTypes)) + return "solutionTypes: array expected"; + for (var i = 0; i < message.solutionTypes.length; ++i) + switch (message.solutionTypes[i]) { + default: + return "solutionTypes: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; - /** - * Properties of a BoostSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @interface IBoostSpec - * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs - */ + /** + * Creates a ServingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ServingConfig} ServingConfig + */ + ServingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ServingConfig) + return object; + var message = new $root.google.cloud.retail.v2beta.ServingConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.modelId != null) + message.modelId = String(object.modelId); + if (object.priceRerankingLevel != null) + message.priceRerankingLevel = String(object.priceRerankingLevel); + if (object.facetControlIds) { + if (!Array.isArray(object.facetControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.facetControlIds: array expected"); + message.facetControlIds = []; + for (var i = 0; i < object.facetControlIds.length; ++i) + message.facetControlIds[i] = String(object.facetControlIds[i]); + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostControlIds) { + if (!Array.isArray(object.boostControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.boostControlIds: array expected"); + message.boostControlIds = []; + for (var i = 0; i < object.boostControlIds.length; ++i) + message.boostControlIds[i] = String(object.boostControlIds[i]); + } + if (object.filterControlIds) { + if (!Array.isArray(object.filterControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.filterControlIds: array expected"); + message.filterControlIds = []; + for (var i = 0; i < object.filterControlIds.length; ++i) + message.filterControlIds[i] = String(object.filterControlIds[i]); + } + if (object.redirectControlIds) { + if (!Array.isArray(object.redirectControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.redirectControlIds: array expected"); + message.redirectControlIds = []; + for (var i = 0; i < object.redirectControlIds.length; ++i) + message.redirectControlIds[i] = String(object.redirectControlIds[i]); + } + if (object.twowaySynonymsControlIds) { + if (!Array.isArray(object.twowaySynonymsControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.twowaySynonymsControlIds: array expected"); + message.twowaySynonymsControlIds = []; + for (var i = 0; i < object.twowaySynonymsControlIds.length; ++i) + message.twowaySynonymsControlIds[i] = String(object.twowaySynonymsControlIds[i]); + } + if (object.onewaySynonymsControlIds) { + if (!Array.isArray(object.onewaySynonymsControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.onewaySynonymsControlIds: array expected"); + message.onewaySynonymsControlIds = []; + for (var i = 0; i < object.onewaySynonymsControlIds.length; ++i) + message.onewaySynonymsControlIds[i] = String(object.onewaySynonymsControlIds[i]); + } + if (object.doNotAssociateControlIds) { + if (!Array.isArray(object.doNotAssociateControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.doNotAssociateControlIds: array expected"); + message.doNotAssociateControlIds = []; + for (var i = 0; i < object.doNotAssociateControlIds.length; ++i) + message.doNotAssociateControlIds[i] = String(object.doNotAssociateControlIds[i]); + } + if (object.replacementControlIds) { + if (!Array.isArray(object.replacementControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.replacementControlIds: array expected"); + message.replacementControlIds = []; + for (var i = 0; i < object.replacementControlIds.length; ++i) + message.replacementControlIds[i] = String(object.replacementControlIds[i]); + } + if (object.ignoreControlIds) { + if (!Array.isArray(object.ignoreControlIds)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.ignoreControlIds: array expected"); + message.ignoreControlIds = []; + for (var i = 0; i < object.ignoreControlIds.length; ++i) + message.ignoreControlIds[i] = String(object.ignoreControlIds[i]); + } + if (object.diversityLevel != null) + message.diversityLevel = String(object.diversityLevel); + if (object.enableCategoryFilterLevel != null) + message.enableCategoryFilterLevel = String(object.enableCategoryFilterLevel); + if (object.solutionTypes) { + if (!Array.isArray(object.solutionTypes)) + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.solutionTypes: array expected"); + message.solutionTypes = []; + for (var i = 0; i < object.solutionTypes.length; ++i) + switch (object.solutionTypes[i]) { + default: + case "SOLUTION_TYPE_UNSPECIFIED": + case 0: + message.solutionTypes[i] = 0; + break; + case "SOLUTION_TYPE_RECOMMENDATION": + case 1: + message.solutionTypes[i] = 1; + break; + case "SOLUTION_TYPE_SEARCH": + case 2: + message.solutionTypes[i] = 2; + break; + } + } + return message; + }; - /** - * Constructs a new BoostSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @classdesc Represents a BoostSpec. - * @implements IBoostSpec - * @constructor - * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec=} [properties] Properties to set - */ - function BoostSpec(properties) { - this.conditionBoostSpecs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from a ServingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {google.cloud.retail.v2beta.ServingConfig} message ServingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetControlIds = []; + object.boostControlIds = []; + object.filterControlIds = []; + object.redirectControlIds = []; + object.onewaySynonymsControlIds = []; + object.doNotAssociateControlIds = []; + object.replacementControlIds = []; + object.ignoreControlIds = []; + object.twowaySynonymsControlIds = []; + object.solutionTypes = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.modelId = ""; + object.priceRerankingLevel = ""; + object.dynamicFacetSpec = null; + object.diversityLevel = ""; + object.enableCategoryFilterLevel = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.modelId != null && message.hasOwnProperty("modelId")) + object.modelId = message.modelId; + if (message.priceRerankingLevel != null && message.hasOwnProperty("priceRerankingLevel")) + object.priceRerankingLevel = message.priceRerankingLevel; + if (message.facetControlIds && message.facetControlIds.length) { + object.facetControlIds = []; + for (var j = 0; j < message.facetControlIds.length; ++j) + object.facetControlIds[j] = message.facetControlIds[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.boostControlIds && message.boostControlIds.length) { + object.boostControlIds = []; + for (var j = 0; j < message.boostControlIds.length; ++j) + object.boostControlIds[j] = message.boostControlIds[j]; + } + if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) + object.diversityLevel = message.diversityLevel; + if (message.filterControlIds && message.filterControlIds.length) { + object.filterControlIds = []; + for (var j = 0; j < message.filterControlIds.length; ++j) + object.filterControlIds[j] = message.filterControlIds[j]; + } + if (message.redirectControlIds && message.redirectControlIds.length) { + object.redirectControlIds = []; + for (var j = 0; j < message.redirectControlIds.length; ++j) + object.redirectControlIds[j] = message.redirectControlIds[j]; + } + if (message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length) { + object.onewaySynonymsControlIds = []; + for (var j = 0; j < message.onewaySynonymsControlIds.length; ++j) + object.onewaySynonymsControlIds[j] = message.onewaySynonymsControlIds[j]; + } + if (message.doNotAssociateControlIds && message.doNotAssociateControlIds.length) { + object.doNotAssociateControlIds = []; + for (var j = 0; j < message.doNotAssociateControlIds.length; ++j) + object.doNotAssociateControlIds[j] = message.doNotAssociateControlIds[j]; + } + if (message.replacementControlIds && message.replacementControlIds.length) { + object.replacementControlIds = []; + for (var j = 0; j < message.replacementControlIds.length; ++j) + object.replacementControlIds[j] = message.replacementControlIds[j]; + } + if (message.ignoreControlIds && message.ignoreControlIds.length) { + object.ignoreControlIds = []; + for (var j = 0; j < message.ignoreControlIds.length; ++j) + object.ignoreControlIds[j] = message.ignoreControlIds[j]; + } + if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) + object.enableCategoryFilterLevel = message.enableCategoryFilterLevel; + if (message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length) { + object.twowaySynonymsControlIds = []; + for (var j = 0; j < message.twowaySynonymsControlIds.length; ++j) + object.twowaySynonymsControlIds[j] = message.twowaySynonymsControlIds[j]; + } + if (message.solutionTypes && message.solutionTypes.length) { + object.solutionTypes = []; + for (var j = 0; j < message.solutionTypes.length; ++j) + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } + return object; + }; - /** - * BoostSpec conditionBoostSpecs. - * @member {Array.} conditionBoostSpecs - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @instance - */ - BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + /** + * Converts this ServingConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + * @returns {Object.} JSON object + */ + ServingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a new BoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec instance - */ - BoostSpec.create = function create(properties) { - return new BoostSpec(properties); - }; + return ServingConfig; + })(); - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) - $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + v2beta.ServingConfigService = (function() { - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new ServingConfigService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ServingConfigService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ServingConfigService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + (ServingConfigService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ServingConfigService; - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates new ServingConfigService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ServingConfigService} RPC service. Useful where requests and/or responses are streamed. + */ + ServingConfigService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Verifies a BoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { - if (!Array.isArray(message.conditionBoostSpecs)) - return "conditionBoostSpecs: array expected"; - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); - if (error) - return "conditionBoostSpecs." + error; - } - } - return null; - }; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#createServingConfig}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef CreateServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ServingConfig} [response] ServingConfig + */ - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec} BoostSpec - */ - BoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec(); - if (object.conditionBoostSpecs) { - if (!Array.isArray(object.conditionBoostSpecs)) - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); - message.conditionBoostSpecs = []; - for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { - if (typeof object.conditionBoostSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); - message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); - } - } - return message; - }; + /** + * Calls CreateServingConfig. + * @function createServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.ICreateServingConfigRequest} request CreateServingConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.CreateServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.createServingConfig = function createServingConfig(request, callback) { + return this.rpcCall(createServingConfig, $root.google.cloud.retail.v2beta.CreateServingConfigRequest, $root.google.cloud.retail.v2beta.ServingConfig, request, callback); + }, "name", { value: "CreateServingConfig" }); - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} message BoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.conditionBoostSpecs = []; - if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { - object.conditionBoostSpecs = []; - for (var j = 0; j < message.conditionBoostSpecs.length; ++j) - object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); - } - return object; - }; + /** + * Calls CreateServingConfig. + * @function createServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.ICreateServingConfigRequest} request CreateServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Converts this BoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @instance - * @returns {Object.} JSON object - */ - BoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#deleteServingConfig}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef DeleteServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ - BoostSpec.ConditionBoostSpec = (function() { + /** + * Calls DeleteServingConfig. + * @function deleteServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteServingConfigRequest} request DeleteServingConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfigCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.deleteServingConfig = function deleteServingConfig(request, callback) { + return this.rpcCall(deleteServingConfig, $root.google.cloud.retail.v2beta.DeleteServingConfigRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteServingConfig" }); - /** - * Properties of a ConditionBoostSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @interface IConditionBoostSpec - * @property {string|null} [condition] ConditionBoostSpec condition - * @property {number|null} [boost] ConditionBoostSpec boost - */ + /** + * Calls DeleteServingConfig. + * @function deleteServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteServingConfigRequest} request DeleteServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Constructs a new ConditionBoostSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec - * @classdesc Represents a ConditionBoostSpec. - * @implements IConditionBoostSpec - * @constructor - * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - */ - function ConditionBoostSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#updateServingConfig}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef UpdateServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ServingConfig} [response] ServingConfig + */ - /** - * ConditionBoostSpec condition. - * @member {string} condition - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.condition = ""; + /** + * Calls UpdateServingConfig. + * @function updateServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateServingConfigRequest} request UpdateServingConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.updateServingConfig = function updateServingConfig(request, callback) { + return this.rpcCall(updateServingConfig, $root.google.cloud.retail.v2beta.UpdateServingConfigRequest, $root.google.cloud.retail.v2beta.ServingConfig, request, callback); + }, "name", { value: "UpdateServingConfig" }); - /** - * ConditionBoostSpec boost. - * @member {number} boost - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.boost = 0; + /** + * Calls UpdateServingConfig. + * @function updateServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateServingConfigRequest} request UpdateServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance - */ - ConditionBoostSpec.create = function create(properties) { - return new ConditionBoostSpec(properties); - }; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#getServingConfig}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef GetServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ServingConfig} [response] ServingConfig + */ - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); - return writer; - }; + /** + * Calls GetServingConfig. + * @function getServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IGetServingConfigRequest} request GetServingConfigRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.GetServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.getServingConfig = function getServingConfig(request, callback) { + return this.rpcCall(getServingConfig, $root.google.cloud.retail.v2beta.GetServingConfigRequest, $root.google.cloud.retail.v2beta.ServingConfig, request, callback); + }, "name", { value: "GetServingConfig" }); - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Calls GetServingConfig. + * @function getServingConfig + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IGetServingConfigRequest} request GetServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#listServingConfigs}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef ListServingConfigsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListServingConfigsResponse} [response] ListServingConfigsResponse + */ - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Calls ListServingConfigs. + * @function listServingConfigs + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IListServingConfigsRequest} request ListServingConfigsRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.ListServingConfigsCallback} callback Node-style callback called with the error, if any, and ListServingConfigsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.listServingConfigs = function listServingConfigs(request, callback) { + return this.rpcCall(listServingConfigs, $root.google.cloud.retail.v2beta.ListServingConfigsRequest, $root.google.cloud.retail.v2beta.ListServingConfigsResponse, request, callback); + }, "name", { value: "ListServingConfigs" }); - /** - * Verifies a ConditionBoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConditionBoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - if (!$util.isString(message.condition)) - return "condition: string expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - return null; - }; + /** + * Calls ListServingConfigs. + * @function listServingConfigs + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IListServingConfigsRequest} request ListServingConfigsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - */ - ConditionBoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec(); - if (object.condition != null) - message.condition = String(object.condition); - if (object.boost != null) - message.boost = Number(object.boost); - return message; - }; + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#addControl}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef AddControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ServingConfig} [response] ServingConfig + */ - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConditionBoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = ""; - object.boost = 0; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = message.condition; - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - return object; - }; + /** + * Calls AddControl. + * @function addControl + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IAddControlRequest} request AddControlRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.AddControlCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.addControl = function addControl(request, callback) { + return this.rpcCall(addControl, $root.google.cloud.retail.v2beta.AddControlRequest, $root.google.cloud.retail.v2beta.ServingConfig, request, callback); + }, "name", { value: "AddControl" }); - /** - * Converts this ConditionBoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - * @returns {Object.} JSON object - */ - ConditionBoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Calls AddControl. + * @function addControl + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IAddControlRequest} request AddControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - return ConditionBoostSpec; - })(); + /** + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#removeControl}. + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @typedef RemoveControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ServingConfig} [response] ServingConfig + */ - return BoostSpec; - })(); + /** + * Calls RemoveControl. + * @function removeControl + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveControlRequest} request RemoveControlRequest message or plain object + * @param {google.cloud.retail.v2beta.ServingConfigService.RemoveControlCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.removeControl = function removeControl(request, callback) { + return this.rpcCall(removeControl, $root.google.cloud.retail.v2beta.RemoveControlRequest, $root.google.cloud.retail.v2beta.ServingConfig, request, callback); + }, "name", { value: "RemoveControl" }); - SearchRequest.QueryExpansionSpec = (function() { + /** + * Calls RemoveControl. + * @function removeControl + * @memberof google.cloud.retail.v2beta.ServingConfigService + * @instance + * @param {google.cloud.retail.v2beta.IRemoveControlRequest} request RemoveControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Properties of a QueryExpansionSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @interface IQueryExpansionSpec - * @property {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition - * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults - */ + return ServingConfigService; + })(); - /** - * Constructs a new QueryExpansionSpec. - * @memberof google.cloud.retail.v2beta.SearchRequest - * @classdesc Represents a QueryExpansionSpec. - * @implements IQueryExpansionSpec - * @constructor - * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - */ - function QueryExpansionSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2beta.CreateServingConfigRequest = (function() { - /** - * QueryExpansionSpec condition. - * @member {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition} condition - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.condition = 0; + /** + * Properties of a CreateServingConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICreateServingConfigRequest + * @property {string|null} [parent] CreateServingConfigRequest parent + * @property {google.cloud.retail.v2beta.IServingConfig|null} [servingConfig] CreateServingConfigRequest servingConfig + * @property {string|null} [servingConfigId] CreateServingConfigRequest servingConfigId + */ - /** - * QueryExpansionSpec pinUnexpandedResults. - * @member {boolean} pinUnexpandedResults - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.pinUnexpandedResults = false; + /** + * Constructs a new CreateServingConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CreateServingConfigRequest. + * @implements ICreateServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICreateServingConfigRequest=} [properties] Properties to set + */ + function CreateServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance - */ - QueryExpansionSpec.create = function create(properties) { - return new QueryExpansionSpec(properties); - }; + /** + * CreateServingConfigRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.parent = ""; - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); - if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); - return writer; - }; + /** + * CreateServingConfigRequest servingConfig. + * @member {google.cloud.retail.v2beta.IServingConfig|null|undefined} servingConfig + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.servingConfig = null; - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * CreateServingConfigRequest servingConfigId. + * @member {string} servingConfigId + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.servingConfigId = ""; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new CreateServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateServingConfigRequest} CreateServingConfigRequest instance + */ + CreateServingConfigRequest.create = function create(properties) { + return new CreateServingConfigRequest(properties); + }; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified CreateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateServingConfigRequest} message CreateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + $root.google.cloud.retail.v2beta.ServingConfig.encode(message.servingConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.servingConfigId != null && Object.hasOwnProperty.call(message, "servingConfigId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.servingConfigId); + return writer; + }; - /** - * Verifies a QueryExpansionSpec message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - switch (message.condition) { - default: - return "condition: enum value expected"; - case 0: - case 1: - case 3: - break; - } - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - if (typeof message.pinUnexpandedResults !== "boolean") - return "pinUnexpandedResults: boolean expected"; - return null; - }; + /** + * Encodes the specified CreateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateServingConfigRequest} message CreateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - */ - QueryExpansionSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); - switch (object.condition) { - case "CONDITION_UNSPECIFIED": - case 0: - message.condition = 0; - break; - case "DISABLED": + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CreateServingConfigRequest} CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - message.condition = 1; + message.parent = reader.string(); + break; + case 2: + message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32()); break; - case "AUTO": case 3: - message.condition = 3; + message.servingConfigId = reader.string(); + break; + default: + reader.skipType(tag & 7); break; } - if (object.pinUnexpandedResults != null) - message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; - object.pinUnexpandedResults = false; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - object.pinUnexpandedResults = message.pinUnexpandedResults; - return object; - }; + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CreateServingConfigRequest} CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this QueryExpansionSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies a CreateServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) { + var error = $root.google.cloud.retail.v2beta.ServingConfig.verify(message.servingConfig); + if (error) + return "servingConfig." + error; + } + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) + if (!$util.isString(message.servingConfigId)) + return "servingConfigId: string expected"; + return null; + }; - /** - * Condition enum. - * @name google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition - * @enum {number} - * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} AUTO=3 AUTO value - */ - QueryExpansionSpec.Condition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[3] = "AUTO"] = 3; - return values; - })(); + /** + * Creates a CreateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CreateServingConfigRequest} CreateServingConfigRequest + */ + CreateServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CreateServingConfigRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.servingConfig != null) { + if (typeof object.servingConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.CreateServingConfigRequest.servingConfig: object expected"); + message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.fromObject(object.servingConfig); + } + if (object.servingConfigId != null) + message.servingConfigId = String(object.servingConfigId); + return message; + }; - return QueryExpansionSpec; - })(); + /** + * Creates a plain object from a CreateServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.CreateServingConfigRequest} message CreateServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.servingConfig = null; + object.servingConfigId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.toObject(message.servingConfig, options); + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) + object.servingConfigId = message.servingConfigId; + return object; + }; /** - * SearchMode enum. - * @name google.cloud.retail.v2beta.SearchRequest.SearchMode - * @enum {number} - * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value - * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value - * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + * Converts this CreateServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @instance + * @returns {Object.} JSON object */ - SearchRequest.SearchMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; - values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; - return values; - })(); + CreateServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return SearchRequest; + return CreateServingConfigRequest; })(); - v2beta.SearchResponse = (function() { + v2beta.UpdateServingConfigRequest = (function() { /** - * Properties of a SearchResponse. + * Properties of an UpdateServingConfigRequest. * @memberof google.cloud.retail.v2beta - * @interface ISearchResponse - * @property {Array.|null} [results] SearchResponse results - * @property {Array.|null} [facets] SearchResponse facets - * @property {number|null} [totalSize] SearchResponse totalSize - * @property {string|null} [correctedQuery] SearchResponse correctedQuery - * @property {string|null} [attributionToken] SearchResponse attributionToken - * @property {string|null} [nextPageToken] SearchResponse nextPageToken - * @property {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo - * @property {string|null} [redirectUri] SearchResponse redirectUri - * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * @interface IUpdateServingConfigRequest + * @property {google.cloud.retail.v2beta.IServingConfig|null} [servingConfig] UpdateServingConfigRequest servingConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateServingConfigRequest updateMask */ /** - * Constructs a new SearchResponse. + * Constructs a new UpdateServingConfigRequest. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a SearchResponse. - * @implements ISearchResponse + * @classdesc Represents an UpdateServingConfigRequest. + * @implements IUpdateServingConfigRequest * @constructor - * @param {google.cloud.retail.v2beta.ISearchResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2beta.IUpdateServingConfigRequest=} [properties] Properties to set */ - function SearchResponse(properties) { - this.results = []; - this.facets = []; - this.appliedControls = []; + function UpdateServingConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -76343,188 +88433,294 @@ } /** - * SearchResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2beta.SearchResponse + * UpdateServingConfigRequest servingConfig. + * @member {google.cloud.retail.v2beta.IServingConfig|null|undefined} servingConfig + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @instance + */ + UpdateServingConfigRequest.prototype.servingConfig = null; + + /** + * UpdateServingConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest * @instance */ - SearchResponse.prototype.results = $util.emptyArray; + UpdateServingConfigRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateServingConfigRequest} UpdateServingConfigRequest instance + */ + UpdateServingConfigRequest.create = function create(properties) { + return new UpdateServingConfigRequest(properties); + }; + + /** + * Encodes the specified UpdateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateServingConfigRequest} message UpdateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + $root.google.cloud.retail.v2beta.ServingConfig.encode(message.servingConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateServingConfigRequest} message UpdateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateServingConfigRequest} UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * SearchResponse facets. - * @member {Array.} facets - * @memberof google.cloud.retail.v2beta.SearchResponse - * @instance + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateServingConfigRequest} UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.prototype.facets = $util.emptyArray; + UpdateServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * SearchResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2beta.SearchResponse - * @instance + * Verifies an UpdateServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.prototype.totalSize = 0; + UpdateServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) { + var error = $root.google.cloud.retail.v2beta.ServingConfig.verify(message.servingConfig); + if (error) + return "servingConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; /** - * SearchResponse correctedQuery. - * @member {string} correctedQuery - * @memberof google.cloud.retail.v2beta.SearchResponse - * @instance + * Creates an UpdateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateServingConfigRequest} UpdateServingConfigRequest */ - SearchResponse.prototype.correctedQuery = ""; + UpdateServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateServingConfigRequest(); + if (object.servingConfig != null) { + if (typeof object.servingConfig !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateServingConfigRequest.servingConfig: object expected"); + message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.fromObject(object.servingConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateServingConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; /** - * SearchResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2beta.SearchResponse - * @instance + * Creates a plain object from an UpdateServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateServingConfigRequest} message UpdateServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchResponse.prototype.attributionToken = ""; + UpdateServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = null; + object.updateMask = null; + } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.toObject(message.servingConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; /** - * SearchResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2beta.SearchResponse + * Converts this UpdateServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest * @instance + * @returns {Object.} JSON object */ - SearchResponse.prototype.nextPageToken = ""; + UpdateServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateServingConfigRequest; + })(); + + v2beta.DeleteServingConfigRequest = (function() { /** - * SearchResponse queryExpansionInfo. - * @member {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo - * @memberof google.cloud.retail.v2beta.SearchResponse - * @instance + * Properties of a DeleteServingConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface IDeleteServingConfigRequest + * @property {string|null} [name] DeleteServingConfigRequest name */ - SearchResponse.prototype.queryExpansionInfo = null; /** - * SearchResponse redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2beta.SearchResponse - * @instance + * Constructs a new DeleteServingConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a DeleteServingConfigRequest. + * @implements IDeleteServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.IDeleteServingConfigRequest=} [properties] Properties to set */ - SearchResponse.prototype.redirectUri = ""; + function DeleteServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * SearchResponse appliedControls. - * @member {Array.} appliedControls - * @memberof google.cloud.retail.v2beta.SearchResponse + * DeleteServingConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @instance */ - SearchResponse.prototype.appliedControls = $util.emptyArray; + DeleteServingConfigRequest.prototype.name = ""; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new DeleteServingConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static - * @param {google.cloud.retail.v2beta.ISearchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse instance + * @param {google.cloud.retail.v2beta.IDeleteServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.DeleteServingConfigRequest} DeleteServingConfigRequest instance */ - SearchResponse.create = function create(properties) { - return new SearchResponse(properties); + DeleteServingConfigRequest.create = function create(properties) { + return new DeleteServingConfigRequest(properties); }; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * Encodes the specified DeleteServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteServingConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static - * @param {google.cloud.retail.v2beta.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IDeleteServingConfigRequest} message DeleteServingConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encode = function encode(message, writer) { + DeleteServingConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.facets != null && message.facets.length) - for (var i = 0; i < message.facets.length; ++i) - $root.google.cloud.retail.v2beta.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); - if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); - if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) - $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); - if (message.appliedControls != null && message.appliedControls.length) - for (var i = 0; i < message.appliedControls.length; ++i) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.verify|verify} messages. + * Encodes the specified DeleteServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteServingConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static - * @param {google.cloud.retail.v2beta.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2beta.IDeleteServingConfigRequest} message DeleteServingConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + DeleteServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2beta.DeleteServingConfigRequest} DeleteServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decode = function decode(reader, length) { + DeleteServingConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteServingConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2beta.SearchResponse.SearchResult.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.decode(reader, reader.uint32())); - break; - case 3: - message.totalSize = reader.int32(); - break; - case 4: - message.correctedQuery = reader.string(); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); - break; - case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - case 10: - message.redirectUri = reader.string(); - break; - case 12: - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -76535,1325 +88731,1157 @@ }; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2beta.DeleteServingConfigRequest} DeleteServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decodeDelimited = function decodeDelimited(reader) { + DeleteServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchResponse message. + * Verifies a DeleteServingConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.verify = function verify(message) { + DeleteServingConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.facets != null && message.hasOwnProperty("facets")) { - if (!Array.isArray(message.facets)) - return "facets: array expected"; - for (var i = 0; i < message.facets.length; ++i) { - var error = $root.google.cloud.retail.v2beta.SearchResponse.Facet.verify(message.facets[i]); - if (error) - return "facets." + error; - } - } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - if (!$util.isString(message.correctedQuery)) - return "correctedQuery: string expected"; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { - var error = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); - if (error) - return "queryExpansionInfo." + error; - } - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; - if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { - if (!Array.isArray(message.appliedControls)) - return "appliedControls: array expected"; - for (var i = 0; i < message.appliedControls.length; ++i) - if (!$util.isString(message.appliedControls[i])) - return "appliedControls: string[] expected"; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteServingConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2beta.DeleteServingConfigRequest} DeleteServingConfigRequest */ - SearchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse) + DeleteServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.DeleteServingConfigRequest) return object; - var message = new $root.google.cloud.retail.v2beta.SearchResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.fromObject(object.results[i]); - } - } - if (object.facets) { - if (!Array.isArray(object.facets)) - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.facets: array expected"); - message.facets = []; - for (var i = 0; i < object.facets.length; ++i) { - if (typeof object.facets[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.facets: object expected"); - message.facets[i] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.fromObject(object.facets[i]); - } - } - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; - if (object.correctedQuery != null) - message.correctedQuery = String(object.correctedQuery); - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.queryExpansionInfo != null) { - if (typeof object.queryExpansionInfo !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.queryExpansionInfo: object expected"); - message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); - } - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); - if (object.appliedControls) { - if (!Array.isArray(object.appliedControls)) - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.appliedControls: array expected"); - message.appliedControls = []; - for (var i = 0; i < object.appliedControls.length; ++i) - message.appliedControls[i] = String(object.appliedControls[i]); - } + var message = new $root.google.cloud.retail.v2beta.DeleteServingConfigRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * Creates a plain object from a DeleteServingConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @static - * @param {google.cloud.retail.v2beta.SearchResponse} message SearchResponse + * @param {google.cloud.retail.v2beta.DeleteServingConfigRequest} message DeleteServingConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchResponse.toObject = function toObject(message, options) { + DeleteServingConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.facets = []; - object.appliedControls = []; - } - if (options.defaults) { - object.totalSize = 0; - object.correctedQuery = ""; - object.attributionToken = ""; - object.nextPageToken = ""; - object.queryExpansionInfo = null; - object.redirectUri = ""; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2beta.SearchResponse.SearchResult.toObject(message.results[j], options); - } - if (message.facets && message.facets.length) { - object.facets = []; - for (var j = 0; j < message.facets.length; ++j) - object.facets[j] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.toObject(message.facets[j], options); - } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - object.correctedQuery = message.correctedQuery; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) - object.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; - if (message.appliedControls && message.appliedControls.length) { - object.appliedControls = []; - for (var j = 0; j < message.appliedControls.length; ++j) - object.appliedControls[j] = message.appliedControls[j]; - } + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this SearchResponse to JSON. + * Converts this DeleteServingConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchResponse + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest * @instance * @returns {Object.} JSON object */ - SearchResponse.prototype.toJSON = function toJSON() { + DeleteServingConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchResponse.SearchResult = (function() { + return DeleteServingConfigRequest; + })(); - /** - * Properties of a SearchResult. - * @memberof google.cloud.retail.v2beta.SearchResponse - * @interface ISearchResult - * @property {string|null} [id] SearchResult id - * @property {google.cloud.retail.v2beta.IProduct|null} [product] SearchResult product - * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount - * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields - * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues - */ + v2beta.GetServingConfigRequest = (function() { - /** - * Constructs a new SearchResult. - * @memberof google.cloud.retail.v2beta.SearchResponse - * @classdesc Represents a SearchResult. - * @implements ISearchResult - * @constructor - * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult=} [properties] Properties to set - */ - function SearchResult(properties) { - this.matchingVariantFields = {}; - this.variantRollupValues = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a GetServingConfigRequest. + * @memberof google.cloud.retail.v2beta + * @interface IGetServingConfigRequest + * @property {string|null} [name] GetServingConfigRequest name + */ - /** - * SearchResult id. - * @member {string} id - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.id = ""; + /** + * Constructs a new GetServingConfigRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a GetServingConfigRequest. + * @implements IGetServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2beta.IGetServingConfigRequest=} [properties] Properties to set + */ + function GetServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * SearchResult product. - * @member {google.cloud.retail.v2beta.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.product = null; + /** + * GetServingConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @instance + */ + GetServingConfigRequest.prototype.name = ""; - /** - * SearchResult matchingVariantCount. - * @member {number} matchingVariantCount - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantCount = 0; + /** + * Creates a new GetServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.GetServingConfigRequest} GetServingConfigRequest instance + */ + GetServingConfigRequest.create = function create(properties) { + return new GetServingConfigRequest(properties); + }; - /** - * SearchResult matchingVariantFields. - * @member {Object.} matchingVariantFields - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantFields = $util.emptyObject; + /** + * Encodes the specified GetServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2beta.GetServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetServingConfigRequest} message GetServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; - /** - * SearchResult variantRollupValues. - * @member {Object.} variantRollupValues - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.variantRollupValues = $util.emptyObject; + /** + * Encodes the specified GetServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.GetServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.IGetServingConfigRequest} message GetServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new SearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult instance - */ - SearchResult.create = function create(properties) { - return new SearchResult(properties); - }; + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.GetServingConfigRequest} GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.GetServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.GetServingConfigRequest} GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2beta.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); - if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) - for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) - for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * Creates a GetServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.GetServingConfigRequest} GetServingConfigRequest + */ + GetServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.GetServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.GetServingConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.SearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a plain object from a GetServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2beta.GetServingConfigRequest} message GetServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.SearchResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 3: - message.matchingVariantCount = reader.int32(); - break; - case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.variantRollupValues[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Converts this GetServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return GetServingConfigRequest; + })(); - /** - * Verifies a SearchResult message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2beta.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - if (!$util.isInteger(message.matchingVariantCount)) - return "matchingVariantCount: integer expected"; - if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { - if (!$util.isObject(message.matchingVariantFields)) - return "matchingVariantFields: object expected"; - var key = Object.keys(message.matchingVariantFields); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); - if (error) - return "matchingVariantFields." + error; - } - } - if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { - if (!$util.isObject(message.variantRollupValues)) - return "variantRollupValues: object expected"; - var key = Object.keys(message.variantRollupValues); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); - if (error) - return "variantRollupValues." + error; - } - } - return null; - }; + v2beta.ListServingConfigsRequest = (function() { - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchResponse.SearchResult} SearchResult - */ - SearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.SearchResult) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchResponse.SearchResult(); - if (object.id != null) - message.id = String(object.id); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.product: object expected"); - message.product = $root.google.cloud.retail.v2beta.Product.fromObject(object.product); - } - if (object.matchingVariantCount != null) - message.matchingVariantCount = object.matchingVariantCount | 0; - if (object.matchingVariantFields) { - if (typeof object.matchingVariantFields !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields = {}; - for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { - if (typeof object.matchingVariantFields[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); - } - } - if (object.variantRollupValues) { - if (typeof object.variantRollupValues !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues = {}; - for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { - if (typeof object.variantRollupValues[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); - } - } - return message; - }; + /** + * Properties of a ListServingConfigsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IListServingConfigsRequest + * @property {string|null} [parent] ListServingConfigsRequest parent + * @property {number|null} [pageSize] ListServingConfigsRequest pageSize + * @property {string|null} [pageToken] ListServingConfigsRequest pageToken + */ - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.SearchResult} message SearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) { - object.matchingVariantFields = {}; - object.variantRollupValues = {}; - } - if (options.defaults) { - object.id = ""; - object.product = null; - object.matchingVariantCount = 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2beta.Product.toObject(message.product, options); - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - object.matchingVariantCount = message.matchingVariantCount; - var keys2; - if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { - object.matchingVariantFields = {}; - for (var j = 0; j < keys2.length; ++j) - object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); - } - if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { - object.variantRollupValues = {}; - for (var j = 0; j < keys2.length; ++j) - object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); - } - return object; - }; + /** + * Constructs a new ListServingConfigsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListServingConfigsRequest. + * @implements IListServingConfigsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IListServingConfigsRequest=} [properties] Properties to set + */ + function ListServingConfigsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this SearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult - * @instance - * @returns {Object.} JSON object - */ - SearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * ListServingConfigsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @instance + */ + ListServingConfigsRequest.prototype.parent = ""; - return SearchResult; - })(); + /** + * ListServingConfigsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @instance + */ + ListServingConfigsRequest.prototype.pageSize = 0; - SearchResponse.Facet = (function() { + /** + * ListServingConfigsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @instance + */ + ListServingConfigsRequest.prototype.pageToken = ""; - /** - * Properties of a Facet. - * @memberof google.cloud.retail.v2beta.SearchResponse - * @interface IFacet - * @property {string|null} [key] Facet key - * @property {Array.|null} [values] Facet values - * @property {boolean|null} [dynamicFacet] Facet dynamicFacet - */ + /** + * Creates a new ListServingConfigsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2beta.IListServingConfigsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListServingConfigsRequest} ListServingConfigsRequest instance + */ + ListServingConfigsRequest.create = function create(properties) { + return new ListServingConfigsRequest(properties); + }; - /** - * Constructs a new Facet. - * @memberof google.cloud.retail.v2beta.SearchResponse - * @classdesc Represents a Facet. - * @implements IFacet - * @constructor - * @param {google.cloud.retail.v2beta.SearchResponse.IFacet=} [properties] Properties to set - */ - function Facet(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified ListServingConfigsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2beta.IListServingConfigsRequest} message ListServingConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; - /** - * Facet key. - * @member {string} key - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @instance - */ - Facet.prototype.key = ""; + /** + * Encodes the specified ListServingConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2beta.IListServingConfigsRequest} message ListServingConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Facet values. - * @member {Array.} values - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @instance - */ - Facet.prototype.values = $util.emptyArray; + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListServingConfigsRequest} ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListServingConfigsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Facet dynamicFacet. - * @member {boolean} dynamicFacet - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @instance - */ - Facet.prototype.dynamicFacet = false; + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListServingConfigsRequest} ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a new Facet instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.IFacet=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet instance - */ - Facet.create = function create(properties) { - return new Facet(properties); - }; + /** + * Verifies a ListServingConfigsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServingConfigsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); - return writer; - }; + /** + * Creates a ListServingConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListServingConfigsRequest} ListServingConfigsRequest + */ + ListServingConfigsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListServingConfigsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ListServingConfigsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a plain object from a ListServingConfigsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2beta.ListServingConfigsRequest} message ListServingConfigsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServingConfigsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; - /** - * Decodes a Facet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Converts this ListServingConfigsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @instance + * @returns {Object.} JSON object + */ + ListServingConfigsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return ListServingConfigsRequest; + })(); - /** - * Verifies a Facet message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Facet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - if (typeof message.dynamicFacet !== "boolean") - return "dynamicFacet: boolean expected"; - return null; - }; + v2beta.ListServingConfigsResponse = (function() { - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet} Facet - */ - Facet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.Facet) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet(); - if (object.key != null) - message.key = String(object.key); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.values: object expected"); - message.values[i] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); - } - } - if (object.dynamicFacet != null) - message.dynamicFacet = Boolean(object.dynamicFacet); - return message; - }; + /** + * Properties of a ListServingConfigsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IListServingConfigsResponse + * @property {Array.|null} [servingConfigs] ListServingConfigsResponse servingConfigs + * @property {string|null} [nextPageToken] ListServingConfigsResponse nextPageToken + */ - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.Facet} message Facet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Facet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (options.defaults) { - object.key = ""; - object.dynamicFacet = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - object.dynamicFacet = message.dynamicFacet; - return object; - }; + /** + * Constructs a new ListServingConfigsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListServingConfigsResponse. + * @implements IListServingConfigsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IListServingConfigsResponse=} [properties] Properties to set + */ + function ListServingConfigsResponse(properties) { + this.servingConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this Facet to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @instance - * @returns {Object.} JSON object - */ - Facet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * ListServingConfigsResponse servingConfigs. + * @member {Array.} servingConfigs + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @instance + */ + ListServingConfigsResponse.prototype.servingConfigs = $util.emptyArray; - Facet.FacetValue = (function() { + /** + * ListServingConfigsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @instance + */ + ListServingConfigsResponse.prototype.nextPageToken = ""; - /** - * Properties of a FacetValue. - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @interface IFacetValue - * @property {string|null} [value] FacetValue value - * @property {google.cloud.retail.v2beta.IInterval|null} [interval] FacetValue interval - * @property {number|Long|null} [count] FacetValue count - */ + /** + * Creates a new ListServingConfigsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2beta.IListServingConfigsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListServingConfigsResponse} ListServingConfigsResponse instance + */ + ListServingConfigsResponse.create = function create(properties) { + return new ListServingConfigsResponse(properties); + }; - /** - * Constructs a new FacetValue. - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet - * @classdesc Represents a FacetValue. - * @implements IFacetValue - * @constructor - * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - */ - function FacetValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified ListServingConfigsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2beta.IListServingConfigsResponse} message ListServingConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfigs != null && message.servingConfigs.length) + for (var i = 0; i < message.servingConfigs.length; ++i) + $root.google.cloud.retail.v2beta.ServingConfig.encode(message.servingConfigs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; - /** - * FacetValue value. - * @member {string|null|undefined} value - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.value = null; + /** + * Encodes the specified ListServingConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListServingConfigsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2beta.IListServingConfigsResponse} message ListServingConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * FacetValue interval. - * @member {google.cloud.retail.v2beta.IInterval|null|undefined} interval - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.interval = null; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListServingConfigsResponse} ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListServingConfigsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.servingConfigs && message.servingConfigs.length)) + message.servingConfigs = []; + message.servingConfigs.push($root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * FacetValue count. - * @member {number|Long} count - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListServingConfigsResponse} ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Verifies a ListServingConfigsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServingConfigsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfigs != null && message.hasOwnProperty("servingConfigs")) { + if (!Array.isArray(message.servingConfigs)) + return "servingConfigs: array expected"; + for (var i = 0; i < message.servingConfigs.length; ++i) { + var error = $root.google.cloud.retail.v2beta.ServingConfig.verify(message.servingConfigs[i]); + if (error) + return "servingConfigs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; - /** - * FacetValue facetValue. - * @member {"value"|"interval"|undefined} facetValue - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @instance - */ - Object.defineProperty(FacetValue.prototype, "facetValue", { - get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Creates a ListServingConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListServingConfigsResponse} ListServingConfigsResponse + */ + ListServingConfigsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListServingConfigsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListServingConfigsResponse(); + if (object.servingConfigs) { + if (!Array.isArray(object.servingConfigs)) + throw TypeError(".google.cloud.retail.v2beta.ListServingConfigsResponse.servingConfigs: array expected"); + message.servingConfigs = []; + for (var i = 0; i < object.servingConfigs.length; ++i) { + if (typeof object.servingConfigs[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListServingConfigsResponse.servingConfigs: object expected"); + message.servingConfigs[i] = $root.google.cloud.retail.v2beta.ServingConfig.fromObject(object.servingConfigs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; - /** - * Creates a new FacetValue instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue instance - */ - FacetValue.create = function create(properties) { - return new FacetValue(properties); - }; + /** + * Creates a plain object from a ListServingConfigsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2beta.ListServingConfigsResponse} message ListServingConfigsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServingConfigsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.servingConfigs && message.servingConfigs.length) { + object.servingConfigs = []; + for (var j = 0; j < message.servingConfigs.length; ++j) + object.servingConfigs[j] = $root.google.cloud.retail.v2beta.ServingConfig.toObject(message.servingConfigs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) - $root.google.cloud.retail.v2beta.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); - return writer; - }; + /** + * Converts this ListServingConfigsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @instance + * @returns {Object.} JSON object + */ + ListServingConfigsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + return ListServingConfigsResponse; + })(); - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.interval = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); - break; - case 3: - message.count = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + v2beta.AddControlRequest = (function() { - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Properties of an AddControlRequest. + * @memberof google.cloud.retail.v2beta + * @interface IAddControlRequest + * @property {string|null} [servingConfig] AddControlRequest servingConfig + * @property {string|null} [controlId] AddControlRequest controlId + */ - /** - * Verifies a FacetValue message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.value != null && message.hasOwnProperty("value")) { - properties.facetValue = 1; - if (!$util.isString(message.value)) - return "value: string expected"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - if (properties.facetValue === 1) - return "facetValue: multiple values"; - properties.facetValue = 1; - { - var error = $root.google.cloud.retail.v2beta.Interval.verify(message.interval); - if (error) - return "interval." + error; - } - } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - return null; - }; + /** + * Constructs a new AddControlRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an AddControlRequest. + * @implements IAddControlRequest + * @constructor + * @param {google.cloud.retail.v2beta.IAddControlRequest=} [properties] Properties to set + */ + function AddControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} FacetValue - */ - FacetValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue(); - if (object.value != null) - message.value = String(object.value); - if (object.interval != null) { - if (typeof object.interval !== "object") - throw TypeError(".google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.interval: object expected"); - message.interval = $root.google.cloud.retail.v2beta.Interval.fromObject(object.interval); - } - if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - return message; - }; + /** + * AddControlRequest servingConfig. + * @member {string} servingConfig + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @instance + */ + AddControlRequest.prototype.servingConfig = ""; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue} message FacetValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) { - object.value = message.value; - if (options.oneofs) - object.facetValue = "value"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - object.interval = $root.google.cloud.retail.v2beta.Interval.toObject(message.interval, options); - if (options.oneofs) - object.facetValue = "interval"; - } - if (message.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - return object; - }; + /** + * AddControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @instance + */ + AddControlRequest.prototype.controlId = ""; - /** - * Converts this FacetValue to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue - * @instance - * @returns {Object.} JSON object - */ - FacetValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a new AddControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {google.cloud.retail.v2beta.IAddControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.AddControlRequest} AddControlRequest instance + */ + AddControlRequest.create = function create(properties) { + return new AddControlRequest(properties); + }; - return FacetValue; - })(); + /** + * Encodes the specified AddControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.AddControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {google.cloud.retail.v2beta.IAddControlRequest} message AddControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfig); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.controlId); + return writer; + }; - return Facet; - })(); + /** + * Encodes the specified AddControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.AddControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {google.cloud.retail.v2beta.IAddControlRequest} message AddControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - SearchResponse.QueryExpansionInfo = (function() { + /** + * Decodes an AddControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.AddControlRequest} AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.AddControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.servingConfig = reader.string(); + break; + case 2: + message.controlId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Properties of a QueryExpansionInfo. - * @memberof google.cloud.retail.v2beta.SearchResponse - * @interface IQueryExpansionInfo - * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery - * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount - */ + /** + * Decodes an AddControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.AddControlRequest} AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Constructs a new QueryExpansionInfo. - * @memberof google.cloud.retail.v2beta.SearchResponse - * @classdesc Represents a QueryExpansionInfo. - * @implements IQueryExpansionInfo - * @constructor - * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - */ - function QueryExpansionInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Verifies an AddControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + if (!$util.isString(message.servingConfig)) + return "servingConfig: string expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; + + /** + * Creates an AddControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.AddControlRequest} AddControlRequest + */ + AddControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.AddControlRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.AddControlRequest(); + if (object.servingConfig != null) + message.servingConfig = String(object.servingConfig); + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; + + /** + * Creates a plain object from an AddControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {google.cloud.retail.v2beta.AddControlRequest} message AddControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = ""; + object.controlId = ""; } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = message.servingConfig; + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; - /** - * QueryExpansionInfo expandedQuery. - * @member {boolean} expandedQuery - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.expandedQuery = false; + /** + * Converts this AddControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @instance + * @returns {Object.} JSON object + */ + AddControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * QueryExpansionInfo pinnedResultCount. - * @member {number|Long} pinnedResultCount - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + return AddControlRequest; + })(); - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance - */ - QueryExpansionInfo.create = function create(properties) { - return new QueryExpansionInfo(properties); - }; + v2beta.RemoveControlRequest = (function() { - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); - if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); - return writer; - }; + /** + * Properties of a RemoveControlRequest. + * @memberof google.cloud.retail.v2beta + * @interface IRemoveControlRequest + * @property {string|null} [servingConfig] RemoveControlRequest servingConfig + * @property {string|null} [controlId] RemoveControlRequest controlId + */ - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new RemoveControlRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a RemoveControlRequest. + * @implements IRemoveControlRequest + * @constructor + * @param {google.cloud.retail.v2beta.IRemoveControlRequest=} [properties] Properties to set + */ + function RemoveControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * RemoveControlRequest servingConfig. + * @member {string} servingConfig + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @instance + */ + RemoveControlRequest.prototype.servingConfig = ""; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * RemoveControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @instance + */ + RemoveControlRequest.prototype.controlId = ""; - /** - * Verifies a QueryExpansionInfo message. - * @function verify - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - if (typeof message.expandedQuery !== "boolean") - return "expandedQuery: boolean expected"; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) - return "pinnedResultCount: integer|Long expected"; - return null; - }; + /** + * Creates a new RemoveControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.RemoveControlRequest} RemoveControlRequest instance + */ + RemoveControlRequest.create = function create(properties) { + return new RemoveControlRequest(properties); + }; - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - */ - QueryExpansionInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo) - return object; - var message = new $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo(); - if (object.expandedQuery != null) - message.expandedQuery = Boolean(object.expandedQuery); - if (object.pinnedResultCount != null) - if ($util.Long) - (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; - else if (typeof object.pinnedResultCount === "string") - message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); - else if (typeof object.pinnedResultCount === "number") - message.pinnedResultCount = object.pinnedResultCount; - else if (typeof object.pinnedResultCount === "object") - message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); - return message; - }; + /** + * Encodes the specified RemoveControlRequest message. Does not implicitly {@link google.cloud.retail.v2beta.RemoveControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveControlRequest} message RemoveControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfig); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.controlId); + return writer; + }; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.expandedQuery = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pinnedResultCount = options.longs === String ? "0" : 0; + /** + * Encodes the specified RemoveControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.RemoveControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2beta.IRemoveControlRequest} message RemoveControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.RemoveControlRequest} RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.RemoveControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.servingConfig = reader.string(); + break; + case 2: + message.controlId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - object.expandedQuery = message.expandedQuery; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (typeof message.pinnedResultCount === "number") - object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; - else - object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + } + return message; + }; + + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.RemoveControlRequest} RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + if (!$util.isString(message.servingConfig)) + return "servingConfig: string expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; + + /** + * Creates a RemoveControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.RemoveControlRequest} RemoveControlRequest + */ + RemoveControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.RemoveControlRequest) return object; - }; + var message = new $root.google.cloud.retail.v2beta.RemoveControlRequest(); + if (object.servingConfig != null) + message.servingConfig = String(object.servingConfig); + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; - /** - * Converts this QueryExpansionInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a RemoveControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2beta.RemoveControlRequest} message RemoveControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = ""; + object.controlId = ""; + } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = message.servingConfig; + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; - return QueryExpansionInfo; - })(); + /** + * Converts this RemoveControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return SearchResponse; + return RemoveControlRequest; })(); v2beta.UserEventService = (function() { diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 3017e50607c..bce4cdd8b67 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -212,6 +212,10 @@ "note": { "type": "string", "id": 3 + }, + "force": { + "type": "bool", + "id": 4 } } }, @@ -465,11 +469,28 @@ } } }, - "Promotion": { + "LocalInventory": { "fields": { - "promotionId": { + "placeId": { "type": "string", "id": 1 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 2 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 3 + }, + "fulfillmentTypes": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } } } }, @@ -708,7 +729,10 @@ }, "requestId": { "type": "string", - "id": 6 + "id": 6, + "options": { + "deprecated": true + } }, "inputConfig": { "type": "ProductInputConfig", @@ -887,7 +911,10 @@ }, "requestId": { "type": "string", - "id": 5 + "id": 5, + "options": { + "deprecated": true + } }, "notificationPubsubTopic": { "type": "string", @@ -1144,6 +1171,14 @@ } } }, + "Promotion": { + "fields": { + "promotionId": { + "type": "string", + "id": 1 + } + } + }, "UserEvent": { "fields": { "eventType": { @@ -1611,6 +1646,62 @@ } } ] + }, + "AddLocalInventories": { + "requestType": "AddLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.AddLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.AddLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.AddLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2.AddLocalInventoriesMetadata" + } + } + ] + }, + "RemoveLocalInventories": { + "requestType": "RemoveLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.RemoveLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.RemoveLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" + } + } + ] } } }, @@ -1794,6 +1885,78 @@ "AddFulfillmentPlacesResponse": { "fields": {} }, + "AddLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 6 + } + } + }, + "AddLocalInventoriesMetadata": { + "fields": {} + }, + "AddLocalInventoriesResponse": { + "fields": {} + }, + "RemoveLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "RemoveLocalInventoriesMetadata": { + "fields": {} + }, + "RemoveLocalInventoriesResponse": { + "fields": {} + }, "RemoveFulfillmentPlacesRequest": { "fields": { "product": { @@ -1954,7 +2117,10 @@ }, "dynamicFacetSpec": { "type": "DynamicFacetSpec", - "id": 21 + "id": 21, + "options": { + "deprecated": true + } }, "boostSpec": { "type": "BoostSpec", @@ -1977,6 +2143,10 @@ "searchMode": { "type": "SearchMode", "id": 31 + }, + "personalizationSpec": { + "type": "PersonalizationSpec", + "id": 32 } }, "nested": { @@ -2063,11 +2233,25 @@ } }, "BoostSpec": { + "oneofs": { + "_skipBoostSpecValidation": { + "oneof": [ + "skipBoostSpecValidation" + ] + } + }, "fields": { "conditionBoostSpecs": { "rule": "repeated", "type": "ConditionBoostSpec", "id": 1 + }, + "skipBoostSpecValidation": { + "type": "bool", + "id": 2, + "options": { + "proto3_optional": true + } } }, "nested": { @@ -2106,6 +2290,23 @@ } } }, + "PersonalizationSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "AUTO": 1, + "DISABLED": 2 + } + } + } + }, "SearchMode": { "values": { "SEARCH_MODE_UNSPECIFIED": 0, @@ -2150,6 +2351,16 @@ "redirectUri": { "type": "string", "id": 10 + }, + "appliedControls": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "invalidConditionBoostSpecs": { + "rule": "repeated", + "type": "SearchRequest.BoostSpec.ConditionBoostSpec", + "id": 14 } }, "nested": { @@ -5346,81 +5557,303 @@ } } }, - "Catalog": { - "options": { - "(google.api.resource).type": "retail.googleapis.com/Catalog", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" - }, + "CatalogAttribute": { "fields": { - "name": { + "key": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "REQUIRED" } }, - "displayName": { - "type": "string", - "id": 2, + "inUse": { + "type": "bool", + "id": 9, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "OUTPUT_ONLY" } }, - "productLevelConfig": { - "type": "ProductLevelConfig", - "id": 4, + "type": { + "type": "AttributeType", + "id": 10, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OUTPUT_ONLY" } - } - } - }, - "SolutionType": { - "values": { - "SOLUTION_TYPE_UNSPECIFIED": 0, - "SOLUTION_TYPE_RECOMMENDATION": 1, - "SOLUTION_TYPE_SEARCH": 2 - } - }, - "Condition": { - "fields": { - "queryTerms": { - "rule": "repeated", - "type": "QueryTerm", - "id": 1 }, - "activeTimeRange": { - "rule": "repeated", - "type": "TimeRange", - "id": 3 + "indexableOption": { + "type": "IndexableOption", + "id": 5 + }, + "dynamicFacetableOption": { + "type": "DynamicFacetableOption", + "id": 6 + }, + "searchableOption": { + "type": "SearchableOption", + "id": 7 } }, "nested": { - "QueryTerm": { - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "fullMatch": { - "type": "bool", - "id": 2 - } + "AttributeType": { + "values": { + "UNKNOWN": 0, + "TEXTUAL": 1, + "NUMERICAL": 2 } }, - "TimeRange": { - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - } + "IndexableOption": { + "values": { + "INDEXABLE_OPTION_UNSPECIFIED": 0, + "INDEXABLE_ENABLED": 1, + "INDEXABLE_DISABLED": 2 } - } - } + }, + "DynamicFacetableOption": { + "values": { + "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": 0, + "DYNAMIC_FACETABLE_ENABLED": 1, + "DYNAMIC_FACETABLE_DISABLED": 2 + } + }, + "SearchableOption": { + "values": { + "SEARCHABLE_OPTION_UNSPECIFIED": 0, + "SEARCHABLE_ENABLED": 1, + "SEARCHABLE_DISABLED": 2 + } + } + } + }, + "AttributesConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/AttributesConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "catalogAttributes": { + "keyType": "string", + "type": "CatalogAttribute", + "id": 2 + }, + "attributeConfigLevel": { + "type": "AttributeConfigLevel", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CompletionConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/CompletionConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "matchingOrder": { + "type": "string", + "id": 2 + }, + "maxSuggestions": { + "type": "int32", + "id": 3 + }, + "minPrefixLength": { + "type": "int32", + "id": 4 + }, + "autoLearning": { + "type": "bool", + "id": 11 + }, + "suggestionsInputConfig": { + "type": "CompletionDataInputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastSuggestionsImportOperation": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "denylistInputConfig": { + "type": "CompletionDataInputConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastDenylistImportOperation": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "allowlistInputConfig": { + "type": "CompletionDataInputConfig", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastAllowlistImportOperation": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "MerchantCenterLink": { + "fields": { + "merchantCenterAccountId": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "branchId": { + "type": "string", + "id": 2 + }, + "destinations": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "regionCode": { + "type": "string", + "id": 4 + }, + "languageCode": { + "type": "string", + "id": 5 + } + } + }, + "MerchantCenterLinkingConfig": { + "fields": { + "links": { + "rule": "repeated", + "type": "MerchantCenterLink", + "id": 1 + } + } + }, + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "productLevelConfig": { + "type": "ProductLevelConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "merchantCenterLinkingConfig": { + "type": "MerchantCenterLinkingConfig", + "id": 6 + } + } + }, + "AttributeConfigLevel": { + "values": { + "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": 0, + "PRODUCT_LEVEL_ATTRIBUTE_CONFIG": 1, + "CATALOG_LEVEL_ATTRIBUTE_CONFIG": 2 + } + }, + "SolutionType": { + "values": { + "SOLUTION_TYPE_UNSPECIFIED": 0, + "SOLUTION_TYPE_RECOMMENDATION": 1, + "SOLUTION_TYPE_SEARCH": 2 + } + }, + "SearchSolutionUseCase": { + "values": { + "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": 0, + "SEARCH_SOLUTION_USE_CASE_SEARCH": 1, + "SEARCH_SOLUTION_USE_CASE_BROWSE": 2 + } + }, + "Condition": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "QueryTerm", + "id": 1 + }, + "activeTimeRange": { + "rule": "repeated", + "type": "TimeRange", + "id": 3 + } + }, + "nested": { + "QueryTerm": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "fullMatch": { + "type": "bool", + "id": 2 + } + } + }, + "TimeRange": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } }, "Rule": { "oneofs": { @@ -5802,11 +6235,28 @@ } } }, - "Promotion": { + "LocalInventory": { "fields": { - "promotionId": { + "placeId": { "type": "string", "id": 1 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 2 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 3 + }, + "fulfillmentTypes": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } } } }, @@ -5918,7 +6368,10 @@ }, "requestId": { "type": "string", - "id": 6 + "id": 6, + "options": { + "deprecated": true + } }, "inputConfig": { "type": "ProductInputConfig", @@ -6097,7 +6550,10 @@ }, "requestId": { "type": "string", - "id": 5 + "id": 5, + "options": { + "deprecated": true + } }, "notificationPubsubTopic": { "type": "string", @@ -6354,6 +6810,14 @@ } } }, + "Promotion": { + "fields": { + "promotionId": { + "type": "string", + "id": 1 + } + } + }, "UserEvent": { "fields": { "eventType": { @@ -6590,18 +7054,142 @@ "(google.api.method_signature)": "catalog" } ] - } - } - }, - "ListCatalogsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } + }, + "GetCompletionConfig": { + "requestType": "GetCompletionConfigRequest", + "responseType": "CompletionConfig", + "options": { + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/completionConfig}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/completionConfig}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateCompletionConfig": { + "requestType": "UpdateCompletionConfigRequest", + "responseType": "CompletionConfig", + "options": { + "(google.api.http).patch": "/v2beta/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}", + "(google.api.http).body": "completion_config", + "(google.api.method_signature)": "completion_config,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}", + "body": "completion_config" + } + }, + { + "(google.api.method_signature)": "completion_config,update_mask" + } + ] + }, + "GetAttributesConfig": { + "requestType": "GetAttributesConfigRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/attributesConfig}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/attributesConfig}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateAttributesConfig": { + "requestType": "UpdateAttributesConfigRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).patch": "/v2beta/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}", + "(google.api.http).body": "attributes_config", + "(google.api.method_signature)": "attributes_config,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}", + "body": "attributes_config" + } + }, + { + "(google.api.method_signature)": "attributes_config,update_mask" + } + ] + }, + "AddCatalogAttribute": { + "requestType": "AddCatalogAttributeRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", + "body": "*" + } + } + ] + }, + "RemoveCatalogAttribute": { + "requestType": "RemoveCatalogAttributeRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", + "body": "*" + } + } + ] + }, + "ReplaceCatalogAttribute": { + "requestType": "ReplaceCatalogAttributeRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", + "body": "*" + } + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } }, "pageSize": { "type": "int32", @@ -6660,6 +7248,10 @@ "note": { "type": "string", "id": 3 + }, + "force": { + "type": "bool", + "id": 4 } } }, @@ -6693,6 +7285,121 @@ } } }, + "GetCompletionConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/CompletionConfig" + } + } + } + }, + "UpdateCompletionConfigRequest": { + "fields": { + "completionConfig": { + "type": "CompletionConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "GetAttributesConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + } + } + }, + "UpdateAttributesConfigRequest": { + "fields": { + "attributesConfig": { + "type": "AttributesConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "AddCatalogAttributeRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "catalogAttribute": { + "type": "CatalogAttribute", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RemoveCatalogAttributeRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "key": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ReplaceCatalogAttributeRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "catalogAttribute": { + "type": "CatalogAttribute", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, "CompletionService": { "options": { "(google.api.default_host)": "retail.googleapis.com", @@ -6820,76 +7527,77 @@ } } }, - "ExportErrorsConfig": { + "Control": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Control", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }, "oneofs": { - "destination": { + "control": { "oneof": [ - "gcsPrefix" + "facetSpec", + "rule" ] } }, "fields": { - "gcsPrefix": { + "facetSpec": { + "type": "SearchRequest.FacetSpec", + "id": 3 + }, + "rule": { + "type": "Rule", + "id": 4 + }, + "name": { "type": "string", - "id": 1 - } - } - }, - "ExportMetadata": { - "fields": { - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - } - } - }, - "ExportProductsResponse": { - "fields": { - "errorSamples": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "errorsConfig": { - "type": "ExportErrorsConfig", - "id": 2 - } - } - }, - "ExportUserEventsResponse": { - "fields": { - "errorSamples": { + "associatedServingConfigIds": { "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "errorsConfig": { - "type": "ExportErrorsConfig", - "id": 2 + "solutionTypes": { + "rule": "repeated", + "type": "SolutionType", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } } } }, - "PredictionService": { + "SearchService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "Predict": { - "requestType": "PredictRequest", - "responseType": "PredictResponse", + "Search": { + "requestType": "SearchRequest", + "responseType": "SearchResponse", "options": { - "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", "(google.api.http).body": "*" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", "body": "*" } } @@ -6897,7 +7605,7 @@ } } }, - "PredictRequest": { + "SearchRequest": { "fields": { "placement": { "type": "string", @@ -6906,306 +7614,509 @@ "(google.api.field_behavior)": "REQUIRED" } }, - "userEvent": { - "type": "UserEvent", + "branch": { + "type": "string", "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "query": { + "type": "string", + "id": 3 + }, + "visitorId": { + "type": "string", + "id": 4, "options": { "(google.api.field_behavior)": "REQUIRED" } }, + "userInfo": { + "type": "UserInfo", + "id": 5 + }, "pageSize": { "type": "int32", - "id": 3 + "id": 7 }, "pageToken": { "type": "string", - "id": 4 + "id": 8 + }, + "offset": { + "type": "int32", + "id": 9 }, "filter": { "type": "string", - "id": 5 - }, - "validateOnly": { - "type": "bool", - "id": 6 + "id": 10 }, - "params": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 7 + "canonicalFilter": { + "type": "string", + "id": 28 }, - "labels": { - "keyType": "string", + "orderBy": { "type": "string", - "id": 8 - } - } - }, - "PredictResponse": { - "fields": { - "results": { + "id": 11 + }, + "facetSpecs": { "rule": "repeated", - "type": "PredictionResult", - "id": 1 + "type": "FacetSpec", + "id": 12 }, - "attributionToken": { + "dynamicFacetSpec": { + "type": "DynamicFacetSpec", + "id": 21, + "options": { + "deprecated": true + } + }, + "boostSpec": { + "type": "BoostSpec", + "id": 13 + }, + "queryExpansionSpec": { + "type": "QueryExpansionSpec", + "id": 14 + }, + "variantRollupKeys": { + "rule": "repeated", "type": "string", - "id": 2 + "id": 17 }, - "missingIds": { + "pageCategories": { "rule": "repeated", "type": "string", - "id": 3 + "id": 23 }, - "validateOnly": { - "type": "bool", - "id": 4 + "searchMode": { + "type": "SearchMode", + "id": 31 + }, + "personalizationSpec": { + "type": "PersonalizationSpec", + "id": 32 } }, "nested": { - "PredictionResult": { + "FacetSpec": { "fields": { - "id": { - "type": "string", - "id": 1 + "facetKey": { + "type": "FacetKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "metadata": { - "keyType": "string", - "type": "google.protobuf.Value", + "limit": { + "type": "int32", "id": 2 - } - } - } - } - }, - "ProductService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "body": "product" - } }, - { - "(google.api.method_signature)": "parent,product,product_id" + "excludedFilterKeys": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "enableDynamicPosition": { + "type": "bool", + "id": 4 } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "nested": { + "FacetKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "intervals": { + "rule": "repeated", + "type": "Interval", + "id": 2 + }, + "restrictedValues": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "prefixes": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "contains": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "orderBy": { + "type": "string", + "id": 4 + }, + "query": { + "type": "string", + "id": 5 + } } - }, - { - "(google.api.method_signature)": "name" } - ] + } }, - "ListProducts": { - "requestType": "ListProductsRequest", - "responseType": "ListProductsResponse", - "options": { - "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.method_signature)": "parent" + "DynamicFacetSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "DISABLED": 1, + "ENABLED": 2 } - }, - { - "(google.api.method_signature)": "parent" } - ] + } }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).patch": "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" + "BoostSpec": { + "oneofs": { + "_skipBoostSpecValidation": { + "oneof": [ + "skipBoostSpecValidation" + ] + } }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "body": "product" - } + "fields": { + "conditionBoostSpecs": { + "rule": "repeated", + "type": "ConditionBoostSpec", + "id": 1 }, - { - "(google.api.method_signature)": "product,update_mask" + "skipBoostSpecValidation": { + "type": "bool", + "id": 2, + "options": { + "proto3_optional": true + } } - ] + }, + "nested": { + "ConditionBoostSpec": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } + } }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", - "responseType": "google.protobuf.Empty", + "QueryExpansionSpec": { + "fields": { + "condition": { + "type": "Condition", + "id": 1 + }, + "pinUnexpandedResults": { + "type": "bool", + "id": 2 + } + }, + "nested": { + "Condition": { + "values": { + "CONDITION_UNSPECIFIED": 0, + "DISABLED": 1, + "AUTO": 3 + } + } + } + }, + "PersonalizationSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "AUTO": 1, + "DISABLED": 2 + } + } + } + }, + "SearchMode": { + "values": { + "SEARCH_MODE_UNSPECIFIED": 0, + "PRODUCT_SEARCH_ONLY": 1, + "FACETED_SEARCH_ONLY": 2 + } + } + } + }, + "SearchResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "SearchResult", + "id": 1 + }, + "facets": { + "rule": "repeated", + "type": "Facet", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + }, + "correctedQuery": { + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "nextPageToken": { + "type": "string", + "id": 6 + }, + "queryExpansionInfo": { + "type": "QueryExpansionInfo", + "id": 7 + }, + "redirectUri": { + "type": "string", + "id": 10 + }, + "appliedControls": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "invalidConditionBoostSpecs": { + "rule": "repeated", + "type": "SearchRequest.BoostSpec.ConditionBoostSpec", + "id": 14 + } + }, + "nested": { + "SearchResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "product": { + "type": "Product", + "id": 2 + }, + "matchingVariantCount": { + "type": "int32", + "id": 3 + }, + "matchingVariantFields": { + "keyType": "string", + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "variantRollupValues": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 5 + } + } + }, + "Facet": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "values": { + "rule": "repeated", + "type": "FacetValue", + "id": 2 + }, + "dynamicFacet": { + "type": "bool", + "id": 3 + } + }, + "nested": { + "FacetValue": { + "oneofs": { + "facetValue": { + "oneof": [ + "value", + "interval" + ] + } + }, + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "interval": { + "type": "Interval", + "id": 2 + }, + "count": { + "type": "int64", + "id": 3 + } + } + } + } + }, + "QueryExpansionInfo": { + "fields": { + "expandedQuery": { + "type": "bool", + "id": 1 + }, + "pinnedResultCount": { + "type": "int64", + "id": 2 + } + } + } + } + }, + "ControlService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateControl": { + "requestType": "CreateControlRequest", + "responseType": "Control", "options": { - "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.http).body": "control", + "(google.api.method_signature)": "parent,control,control_id" }, "parsedOptions": [ { "(google.api.http)": { - "delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls", + "body": "control" } }, { - "(google.api.method_signature)": "name" + "(google.api.method_signature)": "parent,control,control_id" } ] }, - "ImportProducts": { - "requestType": "ImportProductsRequest", - "responseType": "google.longrunning.Operation", + "DeleteControl": { + "requestType": "DeleteControlRequest", + "responseType": "google.protobuf.Empty", "options": { - "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.ImportProductsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", - "body": "*" + "delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/controls/*}" } }, { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2beta.ImportProductsResponse", - "metadata_type": "google.cloud.retail.v2beta.ImportMetadata" - } + "(google.api.method_signature)": "name" } ] }, - "SetInventory": { - "requestType": "SetInventoryRequest", - "responseType": "google.longrunning.Operation", + "UpdateControl": { + "requestType": "UpdateControlRequest", + "responseType": "Control", "options": { - "(google.api.http).post": "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", - "(google.api.http).body": "*", - "(google.api.method_signature)": "inventory,set_mask", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.SetInventoryResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.SetInventoryMetadata" + "(google.api.http).patch": "/v2beta/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.http).body": "control", + "(google.api.method_signature)": "control,update_mask" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", - "body": "*" + "patch": "/v2beta/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "body": "control" } }, { - "(google.api.method_signature)": "inventory,set_mask" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2beta.SetInventoryResponse", - "metadata_type": "google.cloud.retail.v2beta.SetInventoryMetadata" - } + "(google.api.method_signature)": "control,update_mask" } ] }, - "AddFulfillmentPlaces": { - "requestType": "AddFulfillmentPlacesRequest", - "responseType": "google.longrunning.Operation", + "GetControl": { + "requestType": "GetControlRequest", + "responseType": "Control", "options": { - "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", - "(google.api.http).body": "*", - "(google.api.method_signature)": "product", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", - "body": "*" + "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/controls/*}" } }, { - "(google.api.method_signature)": "product" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse", - "metadata_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" - } + "(google.api.method_signature)": "name" } ] }, - "RemoveFulfillmentPlaces": { - "requestType": "RemoveFulfillmentPlacesRequest", - "responseType": "google.longrunning.Operation", + "ListControls": { + "requestType": "ListControlsRequest", + "responseType": "ListControlsResponse", "options": { - "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", - "(google.api.http).body": "*", - "(google.api.method_signature)": "product", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.method_signature)": "parent" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", - "body": "*" + "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls" } }, { - "(google.api.method_signature)": "product" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse", - "metadata_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" - } + "(google.api.method_signature)": "parent" } ] } } }, - "CreateProductRequest": { + "CreateControlRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "product": { - "type": "Product", + "control": { + "type": "Control", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "productId": { + "controlId": { "type": "string", "id": 3, "options": { @@ -7214,82 +8125,83 @@ } } }, - "GetProductRequest": { + "UpdateControlRequest": { "fields": { - "name": { - "type": "string", + "control": { + "type": "Control", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.field_behavior)": "REQUIRED" } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 } } }, - "UpdateProductRequest": { + "DeleteControlRequest": { "fields": { - "product": { - "type": "Product", + "name": { + "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - }, - "allowMissing": { - "type": "bool", - "id": 3 } } }, - "DeleteProductRequest": { + "GetControlRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/Control" } } } }, - "ListProductsRequest": { + "ListControlsRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, "pageSize": { "type": "int32", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "pageToken": { "type": "string", - "id": 3 + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, "filter": { "type": "string", - "id": 4 - }, - "readMask": { - "type": "google.protobuf.FieldMask", - "id": 5 + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, - "ListProductsResponse": { + "ListControlsResponse": { "fields": { - "products": { + "controls": { "rule": "repeated", - "type": "Product", + "type": "Control", "id": 1 }, "nextPageToken": { @@ -7298,167 +8210,76 @@ } } }, - "SetInventoryRequest": { - "fields": { - "inventory": { - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "setMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - }, - "setTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - }, - "allowMissing": { - "type": "bool", - "id": 4 + "ExportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] } - } - }, - "SetInventoryMetadata": { - "fields": {} - }, - "SetInventoryResponse": { - "fields": {} - }, - "AddFulfillmentPlacesRequest": { + }, "fields": { - "product": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" - } - }, - "type": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "placeIds": { - "rule": "repeated", + "gcsPrefix": { "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "addTime": { - "type": "google.protobuf.Timestamp", - "id": 4 - }, - "allowMissing": { - "type": "bool", - "id": 5 + "id": 1 } } }, - "AddFulfillmentPlacesMetadata": { - "fields": {} - }, - "AddFulfillmentPlacesResponse": { - "fields": {} - }, - "RemoveFulfillmentPlacesRequest": { + "ExportMetadata": { "fields": { - "product": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" - } - }, - "type": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "placeIds": { - "rule": "repeated", - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "removeTime": { + "createTime": { "type": "google.protobuf.Timestamp", - "id": 4 + "id": 1 }, - "allowMissing": { - "type": "bool", - "id": 5 + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 } } }, - "RemoveFulfillmentPlacesMetadata": { - "fields": {} - }, - "RemoveFulfillmentPlacesResponse": { - "fields": {} - }, - "PurgeMetadata": { - "fields": {} - }, - "PurgeUserEventsRequest": { + "ExportProductsResponse": { "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "filter": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 }, - "force": { - "type": "bool", - "id": 3 + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 } } }, - "PurgeUserEventsResponse": { + "ExportUserEventsResponse": { "fields": { - "purgedEventsCount": { - "type": "int64", + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 } } }, - "SearchService": { + "PredictionService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "Search": { - "requestType": "SearchRequest", - "responseType": "SearchResponse", + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", "options": { - "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", "(google.api.http).body": "*" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", "body": "*" } } @@ -7466,7 +8287,7 @@ } } }, - "SearchRequest": { + "PredictRequest": { "fields": { "placement": { "type": "string", @@ -7475,342 +8296,1045 @@ "(google.api.field_behavior)": "REQUIRED" } }, - "branch": { - "type": "string", + "userEvent": { + "type": "UserEvent", "id": 2, "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.field_behavior)": "REQUIRED" } }, - "query": { - "type": "string", + "pageSize": { + "type": "int32", "id": 3 }, - "visitorId": { + "pageToken": { "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 4 }, - "userInfo": { - "type": "UserInfo", + "filter": { + "type": "string", "id": 5 }, - "pageSize": { - "type": "int32", + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", "id": 7 }, - "pageToken": { + "labels": { + "keyType": "string", "type": "string", "id": 8 - }, - "offset": { - "type": "int32", - "id": 9 - }, - "filter": { - "type": "string", - "id": 10 - }, - "canonicalFilter": { - "type": "string", - "id": 28 - }, - "orderBy": { - "type": "string", - "id": 11 - }, - "facetSpecs": { + } + } + }, + "PredictResponse": { + "fields": { + "results": { "rule": "repeated", - "type": "FacetSpec", - "id": 12 - }, - "dynamicFacetSpec": { - "type": "DynamicFacetSpec", - "id": 21 - }, - "boostSpec": { - "type": "BoostSpec", - "id": 13 - }, - "queryExpansionSpec": { - "type": "QueryExpansionSpec", - "id": 14 + "type": "PredictionResult", + "id": 1 }, - "variantRollupKeys": { - "rule": "repeated", + "attributionToken": { "type": "string", - "id": 17 + "id": 2 }, - "pageCategories": { + "missingIds": { "rule": "repeated", "type": "string", - "id": 23 + "id": 3 }, - "searchMode": { - "type": "SearchMode", - "id": 31 + "validateOnly": { + "type": "bool", + "id": 4 } }, "nested": { - "FacetSpec": { + "PredictionResult": { "fields": { - "facetKey": { - "type": "FacetKey", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "limit": { - "type": "int32", - "id": 2 - }, - "excludedFilterKeys": { - "rule": "repeated", + "id": { "type": "string", - "id": 3 + "id": 1 }, - "enableDynamicPosition": { - "type": "bool", - "id": 4 + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" }, - "nested": { - "FacetKey": { - "fields": { - "key": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "intervals": { - "rule": "repeated", - "type": "Interval", - "id": 2 - }, - "restrictedValues": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "prefixes": { - "rule": "repeated", - "type": "string", - "id": 8 - }, - "contains": { - "rule": "repeated", - "type": "string", - "id": 9 - }, - "orderBy": { - "type": "string", - "id": 4 - }, - "query": { - "type": "string", - "id": 5 - } + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" } + }, + { + "(google.api.method_signature)": "parent,product,product_id" } - } + ] }, - "DynamicFacetSpec": { - "fields": { - "mode": { - "type": "Mode", - "id": 1 - } + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" }, - "nested": { - "Mode": { - "values": { - "MODE_UNSPECIFIED": 0, - "DISABLED": 1, - "ENABLED": 2 + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" } + }, + { + "(google.api.method_signature)": "name" } - } + ] }, - "BoostSpec": { - "fields": { - "conditionBoostSpecs": { - "rule": "repeated", - "type": "ConditionBoostSpec", - "id": 1 - } + "ListProducts": { + "requestType": "ListProductsRequest", + "responseType": "ListProductsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.method_signature)": "parent" }, - "nested": { - "ConditionBoostSpec": { - "fields": { - "condition": { - "type": "string", - "id": 1 - }, - "boost": { - "type": "float", - "id": 2 - } + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" } - } - } - }, - "QueryExpansionSpec": { - "fields": { - "condition": { - "type": "Condition", - "id": 1 }, - "pinUnexpandedResults": { - "type": "bool", - "id": 2 + { + "(google.api.method_signature)": "parent" } + ] + }, + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" }, - "nested": { - "Condition": { - "values": { - "CONDITION_UNSPECIFIED": 0, - "DISABLED": 1, - "AUTO": 3 + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" } + }, + { + "(google.api.method_signature)": "product,update_mask" } - } + ] }, - "SearchMode": { - "values": { - "SEARCH_MODE_UNSPECIFIED": 0, - "PRODUCT_SEARCH_ONLY": 1, - "FACETED_SEARCH_ONLY": 2 + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2beta.ImportMetadata" + } + } + ] + }, + "SetInventory": { + "requestType": "SetInventoryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "(google.api.http).body": "*", + "(google.api.method_signature)": "inventory,set_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.SetInventoryResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.SetInventoryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "body": "*" + } + }, + { + "(google.api.method_signature)": "inventory,set_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.SetInventoryResponse", + "metadata_type": "google.cloud.retail.v2beta.SetInventoryMetadata" + } + } + ] + }, + "AddFulfillmentPlaces": { + "requestType": "AddFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata" + } + } + ] + }, + "RemoveFulfillmentPlaces": { + "requestType": "RemoveFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata" + } + } + ] + }, + "AddLocalInventories": { + "requestType": "AddLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.AddLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.AddLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.AddLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2beta.AddLocalInventoriesMetadata" + } + } + ] + }, + "RemoveLocalInventories": { + "requestType": "RemoveLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.RemoveLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.RemoveLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata" + } + } + ] + } + } + }, + "CreateProductRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "UpdateProductRequest": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "DeleteProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "ListProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "readMask": { + "type": "google.protobuf.FieldMask", + "id": 5 + } + } + }, + "ListProductsResponse": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "SetInventoryRequest": { + "fields": { + "inventory": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "setMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "allowMissing": { + "type": "bool", + "id": 4 + } + } + }, + "SetInventoryMetadata": { + "fields": {} + }, + "SetInventoryResponse": { + "fields": {} + }, + "AddFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "AddFulfillmentPlacesMetadata": { + "fields": {} + }, + "AddFulfillmentPlacesResponse": { + "fields": {} + }, + "AddLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 6 + } + } + }, + "AddLocalInventoriesMetadata": { + "fields": {} + }, + "AddLocalInventoriesResponse": { + "fields": {} + }, + "RemoveLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "RemoveLocalInventoriesMetadata": { + "fields": {} + }, + "RemoveLocalInventoriesResponse": { + "fields": {} + }, + "RemoveFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "RemoveFulfillmentPlacesMetadata": { + "fields": {} + }, + "RemoveFulfillmentPlacesResponse": { + "fields": {} + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeUserEventsResponse": { + "fields": { + "purgedEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "ServingConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/ServingConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "modelId": { + "type": "string", + "id": 3 + }, + "priceRerankingLevel": { + "type": "string", + "id": 4 + }, + "facetControlIds": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "dynamicFacetSpec": { + "type": "SearchRequest.DynamicFacetSpec", + "id": 6 + }, + "boostControlIds": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "filterControlIds": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "redirectControlIds": { + "rule": "repeated", + "type": "string", + "id": 10 + }, + "twowaySynonymsControlIds": { + "rule": "repeated", + "type": "string", + "id": 18 + }, + "onewaySynonymsControlIds": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "doNotAssociateControlIds": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "replacementControlIds": { + "rule": "repeated", + "type": "string", + "id": 14 + }, + "ignoreControlIds": { + "rule": "repeated", + "type": "string", + "id": 15 + }, + "diversityLevel": { + "type": "string", + "id": 8 + }, + "enableCategoryFilterLevel": { + "type": "string", + "id": 16 + }, + "solutionTypes": { + "rule": "repeated", + "type": "SolutionType", + "id": 19, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" } } } }, - "SearchResponse": { + "ServingConfigService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateServingConfig": { + "requestType": "CreateServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "(google.api.http).body": "serving_config", + "(google.api.method_signature)": "parent,serving_config,serving_config_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "body": "serving_config" + } + }, + { + "(google.api.method_signature)": "parent,serving_config,serving_config_id" + } + ] + }, + "DeleteServingConfig": { + "requestType": "DeleteServingConfigRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateServingConfig": { + "requestType": "UpdateServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).patch": "/v2beta/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.http).body": "serving_config", + "(google.api.method_signature)": "serving_config,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "body": "serving_config" + } + }, + { + "(google.api.method_signature)": "serving_config,update_mask" + } + ] + }, + "GetServingConfig": { + "requestType": "GetServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListServingConfigs": { + "requestType": "ListServingConfigsRequest", + "responseType": "ListServingConfigsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "AddControl": { + "requestType": "AddControlRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + "(google.api.http).body": "*", + "(google.api.method_signature)": "serving_config" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + "body": "*" + } + }, + { + "(google.api.method_signature)": "serving_config" + } + ] + }, + "RemoveControl": { + "requestType": "RemoveControlRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + "(google.api.http).body": "*", + "(google.api.method_signature)": "serving_config" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + "body": "*" + } + }, + { + "(google.api.method_signature)": "serving_config" + } + ] + } + } + }, + "CreateServingConfigRequest": { "fields": { - "results": { - "rule": "repeated", - "type": "SearchResult", - "id": 1 - }, - "facets": { - "rule": "repeated", - "type": "Facet", - "id": 2 + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } }, - "totalSize": { - "type": "int32", - "id": 3 + "servingConfig": { + "type": "ServingConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "correctedQuery": { + "servingConfigId": { "type": "string", - "id": 4 + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateServingConfigRequest": { + "fields": { + "servingConfig": { + "type": "ServingConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "attributionToken": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteServingConfigRequest": { + "fields": { + "name": { "type": "string", - "id": 5 - }, - "nextPageToken": { + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" + } + } + } + }, + "GetServingConfigRequest": { + "fields": { + "name": { "type": "string", - "id": 6 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" + } + } + } + }, + "ListServingConfigsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } }, - "queryExpansionInfo": { - "type": "QueryExpansionInfo", - "id": 7 + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "redirectUri": { + "pageToken": { "type": "string", - "id": 10 - }, - "appliedControls": { + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListServingConfigsResponse": { + "fields": { + "servingConfigs": { "rule": "repeated", + "type": "ServingConfig", + "id": 1 + }, + "nextPageToken": { "type": "string", - "id": 12 + "id": 2 } - }, - "nested": { - "SearchResult": { - "fields": { - "id": { - "type": "string", - "id": 1 - }, - "product": { - "type": "Product", - "id": 2 - }, - "matchingVariantCount": { - "type": "int32", - "id": 3 - }, - "matchingVariantFields": { - "keyType": "string", - "type": "google.protobuf.FieldMask", - "id": 4 - }, - "variantRollupValues": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 5 - } + } + }, + "AddControlRequest": { + "fields": { + "servingConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" } }, - "Facet": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "values": { - "rule": "repeated", - "type": "FacetValue", - "id": 2 - }, - "dynamicFacet": { - "type": "bool", - "id": 3 - } - }, - "nested": { - "FacetValue": { - "oneofs": { - "facetValue": { - "oneof": [ - "value", - "interval" - ] - } - }, - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "interval": { - "type": "Interval", - "id": 2 - }, - "count": { - "type": "int64", - "id": 3 - } - } - } + "controlId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RemoveControlRequest": { + "fields": { + "servingConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" } }, - "QueryExpansionInfo": { - "fields": { - "expandedQuery": { - "type": "bool", - "id": 1 - }, - "pinnedResultCount": { - "type": "int64", - "id": 2 - } + "controlId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" } } } diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js index 6e1fb716d07..f03f4c360a4 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js @@ -34,6 +34,9 @@ function main() { * The final component of the resource name of a branch. * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT * error is returned. + * If there are no sufficient active products in the targeted branch and + * force google.cloud.retail.v2.SetDefaultBranchRequest.force is not set, a + * FAILED_PRECONDITION error is returned. */ // const branchId = 'abc123' /** @@ -44,6 +47,12 @@ function main() { * characters. Otherwise, an INVALID_ARGUMENT error is returned. */ // const note = 'abc123' + /** + * If set to true, it permits switching to a branch with + * branch_id google.cloud.retail.v2.SetDefaultBranchRequest.branch_id even + * if it has no sufficient active products. + */ + // const force = true // Imports the Retail library const {CatalogServiceClient} = require('@google-cloud/retail').v2; diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index 1ed48516ef4..738d1b40bfa 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -37,21 +37,21 @@ function main(catalog, query) { */ // const query = 'abc123' /** - * 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 logs in or out of the website. + * Required field. 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 logs in or 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. */ // const visitorId = 'abc123' /** - * The list of languages of the query. This is - * the BCP-47 language code, such as "en-US" or "sr-Latn". - * For more information, see - * Tags for Identifying Languages (https://tools.ietf.org/html/bcp47). - * The maximum number of allowed characters is 255. - * Only "en-US" is currently supported. + * The language filters applied to the output suggestions. If set, it should + * contain the language of the query. If not set, suggestions are returned + * without considering language restrictions. This is the BCP-47 language + * code, such as "en-US" or "sr-Latn". For more information, see Tags for + * Identifying Languages (https://tools.ietf.org/html/bcp47). The maximum + * number of language codes is 3. */ // const languageCodes = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index 7f93a971926..af3de61999a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -72,9 +72,12 @@ function main(placement, userEvent) { * * 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`. + * If your filter blocks all prediction results, the API will return generic + * (unfiltered) popular products. If you only want results strictly matching + * the filters, set `strictFiltering` to True in `PredictRequest.params` to + * receive empty results instead. + * Note that the API will never return items with storageStatus of "EXPIRED" + * or "DELETED" regardless of filter choices. */ // const filter = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js new file mode 100644 index 00000000000..f0598e366d4 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js @@ -0,0 +1,99 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(product, localInventories) { + // [START retail_v2_generated_ProductService_AddLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const product = 'abc123' + /** + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 3000 inventories are allowed per + * request. + */ + // const localInventories = 1234 + /** + * Indicates which inventory fields in the provided list of + * LocalInventory google.cloud.retail.v2.LocalInventory to update. The + * field is updated to the provided value. + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const addMask = {} + /** + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + */ + // const addTime = {} + /** + * If set to true, and the Product google.cloud.retail.v2.Product is not + * found, the local inventory will still be processed and retained for at most + * 1 day and processed once the Product google.cloud.retail.v2.Product is + * created. If set to false, a NOT_FOUND error is returned if the + * Product google.cloud.retail.v2.Product is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function callAddLocalInventories() { + // Construct request + const request = { + product, + localInventories, + }; + + // Run request + const [operation] = await retailClient.addLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAddLocalInventories(); + // [END retail_v2_generated_ProductService_AddLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index 3cf71650c5c..39cc5522cea 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -32,17 +32,6 @@ function main(parent, inputConfig) { * If updateMask is specified, requires products.update permission. */ // const parent = 'abc123' - /** - * Unique identifier provided by client, within the ancestor - * dataset scope. Ensures idempotency and used for request deduplication. - * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - * ImportMetadata google.cloud.retail.v2.ImportMetadata. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const requestId = 'abc123' /** * Required. The desired input location of the data. */ diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js new file mode 100644 index 00000000000..6332ed05df9 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js @@ -0,0 +1,85 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(product, placeIds) { + // [START retail_v2_generated_ProductService_RemoveLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const product = 'abc123' + /** + * Required. A list of place IDs to have their inventory deleted. + * At most 3000 place IDs are allowed per request. + */ + // const placeIds = 'abc123' + /** + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + */ + // const removeTime = {} + /** + * If set to true, and the Product google.cloud.retail.v2.Product is not + * found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * Product google.cloud.retail.v2.Product is created. If set to false, a + * NOT_FOUND error is returned if the + * Product google.cloud.retail.v2.Product is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function callRemoveLocalInventories() { + // Construct request + const request = { + product, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRemoveLocalInventories(); + // [END retail_v2_generated_ProductService_RemoveLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js index 85b8419df49..4f35c54e91c 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -48,6 +48,20 @@ function main(inventory) { * while respecting the last update time for each inventory field, using the * provided or default value for * SetInventoryRequest.set_time google.cloud.retail.v2.SetInventoryRequest.set_time. + * The caller can replace place IDs for a subset of fulfillment types in the + * following ways: + * * Adds "fulfillment_info" in + * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask + * * Specifies only the desired fulfillment types and corresponding place IDs + * to update in SetInventoryRequest.inventory.fulfillment_info + * The caller can clear all place IDs from a subset of fulfillment types in + * the following ways: + * * Adds "fulfillment_info" in + * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask + * * Specifies only the desired fulfillment types to clear in + * SetInventoryRequest.inventory.fulfillment_info + * * Checks that only the desired fulfillment info types have empty + * SetInventoryRequest.inventory.fulfillment_info.place_ids * The last update time is recorded for the following inventory fields: * * Product.price_info google.cloud.retail.v2.Product.price_info * * Product.availability google.cloud.retail.v2.Product.availability @@ -59,8 +73,8 @@ function main(inventory) { // const inventory = {} /** * Indicates which inventory fields in the provided - * Product google.cloud.retail.v2.Product to update. If not set or set with - * empty paths, all inventory fields will be updated. + * Product google.cloud.retail.v2.Product to update. + * At least one field must be provided. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. */ diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index e95b1561193..2083811f7be 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -27,7 +27,7 @@ function main(placement, visitorId) { */ /** * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -48,6 +48,8 @@ function main(placement, visitorId) { * 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 logs in or out of the website. + * This should be the same identifier as + * UserEvent.visitor_id google.cloud.retail.v2.UserEvent.visitor_id. * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. */ @@ -93,6 +95,8 @@ function main(placement, visitorId) { */ // const filter = 'abc123' /** + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -118,13 +122,6 @@ function main(placement, visitorId) { * is returned. */ // const facetSpecs = 1234 - /** - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. - */ - // const dynamicFacetSpec = {} /** * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). @@ -144,12 +141,15 @@ function main(placement, visitorId) { /** * The keys to fetch and rollup the matching * variant google.cloud.retail.v2.Product.Type.VARIANT - * Product google.cloud.retail.v2.Product s attributes. The attributes from - * all the matching variant google.cloud.retail.v2.Product.Type.VARIANT - * Product google.cloud.retail.v2.Product s are merged and de-duplicated. - * Notice that rollup variant google.cloud.retail.v2.Product.Type.VARIANT - * Product google.cloud.retail.v2.Product s attributes will lead to extra - * query latency. Maximum number of keys is 10. + * Product google.cloud.retail.v2.Product s attributes, + * FulfillmentInfo google.cloud.retail.v2.FulfillmentInfo or + * LocalInventory google.cloud.retail.v2.LocalInventory s attributes. The + * attributes from all the matching + * variant google.cloud.retail.v2.Product.Type.VARIANT + * Product google.cloud.retail.v2.Product s or + * LocalInventory google.cloud.retail.v2.LocalInventory s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * For FulfillmentInfo google.cloud.retail.v2.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", @@ -161,6 +161,7 @@ function main(placement, visitorId) { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * Product.inventories.attributes map. * * attributes.key, where key is any key in the @@ -223,6 +224,10 @@ function main(placement, visitorId) { * request triggers both product search and faceted search. */ // const searchMode = {} + /** + * The specification for personalization. + */ + // const personalizationSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2; diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index bb8b2fe4abd..6dbcb2633bf 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -107,14 +107,14 @@ "regionTag": "retail_v2_generated_CatalogService_SetDefaultBranch_async", "title": "CatalogService setDefaultBranch Sample", "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", "canonical": true, "file": "catalog_service.set_default_branch.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 64, + "end": 73, "type": "FULL" } ], @@ -134,6 +134,10 @@ { "name": "note", "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" } ], "resultType": ".google.protobuf.Empty", @@ -155,7 +159,7 @@ "regionTag": "retail_v2_generated_CatalogService_GetDefaultBranch_async", "title": "CatalogService getDefaultBranch Sample", "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] method under a specified parent catalog. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] method under a specified parent catalog.", "canonical": true, "file": "catalog_service.get_default_branch.js", "language": "JAVASCRIPT", @@ -195,7 +199,7 @@ "regionTag": "retail_v2_generated_CompletionService_CompleteQuery_async", "title": "CatalogService completeQuery Sample", "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "completion_service.complete_query.js", "language": "JAVASCRIPT", @@ -259,7 +263,7 @@ "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", "title": "CatalogService importCompletionData Sample", "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing may be synchronous. Partial updating is not supported. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "completion_service.import_completion_data.js", "language": "JAVASCRIPT", @@ -314,7 +318,7 @@ "segments": [ { "start": 25, - "end": 150, + "end": 153, "type": "FULL" } ], @@ -614,7 +618,7 @@ "segments": [ { "start": 25, - "end": 96, + "end": 85, "type": "FULL" } ], @@ -671,14 +675,14 @@ "regionTag": "retail_v2_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 102, + "end": 116, "type": "FULL" } ], @@ -723,7 +727,7 @@ "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", @@ -779,7 +783,7 @@ "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", @@ -831,18 +835,126 @@ } } }, + { + "regionTag": "retail_v2_generated_ProductService_AddLocalInventories_async", + "title": "CatalogService addLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 91, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.AddLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "local_inventories", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "add_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.AddLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ProductService_RemoveLocalInventories_async", + "title": "CatalogService removeLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } + }, { "regionTag": "retail_v2_generated_SearchService_Search_async", "title": "CatalogService search Sample", "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "search_service.search.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 247, + "end": 252, "type": "FULL" } ], @@ -922,6 +1034,10 @@ { "name": "search_mode", "type": ".google.cloud.retail.v2.SearchRequest.SearchMode" + }, + { + "name": "personalization_spec", + "type": ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec" } ], "resultType": ".google.cloud.retail.v2.SearchResponse", @@ -1135,7 +1251,7 @@ "regionTag": "retail_v2_generated_UserEventService_RejoinUserEvents_async", "title": "CatalogService rejoinUserEvents Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", "canonical": true, "file": "user_event_service.rejoin_user_events.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js new file mode 100644 index 00000000000..553e710302f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, catalogAttribute) { + // [START retail_v2beta_generated_CatalogService_AddCatalogAttribute_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const attributesConfig = 'abc123' + /** + * Required. The + * CatalogAttribute google.cloud.retail.v2beta.CatalogAttribute to add. + */ + // const catalogAttribute = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callAddCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + catalogAttribute, + }; + + // Run request + const response = await retailClient.addCatalogAttribute(request); + console.log(response); + } + + callAddCatalogAttribute(); + // [END retail_v2beta_generated_CatalogService_AddCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js new file mode 100644 index 00000000000..b6c393bd9e7 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_CatalogService_GetAttributesConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const name = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callGetAttributesConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getAttributesConfig(request); + console.log(response); + } + + callGetAttributesConfig(); + // [END retail_v2beta_generated_CatalogService_GetAttributesConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js new file mode 100644 index 00000000000..886e118a824 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_CatalogService_GetCompletionConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + */ + // const name = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callGetCompletionConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getCompletionConfig(request); + console.log(response); + } + + callGetCompletionConfig(); + // [END retail_v2beta_generated_CatalogService_GetCompletionConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js new file mode 100644 index 00000000000..b6d4473a671 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, key) { + // [START retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const attributesConfig = 'abc123' + /** + * Required. The attribute name key of the + * CatalogAttribute google.cloud.retail.v2beta.CatalogAttribute to remove. + */ + // const key = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callRemoveCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + key, + }; + + // Run request + const response = await retailClient.removeCatalogAttribute(request); + console.log(response); + } + + callRemoveCatalogAttribute(); + // [END retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js new file mode 100644 index 00000000000..42548549680 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js @@ -0,0 +1,73 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, catalogAttribute) { + // [START retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const attributesConfig = 'abc123' + /** + * Required. The updated + * CatalogAttribute google.cloud.retail.v2beta.CatalogAttribute. + */ + // const catalogAttribute = {} + /** + * Indicates which fields in the provided + * CatalogAttribute google.cloud.retail.v2beta.CatalogAttribute to update. + * The following are NOT supported: + * * CatalogAttribute.key google.cloud.retail.v2beta.CatalogAttribute.key + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callReplaceCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + catalogAttribute, + }; + + // Run request + const response = await retailClient.replaceCatalogAttribute(request); + console.log(response); + } + + callReplaceCatalogAttribute(); + // [END retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js index ea0695ceaf5..11f667df09c 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js @@ -34,6 +34,9 @@ function main() { * The final component of the resource name of a branch. * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT * error is returned. + * If there are no sufficient active products in the targeted branch and + * force google.cloud.retail.v2beta.SetDefaultBranchRequest.force is not + * set, a FAILED_PRECONDITION error is returned. */ // const branchId = 'abc123' /** @@ -44,6 +47,12 @@ function main() { * characters. Otherwise, an INVALID_ARGUMENT error is returned. */ // const note = 'abc123' + /** + * If set to true, it permits switching to a branch with + * branch_id google.cloud.retail.v2beta.SetDefaultBranchRequest.branch_id + * even if it has no sufficient active products. + */ + // const force = true // Imports the Retail library const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js new file mode 100644 index 00000000000..dee9a094edf --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js @@ -0,0 +1,67 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig) { + // [START retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The + * AttributesConfig google.cloud.retail.v2beta.AttributesConfig to update. + */ + // const attributesConfig = {} + /** + * Indicates which fields in the provided + * AttributesConfig google.cloud.retail.v2beta.AttributesConfig to update. + * The following is the only supported field: + * * AttributesConfig.catalog_attributes google.cloud.retail.v2beta.AttributesConfig.catalog_attributes + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callUpdateAttributesConfig() { + // Construct request + const request = { + attributesConfig, + }; + + // Run request + const response = await retailClient.updateAttributesConfig(request); + console.log(response); + } + + callUpdateAttributesConfig(); + // [END retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js new file mode 100644 index 00000000000..d3c451f3211 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(completionConfig) { + // [START retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The + * CompletionConfig google.cloud.retail.v2beta.CompletionConfig to update. + * If the caller does not have permission to update the + * CompletionConfig google.cloud.retail.v2beta.CompletionConfig, then a + * PERMISSION_DENIED error is returned. + * If the CompletionConfig google.cloud.retail.v2beta.CompletionConfig to + * update does not exist, a NOT_FOUND error is returned. + */ + // const completionConfig = {} + /** + * Indicates which fields in the provided + * CompletionConfig google.cloud.retail.v2beta.CompletionConfig to update. + * The following are the only supported fields: + * * CompletionConfig.matching_order google.cloud.retail.v2beta.CompletionConfig.matching_order + * * CompletionConfig.max_suggestions google.cloud.retail.v2beta.CompletionConfig.max_suggestions + * * CompletionConfig.min_prefix_length google.cloud.retail.v2beta.CompletionConfig.min_prefix_length + * * CompletionConfig.auto_learning google.cloud.retail.v2beta.CompletionConfig.auto_learning + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callUpdateCompletionConfig() { + // Construct request + const request = { + completionConfig, + }; + + // Run request + const response = await retailClient.updateCompletionConfig(request); + console.log(response); + } + + callUpdateCompletionConfig(); + // [END retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index 3dc80166d9c..28957ff1dec 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -37,21 +37,21 @@ function main(catalog, query) { */ // const query = 'abc123' /** - * 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 logs in or out of the website. + * Required field. 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 logs in or 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. */ // const visitorId = 'abc123' /** - * The list of languages of the query. This is - * the BCP-47 language code, such as "en-US" or "sr-Latn". - * For more information, see - * Tags for Identifying Languages (https://tools.ietf.org/html/bcp47). - * The maximum number of allowed characters is 255. - * Only "en-US" is currently supported. + * The language filters applied to the output suggestions. If set, it should + * contain the language of the query. If not set, suggestions are returned + * without considering language restrictions. This is the BCP-47 language + * code, such as "en-US" or "sr-Latn". For more information, see Tags for + * Identifying Languages (https://tools.ietf.org/html/bcp47). The maximum + * number of language codes is 3. */ // const languageCodes = 'abc123' /** @@ -81,7 +81,8 @@ function main(catalog, query) { // const dataset = 'abc123' /** * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value CompletionConfig.max_suggestions . + * to the configured value + * CompletionConfig.max_suggestions google.cloud.retail.v2beta.CompletionConfig.max_suggestions. * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. */ diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js new file mode 100644 index 00000000000..670ed9d8a67 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, control, controlId) { + // [START retail_v2beta_generated_ControlService_CreateControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of parent catalog. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Required. The Control to create. + */ + // const control = {} + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-_/. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callCreateControl() { + // Construct request + const request = { + parent, + control, + controlId, + }; + + // Run request + const response = await retailClient.createControl(request); + console.log(response); + } + + callCreateControl(); + // [END retail_v2beta_generated_ControlService_CreateControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js new file mode 100644 index 00000000000..fa6173821d2 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ControlService_DeleteControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callDeleteControl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteControl(request); + console.log(response); + } + + callDeleteControl(); + // [END retail_v2beta_generated_ControlService_DeleteControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js new file mode 100644 index 00000000000..dcc21c72055 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ControlService_GetControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callGetControl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getControl(request); + console.log(response); + } + + callGetControl(); + // [END retail_v2beta_generated_ControlService_GetControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js new file mode 100644 index 00000000000..5de3859ca7a --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js @@ -0,0 +1,79 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2beta_generated_ControlService_ListControls_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * filter google.cloud.retail.v2beta.ListControlsRequest.filter is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + */ + // const filter = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callListControls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listControlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListControls(); + // [END retail_v2beta_generated_ControlService_ListControls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js new file mode 100644 index 00000000000..3bc73051e23 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js @@ -0,0 +1,66 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(control) { + // [START retail_v2beta_generated_ControlService_UpdateControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Control to update. + */ + // const control = {} + /** + * Indicates which fields in the provided + * Control google.cloud.retail.v2beta.Control to update. The following are + * NOT supported: + * * Control.name google.cloud.retail.v2beta.Control.name + * If not set or empty, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callUpdateControl() { + // Construct request + const request = { + control, + }; + + // Run request + const response = await retailClient.updateControl(request); + console.log(response); + } + + callUpdateControl(); + // [END retail_v2beta_generated_ControlService_UpdateControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index cd878f44770..38b9394ccae 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -72,9 +72,12 @@ function main(placement, userEvent) { * * 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`. + * If your filter blocks all prediction results, the API will return generic + * (unfiltered) popular products. If you only want results strictly matching + * the filters, set `strictFiltering` to True in `PredictRequest.params` to + * receive empty results instead. + * Note that the API will never return items with storageStatus of "EXPIRED" + * or "DELETED" regardless of filter choices. */ // const filter = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js new file mode 100644 index 00000000000..827fb0fe8b9 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js @@ -0,0 +1,100 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(product, localInventories) { + // [START retail_v2beta_generated_ProductService_AddLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * Product google.cloud.retail.v2beta.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.v2beta.Product, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 3000 inventories are allowed per + * request. + */ + // const localInventories = 1234 + /** + * Indicates which inventory fields in the provided list of + * LocalInventory google.cloud.retail.v2beta.LocalInventory to update. The + * field is updated to the provided value. + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + */ + // const addMask = {} + /** + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + */ + // const addTime = {} + /** + * If set to true, and the Product google.cloud.retail.v2beta.Product is + * not found, the local inventory will still be processed and retained for at + * most 1 day and processed once the + * Product google.cloud.retail.v2beta.Product is created. If set to false, + * a NOT_FOUND error is returned if the + * Product google.cloud.retail.v2beta.Product is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function callAddLocalInventories() { + // Construct request + const request = { + product, + localInventories, + }; + + // Run request + const [operation] = await retailClient.addLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAddLocalInventories(); + // [END retail_v2beta_generated_ProductService_AddLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index f57e330bd80..f7fe86da064 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -32,17 +32,6 @@ function main(parent, inputConfig) { * If updateMask is specified, requires products.update permission. */ // const parent = 'abc123' - /** - * Unique identifier provided by client, within the ancestor - * dataset scope. Ensures idempotency and used for request deduplication. - * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - * ImportMetadata google.cloud.retail.v2beta.ImportMetadata. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const requestId = 'abc123' /** * Required. The desired input location of the data. */ diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js new file mode 100644 index 00000000000..a61bac1d185 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js @@ -0,0 +1,85 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(product, placeIds) { + // [START retail_v2beta_generated_ProductService_RemoveLocalInventories_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of + * Product google.cloud.retail.v2beta.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.v2beta.Product, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + */ + // const product = 'abc123' + /** + * Required. A list of place IDs to have their inventory deleted. + * At most 3000 place IDs are allowed per request. + */ + // const placeIds = 'abc123' + /** + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + */ + // const removeTime = {} + /** + * If set to true, and the Product google.cloud.retail.v2beta.Product is + * not found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * Product google.cloud.retail.v2beta.Product is created. If set to false, + * a NOT_FOUND error is returned if the + * Product google.cloud.retail.v2beta.Product is not found. + */ + // const allowMissing = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function callRemoveLocalInventories() { + // Construct request + const request = { + product, + placeIds, + }; + + // Run request + const [operation] = await retailClient.removeLocalInventories(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRemoveLocalInventories(); + // [END retail_v2beta_generated_ProductService_RemoveLocalInventories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js index b7fb846e6e9..ac7ceefff47 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -48,6 +48,20 @@ function main(inventory) { * while respecting the last update time for each inventory field, using the * provided or default value for * SetInventoryRequest.set_time google.cloud.retail.v2beta.SetInventoryRequest.set_time. + * The caller can replace place IDs for a subset of fulfillment types in the + * following ways: + * * Adds "fulfillment_info" in + * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask + * * Specifies only the desired fulfillment types and corresponding place IDs + * to update in SetInventoryRequest.inventory.fulfillment_info + * The caller can clear all place IDs from a subset of fulfillment types in + * the following ways: + * * Adds "fulfillment_info" in + * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask + * * Specifies only the desired fulfillment types to clear in + * SetInventoryRequest.inventory.fulfillment_info + * * Checks that only the desired fulfillment info types have empty + * SetInventoryRequest.inventory.fulfillment_info.place_ids * The last update time is recorded for the following inventory fields: * * Product.price_info google.cloud.retail.v2beta.Product.price_info * * Product.availability google.cloud.retail.v2beta.Product.availability diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index d5b74ef8ab1..62f1df1e9be 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -27,7 +27,7 @@ function main(placement, visitorId) { */ /** * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -95,6 +95,8 @@ function main(placement, visitorId) { */ // const filter = 'abc123' /** + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -120,13 +122,6 @@ function main(placement, visitorId) { * is returned. */ // const facetSpecs = 1234 - /** - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. - */ - // const dynamicFacetSpec = {} /** * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). @@ -149,11 +144,13 @@ function main(placement, visitorId) { * variant google.cloud.retail.v2beta.Product.Type.VARIANT * Product google.cloud.retail.v2beta.Product s attributes, * FulfillmentInfo google.cloud.retail.v2beta.FulfillmentInfo or - * LocalInventory s attributes. The attributes from all the matching + * LocalInventory google.cloud.retail.v2beta.LocalInventory s attributes. + * The attributes from all the matching * variant google.cloud.retail.v2beta.Product.Type.VARIANT - * Product google.cloud.retail.v2beta.Product s or LocalInventory s are - * merged and de-duplicated. Notice that rollup attributes will lead to extra - * query latency. Maximum number of keys is 30. + * Product google.cloud.retail.v2beta.Product s or + * LocalInventory google.cloud.retail.v2beta.LocalInventory s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * For FulfillmentInfo google.cloud.retail.v2beta.FulfillmentInfo, a * fulfillment type and a fulfillment ID must be provided in the format of * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", @@ -228,6 +225,10 @@ function main(placement, visitorId) { * request triggers both product search and faceted search. */ // const searchMode = {} + /** + * The specification for personalization. + */ + // const personalizationSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2beta; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js new file mode 100644 index 00000000000..9086bb910bf --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig, controlId) { + // [START retail_v2beta_generated_ServingConfigService_AddControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const servingConfig = 'abc123' + /** + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config - if id is not found a NOT_FOUND error is returned. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callAddControl() { + // Construct request + const request = { + servingConfig, + controlId, + }; + + // Run request + const response = await retailClient.addControl(request); + console.log(response); + } + + callAddControl(); + // [END retail_v2beta_generated_ServingConfigService_AddControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js new file mode 100644 index 00000000000..fc8ba733c16 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, servingConfig, servingConfigId) { + // [START retail_v2beta_generated_ServingConfigService_CreateServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of parent. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Required. The ServingConfig to create. + */ + // const servingConfig = {} + /** + * Required. The ID to use for the ServingConfig, which will become the final + * component of the ServingConfig's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-_/. + */ + // const servingConfigId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callCreateServingConfig() { + // Construct request + const request = { + parent, + servingConfig, + servingConfigId, + }; + + // Run request + const response = await retailClient.createServingConfig(request); + console.log(response); + } + + callCreateServingConfig(); + // [END retail_v2beta_generated_ServingConfigService_CreateServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js new file mode 100644 index 00000000000..c9202725c12 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callDeleteServingConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteServingConfig(request); + console.log(response); + } + + callDeleteServingConfig(); + // [END retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js new file mode 100644 index 00000000000..be98fd45251 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ServingConfigService_GetServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callGetServingConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getServingConfig(request); + console.log(response); + } + + callGetServingConfig(); + // [END retail_v2beta_generated_ServingConfigService_GetServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js new file mode 100644 index 00000000000..7a517f3e12b --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2beta_generated_ServingConfigService_ListServingConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callListServingConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listServingConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServingConfigs(); + // [END retail_v2beta_generated_ServingConfigService_ListServingConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js new file mode 100644 index 00000000000..314b82f9e4c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig, controlId) { + // [START retail_v2beta_generated_ServingConfigService_RemoveControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const servingConfig = 'abc123' + /** + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callRemoveControl() { + // Construct request + const request = { + servingConfig, + controlId, + }; + + // Run request + const response = await retailClient.removeControl(request); + console.log(response); + } + + callRemoveControl(); + // [END retail_v2beta_generated_ServingConfigService_RemoveControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js new file mode 100644 index 00000000000..f948464a8a8 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js @@ -0,0 +1,66 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig) { + // [START retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ServingConfig to update. + */ + // const servingConfig = {} + /** + * Indicates which fields in the provided + * ServingConfig google.cloud.retail.v2beta.ServingConfig to update. The + * following are NOT supported: + * * ServingConfig.name google.cloud.retail.v2beta.ServingConfig.name + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callUpdateServingConfig() { + // Construct request + const request = { + servingConfig, + }; + + // Run request + const response = await retailClient.updateServingConfig(request); + console.log(response); + } + + callUpdateServingConfig(); + // [END retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 732ea9469d3..8e89b650252 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -107,14 +107,14 @@ "regionTag": "retail_v2beta_generated_CatalogService_SetDefaultBranch_async", "title": "CatalogService setDefaultBranch Sample", "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", "canonical": true, "file": "catalog_service.set_default_branch.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 64, + "end": 73, "type": "FULL" } ], @@ -134,6 +134,10 @@ { "name": "note", "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" } ], "resultType": ".google.protobuf.Empty", @@ -155,7 +159,7 @@ "regionTag": "retail_v2beta_generated_CatalogService_GetDefaultBranch_async", "title": "CatalogService getDefaultBranch Sample", "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] method under a specified parent catalog. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] method under a specified parent catalog.", "canonical": true, "file": "catalog_service.get_default_branch.js", "language": "JAVASCRIPT", @@ -192,240 +196,180 @@ } }, { - "regionTag": "retail_v2beta_generated_CompletionService_CompleteQuery_async", - "title": "CatalogService completeQuery Sample", + "regionTag": "retail_v2beta_generated_CatalogService_GetCompletionConfig_async", + "title": "CatalogService getCompletionConfig Sample", "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Gets a [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig].", "canonical": true, - "file": "completion_service.complete_query.js", + "file": "catalog_service.get_completion_config.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 108, + "end": 51, "type": "FULL" } ], "clientMethod": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetCompletionConfig", "async": true, "parameters": [ { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "device_type", - "type": "TYPE_STRING" - }, - { - "name": "dataset", + "name": "name", "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" } ], - "resultType": ".google.cloud.retail.v2beta.CompleteQueryResponse", + "resultType": ".google.cloud.retail.v2beta.CompletionConfig", "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetCompletionConfig", "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2beta.CompletionService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_CompletionService_ImportCompletionData_async", - "title": "CatalogService importCompletionData Sample", + "regionTag": "retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async", + "title": "CatalogService updateCompletionConfig Sample", "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing may be synchronous. Partial updating is not supported. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Updates the [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig]s.", "canonical": true, - "file": "completion_service.import_completion_data.js", + "file": "catalog_service.update_completion_config.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 65, + "end": 67, "type": "FULL" } ], "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig", "async": true, "parameters": [ { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2beta.CompletionDataInputConfig" + "name": "completion_config", + "type": ".google.cloud.retail.v2beta.CompletionConfig" }, { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" + "name": "update_mask", + "type": ".google.protobuf.FieldMask" } ], - "resultType": ".google.longrunning.Operation", + "resultType": ".google.cloud.retail.v2beta.CompletionConfig", "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig", "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2beta.CompletionService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_PredictionService_Predict_async", - "title": "CatalogService predict Sample", + "regionTag": "retail_v2beta_generated_CatalogService_GetAttributesConfig_async", + "title": "CatalogService getAttributesConfig Sample", "origin": "API_DEFINITION", - "description": " Makes a recommendation prediction.", + "description": " Gets an [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig].", "canonical": true, - "file": "prediction_service.predict.js", + "file": "catalog_service.get_attributes_config.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 150, + "end": 51, "type": "FULL" } ], "clientMethod": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetAttributesConfig", "async": true, "parameters": [ { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2beta.UserEvent" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", + "name": "name", "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "params", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" } ], - "resultType": ".google.cloud.retail.v2beta.PredictResponse", + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", "client": { - "shortName": "PredictionServiceClient", - "fullName": "google.cloud.retail.v2beta.PredictionServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetAttributesConfig", "service": { - "shortName": "PredictionService", - "fullName": "google.cloud.retail.v2beta.PredictionService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_ProductService_CreateProduct_async", - "title": "CatalogService createProduct Sample", + "regionTag": "retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async", + "title": "CatalogService updateAttributesConfig Sample", "origin": "API_DEFINITION", - "description": " Creates a [Product][google.cloud.retail.v2beta.Product].", + "description": " Updates the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", "canonical": true, - "file": "product_service.create_product.js", + "file": "catalog_service.update_attributes_config.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 72, + "end": 59, "type": "FULL" } ], "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig", "async": true, "parameters": [ { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.retail.v2beta.Product" + "name": "attributes_config", + "type": ".google.cloud.retail.v2beta.AttributesConfig" }, { - "name": "product_id", - "type": "TYPE_STRING" + "name": "update_mask", + "type": ".google.protobuf.FieldMask" } ], - "resultType": ".google.cloud.retail.v2beta.Product", + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig", "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_ProductService_GetProduct_async", - "title": "CatalogService getProduct Sample", + "regionTag": "retail_v2beta_generated_CatalogService_AddCatalogAttribute_async", + "title": "CatalogService addCatalogAttribute Sample", "origin": "API_DEFINITION", - "description": " Gets a [Product][google.cloud.retail.v2beta.Product].", + "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", "canonical": true, - "file": "product_service.get_product.js", + "file": "catalog_service.add_catalog_attribute.js", "language": "JAVASCRIPT", "segments": [ { @@ -435,167 +379,755 @@ } ], "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute", "async": true, "parameters": [ { - "name": "name", + "name": "attributes_config", "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2beta.CatalogAttribute" } ], - "resultType": ".google.cloud.retail.v2beta.Product", + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute", "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_ProductService_ListProducts_async", - "title": "CatalogService listProducts Sample", + "regionTag": "retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async", + "title": "CatalogService removeCatalogAttribute Sample", "origin": "API_DEFINITION", - "description": " Gets a list of [Product][google.cloud.retail.v2beta.Product]s.", + "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", "canonical": true, - "file": "product_service.list_products.js", + "file": "catalog_service.remove_catalog_attribute.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 124, + "end": 57, "type": "FULL" } ], "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute", "async": true, "parameters": [ { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", + "name": "attributes_config", "type": "TYPE_STRING" }, { - "name": "filter", + "name": "key", "type": "TYPE_STRING" - }, - { - "name": "read_mask", - "type": ".google.protobuf.FieldMask" } ], - "resultType": ".google.cloud.retail.v2beta.ListProductsResponse", + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute", "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_ProductService_UpdateProduct_async", - "title": "CatalogService updateProduct Sample", + "regionTag": "retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async", + "title": "CatalogService replaceCatalogAttribute Sample", "origin": "API_DEFINITION", - "description": " Updates a [Product][google.cloud.retail.v2beta.Product].", + "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2beta.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", "canonical": true, - "file": "product_service.update_product.js", + "file": "catalog_service.replace_catalog_attribute.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 72, + "end": 65, "type": "FULL" } ], "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute", "async": true, "parameters": [ { - "name": "product", - "type": ".google.cloud.retail.v2beta.Product" + "name": "attributes_config", + "type": "TYPE_STRING" }, { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2beta.CatalogAttribute" }, { - "name": "allow_missing", - "type": "TYPE_BOOL" + "name": "update_mask", + "type": ".google.protobuf.FieldMask" } ], - "resultType": ".google.cloud.retail.v2beta.Product", + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" }, "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute", "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" } } } }, { - "regionTag": "retail_v2beta_generated_ProductService_DeleteProduct_async", - "title": "CatalogService deleteProduct Sample", + "regionTag": "retail_v2beta_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", "origin": "API_DEFINITION", - "description": " Deletes a [Product][google.cloud.retail.v2beta.Product].", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, - "file": "product_service.delete_product.js", + "file": "completion_service.complete_query.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 67, + "end": 109, "type": "FULL" } ], "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", "async": true, "parameters": [ { - "name": "name", + "name": "catalog", "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" - }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2beta.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2beta.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2beta.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ControlService_CreateControl_async", + "title": "CatalogService createControl Sample", + "origin": "API_DEFINITION", + "description": " Creates a Control. If the [Control][google.cloud.retail.v2beta.Control] to create already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "control_service.create_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.CreateControl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "control", + "type": ".google.cloud.retail.v2beta.Control" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.CreateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ControlService_DeleteControl_async", + "title": "CatalogService deleteControl Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Control. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.delete_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2beta.ControlService.DeleteControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2beta.ControlService.DeleteControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ControlService_UpdateControl_async", + "title": "CatalogService updateControl Sample", + "origin": "API_DEFINITION", + "description": " Updates a Control. [Control][google.cloud.retail.v2beta.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.update_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.UpdateControl", + "async": true, + "parameters": [ + { + "name": "control", + "type": ".google.cloud.retail.v2beta.Control" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.UpdateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ControlService_GetControl_async", + "title": "CatalogService getControl Sample", + "origin": "API_DEFINITION", + "description": " Gets a Control.", + "canonical": true, + "file": "control_service.get_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2beta.ControlService.GetControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2beta.ControlService.GetControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ControlService_ListControls_async", + "title": "CatalogService listControls Sample", + "origin": "API_DEFINITION", + "description": " Lists all Controls linked to this catalog.", + "canonical": true, + "file": "control_service.list_controls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2beta.ControlService.ListControls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListControlsResponse", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2beta.ControlService.ListControls", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 153, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2beta.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2beta.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2beta.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2beta.PredictionService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2beta.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 124, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", "service": { "shortName": "ProductService", "fullName": "google.cloud.retail.v2beta.ProductService" @@ -614,7 +1146,7 @@ "segments": [ { "start": 25, - "end": 96, + "end": 85, "type": "FULL" } ], @@ -671,32 +1203,144 @@ "regionTag": "retail_v2beta_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 102, + "end": 116, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, "type": "FULL" } ], "clientMethod": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", "async": true, "parameters": [ { - "name": "inventory", - "type": ".google.cloud.retail.v2beta.Product" + "name": "product", + "type": "TYPE_STRING" }, { - "name": "set_mask", - "type": ".google.protobuf.FieldMask" + "name": "type", + "type": "TYPE_STRING" }, { - "name": "set_time", + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", "type": ".google.protobuf.Timestamp" }, { @@ -710,8 +1354,8 @@ "fullName": "google.cloud.retail.v2beta.ProductServiceClient" }, "method": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", "service": { "shortName": "ProductService", "fullName": "google.cloud.retail.v2beta.ProductService" @@ -720,23 +1364,23 @@ } }, { - "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", - "title": "CatalogService addFulfillmentPlaces Sample", + "regionTag": "retail_v2beta_generated_ProductService_AddLocalInventories_async", + "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, - "file": "product_service.add_fulfillment_places.js", + "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 107, + "end": 92, "type": "FULL" } ], "clientMethod": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.AddLocalInventories", "async": true, "parameters": [ { @@ -744,12 +1388,12 @@ "type": "TYPE_STRING" }, { - "name": "type", - "type": "TYPE_STRING" + "name": "local_inventories", + "type": "TYPE_MESSAGE[]" }, { - "name": "place_ids", - "type": "TYPE_STRING[]" + "name": "add_mask", + "type": ".google.protobuf.FieldMask" }, { "name": "add_time", @@ -766,8 +1410,8 @@ "fullName": "google.cloud.retail.v2beta.ProductServiceClient" }, "method": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.AddLocalInventories", "service": { "shortName": "ProductService", "fullName": "google.cloud.retail.v2beta.ProductService" @@ -776,33 +1420,29 @@ } }, { - "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "CatalogService removeFulfillmentPlaces Sample", + "regionTag": "retail_v2beta_generated_ProductService_RemoveLocalInventories_async", + "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, - "file": "product_service.remove_fulfillment_places.js", + "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 103, + "end": 77, "type": "FULL" } ], "clientMethod": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveLocalInventories", "async": true, "parameters": [ { "name": "product", "type": "TYPE_STRING" }, - { - "name": "type", - "type": "TYPE_STRING" - }, { "name": "place_ids", "type": "TYPE_STRING[]" @@ -822,8 +1462,8 @@ "fullName": "google.cloud.retail.v2beta.ProductServiceClient" }, "method": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveLocalInventories", "service": { "shortName": "ProductService", "fullName": "google.cloud.retail.v2beta.ProductService" @@ -835,14 +1475,14 @@ "regionTag": "retail_v2beta_generated_SearchService_Search_async", "title": "CatalogService search Sample", "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "search_service.search.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 252, + "end": 253, "type": "FULL" } ], @@ -922,6 +1562,10 @@ { "name": "search_mode", "type": ".google.cloud.retail.v2beta.SearchRequest.SearchMode" + }, + { + "name": "personalization_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec" } ], "resultType": ".google.cloud.retail.v2beta.SearchResponse", @@ -939,6 +1583,314 @@ } } }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_CreateServingConfig_async", + "title": "CatalogService createServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2beta.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2beta.Catalog], otherwise a FAILED_PRECONDITION error is returned.", + "canonical": true, + "file": "serving_config_service.create_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.CreateServingConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "serving_config", + "type": ".google.cloud.retail.v2beta.ServingConfig" + }, + { + "name": "serving_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.CreateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async", + "title": "CatalogService deleteServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.delete_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async", + "title": "CatalogService updateServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ServingConfig.", + "canonical": true, + "file": "serving_config_service.update_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfig", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": ".google.cloud.retail.v2beta.ServingConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_GetServingConfig_async", + "title": "CatalogService getServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.get_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.GetServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.GetServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_ListServingConfigs_async", + "title": "CatalogService listServingConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists all ServingConfigs linked to this catalog.", + "canonical": true, + "file": "serving_config_service.list_serving_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.ListServingConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListServingConfigsResponse", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.ListServingConfigs", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_AddControl_async", + "title": "CatalogService addControl Sample", + "origin": "API_DEFINITION", + "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", + "canonical": true, + "file": "serving_config_service.add_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.AddControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.AddControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ServingConfigService_RemoveControl_async", + "title": "CatalogService removeControl Sample", + "origin": "API_DEFINITION", + "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", + "canonical": true, + "file": "serving_config_service.remove_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.RemoveControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.RemoveControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } + }, { "regionTag": "retail_v2beta_generated_UserEventService_WriteUserEvent_async", "title": "CatalogService writeUserEvent Sample", @@ -1135,7 +2087,7 @@ "regionTag": "retail_v2beta_generated_UserEventService_RejoinUserEvents_async", "title": "CatalogService rejoinUserEvents Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", "canonical": true, "file": "user_event_service.rejoin_user_events.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-retail/src/index.ts b/packages/google-cloud-retail/src/index.ts index de1b68b3218..7fb6963744a 100644 --- a/packages/google-cloud-retail/src/index.ts +++ b/packages/google-cloud-retail/src/index.ts @@ -24,12 +24,16 @@ const CatalogServiceClient = v2beta.CatalogServiceClient; type CatalogServiceClient = v2beta.CatalogServiceClient; const CompletionServiceClient = v2beta.CompletionServiceClient; type CompletionServiceClient = v2beta.CompletionServiceClient; +const ControlServiceClient = v2beta.ControlServiceClient; +type ControlServiceClient = v2beta.ControlServiceClient; const PredictionServiceClient = v2beta.PredictionServiceClient; type PredictionServiceClient = v2beta.PredictionServiceClient; const ProductServiceClient = v2beta.ProductServiceClient; type ProductServiceClient = v2beta.ProductServiceClient; const SearchServiceClient = v2beta.SearchServiceClient; type SearchServiceClient = v2beta.SearchServiceClient; +const ServingConfigServiceClient = v2beta.ServingConfigServiceClient; +type ServingConfigServiceClient = v2beta.ServingConfigServiceClient; const UserEventServiceClient = v2beta.UserEventServiceClient; type UserEventServiceClient = v2beta.UserEventServiceClient; @@ -39,9 +43,11 @@ export { v2beta, CatalogServiceClient, CompletionServiceClient, + ControlServiceClient, PredictionServiceClient, ProductServiceClient, SearchServiceClient, + ServingConfigServiceClient, UserEventServiceClient, }; export default { @@ -50,9 +56,11 @@ export default { v2beta, CatalogServiceClient, CompletionServiceClient, + ControlServiceClient, PredictionServiceClient, ProductServiceClient, SearchServiceClient, + ServingConfigServiceClient, UserEventServiceClient, }; import * as protos from '../protos/protos'; diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 74a0fc48d76..a6efcec5f60 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -458,10 +458,6 @@ export class CatalogServiceClient { * * UserEventService will only join events with products from branch * {newBranch}. * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * * @param {Object} request * The request object that will be sent. * @param {string} request.catalog @@ -472,6 +468,10 @@ export class CatalogServiceClient { * * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT * error is returned. + * + * If there are no sufficient active products in the targeted branch and + * {@link google.cloud.retail.v2.SetDefaultBranchRequest.force|force} is not set, a + * FAILED_PRECONDITION error is returned. * @param {string} request.note * Some note on this request, this can be retrieved by * {@link google.cloud.retail.v2.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} @@ -479,6 +479,10 @@ export class CatalogServiceClient { * * This field must be a UTF-8 encoded string with a length limit of 1,000 * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {boolean} request.force + * If set to true, it permits switching to a branch with + * {@link google.cloud.retail.v2.SetDefaultBranchRequest.branch_id|branch_id} even + * if it has no sufficient active products. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -562,10 +566,6 @@ export class CatalogServiceClient { * {@link google.cloud.retail.v2.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} * method under a specified parent catalog. * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. - * * @param {Object} request * The request object that will be sent. * @param {string} request.catalog diff --git a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json index 4db248503a9..dd7dfb7a71b 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json @@ -7,6 +7,7 @@ "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index 365893fa40f..ceec448c353 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -41,8 +41,7 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2 */ @@ -339,8 +338,7 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -354,21 +352,20 @@ export class CompletionServiceClient { * * The maximum number of allowed characters is 255. * @param {string} request.visitorId - * 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 logs in or out of the website. + * Required field. 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 logs in or 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. * @param {string[]} request.languageCodes - * The list of languages of the query. This is - * the BCP-47 language code, such as "en-US" or "sr-Latn". - * For more information, see - * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). - * - * The maximum number of allowed characters is 255. - * Only "en-US" is currently supported. + * The language filters applied to the output suggestions. If set, it should + * contain the language of the query. If not set, suggestions are returned + * without considering language restrictions. This is the BCP-47 language + * code, such as "en-US" or "sr-Latn". For more information, see [Tags for + * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + * number of language codes is 3. * @param {string} request.deviceType * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. @@ -486,11 +483,13 @@ export class CompletionServiceClient { /** * Bulk import of processed completion dataset. * - * Request processing may be synchronous. Partial updating is not supported. + * Request processing is asynchronous. Partial updating is not supported. + * + * The operation is successfully finished only after the imported suggestions + * are indexed successfully and ready for serving. The process takes hours. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. diff --git a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json index 4db248503a9..dd7dfb7a71b 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json @@ -7,6 +7,7 @@ "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", diff --git a/packages/google-cloud-retail/src/v2/gapic_metadata.json b/packages/google-cloud-retail/src/v2/gapic_metadata.json index 064eddd9b6d..e2fe1b36649 100644 --- a/packages/google-cloud-retail/src/v2/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2/gapic_metadata.json @@ -166,6 +166,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", @@ -218,6 +228,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 5f81bbc6219..436b568e8ad 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -345,9 +345,12 @@ export class PredictionServiceClient { * * 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`. + * If your filter blocks all prediction results, the API will return generic + * (unfiltered) popular products. If you only want results strictly matching + * the filters, set `strictFiltering` to True in `PredictRequest.params` to + * receive empty results instead. + * Note that the API will never return items with storageStatus of "EXPIRED" + * or "DELETED" regardless of filter choices. * @param {boolean} request.validateOnly * Use validate only mode for this prediction query. If set to true, a * dummy model will be used that returns arbitrary products. diff --git a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json index 4db248503a9..dd7dfb7a71b 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json @@ -7,6 +7,7 @@ "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 741291525ae..5c4d892aed9 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -225,6 +225,18 @@ export class ProductServiceClient { const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata' ) as gax.protobuf.Type; + const addLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.AddLocalInventoriesResponse' + ) as gax.protobuf.Type; + const addLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.AddLocalInventoriesMetadata' + ) as gax.protobuf.Type; + const removeLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2.RemoveLocalInventoriesResponse' + ) as gax.protobuf.Type; + const removeLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2.RemoveLocalInventoriesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -251,6 +263,20 @@ export class ProductServiceClient { removeFulfillmentPlacesMetadata ) ), + addLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addLocalInventoriesResponse.decode.bind(addLocalInventoriesResponse), + addLocalInventoriesMetadata.decode.bind(addLocalInventoriesMetadata) + ), + removeLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeLocalInventoriesResponse.decode.bind( + removeLocalInventoriesResponse + ), + removeLocalInventoriesMetadata.decode.bind( + removeLocalInventoriesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -312,6 +338,8 @@ export class ProductServiceClient { 'setInventory', 'addFulfillmentPlaces', 'removeFulfillmentPlaces', + 'addLocalInventories', + 'removeLocalInventories', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -823,15 +851,7 @@ export class ProductServiceClient { * If no updateMask is specified, requires products.create permission. * If updateMask is specified, requires products.update permission. * @param {string} request.requestId - * Unique identifier provided by client, within the ancestor - * dataset scope. Ensures idempotency and used for request deduplication. - * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: `{@link |a-zA-Z0-9_]+`. This is returned as [Operation.name} in - * {@link google.cloud.retail.v2.ImportMetadata|ImportMetadata}. - * - * Only supported when - * {@link google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. + * Deprecated. This field has no effect. * @param {google.cloud.retail.v2.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig @@ -1012,7 +1032,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.CreateProductRequest.product|CreateProductRequest.product}, * then any pre-existing inventory information for this product will be used. * - * If no inventory fields are set in {@link |UpdateProductRequest.set_mask}, + * If no inventory fields are set in + * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, * then any existing inventory information will be preserved. * * Pre-existing inventory information can only be updated with @@ -1022,8 +1043,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1055,6 +1075,24 @@ export class ProductServiceClient { * provided or default value for * {@link google.cloud.retail.v2.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. * + * The caller can replace place IDs for a subset of fulfillment types in the + * following ways: + * + * * Adds "fulfillment_info" in + * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} + * * Specifies only the desired fulfillment types and corresponding place IDs + * to update in {@link |SetInventoryRequest.inventory.fulfillment_info} + * + * The caller can clear all place IDs from a subset of fulfillment types in + * the following ways: + * + * * Adds "fulfillment_info" in + * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} + * * Specifies only the desired fulfillment types to clear in + * {@link |SetInventoryRequest.inventory.fulfillment_info} + * * Checks that only the desired fulfillment info types have empty + * {@link |SetInventoryRequest.inventory.fulfillment_info.place_ids} + * * The last update time is recorded for the following inventory fields: * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} * * {@link google.cloud.retail.v2.Product.availability|Product.availability} @@ -1065,8 +1103,9 @@ export class ProductServiceClient { * needed, {@link |UpdateProduct} should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided - * {@link google.cloud.retail.v2.Product|Product} to update. If not set or set with - * empty paths, all inventory fields will be updated. + * {@link google.cloud.retail.v2.Product|Product} to update. + * + * At least one field must be provided. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. @@ -1225,8 +1264,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1429,8 +1467,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1618,6 +1655,376 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata >; } + /** + * Updates local inventory information for a + * {@link google.cloud.retail.v2.Product|Product} at a list of places, while + * respecting the last update timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2.Product|Product} to exist before updating + * inventory information. If the request is valid, the update will be enqueued + * and processed downstream. As a consequence, when a response is returned, + * updates are not immediately manifested in the + * {@link google.cloud.retail.v2.Product|Product} queried by + * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * + * Local inventory information can only be modified using this method. + * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} and + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct} has no + * effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please enable Retail Search on Cloud Console before using this feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * @param {number[]} request.localInventories + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 3000 inventories are allowed per + * request. + * @param {google.protobuf.FieldMask} request.addMask + * Indicates which inventory fields in the provided list of + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory} to update. The + * field is updated to the provided value. + * + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not + * found, the local inventory will still be processed and retained for at most + * 1 day and processed once the {@link google.cloud.retail.v2.Product|Product} is + * created. If set to false, a NOT_FOUND error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/product_service.add_local_inventories.js + * region_tag:retail_v2_generated_ProductService_AddLocalInventories_async + */ + addLocalInventories( + request?: protos.google.cloud.retail.v2.IAddLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addLocalInventories( + request: protos.google.cloud.retail.v2.IAddLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request: protos.google.cloud.retail.v2.IAddLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request?: protos.google.cloud.retail.v2.IAddLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addLocalInventories(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/product_service.add_local_inventories.js + * region_tag:retail_v2_generated_ProductService_AddLocalInventories_async + */ + async checkAddLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2.AddLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2.AddLocalInventoriesMetadata + >; + } + /** + * Remove local inventory information for a + * {@link google.cloud.retail.v2.Product|Product} at a list of places at a removal + * timestamp. + * + * This process is asynchronous. If the request is valid, the removal will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, removals are not immediately manifested in the + * {@link google.cloud.retail.v2.Product|Product} queried by + * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * + * Local inventory information can only be removed using this method. + * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} and + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct} has no + * effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please enable Retail Search on Cloud Console before using this feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of {@link google.cloud.retail.v2.Product|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 + * {@link google.cloud.retail.v2.Product|Product}, regardless of whether or not it + * exists, a PERMISSION_DENIED error is returned. + * @param {string[]} request.placeIds + * Required. A list of place IDs to have their inventory deleted. + * At most 3000 place IDs are allowed per request. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not + * found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * {@link google.cloud.retail.v2.Product|Product} is created. If set to false, a + * NOT_FOUND error is returned if the + * {@link google.cloud.retail.v2.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/product_service.remove_local_inventories.js + * region_tag:retail_v2_generated_ProductService_RemoveLocalInventories_async + */ + removeLocalInventories( + request?: protos.google.cloud.retail.v2.IRemoveLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeLocalInventories( + request: protos.google.cloud.retail.v2.IRemoveLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request: protos.google.cloud.retail.v2.IRemoveLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request?: protos.google.cloud.retail.v2.IRemoveLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeLocalInventories( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/product_service.remove_local_inventories.js + * region_tag:retail_v2_generated_ProductService_RemoveLocalInventories_async + */ + async checkRemoveLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.RemoveLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.RemoveLocalInventoriesMetadata + >; + } /** * Gets a list of {@link google.cloud.retail.v2.Product|Product}s. * diff --git a/packages/google-cloud-retail/src/v2/product_service_client_config.json b/packages/google-cloud-retail/src/v2/product_service_client_config.json index 40550466926..32245ac6134 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/product_service_client_config.json @@ -82,6 +82,16 @@ "timeout_millis": 30000, "retry_codes_name": "idempotent", "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "AddLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "RemoveLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/packages/google-cloud-retail/src/v2/product_service_proto_list.json b/packages/google-cloud-retail/src/v2/product_service_proto_list.json index 4db248503a9..dd7dfb7a71b 100644 --- a/packages/google-cloud-retail/src/v2/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/product_service_proto_list.json @@ -7,6 +7,7 @@ "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index e676995b5bc..cf269f4497d 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -44,8 +44,7 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2 */ @@ -326,14 +325,13 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -350,6 +348,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2.UserInfo} request.userInfo @@ -387,6 +388,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -410,11 +414,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -431,12 +435,15 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s attributes. The attributes from - * all the matching {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s are merged and de-duplicated. - * Notice that rollup {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra - * query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2.Product|Product}s attributes, + * {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo} or + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory}s attributes. The + * attributes from all the matching + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s or + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory}s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -451,6 +458,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -510,6 +518,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -596,7 +606,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -613,6 +623,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2.UserInfo} request.userInfo @@ -650,6 +663,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -673,11 +689,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -694,12 +710,15 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s attributes. The attributes from - * all the matching {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s are merged and de-duplicated. - * Notice that rollup {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra - * query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2.Product|Product}s attributes, + * {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo} or + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory}s attributes. The + * attributes from all the matching + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s or + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory}s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -714,6 +733,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -773,6 +793,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -815,7 +837,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -832,6 +854,9 @@ export class SearchServiceClient { * identify a visitor on a single device. This unique identifier should not * change if the visitor logs in or out of the website. * + * This should be the same identifier as + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id}. + * * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {google.cloud.retail.v2.UserInfo} request.userInfo @@ -869,6 +894,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -892,11 +920,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -913,12 +941,15 @@ export class SearchServiceClient { * @param {string[]} request.variantRollupKeys * The keys to fetch and rollup the matching * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s attributes. The attributes from - * all the matching {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s are merged and de-duplicated. - * Notice that rollup {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2.Product|Product}s attributes will lead to extra - * query latency. Maximum number of keys is 10. + * {@link google.cloud.retail.v2.Product|Product}s attributes, + * {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo} or + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory}s attributes. The + * attributes from all the matching + * {@link google.cloud.retail.v2.Product.Type.VARIANT|variant} + * {@link google.cloud.retail.v2.Product|Product}s or + * {@link google.cloud.retail.v2.LocalInventory|LocalInventory}s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -933,6 +964,7 @@ export class SearchServiceClient { * * discount * * variantId * * inventory(place_id,price) + * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the * {@link |Product.inventories.attributes} map. * * attributes.key, where key is any key in the @@ -992,6 +1024,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} diff --git a/packages/google-cloud-retail/src/v2/search_service_proto_list.json b/packages/google-cloud-retail/src/v2/search_service_proto_list.json index 4db248503a9..dd7dfb7a71b 100644 --- a/packages/google-cloud-retail/src/v2/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/search_service_proto_list.json @@ -7,6 +7,7 @@ "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index cb78d27b192..4853609b4b1 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -866,13 +866,14 @@ export class UserEventServiceClient { >; } /** - * Triggers a user event rejoin operation with latest product catalog. Events + * Starts 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 + * serving. This method can be used to start 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. + * correct events joined with the wrong product catalog. A rejoin operation + * can take hours or days to complete. * * @param {Object} request * The request object that will be sent. diff --git a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json index 4db248503a9..dd7dfb7a71b 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json @@ -7,6 +7,7 @@ "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 5c244a23ca2..d723d5c0e49 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -164,18 +164,30 @@ export class CatalogServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -243,6 +255,13 @@ export class CatalogServiceClient { 'updateCatalog', 'setDefaultBranch', 'getDefaultBranch', + 'getCompletionConfig', + 'updateCompletionConfig', + 'getAttributesConfig', + 'updateAttributesConfig', + 'addCatalogAttribute', + 'removeCatalogAttribute', + 'replaceCatalogAttribute', ]; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( @@ -464,90 +483,817 @@ export class CatalogServiceClient { * * UserEventService will only join events with products from branch * {newBranch}. * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.branchId + * The final component of the resource name of a branch. + * + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + * + * If there are no sufficient active products in the targeted branch and + * {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.force|force} is not + * set, a FAILED_PRECONDITION error is returned. + * @param {string} request.note + * Some note on this request, this can be retrieved by + * {@link google.cloud.retail.v2beta.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} + * before next valid default branch set occurs. + * + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {boolean} request.force + * If set to true, it permits switching to a branch with + * {@link google.cloud.retail.v2beta.SetDefaultBranchRequest.branch_id|branch_id} + * even if it has no sufficient active products. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.set_default_branch.js + * region_tag:retail_v2beta_generated_CatalogService_SetDefaultBranch_async + */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultBranch(request, options, callback); + } + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2beta.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2beta.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.get_default_branch.js + * region_tag:retail_v2beta_generated_CatalogService_GetDefaultBranch_async + */ + getDefaultBranch( + request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + getDefaultBranch( + request: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.getDefaultBranch(request, options, callback); + } + /** + * Gets a {@link google.cloud.retail.v2beta.CompletionConfig|CompletionConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompletionConfig]{@link google.cloud.retail.v2beta.CompletionConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.get_completion_config.js + * region_tag:retail_v2beta_generated_CatalogService_GetCompletionConfig_async + */ + getCompletionConfig( + request?: protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompletionConfig, + protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest | undefined, + {} | undefined + ] + >; + getCompletionConfig( + request: protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getCompletionConfig( + request: protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getCompletionConfig( + request?: protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompletionConfig, + protos.google.cloud.retail.v2beta.IGetCompletionConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCompletionConfig(request, options, callback); + } + /** + * Updates the + * {@link google.cloud.retail.v2beta.CompletionConfig|CompletionConfig}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.CompletionConfig} request.completionConfig + * Required. The + * {@link google.cloud.retail.v2beta.CompletionConfig|CompletionConfig} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2beta.CompletionConfig|CompletionConfig}, then a + * PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2beta.CompletionConfig|CompletionConfig} to + * update does not exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.CompletionConfig|CompletionConfig} to update. + * The following are the only supported fields: + * + * * {@link google.cloud.retail.v2beta.CompletionConfig.matching_order|CompletionConfig.matching_order} + * * {@link google.cloud.retail.v2beta.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions} + * * {@link google.cloud.retail.v2beta.CompletionConfig.min_prefix_length|CompletionConfig.min_prefix_length} + * * {@link google.cloud.retail.v2beta.CompletionConfig.auto_learning|CompletionConfig.auto_learning} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompletionConfig]{@link google.cloud.retail.v2beta.CompletionConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.update_completion_config.js + * region_tag:retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async + */ + updateCompletionConfig( + request?: protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompletionConfig, + ( + | protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest + | undefined + ), + {} | undefined + ] + >; + updateCompletionConfig( + request: protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCompletionConfig( + request: protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCompletionConfig( + request?: protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.ICompletionConfig, + | protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.ICompletionConfig, + ( + | protos.google.cloud.retail.v2beta.IUpdateCompletionConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'completion_config.name': request.completionConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCompletionConfig( + request, + options, + callback + ); + } + /** + * Gets an {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2beta.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.get_attributes_config.js + * region_tag:retail_v2beta_generated_CatalogService_GetAttributesConfig_async + */ + getAttributesConfig( + request?: protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IAttributesConfig, + protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest | undefined, + {} | undefined + ] + >; + getAttributesConfig( + request: protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAttributesConfig( + request: protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAttributesConfig( + request?: protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IAttributesConfig, + protos.google.cloud.retail.v2beta.IGetAttributesConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAttributesConfig(request, options, callback); + } + /** + * Updates the + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig}. + * + * The catalog attributes in the request will be updated in the catalog, or + * inserted if they do not exist. Existing catalog attributes not included in + * the request will remain unchanged. Attributes that are assigned to + * products, but do not exist at the catalog level, are always included in the + * response. The product attribute is assigned default values for missing + * catalog attribute fields, e.g., searchable and dynamic facetable options. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.AttributesConfig} request.attributesConfig + * Required. The + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig} to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig} to update. + * The following is the only supported field: + * + * * {@link google.cloud.retail.v2beta.AttributesConfig.catalog_attributes|AttributesConfig.catalog_attributes} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2beta.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.update_attributes_config.js + * region_tag:retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async + */ + updateAttributesConfig( + request?: protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IAttributesConfig, + ( + | protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest + | undefined + ), + {} | undefined + ] + >; + updateAttributesConfig( + request: protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAttributesConfig( + request: protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAttributesConfig( + request?: protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IAttributesConfig, + ( + | protos.google.cloud.retail.v2beta.IUpdateAttributesConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'attributes_config.name': request.attributesConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAttributesConfig( + request, + options, + callback + ); + } + /** + * Adds the specified + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to the + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig}. + * + * If the {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to + * add already exists, an ALREADY_EXISTS error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {google.cloud.retail.v2beta.CatalogAttribute} request.catalogAttribute + * Required. The + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to add. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2beta.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.add_catalog_attribute.js + * region_tag:retail_v2beta_generated_CatalogService_AddCatalogAttribute_async + */ + addCatalogAttribute( + request?: protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IAttributesConfig, + protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest | undefined, + {} | undefined + ] + >; + addCatalogAttribute( + request: protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + addCatalogAttribute( + request: protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + addCatalogAttribute( + request?: protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IAttributesConfig, + protos.google.cloud.retail.v2beta.IAddCatalogAttributeRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + attributes_config: request.attributesConfig || '', + }); + this.initialize(); + return this.innerApiCalls.addCatalogAttribute(request, options, callback); + } + /** + * Removes the specified + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} from the + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig}. + * + * If the {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to + * remove does not exist, a NOT_FOUND error is returned. * * @param {Object} request * The request object that will be sent. - * @param {string} request.catalog - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.branchId - * The final component of the resource name of a branch. - * - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * @param {string} request.note - * Some note on this request, this can be retrieved by - * {@link google.cloud.retail.v2beta.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} - * before next valid default branch set occurs. - * - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {string} request.key + * Required. The attribute name key of the + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to remove. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2beta.AttributesConfig}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v2beta/catalog_service.set_default_branch.js - * region_tag:retail_v2beta_generated_CatalogService_SetDefaultBranch_async + * @example include:samples/generated/v2beta/catalog_service.remove_catalog_attribute.js + * region_tag:retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async */ - setDefaultBranch( - request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + removeCatalogAttribute( + request?: protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, options?: CallOptions ): Promise< [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2beta.IAttributesConfig, + ( + | protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest + | undefined + ), {} | undefined ] >; - setDefaultBranch( - request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + removeCatalogAttribute( + request: protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, options: CallOptions, callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + removeCatalogAttribute( + request: protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - setDefaultBranch( - request?: protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest, + removeCatalogAttribute( + request?: protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest, optionsOrCallback?: | CallOptions | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined >, callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined > ): Promise< [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2beta.ISetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2beta.IAttributesConfig, + ( + | protos.google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest + | undefined + ), {} | undefined ] > | void { @@ -564,88 +1310,110 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - catalog: request.catalog || '', + attributes_config: request.attributesConfig || '', }); this.initialize(); - return this.innerApiCalls.setDefaultBranch(request, options, callback); + return this.innerApiCalls.removeCatalogAttribute( + request, + options, + callback + ); } /** - * Get which branch is currently default branch set by - * {@link google.cloud.retail.v2beta.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. + * Replaces the specified + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} in the + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig} by updating + * the catalog attribute with the same + * {@link google.cloud.retail.v2beta.CatalogAttribute.key|CatalogAttribute.key}. * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * If the {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to + * replace does not exist, a NOT_FOUND error is returned. * * @param {Object} request * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {google.cloud.retail.v2beta.CatalogAttribute} request.catalogAttribute + * Required. The updated + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute}. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to update. + * The following are NOT supported: + * + * * {@link google.cloud.retail.v2beta.CatalogAttribute.key|CatalogAttribute.key} + * + * If not set, all supported fields are updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2beta.GetDefaultBranchResponse}. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2beta.AttributesConfig}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v2beta/catalog_service.get_default_branch.js - * region_tag:retail_v2beta_generated_CatalogService_GetDefaultBranch_async + * @example include:samples/generated/v2beta/catalog_service.replace_catalog_attribute.js + * region_tag:retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async */ - getDefaultBranch( - request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request?: protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, options?: CallOptions ): Promise< [ - protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2beta.IAttributesConfig, + ( + | protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest + | undefined + ), {} | undefined ] >; - getDefaultBranch( - request: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request: protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, options: CallOptions, callback: Callback< - protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - getDefaultBranch( - request: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request: protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, callback: Callback< - protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - getDefaultBranch( - request?: protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request?: protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest, optionsOrCallback?: | CallOptions | Callback< - protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined >, callback?: Callback< - protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest + protos.google.cloud.retail.v2beta.IAttributesConfig, + | protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined > ): Promise< [ - protos.google.cloud.retail.v2beta.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2beta.IGetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2beta.IAttributesConfig, + ( + | protos.google.cloud.retail.v2beta.IReplaceCatalogAttributeRequest + | undefined + ), {} | undefined ] > | void { @@ -662,10 +1430,14 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - catalog: request.catalog || '', + attributes_config: request.attributesConfig || '', }); this.initialize(); - return this.innerApiCalls.getDefaultBranch(request, options, callback); + return this.innerApiCalls.replaceCatalogAttribute( + request, + options, + callback + ); } /** @@ -916,6 +1688,61 @@ export class CatalogServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -1032,6 +1859,128 @@ export class CatalogServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified location resource name string. * @@ -1149,6 +2098,77 @@ export class CatalogServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json index 096f9c8d886..cd2aebd157d 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json @@ -48,6 +48,41 @@ "timeout_millis": 5000, "retry_codes_name": "idempotent", "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "GetCompletionConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "UpdateCompletionConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "GetAttributesConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "UpdateAttributesConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "AddCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "RemoveCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "ReplaceCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json index 4ec26e01ef2..7cee73e6f3f 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index c4c1acb2f00..c74abaf3f70 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -41,8 +41,7 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2beta */ @@ -166,12 +165,24 @@ export class CompletionServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -339,8 +350,7 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -354,21 +364,20 @@ export class CompletionServiceClient { * * The maximum number of allowed characters is 255. * @param {string} request.visitorId - * 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 logs in or out of the website. + * Required field. 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 logs in or 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. * @param {string[]} request.languageCodes - * The list of languages of the query. This is - * the BCP-47 language code, such as "en-US" or "sr-Latn". - * For more information, see - * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). - * - * The maximum number of allowed characters is 255. - * Only "en-US" is currently supported. + * The language filters applied to the output suggestions. If set, it should + * contain the language of the query. If not set, suggestions are returned + * without considering language restrictions. This is the BCP-47 language + * code, such as "en-US" or "sr-Latn". For more information, see [Tags for + * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + * number of language codes is 3. * @param {string} request.deviceType * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. @@ -400,7 +409,8 @@ export class CompletionServiceClient { * contact Cloud Retail support team first. * @param {number} request.maxSuggestions * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value {@link |CompletionConfig.max_suggestions}. + * to the configured value + * {@link google.cloud.retail.v2beta.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions}. * * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. @@ -492,11 +502,13 @@ export class CompletionServiceClient { /** * Bulk import of processed completion dataset. * - * Request processing may be synchronous. Partial updating is not supported. + * Request processing is asynchronous. Partial updating is not supported. + * + * The operation is successfully finished only after the imported suggestions + * are indexed successfully and ready for serving. The process takes hours. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -646,6 +658,61 @@ export class CompletionServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -695,6 +762,128 @@ export class CompletionServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -776,6 +965,77 @@ export class CompletionServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json index 4ec26e01ef2..7cee73e6f3f 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client.ts b/packages/google-cloud-retail/src/v2beta/control_service_client.ts new file mode 100644 index 00000000000..4f05678336f --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/control_service_client.ts @@ -0,0 +1,1340 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/control_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './control_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for modifying Control. + * @class + * @memberof v2beta + */ +export class ControlServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + controlServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ControlServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ControlServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listControls: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'controls' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.ControlService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.controlServiceStub) { + return this.controlServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.ControlService. + this.controlServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.ControlService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.ControlService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const controlServiceStubMethods = [ + 'createControl', + 'deleteControl', + 'updateControl', + 'getControl', + 'listControls', + ]; + for (const methodName of controlServiceStubMethods) { + const callPromise = this.controlServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.controlServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a Control. + * + * If the {@link google.cloud.retail.v2beta.Control|Control} to create already + * exists, an ALREADY_EXISTS error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full resource name of parent catalog. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {google.cloud.retail.v2beta.Control} request.control + * Required. The Control to create. + * @param {string} request.controlId + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-_/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2beta.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/control_service.create_control.js + * region_tag:retail_v2beta_generated_ControlService_CreateControl_async + */ + createControl( + request?: protos.google.cloud.retail.v2beta.ICreateControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.ICreateControlRequest | undefined, + {} | undefined + ] + >; + createControl( + request: protos.google.cloud.retail.v2beta.ICreateControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.ICreateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createControl( + request: protos.google.cloud.retail.v2beta.ICreateControlRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.ICreateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createControl( + request?: protos.google.cloud.retail.v2beta.ICreateControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.ICreateControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.ICreateControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.ICreateControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createControl(request, options, callback); + } + /** + * Deletes a Control. + * + * If the {@link google.cloud.retail.v2beta.Control|Control} to delete does not + * exist, a NOT_FOUND error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/control_service.delete_control.js + * region_tag:retail_v2beta_generated_ControlService_DeleteControl_async + */ + deleteControl( + request?: protos.google.cloud.retail.v2beta.IDeleteControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteControlRequest | undefined, + {} | undefined + ] + >; + deleteControl( + request: protos.google.cloud.retail.v2beta.IDeleteControlRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteControl( + request: protos.google.cloud.retail.v2beta.IDeleteControlRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteControl( + request?: protos.google.cloud.retail.v2beta.IDeleteControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteControl(request, options, callback); + } + /** + * Updates a Control. + * + * {@link google.cloud.retail.v2beta.Control|Control} cannot be set to a different + * oneof field, if so an INVALID_ARGUMENT is returned. If the + * {@link google.cloud.retail.v2beta.Control|Control} to delete does not exist, a + * NOT_FOUND error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.Control} request.control + * Required. The Control to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.Control|Control} to update. The following are + * NOT supported: + * + * * {@link google.cloud.retail.v2beta.Control.name|Control.name} + * + * If not set or empty, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2beta.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/control_service.update_control.js + * region_tag:retail_v2beta_generated_ControlService_UpdateControl_async + */ + updateControl( + request?: protos.google.cloud.retail.v2beta.IUpdateControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IUpdateControlRequest | undefined, + {} | undefined + ] + >; + updateControl( + request: protos.google.cloud.retail.v2beta.IUpdateControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateControl( + request: protos.google.cloud.retail.v2beta.IUpdateControlRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateControl( + request?: protos.google.cloud.retail.v2beta.IUpdateControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IUpdateControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'control.name': request.control!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateControl(request, options, callback); + } + /** + * Gets a Control. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2beta.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/control_service.get_control.js + * region_tag:retail_v2beta_generated_ControlService_GetControl_async + */ + getControl( + request?: protos.google.cloud.retail.v2beta.IGetControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IGetControlRequest | undefined, + {} | undefined + ] + >; + getControl( + request: protos.google.cloud.retail.v2beta.IGetControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): void; + getControl( + request: protos.google.cloud.retail.v2beta.IGetControlRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): void; + getControl( + request?: protos.google.cloud.retail.v2beta.IGetControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IControl, + | protos.google.cloud.retail.v2beta.IGetControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl, + protos.google.cloud.retail.v2beta.IGetControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getControl(request, options, callback); + } + + /** + * Lists all Controls linked to this catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2beta.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Control]{@link google.cloud.retail.v2beta.Control}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listControlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listControls( + request?: protos.google.cloud.retail.v2beta.IListControlsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl[], + protos.google.cloud.retail.v2beta.IListControlsRequest | null, + protos.google.cloud.retail.v2beta.IListControlsResponse + ] + >; + listControls( + request: protos.google.cloud.retail.v2beta.IListControlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListControlsRequest, + | protos.google.cloud.retail.v2beta.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IControl + > + ): void; + listControls( + request: protos.google.cloud.retail.v2beta.IListControlsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListControlsRequest, + | protos.google.cloud.retail.v2beta.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IControl + > + ): void; + listControls( + request?: protos.google.cloud.retail.v2beta.IListControlsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2beta.IListControlsRequest, + | protos.google.cloud.retail.v2beta.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IControl + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2beta.IListControlsRequest, + | protos.google.cloud.retail.v2beta.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IControl + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IControl[], + protos.google.cloud.retail.v2beta.IListControlsRequest | null, + protos.google.cloud.retail.v2beta.IListControlsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listControls(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2beta.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Control]{@link google.cloud.retail.v2beta.Control} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listControlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listControlsStream( + request?: protos.google.cloud.retail.v2beta.IListControlsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listControls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listControls.createStream( + this.innerApiCalls.listControls as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listControls`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2beta.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Control]{@link google.cloud.retail.v2beta.Control}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2beta/control_service.list_controls.js + * region_tag:retail_v2beta_generated_ControlService_ListControls_async + */ + listControlsAsync( + request?: protos.google.cloud.retail.v2beta.IListControlsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listControls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listControls.asyncIterate( + this.innerApiCalls['listControls'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.controlServiceStub && !this._terminated) { + return this.controlServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client_config.json b/packages/google-cloud-retail/src/v2beta/control_service_client_config.json new file mode 100644 index 00000000000..b7572aeb833 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/control_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.ControlService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListControls": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json new file mode 100644 index 00000000000..7cee73e6f3f --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json @@ -0,0 +1,20 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json index e48d92e5b5d..f9c6514cba0 100644 --- a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json @@ -25,6 +25,41 @@ "getDefaultBranch" ] }, + "GetCompletionConfig": { + "methods": [ + "getCompletionConfig" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "updateCompletionConfig" + ] + }, + "GetAttributesConfig": { + "methods": [ + "getAttributesConfig" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "updateAttributesConfig" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "addCatalogAttribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "removeCatalogAttribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replaceCatalogAttribute" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -52,6 +87,41 @@ "getDefaultBranch" ] }, + "GetCompletionConfig": { + "methods": [ + "getCompletionConfig" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "updateCompletionConfig" + ] + }, + "GetAttributesConfig": { + "methods": [ + "getAttributesConfig" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "updateAttributesConfig" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "addCatalogAttribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "removeCatalogAttribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replaceCatalogAttribute" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -97,6 +167,74 @@ } } }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls", + "listControlsStream", + "listControlsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls", + "listControlsStream", + "listControlsAsync" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -166,6 +304,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", @@ -218,6 +366,16 @@ "removeFulfillmentPlaces" ] }, + "AddLocalInventories": { + "methods": [ + "addLocalInventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "removeLocalInventories" + ] + }, "ListProducts": { "methods": [ "listProducts", @@ -257,6 +415,94 @@ } } }, + "ServingConfigService": { + "clients": { + "grpc": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "createServingConfig" + ] + }, + "DeleteServingConfig": { + "methods": [ + "deleteServingConfig" + ] + }, + "UpdateServingConfig": { + "methods": [ + "updateServingConfig" + ] + }, + "GetServingConfig": { + "methods": [ + "getServingConfig" + ] + }, + "AddControl": { + "methods": [ + "addControl" + ] + }, + "RemoveControl": { + "methods": [ + "removeControl" + ] + }, + "ListServingConfigs": { + "methods": [ + "listServingConfigs", + "listServingConfigsStream", + "listServingConfigsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "createServingConfig" + ] + }, + "DeleteServingConfig": { + "methods": [ + "deleteServingConfig" + ] + }, + "UpdateServingConfig": { + "methods": [ + "updateServingConfig" + ] + }, + "GetServingConfig": { + "methods": [ + "getServingConfig" + ] + }, + "AddControl": { + "methods": [ + "addControl" + ] + }, + "RemoveControl": { + "methods": [ + "removeControl" + ] + }, + "ListServingConfigs": { + "methods": [ + "listServingConfigs", + "listServingConfigsStream", + "listServingConfigsAsync" + ] + } + } + } + } + }, "UserEventService": { "clients": { "grpc": { diff --git a/packages/google-cloud-retail/src/v2beta/index.ts b/packages/google-cloud-retail/src/v2beta/index.ts index 79cde8aa80a..a7e4f6ba79f 100644 --- a/packages/google-cloud-retail/src/v2beta/index.ts +++ b/packages/google-cloud-retail/src/v2beta/index.ts @@ -18,7 +18,9 @@ export {CatalogServiceClient} from './catalog_service_client'; export {CompletionServiceClient} from './completion_service_client'; +export {ControlServiceClient} from './control_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; export {SearchServiceClient} from './search_service_client'; +export {ServingConfigServiceClient} from './serving_config_service_client'; export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index a89b187a973..514d4e4b083 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -155,12 +155,24 @@ export class PredictionServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Put together the default options sent with requests. @@ -345,9 +357,12 @@ export class PredictionServiceClient { * * 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`. + * If your filter blocks all prediction results, the API will return generic + * (unfiltered) popular products. If you only want results strictly matching + * the filters, set `strictFiltering` to True in `PredictRequest.params` to + * receive empty results instead. + * Note that the API will never return items with storageStatus of "EXPIRED" + * or "DELETED" regardless of filter choices. * @param {boolean} request.validateOnly * Use validate only mode for this prediction query. If set to true, a * dummy model will be used that returns arbitrary products. @@ -478,6 +493,61 @@ export class PredictionServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -527,6 +597,128 @@ export class PredictionServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -608,6 +800,77 @@ export class PredictionServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json index 4ec26e01ef2..7cee73e6f3f 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index aa5f24129f2..cb218273048 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -167,15 +167,27 @@ export class ProductServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -225,6 +237,18 @@ export class ProductServiceClient { const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata' ) as gax.protobuf.Type; + const addLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.AddLocalInventoriesResponse' + ) as gax.protobuf.Type; + const addLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.AddLocalInventoriesMetadata' + ) as gax.protobuf.Type; + const removeLocalInventoriesResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse' + ) as gax.protobuf.Type; + const removeLocalInventoriesMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { importProducts: new this._gaxModule.LongrunningDescriptor( @@ -251,6 +275,20 @@ export class ProductServiceClient { removeFulfillmentPlacesMetadata ) ), + addLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + addLocalInventoriesResponse.decode.bind(addLocalInventoriesResponse), + addLocalInventoriesMetadata.decode.bind(addLocalInventoriesMetadata) + ), + removeLocalInventories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + removeLocalInventoriesResponse.decode.bind( + removeLocalInventoriesResponse + ), + removeLocalInventoriesMetadata.decode.bind( + removeLocalInventoriesMetadata + ) + ), }; // Put together the default options sent with requests. @@ -312,6 +350,8 @@ export class ProductServiceClient { 'setInventory', 'addFulfillmentPlaces', 'removeFulfillmentPlaces', + 'addLocalInventories', + 'removeLocalInventories', ]; for (const methodName of productServiceStubMethods) { const callPromise = this.productServiceStub.then( @@ -844,15 +884,7 @@ export class ProductServiceClient { * If no updateMask is specified, requires products.create permission. * If updateMask is specified, requires products.update permission. * @param {string} request.requestId - * Unique identifier provided by client, within the ancestor - * dataset scope. Ensures idempotency and used for request deduplication. - * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: `{@link |a-zA-Z0-9_]+`. This is returned as [Operation.name} in - * {@link google.cloud.retail.v2beta.ImportMetadata|ImportMetadata}. - * - * Only supported when - * {@link google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. + * Deprecated. This field has no effect. * @param {google.cloud.retail.v2beta.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig @@ -1034,7 +1066,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.CreateProductRequest.product|CreateProductRequest.product}, * then any pre-existing inventory information for this product will be used. * - * If no inventory fields are set in {@link |UpdateProductRequest.set_mask}, + * If no inventory fields are set in + * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, * then any existing inventory information will be preserved. * * Pre-existing inventory information can only be updated with @@ -1044,8 +1077,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1077,6 +1109,24 @@ export class ProductServiceClient { * provided or default value for * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. * + * The caller can replace place IDs for a subset of fulfillment types in the + * following ways: + * + * * Adds "fulfillment_info" in + * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} + * * Specifies only the desired fulfillment types and corresponding place IDs + * to update in {@link |SetInventoryRequest.inventory.fulfillment_info} + * + * The caller can clear all place IDs from a subset of fulfillment types in + * the following ways: + * + * * Adds "fulfillment_info" in + * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} + * * Specifies only the desired fulfillment types to clear in + * {@link |SetInventoryRequest.inventory.fulfillment_info} + * * Checks that only the desired fulfillment info types have empty + * {@link |SetInventoryRequest.inventory.fulfillment_info.place_ids} + * * The last update time is recorded for the following inventory fields: * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} * * {@link google.cloud.retail.v2beta.Product.availability|Product.availability} @@ -1248,8 +1298,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1452,8 +1501,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1641,6 +1689,379 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata >; } + /** + * Updates local inventory information for a + * {@link google.cloud.retail.v2beta.Product|Product} at a list of places, while + * respecting the last update timestamps of each inventory field. + * + * This process is asynchronous and does not require the + * {@link google.cloud.retail.v2beta.Product|Product} to exist before updating + * inventory information. If the request is valid, the update will be enqueued + * and processed downstream. As a consequence, when a response is returned, + * updates are not immediately manifested in the + * {@link google.cloud.retail.v2beta.Product|Product} queried by + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * + * Local inventory information can only be modified using this method. + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct} + * has no effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please enable Retail Search on Cloud Console before using this feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * @param {number[]} request.localInventories + * Required. A list of inventory information at difference places. Each place + * is identified by its place ID. At most 3000 inventories are allowed per + * request. + * @param {google.protobuf.FieldMask} request.addMask + * Indicates which inventory fields in the provided list of + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory} to update. The + * field is updated to the provided value. + * + * If a field is set while the place does not have a previous local inventory, + * the local inventory at that store is created. + * + * If a field is set while the value of that field is not provided, the + * original field value, if it exists, is deleted. + * + * If the mask is not set or set with empty paths, all inventory fields will + * be updated. + * + * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + * is returned and the entire update will be ignored. + * @param {google.protobuf.Timestamp} request.addTime + * The time when the inventory updates are issued. Used to prevent + * out-of-order updates on local inventory fields. If not provided, the + * internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} is + * not found, the local inventory will still be processed and retained for at + * most 1 day and processed once the + * {@link google.cloud.retail.v2beta.Product|Product} is created. If set to false, + * a NOT_FOUND error is returned if the + * {@link google.cloud.retail.v2beta.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/product_service.add_local_inventories.js + * region_tag:retail_v2beta_generated_ProductService_AddLocalInventories_async + */ + addLocalInventories( + request?: protos.google.cloud.retail.v2beta.IAddLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + addLocalInventories( + request: protos.google.cloud.retail.v2beta.IAddLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request: protos.google.cloud.retail.v2beta.IAddLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + addLocalInventories( + request?: protos.google.cloud.retail.v2beta.IAddLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.addLocalInventories(request, options, callback); + } + /** + * Check the status of the long running operation returned by `addLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/product_service.add_local_inventories.js + * region_tag:retail_v2beta_generated_ProductService_AddLocalInventories_async + */ + async checkAddLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.AddLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.addLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.AddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.AddLocalInventoriesMetadata + >; + } + /** + * Remove local inventory information for a + * {@link google.cloud.retail.v2beta.Product|Product} at a list of places at a + * removal timestamp. + * + * This process is asynchronous. If the request is valid, the removal will be + * enqueued and processed downstream. As a consequence, when a response is + * returned, removals are not immediately manifested in the + * {@link google.cloud.retail.v2beta.Product|Product} queried by + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * + * Local inventory information can only be removed using this method. + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} + * and + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct} + * has no effect on local inventories. + * + * This feature is only available for users who have Retail Search enabled. + * Please enable Retail Search on Cloud Console before using this feature. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.product + * Required. Full resource name of + * {@link google.cloud.retail.v2beta.Product|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 + * {@link google.cloud.retail.v2beta.Product|Product}, regardless of whether or not + * it exists, a PERMISSION_DENIED error is returned. + * @param {string[]} request.placeIds + * Required. A list of place IDs to have their inventory deleted. + * At most 3000 place IDs are allowed per request. + * @param {google.protobuf.Timestamp} request.removeTime + * The time when the inventory deletions are issued. Used to prevent + * out-of-order updates and deletions on local inventory fields. If not + * provided, the internal system time will be used. + * @param {boolean} request.allowMissing + * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} is + * not found, the local inventory removal request will still be processed and + * retained for at most 1 day and processed once the + * {@link google.cloud.retail.v2beta.Product|Product} is created. If set to false, + * a NOT_FOUND error is returned if the + * {@link google.cloud.retail.v2beta.Product|Product} is not found. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/product_service.remove_local_inventories.js + * region_tag:retail_v2beta_generated_ProductService_RemoveLocalInventories_async + */ + removeLocalInventories( + request?: protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + removeLocalInventories( + request: protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request: protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + removeLocalInventories( + request?: protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + product: request.product || '', + }); + this.initialize(); + return this.innerApiCalls.removeLocalInventories( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `removeLocalInventories()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/product_service.remove_local_inventories.js + * region_tag:retail_v2beta_generated_ProductService_RemoveLocalInventories_async + */ + async checkRemoveLocalInventoriesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.removeLocalInventories, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata + >; + } /** * Gets a list of {@link google.cloud.retail.v2beta.Product|Product}s. * @@ -2041,6 +2462,61 @@ export class ProductServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -2157,6 +2633,128 @@ export class ProductServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -2238,6 +2836,77 @@ export class ProductServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json index d4f16440baf..459b579d7a8 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/product_service_client_config.json @@ -82,6 +82,16 @@ "timeout_millis": 30000, "retry_codes_name": "idempotent", "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "AddLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "RemoveLocalInventories": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" } } } diff --git a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json index 4ec26e01ef2..7cee73e6f3f 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index d48e22859a0..69ca63706c3 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -44,8 +44,7 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2beta */ @@ -168,15 +167,27 @@ export class SearchServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -326,14 +337,13 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -390,6 +400,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -413,11 +426,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -437,11 +450,13 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} * {@link google.cloud.retail.v2beta.Product|Product}s attributes, * {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo} or - * {@link |LocalInventory}s attributes. The attributes from all the matching + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory}s attributes. + * The attributes from all the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s or {@link |LocalInventory}s are - * merged and de-duplicated. Notice that rollup attributes will lead to extra - * query latency. Maximum number of keys is 30. + * {@link google.cloud.retail.v2beta.Product|Product}s or + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory}s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -516,6 +531,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2beta.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -602,7 +619,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -659,6 +676,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -682,11 +702,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -706,11 +726,13 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} * {@link google.cloud.retail.v2beta.Product|Product}s attributes, * {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo} or - * {@link |LocalInventory}s attributes. The attributes from all the matching + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory}s attributes. + * The attributes from all the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s or {@link |LocalInventory}s are - * merged and de-duplicated. Notice that rollup attributes will lead to extra - * query latency. Maximum number of keys is 30. + * {@link google.cloud.retail.v2beta.Product|Product}s or + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory}s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -785,6 +807,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2beta.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -827,7 +851,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -884,6 +908,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -907,11 +934,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2beta.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -931,11 +958,13 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} * {@link google.cloud.retail.v2beta.Product|Product}s attributes, * {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo} or - * {@link |LocalInventory}s attributes. The attributes from all the matching + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory}s attributes. + * The attributes from all the matching * {@link google.cloud.retail.v2beta.Product.Type.VARIANT|variant} - * {@link google.cloud.retail.v2beta.Product|Product}s or {@link |LocalInventory}s are - * merged and de-duplicated. Notice that rollup attributes will lead to extra - * query latency. Maximum number of keys is 30. + * {@link google.cloud.retail.v2beta.Product|Product}s or + * {@link google.cloud.retail.v2beta.LocalInventory|LocalInventory}s are merged and + * de-duplicated. Notice that rollup attributes will lead to extra query + * latency. Maximum number of keys is 30. * * For {@link google.cloud.retail.v2beta.FulfillmentInfo|FulfillmentInfo}, a * fulfillment type and a fulfillment ID must be provided in the format of @@ -1010,6 +1039,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2beta.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1048,6 +1079,61 @@ export class SearchServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -1164,6 +1250,128 @@ export class SearchServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1245,6 +1453,77 @@ export class SearchServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json index 4ec26e01ef2..7cee73e6f3f 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts new file mode 100644 index 00000000000..2695705160d --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts @@ -0,0 +1,1520 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/serving_config_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './serving_config_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for modifying ServingConfig. + * @class + * @memberof v2beta + */ +export class ServingConfigServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + servingConfigServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ServingConfigServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ServingConfigServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServingConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'servingConfigs' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.ServingConfigService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.servingConfigServiceStub) { + return this.servingConfigServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.ServingConfigService. + this.servingConfigServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.ServingConfigService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.ServingConfigService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const servingConfigServiceStubMethods = [ + 'createServingConfig', + 'deleteServingConfig', + 'updateServingConfig', + 'getServingConfig', + 'listServingConfigs', + 'addControl', + 'removeControl', + ]; + for (const methodName of servingConfigServiceStubMethods) { + const callPromise = this.servingConfigServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.servingConfigServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a ServingConfig. + * + * A maximum of 100 {@link google.cloud.retail.v2beta.ServingConfig|ServingConfig}s + * are allowed in a {@link google.cloud.retail.v2beta.Catalog|Catalog}, otherwise + * a FAILED_PRECONDITION error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full resource name of parent. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {google.cloud.retail.v2beta.ServingConfig} request.servingConfig + * Required. The ServingConfig to create. + * @param {string} request.servingConfigId + * Required. The ID to use for the ServingConfig, which will become the final + * component of the ServingConfig's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-_/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.create_serving_config.js + * region_tag:retail_v2beta_generated_ServingConfigService_CreateServingConfig_async + */ + createServingConfig( + request?: protos.google.cloud.retail.v2beta.ICreateServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.ICreateServingConfigRequest | undefined, + {} | undefined + ] + >; + createServingConfig( + request: protos.google.cloud.retail.v2beta.ICreateServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServingConfig( + request: protos.google.cloud.retail.v2beta.ICreateServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServingConfig( + request?: protos.google.cloud.retail.v2beta.ICreateServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.ICreateServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createServingConfig(request, options, callback); + } + /** + * Deletes a ServingConfig. + * + * Returns a NotFound error if the ServingConfig does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.delete_serving_config.js + * region_tag:retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async + */ + deleteServingConfig( + request?: protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest | undefined, + {} | undefined + ] + >; + deleteServingConfig( + request: protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServingConfig( + request: protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServingConfig( + request?: protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteServingConfig(request, options, callback); + } + /** + * Updates a ServingConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.ServingConfig} request.servingConfig + * Required. The ServingConfig to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2beta.ServingConfig|ServingConfig} to update. The + * following are NOT supported: + * + * * {@link google.cloud.retail.v2beta.ServingConfig.name|ServingConfig.name} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.update_serving_config.js + * region_tag:retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async + */ + updateServingConfig( + request?: protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest | undefined, + {} | undefined + ] + >; + updateServingConfig( + request: protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServingConfig( + request: protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServingConfig( + request?: protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IUpdateServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'serving_config.name': request.servingConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateServingConfig(request, options, callback); + } + /** + * Gets a ServingConfig. + * + * Returns a NotFound error if the ServingConfig does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.get_serving_config.js + * region_tag:retail_v2beta_generated_ServingConfigService_GetServingConfig_async + */ + getServingConfig( + request?: protos.google.cloud.retail.v2beta.IGetServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IGetServingConfigRequest | undefined, + {} | undefined + ] + >; + getServingConfig( + request: protos.google.cloud.retail.v2beta.IGetServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getServingConfig( + request: protos.google.cloud.retail.v2beta.IGetServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getServingConfig( + request?: protos.google.cloud.retail.v2beta.IGetServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IGetServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getServingConfig(request, options, callback); + } + /** + * Enables a Control on the specified ServingConfig. + * The control is added in the last position of the list of controls + * it belongs to (e.g. if it's a facet spec control it will be applied + * in the last position of servingConfig.facetSpecIds) + * Returns a ALREADY_EXISTS error if the control has already been applied. + * Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.servingConfig + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {string} request.controlId + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config - if id is not found a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.add_control.js + * region_tag:retail_v2beta_generated_ServingConfigService_AddControl_async + */ + addControl( + request?: protos.google.cloud.retail.v2beta.IAddControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IAddControlRequest | undefined, + {} | undefined + ] + >; + addControl( + request: protos.google.cloud.retail.v2beta.IAddControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): void; + addControl( + request: protos.google.cloud.retail.v2beta.IAddControlRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): void; + addControl( + request?: protos.google.cloud.retail.v2beta.IAddControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IAddControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IAddControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + serving_config: request.servingConfig || '', + }); + this.initialize(); + return this.innerApiCalls.addControl(request, options, callback); + } + /** + * Disables a Control on the specified ServingConfig. + * The control is removed from the ServingConfig. + * Returns a NOT_FOUND error if the Control is not enabled for the + * ServingConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.servingConfig + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {string} request.controlId + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.remove_control.js + * region_tag:retail_v2beta_generated_ServingConfigService_RemoveControl_async + */ + removeControl( + request?: protos.google.cloud.retail.v2beta.IRemoveControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IRemoveControlRequest | undefined, + {} | undefined + ] + >; + removeControl( + request: protos.google.cloud.retail.v2beta.IRemoveControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + removeControl( + request: protos.google.cloud.retail.v2beta.IRemoveControlRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + removeControl( + request?: protos.google.cloud.retail.v2beta.IRemoveControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IServingConfig, + | protos.google.cloud.retail.v2beta.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig, + protos.google.cloud.retail.v2beta.IRemoveControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + serving_config: request.servingConfig || '', + }); + this.initialize(); + return this.innerApiCalls.removeControl(request, options, callback); + } + + /** + * Lists all ServingConfigs linked to this catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServingConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServingConfigs( + request?: protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig[], + protos.google.cloud.retail.v2beta.IListServingConfigsRequest | null, + protos.google.cloud.retail.v2beta.IListServingConfigsResponse + ] + >; + listServingConfigs( + request: protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + | protos.google.cloud.retail.v2beta.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IServingConfig + > + ): void; + listServingConfigs( + request: protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + | protos.google.cloud.retail.v2beta.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IServingConfig + > + ): void; + listServingConfigs( + request?: protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + | protos.google.cloud.retail.v2beta.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IServingConfig + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + | protos.google.cloud.retail.v2beta.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IServingConfig + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IServingConfig[], + protos.google.cloud.retail.v2beta.IListServingConfigsRequest | null, + protos.google.cloud.retail.v2beta.IListServingConfigsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listServingConfigs(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServingConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServingConfigsStream( + request?: protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listServingConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServingConfigs.createStream( + this.innerApiCalls.listServingConfigs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listServingConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ServingConfig]{@link google.cloud.retail.v2beta.ServingConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2beta/serving_config_service.list_serving_configs.js + * region_tag:retail_v2beta_generated_ServingConfigService_ListServingConfigs_async + */ + listServingConfigsAsync( + request?: protos.google.cloud.retail.v2beta.IListServingConfigsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listServingConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServingConfigs.asyncIterate( + this.innerApiCalls['listServingConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.servingConfigServiceStub && !this._terminated) { + return this.servingConfigServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client_config.json b/packages/google-cloud-retail/src/v2beta/serving_config_service_client_config.json new file mode 100644 index 00000000000..2d17b5273c2 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.ServingConfigService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServingConfigs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RemoveControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json new file mode 100644 index 00000000000..7cee73e6f3f --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json @@ -0,0 +1,20 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index b927ad9af4e..68813baf6ad 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -162,12 +162,24 @@ export class UserEventServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -879,13 +891,14 @@ export class UserEventServiceClient { >; } /** - * Triggers a user event rejoin operation with latest product catalog. Events + * Starts 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 + * serving. This method can be used to start 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. + * correct events joined with the wrong product catalog. A rejoin operation + * can take hours or days to complete. * * @param {Object} request * The request object that will be sent. @@ -1031,6 +1044,61 @@ export class UserEventServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -1080,6 +1148,128 @@ export class UserEventServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1161,6 +1351,77 @@ export class UserEventServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json index 4ec26e01ef2..7cee73e6f3f 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2beta/catalog_service.proto", "../../protos/google/cloud/retail/v2beta/common.proto", "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", "../../protos/google/cloud/retail/v2beta/purge_config.proto", "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", "../../protos/google/cloud/retail/v2beta/user_event.proto", "../../protos/google/cloud/retail/v2beta/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js index 986ce62b21c..2416074dc50 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js @@ -22,9 +22,11 @@ const retail = require('@google-cloud/retail'); function main() { const catalogServiceClient = new retail.CatalogServiceClient(); const completionServiceClient = new retail.CompletionServiceClient(); + const controlServiceClient = new retail.ControlServiceClient(); const predictionServiceClient = new retail.PredictionServiceClient(); const productServiceClient = new retail.ProductServiceClient(); const searchServiceClient = new retail.SearchServiceClient(); + const servingConfigServiceClient = new retail.ServingConfigServiceClient(); const userEventServiceClient = new retail.UserEventServiceClient(); } diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts index 4dfeab32f92..d913e8282d1 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts @@ -19,9 +19,11 @@ import { CatalogServiceClient, CompletionServiceClient, + ControlServiceClient, PredictionServiceClient, ProductServiceClient, SearchServiceClient, + ServingConfigServiceClient, UserEventServiceClient, } from '@google-cloud/retail'; @@ -32,6 +34,9 @@ function doStuffWithCatalogServiceClient(client: CatalogServiceClient) { function doStuffWithCompletionServiceClient(client: CompletionServiceClient) { client.close(); } +function doStuffWithControlServiceClient(client: ControlServiceClient) { + client.close(); +} function doStuffWithPredictionServiceClient(client: PredictionServiceClient) { client.close(); } @@ -41,6 +46,11 @@ function doStuffWithProductServiceClient(client: ProductServiceClient) { function doStuffWithSearchServiceClient(client: SearchServiceClient) { client.close(); } +function doStuffWithServingConfigServiceClient( + client: ServingConfigServiceClient +) { + client.close(); +} function doStuffWithUserEventServiceClient(client: UserEventServiceClient) { client.close(); } @@ -53,6 +63,9 @@ function main() { const completionServiceClient = new CompletionServiceClient(); doStuffWithCompletionServiceClient(completionServiceClient); // check that the client instance can be created + const controlServiceClient = new ControlServiceClient(); + doStuffWithControlServiceClient(controlServiceClient); + // check that the client instance can be created const predictionServiceClient = new PredictionServiceClient(); doStuffWithPredictionServiceClient(predictionServiceClient); // check that the client instance can be created @@ -62,6 +75,9 @@ function main() { const searchServiceClient = new SearchServiceClient(); doStuffWithSearchServiceClient(searchServiceClient); // check that the client instance can be created + const servingConfigServiceClient = new ServingConfigServiceClient(); + doStuffWithServingConfigServiceClient(servingConfigServiceClient); + // check that the client instance can be created const userEventServiceClient = new UserEventServiceClient(); doStuffWithUserEventServiceClient(userEventServiceClient); } diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 0d44d0303bf..9ad1be17b7c 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -592,6 +592,927 @@ describe('v2beta.CatalogServiceClient', () => { }); }); + describe('getCompletionConfig', () => { + it('invokes getCompletionConfig without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompletionConfig() + ); + client.innerApiCalls.getCompletionConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getCompletionConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getCompletionConfig without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompletionConfig() + ); + client.innerApiCalls.getCompletionConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCompletionConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.ICompletionConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getCompletionConfig with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCompletionConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getCompletionConfig(request), expectedError); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getCompletionConfig with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCompletionConfig(request), expectedError); + }); + }); + + describe('updateCompletionConfig', () => { + it('invokes updateCompletionConfig without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompletionConfig() + ); + client.innerApiCalls.updateCompletionConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateCompletionConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCompletionConfig without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CompletionConfig() + ); + client.innerApiCalls.updateCompletionConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCompletionConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.ICompletionConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateCompletionConfig with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCompletionConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateCompletionConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCompletionConfig with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateCompletionConfig(request), + expectedError + ); + }); + }); + + describe('getAttributesConfig', () => { + it('invokes getAttributesConfig without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.getAttributesConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getAttributesConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAttributesConfig without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.getAttributesConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAttributesConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getAttributesConfig with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAttributesConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAttributesConfig(request), expectedError); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAttributesConfig with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAttributesConfig(request), expectedError); + }); + }); + + describe('updateAttributesConfig', () => { + it('invokes updateAttributesConfig without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.updateAttributesConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateAttributesConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAttributesConfig without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.updateAttributesConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAttributesConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateAttributesConfig with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAttributesConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateAttributesConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAttributesConfig with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateAttributesConfig(request), + expectedError + ); + }); + }); + + describe('addCatalogAttribute', () => { + it('invokes addCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.addCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + }); + }); + + describe('removeCatalogAttribute', () => { + it('invokes removeCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.removeCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); + }); + }); + + describe('replaceCatalogAttribute', () => { + it('invokes replaceCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.replaceCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.replaceCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes replaceCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.replaceCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes replaceCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.replaceCatalogAttribute(request), + expectedError + ); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes replaceCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.replaceCatalogAttribute(request), + expectedError + ); + }); + }); + describe('listCatalogs', () => { it('invokes listCatalogs without error', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ @@ -876,6 +1797,73 @@ describe('v2beta.CatalogServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -1016,6 +2004,149 @@ describe('v2beta.CatalogServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('location', () => { const fakePath = '/rendered/path/location'; const expectedParameters = { @@ -1152,5 +2283,81 @@ describe('v2beta.CatalogServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index e3bed3a8a4a..f987631a969 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -520,6 +520,75 @@ describe('v2beta.CompletionServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -586,6 +655,153 @@ describe('v2beta.CompletionServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -675,5 +891,83 @@ describe('v2beta.CompletionServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts new file mode 100644 index 00000000000..2fb4e17b608 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts @@ -0,0 +1,1443 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as controlserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.ControlServiceClient', () => { + it('has servicePath', () => { + const servicePath = + controlserviceModule.v2beta.ControlServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + controlserviceModule.v2beta.ControlServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = controlserviceModule.v2beta.ControlServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new controlserviceModule.v2beta.ControlServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + await client.initialize(); + assert(client.controlServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.controlServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createControl', () => { + it('invokes createControl without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Control() + ); + client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); + const [response] = await client.createControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createControl without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Control() + ); + client.innerApiCalls.createControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createControl with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createControl(request), expectedError); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createControl with closed client', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateControlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createControl(request), expectedError); + }); + }); + + describe('deleteControl', () => { + it('invokes deleteControl without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); + const [response] = await client.deleteControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteControl without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteControl( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteControl with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteControl(request), expectedError); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteControl with closed client', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteControlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteControl(request), expectedError); + }); + }); + + describe('updateControl', () => { + it('invokes updateControl without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Control() + ); + client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); + const [response] = await client.updateControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateControl without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Control() + ); + client.innerApiCalls.updateControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateControl with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateControl(request), expectedError); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateControl with closed client', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateControl(request), expectedError); + }); + }); + + describe('getControl', () => { + it('invokes getControl without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Control() + ); + client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); + const [response] = await client.getControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getControl without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Control() + ); + client.innerApiCalls.getControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getControl with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getControl(request), expectedError); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getControl with closed client', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetControlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getControl(request), expectedError); + }); + }); + + describe('listControls', () => { + it('invokes listControls without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + ]; + client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); + const [response] = await client.listControls(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listControls without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + ]; + client.innerApiCalls.listControls = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listControls( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IControl[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listControls with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listControls = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listControls(request), expectedError); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listControlsStream without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + ]; + client.descriptors.page.listControls.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listControlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Control[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Control) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listControls, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listControlsStream with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listControls.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listControlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Control[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Control) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listControls, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listControls without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), + ]; + client.descriptors.page.listControls.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2beta.IControl[] = []; + const iterable = client.listControlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listControls with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listControls.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listControlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2beta.IControl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index a18527b3f52..cfb1b96bb4c 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -279,6 +279,75 @@ describe('v2beta.PredictionServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -345,6 +414,153 @@ describe('v2beta.PredictionServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -434,5 +650,83 @@ describe('v2beta.PredictionServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 7b44c9e06f3..5ec737f973f 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -1530,6 +1530,397 @@ describe('v2.ProductServiceClient', () => { }); }); + describe('addLocalInventories', () => { + it('invokes addLocalInventories without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2.IAddLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addLocalInventories with call error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addLocalInventories(request), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeLocalInventories', () => { + it('invokes removeLocalInventories without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2.IRemoveLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeLocalInventories with call error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeLocalInventories(request), + expectedError + ); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listProducts', () => { it('invokes listProducts without error', async () => { const client = new productserviceModule.v2.ProductServiceClient({ diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index e7d63680517..9c3fe63714f 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -1530,6 +1530,397 @@ describe('v2beta.ProductServiceClient', () => { }); }); + describe('addLocalInventories', () => { + it('invokes addLocalInventories without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.addLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IAddLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IAddLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addLocalInventories with call error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.addLocalInventories(request), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.addLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.addLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkAddLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAddLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkAddLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeLocalInventories', () => { + it('invokes removeLocalInventories without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeLocalInventories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.removeLocalInventories = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeLocalInventories( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesResponse, + protos.google.cloud.retail.v2beta.IRemoveLocalInventoriesMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeLocalInventories with call error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeLocalInventories(request), + expectedError + ); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeLocalInventories with LRO error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() + ); + request.product = ''; + const expectedHeaderRequestParams = 'product='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeLocalInventories = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.removeLocalInventories(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.removeLocalInventories as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRemoveLocalInventoriesProgress without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveLocalInventoriesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRemoveLocalInventoriesProgress with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkRemoveLocalInventoriesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listProducts', () => { it('invokes listProducts without error', async () => { const client = new productserviceModule.v2beta.ProductServiceClient({ @@ -1814,6 +2205,73 @@ describe('v2beta.ProductServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -1954,6 +2412,149 @@ describe('v2beta.ProductServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -2041,5 +2642,81 @@ describe('v2beta.ProductServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index b325ad1e2de..df54dc501ad 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -521,6 +521,73 @@ describe('v2beta.SearchServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -661,6 +728,149 @@ describe('v2beta.SearchServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -748,5 +958,81 @@ describe('v2beta.SearchServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts new file mode 100644 index 00000000000..dbad34bbb43 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts @@ -0,0 +1,1767 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as servingconfigserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.ServingConfigServiceClient', () => { + it('has servicePath', () => { + const servicePath = + servingconfigserviceModule.v2beta.ServingConfigServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + servingconfigserviceModule.v2beta.ServingConfigServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + servingconfigserviceModule.v2beta.ServingConfigServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + await client.initialize(); + assert(client.servingConfigServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.servingConfigServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createServingConfig', () => { + it('invokes createServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.createServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.createServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.createServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createServingConfig(request), expectedError); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createServingConfig(request), expectedError); + }); + }); + + describe('deleteServingConfig', () => { + it('invokes deleteServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteServingConfig(request), expectedError); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteServingConfig(request), expectedError); + }); + }); + + describe('updateServingConfig', () => { + it('invokes updateServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.updateServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.updateServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateServingConfig(request), expectedError); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateServingConfig(request), expectedError); + }); + }); + + describe('getServingConfig', () => { + it('invokes getServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.getServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getServingConfig(request), expectedError); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.GetServingConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServingConfig(request), expectedError); + }); + }); + + describe('addControl', () => { + it('invokes addControl without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); + const [response] = await client.addControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addControl without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.addControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addControl with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addControl(request), expectedError); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addControl with closed client', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddControlRequest() + ); + request.servingConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addControl(request), expectedError); + }); + }); + + describe('removeControl', () => { + it('invokes removeControl without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); + const [response] = await client.removeControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeControl without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ); + client.innerApiCalls.removeControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeControl with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.removeControl(request), expectedError); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeControl with closed client', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.removeControl(request), expectedError); + }); + }); + + describe('listServingConfigs', () => { + it('invokes listServingConfigs without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + ]; + client.innerApiCalls.listServingConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listServingConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServingConfigs without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + ]; + client.innerApiCalls.listServingConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServingConfigs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IServingConfig[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listServingConfigs with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listServingConfigs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listServingConfigs(request), expectedError); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServingConfigsStream without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + ]; + client.descriptors.page.listServingConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServingConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.ServingConfig[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.ServingConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServingConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listServingConfigsStream with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServingConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServingConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.ServingConfig[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.ServingConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServingConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServingConfigs without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2beta.ServingConfig() + ), + ]; + client.descriptors.page.listServingConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2beta.IServingConfig[] = []; + const iterable = client.listServingConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServingConfigs with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServingConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServingConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2beta.IServingConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index c460e94e213..610c49176ae 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -1011,6 +1011,73 @@ describe('v2beta.UserEventServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -1075,6 +1142,149 @@ describe('v2beta.UserEventServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -1162,5 +1372,81 @@ describe('v2beta.UserEventServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); From e984a3b2b0578f2908d5dd7befadb47fdb04fb0e Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 11:36:27 -0700 Subject: [PATCH 074/103] chore(main): release 1.7.0 (#161) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index c9c994efa98..f80f6a417df 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.7.0](https://github.com/googleapis/nodejs-retail/compare/v1.6.1...v1.7.0) (2022-04-01) + + +### Features + +* users can skip validation, search personalization, return ids, and more; docs: suggest search users to not send IP, deprecate request_id, and more ([#160](https://github.com/googleapis/nodejs-retail/issues/160)) ([c793285](https://github.com/googleapis/nodejs-retail/commit/c7932857fc2326971041564094bb4b75802fc741)) + ### [1.6.1](https://github.com/googleapis/nodejs-retail/compare/v1.6.0...v1.6.1) (2022-03-15) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 80897da084e..7e71aa2e6d2 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.6.1", + "version": "1.7.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 909a04fcc73..ebb5a52d186 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.6.1", + "@google-cloud/retail": "^1.7.0", "@google-cloud/bigquery": "^5.9.2", "@google-cloud/storage": "^5.16.1" }, From 98310ed58ed216e766e6aefd4374ef520d8ea629 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Apr 2022 17:30:12 +0000 Subject: [PATCH 075/103] feat: support batch products purge (v2alpha) (#167) - [ ] Regenerate this pull request now. feat: users cannot switch to empty default branch unless force override (v2alpha) feat: allow search users to skip validation for invalid boost specs (v2alpha) feat: support search personalization (v2alpha) feat: search returns applied control ids in the response (v2alpha) docs: users can self enroll retail search feature on cloud console (v2alpha) docs: suggest search users not to send IP and use hashed user id (v2alpha) docs: deprecate request_id in ImportProductsRequest (v2alpha) docs: deprecate search dynamic_facet_spec and suggest to config on cloud console (v2alpha) docs: keep the API doc up-to-date with recent changes (v2alpha) PiperOrigin-RevId: 440123036 Source-Link: https://github.com/googleapis/googleapis/commit/bc9955018a67cc0f3ee610ba043fedb7d42070bb Source-Link: https://github.com/googleapis/googleapis-gen/commit/a0e1d6515128722c8c1621387eab378186122798 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTBlMWQ2NTE1MTI4NzIyYzhjMTYyMTM4N2VhYjM3ODE4NjEyMjc5OCJ9 --- .../google/cloud/retail/v2alpha/catalog.proto | 231 +- .../retail/v2alpha/catalog_service.proto | 251 +- .../google/cloud/retail/v2alpha/common.proto | 106 +- .../retail/v2alpha/completion_service.proto | 47 +- .../google/cloud/retail/v2alpha/control.proto | 92 + .../retail/v2alpha/control_service.proto | 184 + .../cloud/retail/v2alpha/export_config.proto | 1 - .../cloud/retail/v2alpha/import_config.proto | 48 +- .../retail/v2alpha/prediction_service.proto | 9 +- .../google/cloud/retail/v2alpha/product.proto | 16 +- .../retail/v2alpha/product_service.proto | 65 +- .../cloud/retail/v2alpha/promotion.proto | 40 + .../cloud/retail/v2alpha/purge_config.proto | 91 +- .../cloud/retail/v2alpha/search_service.proto | 58 +- .../cloud/retail/v2alpha/serving_config.proto | 247 + .../v2alpha/serving_config_service.proto | 241 + .../cloud/retail/v2alpha/user_event.proto | 16 +- .../retail/v2alpha/user_event_service.proto | 9 +- .../google-cloud-retail/protos/protos.d.ts | 10075 ++-- packages/google-cloud-retail/protos/protos.js | 38206 ++++++++++------ .../google-cloud-retail/protos/protos.json | 2152 +- .../catalog_service.add_catalog_attribute.js | 65 + .../catalog_service.get_attributes_config.js | 59 + .../catalog_service.get_completion_config.js | 59 + ...atalog_service.remove_catalog_attribute.js | 65 + ...talog_service.replace_catalog_attribute.js | 73 + .../catalog_service.set_default_branch.js | 9 + ...atalog_service.update_attributes_config.js | 67 + ...atalog_service.update_completion_config.js | 75 + .../completion_service.complete_query.js | 20 +- .../v2alpha/control_service.create_control.js | 72 + .../v2alpha/control_service.delete_control.js | 59 + .../v2alpha/control_service.get_control.js | 59 + .../v2alpha/control_service.list_controls.js | 79 + .../v2alpha/control_service.update_control.js | 66 + .../v2alpha/prediction_service.predict.js | 9 +- .../product_service.import_products.js | 11 - .../v2alpha/product_service.purge_products.js | 101 + .../v2alpha/product_service.set_inventory.js | 14 + .../v2alpha/search_service.search.js | 15 +- .../serving_config_service.add_control.js | 65 + ...ng_config_service.create_serving_config.js | 72 + ...ng_config_service.delete_serving_config.js | 59 + ...rving_config_service.get_serving_config.js | 59 + ...ing_config_service.list_serving_configs.js | 72 + .../serving_config_service.remove_control.js | 65 + ...ng_config_service.update_serving_config.js | 66 + ..._metadata.google.cloud.retail.v2alpha.json | 940 +- .../src/v2alpha/catalog_service_client.ts | 1192 +- .../catalog_service_client_config.json | 35 + .../v2alpha/catalog_service_proto_list.json | 5 + .../src/v2alpha/completion_service_client.ts | 295 +- .../completion_service_proto_list.json | 5 + .../src/v2alpha/control_service_client.ts | 1340 + .../control_service_client_config.json | 46 + .../v2alpha/control_service_proto_list.json | 20 + .../src/v2alpha/gapic_metadata.json | 236 + .../google-cloud-retail/src/v2alpha/index.ts | 2 + .../src/v2alpha/prediction_service_client.ts | 269 +- .../prediction_service_proto_list.json | 5 + .../src/v2alpha/product_service_client.ts | 517 +- .../product_service_client_config.json | 5 + .../v2alpha/product_service_proto_list.json | 5 + .../src/v2alpha/search_service_client.ts | 305 +- .../v2alpha/search_service_proto_list.json | 5 + .../v2alpha/serving_config_service_client.ts | 1540 + .../serving_config_service_client_config.json | 54 + .../serving_config_service_proto_list.json | 20 + .../src/v2alpha/user_event_service_client.ts | 267 +- .../user_event_service_proto_list.json | 5 + .../test/gapic_catalog_service_v2alpha.ts | 1207 + .../test/gapic_completion_service_v2alpha.ts | 290 + .../test/gapic_control_service_v2alpha.ts | 1443 + .../test/gapic_prediction_service_v2alpha.ts | 290 + .../test/gapic_product_service_v2alpha.ts | 480 + .../test/gapic_search_service_v2alpha.ts | 286 + .../gapic_serving_config_service_v2alpha.ts | 1769 + .../test/gapic_user_event_service_v2alpha.ts | 286 + 78 files changed, 48073 insertions(+), 18711 deletions(-) create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/promotion.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js create mode 100644 packages/google-cloud-retail/src/v2alpha/control_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/control_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/serving_config_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json create mode 100644 packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts create mode 100644 packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index 7cb4da0eca6..8dcb23f60d5 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/common.proto"; @@ -85,6 +84,231 @@ message ProductLevelConfig { string merchant_center_product_id_field = 2; } +// Catalog level attribute config for an attribute. For example, if customers +// want to enable/disable facet for a specific attribute. +message CatalogAttribute { + // The type of an attribute. + enum AttributeType { + // The type of the attribute is unknown. + // + // Used when type cannot be derived from attribute that is not + // [in_use][google.cloud.retail.v2alpha.CatalogAttribute.in_use]. + UNKNOWN = 0; + + // Textual attribute. + TEXTUAL = 1; + + // Numerical attribute. + NUMERICAL = 2; + } + + // The status of the indexable option of a catalog attribute. + enum IndexableOption { + // Value used when unset. Defaults to + // [INDEXABLE_ENABLED][google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED]. + INDEXABLE_OPTION_UNSPECIFIED = 0; + + // Indexable option enabled for an attribute. + INDEXABLE_ENABLED = 1; + + // Indexable option disabled for an attribute. + INDEXABLE_DISABLED = 2; + } + + // The status of the dynamic facetable option of a catalog attribute. + enum DynamicFacetableOption { + // Value used when unset. Defaults to + // [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED]. + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; + + // Dynamic facetable option enabled for an attribute. + DYNAMIC_FACETABLE_ENABLED = 1; + + // Dynamic facetable option disabled for an attribute. + DYNAMIC_FACETABLE_DISABLED = 2; + } + + // The status of the searchable option of a catalog attribute. + enum SearchableOption { + // Value used when unset. Defaults to + // [SEARCHABLE_DISABLED][google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED]. + SEARCHABLE_OPTION_UNSPECIFIED = 0; + + // Searchable option enabled for an attribute. + SEARCHABLE_ENABLED = 1; + + // Searchable option disabled for an attribute. + SEARCHABLE_DISABLED = 2; + } + + // Required. Attribute name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Indicates whether this attribute has been used by any + // products. `True` if at least one + // [Product][google.cloud.retail.v2alpha.Product] is using this attribute in + // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. + // Otherwise, this field is `False`. + // + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] can be + // pre-loaded by using [AddCatalogAttribute][], [ImportCatalogAttributes][], + // or [UpdateAttributesConfig][] APIs. This field is `False` for pre-loaded + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s. + // + // Only [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s that + // are not in use by products can be deleted. + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s that are + // in use by products cannot be deleted; however, their configuration + // properties will reset to default values upon removal request. + // + // After catalog changes, it takes about 10 minutes for this field to update. + bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of this attribute. This is derived from the attribute + // in [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. + AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values + // are indexed so that it can be filtered, faceted, or boosted in + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. + IndexableOption indexable_option = 5; + + // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic + // facet. Could only be DYNAMIC_FACETABLE_DISABLED if + // [CatalogAttribute.indexable_option][google.cloud.retail.v2alpha.CatalogAttribute.indexable_option] + // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. + DynamicFacetableOption dynamic_facetable_option = 6; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values + // are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. + // + // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values + // will not be searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], + // as there are no text values associated to numerical attributes. + SearchableOption searchable_option = 7; +} + +// Catalog level attribute config. +message AttributesConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/AttributesConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }; + + // Required. Immutable. The fully qualified resource name of the attribute + // config. Format: "projects/*/locations/*/catalogs/*/attributesConfig" + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Enable attribute(s) config at catalog level. + // For example, indexable, dynamic_facetable, or searchable for each + // attribute. + // + // The key is catalog attribute's name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + // + // The maximum number of catalog attributes allowed in a request is 1000. + map catalog_attributes = 2; + + // Output only. The + // [AttributeConfigLevel][google.cloud.retail.v2alpha.AttributeConfigLevel] + // used for this catalog. + AttributeConfigLevel attribute_config_level = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Catalog level autocomplete config for customers to customize autocomplete +// feature's settings. +message CompletionConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/CompletionConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }; + + // Required. Immutable. Fully qualified name + // projects/*/locations/*/catalogs/*/completionConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Specifies the matching order for autocomplete suggestions, e.g., a query + // consisting of 'sh' with 'out-of-order' specified would suggest "women's + // shoes", whereas a query of 'red s' with 'exact-prefix' specified would + // suggest "red shoes". Currently supported values: + // + // * 'out-of-order' + // * 'exact-prefix' + // + // Default value: 'exact-prefix'. + string matching_order = 2; + + // The maximum number of autocomplete suggestions returned per term. The + // maximum allowed max suggestions is 20. Default value is 20. If left unset + // or set to 0, then will fallback to default value. + int32 max_suggestions = 3; + + // The minimum number of characters needed to be typed in order to get + // suggestions. Default value is 2. If left unset or set to 0, then will + // fallback to default value. + int32 min_prefix_length = 4; + + // If set to true, the auto learning function is enabled. Auto learning uses + // user data to generate suggestions using ML techniques. Default value is + // false. Only after enabling auto learning can users use `cloud-retail` + // data in + // [CompleteQueryRequest][google.cloud.retail.v2alpha.CompleteQueryRequest]. + bool auto_learning = 11; + + // Output only. The input config for the import of the source data that + // contains the autocomplete phrases uploaded by the customer. + CompletionDataInputConfig suggestions_input_config = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest suggestion terms + // list import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_suggestions_import_operation = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The input config for the import of the source data that + // contains the / autocomplete denylist phrases uploaded by the customer. + CompletionDataInputConfig denylist_input_config = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. LRO corresponding to the latest denylist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_denylist_import_operation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The input config for the import of the source data that + // contains the autocomplete allowlist phrases uploaded by the customer. + CompletionDataInputConfig allowlist_input_config = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. LRO corresponding to the latest allowlist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_allowlist_import_operation = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + // Represents a link between a Merchant Center account and a branch. // Once a link is established, products from the linked merchant center account // will be streamed to the linked branch. @@ -125,8 +349,9 @@ message MerchantCenterLink { // ISO 639-1. // // This specifies the language of offers in Merchant Center that will be - // accepted. - // If empty no language filtering will be performed. + // accepted. If empty no language filtering will be performed. + // + // Example value: `en`. string language_code = 5; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto index bd7265ac927..6ecab7251c3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto @@ -21,8 +21,6 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/catalog.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -93,10 +91,6 @@ service CatalogService { // (if branch is not explicitly set). // * UserEventService will only join events with products from branch // {newBranch}. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. rpc SetDefaultBranch(SetDefaultBranchRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -109,10 +103,6 @@ service CatalogService { // Get which branch is currently default branch set by // [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] // method under a specified parent catalog. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. rpc GetDefaultBranch(GetDefaultBranchRequest) returns (GetDefaultBranchResponse) { option (google.api.http) = { @@ -120,6 +110,97 @@ service CatalogService { }; option (google.api.method_signature) = "catalog"; } + + // Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]. + rpc GetCompletionConfig(GetCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/completionConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the + // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s. + rpc UpdateCompletionConfig(UpdateCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + patch: "/v2alpha/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}" + body: "completion_config" + }; + option (google.api.method_signature) = "completion_config,update_mask"; + } + + // Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. + rpc GetAttributesConfig(GetAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/attributesConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the + // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. + // + // The catalog attributes in the request will be updated in the catalog, or + // inserted if they do not exist. Existing catalog attributes not included in + // the request will remain unchanged. Attributes that are assigned to + // products, but do not exist at the catalog level, are always included in the + // response. The product attribute is assigned default values for missing + // catalog attribute fields, e.g., searchable and dynamic facetable options. + rpc UpdateAttributesConfig(UpdateAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + patch: "/v2alpha/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}" + body: "attributes_config" + }; + option (google.api.method_signature) = "attributes_config,update_mask"; + } + + // Adds the specified + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the + // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to + // add already exists, an ALREADY_EXISTS error is returned. + rpc AddCatalogAttribute(AddCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute" + body: "*" + }; + } + + // Removes the specified + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the + // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to + // remove does not exist, a NOT_FOUND error is returned. + rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute" + body: "*" + }; + } + + // Replaces the specified + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the + // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by + // updating the catalog attribute with the same + // [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. + // + // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to + // replace does not exist, a NOT_FOUND error is returned. + rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute" + body: "*" + }; + } } // Request for @@ -207,6 +288,10 @@ message SetDefaultBranchRequest { // // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT // error is returned. + // + // If there are no sufficient active products in the targeted branch and + // [force][google.cloud.retail.v2alpha.SetDefaultBranchRequest.force] is not + // set, a FAILED_PRECONDITION error is returned. string branch_id = 2 [ (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } ]; @@ -218,6 +303,11 @@ message SetDefaultBranchRequest { // This field must be a UTF-8 encoded string with a length limit of 1,000 // characters. Otherwise, an INVALID_ARGUMENT error is returned. string note = 3; + + // If set to true, it permits switching to a branch with + // [branch_id][google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id] + // even if it has no sufficient active products. + bool force = 4; } // Request message to show which branch is currently the default branch. @@ -245,3 +335,144 @@ message GetDefaultBranchResponse { // field, when this branch was set as default. string note = 3; } + +// Request for +// [CatalogService.GetCompletionConfig][google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig] +// method. +message GetCompletionConfigRequest { + // Required. Full CompletionConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/CompletionConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig] +// method. +message UpdateCompletionConfigRequest { + // Required. The + // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. + // + // If the caller does not have permission to update the + // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig], then a + // PERMISSION_DENIED error is returned. + // + // If the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to + // update does not exist, a NOT_FOUND error is returned. + CompletionConfig completion_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. + // The following are the only supported fields: + // + // * [CompletionConfig.matching_order][google.cloud.retail.v2alpha.CompletionConfig.matching_order] + // * [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions] + // * [CompletionConfig.min_prefix_length][google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length] + // * [CompletionConfig.auto_learning][google.cloud.retail.v2alpha.CompletionConfig.auto_learning] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.GetAttributesConfig][google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig] +// method. +message GetAttributesConfigRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig] +// method. +message UpdateAttributesConfigRequest { + // Required. The + // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. + AttributesConfig attributes_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. + // The following is the only supported field: + // + // * [AttributesConfig.catalog_attributes][google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute] +// method. +message AddCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute] +// method. +message RemoveCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The attribute name key of the + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove. + string key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute] +// method. +message ReplaceCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The updated + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to update. + // The following are NOT supported: + // + // * [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index 696bd73f2bc..ae33d3f60b4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; @@ -29,6 +28,21 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; option ruby_package = "Google::Cloud::Retail::V2alpha"; +// At which level we offer configuration for attributes. +enum AttributeConfigLevel { + // Value used when unset. Defaults to + // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2alpha.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; + + // At this level, we honor the attribute configurations set in + // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; + + // At this level, we honor the attribute configurations set in + // [CatalogConfig.attribute_configs][google.cloud.retail.v2alpha.CatalogConfig.attribute_configs]. + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; +} + // The type of solution. enum SolutionType { // Default value. @@ -41,6 +55,21 @@ enum SolutionType { SOLUTION_TYPE_SEARCH = 2; } +// The use case of Cloud Retail Search. +enum SearchSolutionUseCase { + // The value when it's unspecified. Defaults to + // [SEARCH][]. + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; + + // Search use case. Expects the traffic has a non-empty + // [query][google.cloud.retail.v2alpha.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_SEARCH = 1; + + // Browse use case. Expects the traffic has an empty + // [query][google.cloud.retail.v2alpha.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_BROWSE = 2; +} + // Metadata that is used to define a condition that triggers an action. // A valid condition must specify at least one of 'query_terms' or // 'products_filter'. If multiple fields are specified, the condition is met if @@ -343,6 +372,9 @@ message CustomAttribute { // The textual values of this custom attribute. For example, `["yellow", // "green"]` when the key is "color". // + // Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is + // returned. + // // Exactly one of [text][google.cloud.retail.v2alpha.CustomAttribute.text] or // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be // set. Otherwise, an INVALID_ARGUMENT error is returned. @@ -356,7 +388,11 @@ message CustomAttribute { // set. Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; - // If true, custom attribute values are searchable by text queries in + // This field will only be used when + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are + // searchable by text queries in // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. // // This field is ignored in a @@ -366,8 +402,11 @@ message CustomAttribute { // is set. Otherwise, a INVALID_ARGUMENT error is returned. optional bool searchable = 3; - // If true, custom attribute values are indexed, so that it can be filtered, - // faceted or boosted in + // This field will only be used when + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are + // indexed, so that it can be filtered, faceted or boosted in // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. // // This field is ignored in a @@ -418,7 +457,10 @@ message FulfillmentInfo { repeated string place_ids = 2; } -// [Product][google.cloud.retail.v2alpha.Product] thumbnail/detail image. +// [Product][google.cloud.retail.v2alpha.Product] image. Recommendations AI and +// Retail Search do not use product images to improve prediction and search +// results. However, product images can be returned in results, and are shown in +// prediction or search previews in the console. message Image { // Required. URI of the image. // @@ -610,19 +652,24 @@ message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in // user, such as a user name. // + // Always use a hashed value for this ID. + // // 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. Required for getting - // [SearchResponse.sponsored_results][google.cloud.retail.v2alpha.SearchResponse.sponsored_results]. - // This field is used to extract location information for personalization. + // 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 + // This should not be set when: + // + // * setting + // [SearchRequest.user_info][google.cloud.retail.v2alpha.SearchRequest.user_info]. + // * using the JavaScript tag in // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent] // or if // [direct_user_request][google.cloud.retail.v2alpha.UserInfo.direct_user_request] @@ -655,20 +702,6 @@ message UserInfo { bool direct_user_request = 4; } -// Promotion information. -message Promotion { - // ID of the promotion. For example, "free gift". - // - // The value value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, - // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Google Merchant Center property - // [promotion](https://support.google.com/merchants/answer/7050148). - string promotion_id = 1; -} - // The inventory information at a place (e.g. a store) identified // by a place ID. message LocalInventory { @@ -693,11 +726,36 @@ message LocalInventory { // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, // key0LikeThis or KEY_1_LIKE_THIS. // * The attribute values must be of the same type (text or number). - // * The max number of values per attribute is 10. + // * Only 1 value is allowed for each attribute. // * For text values, the length limit is 256 UTF-8 characters. // * The attribute does not support search. The `searchable` field should be // unset or set to false. // * The max summed total bytes of custom attribute keys and values per // product is 5MiB. map attributes = 3; + + // Input only. Supported fulfillment types. Valid fulfillment type values + // include commonly used types (such as pickup in store and same day + // delivery), and custom types. Customers have to map custom types to their + // display names before rendering UI. + // + // Supported values: + // + // * "pickup-in-store" + // * "ship-to-store" + // * "same-day-delivery" + // * "next-day-delivery" + // * "custom-type-1" + // * "custom-type-2" + // * "custom-type-3" + // * "custom-type-4" + // * "custom-type-5" + // + // If this field is set to an invalid value other than these, an + // INVALID_ARGUMENT error is returned. + // + // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is + // returned. + repeated string fulfillment_types = 4 + [(google.api.field_behavior) = INPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto index 6cd364e95d3..a91aa618734 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto @@ -36,8 +36,7 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Please submit a form [here](https://cloud.google.com/contact) to contact -// cloud sales if you are interested in using Retail Search. +// Please enable Retail Search on Cloud Console before using this feature. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,8 +45,7 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -56,11 +54,13 @@ service CompletionService { // Bulk import of processed completion dataset. // - // Request processing may be synchronous. Partial updating is not supported. + // Request processing is asynchronous. Partial updating is not supported. + // + // The operation is successfully finished only after the imported suggestions + // are indexed successfully and ready for serving. The process takes hours. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -90,22 +90,21 @@ message CompleteQueryRequest { // The maximum number of allowed characters is 255. string query = 2 [(google.api.field_behavior) = 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 logs in or out of the website. + // Required field. 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 logs in or 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 = 7; - // The list of languages of the query. This is - // the BCP-47 language code, such as "en-US" or "sr-Latn". - // For more information, see - // [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). - // - // The maximum number of allowed characters is 255. - // Only "en-US" is currently supported. + // The language filters applied to the output suggestions. If set, it should + // contain the language of the query. If not set, suggestions are returned + // without considering language restrictions. This is the BCP-47 language + // code, such as "en-US" or "sr-Latn". For more information, see [Tags for + // Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + // number of language codes is 3. repeated string language_codes = 3; // The device type context for completion suggestions. @@ -155,7 +154,11 @@ message CompleteQueryResponse { // The suggestion for the query. string suggestion = 1; - // Additional custom attributes ingested through BigQuery. + // Custom attributes for the suggestion term. + // * For "user-data", the attributes are additional custom attributes + // ingested through BigQuery. + // * For "cloud-retail", the attributes are product attributes generated + // by Cloud Retail. map attributes = 2; } @@ -170,9 +173,9 @@ message CompleteQueryResponse { repeated CompletionResult completion_results = 1; // A unique complete token. This should be included in the - // [SearchRequest][google.cloud.retail.v2alpha.SearchRequest] resulting from - // this completion, which enables accurate attribution of complete model - // performance. + // [UserEvent.completion_detail][google.cloud.retail.v2alpha.UserEvent.completion_detail] + // for search events resulting from this completion, which enables accurate + // attribution of complete model performance. string attribution_token = 2; // Matched recent searches of this user. The maximum number of recent searches diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto new file mode 100644 index 00000000000..4d85015e4d8 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto @@ -0,0 +1,92 @@ +// Copyright 2021 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.v2alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/search_service.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ControlProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Configures dynamic serving time metadata that is used to pre and post +// process search/recommendation model results. +message Control { + option (google.api.resource) = { + type: "retail.googleapis.com/Control" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }; + + // The behavior/type of the control + // + // A behavior/type must be specified on creation. Type cannot be changed once + // specified (e.g. A Rule control will always be a Rule control.). An + // INVALID_ARGUMENT will be returned if either condition is violated. + oneof control { + // A facet specification to perform faceted search. + SearchRequest.FacetSpec facet_spec = 3; + + // A rule control - a condition-action pair. + // Enacts a set action when the condition is triggered. + // For example: Boost "gShoe" when query full matches "Running Shoes". + Rule rule = 4; + } + + // Immutable. Fully qualified name + // projects/*/locations/global/catalogs/*/controls/* + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable control display name. Used in Retail UI. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is thrown. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. List of serving configuration ids that that are associated + // with this control. Note the association is managed via the ServingConfig, + // this is an output only denormalizeed view. Assumed to be in the same + // catalog. + repeated string associated_serving_config_ids = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The solution types that the serving config is used + // for. Currently we support setting only one type of solution at creation + // time. + // + // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. + // If no solution type is provided at creation time, will default to + // SOLUTION_TYPE_SEARCH. + repeated SolutionType solution_types = 6 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Specifies the use case for the control. + // Affects what condition fields can be set. + // Only settable by search controls. + // Will default to SEARCH_SOLUTION_USE_CASE_SEARCH if not specified. + // Currently only allow one search_solution_use_case per control. + repeated SearchSolutionUseCase search_solution_use_case = 7 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto new file mode 100644 index 00000000000..6372aca6a39 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto @@ -0,0 +1,184 @@ +// Copyright 2021 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.v2alpha; + +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/v2alpha/control.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ControlServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Service for modifying Control. +service ControlService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Control. + // + // If the [Control][google.cloud.retail.v2alpha.Control] to create already + // exists, an ALREADY_EXISTS error is returned. + rpc CreateControl(CreateControlRequest) returns (Control) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" + body: "control" + }; + option (google.api.method_signature) = "parent,control,control_id"; + } + + // Deletes a Control. + // + // If the [Control][google.cloud.retail.v2alpha.Control] to delete does not + // exist, a NOT_FOUND error is returned. + rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a Control. + // + // [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different + // oneof field, if so an INVALID_ARGUMENT is returned. If the + // [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a + // NOT_FOUND error is returned. + rpc UpdateControl(UpdateControlRequest) returns (Control) { + option (google.api.http) = { + patch: "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}" + body: "control" + }; + option (google.api.method_signature) = "control,update_mask"; + } + + // Gets a Control. + rpc GetControl(GetControlRequest) returns (Control) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all Controls linked to this catalog. + rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for CreateControl method. +message CreateControlRequest { + // Required. Full resource name of parent catalog. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The Control to create. + Control control = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the Control, which will become the final + // component of the Control's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string control_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateControl method. +message UpdateControlRequest { + // Required. The Control to update. + Control control = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [Control][google.cloud.retail.v2alpha.Control] to update. The following are + // NOT supported: + // + // * [Control.name][google.cloud.retail.v2alpha.Control.name] + // + // If not set or empty, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteControl method. +message DeleteControlRequest { + // Required. The resource name of the Control to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for GetControl method. +message GetControlRequest { + // Required. The resource name of the Control to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for ListControls method. +message ListControlsRequest { + // Required. The catalog resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 50. Max allowed value is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListControls` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2alpha.ListControlsRequest.filter] is unset. + // * List controls that are used in a single ServingConfig: + // 'serving_config = "boosted_home_page_cvr"' + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListControls method. +message ListControlsResponse { + // All the Controls for a given catalog. + repeated Control controls = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto index 6b3934fa2cb..f29c7f9a3fb 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto index b8cc15f89e3..a1fcf240c46 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/product.proto"; @@ -122,8 +121,19 @@ message BigQuerySource { // // * `user_event` (default): One JSON // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. - // * `user_event_ga360`: Using + // * `user_event_ga360`: + // The schema is available here: // https://support.google.com/analytics/answer/3437719. + // * `user_event_ga4`: This feature is in private preview. Please contact the + // support team for importing Google Analytics 4 events. + // The schema is available here: + // https://support.google.com/analytics/answer/7029846. + // + // Supported values for auto-completion imports: + // + // * `suggestions` (default): One JSON completion suggestion per line. + // * `denylist`: One JSON deny suggestion per line. + // * `allowlist`: One JSON allow suggestion per line. string data_schema = 4; } @@ -145,9 +155,9 @@ message UserEventInlineSource { 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 Cloud Storage prefix for import errors. This must be an empty, + // existing Cloud Storage directory. Import errors will be written to + // sharded files in this directory, one per line, as a JSON-encoded // `google.rpc.Status` message. string gcs_prefix = 1; } @@ -167,16 +177,15 @@ message ImportProductsRequest { // Calculates diff and replaces the entire product dataset. Existing // products may be deleted if they are not present in the source location. // - // Can only be while using - // [BigQuerySource][google.cloud.retail.v2alpha.BigQuerySource]. + // Can only be set while using + // [BigQuerySource][google.cloud.retail.v2alpha.BigQuerySource]. And the + // BigQuery dataset must be created in the data location "us (multiple + // regions in United States)", otherwise a PERMISSION_DENIED error is + // thrown. // // Add the IAM permission "BigQuery Data Viewer" for // cloud-retail-customer-data-access@system.gserviceaccount.com before // using this feature otherwise an error is thrown. - // - // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. FULL = 2; } @@ -190,16 +199,8 @@ message ImportProductsRequest { (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } ]; - // Unique identifier provided by client, within the ancestor - // dataset scope. Ensures idempotency and used for request deduplication. - // Server-generated if unspecified. Up to 128 characters long and must match - // the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - // [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata]. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - string request_id = 6; + // Deprecated. This field has no effect. + string request_id = 6 [deprecated = true]; // Required. The desired input location of the data. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -337,9 +338,8 @@ message ImportMetadata { // Count of entries that encountered errors while processing. int64 failure_count = 4; - // Id of the request / operation. This is parroting back the requestId - // that was passed in the request. - string request_id = 5; + // Deprecated. This field is never set. + string request_id = 5 [deprecated = true]; // Pub/Sub topic for receiving notification. If this field is set, // when the import is finished, a notification will be sent to diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto index b293caf76f0..5b89bceb40f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto @@ -97,9 +97,12 @@ message PredictRequest { // * 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`. + // If your filter blocks all prediction results, the API will return generic + // (unfiltered) popular products. If you only want results strictly matching + // the filters, set `strictFiltering` to True in `PredictRequest.params` to + // receive empty results instead. + // Note that the API will never return items with storageStatus of "EXPIRED" + // or "DELETED" regardless of filter choices. string filter = 5; // Use validate only mode for this prediction query. If set to true, a diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index 0d6fef3e97e..cbadc568119 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -16,10 +16,10 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/promotion.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -332,8 +332,8 @@ message Product { // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or // `KEY_1_LIKE_THIS`. // * For text attributes, 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. + // allowed. Each value must be a non-empty UTF-8 encoded string with a + // length limit of 256 characters. // * For number attributes, at most 400 values are allowed. map attributes = 12; @@ -399,8 +399,8 @@ message Product { // property [Offer.url](https://schema.org/url). string uri = 22; - // Product images for the product.Highly recommended to put the main image - // to the first. + // Product images for the product. We highly recommend putting the main + // image first. // // A maximum of 300 images are allowed. // @@ -443,7 +443,7 @@ message Product { // The material of the product. For example, "leather", "wooden". // // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an + // string with a length limit of 200 characters. Otherwise, an // INVALID_ARGUMENT error is returned. // // Corresponding properties: Google Merchant Center property @@ -479,7 +479,9 @@ message Product { repeated string conditions = 29; // The promotions applied to the product. A maximum of 10 values are allowed - // per [Product][google.cloud.retail.v2alpha.Product]. + // per [Product][google.cloud.retail.v2alpha.Product]. Only + // [Promotion.promotion_id][google.cloud.retail.v2alpha.Promotion.promotion_id] + // will be used, other fields will be ignored if set. repeated Promotion promotions = 34; // The timestamp when the product is published by the retailer for the first diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index 23bb0ff69f8..7bced3fb3dd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -21,7 +21,6 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; import "google/cloud/retail/v2alpha/import_config.proto"; import "google/cloud/retail/v2alpha/product.proto"; import "google/cloud/retail/v2alpha/purge_config.proto"; @@ -88,6 +87,34 @@ service ProductService { option (google.api.method_signature) = "name"; } + // Permanently deletes all selected + // [Product][google.cloud.retail.v2alpha.Product]s under a branch. + // + // This process is asynchronous. If the request is valid, the removal will be + // enqueued and processed offline. Depending on the number of + // [Product][google.cloud.retail.v2alpha.Product]s, this operation could take + // hours to complete. Before the operation completes, some + // [Product][google.cloud.retail.v2alpha.Product]s may still be returned by + // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or + // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // + // Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, + // this operation could take hours to complete. To get a sample of + // [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set + // [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] + // to false. + rpc PurgeProducts(PurgeProductsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2alpha.PurgeProductsResponse" + metadata_type: "google.cloud.retail.v2alpha.PurgeProductsMetadata" + }; + } + // Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. // // Request processing may be synchronous. No partial updating is supported. @@ -137,7 +164,8 @@ service ProductService { // [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], // then any pre-existing inventory information for this product will be used. // - // If no inventory fields are set in [UpdateProductRequest.set_mask][], + // If no inventory fields are set in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], // then any existing inventory information will be preserved. // // Pre-existing inventory information can only be updated with @@ -147,8 +175,7 @@ service ProductService { // [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -174,8 +201,7 @@ service ProductService { // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -202,8 +228,7 @@ service ProductService { // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -237,8 +262,7 @@ service ProductService { // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // Cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc AddLocalInventories(AddLocalInventoriesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -270,8 +294,7 @@ service ProductService { // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // Cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -547,6 +570,24 @@ message SetInventoryRequest { // using the provided or default value for // [SetInventoryRequest.set_time][google.cloud.retail.v2alpha.SetInventoryRequest.set_time]. // + // The caller can replace place IDs for a subset of fulfillment types in the + // following ways: + // + // * Adds "fulfillment_info" in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] + // * Specifies only the desired fulfillment types and corresponding place IDs + // to update in [SetInventoryRequest.inventory.fulfillment_info][] + // + // The caller can clear all place IDs from a subset of fulfillment types in + // the following ways: + // + // * Adds "fulfillment_info" in + // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] + // * Specifies only the desired fulfillment types to clear in + // [SetInventoryRequest.inventory.fulfillment_info][] + // * Checks that only the desired fulfillment info types have empty + // [SetInventoryRequest.inventory.fulfillment_info.place_ids][] + // // The last update time is recorded for the following inventory fields: // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/promotion.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/promotion.proto new file mode 100644 index 00000000000..879449a42bb --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/promotion.proto @@ -0,0 +1,40 @@ +// Copyright 2021 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.v2alpha; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "PromotionProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Promotion information. +message Promotion { + // ID of the promotion. For example, "free gift". + // + // The value must be a UTF-8 encoded string with a length limit of 128 + // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, + // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + // returned. + // + // Google Merchant Center property + // [promotion](https://support.google.com/merchants/answer/7050148). + string promotion_id = 1; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto index 638e8f67b84..6b929f268c6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; @@ -34,6 +33,96 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; // This will be returned by the google.longrunning.Operation.metadata field. message PurgeMetadata {} +// Metadata related to the progress of the PurgeProducts operation. +// This will be returned by the google.longrunning.Operation.metadata field. +message PurgeProductsMetadata { + // 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 deleted successfully. + int64 success_count = 3; + + // Count of entries that encountered errors while processing. + int64 failure_count = 4; +} + +// Request message for PurgeProducts method. +message PurgeProductsRequest { + // Required. The resource name of the branch under which the products are + // created. The format is + // `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } + ]; + + // Required. The filter string to specify the products to be deleted with a + // length limit of 5,000 characters. + // + // Empty string filter is not allowed. "*" implies delete all items in a + // branch. + // + // The eligible fields for filtering are: + // + // * `availability`: Double quoted + // [Product.availability][google.cloud.retail.v2alpha.Product.availability] + // string. + // * `create_time` : in ISO 8601 "zulu" format. + // + // Supported syntax: + // + // * Comparators (">", "<", ">=", "<=", "="). + // Examples: + // * create_time <= "2015-02-13T17:05:46Z" + // * availability = "IN_STOCK" + // + // * Conjunctions ("AND") + // Examples: + // * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" + // + // * Disjunctions ("OR") + // Examples: + // * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" + // + // * Can support nested queries. + // Examples: + // * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") + // OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") + // + // * Filter Limits: + // * Filter should not contain more than 6 conditions. + // * Max nesting depth should not exceed 2 levels. + // + // Examples queries: + // * Delete back order products created before a timestamp. + // create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" + 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 products. + bool force = 3; +} + +// Response of the PurgeProductsRequest. If the long running operation is +// successfully done, then this message is returned by the +// google.longrunning.Operations.response field. +message PurgeProductsResponse { + // The total count of products purged as a result of the operation. + int64 purge_count = 1; + + // A sample of the product names that will be deleted. + // Only populated if `force` is set to false. A max of 100 names will be + // returned and the names are chosen at random. + repeated string purge_sample = 2 [ + (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } + ]; +} + // Request message for PurgeUserEvents method. message PurgeUserEventsRequest { // Required. The resource name of the catalog under which the events are diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index aec89f85c45..f9612734dbf 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -24,8 +24,6 @@ import "google/cloud/retail/v2alpha/common.proto"; import "google/cloud/retail/v2alpha/product.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; @@ -39,8 +37,7 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Please submit a form [here](https://cloud.google.com/contact) to contact -// cloud sales if you are interested in using Retail Search. +// Please enable Retail Search on Cloud Console before using this feature. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -49,8 +46,7 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Please submit a form [here](https://cloud.google.com/contact) to contact - // cloud sales if you are interested in using Retail Search. + // Please enable Retail Search on Cloud Console before using this feature. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -325,6 +321,14 @@ message SearchRequest { // applied and combined in a non-linear way. Maximum number of // specifications is 10. repeated ConditionBoostSpec condition_boost_specs = 1; + + // Whether to skip boostspec validation. If this field is set to true, + // invalid + // [BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] + // will be ignored and valid + // [BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] + // will still be applied. + optional bool skip_boost_spec_validation = 2; } // Specification to determine under which conditions query expansion should @@ -355,6 +359,26 @@ message SearchRequest { bool pin_unexpanded_results = 2; } + // The specification for personalization. + message PersonalizationSpec { + // The personalization mode of each search request. + enum Mode { + // Default value. Defaults to + // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Let CRS decide whether to use personalization. + AUTO = 1; + + // Disable personalization. + DISABLED = 2; + } + + // Defaults to + // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. + Mode mode = 1; + } + // The relevance threshold of the search results. The higher relevance // threshold is, the higher relevant results are shown and the less number of // results are returned. @@ -406,7 +430,7 @@ message SearchRequest { } // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -475,6 +499,9 @@ message SearchRequest { // If this field is unrecognizable, an INVALID_ARGUMENT is returned. string filter = 10; + // The default filter that is applied when a user performs a search without + // checking any filters on the search page. + // // The filter applied to every search request when quality improvement such as // query expansion is needed. For example, if a query does not have enough // results, an expanded query with @@ -502,12 +529,12 @@ message SearchRequest { // is returned. repeated FacetSpec facet_specs = 12; + // Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + // to enable dynamic facets. Do not set this field. + // // The specification for dynamically generated facets. Notice that only // textual facets can be dynamically generated. - // - // This feature requires additional allowlisting. Contact Retail Search - // support team if you are interested in using dynamic facet feature. - DynamicFacetSpec dynamic_facet_spec = 21; + DynamicFacetSpec dynamic_facet_spec = 21 [deprecated = true]; // Boost specification to boost certain products. See more details at this // [user guide](https://cloud.google.com/retail/docs/boosting). @@ -631,6 +658,9 @@ message SearchRequest { // The search mode of the search request. If not specified, a single search // request triggers both product search and faceted search. SearchMode search_mode = 31; + + // The specification for personalization. + PersonalizationSpec personalization_spec = 32; } // Response message for @@ -793,4 +823,10 @@ message SearchResponse { // The fully qualified resource name of applied // [controls](https://cloud.google.com/retail/docs/serving-control-rules). repeated string applied_controls = 12; + + // The invalid + // [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] + // that are not applied during serving. + repeated SearchRequest.BoostSpec.ConditionBoostSpec + invalid_condition_boost_specs = 14; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto new file mode 100644 index 00000000000..c339f3106d4 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto @@ -0,0 +1,247 @@ +// Copyright 2021 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.v2alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2alpha/common.proto"; +import "google/cloud/retail/v2alpha/search_service.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ServingConfigProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Configures metadata that is used to generate serving time results (e.g. +// search results or recommendation predictions). +// The ServingConfig is passed in the search and predict request and together +// with the Catalog.default_branch, generates results. +message ServingConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/ServingConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" + }; + + // Immutable. Fully qualified name + // projects/*/locations/global/catalogs/*/servingConfig/* + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable serving config display name. Used in Retail + // UI. + // + // 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]; + + // The id of the model to use at serving time. + // Currently only RecommendationModels are supported: + // https://cloud.google.com/retail/recommendations-ai/docs/create-models + // Can be changed but only to a compatible model (e.g. + // others-you-may-like CTR to others-you-may-like CVR). + // + // Required when + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string model_id = 3; + + // How much price ranking we want in serving results. + // Price reranking causes product items with a similar + // recommendation probability to be ordered by price, with the + // highest-priced items first. This setting could result in a decrease in + // click-through and conversion rates. + // Allowed values are: + // + // * 'no-price-reranking' + // * 'low-price-raranking' + // * 'medium-price-reranking' + // * 'high-price-reranking' + // + // If not specified, we choose default based on model type. Default value: + // 'no-price-reranking'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string price_reranking_level = 4; + + // Facet specifications for faceted search. If empty, no facets are returned. + // The ids refer to the ids of [Control][google.cloud.retail.v2alpha.Control] + // resources with only the Facet control set. These controls are assumed to be + // in the same [Catalog][google.cloud.retail.v2alpha.Catalog] as the + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]. + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string facet_control_ids = 5; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + + // Condition boost specifications. If a product matches multiple conditions + // in the specifications, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 100. + // + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] + // and [SearchRequest.boost_spec] are set, the boost conditions from both + // places are evaluated. If a search request matches multiple boost + // conditions, the final boost score is equal to the sum of the boost scores + // from all matched boost conditions. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string boost_control_ids = 7; + + // Condition filter specifications. If a product matches multiple conditions + // in the specifications, filters from these specifications are all + // applied and combined via the AND operator. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string filter_control_ids = 9; + + // Condition redirect specifications. Only the first triggered redirect action + // is applied, even if multiple apply. Maximum number of specifications is + // 1000. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string redirect_control_ids = 10; + + // Condition synonyms specifications. If multiple syonyms conditions match, + // all matching synonyms control in the list will execute. Order of controls + // in the list will not matter. Maximum number of specifications is + // 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string twoway_synonyms_control_ids = 18; + + // Condition oneway synonyms specifications. If multiple oneway synonyms + // conditions match, all matching oneway synonyms controls in the list will + // execute. Order of controls in the list will not matter. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string oneway_synonyms_control_ids = 12; + + // Condition do not associate specifications. If multiple do not associate + // conditions match, all matching do not associate controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string do_not_associate_control_ids = 13; + + // Condition replacement specifications. + // - Applied according to the order in the list. + // - A previously replaced term can not be re-replaced. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string replacement_control_ids = 14; + + // Condition ignore specifications. If multiple ignore + // conditions match, all matching ignore controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string ignore_control_ids = 15; + + // How much diversity to use in recommendation model results e.g. + // 'medium-diversity' or 'high-diversity'. Currently supported values: + // + // * 'no-diversity' + // * 'low-diversity' + // * 'medium-diversity' + // * 'high-diversity' + // * 'auto-diversity' + // + // If not specified, we choose default based on recommendation model + // type. Default value: 'no-diversity'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string diversity_level = 8; + + // Whether to add additional category filters on the 'similar-items' model. + // If not specified, we enable it by default. + // Allowed values are: + // + // * 'no-category-match': No additional filtering of original results from + // the model and the customer's filters. + // * 'relaxed-category-match': Only keep results with categories that match + // at least one item categories in the PredictRequests's context item. + // * If customer also sends filters in the PredictRequest, then the results + // will satisfy both conditions (user given and category match). + // + // Can only be set if + // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string enable_category_filter_level = 16; + + // Required. Immutable. Specifies the solution types that a serving config can + // be associated with. Currently we support setting only one type of solution. + repeated SolutionType solution_types = 19 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto new file mode 100644 index 00000000000..4828679766e --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto @@ -0,0 +1,241 @@ +// Copyright 2021 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.v2alpha; + +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/v2alpha/serving_config.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ServingConfigServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Service for modifying ServingConfig. +service ServingConfigService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a ServingConfig. + // + // A maximum of 100 + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in + // a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a + // FAILED_PRECONDITION error is returned. + rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + body: "serving_config" + }; + option (google.api.method_signature) = + "parent,serving_config,serving_config_id"; + } + + // Deletes a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc DeleteServingConfig(DeleteServingConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a ServingConfig. + rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + patch: "/v2alpha/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + body: "serving_config" + }; + option (google.api.method_signature) = "serving_config,update_mask"; + } + + // Gets a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all ServingConfigs linked to this catalog. + rpc ListServingConfigs(ListServingConfigsRequest) + returns (ListServingConfigsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Enables a Control on the specified ServingConfig. + // The control is added in the last position of the list of controls + // it belongs to (e.g. if it's a facet spec control it will be applied + // in the last position of servingConfig.facetSpecIds) + // Returns a ALREADY_EXISTS error if the control has already been applied. + // Returns a FAILED_PRECONDITION error if the addition could exceed maximum + // number of control allowed for that type of control. + rpc AddControl(AddControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } + + // Disables a Control on the specified ServingConfig. + // The control is removed from the ServingConfig. + // Returns a NOT_FOUND error if the Control is not enabled for the + // ServingConfig. + rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } +} + +// Request for CreateServingConfig method. +message CreateServingConfigRequest { + // Required. Full resource name of parent. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The ServingConfig to create. + ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the ServingConfig, which will become the final + // component of the ServingConfig's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateServingConfig method. +message UpdateServingConfigRequest { + // Required. The ServingConfig to update. + ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to update. The + // following are NOT supported: + // + // * [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteServingConfig method. +message DeleteServingConfigRequest { + // Required. The resource name of the ServingConfig to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for GetServingConfig method. +message GetServingConfigRequest { + // Required. The resource name of the ServingConfig to get. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for ListServingConfigs method. +message ListServingConfigsRequest { + // Required. The catalog resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 100. If a value greater than 100 is provided, at most 100 results are + // returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListServingConfigs` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListServingConfigs method. +message ListServingConfigsResponse { + // All the ServingConfigs for a given catalog. + repeated ServingConfig serving_configs = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} + +// Request for AddControl method. +message AddControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config - if id is not found a NOT_FOUND error is returned. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for RemoveControl method. +message RemoveControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto index 6b2d048e1ec..94f728791f9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/retail/v2alpha/common.proto"; import "google/cloud/retail/v2alpha/product.proto"; @@ -136,6 +135,13 @@ message UserEvent { // Extra user event features to include in the recommendation model. // + // If you provide custom attributes for ingested user events, also include + // them in the user events that you associate with prediction requests. Custom + // attribute formatting must be consistent between imported events and events + // provided with prediction requests. This lets the Retail API use + // those custom attributes when training models and serving predictions, which + // helps improve recommendation quality. + // // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT // error is returned: // @@ -146,10 +152,10 @@ message UserEvent { // 256 characters. // * For number attributes, at most 400 values are allowed. // - // 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. + // For product recommendations, an example of extra user information is + // traffic_channel, which is how a user arrives at the site. Users can arrive + // at the site by coming to the site directly, coming through Google + // search, or in other ways. map attributes = 7; // The ID or name of the associated shopping cart. This ID is used diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto index 2e91984a99b..af97dad9dbc 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto @@ -20,7 +20,7 @@ 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/v2alpha/export_config.proto"; +import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/import_config.proto"; import "google/cloud/retail/v2alpha/purge_config.proto"; import "google/cloud/retail/v2alpha/user_event.proto"; @@ -95,13 +95,14 @@ service UserEventService { }; } - // Triggers a user event rejoin operation with latest product catalog. Events + // Starts 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 + // serving. This method can be used to start 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. + // correct events joined with the wrong product catalog. A rejoin operation + // can take hours or days to complete. rpc RejoinUserEvents(RejoinUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 20740410363..2e6a9dfa755 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -10301,1050 +10301,1467 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a MerchantCenterLink. */ - interface IMerchantCenterLink { + /** Properties of a CatalogAttribute. */ + interface ICatalogAttribute { - /** MerchantCenterLink merchantCenterAccountId */ - merchantCenterAccountId?: (number|Long|string|null); + /** CatalogAttribute key */ + key?: (string|null); - /** MerchantCenterLink branchId */ - branchId?: (string|null); + /** CatalogAttribute inUse */ + inUse?: (boolean|null); - /** MerchantCenterLink destinations */ - destinations?: (string[]|null); + /** CatalogAttribute type */ + type?: (google.cloud.retail.v2alpha.CatalogAttribute.AttributeType|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.AttributeType|null); - /** MerchantCenterLink regionCode */ - regionCode?: (string|null); + /** CatalogAttribute indexableOption */ + indexableOption?: (google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption|null); - /** MerchantCenterLink languageCode */ - languageCode?: (string|null); + /** CatalogAttribute dynamicFacetableOption */ + dynamicFacetableOption?: (google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption|null); + + /** CatalogAttribute searchableOption */ + searchableOption?: (google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|null); } - /** Represents a MerchantCenterLink. */ - class MerchantCenterLink implements IMerchantCenterLink { + /** Represents a CatalogAttribute. */ + class CatalogAttribute implements ICatalogAttribute { /** - * Constructs a new MerchantCenterLink. + * Constructs a new CatalogAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink); + constructor(properties?: google.cloud.retail.v2alpha.ICatalogAttribute); - /** MerchantCenterLink merchantCenterAccountId. */ - public merchantCenterAccountId: (number|Long|string); + /** CatalogAttribute key. */ + public key: string; - /** MerchantCenterLink branchId. */ - public branchId: string; + /** CatalogAttribute inUse. */ + public inUse: boolean; - /** MerchantCenterLink destinations. */ - public destinations: string[]; + /** CatalogAttribute type. */ + public type: (google.cloud.retail.v2alpha.CatalogAttribute.AttributeType|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.AttributeType); - /** MerchantCenterLink regionCode. */ - public regionCode: string; + /** CatalogAttribute indexableOption. */ + public indexableOption: (google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption); - /** MerchantCenterLink languageCode. */ - public languageCode: string; + /** CatalogAttribute dynamicFacetableOption. */ + public dynamicFacetableOption: (google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption); + + /** CatalogAttribute searchableOption. */ + public searchableOption: (google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption); /** - * Creates a new MerchantCenterLink instance using the specified properties. + * Creates a new CatalogAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns MerchantCenterLink instance + * @returns CatalogAttribute instance */ - public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink): google.cloud.retail.v2alpha.MerchantCenterLink; + public static create(properties?: google.cloud.retail.v2alpha.ICatalogAttribute): google.cloud.retail.v2alpha.CatalogAttribute; /** - * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. - * @param message MerchantCenterLink message or plain object to encode + * Encodes the specified CatalogAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CatalogAttribute.verify|verify} messages. + * @param message CatalogAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICatalogAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. - * @param message MerchantCenterLink message or plain object to encode + * Encodes the specified CatalogAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CatalogAttribute.verify|verify} messages. + * @param message CatalogAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalogAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a MerchantCenterLink message from the specified reader or buffer. + * Decodes a CatalogAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns MerchantCenterLink + * @returns CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLink; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CatalogAttribute; /** - * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. + * Decodes a CatalogAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns MerchantCenterLink + * @returns CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLink; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CatalogAttribute; /** - * Verifies a MerchantCenterLink message. + * Verifies a CatalogAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. + * Creates a CatalogAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns MerchantCenterLink + * @returns CatalogAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLink; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CatalogAttribute; /** - * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. - * @param message MerchantCenterLink + * Creates a plain object from a CatalogAttribute message. Also converts values to other types if specified. + * @param message CatalogAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CatalogAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this MerchantCenterLink to JSON. + * Converts this CatalogAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a MerchantCenterLinkingConfig. */ - interface IMerchantCenterLinkingConfig { + namespace CatalogAttribute { - /** MerchantCenterLinkingConfig links */ - links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); + /** AttributeType enum. */ + enum AttributeType { + UNKNOWN = 0, + TEXTUAL = 1, + NUMERICAL = 2 + } + + /** IndexableOption enum. */ + enum IndexableOption { + INDEXABLE_OPTION_UNSPECIFIED = 0, + INDEXABLE_ENABLED = 1, + INDEXABLE_DISABLED = 2 + } + + /** DynamicFacetableOption enum. */ + enum DynamicFacetableOption { + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0, + DYNAMIC_FACETABLE_ENABLED = 1, + DYNAMIC_FACETABLE_DISABLED = 2 + } + + /** SearchableOption enum. */ + enum SearchableOption { + SEARCHABLE_OPTION_UNSPECIFIED = 0, + SEARCHABLE_ENABLED = 1, + SEARCHABLE_DISABLED = 2 + } } - /** Represents a MerchantCenterLinkingConfig. */ - class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { + /** Properties of an AttributesConfig. */ + interface IAttributesConfig { + + /** AttributesConfig name */ + name?: (string|null); + + /** AttributesConfig catalogAttributes */ + catalogAttributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICatalogAttribute }|null); + + /** AttributesConfig attributeConfigLevel */ + attributeConfigLevel?: (google.cloud.retail.v2alpha.AttributeConfigLevel|keyof typeof google.cloud.retail.v2alpha.AttributeConfigLevel|null); + } + + /** Represents an AttributesConfig. */ + class AttributesConfig implements IAttributesConfig { /** - * Constructs a new MerchantCenterLinkingConfig. + * Constructs a new AttributesConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); + constructor(properties?: google.cloud.retail.v2alpha.IAttributesConfig); - /** MerchantCenterLinkingConfig links. */ - public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; + /** AttributesConfig name. */ + public name: string; + + /** AttributesConfig catalogAttributes. */ + public catalogAttributes: { [k: string]: google.cloud.retail.v2alpha.ICatalogAttribute }; + + /** AttributesConfig attributeConfigLevel. */ + public attributeConfigLevel: (google.cloud.retail.v2alpha.AttributeConfigLevel|keyof typeof google.cloud.retail.v2alpha.AttributeConfigLevel); /** - * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * Creates a new AttributesConfig instance using the specified properties. * @param [properties] Properties to set - * @returns MerchantCenterLinkingConfig instance + * @returns AttributesConfig instance */ - public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static create(properties?: google.cloud.retail.v2alpha.IAttributesConfig): google.cloud.retail.v2alpha.AttributesConfig; /** - * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @param message MerchantCenterLinkingConfig message or plain object to encode + * Encodes the specified AttributesConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.AttributesConfig.verify|verify} messages. + * @param message AttributesConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IAttributesConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. - * @param message MerchantCenterLinkingConfig message or plain object to encode + * Encodes the specified AttributesConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AttributesConfig.verify|verify} messages. + * @param message AttributesConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAttributesConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * Decodes an AttributesConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns MerchantCenterLinkingConfig + * @returns AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AttributesConfig; /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * Decodes an AttributesConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns MerchantCenterLinkingConfig + * @returns AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AttributesConfig; /** - * Verifies a MerchantCenterLinkingConfig message. + * Verifies an AttributesConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AttributesConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns MerchantCenterLinkingConfig + * @returns AttributesConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AttributesConfig; /** - * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. - * @param message MerchantCenterLinkingConfig + * Creates a plain object from an AttributesConfig message. Also converts values to other types if specified. + * @param message AttributesConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.AttributesConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this MerchantCenterLinkingConfig to JSON. + * Converts this AttributesConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Catalog. */ - interface ICatalog { + /** Properties of a CompletionConfig. */ + interface ICompletionConfig { - /** Catalog name */ + /** CompletionConfig name */ name?: (string|null); - /** Catalog displayName */ - displayName?: (string|null); + /** CompletionConfig matchingOrder */ + matchingOrder?: (string|null); - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + /** CompletionConfig maxSuggestions */ + maxSuggestions?: (number|null); - /** Catalog merchantCenterLinkingConfig */ - merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + /** CompletionConfig minPrefixLength */ + minPrefixLength?: (number|null); + + /** CompletionConfig autoLearning */ + autoLearning?: (boolean|null); + + /** CompletionConfig suggestionsInputConfig */ + suggestionsInputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** CompletionConfig lastSuggestionsImportOperation */ + lastSuggestionsImportOperation?: (string|null); + + /** CompletionConfig denylistInputConfig */ + denylistInputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** CompletionConfig lastDenylistImportOperation */ + lastDenylistImportOperation?: (string|null); + + /** CompletionConfig allowlistInputConfig */ + allowlistInputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** CompletionConfig lastAllowlistImportOperation */ + lastAllowlistImportOperation?: (string|null); } - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** Represents a CompletionConfig. */ + class CompletionConfig implements ICompletionConfig { /** - * Constructs a new Catalog. + * Constructs a new CompletionConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICatalog); + constructor(properties?: google.cloud.retail.v2alpha.ICompletionConfig); - /** Catalog name. */ + /** CompletionConfig name. */ public name: string; - /** Catalog displayName. */ - public displayName: string; + /** CompletionConfig matchingOrder. */ + public matchingOrder: string; - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); + /** CompletionConfig maxSuggestions. */ + public maxSuggestions: number; - /** Catalog merchantCenterLinkingConfig. */ - public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); + /** CompletionConfig minPrefixLength. */ + public minPrefixLength: number; - /** - * Creates a new Catalog instance using the specified properties. - * @param [properties] Properties to set - * @returns Catalog instance - */ - public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; + /** CompletionConfig autoLearning. */ + public autoLearning: boolean; - /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + /** CompletionConfig suggestionsInputConfig. */ + public suggestionsInputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); - /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + /** CompletionConfig lastSuggestionsImportOperation. */ + public lastSuggestionsImportOperation: string; + + /** CompletionConfig denylistInputConfig. */ + public denylistInputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** CompletionConfig lastDenylistImportOperation. */ + public lastDenylistImportOperation: string; + + /** CompletionConfig allowlistInputConfig. */ + public allowlistInputConfig?: (google.cloud.retail.v2alpha.ICompletionDataInputConfig|null); + + /** CompletionConfig lastAllowlistImportOperation. */ + public lastAllowlistImportOperation: string; + + /** + * Creates a new CompletionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICompletionConfig): google.cloud.retail.v2alpha.CompletionConfig; + + /** + * Encodes the specified CompletionConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionConfig.verify|verify} messages. + * @param message CompletionConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompletionConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Catalog message from the specified reader or buffer. + * Encodes the specified CompletionConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionConfig.verify|verify} messages. + * @param message CompletionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompletionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Catalog + * @returns CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompletionConfig; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a CompletionConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Catalog + * @returns CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompletionConfig; /** - * Verifies a Catalog message. + * Verifies a CompletionConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Catalog + * @returns CompletionConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompletionConfig; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog + * Creates a plain object from a CompletionConfig message. Also converts values to other types if specified. + * @param message CompletionConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompletionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Catalog to JSON. + * Converts this CompletionConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** SolutionType enum. */ - enum SolutionType { - SOLUTION_TYPE_UNSPECIFIED = 0, - SOLUTION_TYPE_RECOMMENDATION = 1, - SOLUTION_TYPE_SEARCH = 2 - } + /** Properties of a MerchantCenterLink. */ + interface IMerchantCenterLink { - /** Properties of a Condition. */ - interface ICondition { + /** MerchantCenterLink merchantCenterAccountId */ + merchantCenterAccountId?: (number|Long|string|null); - /** Condition queryTerms */ - queryTerms?: (google.cloud.retail.v2alpha.Condition.IQueryTerm[]|null); + /** MerchantCenterLink branchId */ + branchId?: (string|null); - /** Condition activeTimeRange */ - activeTimeRange?: (google.cloud.retail.v2alpha.Condition.ITimeRange[]|null); + /** MerchantCenterLink destinations */ + destinations?: (string[]|null); + + /** MerchantCenterLink regionCode */ + regionCode?: (string|null); + + /** MerchantCenterLink languageCode */ + languageCode?: (string|null); } - /** Represents a Condition. */ - class Condition implements ICondition { + /** Represents a MerchantCenterLink. */ + class MerchantCenterLink implements IMerchantCenterLink { /** - * Constructs a new Condition. + * Constructs a new MerchantCenterLink. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICondition); + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink); - /** Condition queryTerms. */ - public queryTerms: google.cloud.retail.v2alpha.Condition.IQueryTerm[]; + /** MerchantCenterLink merchantCenterAccountId. */ + public merchantCenterAccountId: (number|Long|string); - /** Condition activeTimeRange. */ - public activeTimeRange: google.cloud.retail.v2alpha.Condition.ITimeRange[]; + /** MerchantCenterLink branchId. */ + public branchId: string; + + /** MerchantCenterLink destinations. */ + public destinations: string[]; + + /** MerchantCenterLink regionCode. */ + public regionCode: string; + + /** MerchantCenterLink languageCode. */ + public languageCode: string; /** - * Creates a new Condition instance using the specified properties. + * Creates a new MerchantCenterLink instance using the specified properties. * @param [properties] Properties to set - * @returns Condition instance + * @returns MerchantCenterLink instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICondition): google.cloud.retail.v2alpha.Condition; + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLink): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. - * @param message Condition message or plain object to encode + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. - * @param message Condition message or plain object to encode + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * @param message MerchantCenterLink message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLink, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Condition message from the specified reader or buffer. + * Decodes a MerchantCenterLink message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Condition + * @returns MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Decodes a Condition message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Condition + * @returns MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Verifies a Condition message. + * Verifies a MerchantCenterLink message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Condition + * @returns MerchantCenterLink */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLink; /** - * Creates a plain object from a Condition message. Also converts values to other types if specified. - * @param message Condition + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. + * @param message MerchantCenterLink * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Condition to JSON. + * Converts this MerchantCenterLink to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Condition { - - /** Properties of a QueryTerm. */ - interface IQueryTerm { + /** Properties of a MerchantCenterLinkingConfig. */ + interface IMerchantCenterLinkingConfig { - /** QueryTerm value */ - value?: (string|null); + /** MerchantCenterLinkingConfig links */ + links?: (google.cloud.retail.v2alpha.IMerchantCenterLink[]|null); + } - /** QueryTerm fullMatch */ - fullMatch?: (boolean|null); - } + /** Represents a MerchantCenterLinkingConfig. */ + class MerchantCenterLinkingConfig implements IMerchantCenterLinkingConfig { - /** Represents a QueryTerm. */ - class QueryTerm implements IQueryTerm { + /** + * Constructs a new MerchantCenterLinkingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig); - /** - * Constructs a new QueryTerm. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm); + /** MerchantCenterLinkingConfig links. */ + public links: google.cloud.retail.v2alpha.IMerchantCenterLink[]; - /** QueryTerm value. */ - public value: string; + /** + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MerchantCenterLinkingConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; - /** QueryTerm fullMatch. */ - public fullMatch: boolean; + /** + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new QueryTerm instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryTerm instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm): google.cloud.retail.v2alpha.Condition.QueryTerm; + /** + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @param message MerchantCenterLinkingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @param message QueryTerm message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; - /** - * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @param message QueryTerm message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; - /** - * Decodes a QueryTerm message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.QueryTerm; + /** + * Verifies a MerchantCenterLinkingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes a QueryTerm message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.QueryTerm; - - /** - * Verifies a QueryTerm message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryTerm - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.QueryTerm; - - /** - * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. - * @param message QueryTerm - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this QueryTerm to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a TimeRange. */ - interface ITimeRange { - - /** TimeRange startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** TimeRange endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a TimeRange. */ - class TimeRange implements ITimeRange { - - /** - * Constructs a new TimeRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange); - - /** TimeRange startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** TimeRange endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new TimeRange instance using the specified properties. - * @param [properties] Properties to set - * @returns TimeRange instance - */ - public static create(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange): google.cloud.retail.v2alpha.Condition.TimeRange; - - /** - * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @param message TimeRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @param message TimeRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TimeRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.TimeRange; - - /** - * Decodes a TimeRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.TimeRange; - - /** - * Verifies a TimeRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TimeRange - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.TimeRange; + /** + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MerchantCenterLinkingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.MerchantCenterLinkingConfig; - /** - * Creates a plain object from a TimeRange message. Also converts values to other types if specified. - * @param message TimeRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @param message MerchantCenterLinkingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.MerchantCenterLinkingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this TimeRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this MerchantCenterLinkingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a Rule. */ - interface IRule { - - /** Rule boostAction */ - boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); - - /** Rule redirectAction */ - redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); - - /** Rule onewaySynonymsAction */ - onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); - - /** Rule doNotAssociateAction */ - doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); - - /** Rule replacementAction */ - replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + /** Properties of a Catalog. */ + interface ICatalog { - /** Rule ignoreAction */ - ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + /** Catalog name */ + name?: (string|null); - /** Rule filterAction */ - filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + /** Catalog displayName */ + displayName?: (string|null); - /** Rule twowaySynonymsAction */ - twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); - /** Rule condition */ - condition?: (google.cloud.retail.v2alpha.ICondition|null); + /** Catalog merchantCenterLinkingConfig */ + merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); } - /** Represents a Rule. */ - class Rule implements IRule { + /** Represents a Catalog. */ + class Catalog implements ICatalog { /** - * Constructs a new Rule. + * Constructs a new Catalog. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IRule); - - /** Rule boostAction. */ - public boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); - - /** Rule redirectAction. */ - public redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); - - /** Rule onewaySynonymsAction. */ - public onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); - - /** Rule doNotAssociateAction. */ - public doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); - - /** Rule replacementAction. */ - public replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); - - /** Rule ignoreAction. */ - public ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + constructor(properties?: google.cloud.retail.v2alpha.ICatalog); - /** Rule filterAction. */ - public filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + /** Catalog name. */ + public name: string; - /** Rule twowaySynonymsAction. */ - public twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + /** Catalog displayName. */ + public displayName: string; - /** Rule condition. */ - public condition?: (google.cloud.retail.v2alpha.ICondition|null); + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2alpha.IProductLevelConfig|null); - /** Rule action. */ - public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + /** Catalog merchantCenterLinkingConfig. */ + public merchantCenterLinkingConfig?: (google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null); /** - * Creates a new Rule instance using the specified properties. + * Creates a new Catalog instance using the specified properties. * @param [properties] Properties to set - * @returns Rule instance + * @returns Catalog instance */ - public static create(properties?: google.cloud.retail.v2alpha.IRule): google.cloud.retail.v2alpha.Rule; + public static create(properties?: google.cloud.retail.v2alpha.ICatalog): google.cloud.retail.v2alpha.Catalog; /** - * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. - * @param message Rule message or plain object to encode + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. - * @param message Rule message or plain object to encode + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rule message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rule + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Catalog; /** - * Decodes a Rule message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rule + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Catalog; /** - * Verifies a Rule message. + * Verifies a Catalog message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rule + * @returns Catalog */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Catalog; /** - * Creates a plain object from a Rule message. Also converts values to other types if specified. - * @param message Rule + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rule to JSON. + * Converts this Catalog to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Rule { + /** AttributeConfigLevel enum. */ + enum AttributeConfigLevel { + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0, + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1, + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2 + } - /** Properties of a BoostAction. */ - interface IBoostAction { + /** SolutionType enum. */ + enum SolutionType { + SOLUTION_TYPE_UNSPECIFIED = 0, + SOLUTION_TYPE_RECOMMENDATION = 1, + SOLUTION_TYPE_SEARCH = 2 + } - /** BoostAction boost */ - boost?: (number|null); + /** SearchSolutionUseCase enum. */ + enum SearchSolutionUseCase { + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0, + SEARCH_SOLUTION_USE_CASE_SEARCH = 1, + SEARCH_SOLUTION_USE_CASE_BROWSE = 2 + } - /** BoostAction productsFilter */ - productsFilter?: (string|null); + /** Properties of a Condition. */ + interface ICondition { + + /** Condition queryTerms */ + queryTerms?: (google.cloud.retail.v2alpha.Condition.IQueryTerm[]|null); + + /** Condition activeTimeRange */ + activeTimeRange?: (google.cloud.retail.v2alpha.Condition.ITimeRange[]|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { + + /** + * Constructs a new Condition. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICondition); + + /** Condition queryTerms. */ + public queryTerms: google.cloud.retail.v2alpha.Condition.IQueryTerm[]; + + /** Condition activeTimeRange. */ + public activeTimeRange: google.cloud.retail.v2alpha.Condition.ITimeRange[]; + + /** + * Creates a new Condition instance using the specified properties. + * @param [properties] Properties to set + * @returns Condition instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICondition): google.cloud.retail.v2alpha.Condition; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition; + + /** + * Verifies a Condition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Condition + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Condition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Condition { + + /** Properties of a QueryTerm. */ + interface IQueryTerm { + + /** QueryTerm value */ + value?: (string|null); + + /** QueryTerm fullMatch */ + fullMatch?: (boolean|null); } - /** Represents a BoostAction. */ - class BoostAction implements IBoostAction { + /** Represents a QueryTerm. */ + class QueryTerm implements IQueryTerm { /** - * Constructs a new BoostAction. + * Constructs a new QueryTerm. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction); + constructor(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm); - /** BoostAction boost. */ - public boost: number; + /** QueryTerm value. */ + public value: string; - /** BoostAction productsFilter. */ - public productsFilter: string; + /** QueryTerm fullMatch. */ + public fullMatch: boolean; /** - * Creates a new BoostAction instance using the specified properties. + * Creates a new QueryTerm instance using the specified properties. * @param [properties] Properties to set - * @returns BoostAction instance + * @returns QueryTerm instance */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction): google.cloud.retail.v2alpha.Rule.BoostAction; + public static create(properties?: google.cloud.retail.v2alpha.Condition.IQueryTerm): google.cloud.retail.v2alpha.Condition.QueryTerm; /** - * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. - * @param message BoostAction message or plain object to encode + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. - * @param message BoostAction message or plain object to encode + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BoostAction message from the specified reader or buffer. + * Decodes a QueryTerm message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BoostAction + * @returns QueryTerm * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.BoostAction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.QueryTerm; /** - * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BoostAction + * @returns QueryTerm * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.BoostAction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.QueryTerm; /** - * Verifies a BoostAction message. + * Verifies a QueryTerm message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BoostAction + * @returns QueryTerm */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.BoostAction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.QueryTerm; /** - * Creates a plain object from a BoostAction message. Also converts values to other types if specified. - * @param message BoostAction + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @param message QueryTerm * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BoostAction to JSON. + * Converts this QueryTerm to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FilterAction. */ - interface IFilterAction { + /** Properties of a TimeRange. */ + interface ITimeRange { - /** FilterAction filter */ - filter?: (string|null); + /** TimeRange startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime */ + endTime?: (google.protobuf.ITimestamp|null); } - /** Represents a FilterAction. */ - class FilterAction implements IFilterAction { + /** Represents a TimeRange. */ + class TimeRange implements ITimeRange { /** - * Constructs a new FilterAction. + * Constructs a new TimeRange. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction); + constructor(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange); - /** FilterAction filter. */ - public filter: string; + /** TimeRange startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** TimeRange endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new FilterAction instance using the specified properties. + * Creates a new TimeRange instance using the specified properties. * @param [properties] Properties to set - * @returns FilterAction instance + * @returns TimeRange instance */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction): google.cloud.retail.v2alpha.Rule.FilterAction; + public static create(properties?: google.cloud.retail.v2alpha.Condition.ITimeRange): google.cloud.retail.v2alpha.Condition.TimeRange; /** - * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @param message FilterAction message or plain object to encode + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @param message FilterAction message or plain object to encode + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FilterAction message from the specified reader or buffer. + * Decodes a TimeRange message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FilterAction + * @returns TimeRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.FilterAction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Condition.TimeRange; /** - * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * Decodes a TimeRange message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FilterAction + * @returns TimeRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.FilterAction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Condition.TimeRange; /** - * Verifies a FilterAction message. + * Verifies a TimeRange message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FilterAction + * @returns TimeRange */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.FilterAction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Condition.TimeRange; /** - * Creates a plain object from a FilterAction message. Also converts values to other types if specified. - * @param message FilterAction + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @param message TimeRange * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FilterAction to JSON. + * Converts this TimeRange to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - /** Properties of a RedirectAction. */ - interface IRedirectAction { + /** Properties of a Rule. */ + interface IRule { - /** RedirectAction redirectUri */ - redirectUri?: (string|null); + /** Rule boostAction */ + boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + + /** Rule redirectAction */ + redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction */ + onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction */ + doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction */ + replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + + /** Rule ignoreAction */ + ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + + /** Rule filterAction */ + filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction */ + twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + + /** Rule condition */ + condition?: (google.cloud.retail.v2alpha.ICondition|null); + } + + /** Represents a Rule. */ + class Rule implements IRule { + + /** + * Constructs a new Rule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRule); + + /** Rule boostAction. */ + public boostAction?: (google.cloud.retail.v2alpha.Rule.IBoostAction|null); + + /** Rule redirectAction. */ + public redirectAction?: (google.cloud.retail.v2alpha.Rule.IRedirectAction|null); + + /** Rule onewaySynonymsAction. */ + public onewaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction. */ + public doNotAssociateAction?: (google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction. */ + public replacementAction?: (google.cloud.retail.v2alpha.Rule.IReplacementAction|null); + + /** Rule ignoreAction. */ + public ignoreAction?: (google.cloud.retail.v2alpha.Rule.IIgnoreAction|null); + + /** Rule filterAction. */ + public filterAction?: (google.cloud.retail.v2alpha.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction. */ + public twowaySynonymsAction?: (google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null); + + /** Rule condition. */ + public condition?: (google.cloud.retail.v2alpha.ICondition|null); + + /** Rule action. */ + public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); + + /** + * Creates a new Rule instance using the specified properties. + * @param [properties] Properties to set + * @returns Rule instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRule): google.cloud.retail.v2alpha.Rule; + + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule; + + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule; + + /** + * Verifies a Rule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @param message Rule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Rule { + + /** Properties of a BoostAction. */ + interface IBoostAction { + + /** BoostAction boost */ + boost?: (number|null); + + /** BoostAction productsFilter */ + productsFilter?: (string|null); } - /** Represents a RedirectAction. */ - class RedirectAction implements IRedirectAction { + /** Represents a BoostAction. */ + class BoostAction implements IBoostAction { /** - * Constructs a new RedirectAction. + * Constructs a new BoostAction. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction); + constructor(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction); - /** RedirectAction redirectUri. */ - public redirectUri: string; + /** BoostAction boost. */ + public boost: number; + + /** BoostAction productsFilter. */ + public productsFilter: string; /** - * Creates a new RedirectAction instance using the specified properties. + * Creates a new BoostAction instance using the specified properties. * @param [properties] Properties to set - * @returns RedirectAction instance + * @returns BoostAction instance */ - public static create(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction): google.cloud.retail.v2alpha.Rule.RedirectAction; + public static create(properties?: google.cloud.retail.v2alpha.Rule.IBoostAction): google.cloud.retail.v2alpha.Rule.BoostAction; /** - * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @param message RedirectAction message or plain object to encode + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @param message RedirectAction message or plain object to encode + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a RedirectAction message from the specified reader or buffer. + * Decodes a BoostAction message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns RedirectAction + * @returns BoostAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.RedirectAction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.BoostAction; /** - * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * Decodes a BoostAction message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns RedirectAction + * @returns BoostAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.RedirectAction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.BoostAction; /** - * Verifies a RedirectAction message. + * Verifies a BoostAction message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns RedirectAction + * @returns BoostAction */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.RedirectAction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.BoostAction; /** - * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. - * @param message RedirectAction + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @param message BoostAction * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this RedirectAction to JSON. + * Converts this BoostAction to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a TwowaySynonymsAction. */ - interface ITwowaySynonymsAction { + /** Properties of a FilterAction. */ + interface IFilterAction { - /** TwowaySynonymsAction synonyms */ - synonyms?: (string[]|null); + /** FilterAction filter */ + filter?: (string|null); } - /** Represents a TwowaySynonymsAction. */ - class TwowaySynonymsAction implements ITwowaySynonymsAction { + /** Represents a FilterAction. */ + class FilterAction implements IFilterAction { /** - * Constructs a new TwowaySynonymsAction. + * Constructs a new FilterAction. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction); + constructor(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction); + + /** FilterAction filter. */ + public filter: string; + + /** + * Creates a new FilterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns FilterAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IFilterAction): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Verifies a FilterAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FilterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.FilterAction; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @param message FilterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FilterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RedirectAction. */ + interface IRedirectAction { + + /** RedirectAction redirectUri */ + redirectUri?: (string|null); + } + + /** Represents a RedirectAction. */ + class RedirectAction implements IRedirectAction { + + /** + * Constructs a new RedirectAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction); + + /** RedirectAction redirectUri. */ + public redirectUri: string; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RedirectAction instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Rule.IRedirectAction): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Verifies a RedirectAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RedirectAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Rule.RedirectAction; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @param message RedirectAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RedirectAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TwowaySynonymsAction. */ + interface ITwowaySynonymsAction { + + /** TwowaySynonymsAction synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a TwowaySynonymsAction. */ + class TwowaySynonymsAction implements ITwowaySynonymsAction { + + /** + * Constructs a new TwowaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction); /** TwowaySynonymsAction synonyms. */ public synonyms: string[]; @@ -12870,180 +13287,96 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a Promotion. */ - interface IPromotion { + /** Properties of a LocalInventory. */ + interface ILocalInventory { - /** Promotion promotionId */ - promotionId?: (string|null); + /** LocalInventory placeId */ + placeId?: (string|null); + + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + + /** LocalInventory fulfillmentTypes */ + fulfillmentTypes?: (string[]|null); } - /** Represents a Promotion. */ - class Promotion implements IPromotion { + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { /** - * Constructs a new Promotion. + * Constructs a new LocalInventory. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPromotion); + constructor(properties?: google.cloud.retail.v2alpha.ILocalInventory); - /** Promotion promotionId. */ - public promotionId: string; + /** LocalInventory placeId. */ + public placeId: string; + + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); + + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + + /** LocalInventory fulfillmentTypes. */ + public fulfillmentTypes: string[]; /** - * Creates a new Promotion instance using the specified properties. + * Creates a new LocalInventory instance using the specified properties. * @param [properties] Properties to set - * @returns Promotion instance + * @returns LocalInventory instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPromotion): google.cloud.retail.v2alpha.Promotion; + public static create(properties?: google.cloud.retail.v2alpha.ILocalInventory): google.cloud.retail.v2alpha.LocalInventory; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Promotion + * @returns LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Promotion; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.LocalInventory; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Promotion + * @returns LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Promotion; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.LocalInventory; /** - * Verifies a Promotion message. + * Verifies a LocalInventory message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Promotion - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Promotion; - - /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. - * @param message Promotion - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Promotion to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a LocalInventory. */ - interface ILocalInventory { - - /** LocalInventory placeId */ - placeId?: (string|null); - - /** LocalInventory priceInfo */ - priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - - /** LocalInventory attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); - } - - /** Represents a LocalInventory. */ - class LocalInventory implements ILocalInventory { - - /** - * Constructs a new LocalInventory. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.ILocalInventory); - - /** LocalInventory placeId. */ - public placeId: string; - - /** LocalInventory priceInfo. */ - public priceInfo?: (google.cloud.retail.v2alpha.IPriceInfo|null); - - /** LocalInventory attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; - - /** - * Creates a new LocalInventory instance using the specified properties. - * @param [properties] Properties to set - * @returns LocalInventory instance - */ - public static create(properties?: google.cloud.retail.v2alpha.ILocalInventory): google.cloud.retail.v2alpha.LocalInventory; - - /** - * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. - * @param message LocalInventory message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. - * @param message LocalInventory message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocalInventory message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocalInventory - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.LocalInventory; - - /** - * Decodes a LocalInventory message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocalInventory - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.LocalInventory; - - /** - * Verifies a LocalInventory message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocalInventory + * @returns LocalInventory */ public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.LocalInventory; @@ -15006,6 +15339,96 @@ export namespace google { } } + /** Properties of a Promotion. */ + interface IPromotion { + + /** Promotion promotionId */ + promotionId?: (string|null); + } + + /** Represents a Promotion. */ + class Promotion implements IPromotion { + + /** + * Constructs a new Promotion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPromotion); + + /** Promotion promotionId. */ + public promotionId: string; + + /** + * Creates a new Promotion instance using the specified properties. + * @param [properties] Properties to set + * @returns Promotion instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPromotion): google.cloud.retail.v2alpha.Promotion; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Promotion; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Promotion; + + /** + * Verifies a Promotion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Promotion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Promotion; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Promotion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a UserEvent. */ interface IUserEvent { @@ -15597,63 +16020,210 @@ export namespace google { * @returns Promise */ public getDefaultBranch(request: google.cloud.retail.v2alpha.IGetDefaultBranchRequest): Promise; - } - - namespace CatalogService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse + * Calls GetCompletionConfig. + * @param request GetCompletionConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompletionConfig */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; + public getCompletionConfig(request: google.cloud.retail.v2alpha.IGetCompletionConfigRequest, callback: google.cloud.retail.v2alpha.CatalogService.GetCompletionConfigCallback): void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. - * @param error Error, if any - * @param [response] Catalog + * Calls GetCompletionConfig. + * @param request GetCompletionConfigRequest message or plain object + * @returns Promise */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; + public getCompletionConfig(request: google.cloud.retail.v2alpha.IGetCompletionConfigRequest): Promise; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. - * @param error Error, if any - * @param [response] Empty + * Calls UpdateCompletionConfig. + * @param request UpdateCompletionConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompletionConfig */ - type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public updateCompletionConfig(request: google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfigCallback): void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. - * @param error Error, if any - * @param [response] GetDefaultBranchResponse + * Calls UpdateCompletionConfig. + * @param request UpdateCompletionConfigRequest message or plain object + * @returns Promise */ - type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.GetDefaultBranchResponse) => void; - } - - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { - - /** ListCatalogsRequest parent */ - parent?: (string|null); - - /** ListCatalogsRequest pageSize */ - pageSize?: (number|null); + public updateCompletionConfig(request: google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest): Promise; - /** ListCatalogsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** + * Calls GetAttributesConfig. + * @param request GetAttributesConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public getAttributesConfig(request: google.cloud.retail.v2alpha.IGetAttributesConfigRequest, callback: google.cloud.retail.v2alpha.CatalogService.GetAttributesConfigCallback): void; /** - * Constructs a new ListCatalogsRequest. - * @param [properties] Properties to set + * Calls GetAttributesConfig. + * @param request GetAttributesConfigRequest message or plain object + * @returns Promise */ - constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); + public getAttributesConfig(request: google.cloud.retail.v2alpha.IGetAttributesConfigRequest): Promise; - /** ListCatalogsRequest parent. */ - public parent: string; + /** + * Calls UpdateAttributesConfig. + * @param request UpdateAttributesConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public updateAttributesConfig(request: google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, callback: google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfigCallback): void; + + /** + * Calls UpdateAttributesConfig. + * @param request UpdateAttributesConfigRequest message or plain object + * @returns Promise + */ + public updateAttributesConfig(request: google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest): Promise; + + /** + * Calls AddCatalogAttribute. + * @param request AddCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public addCatalogAttribute(request: google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, callback: google.cloud.retail.v2alpha.CatalogService.AddCatalogAttributeCallback): void; + + /** + * Calls AddCatalogAttribute. + * @param request AddCatalogAttributeRequest message or plain object + * @returns Promise + */ + public addCatalogAttribute(request: google.cloud.retail.v2alpha.IAddCatalogAttributeRequest): Promise; + + /** + * Calls RemoveCatalogAttribute. + * @param request RemoveCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public removeCatalogAttribute(request: google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, callback: google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttributeCallback): void; + + /** + * Calls RemoveCatalogAttribute. + * @param request RemoveCatalogAttributeRequest message or plain object + * @returns Promise + */ + public removeCatalogAttribute(request: google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest): Promise; + + /** + * Calls ReplaceCatalogAttribute. + * @param request ReplaceCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public replaceCatalogAttribute(request: google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, callback: google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttributeCallback): void; + + /** + * Calls ReplaceCatalogAttribute. + * @param request ReplaceCatalogAttributeRequest message or plain object + * @returns Promise + */ + public replaceCatalogAttribute(request: google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest): Promise; + } + + namespace CatalogService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * @param error Error, if any + * @param [response] ListCatalogsResponse + */ + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * @param error Error, if any + * @param [response] Catalog + */ + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.GetDefaultBranchResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getCompletionConfig}. + * @param error Error, if any + * @param [response] CompletionConfig + */ + type GetCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompletionConfig) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCompletionConfig}. + * @param error Error, if any + * @param [response] CompletionConfig + */ + type UpdateCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompletionConfig) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getAttributesConfig}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type GetAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateAttributesConfig}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type UpdateAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#addCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type AddCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#removeCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type RemoveCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#replaceCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type ReplaceCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; + } + + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { + + /** ListCatalogsRequest parent */ + parent?: (string|null); + + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); + + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { + + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListCatalogsRequest); + + /** ListCatalogsRequest parent. */ + public parent: string; /** ListCatalogsRequest pageSize. */ public pageSize: number; @@ -15935,6 +16505,9 @@ export namespace google { /** SetDefaultBranchRequest note */ note?: (string|null); + + /** SetDefaultBranchRequest force */ + force?: (boolean|null); } /** Represents a SetDefaultBranchRequest. */ @@ -15955,6 +16528,9 @@ export namespace google { /** SetDefaultBranchRequest note. */ public note: string; + /** SetDefaultBranchRequest force. */ + public force: boolean; + /** * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set @@ -16218,1937 +16794,5040 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Represents a CompletionService */ - class CompletionService extends $protobuf.rpc.Service { + /** Properties of a GetCompletionConfigRequest. */ + interface IGetCompletionConfigRequest { + + /** GetCompletionConfigRequest name */ + name?: (string|null); + } + + /** Represents a GetCompletionConfigRequest. */ + class GetCompletionConfigRequest implements IGetCompletionConfigRequest { /** - * Constructs a new CompletionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new GetCompletionConfigRequest. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.retail.v2alpha.IGetCompletionConfigRequest); + + /** GetCompletionConfigRequest name. */ + public name: string; /** - * Creates new CompletionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new GetCompletionConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetCompletionConfigRequest instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; + public static create(properties?: google.cloud.retail.v2alpha.IGetCompletionConfigRequest): google.cloud.retail.v2alpha.GetCompletionConfigRequest; /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse + * Encodes the specified GetCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetCompletionConfigRequest.verify|verify} messages. + * @param message GetCompletionConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest, callback: google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback): void; + public static encode(message: google.cloud.retail.v2alpha.IGetCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @returns Promise + * Encodes the specified GetCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetCompletionConfigRequest.verify|verify} messages. + * @param message GetCompletionConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest, callback: google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetCompletionConfigRequest; /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @returns Promise + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest): Promise; - } + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetCompletionConfigRequest; - namespace CompletionService { + /** + * Verifies a GetCompletionConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. - * @param error Error, if any - * @param [response] CompleteQueryResponse + * Creates a GetCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetCompletionConfigRequest */ - type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompleteQueryResponse) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetCompletionConfigRequest; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. - * @param error Error, if any - * @param [response] Operation + * Creates a plain object from a GetCompletionConfigRequest message. Also converts values to other types if specified. + * @param message GetCompletionConfigRequest + * @param [options] Conversion options + * @returns Plain object */ - type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.retail.v2alpha.GetCompletionConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetCompletionConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a CompleteQueryRequest. */ - interface ICompleteQueryRequest { + /** Properties of an UpdateCompletionConfigRequest. */ + interface IUpdateCompletionConfigRequest { - /** CompleteQueryRequest catalog */ - catalog?: (string|null); + /** UpdateCompletionConfigRequest completionConfig */ + completionConfig?: (google.cloud.retail.v2alpha.ICompletionConfig|null); - /** CompleteQueryRequest query */ - query?: (string|null); + /** UpdateCompletionConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } - /** CompleteQueryRequest visitorId */ - visitorId?: (string|null); + /** Represents an UpdateCompletionConfigRequest. */ + class UpdateCompletionConfigRequest implements IUpdateCompletionConfigRequest { - /** CompleteQueryRequest languageCodes */ - languageCodes?: (string[]|null); + /** + * Constructs a new UpdateCompletionConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest); - /** CompleteQueryRequest deviceType */ - deviceType?: (string|null); + /** UpdateCompletionConfigRequest completionConfig. */ + public completionConfig?: (google.cloud.retail.v2alpha.ICompletionConfig|null); - /** CompleteQueryRequest dataset */ - dataset?: (string|null); + /** UpdateCompletionConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** CompleteQueryRequest maxSuggestions */ - maxSuggestions?: (number|null); - } + /** + * Creates a new UpdateCompletionConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCompletionConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest): google.cloud.retail.v2alpha.UpdateCompletionConfigRequest; - /** Represents a CompleteQueryRequest. */ - class CompleteQueryRequest implements ICompleteQueryRequest { + /** + * Encodes the specified UpdateCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCompletionConfigRequest.verify|verify} messages. + * @param message UpdateCompletionConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Constructs a new CompleteQueryRequest. - * @param [properties] Properties to set + * Encodes the specified UpdateCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCompletionConfigRequest.verify|verify} messages. + * @param message UpdateCompletionConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest); + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** CompleteQueryRequest catalog. */ - public catalog: string; + /** + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateCompletionConfigRequest; - /** CompleteQueryRequest query. */ - public query: string; + /** + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCompletionConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateCompletionConfigRequest; - /** CompleteQueryRequest visitorId. */ - public visitorId: string; + /** + * Verifies an UpdateCompletionConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** CompleteQueryRequest languageCodes. */ - public languageCodes: string[]; + /** + * Creates an UpdateCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCompletionConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateCompletionConfigRequest; - /** CompleteQueryRequest deviceType. */ - public deviceType: string; + /** + * Creates a plain object from an UpdateCompletionConfigRequest message. Also converts values to other types if specified. + * @param message UpdateCompletionConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateCompletionConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** CompleteQueryRequest dataset. */ - public dataset: string; + /** + * Converts this UpdateCompletionConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** CompleteQueryRequest maxSuggestions. */ - public maxSuggestions: number; + /** Properties of a GetAttributesConfigRequest. */ + interface IGetAttributesConfigRequest { + + /** GetAttributesConfigRequest name */ + name?: (string|null); + } + + /** Represents a GetAttributesConfigRequest. */ + class GetAttributesConfigRequest implements IGetAttributesConfigRequest { /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Constructs a new GetAttributesConfigRequest. * @param [properties] Properties to set - * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest): google.cloud.retail.v2alpha.CompleteQueryRequest; + constructor(properties?: google.cloud.retail.v2alpha.IGetAttributesConfigRequest); + + /** GetAttributesConfigRequest name. */ + public name: string; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Creates a new GetAttributesConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAttributesConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGetAttributesConfigRequest): google.cloud.retail.v2alpha.GetAttributesConfigRequest; + + /** + * Encodes the specified GetAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetAttributesConfigRequest.verify|verify} messages. + * @param message GetAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IGetAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified GetAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetAttributesConfigRequest.verify|verify} messages. + * @param message GetAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryRequest + * @returns GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetAttributesConfigRequest; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryRequest + * @returns GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetAttributesConfigRequest; /** - * Verifies a CompleteQueryRequest message. + * Verifies a GetAttributesConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryRequest + * @returns GetAttributesConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetAttributesConfigRequest; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. - * @param message CompleteQueryRequest + * Creates a plain object from a GetAttributesConfigRequest message. Also converts values to other types if specified. + * @param message GetAttributesConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.GetAttributesConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this GetAttributesConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CompleteQueryResponse. */ - interface ICompleteQueryResponse { - - /** CompleteQueryResponse completionResults */ - completionResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]|null); + /** Properties of an UpdateAttributesConfigRequest. */ + interface IUpdateAttributesConfigRequest { - /** CompleteQueryResponse attributionToken */ - attributionToken?: (string|null); + /** UpdateAttributesConfigRequest attributesConfig */ + attributesConfig?: (google.cloud.retail.v2alpha.IAttributesConfig|null); - /** CompleteQueryResponse recentSearchResults */ - recentSearchResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]|null); + /** UpdateAttributesConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a CompleteQueryResponse. */ - class CompleteQueryResponse implements ICompleteQueryResponse { + /** Represents an UpdateAttributesConfigRequest. */ + class UpdateAttributesConfigRequest implements IUpdateAttributesConfigRequest { /** - * Constructs a new CompleteQueryResponse. + * Constructs a new UpdateAttributesConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse); - - /** CompleteQueryResponse completionResults. */ - public completionResults: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]; + constructor(properties?: google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest); - /** CompleteQueryResponse attributionToken. */ - public attributionToken: string; + /** UpdateAttributesConfigRequest attributesConfig. */ + public attributesConfig?: (google.cloud.retail.v2alpha.IAttributesConfig|null); - /** CompleteQueryResponse recentSearchResults. */ - public recentSearchResults: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]; + /** UpdateAttributesConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new UpdateAttributesConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryResponse instance + * @returns UpdateAttributesConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse): google.cloud.retail.v2alpha.CompleteQueryResponse; + public static create(properties?: google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest): google.cloud.retail.v2alpha.UpdateAttributesConfigRequest; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified UpdateAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateAttributesConfigRequest.verify|verify} messages. + * @param message UpdateAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified UpdateAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateAttributesConfigRequest.verify|verify} messages. + * @param message UpdateAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryResponse + * @returns UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateAttributesConfigRequest; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryResponse + * @returns UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateAttributesConfigRequest; /** - * Verifies a CompleteQueryResponse message. + * Verifies an UpdateAttributesConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryResponse + * @returns UpdateAttributesConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateAttributesConfigRequest; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. - * @param message CompleteQueryResponse + * Creates a plain object from an UpdateAttributesConfigRequest message. Also converts values to other types if specified. + * @param message UpdateAttributesConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.UpdateAttributesConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this UpdateAttributesConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CompleteQueryResponse { + /** Properties of an AddCatalogAttributeRequest. */ + interface IAddCatalogAttributeRequest { - /** Properties of a CompletionResult. */ - interface ICompletionResult { + /** AddCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); - /** CompletionResult suggestion */ - suggestion?: (string|null); + /** AddCatalogAttributeRequest catalogAttribute */ + catalogAttribute?: (google.cloud.retail.v2alpha.ICatalogAttribute|null); + } - /** CompletionResult attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); - } + /** Represents an AddCatalogAttributeRequest. */ + class AddCatalogAttributeRequest implements IAddCatalogAttributeRequest { - /** Represents a CompletionResult. */ - class CompletionResult implements ICompletionResult { + /** + * Constructs a new AddCatalogAttributeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddCatalogAttributeRequest); - /** - * Constructs a new CompletionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult); + /** AddCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** CompletionResult suggestion. */ - public suggestion: string; + /** AddCatalogAttributeRequest catalogAttribute. */ + public catalogAttribute?: (google.cloud.retail.v2alpha.ICatalogAttribute|null); - /** CompletionResult attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; + /** + * Creates a new AddCatalogAttributeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddCatalogAttributeRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddCatalogAttributeRequest): google.cloud.retail.v2alpha.AddCatalogAttributeRequest; - /** - * Creates a new CompletionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns CompletionResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; + /** + * Encodes the specified AddCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddCatalogAttributeRequest.verify|verify} messages. + * @param message AddCatalogAttributeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - - /** - * Verifies a CompletionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompletionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @param message CompletionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CompletionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a RecentSearchResult. */ - interface IRecentSearchResult { - - /** RecentSearchResult recentSearch */ - recentSearch?: (string|null); - } - - /** Represents a RecentSearchResult. */ - class RecentSearchResult implements IRecentSearchResult { - - /** - * Constructs a new RecentSearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult); - - /** RecentSearchResult recentSearch. */ - public recentSearch: string; - - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns RecentSearchResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; - - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddCatalogAttributeRequest.verify|verify} messages. + * @param message AddCatalogAttributeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddCatalogAttributeRequest; - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddCatalogAttributeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddCatalogAttributeRequest; - /** - * Verifies a RecentSearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies an AddCatalogAttributeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RecentSearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; + /** + * Creates an AddCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddCatalogAttributeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddCatalogAttributeRequest; - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @param message RecentSearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from an AddCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message AddCatalogAttributeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this RecentSearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this AddCatalogAttributeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of an ExportErrorsConfig. */ - interface IExportErrorsConfig { + /** Properties of a RemoveCatalogAttributeRequest. */ + interface IRemoveCatalogAttributeRequest { - /** ExportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); + /** RemoveCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); + + /** RemoveCatalogAttributeRequest key */ + key?: (string|null); } - /** Represents an ExportErrorsConfig. */ - class ExportErrorsConfig implements IExportErrorsConfig { + /** Represents a RemoveCatalogAttributeRequest. */ + class RemoveCatalogAttributeRequest implements IRemoveCatalogAttributeRequest { /** - * Constructs a new ExportErrorsConfig. + * Constructs a new RemoveCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig); + constructor(properties?: google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest); - /** ExportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + /** RemoveCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** ExportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** RemoveCatalogAttributeRequest key. */ + public key: string; /** - * Creates a new ExportErrorsConfig instance using the specified properties. + * Creates a new RemoveCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ExportErrorsConfig instance + * @returns RemoveCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static create(properties?: google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest): google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. - * @param message ExportErrorsConfig message or plain object to encode + * Encodes the specified RemoveCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest.verify|verify} messages. + * @param message RemoveCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. - * @param message ExportErrorsConfig message or plain object to encode + * Encodes the specified RemoveCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest.verify|verify} messages. + * @param message RemoveCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ExportErrorsConfig + * @returns RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ExportErrorsConfig + * @returns RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest; /** - * Verifies an ExportErrorsConfig message. + * Verifies a RemoveCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ExportErrorsConfig + * @returns RemoveCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportErrorsConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. - * @param message ExportErrorsConfig + * Creates a plain object from a RemoveCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message RemoveCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ExportErrorsConfig to JSON. + * Converts this RemoveCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ExportMetadata. */ - interface IExportMetadata { + /** Properties of a ReplaceCatalogAttributeRequest. */ + interface IReplaceCatalogAttributeRequest { - /** ExportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** ReplaceCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); - /** ExportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** ReplaceCatalogAttributeRequest catalogAttribute */ + catalogAttribute?: (google.cloud.retail.v2alpha.ICatalogAttribute|null); + + /** ReplaceCatalogAttributeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents an ExportMetadata. */ - class ExportMetadata implements IExportMetadata { + /** Represents a ReplaceCatalogAttributeRequest. */ + class ReplaceCatalogAttributeRequest implements IReplaceCatalogAttributeRequest { /** - * Constructs a new ExportMetadata. + * Constructs a new ReplaceCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IExportMetadata); + constructor(properties?: google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest); - /** ExportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** ReplaceCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** ExportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** ReplaceCatalogAttributeRequest catalogAttribute. */ + public catalogAttribute?: (google.cloud.retail.v2alpha.ICatalogAttribute|null); + + /** ReplaceCatalogAttributeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new ExportMetadata instance using the specified properties. + * Creates a new ReplaceCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ExportMetadata instance + * @returns ReplaceCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IExportMetadata): google.cloud.retail.v2alpha.ExportMetadata; + public static create(properties?: google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest): google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest; /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. - * @param message ExportMetadata message or plain object to encode + * Encodes the specified ReplaceCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @param message ReplaceCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. - * @param message ExportMetadata message or plain object to encode + * Encodes the specified ReplaceCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @param message ReplaceCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ExportMetadata message from the specified reader or buffer. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ExportMetadata + * @returns ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest; /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ExportMetadata + * @returns ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest; /** - * Verifies an ExportMetadata message. + * Verifies a ReplaceCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ReplaceCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ExportMetadata + * @returns ReplaceCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest; /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. - * @param message ExportMetadata + * Creates a plain object from a ReplaceCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message ReplaceCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ExportMetadata to JSON. + * Converts this ReplaceCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ExportProductsResponse. */ - interface IExportProductsResponse { - - /** ExportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - - /** ExportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); - } - - /** Represents an ExportProductsResponse. */ - class ExportProductsResponse implements IExportProductsResponse { - - /** - * Constructs a new ExportProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IExportProductsResponse); - - /** ExportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; - - /** ExportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { /** - * Creates a new ExportProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportProductsResponse instance + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static create(properties?: google.cloud.retail.v2alpha.IExportProductsResponse): google.cloud.retail.v2alpha.ExportProductsResponse; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. - * @param message ExportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static encode(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. - * @param message ExportProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest, callback: google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback): void; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportProductsResponse; + public completeQuery(request: google.cloud.retail.v2alpha.ICompleteQueryRequest): Promise; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportProductsResponse; + public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest, callback: google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback): void; /** - * Verifies an ExportProductsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public importCompletionData(request: google.cloud.retail.v2alpha.IImportCompletionDataRequest): Promise; + } - /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportProductsResponse; + namespace CompletionService { /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. - * @param message ExportProductsResponse - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse */ - public static toObject(message: google.cloud.retail.v2alpha.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompleteQueryResponse) => void; /** - * Converts this ExportProductsResponse to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of an ExportUserEventsResponse. */ - interface IExportUserEventsResponse { + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { - /** ExportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** CompleteQueryRequest catalog */ + catalog?: (string|null); - /** ExportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** CompleteQueryRequest query */ + query?: (string|null); + + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); } - /** Represents an ExportUserEventsResponse. */ - class ExportUserEventsResponse implements IExportUserEventsResponse { + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { /** - * Constructs a new ExportUserEventsResponse. + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse); + constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest); - /** ExportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** CompleteQueryRequest catalog. */ + public catalog: string; - /** ExportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** CompleteQueryRequest query. */ + public query: string; + + /** CompleteQueryRequest visitorId. */ + public visitorId: string; + + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; + + /** CompleteQueryRequest deviceType. */ + public deviceType: string; + + /** CompleteQueryRequest dataset. */ + public dataset: string; + + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new ExportUserEventsResponse instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ExportUserEventsResponse instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryRequest): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ExportUserEventsResponse + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ExportUserEventsResponse + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ExportUserEventsResponse + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryRequest; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. - * @param message ExportUserEventsResponse + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { - - /** - * Constructs a new PredictionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new PredictionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; - - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse - */ - public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; - - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @returns Promise - */ - public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; - } - - namespace PredictionService { - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. - * @param error Error, if any - * @param [response] PredictResponse - */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; - } - - /** Properties of a PredictRequest. */ - interface IPredictRequest { - - /** PredictRequest placement */ - placement?: (string|null); - - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); - - /** PredictRequest pageSize */ - pageSize?: (number|null); - - /** PredictRequest pageToken */ - pageToken?: (string|null); - - /** PredictRequest filter */ - filter?: (string|null); + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]|null); - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new PredictRequest. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); - - /** PredictRequest placement. */ - public placement: string; - - /** PredictRequest userEvent. */ - public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); - - /** PredictRequest pageSize. */ - public pageSize: number; - - /** PredictRequest pageToken. */ - public pageToken: string; - - /** PredictRequest filter. */ - public filter: string; + constructor(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse); - /** PredictRequest validateOnly. */ - public validateOnly: boolean; + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult[]; - /** PredictRequest params. */ - public params: { [k: string]: google.protobuf.IValue }; + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; - /** PredictRequest labels. */ - public labels: { [k: string]: string }; + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PredictRequest instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; + public static create(properties?: google.cloud.retail.v2alpha.ICompleteQueryResponse): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. - * @param message PredictRequest message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictRequest + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictRequest + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Verifies a PredictRequest message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictRequest + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. - * @param message PredictRequest + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictRequest to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a PredictResponse. */ - interface IPredictResponse { + namespace CompleteQueryResponse { - /** PredictResponse results */ - results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); + /** Properties of a CompletionResult. */ + interface ICompletionResult { - /** PredictResponse attributionToken */ - attributionToken?: (string|null); + /** CompletionResult suggestion */ + suggestion?: (string|null); - /** PredictResponse missingIds */ - missingIds?: (string[]|null); + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }|null); + } - /** PredictResponse validateOnly */ - validateOnly?: (boolean|null); - } + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { - /** Represents a PredictResponse. */ - class PredictResponse implements IPredictResponse { + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult); - /** - * Constructs a new PredictResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); + /** CompletionResult suggestion. */ + public suggestion: string; - /** PredictResponse results. */ - public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2alpha.ICustomAttribute }; - /** PredictResponse attributionToken. */ - public attributionToken: string; + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - /** PredictResponse missingIds. */ - public missingIds: string[]; + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** PredictResponse validateOnly. */ - public validateOnly: boolean; + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new PredictResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PredictResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. - * @param message PredictResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PredictResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PredictResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; - - /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PredictResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; - - /** - * Verifies a PredictResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PredictResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. - * @param message PredictResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this PredictResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult; - namespace PredictResponse { + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Properties of a PredictionResult. */ - interface IPredictionResult { + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** PredictionResult id */ - id?: (string|null); + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { - /** PredictionResult metadata */ - metadata?: ({ [k: string]: google.protobuf.IValue }|null); + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); } - /** Represents a PredictionResult. */ - class PredictionResult implements IPredictionResult { + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { /** - * Constructs a new PredictionResult. + * Constructs a new RecentSearchResult. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); - - /** PredictionResult id. */ - public id: string; + constructor(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult); - /** PredictionResult metadata. */ - public metadata: { [k: string]: google.protobuf.IValue }; + /** RecentSearchResult recentSearch. */ + public recentSearch: string; /** - * Creates a new PredictionResult instance using the specified properties. + * Creates a new RecentSearchResult instance using the specified properties. * @param [properties] Properties to set - * @returns PredictionResult instance + * @returns RecentSearchResult instance */ - public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + public static create(properties?: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. - * @param message PredictionResult message or plain object to encode + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PredictionResult message from the specified reader or buffer. + * Decodes a RecentSearchResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PredictionResult + * @returns RecentSearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PredictionResult + * @returns RecentSearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Verifies a PredictionResult message. + * Verifies a RecentSearchResult message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PredictionResult + * @returns RecentSearchResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult; /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @param message PredictionResult + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PredictionResult to JSON. + * Converts this RecentSearchResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } } - /** Represents a ProductService */ - class ProductService extends $protobuf.rpc.Service { + /** Properties of a Control. */ + interface IControl { + + /** Control facetSpec */ + facetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec|null); + + /** Control rule */ + rule?: (google.cloud.retail.v2alpha.IRule|null); + + /** Control name */ + name?: (string|null); + + /** Control displayName */ + displayName?: (string|null); + + /** Control associatedServingConfigIds */ + associatedServingConfigIds?: (string[]|null); + + /** Control solutionTypes */ + solutionTypes?: (google.cloud.retail.v2alpha.SolutionType[]|null); + + /** Control searchSolutionUseCase */ + searchSolutionUseCase?: (google.cloud.retail.v2alpha.SearchSolutionUseCase[]|null); + } + + /** Represents a Control. */ + class Control implements IControl { /** - * Constructs a new ProductService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new Control. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.retail.v2alpha.IControl); + + /** Control facetSpec. */ + public facetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec|null); + + /** Control rule. */ + public rule?: (google.cloud.retail.v2alpha.IRule|null); + + /** Control name. */ + public name: string; + + /** Control displayName. */ + public displayName: string; + + /** Control associatedServingConfigIds. */ + public associatedServingConfigIds: string[]; + + /** Control solutionTypes. */ + public solutionTypes: google.cloud.retail.v2alpha.SolutionType[]; + + /** Control searchSolutionUseCase. */ + public searchSolutionUseCase: google.cloud.retail.v2alpha.SearchSolutionUseCase[]; + + /** Control control. */ + public control?: ("facetSpec"|"rule"); /** - * Creates new ProductService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new Control instance using the specified properties. + * @param [properties] Properties to set + * @returns Control instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + public static create(properties?: google.cloud.retail.v2alpha.IControl): google.cloud.retail.v2alpha.Control; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Encodes the specified Control message. Does not implicitly {@link google.cloud.retail.v2alpha.Control.verify|verify} messages. + * @param message Control message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; + public static encode(message: google.cloud.retail.v2alpha.IControl, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise + * Encodes the specified Control message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Control.verify|verify} messages. + * @param message Control message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IControl, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Decodes a Control message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Control + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Control; /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise + * Decodes a Control message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Control + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Control; /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsResponse - */ - public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ListProductsCallback): void; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @returns Promise + * Verifies a Control message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest): Promise; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product + * Creates a Control message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Control */ - public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Control; /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise + * Creates a plain object from a Control message. Also converts values to other types if specified. + * @param message Control + * @param [options] Conversion options + * @returns Plain object */ - public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; + public static toObject(message: google.cloud.retail.v2alpha.Control, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Converts this Control to JSON. + * @returns JSON object */ - public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; + public toJSON(): { [k: string]: any }; + } - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise - */ - public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Calls ImportProducts. - * @param request ImportProductsRequest message or plain object - * @returns Promise + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; /** - * Calls SetInventory. - * @param request SetInventoryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse */ - public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest, callback: google.cloud.retail.v2alpha.ProductService.SetInventoryCallback): void; + public search(request: google.cloud.retail.v2alpha.ISearchRequest, callback: google.cloud.retail.v2alpha.SearchService.SearchCallback): void; /** - * Calls SetInventory. - * @param request SetInventoryRequest message or plain object + * Calls Search. + * @param request SearchRequest message or plain object * @returns Promise */ - public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest): Promise; - - /** - * Calls AddFulfillmentPlaces. - * @param request AddFulfillmentPlacesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback): void; + public search(request: google.cloud.retail.v2alpha.ISearchRequest): Promise; + } - /** - * Calls AddFulfillmentPlaces. - * @param request AddFulfillmentPlacesRequest message or plain object - * @returns Promise - */ - public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): Promise; + namespace SearchService { /** - * Calls RemoveFulfillmentPlaces. - * @param request RemoveFulfillmentPlacesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * @param error Error, if any + * @param [response] SearchResponse */ - public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback): void; + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.SearchResponse) => void; + } - /** - * Calls RemoveFulfillmentPlaces. - * @param request RemoveFulfillmentPlacesRequest message or plain object - * @returns Promise - */ - public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; + /** Properties of a SearchRequest. */ + interface ISearchRequest { - /** - * Calls AddLocalInventories. - * @param request AddLocalInventoriesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback): void; + /** SearchRequest placement */ + placement?: (string|null); - /** - * Calls AddLocalInventories. - * @param request AddLocalInventoriesRequest message or plain object - * @returns Promise - */ - public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): Promise; + /** SearchRequest branch */ + branch?: (string|null); - /** - * Calls RemoveLocalInventories. - * @param request RemoveLocalInventoriesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback): void; + /** SearchRequest query */ + query?: (string|null); - /** - * Calls RemoveLocalInventories. - * @param request RemoveLocalInventoriesRequest message or plain object - * @returns Promise - */ - public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): Promise; - } + /** SearchRequest visitorId */ + visitorId?: (string|null); - namespace ProductService { + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. - * @param error Error, if any - * @param [response] Product - */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + /** SearchRequest pageSize */ + pageSize?: (number|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. - * @param error Error, if any - * @param [response] Product - */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + /** SearchRequest pageToken */ + pageToken?: (string|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. - * @param error Error, if any - * @param [response] ListProductsResponse - */ - type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListProductsResponse) => void; + /** SearchRequest offset */ + offset?: (number|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. - * @param error Error, if any - * @param [response] Product - */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + /** SearchRequest filter */ + filter?: (string|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** SearchRequest orderBy */ + orderBy?: (string|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. - * @param error Error, if any - * @param [response] Operation - */ - type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. - * @param error Error, if any - * @param [response] Operation - */ - type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. - * @param error Error, if any - * @param [response] Operation - */ - type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. - * @param error Error, if any - * @param [response] Operation - */ - type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. - * @param error Error, if any - * @param [response] Operation - */ - type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } + /** SearchRequest relevanceThreshold */ + relevanceThreshold?: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null); - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); - /** CreateProductRequest parent */ - parent?: (string|null); + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); - /** CreateProductRequest product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode|null); - /** CreateProductRequest productId */ - productId?: (string|null); + /** SearchRequest personalizationSpec */ + personalizationSpec?: (google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null); } - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { /** - * Constructs a new CreateProductRequest. + * Constructs a new SearchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); + constructor(properties?: google.cloud.retail.v2alpha.ISearchRequest); - /** CreateProductRequest parent. */ - public parent: string; + /** SearchRequest placement. */ + public placement: string; - /** CreateProductRequest product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** SearchRequest branch. */ + public branch: string; - /** CreateProductRequest productId. */ - public productId: string; + /** SearchRequest query. */ + public query: string; - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; + /** SearchRequest visitorId. */ + public visitorId: string; - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchRequest pageSize. */ + public pageSize: number; - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; + /** SearchRequest pageToken. */ + public pageToken: string; - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; + /** SearchRequest offset. */ + public offset: number; - /** - * Verifies a CreateProductRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** SearchRequest filter. */ + public filter: string; - /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** SearchRequest orderBy. */ + public orderBy: string; - /** - * Converts this CreateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]; - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - /** GetProductRequest name */ - name?: (string|null); - } + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); - /** - * Constructs a new GetProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); + /** SearchRequest relevanceThreshold. */ + public relevanceThreshold: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold); - /** GetProductRequest name. */ - public name: string; + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; + + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode); + + /** SearchRequest personalizationSpec. */ + public personalizationSpec?: (google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null); /** - * Creates a new GetProductRequest instance using the specified properties. + * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns GetProductRequest instance + * @returns SearchRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; + public static create(properties?: google.cloud.retail.v2alpha.ISearchRequest): google.cloud.retail.v2alpha.SearchRequest; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetProductRequest + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetProductRequest + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest; /** - * Verifies a GetProductRequest message. + * Verifies a SearchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetProductRequest + * @returns SearchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetProductRequest to JSON. + * Converts this SearchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { + namespace SearchRequest { - /** UpdateProductRequest product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** Properties of a FacetSpec. */ + interface IFacetSpec { - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); - /** UpdateProductRequest allowMissing */ - allowMissing?: (boolean|null); - } + /** FacetSpec limit */ + limit?: (number|null); - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); - /** - * Constructs a new UpdateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } - /** UpdateProductRequest product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec); - /** UpdateProductRequest allowMissing. */ - public allowMissing: boolean; + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; + /** FacetSpec limit. */ + public limit: number; - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; - - /** - * Verifies an UpdateProductRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this UpdateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - /** DeleteProductRequest name */ - name?: (string|null); - } + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Constructs a new DeleteProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - /** DeleteProductRequest name. */ - public name: string; + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductRequest instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + namespace FacetSpec { - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of a FacetKey. */ + interface IFacetKey { - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; + /** FacetKey key */ + key?: (string|null); - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2alpha.IInterval[]|null); - /** - * Verifies a DeleteProductRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); - /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; + /** FacetKey prefixes */ + prefixes?: (string[]|null); - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** FacetKey contains */ + contains?: (string[]|null); - /** - * Converts this DeleteProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** FacetKey orderBy */ + orderBy?: (string|null); - /** Properties of a ListProductsRequest. */ - interface IListProductsRequest { + /** FacetKey query */ + query?: (string|null); + } - /** ListProductsRequest parent */ - parent?: (string|null); + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { - /** ListProductsRequest pageSize */ - pageSize?: (number|null); + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey); - /** ListProductsRequest pageToken */ - pageToken?: (string|null); + /** FacetKey key. */ + public key: string; - /** ListProductsRequest filter */ - filter?: (string|null); + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2alpha.IInterval[]; - /** ListProductsRequest readMask */ - readMask?: (google.protobuf.IFieldMask|null); + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; - /** ListProductsRequest requireTotalSize */ - requireTotalSize?: (boolean|null); - } + /** FacetKey prefixes. */ + public prefixes: string[]; - /** Represents a ListProductsRequest. */ - class ListProductsRequest implements IListProductsRequest { + /** FacetKey contains. */ + public contains: string[]; - /** - * Constructs a new ListProductsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IListProductsRequest); + /** FacetKey orderBy. */ + public orderBy: string; - /** ListProductsRequest parent. */ - public parent: string; + /** FacetKey query. */ + public query: string; - /** ListProductsRequest pageSize. */ - public pageSize: number; + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; - /** ListProductsRequest pageToken. */ - public pageToken: string; + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - /** ListProductsRequest filter. */ - public filter: string; + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; - /** ListProductsRequest readMask. */ + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { + + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null); + } + + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { + + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec); + + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode); + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DynamicFacetSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } + + /** Properties of a BoostSpec. */ + interface IBoostSpec { + + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + + /** BoostSpec skipBoostSpecValidation */ + skipBoostSpecValidation?: (boolean|null); + } + + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { + + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec); + + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]; + + /** BoostSpec skipBoostSpecValidation. */ + public skipBoostSpecValidation?: (boolean|null); + + /** BoostSpec _skipBoostSpecValidation. */ + public _skipBoostSpecValidation?: "skipBoostSpecValidation"; + + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BoostSpec { + + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { + + /** ConditionBoostSpec condition */ + condition?: (string|null); + + /** ConditionBoostSpec boost */ + boost?: (number|null); + } + + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { + + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec); + + /** ConditionBoostSpec condition. */ + public condition: string; + + /** ConditionBoostSpec boost. */ + public boost: number; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { + + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null); + + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); + } + + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { + + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec); + + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition); + + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace QueryExpansionSpec { + + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } + + /** Properties of a PersonalizationSpec. */ + interface IPersonalizationSpec { + + /** PersonalizationSpec mode */ + mode?: (google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode|null); + } + + /** Represents a PersonalizationSpec. */ + class PersonalizationSpec implements IPersonalizationSpec { + + /** + * Constructs a new PersonalizationSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec); + + /** PersonalizationSpec mode. */ + public mode: (google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode); + + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns PersonalizationSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec): google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec; + + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec; + + /** + * Verifies a PersonalizationSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PersonalizationSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec; + + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @param message PersonalizationSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PersonalizationSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PersonalizationSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + AUTO = 1, + DISABLED = 2 + } + } + + /** RelevanceThreshold enum. */ + enum RelevanceThreshold { + RELEVANCE_THRESHOLD_UNSPECIFIED = 0, + HIGH = 1, + MEDIUM = 2, + LOW = 3, + LOWEST = 4 + } + + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } + } + + /** Properties of a SearchResponse. */ + interface ISearchResponse { + + /** SearchResponse results */ + results?: (google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null); + + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2alpha.SearchResponse.IFacet[]|null); + + /** SearchResponse totalSize */ + totalSize?: (number|null); + + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); + + /** SearchResponse attributionToken */ + attributionToken?: (string|null); + + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); + + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri */ + redirectUri?: (string|null); + + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); + + /** SearchResponse invalidConditionBoostSpecs */ + invalidConditionBoostSpecs?: (google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } + + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { + + /** + * Constructs a new SearchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ISearchResponse); + + /** SearchResponse results. */ + public results: google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]; + + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2alpha.SearchResponse.IFacet[]; + + /** SearchResponse totalSize. */ + public totalSize: number; + + /** SearchResponse correctedQuery. */ + public correctedQuery: string; + + /** SearchResponse attributionToken. */ + public attributionToken: string; + + /** SearchResponse nextPageToken. */ + public nextPageToken: string; + + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + + /** SearchResponse redirectUri. */ + public redirectUri: string; + + /** SearchResponse appliedControls. */ + public appliedControls: string[]; + + /** SearchResponse invalidConditionBoostSpecs. */ + public invalidConditionBoostSpecs: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]; + + /** + * Creates a new SearchResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ISearchResponse): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Verifies a SearchResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SearchResponse { + + /** Properties of a SearchResult. */ + interface ISearchResult { + + /** SearchResult id */ + id?: (string|null); + + /** SearchResult product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); + + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { + + /** + * Constructs a new SearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult); + + /** SearchResult id. */ + public id: string; + + /** SearchResult product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; + + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new SearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Verifies a SearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Facet. */ + interface IFacet { + + /** Facet key */ + key?: (string|null); + + /** Facet values */ + values?: (google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]|null); + + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); + } + + /** Represents a Facet. */ + class Facet implements IFacet { + + /** + * Constructs a new Facet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet); + + /** Facet key. */ + public key: string; + + /** Facet values. */ + public values: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]; + + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; + + /** + * Creates a new Facet instance using the specified properties. + * @param [properties] Properties to set + * @returns Facet instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Verifies a Facet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Facet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Facet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Facet { + + /** Properties of a FacetValue. */ + interface IFacetValue { + + /** FacetValue value */ + value?: (string|null); + + /** FacetValue interval */ + interval?: (google.cloud.retail.v2alpha.IInterval|null); + + /** FacetValue count */ + count?: (number|Long|string|null); + } + + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { + + /** + * Constructs a new FacetValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue); + + /** FacetValue value. */ + public value?: (string|null); + + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2alpha.IInterval|null); + + /** FacetValue count. */ + public count: (number|Long|string); + + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); + + /** + * Creates a new FacetValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetValue instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Verifies a FacetValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { + + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); + + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); + } + + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { + + /** + * Constructs a new QueryExpansionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo); + + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; + + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionInfo instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ControlService */ + class ControlService extends $protobuf.rpc.Service { + + /** + * Constructs a new ControlService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ControlService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ControlService; + + /** + * Calls CreateControl. + * @param request CreateControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control + */ + public createControl(request: google.cloud.retail.v2alpha.ICreateControlRequest, callback: google.cloud.retail.v2alpha.ControlService.CreateControlCallback): void; + + /** + * Calls CreateControl. + * @param request CreateControlRequest message or plain object + * @returns Promise + */ + public createControl(request: google.cloud.retail.v2alpha.ICreateControlRequest): Promise; + + /** + * Calls DeleteControl. + * @param request DeleteControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteControl(request: google.cloud.retail.v2alpha.IDeleteControlRequest, callback: google.cloud.retail.v2alpha.ControlService.DeleteControlCallback): void; + + /** + * Calls DeleteControl. + * @param request DeleteControlRequest message or plain object + * @returns Promise + */ + public deleteControl(request: google.cloud.retail.v2alpha.IDeleteControlRequest): Promise; + + /** + * Calls UpdateControl. + * @param request UpdateControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control + */ + public updateControl(request: google.cloud.retail.v2alpha.IUpdateControlRequest, callback: google.cloud.retail.v2alpha.ControlService.UpdateControlCallback): void; + + /** + * Calls UpdateControl. + * @param request UpdateControlRequest message or plain object + * @returns Promise + */ + public updateControl(request: google.cloud.retail.v2alpha.IUpdateControlRequest): Promise; + + /** + * Calls GetControl. + * @param request GetControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control + */ + public getControl(request: google.cloud.retail.v2alpha.IGetControlRequest, callback: google.cloud.retail.v2alpha.ControlService.GetControlCallback): void; + + /** + * Calls GetControl. + * @param request GetControlRequest message or plain object + * @returns Promise + */ + public getControl(request: google.cloud.retail.v2alpha.IGetControlRequest): Promise; + + /** + * Calls ListControls. + * @param request ListControlsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListControlsResponse + */ + public listControls(request: google.cloud.retail.v2alpha.IListControlsRequest, callback: google.cloud.retail.v2alpha.ControlService.ListControlsCallback): void; + + /** + * Calls ListControls. + * @param request ListControlsRequest message or plain object + * @returns Promise + */ + public listControls(request: google.cloud.retail.v2alpha.IListControlsRequest): Promise; + } + + namespace ControlService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#createControl}. + * @param error Error, if any + * @param [response] Control + */ + type CreateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Control) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#deleteControl}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteControlCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#updateControl}. + * @param error Error, if any + * @param [response] Control + */ + type UpdateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Control) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#getControl}. + * @param error Error, if any + * @param [response] Control + */ + type GetControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Control) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#listControls}. + * @param error Error, if any + * @param [response] ListControlsResponse + */ + type ListControlsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListControlsResponse) => void; + } + + /** Properties of a CreateControlRequest. */ + interface ICreateControlRequest { + + /** CreateControlRequest parent */ + parent?: (string|null); + + /** CreateControlRequest control */ + control?: (google.cloud.retail.v2alpha.IControl|null); + + /** CreateControlRequest controlId */ + controlId?: (string|null); + } + + /** Represents a CreateControlRequest. */ + class CreateControlRequest implements ICreateControlRequest { + + /** + * Constructs a new CreateControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateControlRequest); + + /** CreateControlRequest parent. */ + public parent: string; + + /** CreateControlRequest control. */ + public control?: (google.cloud.retail.v2alpha.IControl|null); + + /** CreateControlRequest controlId. */ + public controlId: string; + + /** + * Creates a new CreateControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateControlRequest): google.cloud.retail.v2alpha.CreateControlRequest; + + /** + * Encodes the specified CreateControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateControlRequest.verify|verify} messages. + * @param message CreateControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateControlRequest.verify|verify} messages. + * @param message CreateControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateControlRequest; + + /** + * Decodes a CreateControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateControlRequest; + + /** + * Verifies a CreateControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateControlRequest; + + /** + * Creates a plain object from a CreateControlRequest message. Also converts values to other types if specified. + * @param message CreateControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateControlRequest. */ + interface IUpdateControlRequest { + + /** UpdateControlRequest control */ + control?: (google.cloud.retail.v2alpha.IControl|null); + + /** UpdateControlRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateControlRequest. */ + class UpdateControlRequest implements IUpdateControlRequest { + + /** + * Constructs a new UpdateControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateControlRequest); + + /** UpdateControlRequest control. */ + public control?: (google.cloud.retail.v2alpha.IControl|null); + + /** UpdateControlRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateControlRequest): google.cloud.retail.v2alpha.UpdateControlRequest; + + /** + * Encodes the specified UpdateControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateControlRequest.verify|verify} messages. + * @param message UpdateControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateControlRequest.verify|verify} messages. + * @param message UpdateControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateControlRequest; + + /** + * Decodes an UpdateControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateControlRequest; + + /** + * Verifies an UpdateControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateControlRequest; + + /** + * Creates a plain object from an UpdateControlRequest message. Also converts values to other types if specified. + * @param message UpdateControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteControlRequest. */ + interface IDeleteControlRequest { + + /** DeleteControlRequest name */ + name?: (string|null); + } + + /** Represents a DeleteControlRequest. */ + class DeleteControlRequest implements IDeleteControlRequest { + + /** + * Constructs a new DeleteControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IDeleteControlRequest); + + /** DeleteControlRequest name. */ + public name: string; + + /** + * Creates a new DeleteControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IDeleteControlRequest): google.cloud.retail.v2alpha.DeleteControlRequest; + + /** + * Encodes the specified DeleteControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteControlRequest.verify|verify} messages. + * @param message DeleteControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IDeleteControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteControlRequest.verify|verify} messages. + * @param message DeleteControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteControlRequest; + + /** + * Decodes a DeleteControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteControlRequest; + + /** + * Verifies a DeleteControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteControlRequest; + + /** + * Creates a plain object from a DeleteControlRequest message. Also converts values to other types if specified. + * @param message DeleteControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.DeleteControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetControlRequest. */ + interface IGetControlRequest { + + /** GetControlRequest name */ + name?: (string|null); + } + + /** Represents a GetControlRequest. */ + class GetControlRequest implements IGetControlRequest { + + /** + * Constructs a new GetControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGetControlRequest); + + /** GetControlRequest name. */ + public name: string; + + /** + * Creates a new GetControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGetControlRequest): google.cloud.retail.v2alpha.GetControlRequest; + + /** + * Encodes the specified GetControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetControlRequest.verify|verify} messages. + * @param message GetControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGetControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetControlRequest.verify|verify} messages. + * @param message GetControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetControlRequest; + + /** + * Decodes a GetControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetControlRequest; + + /** + * Verifies a GetControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetControlRequest; + + /** + * Creates a plain object from a GetControlRequest message. Also converts values to other types if specified. + * @param message GetControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GetControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListControlsRequest. */ + interface IListControlsRequest { + + /** ListControlsRequest parent */ + parent?: (string|null); + + /** ListControlsRequest pageSize */ + pageSize?: (number|null); + + /** ListControlsRequest pageToken */ + pageToken?: (string|null); + + /** ListControlsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListControlsRequest. */ + class ListControlsRequest implements IListControlsRequest { + + /** + * Constructs a new ListControlsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListControlsRequest); + + /** ListControlsRequest parent. */ + public parent: string; + + /** ListControlsRequest pageSize. */ + public pageSize: number; + + /** ListControlsRequest pageToken. */ + public pageToken: string; + + /** ListControlsRequest filter. */ + public filter: string; + + /** + * Creates a new ListControlsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListControlsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListControlsRequest): google.cloud.retail.v2alpha.ListControlsRequest; + + /** + * Encodes the specified ListControlsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsRequest.verify|verify} messages. + * @param message ListControlsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListControlsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListControlsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsRequest.verify|verify} messages. + * @param message ListControlsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListControlsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListControlsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListControlsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListControlsRequest; + + /** + * Decodes a ListControlsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListControlsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListControlsRequest; + + /** + * Verifies a ListControlsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListControlsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListControlsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListControlsRequest; + + /** + * Creates a plain object from a ListControlsRequest message. Also converts values to other types if specified. + * @param message ListControlsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListControlsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListControlsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListControlsResponse. */ + interface IListControlsResponse { + + /** ListControlsResponse controls */ + controls?: (google.cloud.retail.v2alpha.IControl[]|null); + + /** ListControlsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListControlsResponse. */ + class ListControlsResponse implements IListControlsResponse { + + /** + * Constructs a new ListControlsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListControlsResponse); + + /** ListControlsResponse controls. */ + public controls: google.cloud.retail.v2alpha.IControl[]; + + /** ListControlsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListControlsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListControlsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListControlsResponse): google.cloud.retail.v2alpha.ListControlsResponse; + + /** + * Encodes the specified ListControlsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsResponse.verify|verify} messages. + * @param message ListControlsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListControlsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListControlsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsResponse.verify|verify} messages. + * @param message ListControlsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListControlsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListControlsResponse; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListControlsResponse; + + /** + * Verifies a ListControlsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListControlsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListControlsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListControlsResponse; + + /** + * Creates a plain object from a ListControlsResponse message. Also converts values to other types if specified. + * @param message ListControlsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListControlsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListControlsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportErrorsConfig. */ + interface IExportErrorsConfig { + + /** ExportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ExportErrorsConfig. */ + class ExportErrorsConfig implements IExportErrorsConfig { + + /** + * Constructs a new ExportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig); + + /** ExportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ExportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IExportErrorsConfig): google.cloud.retail.v2alpha.ExportErrorsConfig; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @param message ExportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportErrorsConfig; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportErrorsConfig; + + /** + * Verifies an ExportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportErrorsConfig; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @param message ExportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ExportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportMetadata. */ + interface IExportMetadata { + + /** ExportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an ExportMetadata. */ + class ExportMetadata implements IExportMetadata { + + /** + * Constructs a new ExportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IExportMetadata); + + /** ExportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ExportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IExportMetadata): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @param message ExportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Verifies an ExportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportMetadata; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @param message ExportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ExportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportProductsResponse. */ + interface IExportProductsResponse { + + /** ExportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + } + + /** Represents an ExportProductsResponse. */ + class ExportProductsResponse implements IExportProductsResponse { + + /** + * Constructs a new ExportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IExportProductsResponse); + + /** ExportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + + /** + * Creates a new ExportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IExportProductsResponse): google.cloud.retail.v2alpha.ExportProductsResponse; + + /** + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @param message ExportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportProductsResponse; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportProductsResponse; + + /** + * Verifies an ExportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportProductsResponse; + + /** + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @param message ExportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ExportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportUserEventsResponse. */ + interface IExportUserEventsResponse { + + /** ExportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ExportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + } + + /** Represents an ExportUserEventsResponse. */ + class ExportUserEventsResponse implements IExportUserEventsResponse { + + /** + * Constructs a new ExportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse); + + /** ExportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ExportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IExportUserEventsResponse): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Verifies an ExportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @param message ExportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { + + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest, callback: google.cloud.retail.v2alpha.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2alpha.IPredictRequest): Promise; + } + + namespace PredictionService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPredictRequest); + + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ + public userEvent?: (google.cloud.retail.v2alpha.IUserEvent|null); + + /** PredictRequest pageSize. */ + public pageSize: number; + + /** PredictRequest pageToken. */ + public pageToken: string; + + /** PredictRequest filter. */ + public filter: string; + + /** PredictRequest validateOnly. */ + public validateOnly: boolean; + + /** PredictRequest params. */ + public params: { [k: string]: google.protobuf.IValue }; + + /** PredictRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPredictRequest): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @param message PredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Verifies a PredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictRequest; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @param message PredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PredictResponse. */ + interface IPredictResponse { + + /** PredictResponse results */ + results?: (google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]|null); + + /** PredictResponse attributionToken */ + attributionToken?: (string|null); + + /** PredictResponse missingIds */ + missingIds?: (string[]|null); + + /** PredictResponse validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a PredictResponse. */ + class PredictResponse implements IPredictResponse { + + /** + * Constructs a new PredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPredictResponse); + + /** PredictResponse results. */ + public results: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult[]; + + /** PredictResponse attributionToken. */ + public attributionToken: string; + + /** PredictResponse missingIds. */ + public missingIds: string[]; + + /** PredictResponse validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPredictResponse): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @param message PredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Verifies a PredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @param message PredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PredictResponse { + + /** Properties of a PredictionResult. */ + interface IPredictionResult { + + /** PredictionResult id */ + id?: (string|null); + + /** PredictionResult metadata */ + metadata?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a PredictionResult. */ + class PredictionResult implements IPredictionResult { + + /** + * Constructs a new PredictionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult); + + /** PredictionResult id. */ + public id: string; + + /** PredictionResult metadata. */ + public metadata: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PredictionResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @param message PredictionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.PredictResponse.IPredictionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Verifies a PredictionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PredictionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PredictResponse.PredictionResult; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @param message PredictionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PredictResponse.PredictionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PredictionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Represents a ProductService */ + class ProductService extends $protobuf.rpc.Service { + + /** + * Constructs a new ProductService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ProductService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ProductService; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.CreateProductCallback): void; + + /** + * Calls CreateProduct. + * @param request CreateProductRequest message or plain object + * @returns Promise + */ + public createProduct(request: google.cloud.retail.v2alpha.ICreateProductRequest): Promise; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest, callback: google.cloud.retail.v2alpha.ProductService.GetProductCallback): void; + + /** + * Calls GetProduct. + * @param request GetProductRequest message or plain object + * @returns Promise + */ + public getProduct(request: google.cloud.retail.v2alpha.IGetProductRequest): Promise; + + /** + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProductsResponse + */ + public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ListProductsCallback): void; + + /** + * Calls ListProducts. + * @param request ListProductsRequest message or plain object + * @returns Promise + */ + public listProducts(request: google.cloud.retail.v2alpha.IListProductsRequest): Promise; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Product + */ + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest, callback: google.cloud.retail.v2alpha.ProductService.UpdateProductCallback): void; + + /** + * Calls UpdateProduct. + * @param request UpdateProductRequest message or plain object + * @returns Promise + */ + public updateProduct(request: google.cloud.retail.v2alpha.IUpdateProductRequest): Promise; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest, callback: google.cloud.retail.v2alpha.ProductService.DeleteProductCallback): void; + + /** + * Calls DeleteProduct. + * @param request DeleteProductRequest message or plain object + * @returns Promise + */ + public deleteProduct(request: google.cloud.retail.v2alpha.IDeleteProductRequest): Promise; + + /** + * Calls PurgeProducts. + * @param request PurgeProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public purgeProducts(request: google.cloud.retail.v2alpha.IPurgeProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.PurgeProductsCallback): void; + + /** + * Calls PurgeProducts. + * @param request PurgeProductsRequest message or plain object + * @returns Promise + */ + public purgeProducts(request: google.cloud.retail.v2alpha.IPurgeProductsRequest): Promise; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest, callback: google.cloud.retail.v2alpha.ProductService.ImportProductsCallback): void; + + /** + * Calls ImportProducts. + * @param request ImportProductsRequest message or plain object + * @returns Promise + */ + public importProducts(request: google.cloud.retail.v2alpha.IImportProductsRequest): Promise; + + /** + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest, callback: google.cloud.retail.v2alpha.ProductService.SetInventoryCallback): void; + + /** + * Calls SetInventory. + * @param request SetInventoryRequest message or plain object + * @returns Promise + */ + public setInventory(request: google.cloud.retail.v2alpha.ISetInventoryRequest): Promise; + + /** + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback): void; + + /** + * Calls AddFulfillmentPlaces. + * @param request AddFulfillmentPlacesRequest message or plain object + * @returns Promise + */ + public addFulfillmentPlaces(request: google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest): Promise; + + /** + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback): void; + + /** + * Calls RemoveFulfillmentPlaces. + * @param request RemoveFulfillmentPlacesRequest message or plain object + * @returns Promise + */ + public removeFulfillmentPlaces(request: google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest): Promise; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback): void; + + /** + * Calls AddLocalInventories. + * @param request AddLocalInventoriesRequest message or plain object + * @returns Promise + */ + public addLocalInventories(request: google.cloud.retail.v2alpha.IAddLocalInventoriesRequest): Promise; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, callback: google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback): void; + + /** + * Calls RemoveLocalInventories. + * @param request RemoveLocalInventoriesRequest message or plain object + * @returns Promise + */ + public removeLocalInventories(request: google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest): Promise; + } + + namespace ProductService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @param error Error, if any + * @param [response] Product + */ + type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @param error Error, if any + * @param [response] Product + */ + type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * @param error Error, if any + * @param [response] ListProductsResponse + */ + type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListProductsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @param error Error, if any + * @param [response] Product + */ + type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#purgeProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type PurgeProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * @param error Error, if any + * @param [response] Operation + */ + type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @param error Error, if any + * @param [response] Operation + */ + type RemoveLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateProductRequest. */ + interface ICreateProductRequest { + + /** CreateProductRequest parent */ + parent?: (string|null); + + /** CreateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** CreateProductRequest productId */ + productId?: (string|null); + } + + /** Represents a CreateProductRequest. */ + class CreateProductRequest implements ICreateProductRequest { + + /** + * Constructs a new CreateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateProductRequest); + + /** CreateProductRequest parent. */ + public parent: string; + + /** CreateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** CreateProductRequest productId. */ + public productId: string; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateProductRequest): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @param message CreateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Verifies a CreateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateProductRequest; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @param message CreateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProductRequest. */ + interface IGetProductRequest { + + /** GetProductRequest name */ + name?: (string|null); + } + + /** Represents a GetProductRequest. */ + class GetProductRequest implements IGetProductRequest { + + /** + * Constructs a new GetProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGetProductRequest); + + /** GetProductRequest name. */ + public name: string; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGetProductRequest): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @param message GetProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Verifies a GetProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetProductRequest; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @param message GetProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProductRequest. */ + interface IUpdateProductRequest { + + /** UpdateProductRequest product */ + product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** UpdateProductRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing */ + allowMissing?: (boolean|null); + } + + /** Represents an UpdateProductRequest. */ + class UpdateProductRequest implements IUpdateProductRequest { + + /** + * Constructs a new UpdateProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest); + + /** UpdateProductRequest product. */ + public product?: (google.cloud.retail.v2alpha.IProduct|null); + + /** UpdateProductRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateProductRequest allowMissing. */ + public allowMissing: boolean; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateProductRequest): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @param message UpdateProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Verifies an UpdateProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateProductRequest; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @param message UpdateProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProductRequest. */ + interface IDeleteProductRequest { + + /** DeleteProductRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProductRequest. */ + class DeleteProductRequest implements IDeleteProductRequest { + + /** + * Constructs a new DeleteProductRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest); + + /** DeleteProductRequest name. */ + public name: string; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProductRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IDeleteProductRequest): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. + * @param message DeleteProductRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Verifies a DeleteProductRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProductRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteProductRequest; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @param message DeleteProductRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProductRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProductsRequest. */ + interface IListProductsRequest { + + /** ListProductsRequest parent */ + parent?: (string|null); + + /** ListProductsRequest pageSize */ + pageSize?: (number|null); + + /** ListProductsRequest pageToken */ + pageToken?: (string|null); + + /** ListProductsRequest filter */ + filter?: (string|null); + + /** ListProductsRequest readMask */ + readMask?: (google.protobuf.IFieldMask|null); + + /** ListProductsRequest requireTotalSize */ + requireTotalSize?: (boolean|null); + } + + /** Represents a ListProductsRequest. */ + class ListProductsRequest implements IListProductsRequest { + + /** + * Constructs a new ListProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListProductsRequest); + + /** ListProductsRequest parent. */ + public parent: string; + + /** ListProductsRequest pageSize. */ + public pageSize: number; + + /** ListProductsRequest pageToken. */ + public pageToken: string; + + /** ListProductsRequest filter. */ + public filter: string; + + /** ListProductsRequest readMask. */ public readMask?: (google.protobuf.IFieldMask|null); /** ListProductsRequest requireTotalSize. */ @@ -19788,22 +23467,328 @@ export namespace google { public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeProductsMetadata. */ + interface IPurgeProductsMetadata { + + /** PurgeProductsMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** PurgeProductsMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** PurgeProductsMetadata successCount */ + successCount?: (number|Long|string|null); + + /** PurgeProductsMetadata failureCount */ + failureCount?: (number|Long|string|null); + } + + /** Represents a PurgeProductsMetadata. */ + class PurgeProductsMetadata implements IPurgeProductsMetadata { + + /** + * Constructs a new PurgeProductsMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeProductsMetadata); + + /** PurgeProductsMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** PurgeProductsMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** PurgeProductsMetadata successCount. */ + public successCount: (number|Long|string); + + /** PurgeProductsMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** + * Creates a new PurgeProductsMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeProductsMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeProductsMetadata): google.cloud.retail.v2alpha.PurgeProductsMetadata; + + /** + * Encodes the specified PurgeProductsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsMetadata.verify|verify} messages. + * @param message PurgeProductsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeProductsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeProductsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsMetadata.verify|verify} messages. + * @param message PurgeProductsMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeProductsMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeProductsMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeProductsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeProductsMetadata; + + /** + * Decodes a PurgeProductsMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeProductsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeProductsMetadata; + + /** + * Verifies a PurgeProductsMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeProductsMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeProductsMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeProductsMetadata; + + /** + * Creates a plain object from a PurgeProductsMetadata message. Also converts values to other types if specified. + * @param message PurgeProductsMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeProductsMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeProductsMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeProductsRequest. */ + interface IPurgeProductsRequest { + + /** PurgeProductsRequest parent */ + parent?: (string|null); + + /** PurgeProductsRequest filter */ + filter?: (string|null); + + /** PurgeProductsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeProductsRequest. */ + class PurgeProductsRequest implements IPurgeProductsRequest { + + /** + * Constructs a new PurgeProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeProductsRequest); + + /** PurgeProductsRequest parent. */ + public parent: string; + + /** PurgeProductsRequest filter. */ + public filter: string; + + /** PurgeProductsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeProductsRequest): google.cloud.retail.v2alpha.PurgeProductsRequest; + + /** + * Encodes the specified PurgeProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsRequest.verify|verify} messages. + * @param message PurgeProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsRequest.verify|verify} messages. + * @param message PurgeProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeProductsRequest; + + /** + * Decodes a PurgeProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeProductsRequest; + + /** + * Verifies a PurgeProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeProductsRequest; + + /** + * Creates a plain object from a PurgeProductsRequest message. Also converts values to other types if specified. + * @param message PurgeProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PurgeProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PurgeProductsResponse. */ + interface IPurgeProductsResponse { + + /** PurgeProductsResponse purgeCount */ + purgeCount?: (number|Long|string|null); + + /** PurgeProductsResponse purgeSample */ + purgeSample?: (string[]|null); + } + + /** Represents a PurgeProductsResponse. */ + class PurgeProductsResponse implements IPurgeProductsResponse { + + /** + * Constructs a new PurgeProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeProductsResponse); + + /** PurgeProductsResponse purgeCount. */ + public purgeCount: (number|Long|string); + + /** PurgeProductsResponse purgeSample. */ + public purgeSample: string[]; + + /** + * Creates a new PurgeProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPurgeProductsResponse): google.cloud.retail.v2alpha.PurgeProductsResponse; + + /** + * Encodes the specified PurgeProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsResponse.verify|verify} messages. + * @param message PurgeProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPurgeProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsResponse.verify|verify} messages. + * @param message PurgeProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeProductsResponse; + + /** + * Decodes a PurgeProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeProductsResponse; + + /** + * Verifies a PurgeProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeProductsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeMetadata + * @returns PurgeProductsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeProductsResponse; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata + * Creates a plain object from a PurgeProductsResponse message. Also converts values to other types if specified. + * @param message PurgeProductsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PurgeProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeMetadata to JSON. + * Converts this PurgeProductsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -19918,1542 +23903,1212 @@ export namespace google { purgedEventsCount?: (number|Long|string|null); } - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { - - /** - * Constructs a new PurgeUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); - - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); - - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance - */ - public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; - - /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; - - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; - - /** - * Verifies a PurgeUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeUserEventsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; - - /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PurgeUserEventsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Represents a SearchService */ - class SearchService extends $protobuf.rpc.Service { - - /** - * Constructs a new SearchService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SearchService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; - - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SearchResponse - */ - public search(request: google.cloud.retail.v2alpha.ISearchRequest, callback: google.cloud.retail.v2alpha.SearchService.SearchCallback): void; - - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @returns Promise - */ - public search(request: google.cloud.retail.v2alpha.ISearchRequest): Promise; - } - - namespace SearchService { - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. - * @param error Error, if any - * @param [response] SearchResponse - */ - type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.SearchResponse) => void; - } - - /** Properties of a SearchRequest. */ - interface ISearchRequest { - - /** SearchRequest placement */ - placement?: (string|null); - - /** SearchRequest branch */ - branch?: (string|null); - - /** SearchRequest query */ - query?: (string|null); - - /** SearchRequest visitorId */ - visitorId?: (string|null); - - /** SearchRequest userInfo */ - userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - - /** SearchRequest pageSize */ - pageSize?: (number|null); - - /** SearchRequest pageToken */ - pageToken?: (string|null); - - /** SearchRequest offset */ - offset?: (number|null); - - /** SearchRequest filter */ - filter?: (string|null); - - /** SearchRequest canonicalFilter */ - canonicalFilter?: (string|null); - - /** SearchRequest orderBy */ - orderBy?: (string|null); - - /** SearchRequest facetSpecs */ - facetSpecs?: (google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]|null); - - /** SearchRequest dynamicFacetSpec */ - dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - - /** SearchRequest boostSpec */ - boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); - - /** SearchRequest queryExpansionSpec */ - queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); - - /** SearchRequest relevanceThreshold */ - relevanceThreshold?: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null); - - /** SearchRequest variantRollupKeys */ - variantRollupKeys?: (string[]|null); - - /** SearchRequest pageCategories */ - pageCategories?: (string[]|null); - - /** SearchRequest searchMode */ - searchMode?: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode|null); - } - - /** Represents a SearchRequest. */ - class SearchRequest implements ISearchRequest { - - /** - * Constructs a new SearchRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.ISearchRequest); - - /** SearchRequest placement. */ - public placement: string; - - /** SearchRequest branch. */ - public branch: string; - - /** SearchRequest query. */ - public query: string; - - /** SearchRequest visitorId. */ - public visitorId: string; - - /** SearchRequest userInfo. */ - public userInfo?: (google.cloud.retail.v2alpha.IUserInfo|null); - - /** SearchRequest pageSize. */ - public pageSize: number; - - /** SearchRequest pageToken. */ - public pageToken: string; - - /** SearchRequest offset. */ - public offset: number; - - /** SearchRequest filter. */ - public filter: string; - - /** SearchRequest canonicalFilter. */ - public canonicalFilter: string; - - /** SearchRequest orderBy. */ - public orderBy: string; - - /** SearchRequest facetSpecs. */ - public facetSpecs: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec[]; - - /** SearchRequest dynamicFacetSpec. */ - public dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - - /** SearchRequest boostSpec. */ - public boostSpec?: (google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null); - - /** SearchRequest queryExpansionSpec. */ - public queryExpansionSpec?: (google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null); - - /** SearchRequest relevanceThreshold. */ - public relevanceThreshold: (google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|keyof typeof google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold); - - /** SearchRequest variantRollupKeys. */ - public variantRollupKeys: string[]; - - /** SearchRequest pageCategories. */ - public pageCategories: string[]; + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { - /** SearchRequest searchMode. */ - public searchMode: (google.cloud.retail.v2alpha.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SearchMode); + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new PurgeUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns SearchRequest instance + * @returns PurgeUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISearchRequest): google.cloud.retail.v2alpha.SearchRequest; + public static create(properties?: google.cloud.retail.v2alpha.IPurgeUserEventsResponse): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchRequest + * @returns PurgeUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Verifies a SearchRequest message. + * Verifies a PurgeUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchRequest + * @returns PurgeUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PurgeUserEventsResponse; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. - * @param message SearchRequest + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchRequest to JSON. + * Converts this PurgeUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchRequest { - - /** Properties of a FacetSpec. */ - interface IFacetSpec { - - /** FacetSpec facetKey */ - facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); - - /** FacetSpec limit */ - limit?: (number|null); - - /** FacetSpec excludedFilterKeys */ - excludedFilterKeys?: (string[]|null); - - /** FacetSpec enableDynamicPosition */ - enableDynamicPosition?: (boolean|null); - } - - /** Represents a FacetSpec. */ - class FacetSpec implements IFacetSpec { - - /** - * Constructs a new FacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec); - - /** FacetSpec facetKey. */ - public facetKey?: (google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null); - - /** FacetSpec limit. */ - public limit: number; - - /** FacetSpec excludedFilterKeys. */ - public excludedFilterKeys: string[]; - - /** FacetSpec enableDynamicPosition. */ - public enableDynamicPosition: boolean; - - /** - * Creates a new FacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; - - /** - * Verifies a FacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec; + /** Properties of a ServingConfig. */ + interface IServingConfig { - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @param message FacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ServingConfig name */ + name?: (string|null); - /** - * Converts this FacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** ServingConfig displayName */ + displayName?: (string|null); - namespace FacetSpec { + /** ServingConfig modelId */ + modelId?: (string|null); - /** Properties of a FacetKey. */ - interface IFacetKey { + /** ServingConfig priceRerankingLevel */ + priceRerankingLevel?: (string|null); - /** FacetKey key */ - key?: (string|null); + /** ServingConfig facetControlIds */ + facetControlIds?: (string[]|null); - /** FacetKey intervals */ - intervals?: (google.cloud.retail.v2alpha.IInterval[]|null); + /** ServingConfig dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - /** FacetKey restrictedValues */ - restrictedValues?: (string[]|null); + /** ServingConfig boostControlIds */ + boostControlIds?: (string[]|null); - /** FacetKey prefixes */ - prefixes?: (string[]|null); + /** ServingConfig filterControlIds */ + filterControlIds?: (string[]|null); - /** FacetKey contains */ - contains?: (string[]|null); + /** ServingConfig redirectControlIds */ + redirectControlIds?: (string[]|null); - /** FacetKey orderBy */ - orderBy?: (string|null); + /** ServingConfig twowaySynonymsControlIds */ + twowaySynonymsControlIds?: (string[]|null); - /** FacetKey query */ - query?: (string|null); - } + /** ServingConfig onewaySynonymsControlIds */ + onewaySynonymsControlIds?: (string[]|null); - /** Represents a FacetKey. */ - class FacetKey implements IFacetKey { + /** ServingConfig doNotAssociateControlIds */ + doNotAssociateControlIds?: (string[]|null); - /** - * Constructs a new FacetKey. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey); + /** ServingConfig replacementControlIds */ + replacementControlIds?: (string[]|null); - /** FacetKey key. */ - public key: string; + /** ServingConfig ignoreControlIds */ + ignoreControlIds?: (string[]|null); - /** FacetKey intervals. */ - public intervals: google.cloud.retail.v2alpha.IInterval[]; + /** ServingConfig diversityLevel */ + diversityLevel?: (string|null); - /** FacetKey restrictedValues. */ - public restrictedValues: string[]; + /** ServingConfig enableCategoryFilterLevel */ + enableCategoryFilterLevel?: (string|null); - /** FacetKey prefixes. */ - public prefixes: string[]; + /** ServingConfig solutionTypes */ + solutionTypes?: (google.cloud.retail.v2alpha.SolutionType[]|null); + } - /** FacetKey contains. */ - public contains: string[]; + /** Represents a ServingConfig. */ + class ServingConfig implements IServingConfig { - /** FacetKey orderBy. */ - public orderBy: string; + /** + * Constructs a new ServingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IServingConfig); - /** FacetKey query. */ - public query: string; + /** ServingConfig name. */ + public name: string; - /** - * Creates a new FacetKey instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetKey instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + /** ServingConfig displayName. */ + public displayName: string; - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** ServingConfig modelId. */ + public modelId: string; - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** ServingConfig priceRerankingLevel. */ + public priceRerankingLevel: string; - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + /** ServingConfig facetControlIds. */ + public facetControlIds: string[]; - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + /** ServingConfig dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null); - /** - * Verifies a FacetKey message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** ServingConfig boostControlIds. */ + public boostControlIds: string[]; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetKey - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey; + /** ServingConfig filterControlIds. */ + public filterControlIds: string[]; - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @param message FacetKey - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ServingConfig redirectControlIds. */ + public redirectControlIds: string[]; - /** - * Converts this FacetKey to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** ServingConfig twowaySynonymsControlIds. */ + public twowaySynonymsControlIds: string[]; - /** Properties of a DynamicFacetSpec. */ - interface IDynamicFacetSpec { + /** ServingConfig onewaySynonymsControlIds. */ + public onewaySynonymsControlIds: string[]; - /** DynamicFacetSpec mode */ - mode?: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null); - } + /** ServingConfig doNotAssociateControlIds. */ + public doNotAssociateControlIds: string[]; - /** Represents a DynamicFacetSpec. */ - class DynamicFacetSpec implements IDynamicFacetSpec { + /** ServingConfig replacementControlIds. */ + public replacementControlIds: string[]; - /** - * Constructs a new DynamicFacetSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec); + /** ServingConfig ignoreControlIds. */ + public ignoreControlIds: string[]; - /** DynamicFacetSpec mode. */ - public mode: (google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode); + /** ServingConfig diversityLevel. */ + public diversityLevel: string; - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns DynamicFacetSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + /** ServingConfig enableCategoryFilterLevel. */ + public enableCategoryFilterLevel: string; - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** ServingConfig solutionTypes. */ + public solutionTypes: google.cloud.retail.v2alpha.SolutionType[]; - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new ServingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServingConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IServingConfig): google.cloud.retail.v2alpha.ServingConfig; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + /** + * Encodes the specified ServingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ServingConfig.verify|verify} messages. + * @param message ServingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IServingConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + /** + * Encodes the specified ServingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ServingConfig.verify|verify} messages. + * @param message ServingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IServingConfig, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a DynamicFacetSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a ServingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ServingConfig; - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DynamicFacetSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec; + /** + * Decodes a ServingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ServingConfig; - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @param message DynamicFacetSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a ServingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this DynamicFacetSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a ServingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ServingConfig; - namespace DynamicFacetSpec { + /** + * Creates a plain object from a ServingConfig message. Also converts values to other types if specified. + * @param message ServingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ServingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - DISABLED = 1, - ENABLED = 2 - } - } + /** + * Converts this ServingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of a BoostSpec. */ - interface IBoostSpec { + /** Represents a ServingConfigService */ + class ServingConfigService extends $protobuf.rpc.Service { - /** BoostSpec conditionBoostSpecs */ - conditionBoostSpecs?: (google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); - } + /** + * Constructs a new ServingConfigService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** Represents a BoostSpec. */ - class BoostSpec implements IBoostSpec { + /** + * Creates new ServingConfigService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ServingConfigService; - /** - * Constructs a new BoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec); + /** + * Calls CreateServingConfig. + * @param request CreateServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public createServingConfig(request: google.cloud.retail.v2alpha.ICreateServingConfigRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfigCallback): void; - /** BoostSpec conditionBoostSpecs. */ - public conditionBoostSpecs: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec[]; + /** + * Calls CreateServingConfig. + * @param request CreateServingConfigRequest message or plain object + * @returns Promise + */ + public createServingConfig(request: google.cloud.retail.v2alpha.ICreateServingConfigRequest): Promise; - /** - * Creates a new BoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns BoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** + * Calls DeleteServingConfig. + * @param request DeleteServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteServingConfig(request: google.cloud.retail.v2alpha.IDeleteServingConfigRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfigCallback): void; - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Calls DeleteServingConfig. + * @param request DeleteServingConfigRequest message or plain object + * @returns Promise + */ + public deleteServingConfig(request: google.cloud.retail.v2alpha.IDeleteServingConfigRequest): Promise; - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Calls UpdateServingConfig. + * @param request UpdateServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public updateServingConfig(request: google.cloud.retail.v2alpha.IUpdateServingConfigRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfigCallback): void; - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** + * Calls UpdateServingConfig. + * @param request UpdateServingConfigRequest message or plain object + * @returns Promise + */ + public updateServingConfig(request: google.cloud.retail.v2alpha.IUpdateServingConfigRequest): Promise; - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** + * Calls GetServingConfig. + * @param request GetServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public getServingConfig(request: google.cloud.retail.v2alpha.IGetServingConfigRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.GetServingConfigCallback): void; - /** - * Verifies a BoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Calls GetServingConfig. + * @param request GetServingConfigRequest message or plain object + * @returns Promise + */ + public getServingConfig(request: google.cloud.retail.v2alpha.IGetServingConfigRequest): Promise; - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec; + /** + * Calls ListServingConfigs. + * @param request ListServingConfigsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListServingConfigsResponse + */ + public listServingConfigs(request: google.cloud.retail.v2alpha.IListServingConfigsRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigsCallback): void; - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @param message BoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Calls ListServingConfigs. + * @param request ListServingConfigsRequest message or plain object + * @returns Promise + */ + public listServingConfigs(request: google.cloud.retail.v2alpha.IListServingConfigsRequest): Promise; - /** - * Converts this BoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Calls AddControl. + * @param request AddControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public addControl(request: google.cloud.retail.v2alpha.IAddControlRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.AddControlCallback): void; - namespace BoostSpec { + /** + * Calls AddControl. + * @param request AddControlRequest message or plain object + * @returns Promise + */ + public addControl(request: google.cloud.retail.v2alpha.IAddControlRequest): Promise; - /** Properties of a ConditionBoostSpec. */ - interface IConditionBoostSpec { + /** + * Calls RemoveControl. + * @param request RemoveControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public removeControl(request: google.cloud.retail.v2alpha.IRemoveControlRequest, callback: google.cloud.retail.v2alpha.ServingConfigService.RemoveControlCallback): void; - /** ConditionBoostSpec condition */ - condition?: (string|null); + /** + * Calls RemoveControl. + * @param request RemoveControlRequest message or plain object + * @returns Promise + */ + public removeControl(request: google.cloud.retail.v2alpha.IRemoveControlRequest): Promise; + } - /** ConditionBoostSpec boost */ - boost?: (number|null); - } + namespace ServingConfigService { - /** Represents a ConditionBoostSpec. */ - class ConditionBoostSpec implements IConditionBoostSpec { + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#createServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type CreateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; - /** - * Constructs a new ConditionBoostSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec); + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#deleteServingConfig}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteServingConfigCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - /** ConditionBoostSpec condition. */ - public condition: string; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#updateServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type UpdateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; - /** ConditionBoostSpec boost. */ - public boost: number; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#getServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type GetServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns ConditionBoostSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#listServingConfigs}. + * @param error Error, if any + * @param [response] ListServingConfigsResponse + */ + type ListServingConfigsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListServingConfigsResponse) => void; - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#addControl}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type AddControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#removeControl}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type RemoveControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; + } - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** Properties of a CreateServingConfigRequest. */ + interface ICreateServingConfigRequest { - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** CreateServingConfigRequest parent */ + parent?: (string|null); - /** - * Verifies a ConditionBoostSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** CreateServingConfigRequest servingConfig */ + servingConfig?: (google.cloud.retail.v2alpha.IServingConfig|null); - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConditionBoostSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec; + /** CreateServingConfigRequest servingConfigId */ + servingConfigId?: (string|null); + } - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @param message ConditionBoostSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** Represents a CreateServingConfigRequest. */ + class CreateServingConfigRequest implements ICreateServingConfigRequest { - /** - * Converts this ConditionBoostSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Constructs a new CreateServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateServingConfigRequest); - /** Properties of a QueryExpansionSpec. */ - interface IQueryExpansionSpec { + /** CreateServingConfigRequest parent. */ + public parent: string; - /** QueryExpansionSpec condition */ - condition?: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null); + /** CreateServingConfigRequest servingConfig. */ + public servingConfig?: (google.cloud.retail.v2alpha.IServingConfig|null); - /** QueryExpansionSpec pinUnexpandedResults */ - pinUnexpandedResults?: (boolean|null); - } + /** CreateServingConfigRequest servingConfigId. */ + public servingConfigId: string; - /** Represents a QueryExpansionSpec. */ - class QueryExpansionSpec implements IQueryExpansionSpec { + /** + * Creates a new CreateServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateServingConfigRequest): google.cloud.retail.v2alpha.CreateServingConfigRequest; - /** - * Constructs a new QueryExpansionSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec); + /** + * Encodes the specified CreateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateServingConfigRequest.verify|verify} messages. + * @param message CreateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** QueryExpansionSpec condition. */ - public condition: (google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition); + /** + * Encodes the specified CreateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateServingConfigRequest.verify|verify} messages. + * @param message CreateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** QueryExpansionSpec pinUnexpandedResults. */ - public pinUnexpandedResults: boolean; + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateServingConfigRequest; - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionSpec instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateServingConfigRequest; - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a CreateServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a CreateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateServingConfigRequest; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** + * Creates a plain object from a CreateServingConfigRequest message. Also converts values to other types if specified. + * @param message CreateServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** + * Converts this CreateServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Verifies a QueryExpansionSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Properties of an UpdateServingConfigRequest. */ + interface IUpdateServingConfigRequest { - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec; + /** UpdateServingConfigRequest servingConfig */ + servingConfig?: (google.cloud.retail.v2alpha.IServingConfig|null); - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @param message QueryExpansionSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** UpdateServingConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } - /** - * Converts this QueryExpansionSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** Represents an UpdateServingConfigRequest. */ + class UpdateServingConfigRequest implements IUpdateServingConfigRequest { - namespace QueryExpansionSpec { + /** + * Constructs a new UpdateServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateServingConfigRequest); - /** Condition enum. */ - enum Condition { - CONDITION_UNSPECIFIED = 0, - DISABLED = 1, - AUTO = 3 - } - } + /** UpdateServingConfigRequest servingConfig. */ + public servingConfig?: (google.cloud.retail.v2alpha.IServingConfig|null); - /** RelevanceThreshold enum. */ - enum RelevanceThreshold { - RELEVANCE_THRESHOLD_UNSPECIFIED = 0, - HIGH = 1, - MEDIUM = 2, - LOW = 3, - LOWEST = 4 - } + /** UpdateServingConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** SearchMode enum. */ - enum SearchMode { - SEARCH_MODE_UNSPECIFIED = 0, - PRODUCT_SEARCH_ONLY = 1, - FACETED_SEARCH_ONLY = 2 - } - } + /** + * Creates a new UpdateServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateServingConfigRequest): google.cloud.retail.v2alpha.UpdateServingConfigRequest; - /** Properties of a SearchResponse. */ - interface ISearchResponse { + /** + * Encodes the specified UpdateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateServingConfigRequest.verify|verify} messages. + * @param message UpdateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchResponse results */ - results?: (google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null); + /** + * Encodes the specified UpdateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateServingConfigRequest.verify|verify} messages. + * @param message UpdateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchResponse facets */ - facets?: (google.cloud.retail.v2alpha.SearchResponse.IFacet[]|null); + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateServingConfigRequest; - /** SearchResponse totalSize */ - totalSize?: (number|null); + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateServingConfigRequest; - /** SearchResponse correctedQuery */ - correctedQuery?: (string|null); + /** + * Verifies an UpdateServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchResponse attributionToken */ - attributionToken?: (string|null); + /** + * Creates an UpdateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateServingConfigRequest; - /** SearchResponse nextPageToken */ - nextPageToken?: (string|null); + /** + * Creates a plain object from an UpdateServingConfigRequest message. Also converts values to other types if specified. + * @param message UpdateServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResponse queryExpansionInfo */ - queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); + /** + * Converts this UpdateServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** SearchResponse redirectUri */ - redirectUri?: (string|null); + /** Properties of a DeleteServingConfigRequest. */ + interface IDeleteServingConfigRequest { - /** SearchResponse appliedControls */ - appliedControls?: (string[]|null); + /** DeleteServingConfigRequest name */ + name?: (string|null); } - /** Represents a SearchResponse. */ - class SearchResponse implements ISearchResponse { + /** Represents a DeleteServingConfigRequest. */ + class DeleteServingConfigRequest implements IDeleteServingConfigRequest { /** - * Constructs a new SearchResponse. + * Constructs a new DeleteServingConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2alpha.ISearchResponse); - - /** SearchResponse results. */ - public results: google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]; - - /** SearchResponse facets. */ - public facets: google.cloud.retail.v2alpha.SearchResponse.IFacet[]; - - /** SearchResponse totalSize. */ - public totalSize: number; - - /** SearchResponse correctedQuery. */ - public correctedQuery: string; - - /** SearchResponse attributionToken. */ - public attributionToken: string; - - /** SearchResponse nextPageToken. */ - public nextPageToken: string; - - /** SearchResponse queryExpansionInfo. */ - public queryExpansionInfo?: (google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null); - - /** SearchResponse redirectUri. */ - public redirectUri: string; + constructor(properties?: google.cloud.retail.v2alpha.IDeleteServingConfigRequest); - /** SearchResponse appliedControls. */ - public appliedControls: string[]; + /** DeleteServingConfigRequest name. */ + public name: string; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new DeleteServingConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns SearchResponse instance + * @returns DeleteServingConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2alpha.ISearchResponse): google.cloud.retail.v2alpha.SearchResponse; + public static create(properties?: google.cloud.retail.v2alpha.IDeleteServingConfigRequest): google.cloud.retail.v2alpha.DeleteServingConfigRequest; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified DeleteServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteServingConfigRequest.verify|verify} messages. + * @param message DeleteServingConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IDeleteServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified DeleteServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteServingConfigRequest.verify|verify} messages. + * @param message DeleteServingConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchResponse + * @returns DeleteServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteServingConfigRequest; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchResponse + * @returns DeleteServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteServingConfigRequest; /** - * Verifies a SearchResponse message. + * Verifies a DeleteServingConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteServingConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchResponse + * @returns DeleteServingConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteServingConfigRequest; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. - * @param message SearchResponse + * Creates a plain object from a DeleteServingConfigRequest message. Also converts values to other types if specified. + * @param message DeleteServingConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.DeleteServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchResponse to JSON. + * Converts this DeleteServingConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace SearchResponse { + /** Properties of a GetServingConfigRequest. */ + interface IGetServingConfigRequest { - /** Properties of a SearchResult. */ - interface ISearchResult { + /** GetServingConfigRequest name */ + name?: (string|null); + } - /** SearchResult id */ - id?: (string|null); + /** Represents a GetServingConfigRequest. */ + class GetServingConfigRequest implements IGetServingConfigRequest { - /** SearchResult product */ - product?: (google.cloud.retail.v2alpha.IProduct|null); + /** + * Constructs a new GetServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IGetServingConfigRequest); - /** SearchResult matchingVariantCount */ - matchingVariantCount?: (number|null); + /** GetServingConfigRequest name. */ + public name: string; - /** SearchResult matchingVariantFields */ - matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + /** + * Creates a new GetServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IGetServingConfigRequest): google.cloud.retail.v2alpha.GetServingConfigRequest; - /** SearchResult variantRollupValues */ - variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); - } + /** + * Encodes the specified GetServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetServingConfigRequest.verify|verify} messages. + * @param message GetServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IGetServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a SearchResult. */ - class SearchResult implements ISearchResult { + /** + * Encodes the specified GetServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetServingConfigRequest.verify|verify} messages. + * @param message GetServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IGetServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new SearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult); + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.GetServingConfigRequest; - /** SearchResult id. */ - public id: string; + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.GetServingConfigRequest; - /** SearchResult product. */ - public product?: (google.cloud.retail.v2alpha.IProduct|null); + /** + * Verifies a GetServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchResult matchingVariantCount. */ - public matchingVariantCount: number; + /** + * Creates a GetServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.GetServingConfigRequest; - /** SearchResult matchingVariantFields. */ - public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + /** + * Creates a plain object from a GetServingConfigRequest message. Also converts values to other types if specified. + * @param message GetServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.GetServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResult variantRollupValues. */ - public variantRollupValues: { [k: string]: google.protobuf.IValue }; + /** + * Converts this GetServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a new SearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns SearchResult instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.ISearchResult): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** Properties of a ListServingConfigsRequest. */ + interface IListServingConfigsRequest { - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** ListServingConfigsRequest parent */ + parent?: (string|null); - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** ListServingConfigsRequest pageSize */ + pageSize?: (number|null); - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** ListServingConfigsRequest pageToken */ + pageToken?: (string|null); + } - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** Represents a ListServingConfigsRequest. */ + class ListServingConfigsRequest implements IListServingConfigsRequest { - /** - * Verifies a SearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Constructs a new ListServingConfigsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListServingConfigsRequest); - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.SearchResult; + /** ListServingConfigsRequest parent. */ + public parent: string; - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @param message SearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ListServingConfigsRequest pageSize. */ + public pageSize: number; + + /** ListServingConfigsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListServingConfigsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServingConfigsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListServingConfigsRequest): google.cloud.retail.v2alpha.ListServingConfigsRequest; + + /** + * Encodes the specified ListServingConfigsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsRequest.verify|verify} messages. + * @param message ListServingConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListServingConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Converts this SearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Encodes the specified ListServingConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsRequest.verify|verify} messages. + * @param message ListServingConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListServingConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a Facet. */ - interface IFacet { + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListServingConfigsRequest; - /** Facet key */ - key?: (string|null); + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListServingConfigsRequest; - /** Facet values */ - values?: (google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]|null); + /** + * Verifies a ListServingConfigsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Facet dynamicFacet */ - dynamicFacet?: (boolean|null); - } + /** + * Creates a ListServingConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServingConfigsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListServingConfigsRequest; - /** Represents a Facet. */ - class Facet implements IFacet { + /** + * Creates a plain object from a ListServingConfigsRequest message. Also converts values to other types if specified. + * @param message ListServingConfigsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListServingConfigsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Constructs a new Facet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet); + /** + * Converts this ListServingConfigsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Facet key. */ - public key: string; + /** Properties of a ListServingConfigsResponse. */ + interface IListServingConfigsResponse { - /** Facet values. */ - public values: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue[]; + /** ListServingConfigsResponse servingConfigs */ + servingConfigs?: (google.cloud.retail.v2alpha.IServingConfig[]|null); - /** Facet dynamicFacet. */ - public dynamicFacet: boolean; + /** ListServingConfigsResponse nextPageToken */ + nextPageToken?: (string|null); + } - /** - * Creates a new Facet instance using the specified properties. - * @param [properties] Properties to set - * @returns Facet instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IFacet): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** Represents a ListServingConfigsResponse. */ + class ListServingConfigsResponse implements IListServingConfigsResponse { - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new ListServingConfigsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListServingConfigsResponse); - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** ListServingConfigsResponse servingConfigs. */ + public servingConfigs: google.cloud.retail.v2alpha.IServingConfig[]; - /** - * Decodes a Facet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** ListServingConfigsResponse nextPageToken. */ + public nextPageToken: string; - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** + * Creates a new ListServingConfigsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServingConfigsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListServingConfigsResponse): google.cloud.retail.v2alpha.ListServingConfigsResponse; - /** - * Verifies a Facet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified ListServingConfigsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsResponse.verify|verify} messages. + * @param message ListServingConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListServingConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Facet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet; + /** + * Encodes the specified ListServingConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsResponse.verify|verify} messages. + * @param message ListServingConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListServingConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @param message Facet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListServingConfigsResponse; - /** - * Converts this Facet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListServingConfigsResponse; - namespace Facet { + /** + * Verifies a ListServingConfigsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of a FacetValue. */ - interface IFacetValue { + /** + * Creates a ListServingConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServingConfigsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListServingConfigsResponse; - /** FacetValue value */ - value?: (string|null); + /** + * Creates a plain object from a ListServingConfigsResponse message. Also converts values to other types if specified. + * @param message ListServingConfigsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListServingConfigsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** FacetValue interval */ - interval?: (google.cloud.retail.v2alpha.IInterval|null); + /** + * Converts this ListServingConfigsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** FacetValue count */ - count?: (number|Long|string|null); - } + /** Properties of an AddControlRequest. */ + interface IAddControlRequest { - /** Represents a FacetValue. */ - class FacetValue implements IFacetValue { + /** AddControlRequest servingConfig */ + servingConfig?: (string|null); - /** - * Constructs a new FacetValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue); + /** AddControlRequest controlId */ + controlId?: (string|null); + } - /** FacetValue value. */ - public value?: (string|null); + /** Represents an AddControlRequest. */ + class AddControlRequest implements IAddControlRequest { - /** FacetValue interval. */ - public interval?: (google.cloud.retail.v2alpha.IInterval|null); + /** + * Constructs a new AddControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IAddControlRequest); - /** FacetValue count. */ - public count: (number|Long|string); + /** AddControlRequest servingConfig. */ + public servingConfig: string; - /** FacetValue facetValue. */ - public facetValue?: ("value"|"interval"); + /** AddControlRequest controlId. */ + public controlId: string; - /** - * Creates a new FacetValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetValue instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** + * Creates a new AddControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IAddControlRequest): google.cloud.retail.v2alpha.AddControlRequest; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddControlRequest.verify|verify} messages. + * @param message AddControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IAddControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddControlRequest.verify|verify} messages. + * @param message AddControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IAddControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** + * Decodes an AddControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.AddControlRequest; - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** + * Decodes an AddControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.AddControlRequest; - /** - * Verifies a FacetValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies an AddControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue; + /** + * Creates an AddControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.AddControlRequest; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @param message FacetValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from an AddControlRequest message. Also converts values to other types if specified. + * @param message AddControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.AddControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this FacetValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - } + /** + * Converts this AddControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Properties of a QueryExpansionInfo. */ - interface IQueryExpansionInfo { + /** Properties of a RemoveControlRequest. */ + interface IRemoveControlRequest { - /** QueryExpansionInfo expandedQuery */ - expandedQuery?: (boolean|null); + /** RemoveControlRequest servingConfig */ + servingConfig?: (string|null); - /** QueryExpansionInfo pinnedResultCount */ - pinnedResultCount?: (number|Long|string|null); - } + /** RemoveControlRequest controlId */ + controlId?: (string|null); + } - /** Represents a QueryExpansionInfo. */ - class QueryExpansionInfo implements IQueryExpansionInfo { + /** Represents a RemoveControlRequest. */ + class RemoveControlRequest implements IRemoveControlRequest { - /** - * Constructs a new QueryExpansionInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo); + /** + * Constructs a new RemoveControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IRemoveControlRequest); - /** QueryExpansionInfo expandedQuery. */ - public expandedQuery: boolean; + /** RemoveControlRequest servingConfig. */ + public servingConfig: string; - /** QueryExpansionInfo pinnedResultCount. */ - public pinnedResultCount: (number|Long|string); + /** RemoveControlRequest controlId. */ + public controlId: string; - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionInfo instance - */ - public static create(properties?: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** + * Creates a new RemoveControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IRemoveControlRequest): google.cloud.retail.v2alpha.RemoveControlRequest; - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified RemoveControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveControlRequest.verify|verify} messages. + * @param message RemoveControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IRemoveControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified RemoveControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveControlRequest.verify|verify} messages. + * @param message RemoveControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IRemoveControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.RemoveControlRequest; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.RemoveControlRequest; - /** - * Verifies a QueryExpansionInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a RemoveControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo; + /** + * Creates a RemoveControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.RemoveControlRequest; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @param message QueryExpansionInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a RemoveControlRequest message. Also converts values to other types if specified. + * @param message RemoveControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.RemoveControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this QueryExpansionInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this RemoveControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } /** Represents a UserEventService */ diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index b4e3120af83..6fbed5b5c5a 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -25292,29 +25292,29 @@ return ProductLevelConfig; })(); - v2alpha.MerchantCenterLink = (function() { + v2alpha.CatalogAttribute = (function() { /** - * Properties of a MerchantCenterLink. + * Properties of a CatalogAttribute. * @memberof google.cloud.retail.v2alpha - * @interface IMerchantCenterLink - * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId - * @property {string|null} [branchId] MerchantCenterLink branchId - * @property {Array.|null} [destinations] MerchantCenterLink destinations - * @property {string|null} [regionCode] MerchantCenterLink regionCode - * @property {string|null} [languageCode] MerchantCenterLink languageCode + * @interface ICatalogAttribute + * @property {string|null} [key] CatalogAttribute key + * @property {boolean|null} [inUse] CatalogAttribute inUse + * @property {google.cloud.retail.v2alpha.CatalogAttribute.AttributeType|null} [type] CatalogAttribute type + * @property {google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption|null} [indexableOption] CatalogAttribute indexableOption + * @property {google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption|null} [dynamicFacetableOption] CatalogAttribute dynamicFacetableOption + * @property {google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|null} [searchableOption] CatalogAttribute searchableOption */ /** - * Constructs a new MerchantCenterLink. + * Constructs a new CatalogAttribute. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a MerchantCenterLink. - * @implements IMerchantCenterLink + * @classdesc Represents a CatalogAttribute. + * @implements ICatalogAttribute * @constructor - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICatalogAttribute=} [properties] Properties to set */ - function MerchantCenterLink(properties) { - this.destinations = []; + function CatalogAttribute(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25322,130 +25322,140 @@ } /** - * MerchantCenterLink merchantCenterAccountId. - * @member {number|Long} merchantCenterAccountId - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * CatalogAttribute key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @instance */ - MerchantCenterLink.prototype.merchantCenterAccountId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + CatalogAttribute.prototype.key = ""; /** - * MerchantCenterLink branchId. - * @member {string} branchId - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * CatalogAttribute inUse. + * @member {boolean} inUse + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @instance */ - MerchantCenterLink.prototype.branchId = ""; + CatalogAttribute.prototype.inUse = false; /** - * MerchantCenterLink destinations. - * @member {Array.} destinations - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * CatalogAttribute type. + * @member {google.cloud.retail.v2alpha.CatalogAttribute.AttributeType} type + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @instance */ - MerchantCenterLink.prototype.destinations = $util.emptyArray; + CatalogAttribute.prototype.type = 0; /** - * MerchantCenterLink regionCode. - * @member {string} regionCode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * CatalogAttribute indexableOption. + * @member {google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption} indexableOption + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @instance */ - MerchantCenterLink.prototype.regionCode = ""; + CatalogAttribute.prototype.indexableOption = 0; /** - * MerchantCenterLink languageCode. - * @member {string} languageCode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * CatalogAttribute dynamicFacetableOption. + * @member {google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption} dynamicFacetableOption + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @instance */ - MerchantCenterLink.prototype.languageCode = ""; + CatalogAttribute.prototype.dynamicFacetableOption = 0; /** - * Creates a new MerchantCenterLink instance using the specified properties. + * CatalogAttribute searchableOption. + * @member {google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption} searchableOption + * @memberof google.cloud.retail.v2alpha.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.searchableOption = 0; + + /** + * Creates a new CatalogAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink instance + * @param {google.cloud.retail.v2alpha.ICatalogAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CatalogAttribute} CatalogAttribute instance */ - MerchantCenterLink.create = function create(properties) { - return new MerchantCenterLink(properties); + CatalogAttribute.create = function create(properties) { + return new CatalogAttribute(properties); }; /** - * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * Encodes the specified CatalogAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CatalogAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICatalogAttribute} message CatalogAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MerchantCenterLink.encode = function encode(message, writer) { + CatalogAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.merchantCenterAccountId != null && Object.hasOwnProperty.call(message, "merchantCenterAccountId")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.merchantCenterAccountId); - if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); - if (message.destinations != null && message.destinations.length) - for (var i = 0; i < message.destinations.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); - if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.regionCode); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.languageCode); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.indexableOption != null && Object.hasOwnProperty.call(message, "indexableOption")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.indexableOption); + if (message.dynamicFacetableOption != null && Object.hasOwnProperty.call(message, "dynamicFacetableOption")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.dynamicFacetableOption); + if (message.searchableOption != null && Object.hasOwnProperty.call(message, "searchableOption")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.searchableOption); + if (message.inUse != null && Object.hasOwnProperty.call(message, "inUse")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.inUse); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.type); return writer; }; /** - * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. + * Encodes the specified CatalogAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CatalogAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICatalogAttribute} message CatalogAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MerchantCenterLink.encodeDelimited = function encodeDelimited(message, writer) { + CatalogAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MerchantCenterLink message from the specified reader or buffer. + * Decodes a CatalogAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink + * @returns {google.cloud.retail.v2alpha.CatalogAttribute} CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MerchantCenterLink.decode = function decode(reader, length) { + CatalogAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CatalogAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.merchantCenterAccountId = reader.int64(); - break; - case 2: - message.branchId = reader.string(); + message.key = reader.string(); break; - case 3: - if (!(message.destinations && message.destinations.length)) - message.destinations = []; - message.destinations.push(reader.string()); + case 9: + message.inUse = reader.bool(); break; - case 4: - message.regionCode = reader.string(); + case 10: + message.type = reader.int32(); break; case 5: - message.languageCode = reader.string(); + message.indexableOption = reader.int32(); + break; + case 6: + message.dynamicFacetableOption = reader.int32(); + break; + case 7: + message.searchableOption = reader.int32(); break; default: reader.skipType(tag & 7); @@ -25456,168 +25466,287 @@ }; /** - * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. + * Decodes a CatalogAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink + * @returns {google.cloud.retail.v2alpha.CatalogAttribute} CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MerchantCenterLink.decodeDelimited = function decodeDelimited(reader) { + CatalogAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MerchantCenterLink message. + * Verifies a CatalogAttribute message. * @function verify - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MerchantCenterLink.verify = function verify(message) { + CatalogAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) - if (!$util.isInteger(message.merchantCenterAccountId) && !(message.merchantCenterAccountId && $util.isInteger(message.merchantCenterAccountId.low) && $util.isInteger(message.merchantCenterAccountId.high))) - return "merchantCenterAccountId: integer|Long expected"; - if (message.branchId != null && message.hasOwnProperty("branchId")) - if (!$util.isString(message.branchId)) - return "branchId: string expected"; - if (message.destinations != null && message.hasOwnProperty("destinations")) { - if (!Array.isArray(message.destinations)) - return "destinations: array expected"; - for (var i = 0; i < message.destinations.length; ++i) - if (!$util.isString(message.destinations[i])) - return "destinations: string[] expected"; - } - if (message.regionCode != null && message.hasOwnProperty("regionCode")) - if (!$util.isString(message.regionCode)) - return "regionCode: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.inUse != null && message.hasOwnProperty("inUse")) + if (typeof message.inUse !== "boolean") + return "inUse: boolean expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) + switch (message.indexableOption) { + default: + return "indexableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) + switch (message.dynamicFacetableOption) { + default: + return "dynamicFacetableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) + switch (message.searchableOption) { + default: + return "searchableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. + * Creates a CatalogAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink + * @returns {google.cloud.retail.v2alpha.CatalogAttribute} CatalogAttribute */ - MerchantCenterLink.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLink) + CatalogAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CatalogAttribute) return object; - var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); - if (object.merchantCenterAccountId != null) - if ($util.Long) - (message.merchantCenterAccountId = $util.Long.fromValue(object.merchantCenterAccountId)).unsigned = false; - else if (typeof object.merchantCenterAccountId === "string") - message.merchantCenterAccountId = parseInt(object.merchantCenterAccountId, 10); - else if (typeof object.merchantCenterAccountId === "number") - message.merchantCenterAccountId = object.merchantCenterAccountId; - else if (typeof object.merchantCenterAccountId === "object") - message.merchantCenterAccountId = new $util.LongBits(object.merchantCenterAccountId.low >>> 0, object.merchantCenterAccountId.high >>> 0).toNumber(); - if (object.branchId != null) - message.branchId = String(object.branchId); - if (object.destinations) { - if (!Array.isArray(object.destinations)) - throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLink.destinations: array expected"); - message.destinations = []; - for (var i = 0; i < object.destinations.length; ++i) - message.destinations[i] = String(object.destinations[i]); + var message = new $root.google.cloud.retail.v2alpha.CatalogAttribute(); + if (object.key != null) + message.key = String(object.key); + if (object.inUse != null) + message.inUse = Boolean(object.inUse); + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "TEXTUAL": + case 1: + message.type = 1; + break; + case "NUMERICAL": + case 2: + message.type = 2; + break; } - if (object.regionCode != null) - message.regionCode = String(object.regionCode); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; - - /** - * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + switch (object.indexableOption) { + case "INDEXABLE_OPTION_UNSPECIFIED": + case 0: + message.indexableOption = 0; + break; + case "INDEXABLE_ENABLED": + case 1: + message.indexableOption = 1; + break; + case "INDEXABLE_DISABLED": + case 2: + message.indexableOption = 2; + break; + } + switch (object.dynamicFacetableOption) { + case "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": + case 0: + message.dynamicFacetableOption = 0; + break; + case "DYNAMIC_FACETABLE_ENABLED": + case 1: + message.dynamicFacetableOption = 1; + break; + case "DYNAMIC_FACETABLE_DISABLED": + case 2: + message.dynamicFacetableOption = 2; + break; + } + switch (object.searchableOption) { + case "SEARCHABLE_OPTION_UNSPECIFIED": + case 0: + message.searchableOption = 0; + break; + case "SEARCHABLE_ENABLED": + case 1: + message.searchableOption = 1; + break; + case "SEARCHABLE_DISABLED": + case 2: + message.searchableOption = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a CatalogAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @static - * @param {google.cloud.retail.v2alpha.MerchantCenterLink} message MerchantCenterLink + * @param {google.cloud.retail.v2alpha.CatalogAttribute} message CatalogAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MerchantCenterLink.toObject = function toObject(message, options) { + CatalogAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.destinations = []; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.merchantCenterAccountId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.merchantCenterAccountId = options.longs === String ? "0" : 0; - object.branchId = ""; - object.regionCode = ""; - object.languageCode = ""; - } - if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) - if (typeof message.merchantCenterAccountId === "number") - object.merchantCenterAccountId = options.longs === String ? String(message.merchantCenterAccountId) : message.merchantCenterAccountId; - else - object.merchantCenterAccountId = options.longs === String ? $util.Long.prototype.toString.call(message.merchantCenterAccountId) : options.longs === Number ? new $util.LongBits(message.merchantCenterAccountId.low >>> 0, message.merchantCenterAccountId.high >>> 0).toNumber() : message.merchantCenterAccountId; - if (message.branchId != null && message.hasOwnProperty("branchId")) - object.branchId = message.branchId; - if (message.destinations && message.destinations.length) { - object.destinations = []; - for (var j = 0; j < message.destinations.length; ++j) - object.destinations[j] = message.destinations[j]; + object.key = ""; + object.indexableOption = options.enums === String ? "INDEXABLE_OPTION_UNSPECIFIED" : 0; + object.dynamicFacetableOption = options.enums === String ? "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" : 0; + object.searchableOption = options.enums === String ? "SEARCHABLE_OPTION_UNSPECIFIED" : 0; + object.inUse = false; + object.type = options.enums === String ? "UNKNOWN" : 0; } - if (message.regionCode != null && message.hasOwnProperty("regionCode")) - object.regionCode = message.regionCode; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) + object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; + if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) + object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; + if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) + object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + if (message.inUse != null && message.hasOwnProperty("inUse")) + object.inUse = message.inUse; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.AttributeType[message.type] : message.type; return object; }; /** - * Converts this MerchantCenterLink to JSON. + * Converts this CatalogAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @memberof google.cloud.retail.v2alpha.CatalogAttribute * @instance * @returns {Object.} JSON object */ - MerchantCenterLink.prototype.toJSON = function toJSON() { + CatalogAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return MerchantCenterLink; + /** + * AttributeType enum. + * @name google.cloud.retail.v2alpha.CatalogAttribute.AttributeType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} TEXTUAL=1 TEXTUAL value + * @property {number} NUMERICAL=2 NUMERICAL value + */ + CatalogAttribute.AttributeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "TEXTUAL"] = 1; + values[valuesById[2] = "NUMERICAL"] = 2; + return values; + })(); + + /** + * IndexableOption enum. + * @name google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption + * @enum {number} + * @property {number} INDEXABLE_OPTION_UNSPECIFIED=0 INDEXABLE_OPTION_UNSPECIFIED value + * @property {number} INDEXABLE_ENABLED=1 INDEXABLE_ENABLED value + * @property {number} INDEXABLE_DISABLED=2 INDEXABLE_DISABLED value + */ + CatalogAttribute.IndexableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INDEXABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "INDEXABLE_ENABLED"] = 1; + values[valuesById[2] = "INDEXABLE_DISABLED"] = 2; + return values; + })(); + + /** + * DynamicFacetableOption enum. + * @name google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption + * @enum {number} + * @property {number} DYNAMIC_FACETABLE_OPTION_UNSPECIFIED=0 DYNAMIC_FACETABLE_OPTION_UNSPECIFIED value + * @property {number} DYNAMIC_FACETABLE_ENABLED=1 DYNAMIC_FACETABLE_ENABLED value + * @property {number} DYNAMIC_FACETABLE_DISABLED=2 DYNAMIC_FACETABLE_DISABLED value + */ + CatalogAttribute.DynamicFacetableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DYNAMIC_FACETABLE_ENABLED"] = 1; + values[valuesById[2] = "DYNAMIC_FACETABLE_DISABLED"] = 2; + return values; + })(); + + /** + * SearchableOption enum. + * @name google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption + * @enum {number} + * @property {number} SEARCHABLE_OPTION_UNSPECIFIED=0 SEARCHABLE_OPTION_UNSPECIFIED value + * @property {number} SEARCHABLE_ENABLED=1 SEARCHABLE_ENABLED value + * @property {number} SEARCHABLE_DISABLED=2 SEARCHABLE_DISABLED value + */ + CatalogAttribute.SearchableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCHABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "SEARCHABLE_ENABLED"] = 1; + values[valuesById[2] = "SEARCHABLE_DISABLED"] = 2; + return values; + })(); + + return CatalogAttribute; })(); - v2alpha.MerchantCenterLinkingConfig = (function() { + v2alpha.AttributesConfig = (function() { /** - * Properties of a MerchantCenterLinkingConfig. + * Properties of an AttributesConfig. * @memberof google.cloud.retail.v2alpha - * @interface IMerchantCenterLinkingConfig - * @property {Array.|null} [links] MerchantCenterLinkingConfig links + * @interface IAttributesConfig + * @property {string|null} [name] AttributesConfig name + * @property {Object.|null} [catalogAttributes] AttributesConfig catalogAttributes + * @property {google.cloud.retail.v2alpha.AttributeConfigLevel|null} [attributeConfigLevel] AttributesConfig attributeConfigLevel */ /** - * Constructs a new MerchantCenterLinkingConfig. + * Constructs a new AttributesConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a MerchantCenterLinkingConfig. - * @implements IMerchantCenterLinkingConfig + * @classdesc Represents an AttributesConfig. + * @implements IAttributesConfig * @constructor - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAttributesConfig=} [properties] Properties to set */ - function MerchantCenterLinkingConfig(properties) { - this.links = []; + function AttributesConfig(properties) { + this.catalogAttributes = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25625,209 +25754,299 @@ } /** - * MerchantCenterLinkingConfig links. - * @member {Array.} links - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * AttributesConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @instance */ - MerchantCenterLinkingConfig.prototype.links = $util.emptyArray; + AttributesConfig.prototype.name = ""; /** - * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * AttributesConfig catalogAttributes. + * @member {Object.} catalogAttributes + * @memberof google.cloud.retail.v2alpha.AttributesConfig + * @instance + */ + AttributesConfig.prototype.catalogAttributes = $util.emptyObject; + + /** + * AttributesConfig attributeConfigLevel. + * @member {google.cloud.retail.v2alpha.AttributeConfigLevel} attributeConfigLevel + * @memberof google.cloud.retail.v2alpha.AttributesConfig + * @instance + */ + AttributesConfig.prototype.attributeConfigLevel = 0; + + /** + * Creates a new AttributesConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig instance + * @param {google.cloud.retail.v2alpha.IAttributesConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AttributesConfig} AttributesConfig instance */ - MerchantCenterLinkingConfig.create = function create(properties) { - return new MerchantCenterLinkingConfig(properties); + AttributesConfig.create = function create(properties) { + return new AttributesConfig(properties); }; /** - * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * Encodes the specified AttributesConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.AttributesConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAttributesConfig} message AttributesConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MerchantCenterLinkingConfig.encode = function encode(message, writer) { + AttributesConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.links != null && message.links.length) - for (var i = 0; i < message.links.length; ++i) - $root.google.cloud.retail.v2alpha.MerchantCenterLink.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.catalogAttributes != null && Object.hasOwnProperty.call(message, "catalogAttributes")) + for (var keys = Object.keys(message.catalogAttributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CatalogAttribute.encode(message.catalogAttributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.attributeConfigLevel != null && Object.hasOwnProperty.call(message, "attributeConfigLevel")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.attributeConfigLevel); return writer; }; /** - * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * Encodes the specified AttributesConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AttributesConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static - * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAttributesConfig} message AttributesConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MerchantCenterLinkingConfig.encodeDelimited = function encodeDelimited(message, writer) { + AttributesConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * Decodes an AttributesConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + * @returns {google.cloud.retail.v2alpha.AttributesConfig} AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MerchantCenterLinkingConfig.decode = function decode(reader, length) { + AttributesConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AttributesConfig(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.links && message.links.length)) - message.links = []; - message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); + message.name = reader.string(); break; - } - } - return message; - }; - - /** - * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerchantCenterLinkingConfig.decodeDelimited = function decodeDelimited(reader) { + case 2: + if (message.catalogAttributes === $util.emptyObject) + message.catalogAttributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.catalogAttributes[key] = value; + break; + case 3: + message.attributeConfigLevel = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AttributesConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AttributesConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AttributesConfig} AttributesConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttributesConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MerchantCenterLinkingConfig message. + * Verifies an AttributesConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MerchantCenterLinkingConfig.verify = function verify(message) { + AttributesConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.links != null && message.hasOwnProperty("links")) { - if (!Array.isArray(message.links)) - return "links: array expected"; - for (var i = 0; i < message.links.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.MerchantCenterLink.verify(message.links[i]); + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.catalogAttributes != null && message.hasOwnProperty("catalogAttributes")) { + if (!$util.isObject(message.catalogAttributes)) + return "catalogAttributes: object expected"; + var key = Object.keys(message.catalogAttributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CatalogAttribute.verify(message.catalogAttributes[key[i]]); if (error) - return "links." + error; + return "catalogAttributes." + error; } } + if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) + switch (message.attributeConfigLevel) { + default: + return "attributeConfigLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AttributesConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + * @returns {google.cloud.retail.v2alpha.AttributesConfig} AttributesConfig */ - MerchantCenterLinkingConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig) + AttributesConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AttributesConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); - if (object.links) { - if (!Array.isArray(object.links)) - throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: array expected"); - message.links = []; - for (var i = 0; i < object.links.length; ++i) { - if (typeof object.links[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: object expected"); - message.links[i] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.fromObject(object.links[i]); + var message = new $root.google.cloud.retail.v2alpha.AttributesConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.catalogAttributes) { + if (typeof object.catalogAttributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AttributesConfig.catalogAttributes: object expected"); + message.catalogAttributes = {}; + for (var keys = Object.keys(object.catalogAttributes), i = 0; i < keys.length; ++i) { + if (typeof object.catalogAttributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AttributesConfig.catalogAttributes: object expected"); + message.catalogAttributes[keys[i]] = $root.google.cloud.retail.v2alpha.CatalogAttribute.fromObject(object.catalogAttributes[keys[i]]); } } + switch (object.attributeConfigLevel) { + case "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": + case 0: + message.attributeConfigLevel = 0; + break; + case "PRODUCT_LEVEL_ATTRIBUTE_CONFIG": + case 1: + message.attributeConfigLevel = 1; + break; + case "CATALOG_LEVEL_ATTRIBUTE_CONFIG": + case 2: + message.attributeConfigLevel = 2; + break; + } return message; }; /** - * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * Creates a plain object from an AttributesConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @static - * @param {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} message MerchantCenterLinkingConfig + * @param {google.cloud.retail.v2alpha.AttributesConfig} message AttributesConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MerchantCenterLinkingConfig.toObject = function toObject(message, options) { + AttributesConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.links = []; - if (message.links && message.links.length) { - object.links = []; - for (var j = 0; j < message.links.length; ++j) - object.links[j] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.toObject(message.links[j], options); + if (options.objects || options.defaults) + object.catalogAttributes = {}; + if (options.defaults) { + object.name = ""; + object.attributeConfigLevel = options.enums === String ? "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + var keys2; + if (message.catalogAttributes && (keys2 = Object.keys(message.catalogAttributes)).length) { + object.catalogAttributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.catalogAttributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CatalogAttribute.toObject(message.catalogAttributes[keys2[j]], options); } + if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) + object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2alpha.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; return object; }; /** - * Converts this MerchantCenterLinkingConfig to JSON. + * Converts this AttributesConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.AttributesConfig * @instance * @returns {Object.} JSON object */ - MerchantCenterLinkingConfig.prototype.toJSON = function toJSON() { + AttributesConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return MerchantCenterLinkingConfig; + return AttributesConfig; })(); - v2alpha.Catalog = (function() { + v2alpha.CompletionConfig = (function() { /** - * Properties of a Catalog. + * Properties of a CompletionConfig. * @memberof google.cloud.retail.v2alpha - * @interface ICatalog - * @property {string|null} [name] Catalog name - * @property {string|null} [displayName] Catalog displayName - * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig - * @property {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null} [merchantCenterLinkingConfig] Catalog merchantCenterLinkingConfig + * @interface ICompletionConfig + * @property {string|null} [name] CompletionConfig name + * @property {string|null} [matchingOrder] CompletionConfig matchingOrder + * @property {number|null} [maxSuggestions] CompletionConfig maxSuggestions + * @property {number|null} [minPrefixLength] CompletionConfig minPrefixLength + * @property {boolean|null} [autoLearning] CompletionConfig autoLearning + * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [suggestionsInputConfig] CompletionConfig suggestionsInputConfig + * @property {string|null} [lastSuggestionsImportOperation] CompletionConfig lastSuggestionsImportOperation + * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [denylistInputConfig] CompletionConfig denylistInputConfig + * @property {string|null} [lastDenylistImportOperation] CompletionConfig lastDenylistImportOperation + * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [allowlistInputConfig] CompletionConfig allowlistInputConfig + * @property {string|null} [lastAllowlistImportOperation] CompletionConfig lastAllowlistImportOperation */ /** - * Constructs a new Catalog. + * Constructs a new CompletionConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Catalog. - * @implements ICatalog + * @classdesc Represents a CompletionConfig. + * @implements ICompletionConfig * @constructor - * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompletionConfig=} [properties] Properties to set */ - function Catalog(properties) { + function CompletionConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25835,100 +26054,170 @@ } /** - * Catalog name. + * CompletionConfig name. * @member {string} name - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @instance */ - Catalog.prototype.name = ""; + CompletionConfig.prototype.name = ""; /** - * Catalog displayName. - * @member {string} displayName - * @memberof google.cloud.retail.v2alpha.Catalog + * CompletionConfig matchingOrder. + * @member {string} matchingOrder + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @instance */ - Catalog.prototype.displayName = ""; + CompletionConfig.prototype.matchingOrder = ""; /** - * Catalog productLevelConfig. - * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig - * @memberof google.cloud.retail.v2alpha.Catalog + * CompletionConfig maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @instance */ - Catalog.prototype.productLevelConfig = null; + CompletionConfig.prototype.maxSuggestions = 0; /** - * Catalog merchantCenterLinkingConfig. - * @member {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null|undefined} merchantCenterLinkingConfig - * @memberof google.cloud.retail.v2alpha.Catalog + * CompletionConfig minPrefixLength. + * @member {number} minPrefixLength + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @instance */ - Catalog.prototype.merchantCenterLinkingConfig = null; + CompletionConfig.prototype.minPrefixLength = 0; /** - * Creates a new Catalog instance using the specified properties. + * CompletionConfig autoLearning. + * @member {boolean} autoLearning + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.autoLearning = false; + + /** + * CompletionConfig suggestionsInputConfig. + * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} suggestionsInputConfig + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.suggestionsInputConfig = null; + + /** + * CompletionConfig lastSuggestionsImportOperation. + * @member {string} lastSuggestionsImportOperation + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastSuggestionsImportOperation = ""; + + /** + * CompletionConfig denylistInputConfig. + * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} denylistInputConfig + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.denylistInputConfig = null; + + /** + * CompletionConfig lastDenylistImportOperation. + * @member {string} lastDenylistImportOperation + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastDenylistImportOperation = ""; + + /** + * CompletionConfig allowlistInputConfig. + * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} allowlistInputConfig + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.allowlistInputConfig = null; + + /** + * CompletionConfig lastAllowlistImportOperation. + * @member {string} lastAllowlistImportOperation + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastAllowlistImportOperation = ""; + + /** + * Creates a new CompletionConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static - * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance + * @param {google.cloud.retail.v2alpha.ICompletionConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompletionConfig} CompletionConfig instance */ - Catalog.create = function create(properties) { - return new Catalog(properties); + CompletionConfig.create = function create(properties) { + return new CompletionConfig(properties); }; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * Encodes the specified CompletionConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionConfig} message CompletionConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encode = function encode(message, writer) { + CompletionConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) - $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.merchantCenterLinkingConfig != null && Object.hasOwnProperty.call(message, "merchantCenterLinkingConfig")) - $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.encode(message.merchantCenterLinkingConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.matchingOrder != null && Object.hasOwnProperty.call(message, "matchingOrder")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.matchingOrder); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxSuggestions); + if (message.minPrefixLength != null && Object.hasOwnProperty.call(message, "minPrefixLength")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minPrefixLength); + if (message.suggestionsInputConfig != null && Object.hasOwnProperty.call(message, "suggestionsInputConfig")) + $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.suggestionsInputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.lastSuggestionsImportOperation != null && Object.hasOwnProperty.call(message, "lastSuggestionsImportOperation")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.lastSuggestionsImportOperation); + if (message.denylistInputConfig != null && Object.hasOwnProperty.call(message, "denylistInputConfig")) + $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.denylistInputConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.lastDenylistImportOperation != null && Object.hasOwnProperty.call(message, "lastDenylistImportOperation")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.lastDenylistImportOperation); + if (message.allowlistInputConfig != null && Object.hasOwnProperty.call(message, "allowlistInputConfig")) + $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.allowlistInputConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.lastAllowlistImportOperation != null && Object.hasOwnProperty.call(message, "lastAllowlistImportOperation")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.lastAllowlistImportOperation); + if (message.autoLearning != null && Object.hasOwnProperty.call(message, "autoLearning")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoLearning); return writer; }; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * Encodes the specified CompletionConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static - * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionConfig} message CompletionConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { + CompletionConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a CompletionConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2alpha.CompletionConfig} CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decode = function decode(reader, length) { + CompletionConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -25936,13 +26225,34 @@ message.name = reader.string(); break; case 2: - message.displayName = reader.string(); + message.matchingOrder = reader.string(); + break; + case 3: + message.maxSuggestions = reader.int32(); break; case 4: - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); + message.minPrefixLength = reader.int32(); + break; + case 11: + message.autoLearning = reader.bool(); + break; + case 5: + message.suggestionsInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); break; case 6: - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + message.lastSuggestionsImportOperation = reader.string(); + break; + case 7: + message.denylistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 8: + message.lastDenylistImportOperation = reader.string(); + break; + case 9: + message.allowlistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + case 10: + message.lastAllowlistImportOperation = reader.string(); break; default: reader.skipType(tag & 7); @@ -25953,161 +26263,208 @@ }; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a CompletionConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2alpha.CompletionConfig} CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decodeDelimited = function decodeDelimited(reader) { + CompletionConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Catalog message. + * Verifies a CompletionConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Catalog.verify = function verify(message) { + CompletionConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); + if (message.matchingOrder != null && message.hasOwnProperty("matchingOrder")) + if (!$util.isString(message.matchingOrder)) + return "matchingOrder: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + if (!$util.isInteger(message.minPrefixLength)) + return "minPrefixLength: integer expected"; + if (message.autoLearning != null && message.hasOwnProperty("autoLearning")) + if (typeof message.autoLearning !== "boolean") + return "autoLearning: boolean expected"; + if (message.suggestionsInputConfig != null && message.hasOwnProperty("suggestionsInputConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.suggestionsInputConfig); if (error) - return "productLevelConfig." + error; + return "suggestionsInputConfig." + error; } - if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { - var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (message.lastSuggestionsImportOperation != null && message.hasOwnProperty("lastSuggestionsImportOperation")) + if (!$util.isString(message.lastSuggestionsImportOperation)) + return "lastSuggestionsImportOperation: string expected"; + if (message.denylistInputConfig != null && message.hasOwnProperty("denylistInputConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.denylistInputConfig); if (error) - return "merchantCenterLinkingConfig." + error; + return "denylistInputConfig." + error; + } + if (message.lastDenylistImportOperation != null && message.hasOwnProperty("lastDenylistImportOperation")) + if (!$util.isString(message.lastDenylistImportOperation)) + return "lastDenylistImportOperation: string expected"; + if (message.allowlistInputConfig != null && message.hasOwnProperty("allowlistInputConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.allowlistInputConfig); + if (error) + return "allowlistInputConfig." + error; } + if (message.lastAllowlistImportOperation != null && message.hasOwnProperty("lastAllowlistImportOperation")) + if (!$util.isString(message.lastAllowlistImportOperation)) + return "lastAllowlistImportOperation: string expected"; return null; }; /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @returns {google.cloud.retail.v2alpha.CompletionConfig} CompletionConfig */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + CompletionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompletionConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.Catalog(); + var message = new $root.google.cloud.retail.v2alpha.CompletionConfig(); if (object.name != null) message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); + if (object.matchingOrder != null) + message.matchingOrder = String(object.matchingOrder); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; + if (object.minPrefixLength != null) + message.minPrefixLength = object.minPrefixLength | 0; + if (object.autoLearning != null) + message.autoLearning = Boolean(object.autoLearning); + if (object.suggestionsInputConfig != null) { + if (typeof object.suggestionsInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompletionConfig.suggestionsInputConfig: object expected"); + message.suggestionsInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.suggestionsInputConfig); } - if (object.merchantCenterLinkingConfig != null) { - if (typeof object.merchantCenterLinkingConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); + if (object.lastSuggestionsImportOperation != null) + message.lastSuggestionsImportOperation = String(object.lastSuggestionsImportOperation); + if (object.denylistInputConfig != null) { + if (typeof object.denylistInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompletionConfig.denylistInputConfig: object expected"); + message.denylistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.denylistInputConfig); + } + if (object.lastDenylistImportOperation != null) + message.lastDenylistImportOperation = String(object.lastDenylistImportOperation); + if (object.allowlistInputConfig != null) { + if (typeof object.allowlistInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompletionConfig.allowlistInputConfig: object expected"); + message.allowlistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.allowlistInputConfig); } + if (object.lastAllowlistImportOperation != null) + message.lastAllowlistImportOperation = String(object.lastAllowlistImportOperation); return message; }; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * Creates a plain object from a CompletionConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @static - * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {google.cloud.retail.v2alpha.CompletionConfig} message CompletionConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Catalog.toObject = function toObject(message, options) { + CompletionConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; - object.merchantCenterLinkingConfig = null; + object.matchingOrder = ""; + object.maxSuggestions = 0; + object.minPrefixLength = 0; + object.suggestionsInputConfig = null; + object.lastSuggestionsImportOperation = ""; + object.denylistInputConfig = null; + object.lastDenylistImportOperation = ""; + object.allowlistInputConfig = null; + object.lastAllowlistImportOperation = ""; + object.autoLearning = false; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); - if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) - object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); + if (message.matchingOrder != null && message.hasOwnProperty("matchingOrder")) + object.matchingOrder = message.matchingOrder; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + object.minPrefixLength = message.minPrefixLength; + if (message.suggestionsInputConfig != null && message.hasOwnProperty("suggestionsInputConfig")) + object.suggestionsInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.suggestionsInputConfig, options); + if (message.lastSuggestionsImportOperation != null && message.hasOwnProperty("lastSuggestionsImportOperation")) + object.lastSuggestionsImportOperation = message.lastSuggestionsImportOperation; + if (message.denylistInputConfig != null && message.hasOwnProperty("denylistInputConfig")) + object.denylistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.denylistInputConfig, options); + if (message.lastDenylistImportOperation != null && message.hasOwnProperty("lastDenylistImportOperation")) + object.lastDenylistImportOperation = message.lastDenylistImportOperation; + if (message.allowlistInputConfig != null && message.hasOwnProperty("allowlistInputConfig")) + object.allowlistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.allowlistInputConfig, options); + if (message.lastAllowlistImportOperation != null && message.hasOwnProperty("lastAllowlistImportOperation")) + object.lastAllowlistImportOperation = message.lastAllowlistImportOperation; + if (message.autoLearning != null && message.hasOwnProperty("autoLearning")) + object.autoLearning = message.autoLearning; return object; }; /** - * Converts this Catalog to JSON. + * Converts this CompletionConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Catalog + * @memberof google.cloud.retail.v2alpha.CompletionConfig * @instance * @returns {Object.} JSON object */ - Catalog.prototype.toJSON = function toJSON() { + CompletionConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Catalog; - })(); - - /** - * SolutionType enum. - * @name google.cloud.retail.v2alpha.SolutionType - * @enum {number} - * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value - * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value - * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value - */ - v2alpha.SolutionType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; - values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; - return values; + return CompletionConfig; })(); - v2alpha.Condition = (function() { + v2alpha.MerchantCenterLink = (function() { /** - * Properties of a Condition. + * Properties of a MerchantCenterLink. * @memberof google.cloud.retail.v2alpha - * @interface ICondition - * @property {Array.|null} [queryTerms] Condition queryTerms - * @property {Array.|null} [activeTimeRange] Condition activeTimeRange + * @interface IMerchantCenterLink + * @property {number|Long|null} [merchantCenterAccountId] MerchantCenterLink merchantCenterAccountId + * @property {string|null} [branchId] MerchantCenterLink branchId + * @property {Array.|null} [destinations] MerchantCenterLink destinations + * @property {string|null} [regionCode] MerchantCenterLink regionCode + * @property {string|null} [languageCode] MerchantCenterLink languageCode */ /** - * Constructs a new Condition. + * Constructs a new MerchantCenterLink. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Condition. - * @implements ICondition + * @classdesc Represents a MerchantCenterLink. + * @implements IMerchantCenterLink * @constructor - * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set */ - function Condition(properties) { - this.queryTerms = []; - this.activeTimeRange = []; + function MerchantCenterLink(properties) { + this.destinations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -26115,94 +26472,130 @@ } /** - * Condition queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Condition + * MerchantCenterLink merchantCenterAccountId. + * @member {number|Long} merchantCenterAccountId + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @instance */ - Condition.prototype.queryTerms = $util.emptyArray; + MerchantCenterLink.prototype.merchantCenterAccountId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Condition activeTimeRange. - * @member {Array.} activeTimeRange - * @memberof google.cloud.retail.v2alpha.Condition + * MerchantCenterLink branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @instance */ - Condition.prototype.activeTimeRange = $util.emptyArray; + MerchantCenterLink.prototype.branchId = ""; /** - * Creates a new Condition instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Condition - * @static - * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Condition} Condition instance - */ - Condition.create = function create(properties) { - return new Condition(properties); + * MerchantCenterLink destinations. + * @member {Array.} destinations + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.destinations = $util.emptyArray; + + /** + * MerchantCenterLink regionCode. + * @member {string} regionCode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.regionCode = ""; + + /** + * MerchantCenterLink languageCode. + * @member {string} languageCode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @instance + */ + MerchantCenterLink.prototype.languageCode = ""; + + /** + * Creates a new MerchantCenterLink instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink instance + */ + MerchantCenterLink.create = function create(properties) { + return new MerchantCenterLink(properties); }; /** - * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * Encodes the specified MerchantCenterLink message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Condition.encode = function encode(message, writer) { + MerchantCenterLink.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - $root.google.cloud.retail.v2alpha.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeTimeRange != null && message.activeTimeRange.length) - for (var i = 0; i < message.activeTimeRange.length; ++i) - $root.google.cloud.retail.v2alpha.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.merchantCenterAccountId != null && Object.hasOwnProperty.call(message, "merchantCenterAccountId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.merchantCenterAccountId); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.destinations != null && message.destinations.length) + for (var i = 0; i < message.destinations.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinations[i]); + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.regionCode); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.languageCode); return writer; }; /** - * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. + * Encodes the specified MerchantCenterLink message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLink.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode + * @param {google.cloud.retail.v2alpha.IMerchantCenterLink} message MerchantCenterLink message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Condition.encodeDelimited = function encodeDelimited(message, writer) { + MerchantCenterLink.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Condition message from the specified reader or buffer. + * Decodes a MerchantCenterLink message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Condition.decode = function decode(reader, length) { + MerchantCenterLink.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); + message.merchantCenterAccountId = reader.int64(); + break; + case 2: + message.branchId = reader.string(); break; case 3: - if (!(message.activeTimeRange && message.activeTimeRange.length)) - message.activeTimeRange = []; - message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + message.destinations.push(reader.string()); + break; + case 4: + message.regionCode = reader.string(); + break; + case 5: + message.languageCode = reader.string(); break; default: reader.skipType(tag & 7); @@ -26213,782 +26606,785 @@ }; /** - * Decodes a Condition message from the specified reader or buffer, length delimited. + * Decodes a MerchantCenterLink message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Condition.decodeDelimited = function decodeDelimited(reader) { + MerchantCenterLink.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Condition message. + * Verifies a MerchantCenterLink message. * @function verify - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Condition.verify = function verify(message) { + MerchantCenterLink.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.verify(message.queryTerms[i]); - if (error) - return "queryTerms." + error; - } - } - if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { - if (!Array.isArray(message.activeTimeRange)) - return "activeTimeRange: array expected"; - for (var i = 0; i < message.activeTimeRange.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Condition.TimeRange.verify(message.activeTimeRange[i]); - if (error) - return "activeTimeRange." + error; - } + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (!$util.isInteger(message.merchantCenterAccountId) && !(message.merchantCenterAccountId && $util.isInteger(message.merchantCenterAccountId.low) && $util.isInteger(message.merchantCenterAccountId.high))) + return "merchantCenterAccountId: integer|Long expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + if (!$util.isString(message.destinations[i])) + return "destinations: string[] expected"; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + if (!$util.isString(message.regionCode)) + return "regionCode: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; return null; }; /** - * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * Creates a MerchantCenterLink message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Condition} Condition + * @returns {google.cloud.retail.v2alpha.MerchantCenterLink} MerchantCenterLink */ - Condition.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Condition) + MerchantCenterLink.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLink) return object; - var message = new $root.google.cloud.retail.v2alpha.Condition(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) { - if (typeof object.queryTerms[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: object expected"); - message.queryTerms[i] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.fromObject(object.queryTerms[i]); - } - } - if (object.activeTimeRange) { - if (!Array.isArray(object.activeTimeRange)) - throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: array expected"); - message.activeTimeRange = []; - for (var i = 0; i < object.activeTimeRange.length; ++i) { - if (typeof object.activeTimeRange[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: object expected"); - message.activeTimeRange[i] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.fromObject(object.activeTimeRange[i]); - } + var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLink(); + if (object.merchantCenterAccountId != null) + if ($util.Long) + (message.merchantCenterAccountId = $util.Long.fromValue(object.merchantCenterAccountId)).unsigned = false; + else if (typeof object.merchantCenterAccountId === "string") + message.merchantCenterAccountId = parseInt(object.merchantCenterAccountId, 10); + else if (typeof object.merchantCenterAccountId === "number") + message.merchantCenterAccountId = object.merchantCenterAccountId; + else if (typeof object.merchantCenterAccountId === "object") + message.merchantCenterAccountId = new $util.LongBits(object.merchantCenterAccountId.low >>> 0, object.merchantCenterAccountId.high >>> 0).toNumber(); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLink.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + message.destinations[i] = String(object.destinations[i]); } + if (object.regionCode != null) + message.regionCode = String(object.regionCode); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); return message; }; /** - * Creates a plain object from a Condition message. Also converts values to other types if specified. + * Creates a plain object from a MerchantCenterLink message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @static - * @param {google.cloud.retail.v2alpha.Condition} message Condition + * @param {google.cloud.retail.v2alpha.MerchantCenterLink} message MerchantCenterLink * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Condition.toObject = function toObject(message, options) { + MerchantCenterLink.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.queryTerms = []; - object.activeTimeRange = []; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.toObject(message.queryTerms[j], options); + if (options.arrays || options.defaults) + object.destinations = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.merchantCenterAccountId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.merchantCenterAccountId = options.longs === String ? "0" : 0; + object.branchId = ""; + object.regionCode = ""; + object.languageCode = ""; } - if (message.activeTimeRange && message.activeTimeRange.length) { - object.activeTimeRange = []; - for (var j = 0; j < message.activeTimeRange.length; ++j) - object.activeTimeRange[j] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.toObject(message.activeTimeRange[j], options); + if (message.merchantCenterAccountId != null && message.hasOwnProperty("merchantCenterAccountId")) + if (typeof message.merchantCenterAccountId === "number") + object.merchantCenterAccountId = options.longs === String ? String(message.merchantCenterAccountId) : message.merchantCenterAccountId; + else + object.merchantCenterAccountId = options.longs === String ? $util.Long.prototype.toString.call(message.merchantCenterAccountId) : options.longs === Number ? new $util.LongBits(message.merchantCenterAccountId.low >>> 0, message.merchantCenterAccountId.high >>> 0).toNumber() : message.merchantCenterAccountId; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = message.destinations[j]; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; return object; }; /** - * Converts this Condition to JSON. + * Converts this MerchantCenterLink to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Condition + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink * @instance * @returns {Object.} JSON object */ - Condition.prototype.toJSON = function toJSON() { + MerchantCenterLink.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - Condition.QueryTerm = (function() { + return MerchantCenterLink; + })(); - /** - * Properties of a QueryTerm. - * @memberof google.cloud.retail.v2alpha.Condition - * @interface IQueryTerm - * @property {string|null} [value] QueryTerm value - * @property {boolean|null} [fullMatch] QueryTerm fullMatch - */ + v2alpha.MerchantCenterLinkingConfig = (function() { - /** - * Constructs a new QueryTerm. - * @memberof google.cloud.retail.v2alpha.Condition - * @classdesc Represents a QueryTerm. - * @implements IQueryTerm - * @constructor - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set - */ - function QueryTerm(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a MerchantCenterLinkingConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IMerchantCenterLinkingConfig + * @property {Array.|null} [links] MerchantCenterLinkingConfig links + */ - /** - * QueryTerm value. - * @member {string} value - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @instance - */ - QueryTerm.prototype.value = ""; + /** + * Constructs a new MerchantCenterLinkingConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a MerchantCenterLinkingConfig. + * @implements IMerchantCenterLinkingConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set + */ + function MerchantCenterLinkingConfig(properties) { + this.links = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * QueryTerm fullMatch. - * @member {boolean} fullMatch - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @instance - */ - QueryTerm.prototype.fullMatch = false; + /** + * MerchantCenterLinkingConfig links. + * @member {Array.} links + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @instance + */ + MerchantCenterLinkingConfig.prototype.links = $util.emptyArray; - /** - * Creates a new QueryTerm instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm instance - */ - QueryTerm.create = function create(properties) { - return new QueryTerm(properties); - }; + /** + * Creates a new MerchantCenterLinkingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig instance + */ + MerchantCenterLinkingConfig.create = function create(properties) { + return new MerchantCenterLinkingConfig(properties); + }; - /** - * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTerm.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); - return writer; - }; + /** + * Encodes the specified MerchantCenterLinkingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerchantCenterLinkingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.links != null && message.links.length) + for (var i = 0; i < message.links.length; ++i) + $root.google.cloud.retail.v2alpha.MerchantCenterLink.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified MerchantCenterLinkingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig} message MerchantCenterLinkingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerchantCenterLinkingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a QueryTerm message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTerm.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.fullMatch = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerchantCenterLinkingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a QueryTerm message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTerm.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a QueryTerm message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryTerm.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) - if (typeof message.fullMatch !== "boolean") - return "fullMatch: boolean expected"; - return null; - }; + /** + * Decodes a MerchantCenterLinkingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerchantCenterLinkingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm - */ - QueryTerm.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Condition.QueryTerm) - return object; - var message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); - if (object.value != null) - message.value = String(object.value); - if (object.fullMatch != null) - message.fullMatch = Boolean(object.fullMatch); - return message; - }; - - /** - * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @static - * @param {google.cloud.retail.v2alpha.Condition.QueryTerm} message QueryTerm - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryTerm.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.fullMatch = false; + /** + * Verifies a MerchantCenterLinkingConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerchantCenterLinkingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.links != null && message.hasOwnProperty("links")) { + if (!Array.isArray(message.links)) + return "links: array expected"; + for (var i = 0; i < message.links.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLink.verify(message.links[i]); + if (error) + return "links." + error; } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) - object.fullMatch = message.fullMatch; + } + return null; + }; + + /** + * Creates a MerchantCenterLinkingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} MerchantCenterLinkingConfig + */ + MerchantCenterLinkingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig) return object; - }; + var message = new $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig(); + if (object.links) { + if (!Array.isArray(object.links)) + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: array expected"); + message.links = []; + for (var i = 0; i < object.links.length; ++i) { + if (typeof object.links[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.links: object expected"); + message.links[i] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.fromObject(object.links[i]); + } + } + return message; + }; - /** - * Converts this QueryTerm to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm - * @instance - * @returns {Object.} JSON object - */ - QueryTerm.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a MerchantCenterLinkingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {google.cloud.retail.v2alpha.MerchantCenterLinkingConfig} message MerchantCenterLinkingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerchantCenterLinkingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.links = []; + if (message.links && message.links.length) { + object.links = []; + for (var j = 0; j < message.links.length; ++j) + object.links[j] = $root.google.cloud.retail.v2alpha.MerchantCenterLink.toObject(message.links[j], options); + } + return object; + }; - return QueryTerm; - })(); + /** + * Converts this MerchantCenterLinkingConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @instance + * @returns {Object.} JSON object + */ + MerchantCenterLinkingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - Condition.TimeRange = (function() { + return MerchantCenterLinkingConfig; + })(); - /** - * Properties of a TimeRange. - * @memberof google.cloud.retail.v2alpha.Condition - * @interface ITimeRange - * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime - * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime - */ + v2alpha.Catalog = (function() { - /** - * Constructs a new TimeRange. - * @memberof google.cloud.retail.v2alpha.Condition - * @classdesc Represents a TimeRange. - * @implements ITimeRange - * @constructor - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set - */ - function TimeRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a Catalog. + * @memberof google.cloud.retail.v2alpha + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2alpha.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * @property {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null} [merchantCenterLinkingConfig] Catalog merchantCenterLinkingConfig + */ - /** - * TimeRange startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @instance - */ - TimeRange.prototype.startTime = null; + /** + * Constructs a new Catalog. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Catalog. + * @implements ICatalog + * @constructor + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + */ + function Catalog(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * TimeRange endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @instance - */ - TimeRange.prototype.endTime = null; + /** + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.name = ""; - /** - * Creates a new TimeRange instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange instance - */ - TimeRange.create = function create(properties) { - return new TimeRange(properties); - }; + /** + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.displayName = ""; - /** - * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TimeRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2alpha.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; - /** - * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TimeRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TimeRange message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TimeRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TimeRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TimeRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TimeRange message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TimeRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - return null; - }; - - /** - * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange - */ - TimeRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Condition.TimeRange) - return object; - var message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - return message; - }; - - /** - * Creates a plain object from a TimeRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @static - * @param {google.cloud.retail.v2alpha.Condition.TimeRange} message TimeRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TimeRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = null; - object.endTime = null; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - return object; - }; - - /** - * Converts this TimeRange to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Condition.TimeRange - * @instance - * @returns {Object.} JSON object - */ - TimeRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TimeRange; - })(); - - return Condition; - })(); - - v2alpha.Rule = (function() { - - /** - * Properties of a Rule. - * @memberof google.cloud.retail.v2alpha - * @interface IRule - * @property {google.cloud.retail.v2alpha.Rule.IBoostAction|null} [boostAction] Rule boostAction - * @property {google.cloud.retail.v2alpha.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction - * @property {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction - * @property {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction - * @property {google.cloud.retail.v2alpha.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction - * @property {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction - * @property {google.cloud.retail.v2alpha.Rule.IFilterAction|null} [filterAction] Rule filterAction - * @property {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction - * @property {google.cloud.retail.v2alpha.ICondition|null} [condition] Rule condition - */ + /** + * Catalog merchantCenterLinkingConfig. + * @member {google.cloud.retail.v2alpha.IMerchantCenterLinkingConfig|null|undefined} merchantCenterLinkingConfig + * @memberof google.cloud.retail.v2alpha.Catalog + * @instance + */ + Catalog.prototype.merchantCenterLinkingConfig = null; /** - * Constructs a new Rule. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Rule. - * @implements IRule - * @constructor - * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + * Creates a new Catalog instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog instance */ - function Rule(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Catalog.create = function create(properties) { + return new Catalog(properties); + }; /** - * Rule boostAction. - * @member {google.cloud.retail.v2alpha.Rule.IBoostAction|null|undefined} boostAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Rule.prototype.boostAction = null; + Catalog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2alpha.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.merchantCenterLinkingConfig != null && Object.hasOwnProperty.call(message, "merchantCenterLinkingConfig")) + $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.encode(message.merchantCenterLinkingConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; /** - * Rule redirectAction. - * @member {google.cloud.retail.v2alpha.Rule.IRedirectAction|null|undefined} redirectAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Catalog.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.ICatalog} message Catalog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Rule.prototype.redirectAction = null; + Catalog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Rule onewaySynonymsAction. - * @member {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Decodes a Catalog message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.prototype.onewaySynonymsAction = null; + Catalog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Catalog(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); + break; + case 6: + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Rule doNotAssociateAction. - * @member {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Decodes a Catalog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.prototype.doNotAssociateAction = null; + Catalog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Rule replacementAction. - * @member {google.cloud.retail.v2alpha.Rule.IReplacementAction|null|undefined} replacementAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Verifies a Catalog message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rule.prototype.replacementAction = null; + Catalog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2alpha.ProductLevelConfig.verify(message.productLevelConfig); + if (error) + return "productLevelConfig." + error; + } + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) { + var error = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.verify(message.merchantCenterLinkingConfig); + if (error) + return "merchantCenterLinkingConfig." + error; + } + return null; + }; /** - * Rule ignoreAction. - * @member {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null|undefined} ignoreAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Catalog} Catalog */ - Rule.prototype.ignoreAction = null; + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Catalog) + return object; + var message = new $root.google.cloud.retail.v2alpha.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.fromObject(object.productLevelConfig); + } + if (object.merchantCenterLinkingConfig != null) { + if (typeof object.merchantCenterLinkingConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Catalog.merchantCenterLinkingConfig: object expected"); + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.fromObject(object.merchantCenterLinkingConfig); + } + return message; + }; /** - * Rule filterAction. - * @member {google.cloud.retail.v2alpha.Rule.IFilterAction|null|undefined} filterAction - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {google.cloud.retail.v2alpha.Catalog} message Catalog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Rule.prototype.filterAction = null; + Catalog.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; + object.merchantCenterLinkingConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.merchantCenterLinkingConfig != null && message.hasOwnProperty("merchantCenterLinkingConfig")) + object.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.toObject(message.merchantCenterLinkingConfig, options); + return object; + }; /** - * Rule twowaySynonymsAction. - * @member {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction - * @memberof google.cloud.retail.v2alpha.Rule + * Converts this Catalog to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Catalog * @instance + * @returns {Object.} JSON object */ - Rule.prototype.twowaySynonymsAction = null; + Catalog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Catalog; + })(); + + /** + * AttributeConfigLevel enum. + * @name google.cloud.retail.v2alpha.AttributeConfigLevel + * @enum {number} + * @property {number} ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED=0 ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED value + * @property {number} PRODUCT_LEVEL_ATTRIBUTE_CONFIG=1 PRODUCT_LEVEL_ATTRIBUTE_CONFIG value + * @property {number} CATALOG_LEVEL_ATTRIBUTE_CONFIG=2 CATALOG_LEVEL_ATTRIBUTE_CONFIG value + */ + v2alpha.AttributeConfigLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_LEVEL_ATTRIBUTE_CONFIG"] = 1; + values[valuesById[2] = "CATALOG_LEVEL_ATTRIBUTE_CONFIG"] = 2; + return values; + })(); + + /** + * SolutionType enum. + * @name google.cloud.retail.v2alpha.SolutionType + * @enum {number} + * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value + * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value + * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value + */ + v2alpha.SolutionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; + values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; + return values; + })(); + + /** + * SearchSolutionUseCase enum. + * @name google.cloud.retail.v2alpha.SearchSolutionUseCase + * @enum {number} + * @property {number} SEARCH_SOLUTION_USE_CASE_UNSPECIFIED=0 SEARCH_SOLUTION_USE_CASE_UNSPECIFIED value + * @property {number} SEARCH_SOLUTION_USE_CASE_SEARCH=1 SEARCH_SOLUTION_USE_CASE_SEARCH value + * @property {number} SEARCH_SOLUTION_USE_CASE_BROWSE=2 SEARCH_SOLUTION_USE_CASE_BROWSE value + */ + v2alpha.SearchSolutionUseCase = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SEARCH_SOLUTION_USE_CASE_SEARCH"] = 1; + values[valuesById[2] = "SEARCH_SOLUTION_USE_CASE_BROWSE"] = 2; + return values; + })(); + + v2alpha.Condition = (function() { /** - * Rule condition. - * @member {google.cloud.retail.v2alpha.ICondition|null|undefined} condition - * @memberof google.cloud.retail.v2alpha.Rule - * @instance + * Properties of a Condition. + * @memberof google.cloud.retail.v2alpha + * @interface ICondition + * @property {Array.|null} [queryTerms] Condition queryTerms + * @property {Array.|null} [activeTimeRange] Condition activeTimeRange */ - Rule.prototype.condition = null; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Constructs a new Condition. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Condition. + * @implements ICondition + * @constructor + * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + */ + function Condition(properties) { + this.queryTerms = []; + this.activeTimeRange = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Rule action. - * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action - * @memberof google.cloud.retail.v2alpha.Rule + * Condition queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Condition * @instance */ - Object.defineProperty(Rule.prototype, "action", { - get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), - set: $util.oneOfSetter($oneOfFields) - }); + Condition.prototype.queryTerms = $util.emptyArray; /** - * Creates a new Rule instance using the specified properties. + * Condition activeTimeRange. + * @member {Array.} activeTimeRange + * @memberof google.cloud.retail.v2alpha.Condition + * @instance + */ + Condition.prototype.activeTimeRange = $util.emptyArray; + + /** + * Creates a new Condition instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static - * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule} Rule instance + * @param {google.cloud.retail.v2alpha.ICondition=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition} Condition instance */ - Rule.create = function create(properties) { - return new Rule(properties); + Condition.create = function create(properties) { + return new Condition(properties); }; /** - * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static - * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rule.encode = function encode(message, writer) { + Condition.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - $root.google.cloud.retail.v2alpha.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) - $root.google.cloud.retail.v2alpha.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) - $root.google.cloud.retail.v2alpha.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) - $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) - $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) - $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) - $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) - $root.google.cloud.retail.v2alpha.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) - $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + $root.google.cloud.retail.v2alpha.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeTimeRange != null && message.activeTimeRange.length) + for (var i = 0; i < message.activeTimeRange.length; ++i) + $root.google.cloud.retail.v2alpha.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static - * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICondition} message Condition message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rule.encodeDelimited = function encodeDelimited(message, writer) { + Condition.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Rule message from the specified reader or buffer. + * Decodes a Condition message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @returns {google.cloud.retail.v2alpha.Condition} Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.decode = function decode(reader, length) { + Condition.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); + case 1: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); break; case 3: - message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); - break; - case 6: - message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); - break; - case 7: - message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); - break; - case 8: - message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); - break; - case 9: - message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); - break; - case 10: - message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); - break; - case 11: - message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); - break; - case 1: - message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -26999,269 +27395,148 @@ }; /** - * Decodes a Rule message from the specified reader or buffer, length delimited. + * Decodes a Condition message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @returns {google.cloud.retail.v2alpha.Condition} Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rule.decodeDelimited = function decodeDelimited(reader) { + Condition.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Rule message. + * Verifies a Condition message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rule.verify = function verify(message) { + Condition.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.boostAction != null && message.hasOwnProperty("boostAction")) { - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.BoostAction.verify(message.boostAction); - if (error) - return "boostAction." + error; - } - } - if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.verify(message.redirectAction); - if (error) - return "redirectAction." + error; - } - } - if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); - if (error) - return "onewaySynonymsAction." + error; - } - } - if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); - if (error) - return "doNotAssociateAction." + error; - } - } - if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.verify(message.replacementAction); - if (error) - return "replacementAction." + error; - } - } - if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.verify(message.ignoreAction); - if (error) - return "ignoreAction." + error; - } - } - if (message.filterAction != null && message.hasOwnProperty("filterAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.FilterAction.verify(message.filterAction); + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.verify(message.queryTerms[i]); if (error) - return "filterAction." + error; + return "queryTerms." + error; } } - if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { - if (properties.action === 1) - return "action: multiple values"; - properties.action = 1; - { - var error = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { + if (!Array.isArray(message.activeTimeRange)) + return "activeTimeRange: array expected"; + for (var i = 0; i < message.activeTimeRange.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Condition.TimeRange.verify(message.activeTimeRange[i]); if (error) - return "twowaySynonymsAction." + error; + return "activeTimeRange." + error; } } - if (message.condition != null && message.hasOwnProperty("condition")) { - var error = $root.google.cloud.retail.v2alpha.Condition.verify(message.condition); - if (error) - return "condition." + error; - } return null; }; /** - * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * Creates a Condition message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @returns {google.cloud.retail.v2alpha.Condition} Condition */ - Rule.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule) + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule(); - if (object.boostAction != null) { - if (typeof object.boostAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.boostAction: object expected"); - message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.fromObject(object.boostAction); - } - if (object.redirectAction != null) { - if (typeof object.redirectAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.redirectAction: object expected"); - message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.fromObject(object.redirectAction); - } - if (object.onewaySynonymsAction != null) { - if (typeof object.onewaySynonymsAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.onewaySynonymsAction: object expected"); - message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); - } - if (object.doNotAssociateAction != null) { - if (typeof object.doNotAssociateAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.doNotAssociateAction: object expected"); - message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); - } - if (object.replacementAction != null) { - if (typeof object.replacementAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.replacementAction: object expected"); - message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.fromObject(object.replacementAction); - } - if (object.ignoreAction != null) { - if (typeof object.ignoreAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.ignoreAction: object expected"); - message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.fromObject(object.ignoreAction); - } - if (object.filterAction != null) { - if (typeof object.filterAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.filterAction: object expected"); - message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.fromObject(object.filterAction); - } - if (object.twowaySynonymsAction != null) { - if (typeof object.twowaySynonymsAction !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.twowaySynonymsAction: object expected"); - message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + var message = new $root.google.cloud.retail.v2alpha.Condition(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) { + if (typeof object.queryTerms[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.queryTerms: object expected"); + message.queryTerms[i] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.fromObject(object.queryTerms[i]); + } } - if (object.condition != null) { - if (typeof object.condition !== "object") - throw TypeError(".google.cloud.retail.v2alpha.Rule.condition: object expected"); - message.condition = $root.google.cloud.retail.v2alpha.Condition.fromObject(object.condition); + if (object.activeTimeRange) { + if (!Array.isArray(object.activeTimeRange)) + throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: array expected"); + message.activeTimeRange = []; + for (var i = 0; i < object.activeTimeRange.length; ++i) { + if (typeof object.activeTimeRange[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.activeTimeRange: object expected"); + message.activeTimeRange[i] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.fromObject(object.activeTimeRange[i]); + } } return message; }; /** - * Creates a plain object from a Rule message. Also converts values to other types if specified. + * Creates a plain object from a Condition message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @static - * @param {google.cloud.retail.v2alpha.Rule} message Rule + * @param {google.cloud.retail.v2alpha.Condition} message Condition * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Rule.toObject = function toObject(message, options) { + Condition.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.condition = null; - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = $root.google.cloud.retail.v2alpha.Condition.toObject(message.condition, options); - if (message.boostAction != null && message.hasOwnProperty("boostAction")) { - object.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.toObject(message.boostAction, options); - if (options.oneofs) - object.action = "boostAction"; + if (options.arrays || options.defaults) { + object.queryTerms = []; + object.activeTimeRange = []; } - if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { - object.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.toObject(message.redirectAction, options); - if (options.oneofs) - object.action = "redirectAction"; - } - if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { - object.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); - if (options.oneofs) - object.action = "onewaySynonymsAction"; - } - if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { - object.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); - if (options.oneofs) - object.action = "doNotAssociateAction"; - } - if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { - object.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.toObject(message.replacementAction, options); - if (options.oneofs) - object.action = "replacementAction"; - } - if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { - object.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.toObject(message.ignoreAction, options); - if (options.oneofs) - object.action = "ignoreAction"; - } - if (message.filterAction != null && message.hasOwnProperty("filterAction")) { - object.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.toObject(message.filterAction, options); - if (options.oneofs) - object.action = "filterAction"; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = $root.google.cloud.retail.v2alpha.Condition.QueryTerm.toObject(message.queryTerms[j], options); } - if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { - object.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); - if (options.oneofs) - object.action = "twowaySynonymsAction"; + if (message.activeTimeRange && message.activeTimeRange.length) { + object.activeTimeRange = []; + for (var j = 0; j < message.activeTimeRange.length; ++j) + object.activeTimeRange[j] = $root.google.cloud.retail.v2alpha.Condition.TimeRange.toObject(message.activeTimeRange[j], options); } return object; }; /** - * Converts this Rule to JSON. + * Converts this Condition to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule + * @memberof google.cloud.retail.v2alpha.Condition * @instance * @returns {Object.} JSON object */ - Rule.prototype.toJSON = function toJSON() { + Condition.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - Rule.BoostAction = (function() { + Condition.QueryTerm = (function() { /** - * Properties of a BoostAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IBoostAction - * @property {number|null} [boost] BoostAction boost - * @property {string|null} [productsFilter] BoostAction productsFilter + * Properties of a QueryTerm. + * @memberof google.cloud.retail.v2alpha.Condition + * @interface IQueryTerm + * @property {string|null} [value] QueryTerm value + * @property {boolean|null} [fullMatch] QueryTerm fullMatch */ /** - * Constructs a new BoostAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a BoostAction. - * @implements IBoostAction + * Constructs a new QueryTerm. + * @memberof google.cloud.retail.v2alpha.Condition + * @classdesc Represents a QueryTerm. + * @implements IQueryTerm * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set */ - function BoostAction(properties) { + function QueryTerm(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27269,88 +27544,88 @@ } /** - * BoostAction boost. - * @member {number} boost - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * QueryTerm value. + * @member {string} value + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @instance */ - BoostAction.prototype.boost = 0; + QueryTerm.prototype.value = ""; /** - * BoostAction productsFilter. - * @member {string} productsFilter - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * QueryTerm fullMatch. + * @member {boolean} fullMatch + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @instance */ - BoostAction.prototype.productsFilter = ""; + QueryTerm.prototype.fullMatch = false; /** - * Creates a new BoostAction instance using the specified properties. + * Creates a new QueryTerm instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction instance + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm instance */ - BoostAction.create = function create(properties) { - return new BoostAction(properties); + QueryTerm.create = function create(properties) { + return new QueryTerm(properties); }; /** - * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoostAction.encode = function encode(message, writer) { + QueryTerm.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); - if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); return writer; }; /** - * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.QueryTerm.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static - * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Condition.IQueryTerm} message QueryTerm message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoostAction message from the specified reader or buffer. + * Decodes a QueryTerm message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoostAction.decode = function decode(reader, length) { + QueryTerm.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boost = reader.float(); + message.value = reader.string(); break; case 2: - message.productsFilter = reader.string(); + message.fullMatch = reader.bool(); break; default: reader.skipType(tag & 7); @@ -27361,116 +27636,117 @@ }; /** - * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoostAction.decodeDelimited = function decodeDelimited(reader) { + QueryTerm.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoostAction message. + * Verifies a QueryTerm message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoostAction.verify = function verify(message) { + QueryTerm.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) - if (!$util.isString(message.productsFilter)) - return "productsFilter: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + if (typeof message.fullMatch !== "boolean") + return "fullMatch: boolean expected"; return null; }; /** - * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction + * @returns {google.cloud.retail.v2alpha.Condition.QueryTerm} QueryTerm */ - BoostAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.BoostAction) + QueryTerm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition.QueryTerm) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); - if (object.boost != null) - message.boost = Number(object.boost); - if (object.productsFilter != null) - message.productsFilter = String(object.productsFilter); + var message = new $root.google.cloud.retail.v2alpha.Condition.QueryTerm(); + if (object.value != null) + message.value = String(object.value); + if (object.fullMatch != null) + message.fullMatch = Boolean(object.fullMatch); return message; }; /** - * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @static - * @param {google.cloud.retail.v2alpha.Rule.BoostAction} message BoostAction + * @param {google.cloud.retail.v2alpha.Condition.QueryTerm} message QueryTerm * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoostAction.toObject = function toObject(message, options) { + QueryTerm.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.boost = 0; - object.productsFilter = ""; + object.value = ""; + object.fullMatch = false; } - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) - object.productsFilter = message.productsFilter; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + object.fullMatch = message.fullMatch; return object; }; /** - * Converts this BoostAction to JSON. + * Converts this QueryTerm to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm * @instance * @returns {Object.} JSON object */ - BoostAction.prototype.toJSON = function toJSON() { + QueryTerm.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoostAction; + return QueryTerm; })(); - Rule.FilterAction = (function() { + Condition.TimeRange = (function() { /** - * Properties of a FilterAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IFilterAction - * @property {string|null} [filter] FilterAction filter + * Properties of a TimeRange. + * @memberof google.cloud.retail.v2alpha.Condition + * @interface ITimeRange + * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime */ /** - * Constructs a new FilterAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a FilterAction. - * @implements IFilterAction + * Constructs a new TimeRange. + * @memberof google.cloud.retail.v2alpha.Condition + * @classdesc Represents a TimeRange. + * @implements ITimeRange * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set */ - function FilterAction(properties) { + function TimeRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27478,75 +27754,88 @@ } /** - * FilterAction filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * TimeRange startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @instance */ - FilterAction.prototype.filter = ""; + TimeRange.prototype.startTime = null; /** - * Creates a new FilterAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction instance + * TimeRange endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @instance */ - FilterAction.create = function create(properties) { - return new FilterAction(properties); - }; + TimeRange.prototype.endTime = null; /** - * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode + * Creates a new TimeRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange instance + */ + TimeRange.create = function create(properties) { + return new TimeRange(properties); + }; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FilterAction.encode = function encode(message, writer) { + TimeRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Condition.TimeRange.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static - * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Condition.ITimeRange} message TimeRange message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + TimeRange.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FilterAction message from the specified reader or buffer. + * Decodes a TimeRange message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FilterAction.decode = function decode(reader, length) { + TimeRange.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.filter = reader.string(); + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -27557,502 +27846,604 @@ }; /** - * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * Decodes a TimeRange message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FilterAction.decodeDelimited = function decodeDelimited(reader) { + TimeRange.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FilterAction message. + * Verifies a TimeRange message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FilterAction.verify = function verify(message) { + TimeRange.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } return null; }; /** - * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction + * @returns {google.cloud.retail.v2alpha.Condition.TimeRange} TimeRange */ - FilterAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.FilterAction) + TimeRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Condition.TimeRange) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); - if (object.filter != null) - message.filter = String(object.filter); + var message = new $root.google.cloud.retail.v2alpha.Condition.TimeRange(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Condition.TimeRange.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } return message; }; /** - * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @static - * @param {google.cloud.retail.v2alpha.Rule.FilterAction} message FilterAction + * @param {google.cloud.retail.v2alpha.Condition.TimeRange} message TimeRange * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FilterAction.toObject = function toObject(message, options) { + TimeRange.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.filter = ""; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); return object; }; /** - * Converts this FilterAction to JSON. + * Converts this TimeRange to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange * @instance * @returns {Object.} JSON object */ - FilterAction.prototype.toJSON = function toJSON() { + TimeRange.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FilterAction; + return TimeRange; })(); - Rule.RedirectAction = (function() { + return Condition; + })(); - /** - * Properties of a RedirectAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IRedirectAction - * @property {string|null} [redirectUri] RedirectAction redirectUri - */ + v2alpha.Rule = (function() { - /** - * Constructs a new RedirectAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a RedirectAction. - * @implements IRedirectAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set - */ - function RedirectAction(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a Rule. + * @memberof google.cloud.retail.v2alpha + * @interface IRule + * @property {google.cloud.retail.v2alpha.Rule.IBoostAction|null} [boostAction] Rule boostAction + * @property {google.cloud.retail.v2alpha.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction + * @property {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction + * @property {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction + * @property {google.cloud.retail.v2alpha.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction + * @property {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction + * @property {google.cloud.retail.v2alpha.Rule.IFilterAction|null} [filterAction] Rule filterAction + * @property {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction + * @property {google.cloud.retail.v2alpha.ICondition|null} [condition] Rule condition + */ - /** - * RedirectAction redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @instance - */ - RedirectAction.prototype.redirectUri = ""; + /** + * Constructs a new Rule. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Rule. + * @implements IRule + * @constructor + * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + */ + function Rule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new RedirectAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction instance - */ - RedirectAction.create = function create(properties) { - return new RedirectAction(properties); - }; + /** + * Rule boostAction. + * @member {google.cloud.retail.v2alpha.Rule.IBoostAction|null|undefined} boostAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.boostAction = null; - /** - * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedirectAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); - return writer; - }; + /** + * Rule redirectAction. + * @member {google.cloud.retail.v2alpha.Rule.IRedirectAction|null|undefined} redirectAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.redirectAction = null; - /** - * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Rule onewaySynonymsAction. + * @member {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.onewaySynonymsAction = null; - /** - * Decodes a RedirectAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedirectAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.redirectUri = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RedirectAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedirectAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Rule doNotAssociateAction. + * @member {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.doNotAssociateAction = null; - /** - * Verifies a RedirectAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RedirectAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; - return null; - }; + /** + * Rule replacementAction. + * @member {google.cloud.retail.v2alpha.Rule.IReplacementAction|null|undefined} replacementAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.replacementAction = null; - /** - * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction - */ - RedirectAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.RedirectAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); - return message; - }; + /** + * Rule ignoreAction. + * @member {google.cloud.retail.v2alpha.Rule.IIgnoreAction|null|undefined} ignoreAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.ignoreAction = null; - /** - * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.RedirectAction} message RedirectAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RedirectAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.redirectUri = ""; - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; - return object; - }; + /** + * Rule filterAction. + * @member {google.cloud.retail.v2alpha.Rule.IFilterAction|null|undefined} filterAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.filterAction = null; - /** - * Converts this RedirectAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction - * @instance - * @returns {Object.} JSON object - */ - RedirectAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Rule twowaySynonymsAction. + * @member {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.twowaySynonymsAction = null; - return RedirectAction; - })(); + /** + * Rule condition. + * @member {google.cloud.retail.v2alpha.ICondition|null|undefined} condition + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Rule.prototype.condition = null; - Rule.TwowaySynonymsAction = (function() { + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Properties of a TwowaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface ITwowaySynonymsAction - * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms - */ + /** + * Rule action. + * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + */ + Object.defineProperty(Rule.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Constructs a new TwowaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a TwowaySynonymsAction. - * @implements ITwowaySynonymsAction - * @constructor - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set - */ - function TwowaySynonymsAction(properties) { - this.synonyms = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a new Rule instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.IRule=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule} Rule instance + */ + Rule.create = function create(properties) { + return new Rule(properties); + }; - /** - * TwowaySynonymsAction synonyms. - * @member {Array.} synonyms - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @instance - */ - TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; + /** + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.cloud.retail.v2alpha.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) + $root.google.cloud.retail.v2alpha.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) + $root.google.cloud.retail.v2alpha.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) + $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) + $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) + $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) + $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) + $root.google.cloud.retail.v2alpha.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) + $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; - /** - * Creates a new TwowaySynonymsAction instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance - */ - TwowaySynonymsAction.create = function create(properties) { - return new TwowaySynonymsAction(properties); - }; + /** + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.IRule} message Rule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Rule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TwowaySynonymsAction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.synonyms != null && message.synonyms.length) - for (var i = 0; i < message.synonyms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); - return writer; - }; - - /** - * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TwowaySynonymsAction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a Rule message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); + break; + case 3: + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + case 6: + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + case 7: + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + case 8: + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + case 9: + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + case 10: + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); + break; + case 11: + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + case 1: + message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; - /** - * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Rule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule} Rule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Rule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a TwowaySynonymsAction message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TwowaySynonymsAction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.synonyms != null && message.hasOwnProperty("synonyms")) { - if (!Array.isArray(message.synonyms)) - return "synonyms: array expected"; - for (var i = 0; i < message.synonyms.length; ++i) - if (!$util.isString(message.synonyms[i])) - return "synonyms: string[] expected"; + /** + * Verifies a Rule message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Rule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.BoostAction.verify(message.boostAction); + if (error) + return "boostAction." + error; } - return null; - }; - - /** - * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction - */ - TwowaySynonymsAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction) - return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); - if (object.synonyms) { - if (!Array.isArray(object.synonyms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.synonyms: array expected"); - message.synonyms = []; - for (var i = 0; i < object.synonyms.length; ++i) - message.synonyms[i] = String(object.synonyms[i]); + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.verify(message.redirectAction); + if (error) + return "redirectAction." + error; } - return message; - }; - - /** - * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @static - * @param {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} message TwowaySynonymsAction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TwowaySynonymsAction.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.synonyms = []; - if (message.synonyms && message.synonyms.length) { - object.synonyms = []; - for (var j = 0; j < message.synonyms.length; ++j) - object.synonyms[j] = message.synonyms[j]; + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); + if (error) + return "onewaySynonymsAction." + error; } - return object; - }; - - /** - * Converts this TwowaySynonymsAction to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction - * @instance - * @returns {Object.} JSON object - */ - TwowaySynonymsAction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TwowaySynonymsAction; - })(); - - Rule.OnewaySynonymsAction = (function() { - - /** - * Properties of an OnewaySynonymsAction. - * @memberof google.cloud.retail.v2alpha.Rule - * @interface IOnewaySynonymsAction - * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms - * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms - * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms - */ - + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); + if (error) + return "doNotAssociateAction." + error; + } + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.verify(message.replacementAction); + if (error) + return "replacementAction." + error; + } + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.verify(message.ignoreAction); + if (error) + return "ignoreAction." + error; + } + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.FilterAction.verify(message.filterAction); + if (error) + return "filterAction." + error; + } + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (error) + return "twowaySynonymsAction." + error; + } + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.cloud.retail.v2alpha.Condition.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a Rule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule} Rule + */ + Rule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule(); + if (object.boostAction != null) { + if (typeof object.boostAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.boostAction: object expected"); + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.fromObject(object.boostAction); + } + if (object.redirectAction != null) { + if (typeof object.redirectAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.redirectAction: object expected"); + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.fromObject(object.redirectAction); + } + if (object.onewaySynonymsAction != null) { + if (typeof object.onewaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.onewaySynonymsAction: object expected"); + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + } + if (object.doNotAssociateAction != null) { + if (typeof object.doNotAssociateAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.doNotAssociateAction: object expected"); + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); + } + if (object.replacementAction != null) { + if (typeof object.replacementAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.replacementAction: object expected"); + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.fromObject(object.replacementAction); + } + if (object.ignoreAction != null) { + if (typeof object.ignoreAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.ignoreAction: object expected"); + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.fromObject(object.ignoreAction); + } + if (object.filterAction != null) { + if (typeof object.filterAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.filterAction: object expected"); + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.fromObject(object.filterAction); + } + if (object.twowaySynonymsAction != null) { + if (typeof object.twowaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.twowaySynonymsAction: object expected"); + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Rule.condition: object expected"); + message.condition = $root.google.cloud.retail.v2alpha.Condition.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {google.cloud.retail.v2alpha.Rule} message Rule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Rule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.condition = null; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.cloud.retail.v2alpha.Condition.toObject(message.condition, options); + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + object.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.toObject(message.boostAction, options); + if (options.oneofs) + object.action = "boostAction"; + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + object.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.toObject(message.redirectAction, options); + if (options.oneofs) + object.action = "redirectAction"; + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + object.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); + if (options.oneofs) + object.action = "onewaySynonymsAction"; + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + object.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); + if (options.oneofs) + object.action = "doNotAssociateAction"; + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + object.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.toObject(message.replacementAction, options); + if (options.oneofs) + object.action = "replacementAction"; + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + object.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.toObject(message.ignoreAction, options); + if (options.oneofs) + object.action = "ignoreAction"; + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + object.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.toObject(message.filterAction, options); + if (options.oneofs) + object.action = "filterAction"; + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + object.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); + if (options.oneofs) + object.action = "twowaySynonymsAction"; + } + return object; + }; + + /** + * Converts this Rule to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule + * @instance + * @returns {Object.} JSON object + */ + Rule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Rule.BoostAction = (function() { + /** - * Constructs a new OnewaySynonymsAction. + * Properties of a BoostAction. * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents an OnewaySynonymsAction. - * @implements IOnewaySynonymsAction + * @interface IBoostAction + * @property {number|null} [boost] BoostAction boost + * @property {string|null} [productsFilter] BoostAction productsFilter + */ + + /** + * Constructs a new BoostAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a BoostAction. + * @implements IBoostAction * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set */ - function OnewaySynonymsAction(properties) { - this.queryTerms = []; - this.synonyms = []; - this.onewayTerms = []; + function BoostAction(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28060,110 +28451,88 @@ } /** - * OnewaySynonymsAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction - * @instance - */ - OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; - - /** - * OnewaySynonymsAction synonyms. - * @member {Array.} synonyms - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * BoostAction boost. + * @member {number} boost + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @instance */ - OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; + BoostAction.prototype.boost = 0; /** - * OnewaySynonymsAction onewayTerms. - * @member {Array.} onewayTerms - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * BoostAction productsFilter. + * @member {string} productsFilter + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @instance */ - OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; + BoostAction.prototype.productsFilter = ""; /** - * Creates a new OnewaySynonymsAction instance using the specified properties. + * Creates a new BoostAction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction instance */ - OnewaySynonymsAction.create = function create(properties) { - return new OnewaySynonymsAction(properties); + BoostAction.create = function create(properties) { + return new BoostAction(properties); }; /** - * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OnewaySynonymsAction.encode = function encode(message, writer) { + BoostAction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.onewayTerms != null && message.onewayTerms.length) - for (var i = 0; i < message.onewayTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); - if (message.synonyms != null && message.synonyms.length) - for (var i = 0; i < message.synonyms.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); + if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); return writer; }; /** - * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.BoostAction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IBoostAction} message BoostAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + BoostAction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * Decodes a BoostAction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OnewaySynonymsAction.decode = function decode(reader, length) { + BoostAction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 4: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); + case 1: + message.boost = reader.float(); break; case 2: - if (!(message.onewayTerms && message.onewayTerms.length)) - message.onewayTerms = []; - message.onewayTerms.push(reader.string()); + message.productsFilter = reader.string(); break; default: reader.skipType(tag & 7); @@ -28174,165 +28543,116 @@ }; /** - * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * Decodes a BoostAction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + BoostAction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OnewaySynonymsAction message. + * Verifies a BoostAction message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OnewaySynonymsAction.verify = function verify(message) { + BoostAction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.synonyms != null && message.hasOwnProperty("synonyms")) { - if (!Array.isArray(message.synonyms)) - return "synonyms: array expected"; - for (var i = 0; i < message.synonyms.length; ++i) - if (!$util.isString(message.synonyms[i])) - return "synonyms: string[] expected"; - } - if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { - if (!Array.isArray(message.onewayTerms)) - return "onewayTerms: array expected"; - for (var i = 0; i < message.onewayTerms.length; ++i) - if (!$util.isString(message.onewayTerms[i])) - return "onewayTerms: string[] expected"; - } + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + if (!$util.isString(message.productsFilter)) + return "productsFilter: string expected"; return null; }; /** - * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @returns {google.cloud.retail.v2alpha.Rule.BoostAction} BoostAction */ - OnewaySynonymsAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction) + BoostAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.BoostAction) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.synonyms) { - if (!Array.isArray(object.synonyms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.synonyms: array expected"); - message.synonyms = []; - for (var i = 0; i < object.synonyms.length; ++i) - message.synonyms[i] = String(object.synonyms[i]); - } - if (object.onewayTerms) { - if (!Array.isArray(object.onewayTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.onewayTerms: array expected"); - message.onewayTerms = []; - for (var i = 0; i < object.onewayTerms.length; ++i) - message.onewayTerms[i] = String(object.onewayTerms[i]); - } + var message = new $root.google.cloud.retail.v2alpha.Rule.BoostAction(); + if (object.boost != null) + message.boost = Number(object.boost); + if (object.productsFilter != null) + message.productsFilter = String(object.productsFilter); return message; }; /** - * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @static - * @param {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {google.cloud.retail.v2alpha.Rule.BoostAction} message BoostAction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OnewaySynonymsAction.toObject = function toObject(message, options) { + BoostAction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.onewayTerms = []; - object.queryTerms = []; - object.synonyms = []; - } - if (message.onewayTerms && message.onewayTerms.length) { - object.onewayTerms = []; - for (var j = 0; j < message.onewayTerms.length; ++j) - object.onewayTerms[j] = message.onewayTerms[j]; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.synonyms && message.synonyms.length) { - object.synonyms = []; - for (var j = 0; j < message.synonyms.length; ++j) - object.synonyms[j] = message.synonyms[j]; + if (options.defaults) { + object.boost = 0; + object.productsFilter = ""; } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + object.productsFilter = message.productsFilter; return object; }; /** - * Converts this OnewaySynonymsAction to JSON. + * Converts this BoostAction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction * @instance * @returns {Object.} JSON object */ - OnewaySynonymsAction.prototype.toJSON = function toJSON() { + BoostAction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OnewaySynonymsAction; + return BoostAction; })(); - Rule.DoNotAssociateAction = (function() { + Rule.FilterAction = (function() { /** - * Properties of a DoNotAssociateAction. + * Properties of a FilterAction. * @memberof google.cloud.retail.v2alpha.Rule - * @interface IDoNotAssociateAction - * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms - * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms - * @property {Array.|null} [terms] DoNotAssociateAction terms + * @interface IFilterAction + * @property {string|null} [filter] FilterAction filter */ /** - * Constructs a new DoNotAssociateAction. + * Constructs a new FilterAction. * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a DoNotAssociateAction. - * @implements IDoNotAssociateAction + * @classdesc Represents a FilterAction. + * @implements IFilterAction * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set */ - function DoNotAssociateAction(properties) { - this.queryTerms = []; - this.doNotAssociateTerms = []; - this.terms = []; + function FilterAction(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28340,110 +28660,75 @@ } /** - * DoNotAssociateAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; - - /** - * DoNotAssociateAction doNotAssociateTerms. - * @member {Array.} doNotAssociateTerms - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction - * @instance - */ - DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; - - /** - * DoNotAssociateAction terms. - * @member {Array.} terms - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * FilterAction filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @instance */ - DoNotAssociateAction.prototype.terms = $util.emptyArray; + FilterAction.prototype.filter = ""; /** - * Creates a new DoNotAssociateAction instance using the specified properties. + * Creates a new FilterAction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction instance + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction instance */ - DoNotAssociateAction.create = function create(properties) { - return new DoNotAssociateAction(properties); + FilterAction.create = function create(properties) { + return new FilterAction(properties); }; /** - * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DoNotAssociateAction.encode = function encode(message, writer) { + FilterAction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.terms != null && message.terms.length) - for (var i = 0; i < message.terms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); - if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) - for (var i = 0; i < message.doNotAssociateTerms.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); return writer; }; /** - * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.FilterAction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IFilterAction} message FilterAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + FilterAction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * Decodes a FilterAction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DoNotAssociateAction.decode = function decode(reader, length) { + FilterAction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) - message.doNotAssociateTerms = []; - message.doNotAssociateTerms.push(reader.string()); - break; case 1: - if (!(message.terms && message.terms.length)) - message.terms = []; - message.terms.push(reader.string()); + message.filter = reader.string(); break; default: reader.skipType(tag & 7); @@ -28454,163 +28739,107 @@ }; /** - * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * Decodes a FilterAction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + FilterAction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DoNotAssociateAction message. + * Verifies a FilterAction message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DoNotAssociateAction.verify = function verify(message) { + FilterAction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { - if (!Array.isArray(message.doNotAssociateTerms)) - return "doNotAssociateTerms: array expected"; - for (var i = 0; i < message.doNotAssociateTerms.length; ++i) - if (!$util.isString(message.doNotAssociateTerms[i])) - return "doNotAssociateTerms: string[] expected"; - } - if (message.terms != null && message.hasOwnProperty("terms")) { - if (!Array.isArray(message.terms)) - return "terms: array expected"; - for (var i = 0; i < message.terms.length; ++i) - if (!$util.isString(message.terms[i])) - return "terms: string[] expected"; - } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; return null; }; /** - * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @returns {google.cloud.retail.v2alpha.Rule.FilterAction} FilterAction */ - DoNotAssociateAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction) + FilterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.FilterAction) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.doNotAssociateTerms) { - if (!Array.isArray(object.doNotAssociateTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); - message.doNotAssociateTerms = []; - for (var i = 0; i < object.doNotAssociateTerms.length; ++i) - message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); - } - if (object.terms) { - if (!Array.isArray(object.terms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.terms: array expected"); - message.terms = []; - for (var i = 0; i < object.terms.length; ++i) - message.terms[i] = String(object.terms[i]); - } + var message = new $root.google.cloud.retail.v2alpha.Rule.FilterAction(); + if (object.filter != null) + message.filter = String(object.filter); return message; }; /** - * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @static - * @param {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {google.cloud.retail.v2alpha.Rule.FilterAction} message FilterAction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DoNotAssociateAction.toObject = function toObject(message, options) { + FilterAction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.terms = []; - object.queryTerms = []; - object.doNotAssociateTerms = []; - } - if (message.terms && message.terms.length) { - object.terms = []; - for (var j = 0; j < message.terms.length; ++j) - object.terms[j] = message.terms[j]; - } - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { - object.doNotAssociateTerms = []; - for (var j = 0; j < message.doNotAssociateTerms.length; ++j) - object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; - } + if (options.defaults) + object.filter = ""; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; return object; }; /** - * Converts this DoNotAssociateAction to JSON. + * Converts this FilterAction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction * @instance * @returns {Object.} JSON object */ - DoNotAssociateAction.prototype.toJSON = function toJSON() { + FilterAction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DoNotAssociateAction; + return FilterAction; })(); - Rule.ReplacementAction = (function() { + Rule.RedirectAction = (function() { /** - * Properties of a ReplacementAction. + * Properties of a RedirectAction. * @memberof google.cloud.retail.v2alpha.Rule - * @interface IReplacementAction - * @property {Array.|null} [queryTerms] ReplacementAction queryTerms - * @property {string|null} [replacementTerm] ReplacementAction replacementTerm - * @property {string|null} [term] ReplacementAction term + * @interface IRedirectAction + * @property {string|null} [redirectUri] RedirectAction redirectUri */ /** - * Constructs a new ReplacementAction. + * Constructs a new RedirectAction. * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents a ReplacementAction. - * @implements IReplacementAction + * @classdesc Represents a RedirectAction. + * @implements IRedirectAction * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set */ - function ReplacementAction(properties) { - this.queryTerms = []; + function RedirectAction(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28618,104 +28847,75 @@ } /** - * ReplacementAction queryTerms. - * @member {Array.} queryTerms - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @instance - */ - ReplacementAction.prototype.queryTerms = $util.emptyArray; - - /** - * ReplacementAction replacementTerm. - * @member {string} replacementTerm - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction - * @instance - */ - ReplacementAction.prototype.replacementTerm = ""; - - /** - * ReplacementAction term. - * @member {string} term - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * RedirectAction redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @instance */ - ReplacementAction.prototype.term = ""; + RedirectAction.prototype.redirectUri = ""; /** - * Creates a new ReplacementAction instance using the specified properties. + * Creates a new RedirectAction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction instance + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction instance */ - ReplacementAction.create = function create(properties) { - return new ReplacementAction(properties); + RedirectAction.create = function create(properties) { + return new RedirectAction(properties); }; /** - * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReplacementAction.encode = function encode(message, writer) { + RedirectAction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.term != null && Object.hasOwnProperty.call(message, "term")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); - if (message.queryTerms != null && message.queryTerms.length) - for (var i = 0; i < message.queryTerms.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); - if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); return writer; }; /** - * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.RedirectAction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.IRedirectAction} message RedirectAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReplacementAction message from the specified reader or buffer. + * Decodes a RedirectAction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReplacementAction.decode = function decode(reader, length) { + RedirectAction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - message.replacementTerm = reader.string(); - break; case 1: - message.term = reader.string(); + message.redirectUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -28726,138 +28926,108 @@ }; /** - * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + RedirectAction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReplacementAction message. + * Verifies a RedirectAction message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReplacementAction.verify = function verify(message) { + RedirectAction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { - if (!Array.isArray(message.queryTerms)) - return "queryTerms: array expected"; - for (var i = 0; i < message.queryTerms.length; ++i) - if (!$util.isString(message.queryTerms[i])) - return "queryTerms: string[] expected"; - } - if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) - if (!$util.isString(message.replacementTerm)) - return "replacementTerm: string expected"; - if (message.term != null && message.hasOwnProperty("term")) - if (!$util.isString(message.term)) - return "term: string expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; return null; }; /** - * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @returns {google.cloud.retail.v2alpha.Rule.RedirectAction} RedirectAction */ - ReplacementAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.ReplacementAction) + RedirectAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.RedirectAction) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); - if (object.queryTerms) { - if (!Array.isArray(object.queryTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.ReplacementAction.queryTerms: array expected"); - message.queryTerms = []; - for (var i = 0; i < object.queryTerms.length; ++i) - message.queryTerms[i] = String(object.queryTerms[i]); - } - if (object.replacementTerm != null) - message.replacementTerm = String(object.replacementTerm); - if (object.term != null) - message.term = String(object.term); + var message = new $root.google.cloud.retail.v2alpha.Rule.RedirectAction(); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); return message; }; /** - * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @static - * @param {google.cloud.retail.v2alpha.Rule.ReplacementAction} message ReplacementAction + * @param {google.cloud.retail.v2alpha.Rule.RedirectAction} message RedirectAction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReplacementAction.toObject = function toObject(message, options) { + RedirectAction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.queryTerms = []; - if (options.defaults) { - object.term = ""; - object.replacementTerm = ""; - } - if (message.term != null && message.hasOwnProperty("term")) - object.term = message.term; - if (message.queryTerms && message.queryTerms.length) { - object.queryTerms = []; - for (var j = 0; j < message.queryTerms.length; ++j) - object.queryTerms[j] = message.queryTerms[j]; - } - if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) - object.replacementTerm = message.replacementTerm; + if (options.defaults) + object.redirectUri = ""; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; return object; }; /** - * Converts this ReplacementAction to JSON. + * Converts this RedirectAction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction * @instance * @returns {Object.} JSON object */ - ReplacementAction.prototype.toJSON = function toJSON() { + RedirectAction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReplacementAction; + return RedirectAction; })(); - Rule.IgnoreAction = (function() { + Rule.TwowaySynonymsAction = (function() { /** - * Properties of an IgnoreAction. + * Properties of a TwowaySynonymsAction. * @memberof google.cloud.retail.v2alpha.Rule - * @interface IIgnoreAction - * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + * @interface ITwowaySynonymsAction + * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms */ /** - * Constructs a new IgnoreAction. + * Constructs a new TwowaySynonymsAction. * @memberof google.cloud.retail.v2alpha.Rule - * @classdesc Represents an IgnoreAction. - * @implements IIgnoreAction + * @classdesc Represents a TwowaySynonymsAction. + * @implements ITwowaySynonymsAction * @constructor - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set */ - function IgnoreAction(properties) { - this.ignoreTerms = []; + function TwowaySynonymsAction(properties) { + this.synonyms = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28865,78 +29035,78 @@ } /** - * IgnoreAction ignoreTerms. - * @member {Array.} ignoreTerms - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * TwowaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @instance */ - IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; /** - * Creates a new IgnoreAction instance using the specified properties. + * Creates a new TwowaySynonymsAction instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction instance + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance */ - IgnoreAction.create = function create(properties) { - return new IgnoreAction(properties); + TwowaySynonymsAction.create = function create(properties) { + return new TwowaySynonymsAction(properties); }; /** - * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IgnoreAction.encode = function encode(message, writer) { + TwowaySynonymsAction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ignoreTerms != null && message.ignoreTerms.length) - for (var i = 0; i < message.ignoreTerms.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); return writer; }; /** - * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {google.cloud.retail.v2alpha.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an IgnoreAction message from the specified reader or buffer. + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IgnoreAction.decode = function decode(reader, length) { + TwowaySynonymsAction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.ignoreTerms && message.ignoreTerms.length)) - message.ignoreTerms = []; - message.ignoreTerms.push(reader.string()); + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -28947,1028 +29117,1232 @@ }; /** - * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an IgnoreAction message. + * Verifies a TwowaySynonymsAction message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IgnoreAction.verify = function verify(message) { + TwowaySynonymsAction.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { - if (!Array.isArray(message.ignoreTerms)) - return "ignoreTerms: array expected"; - for (var i = 0; i < message.ignoreTerms.length; ++i) - if (!$util.isString(message.ignoreTerms[i])) - return "ignoreTerms: string[] expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; } return null; }; /** - * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @returns {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} TwowaySynonymsAction */ - IgnoreAction.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rule.IgnoreAction) + TwowaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction) return object; - var message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); - if (object.ignoreTerms) { - if (!Array.isArray(object.ignoreTerms)) - throw TypeError(".google.cloud.retail.v2alpha.Rule.IgnoreAction.ignoreTerms: array expected"); - message.ignoreTerms = []; - for (var i = 0; i < object.ignoreTerms.length; ++i) - message.ignoreTerms[i] = String(object.ignoreTerms[i]); + var message = new $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction(); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); } return message; }; /** - * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @static - * @param {google.cloud.retail.v2alpha.Rule.IgnoreAction} message IgnoreAction + * @param {google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction} message TwowaySynonymsAction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IgnoreAction.toObject = function toObject(message, options) { + TwowaySynonymsAction.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.ignoreTerms = []; - if (message.ignoreTerms && message.ignoreTerms.length) { - object.ignoreTerms = []; - for (var j = 0; j < message.ignoreTerms.length; ++j) - object.ignoreTerms[j] = message.ignoreTerms[j]; + object.synonyms = []; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; } return object; }; /** - * Converts this IgnoreAction to JSON. + * Converts this TwowaySynonymsAction to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction * @instance * @returns {Object.} JSON object */ - IgnoreAction.prototype.toJSON = function toJSON() { + TwowaySynonymsAction.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return IgnoreAction; + return TwowaySynonymsAction; })(); - return Rule; - })(); - - v2alpha.Audience = (function() { + Rule.OnewaySynonymsAction = (function() { - /** - * Properties of an Audience. - * @memberof google.cloud.retail.v2alpha - * @interface IAudience - * @property {Array.|null} [genders] Audience genders - * @property {Array.|null} [ageGroups] Audience ageGroups - */ + /** + * Properties of an OnewaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IOnewaySynonymsAction + * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms + * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms + * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms + */ - /** - * Constructs a new Audience. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Audience. - * @implements IAudience - * @constructor - * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set - */ - function Audience(properties) { - this.genders = []; - this.ageGroups = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new OnewaySynonymsAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents an OnewaySynonymsAction. + * @implements IOnewaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + */ + function OnewaySynonymsAction(properties) { + this.queryTerms = []; + this.synonyms = []; + this.onewayTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Audience genders. - * @member {Array.} genders - * @memberof google.cloud.retail.v2alpha.Audience - * @instance - */ - Audience.prototype.genders = $util.emptyArray; + /** + * OnewaySynonymsAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; - /** - * Audience ageGroups. - * @member {Array.} ageGroups - * @memberof google.cloud.retail.v2alpha.Audience - * @instance - */ - Audience.prototype.ageGroups = $util.emptyArray; + /** + * OnewaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; - /** - * Creates a new Audience instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Audience} Audience instance - */ - Audience.create = function create(properties) { - return new Audience(properties); - }; + /** + * OnewaySynonymsAction onewayTerms. + * @member {Array.} onewayTerms + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; - /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Audience.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.genders != null && message.genders.length) - for (var i = 0; i < message.genders.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); - if (message.ageGroups != null && message.ageGroups.length) - for (var i = 0; i < message.ageGroups.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); - return writer; - }; + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + */ + OnewaySynonymsAction.create = function create(properties) { + return new OnewaySynonymsAction(properties); + }; - /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Audience.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.onewayTerms != null && message.onewayTerms.length) + for (var i = 0; i < message.onewayTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + return writer; + }; - /** - * Decodes an Audience message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Audience} Audience - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Audience.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Audience(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); - break; - case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 4: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + case 2: + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes an Audience message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Audience} Audience - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Audience.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an Audience message. - * @function verify - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Audience.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.genders != null && message.hasOwnProperty("genders")) { - if (!Array.isArray(message.genders)) - return "genders: array expected"; - for (var i = 0; i < message.genders.length; ++i) - if (!$util.isString(message.genders[i])) - return "genders: string[] expected"; - } - if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { - if (!Array.isArray(message.ageGroups)) - return "ageGroups: array expected"; - for (var i = 0; i < message.ageGroups.length; ++i) - if (!$util.isString(message.ageGroups[i])) - return "ageGroups: string[] expected"; - } - return null; - }; + /** + * Verifies an OnewaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnewaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { + if (!Array.isArray(message.onewayTerms)) + return "onewayTerms: array expected"; + for (var i = 0; i < message.onewayTerms.length; ++i) + if (!$util.isString(message.onewayTerms[i])) + return "onewayTerms: string[] expected"; + } + return null; + }; - /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Audience} Audience - */ - Audience.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Audience) - return object; - var message = new $root.google.cloud.retail.v2alpha.Audience(); - if (object.genders) { - if (!Array.isArray(object.genders)) - throw TypeError(".google.cloud.retail.v2alpha.Audience.genders: array expected"); - message.genders = []; - for (var i = 0; i < object.genders.length; ++i) - message.genders[i] = String(object.genders[i]); - } - if (object.ageGroups) { - if (!Array.isArray(object.ageGroups)) - throw TypeError(".google.cloud.retail.v2alpha.Audience.ageGroups: array expected"); - message.ageGroups = []; - for (var i = 0; i < object.ageGroups.length; ++i) - message.ageGroups[i] = String(object.ageGroups[i]); - } - return message; - }; + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} OnewaySynonymsAction + */ + OnewaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + if (object.onewayTerms) { + if (!Array.isArray(object.onewayTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.onewayTerms: array expected"); + message.onewayTerms = []; + for (var i = 0; i < object.onewayTerms.length; ++i) + message.onewayTerms[i] = String(object.onewayTerms[i]); + } + return message; + }; - /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.Audience - * @static - * @param {google.cloud.retail.v2alpha.Audience} message Audience - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Audience.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.genders = []; - object.ageGroups = []; - } - if (message.genders && message.genders.length) { - object.genders = []; - for (var j = 0; j < message.genders.length; ++j) - object.genders[j] = message.genders[j]; - } - if (message.ageGroups && message.ageGroups.length) { - object.ageGroups = []; - for (var j = 0; j < message.ageGroups.length; ++j) - object.ageGroups[j] = message.ageGroups[j]; - } - return object; - }; + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnewaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.onewayTerms = []; + object.queryTerms = []; + object.synonyms = []; + } + if (message.onewayTerms && message.onewayTerms.length) { + object.onewayTerms = []; + for (var j = 0; j < message.onewayTerms.length; ++j) + object.onewayTerms[j] = message.onewayTerms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; - /** - * Converts this Audience to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.Audience - * @instance - * @returns {Object.} JSON object - */ - Audience.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this OnewaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + OnewaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Audience; - })(); + return OnewaySynonymsAction; + })(); - v2alpha.ColorInfo = (function() { + Rule.DoNotAssociateAction = (function() { - /** - * Properties of a ColorInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IColorInfo - * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies - * @property {Array.|null} [colors] ColorInfo colors - */ + /** + * Properties of a DoNotAssociateAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IDoNotAssociateAction + * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms + * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms + * @property {Array.|null} [terms] DoNotAssociateAction terms + */ - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set - */ - function ColorInfo(properties) { - this.colorFamilies = []; - this.colors = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new DoNotAssociateAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a DoNotAssociateAction. + * @implements IDoNotAssociateAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + */ + function DoNotAssociateAction(properties) { + this.queryTerms = []; + this.doNotAssociateTerms = []; + this.terms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ColorInfo colorFamilies. - * @member {Array.} colorFamilies - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @instance - */ - ColorInfo.prototype.colorFamilies = $util.emptyArray; + /** + * DoNotAssociateAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; - /** - * ColorInfo colors. - * @member {Array.} colors - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @instance - */ - ColorInfo.prototype.colors = $util.emptyArray; + /** + * DoNotAssociateAction doNotAssociateTerms. + * @member {Array.} doNotAssociateTerms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; + /** + * DoNotAssociateAction terms. + * @member {Array.} terms + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.terms = $util.emptyArray; - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.colorFamilies != null && message.colorFamilies.length) - for (var i = 0; i < message.colorFamilies.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); - return writer; - }; + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction instance + */ + DoNotAssociateAction.create = function create(properties) { + return new DoNotAssociateAction(properties); + }; - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.terms != null && message.terms.length) + for (var i = 0; i < message.terms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + return writer; + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ColorInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + case 1: + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Verifies a ColorInfo message. - * @function verify - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ColorInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { - if (!Array.isArray(message.colorFamilies)) - return "colorFamilies: array expected"; - for (var i = 0; i < message.colorFamilies.length; ++i) - if (!$util.isString(message.colorFamilies[i])) - return "colorFamilies: string[] expected"; - } - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) - if (!$util.isString(message.colors[i])) - return "colors: string[] expected"; - } - return null; - }; + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ColorInfo) - return object; - var message = new $root.google.cloud.retail.v2alpha.ColorInfo(); - if (object.colorFamilies) { - if (!Array.isArray(object.colorFamilies)) - throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colorFamilies: array expected"); - message.colorFamilies = []; - for (var i = 0; i < object.colorFamilies.length; ++i) - message.colorFamilies[i] = String(object.colorFamilies[i]); - } - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) - message.colors[i] = String(object.colors[i]); - } - return message; - }; + /** + * Verifies a DoNotAssociateAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoNotAssociateAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { + if (!Array.isArray(message.doNotAssociateTerms)) + return "doNotAssociateTerms: array expected"; + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + if (!$util.isString(message.doNotAssociateTerms[i])) + return "doNotAssociateTerms: string[] expected"; + } + if (message.terms != null && message.hasOwnProperty("terms")) { + if (!Array.isArray(message.terms)) + return "terms: array expected"; + for (var i = 0; i < message.terms.length; ++i) + if (!$util.isString(message.terms[i])) + return "terms: string[] expected"; + } + return null; + }; - /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @static - * @param {google.cloud.retail.v2alpha.ColorInfo} message ColorInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ColorInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.colorFamilies = []; - object.colors = []; - } - if (message.colorFamilies && message.colorFamilies.length) { - object.colorFamilies = []; - for (var j = 0; j < message.colorFamilies.length; ++j) - object.colorFamilies[j] = message.colorFamilies[j]; - } - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = message.colors[j]; - } - return object; - }; + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} DoNotAssociateAction + */ + DoNotAssociateAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.doNotAssociateTerms) { + if (!Array.isArray(object.doNotAssociateTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); + message.doNotAssociateTerms = []; + for (var i = 0; i < object.doNotAssociateTerms.length; ++i) + message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); + } + if (object.terms) { + if (!Array.isArray(object.terms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.terms: array expected"); + message.terms = []; + for (var i = 0; i < object.terms.length; ++i) + message.terms[i] = String(object.terms[i]); + } + return message; + }; - /** - * Converts this ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoNotAssociateAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.terms = []; + object.queryTerms = []; + object.doNotAssociateTerms = []; + } + if (message.terms && message.terms.length) { + object.terms = []; + for (var j = 0; j < message.terms.length; ++j) + object.terms[j] = message.terms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { + object.doNotAssociateTerms = []; + for (var j = 0; j < message.doNotAssociateTerms.length; ++j) + object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; + } + return object; + }; - return ColorInfo; - })(); + /** + * Converts this DoNotAssociateAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @instance + * @returns {Object.} JSON object + */ + DoNotAssociateAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - v2alpha.CustomAttribute = (function() { + return DoNotAssociateAction; + })(); - /** - * Properties of a CustomAttribute. - * @memberof google.cloud.retail.v2alpha - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers - * @property {boolean|null} [searchable] CustomAttribute searchable - * @property {boolean|null} [indexable] CustomAttribute indexable - */ + Rule.ReplacementAction = (function() { - /** - * Constructs a new CustomAttribute. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute - * @constructor - * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set - */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a ReplacementAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IReplacementAction + * @property {Array.|null} [queryTerms] ReplacementAction queryTerms + * @property {string|null} [replacementTerm] ReplacementAction replacementTerm + * @property {string|null} [term] ReplacementAction term + */ - /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.text = $util.emptyArray; + /** + * Constructs a new ReplacementAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents a ReplacementAction. + * @implements IReplacementAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + */ + function ReplacementAction(properties) { + this.queryTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.numbers = $util.emptyArray; + /** + * ReplacementAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.queryTerms = $util.emptyArray; - /** - * CustomAttribute searchable. - * @member {boolean|null|undefined} searchable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.searchable = null; - - /** - * CustomAttribute indexable. - * @member {boolean|null|undefined} indexable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - CustomAttribute.prototype.indexable = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * CustomAttribute _searchable. - * @member {"searchable"|undefined} _searchable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_searchable", { - get: $util.oneOfGetter($oneOfFields = ["searchable"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * ReplacementAction replacementTerm. + * @member {string} replacementTerm + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.replacementTerm = ""; - /** - * CustomAttribute _indexable. - * @member {"indexable"|undefined} _indexable - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_indexable", { - get: $util.oneOfGetter($oneOfFields = ["indexable"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * ReplacementAction term. + * @member {string} term + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.term = ""; - /** - * Creates a new CustomAttribute instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance - */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); - }; + /** + * Creates a new ReplacementAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction instance + */ + ReplacementAction.create = function create(properties) { + return new ReplacementAction(properties); + }; - /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomAttribute.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } - if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); - if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); - return writer; - }; + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.term != null && Object.hasOwnProperty.call(message, "term")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + return writer; + }; - /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.ReplacementAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a CustomAttribute message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomAttribute.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + case 3: + message.replacementTerm = reader.string(); + break; + case 1: + message.term = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a CustomAttribute message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomAttribute.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - properties._searchable = 1; - if (typeof message.searchable !== "boolean") - return "searchable: boolean expected"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - properties._indexable = 1; - if (typeof message.indexable !== "boolean") - return "indexable: boolean expected"; - } - return null; - }; + /** + * Verifies a ReplacementAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplacementAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + if (!$util.isString(message.replacementTerm)) + return "replacementTerm: string expected"; + if (message.term != null && message.hasOwnProperty("term")) + if (!$util.isString(message.term)) + return "term: string expected"; + return null; + }; - /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute - */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.ReplacementAction} ReplacementAction + */ + ReplacementAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.ReplacementAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.ReplacementAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.ReplacementAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.replacementTerm != null) + message.replacementTerm = String(object.replacementTerm); + if (object.term != null) + message.term = String(object.term); + return message; + }; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.ReplacementAction} message ReplacementAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplacementAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.queryTerms = []; + if (options.defaults) { + object.term = ""; + object.replacementTerm = ""; + } + if (message.term != null && message.hasOwnProperty("term")) + object.term = message.term; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + object.replacementTerm = message.replacementTerm; return object; - var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); - } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); - } - if (object.searchable != null) - message.searchable = Boolean(object.searchable); - if (object.indexable != null) - message.indexable = Boolean(object.indexable); - return message; - }; + }; - /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @static - * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomAttribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - object.searchable = message.searchable; - if (options.oneofs) - object._searchable = "searchable"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - object.indexable = message.indexable; - if (options.oneofs) - object._indexable = "indexable"; - } - return object; - }; + /** + * Converts this ReplacementAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @instance + * @returns {Object.} JSON object + */ + ReplacementAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this CustomAttribute to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CustomAttribute - * @instance - * @returns {Object.} JSON object - */ - CustomAttribute.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ReplacementAction; + })(); - return CustomAttribute; - })(); + Rule.IgnoreAction = (function() { - v2alpha.FulfillmentInfo = (function() { + /** + * Properties of an IgnoreAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @interface IIgnoreAction + * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + */ - /** - * Properties of a FulfillmentInfo. - * @memberof google.cloud.retail.v2alpha - * @interface IFulfillmentInfo - * @property {string|null} [type] FulfillmentInfo type - * @property {Array.|null} [placeIds] FulfillmentInfo placeIds - */ + /** + * Constructs a new IgnoreAction. + * @memberof google.cloud.retail.v2alpha.Rule + * @classdesc Represents an IgnoreAction. + * @implements IIgnoreAction + * @constructor + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + */ + function IgnoreAction(properties) { + this.ignoreTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new FulfillmentInfo. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a FulfillmentInfo. - * @implements IFulfillmentInfo - * @constructor - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set - */ - function FulfillmentInfo(properties) { - this.placeIds = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + /** + * IgnoreAction ignoreTerms. + * @member {Array.} ignoreTerms + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @instance + */ + IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction instance + */ + IgnoreAction.create = function create(properties) { + return new IgnoreAction(properties); + }; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ignoreTerms != null && message.ignoreTerms.length) + for (var i = 0; i < message.ignoreTerms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + return writer; + }; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rule.IgnoreAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IgnoreAction message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IgnoreAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { + if (!Array.isArray(message.ignoreTerms)) + return "ignoreTerms: array expected"; + for (var i = 0; i < message.ignoreTerms.length; ++i) + if (!$util.isString(message.ignoreTerms[i])) + return "ignoreTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Rule.IgnoreAction} IgnoreAction + */ + IgnoreAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rule.IgnoreAction) + return object; + var message = new $root.google.cloud.retail.v2alpha.Rule.IgnoreAction(); + if (object.ignoreTerms) { + if (!Array.isArray(object.ignoreTerms)) + throw TypeError(".google.cloud.retail.v2alpha.Rule.IgnoreAction.ignoreTerms: array expected"); + message.ignoreTerms = []; + for (var i = 0; i < object.ignoreTerms.length; ++i) + message.ignoreTerms[i] = String(object.ignoreTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2alpha.Rule.IgnoreAction} message IgnoreAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IgnoreAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreTerms = []; + if (message.ignoreTerms && message.ignoreTerms.length) { + object.ignoreTerms = []; + for (var j = 0; j < message.ignoreTerms.length; ++j) + object.ignoreTerms[j] = message.ignoreTerms[j]; + } + return object; + }; + + /** + * Converts this IgnoreAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @instance + * @returns {Object.} JSON object + */ + IgnoreAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IgnoreAction; + })(); + + return Rule; + })(); + + v2alpha.Audience = (function() { + + /** + * Properties of an Audience. + * @memberof google.cloud.retail.v2alpha + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups + */ + + /** + * Constructs a new Audience. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an Audience. + * @implements IAudience + * @constructor + * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set + */ + function Audience(properties) { + this.genders = []; + this.ageGroups = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** - * FulfillmentInfo type. - * @member {string} type - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2alpha.Audience * @instance */ - FulfillmentInfo.prototype.type = ""; + Audience.prototype.genders = $util.emptyArray; /** - * FulfillmentInfo placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2alpha.Audience * @instance */ - FulfillmentInfo.prototype.placeIds = $util.emptyArray; + Audience.prototype.ageGroups = $util.emptyArray; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * Creates a new Audience instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo instance + * @param {google.cloud.retail.v2alpha.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Audience} Audience instance */ - FulfillmentInfo.create = function create(properties) { - return new FulfillmentInfo(properties); + Audience.create = function create(properties) { + return new Audience(properties); }; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encode = function encode(message, writer) { + Audience.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); return writer; }; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Audience.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + Audience.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2alpha.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decode = function decode(reader, length) { + Audience.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Audience(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.string(); + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); break; case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -29979,130 +30353,143 @@ }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2alpha.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + Audience.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FulfillmentInfo message. + * Verifies an Audience message. * @function verify - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FulfillmentInfo.verify = function verify(message) { + Audience.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; } return null; }; /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2alpha.Audience} Audience */ - FulfillmentInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.FulfillmentInfo) + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Audience) return object; - var message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.FulfillmentInfo.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); + var message = new $root.google.cloud.retail.v2alpha.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2alpha.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2alpha.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); } return message; }; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * Creates a plain object from an Audience message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @static - * @param {google.cloud.retail.v2alpha.FulfillmentInfo} message FulfillmentInfo + * @param {google.cloud.retail.v2alpha.Audience} message Audience * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FulfillmentInfo.toObject = function toObject(message, options) { + Audience.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) - object.type = ""; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; } return object; }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this Audience to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Audience * @instance * @returns {Object.} JSON object */ - FulfillmentInfo.prototype.toJSON = function toJSON() { + Audience.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FulfillmentInfo; + return Audience; })(); - v2alpha.Image = (function() { + v2alpha.ColorInfo = (function() { /** - * Properties of an Image. + * Properties of a ColorInfo. * @memberof google.cloud.retail.v2alpha - * @interface IImage - * @property {string|null} [uri] Image uri - * @property {number|null} [height] Image height - * @property {number|null} [width] Image width + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors */ /** - * Constructs a new Image. + * Constructs a new ColorInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set */ - function Image(properties) { + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30110,101 +30497,94 @@ } /** - * Image uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.Image - * @instance - */ - Image.prototype.uri = ""; - - /** - * Image height. - * @member {number} height - * @memberof google.cloud.retail.v2alpha.Image + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance */ - Image.prototype.height = 0; + ColorInfo.prototype.colorFamilies = $util.emptyArray; /** - * Image width. - * @member {number} width - * @memberof google.cloud.retail.v2alpha.Image + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance */ - Image.prototype.width = 0; + ColorInfo.prototype.colors = $util.emptyArray; /** - * Creates a new Image instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Image} Image instance + * @param {google.cloud.retail.v2alpha.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo instance */ - Image.create = function create(properties) { - return new Image(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode + * @param {google.cloud.retail.v2alpha.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Image} Image + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + ColorInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); break; case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -30215,127 +30595,145 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Image} Image + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; + } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; + } return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Image} Image + * @returns {google.cloud.retail.v2alpha.ColorInfo} ColorInfo */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Image) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ColorInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.Image(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.height != null) - message.height = object.height | 0; - if (object.width != null) - message.width = object.width | 0; + var message = new $root.google.cloud.retail.v2alpha.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); + } + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2alpha.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); + } return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @static - * @param {google.cloud.retail.v2alpha.Image} message Image + * @param {google.cloud.retail.v2alpha.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.uri = ""; - object.height = 0; - object.width = 0; + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; + } + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; + } + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; return object; }; /** - * Converts this Image to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Image + * @memberof google.cloud.retail.v2alpha.ColorInfo * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return ColorInfo; })(); - v2alpha.Interval = (function() { + v2alpha.CustomAttribute = (function() { /** - * Properties of an Interval. + * Properties of a CustomAttribute. * @memberof google.cloud.retail.v2alpha - * @interface IInterval - * @property {number|null} [minimum] Interval minimum - * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum - * @property {number|null} [maximum] Interval maximum - * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable */ /** - * Constructs a new Interval. + * Constructs a new CustomAttribute. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an Interval. - * @implements IInterval + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute * @constructor - * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set */ - function Interval(properties) { + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30343,139 +30741,153 @@ } /** - * Interval minimum. - * @member {number|null|undefined} minimum - * @memberof google.cloud.retail.v2alpha.Interval + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - Interval.prototype.minimum = null; + CustomAttribute.prototype.text = $util.emptyArray; /** - * Interval exclusiveMinimum. - * @member {number|null|undefined} exclusiveMinimum - * @memberof google.cloud.retail.v2alpha.Interval + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - Interval.prototype.exclusiveMinimum = null; + CustomAttribute.prototype.numbers = $util.emptyArray; /** - * Interval maximum. - * @member {number|null|undefined} maximum - * @memberof google.cloud.retail.v2alpha.Interval + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - Interval.prototype.maximum = null; + CustomAttribute.prototype.searchable = null; /** - * Interval exclusiveMaximum. - * @member {number|null|undefined} exclusiveMaximum - * @memberof google.cloud.retail.v2alpha.Interval + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - Interval.prototype.exclusiveMaximum = null; + CustomAttribute.prototype.indexable = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * Interval min. - * @member {"minimum"|"exclusiveMinimum"|undefined} min - * @memberof google.cloud.retail.v2alpha.Interval + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - Object.defineProperty(Interval.prototype, "min", { - get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Interval max. - * @member {"maximum"|"exclusiveMaximum"|undefined} max - * @memberof google.cloud.retail.v2alpha.Interval + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance */ - Object.defineProperty(Interval.prototype, "max", { - get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new Interval instance using the specified properties. + * Creates a new CustomAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Interval} Interval instance + * @param {google.cloud.retail.v2alpha.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute instance */ - Interval.create = function create(properties) { - return new Interval(properties); + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); }; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Interval.encode = function encode(message, writer) { + CustomAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); - if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); - if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) - writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); - if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) - writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); return writer; }; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CustomAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICustomAttribute} message CustomAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Interval.encodeDelimited = function encodeDelimited(message, writer) { + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes a CustomAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Interval} Interval + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Interval.decode = function decode(reader, length) { + CustomAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Interval(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.minimum = reader.double(); + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); break; case 2: - message.exclusiveMinimum = reader.double(); + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); break; case 3: - message.maximum = reader.double(); + message.searchable = reader.bool(); break; case 4: - message.exclusiveMaximum = reader.double(); + message.indexable = reader.bool(); break; default: reader.skipType(tag & 7); @@ -30486,157 +30898,167 @@ }; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Interval} Interval + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Interval.decodeDelimited = function decodeDelimited(reader) { + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Interval message. + * Verifies a CustomAttribute message. * @function verify - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Interval.verify = function verify(message) { + CustomAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - properties.min = 1; - if (typeof message.minimum !== "number") - return "minimum: number expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - if (properties.min === 1) - return "min: multiple values"; - properties.min = 1; - if (typeof message.exclusiveMinimum !== "number") - return "exclusiveMinimum: number expected"; + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - properties.max = 1; - if (typeof message.maximum !== "number") - return "maximum: number expected"; + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - if (properties.max === 1) - return "max: multiple values"; - properties.max = 1; - if (typeof message.exclusiveMaximum !== "number") - return "exclusiveMaximum: number expected"; + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; } return null; }; /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Interval} Interval + * @returns {google.cloud.retail.v2alpha.CustomAttribute} CustomAttribute */ - Interval.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Interval) + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CustomAttribute) return object; - var message = new $root.google.cloud.retail.v2alpha.Interval(); - if (object.minimum != null) - message.minimum = Number(object.minimum); - if (object.exclusiveMinimum != null) - message.exclusiveMinimum = Number(object.exclusiveMinimum); - if (object.maximum != null) - message.maximum = Number(object.maximum); - if (object.exclusiveMaximum != null) - message.exclusiveMaximum = Number(object.exclusiveMaximum); + var message = new $root.google.cloud.retail.v2alpha.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2alpha.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); return message; }; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @static - * @param {google.cloud.retail.v2alpha.Interval} message Interval + * @param {google.cloud.retail.v2alpha.CustomAttribute} message CustomAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Interval.toObject = function toObject(message, options) { + CustomAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.minimum != null && message.hasOwnProperty("minimum")) { - object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; - if (options.oneofs) - object.min = "minimum"; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; } - if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { - object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; - if (options.oneofs) - object.min = "exclusiveMinimum"; + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; } - if (message.maximum != null && message.hasOwnProperty("maximum")) { - object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; if (options.oneofs) - object.max = "maximum"; + object._searchable = "searchable"; } - if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { - object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; if (options.oneofs) - object.max = "exclusiveMaximum"; + object._indexable = "indexable"; } return object; }; /** - * Converts this Interval to JSON. + * Converts this CustomAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Interval + * @memberof google.cloud.retail.v2alpha.CustomAttribute * @instance * @returns {Object.} JSON object */ - Interval.prototype.toJSON = function toJSON() { + CustomAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Interval; + return CustomAttribute; })(); - v2alpha.PriceInfo = (function() { + v2alpha.FulfillmentInfo = (function() { /** - * Properties of a PriceInfo. + * Properties of a FulfillmentInfo. * @memberof google.cloud.retail.v2alpha - * @interface IPriceInfo - * @property {string|null} [currencyCode] PriceInfo currencyCode - * @property {number|null} [price] PriceInfo price - * @property {number|null} [originalPrice] PriceInfo originalPrice - * @property {number|null} [cost] PriceInfo cost - * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime - * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime - * @property {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds */ /** - * Constructs a new PriceInfo. + * Constructs a new FulfillmentInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PriceInfo. - * @implements IPriceInfo + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo * @constructor - * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set */ - function PriceInfo(properties) { + function FulfillmentInfo(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30644,153 +31066,91 @@ } /** - * PriceInfo currencyCode. - * @member {string} currencyCode - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.currencyCode = ""; - - /** - * PriceInfo price. - * @member {number} price - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.price = 0; - - /** - * PriceInfo originalPrice. - * @member {number} originalPrice - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.originalPrice = 0; - - /** - * PriceInfo cost. - * @member {number} cost - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.cost = 0; - - /** - * PriceInfo priceEffectiveTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @instance - */ - PriceInfo.prototype.priceEffectiveTime = null; - - /** - * PriceInfo priceExpireTime. - * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime - * @memberof google.cloud.retail.v2alpha.PriceInfo + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance */ - PriceInfo.prototype.priceExpireTime = null; + FulfillmentInfo.prototype.type = ""; /** - * PriceInfo priceRange. - * @member {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null|undefined} priceRange - * @memberof google.cloud.retail.v2alpha.PriceInfo + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance */ - PriceInfo.prototype.priceRange = null; + FulfillmentInfo.prototype.placeIds = $util.emptyArray; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new FulfillmentInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo instance */ - PriceInfo.create = function create(properties) { - return new PriceInfo(properties); + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); }; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encode = function encode(message, writer) { + FulfillmentInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); - if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); - if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) - $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) - $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) - $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); return writer; }; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.FulfillmentInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a FulfillmentInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decode = function decode(reader, length) { + FulfillmentInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.currencyCode = reader.string(); + message.type = reader.string(); break; case 2: - message.price = reader.float(); - break; - case 3: - message.originalPrice = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -30801,507 +31161,232 @@ }; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PriceInfo.decodeDelimited = function decodeDelimited(reader) { + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PriceInfo message. + * Verifies a FulfillmentInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PriceInfo.verify = function verify(message) { + FulfillmentInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - if (!$util.isString(message.currencyCode)) - return "currencyCode: string expected"; - if (message.price != null && message.hasOwnProperty("price")) - if (typeof message.price !== "number") - return "price: number expected"; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - if (typeof message.originalPrice !== "number") - return "originalPrice: number expected"; - if (message.cost != null && message.hasOwnProperty("cost")) - if (typeof message.cost !== "number") - return "cost: number expected"; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); - if (error) - return "priceEffectiveTime." + error; - } - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); - if (error) - return "priceExpireTime." + error; - } - if (message.priceRange != null && message.hasOwnProperty("priceRange")) { - var error = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify(message.priceRange); - if (error) - return "priceRange." + error; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; } return null; }; /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo + * @returns {google.cloud.retail.v2alpha.FulfillmentInfo} FulfillmentInfo */ - PriceInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.FulfillmentInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); - if (object.currencyCode != null) - message.currencyCode = String(object.currencyCode); - if (object.price != null) - message.price = Number(object.price); - if (object.originalPrice != null) - message.originalPrice = Number(object.originalPrice); - if (object.cost != null) - message.cost = Number(object.cost); - if (object.priceEffectiveTime != null) { - if (typeof object.priceEffectiveTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceEffectiveTime: object expected"); - message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); - } - if (object.priceExpireTime != null) { - if (typeof object.priceExpireTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceExpireTime: object expected"); - message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); - } - if (object.priceRange != null) { - if (typeof object.priceRange !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceRange: object expected"); - message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.fromObject(object.priceRange); + var message = new $root.google.cloud.retail.v2alpha.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.FulfillmentInfo.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); } return message; }; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @static - * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo + * @param {google.cloud.retail.v2alpha.FulfillmentInfo} message FulfillmentInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PriceInfo.toObject = function toObject(message, options) { + FulfillmentInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.currencyCode = ""; - object.price = 0; - object.originalPrice = 0; - object.cost = 0; - object.priceEffectiveTime = null; - object.priceExpireTime = null; - object.priceRange = null; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; } - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) - object.currencyCode = message.currencyCode; - if (message.price != null && message.hasOwnProperty("price")) - object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; - if (message.cost != null && message.hasOwnProperty("cost")) - object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; - if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) - object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); - if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) - object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); - if (message.priceRange != null && message.hasOwnProperty("priceRange")) - object.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; /** - * Converts this PriceInfo to JSON. + * Converts this FulfillmentInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PriceInfo + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo * @instance * @returns {Object.} JSON object */ - PriceInfo.prototype.toJSON = function toJSON() { + FulfillmentInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PriceInfo.PriceRange = (function() { - - /** - * Properties of a PriceRange. - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @interface IPriceRange - * @property {google.cloud.retail.v2alpha.IInterval|null} [price] PriceRange price - * @property {google.cloud.retail.v2alpha.IInterval|null} [originalPrice] PriceRange originalPrice - */ + return FulfillmentInfo; + })(); - /** - * Constructs a new PriceRange. - * @memberof google.cloud.retail.v2alpha.PriceInfo - * @classdesc Represents a PriceRange. - * @implements IPriceRange - * @constructor - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set - */ - function PriceRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2alpha.Image = (function() { - /** - * PriceRange price. - * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} price - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.price = null; + /** + * Properties of an Image. + * @memberof google.cloud.retail.v2alpha + * @interface IImage + * @property {string|null} [uri] Image uri + * @property {number|null} [height] Image height + * @property {number|null} [width] Image width + */ - /** - * PriceRange originalPrice. - * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} originalPrice - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @instance - */ - PriceRange.prototype.originalPrice = null; + /** + * Constructs a new Image. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + */ + function Image(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new PriceRange instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange instance - */ - PriceRange.create = function create(properties) { - return new PriceRange(properties); - }; - - /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.price != null && Object.hasOwnProperty.call(message, "price")) - $root.google.cloud.retail.v2alpha.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) - $root.google.cloud.retail.v2alpha.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PriceRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PriceRange message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; - case 2: - message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PriceRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PriceRange message. - * @function verify - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PriceRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.price != null && message.hasOwnProperty("price")) { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.price); - if (error) - return "price." + error; - } - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.originalPrice); - if (error) - return "originalPrice." + error; - } - return null; - }; - - /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange - */ - PriceRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange) - return object; - var message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); - if (object.price != null) { - if (typeof object.price !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.price: object expected"); - message.price = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.price); - } - if (object.originalPrice != null) { - if (typeof object.originalPrice !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.originalPrice: object expected"); - message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.originalPrice); - } - return message; - }; - - /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @static - * @param {google.cloud.retail.v2alpha.PriceInfo.PriceRange} message PriceRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PriceRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.price = null; - object.originalPrice = null; - } - if (message.price != null && message.hasOwnProperty("price")) - object.price = $root.google.cloud.retail.v2alpha.Interval.toObject(message.price, options); - if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) - object.originalPrice = $root.google.cloud.retail.v2alpha.Interval.toObject(message.originalPrice, options); - return object; - }; - - /** - * Converts this PriceRange to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange - * @instance - * @returns {Object.} JSON object - */ - PriceRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PriceRange; - })(); - - return PriceInfo; - })(); - - v2alpha.Rating = (function() { - - /** - * Properties of a Rating. - * @memberof google.cloud.retail.v2alpha - * @interface IRating - * @property {number|null} [ratingCount] Rating ratingCount - * @property {number|null} [averageRating] Rating averageRating - * @property {Array.|null} [ratingHistogram] Rating ratingHistogram - */ - - /** - * Constructs a new Rating. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Rating. - * @implements IRating - * @constructor - * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set - */ - function Rating(properties) { - this.ratingHistogram = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Image uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Image + * @instance + */ + Image.prototype.uri = ""; /** - * Rating ratingCount. - * @member {number} ratingCount - * @memberof google.cloud.retail.v2alpha.Rating - * @instance - */ - Rating.prototype.ratingCount = 0; - - /** - * Rating averageRating. - * @member {number} averageRating - * @memberof google.cloud.retail.v2alpha.Rating + * Image height. + * @member {number} height + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - Rating.prototype.averageRating = 0; + Image.prototype.height = 0; /** - * Rating ratingHistogram. - * @member {Array.} ratingHistogram - * @memberof google.cloud.retail.v2alpha.Rating + * Image width. + * @member {number} width + * @memberof google.cloud.retail.v2alpha.Image * @instance */ - Rating.prototype.ratingHistogram = $util.emptyArray; + Image.prototype.width = 0; /** - * Creates a new Rating instance using the specified properties. + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Rating} Rating instance + * @param {google.cloud.retail.v2alpha.IImage=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Image} Image instance */ - Rating.create = function create(properties) { - return new Rating(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rating.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); - if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); - if (message.ratingHistogram != null && message.ratingHistogram.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (var i = 0; i < message.ratingHistogram.length; ++i) - writer.int32(message.ratingHistogram[i]); - writer.ldelim(); - } + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.width); return writer; }; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Rating.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Rating} Rating + * @returns {google.cloud.retail.v2alpha.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rating.decode = function decode(reader, length) { + Image.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rating(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.ratingCount = reader.int32(); + message.uri = reader.string(); break; case 2: - message.averageRating = reader.float(); + message.height = reader.int32(); break; case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.ratingHistogram.push(reader.int32()); - } else - message.ratingHistogram.push(reader.int32()); + message.width = reader.int32(); break; default: reader.skipType(tag & 7); @@ -31312,140 +31397,127 @@ }; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Rating} Rating + * @returns {google.cloud.retail.v2alpha.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Rating.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Rating message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Rating.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - if (!$util.isInteger(message.ratingCount)) - return "ratingCount: integer expected"; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - if (typeof message.averageRating !== "number") - return "averageRating: number expected"; - if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { - if (!Array.isArray(message.ratingHistogram)) - return "ratingHistogram: array expected"; - for (var i = 0; i < message.ratingHistogram.length; ++i) - if (!$util.isInteger(message.ratingHistogram[i])) - return "ratingHistogram: integer[] expected"; - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; return null; }; /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Rating} Rating + * @returns {google.cloud.retail.v2alpha.Image} Image */ - Rating.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Rating) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Image) return object; - var message = new $root.google.cloud.retail.v2alpha.Rating(); - if (object.ratingCount != null) - message.ratingCount = object.ratingCount | 0; - if (object.averageRating != null) - message.averageRating = Number(object.averageRating); - if (object.ratingHistogram) { - if (!Array.isArray(object.ratingHistogram)) - throw TypeError(".google.cloud.retail.v2alpha.Rating.ratingHistogram: array expected"); - message.ratingHistogram = []; - for (var i = 0; i < object.ratingHistogram.length; ++i) - message.ratingHistogram[i] = object.ratingHistogram[i] | 0; - } + var message = new $root.google.cloud.retail.v2alpha.Image(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.height != null) + message.height = object.height | 0; + if (object.width != null) + message.width = object.width | 0; return message; }; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @static - * @param {google.cloud.retail.v2alpha.Rating} message Rating + * @param {google.cloud.retail.v2alpha.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Rating.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.ratingHistogram = []; if (options.defaults) { - object.ratingCount = 0; - object.averageRating = 0; - } - if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) - object.ratingCount = message.ratingCount; - if (message.averageRating != null && message.hasOwnProperty("averageRating")) - object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; - if (message.ratingHistogram && message.ratingHistogram.length) { - object.ratingHistogram = []; - for (var j = 0; j < message.ratingHistogram.length; ++j) - object.ratingHistogram[j] = message.ratingHistogram[j]; + object.uri = ""; + object.height = 0; + object.width = 0; } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; return object; }; /** - * Converts this Rating to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Rating + * @memberof google.cloud.retail.v2alpha.Image * @instance * @returns {Object.} JSON object */ - Rating.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Rating; + return Image; })(); - v2alpha.UserInfo = (function() { + v2alpha.Interval = (function() { /** - * Properties of a UserInfo. + * Properties of an Interval. * @memberof google.cloud.retail.v2alpha - * @interface IUserInfo - * @property {string|null} [userId] UserInfo userId - * @property {string|null} [ipAddress] UserInfo ipAddress - * @property {string|null} [userAgent] UserInfo userAgent - * @property {boolean|null} [directUserRequest] UserInfo directUserRequest + * @interface IInterval + * @property {number|null} [minimum] Interval minimum + * @property {number|null} [exclusiveMinimum] Interval exclusiveMinimum + * @property {number|null} [maximum] Interval maximum + * @property {number|null} [exclusiveMaximum] Interval exclusiveMaximum */ /** - * Constructs a new UserInfo. + * Constructs a new Interval. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserInfo. - * @implements IUserInfo + * @classdesc Represents an Interval. + * @implements IInterval * @constructor - * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set */ - function UserInfo(properties) { + function Interval(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31453,114 +31525,139 @@ } /** - * UserInfo userId. - * @member {string} userId - * @memberof google.cloud.retail.v2alpha.UserInfo + * Interval minimum. + * @member {number|null|undefined} minimum + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - UserInfo.prototype.userId = ""; + Interval.prototype.minimum = null; /** - * UserInfo ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.retail.v2alpha.UserInfo + * Interval exclusiveMinimum. + * @member {number|null|undefined} exclusiveMinimum + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - UserInfo.prototype.ipAddress = ""; + Interval.prototype.exclusiveMinimum = null; /** - * UserInfo userAgent. - * @member {string} userAgent - * @memberof google.cloud.retail.v2alpha.UserInfo + * Interval maximum. + * @member {number|null|undefined} maximum + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - UserInfo.prototype.userAgent = ""; + Interval.prototype.maximum = null; /** - * UserInfo directUserRequest. - * @member {boolean} directUserRequest - * @memberof google.cloud.retail.v2alpha.UserInfo + * Interval exclusiveMaximum. + * @member {number|null|undefined} exclusiveMaximum + * @memberof google.cloud.retail.v2alpha.Interval * @instance */ - UserInfo.prototype.directUserRequest = false; + Interval.prototype.exclusiveMaximum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new UserInfo instance using the specified properties. + * Interval min. + * @member {"minimum"|"exclusiveMinimum"|undefined} min + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "min", { + get: $util.oneOfGetter($oneOfFields = ["minimum", "exclusiveMinimum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Interval max. + * @member {"maximum"|"exclusiveMaximum"|undefined} max + * @memberof google.cloud.retail.v2alpha.Interval + * @instance + */ + Object.defineProperty(Interval.prototype, "max", { + get: $util.oneOfGetter($oneOfFields = ["maximum", "exclusiveMaximum"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Interval instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance + * @param {google.cloud.retail.v2alpha.IInterval=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Interval} Interval instance */ - UserInfo.create = function create(properties) { - return new UserInfo(properties); + Interval.create = function create(properties) { + return new Interval(properties); }; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encode = function encode(message, writer) { + Interval.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); - if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); + if (message.minimum != null && Object.hasOwnProperty.call(message, "minimum")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.minimum); + if (message.exclusiveMinimum != null && Object.hasOwnProperty.call(message, "exclusiveMinimum")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.exclusiveMinimum); + if (message.maximum != null && Object.hasOwnProperty.call(message, "maximum")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.maximum); + if (message.exclusiveMaximum != null && Object.hasOwnProperty.call(message, "exclusiveMaximum")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.exclusiveMaximum); return writer; }; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Interval.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode + * @param {google.cloud.retail.v2alpha.IInterval} message Interval message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserInfo.encodeDelimited = function encodeDelimited(message, writer) { + Interval.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes an Interval message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decode = function decode(reader, length) { + Interval.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Interval(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userId = reader.string(); + message.minimum = reader.double(); break; case 2: - message.ipAddress = reader.string(); + message.exclusiveMinimum = reader.double(); break; case 3: - message.userAgent = reader.string(); + message.maximum = reader.double(); break; case 4: - message.directUserRequest = reader.bool(); + message.exclusiveMaximum = reader.double(); break; default: reader.skipType(tag & 7); @@ -31571,132 +31668,157 @@ }; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes an Interval message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.Interval} Interval * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserInfo.decodeDelimited = function decodeDelimited(reader) { + Interval.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserInfo message. + * Verifies an Interval message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserInfo.verify = function verify(message) { + Interval.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userId != null && message.hasOwnProperty("userId")) - if (!$util.isString(message.userId)) - return "userId: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - if (!$util.isString(message.userAgent)) - return "userAgent: string expected"; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - if (typeof message.directUserRequest !== "boolean") - return "directUserRequest: boolean expected"; + var properties = {}; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + properties.min = 1; + if (typeof message.minimum !== "number") + return "minimum: number expected"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + if (properties.min === 1) + return "min: multiple values"; + properties.min = 1; + if (typeof message.exclusiveMinimum !== "number") + return "exclusiveMinimum: number expected"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + properties.max = 1; + if (typeof message.maximum !== "number") + return "maximum: number expected"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + if (properties.max === 1) + return "max: multiple values"; + properties.max = 1; + if (typeof message.exclusiveMaximum !== "number") + return "exclusiveMaximum: number expected"; + } return null; }; /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Interval message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo + * @returns {google.cloud.retail.v2alpha.Interval} Interval */ - UserInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Interval) return object; - var message = new $root.google.cloud.retail.v2alpha.UserInfo(); - if (object.userId != null) - message.userId = String(object.userId); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.userAgent != null) - message.userAgent = String(object.userAgent); - if (object.directUserRequest != null) - message.directUserRequest = Boolean(object.directUserRequest); + var message = new $root.google.cloud.retail.v2alpha.Interval(); + if (object.minimum != null) + message.minimum = Number(object.minimum); + if (object.exclusiveMinimum != null) + message.exclusiveMinimum = Number(object.exclusiveMinimum); + if (object.maximum != null) + message.maximum = Number(object.maximum); + if (object.exclusiveMaximum != null) + message.exclusiveMaximum = Number(object.exclusiveMaximum); return message; }; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * Creates a plain object from an Interval message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @static - * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo + * @param {google.cloud.retail.v2alpha.Interval} message Interval * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserInfo.toObject = function toObject(message, options) { + Interval.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.userId = ""; - object.ipAddress = ""; - object.userAgent = ""; - object.directUserRequest = false; + if (message.minimum != null && message.hasOwnProperty("minimum")) { + object.minimum = options.json && !isFinite(message.minimum) ? String(message.minimum) : message.minimum; + if (options.oneofs) + object.min = "minimum"; + } + if (message.exclusiveMinimum != null && message.hasOwnProperty("exclusiveMinimum")) { + object.exclusiveMinimum = options.json && !isFinite(message.exclusiveMinimum) ? String(message.exclusiveMinimum) : message.exclusiveMinimum; + if (options.oneofs) + object.min = "exclusiveMinimum"; + } + if (message.maximum != null && message.hasOwnProperty("maximum")) { + object.maximum = options.json && !isFinite(message.maximum) ? String(message.maximum) : message.maximum; + if (options.oneofs) + object.max = "maximum"; + } + if (message.exclusiveMaximum != null && message.hasOwnProperty("exclusiveMaximum")) { + object.exclusiveMaximum = options.json && !isFinite(message.exclusiveMaximum) ? String(message.exclusiveMaximum) : message.exclusiveMaximum; + if (options.oneofs) + object.max = "exclusiveMaximum"; } - if (message.userId != null && message.hasOwnProperty("userId")) - object.userId = message.userId; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.userAgent != null && message.hasOwnProperty("userAgent")) - object.userAgent = message.userAgent; - if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) - object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this UserInfo to JSON. + * Converts this Interval to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserInfo + * @memberof google.cloud.retail.v2alpha.Interval * @instance * @returns {Object.} JSON object */ - UserInfo.prototype.toJSON = function toJSON() { + Interval.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserInfo; + return Interval; })(); - v2alpha.Promotion = (function() { + v2alpha.PriceInfo = (function() { /** - * Properties of a Promotion. + * Properties of a PriceInfo. * @memberof google.cloud.retail.v2alpha - * @interface IPromotion - * @property {string|null} [promotionId] Promotion promotionId + * @interface IPriceInfo + * @property {string|null} [currencyCode] PriceInfo currencyCode + * @property {number|null} [price] PriceInfo price + * @property {number|null} [originalPrice] PriceInfo originalPrice + * @property {number|null} [cost] PriceInfo cost + * @property {google.protobuf.ITimestamp|null} [priceEffectiveTime] PriceInfo priceEffectiveTime + * @property {google.protobuf.ITimestamp|null} [priceExpireTime] PriceInfo priceExpireTime + * @property {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null} [priceRange] PriceInfo priceRange */ /** - * Constructs a new Promotion. + * Constructs a new PriceInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Promotion. - * @implements IPromotion + * @classdesc Represents a PriceInfo. + * @implements IPriceInfo * @constructor - * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set */ - function Promotion(properties) { + function PriceInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31704,75 +31826,153 @@ } /** - * Promotion promotionId. - * @member {string} promotionId - * @memberof google.cloud.retail.v2alpha.Promotion + * PriceInfo currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.retail.v2alpha.PriceInfo * @instance */ - Promotion.prototype.promotionId = ""; + PriceInfo.prototype.currencyCode = ""; /** - * Creates a new Promotion instance using the specified properties. + * PriceInfo price. + * @member {number} price + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.price = 0; + + /** + * PriceInfo originalPrice. + * @member {number} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.originalPrice = 0; + + /** + * PriceInfo cost. + * @member {number} cost + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.cost = 0; + + /** + * PriceInfo priceEffectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceEffectiveTime + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceEffectiveTime = null; + + /** + * PriceInfo priceExpireTime. + * @member {google.protobuf.ITimestamp|null|undefined} priceExpireTime + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceExpireTime = null; + + /** + * PriceInfo priceRange. + * @member {google.cloud.retail.v2alpha.PriceInfo.IPriceRange|null|undefined} priceRange + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @instance + */ + PriceInfo.prototype.priceRange = null; + + /** + * Creates a new PriceInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion instance + * @param {google.cloud.retail.v2alpha.IPriceInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo instance */ - Promotion.create = function create(properties) { - return new Promotion(properties); + PriceInfo.create = function create(properties) { + return new PriceInfo(properties); }; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encode = function encode(message, writer) { + PriceInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); - return writer; - }; - - /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.Promotion - * @static - * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.price); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.originalPrice); + if (message.cost != null && Object.hasOwnProperty.call(message, "cost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.cost); + if (message.priceEffectiveTime != null && Object.hasOwnProperty.call(message, "priceEffectiveTime")) + $root.google.protobuf.Timestamp.encode(message.priceEffectiveTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.priceExpireTime != null && Object.hasOwnProperty.call(message, "priceExpireTime")) + $root.google.protobuf.Timestamp.encode(message.priceExpireTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.priceRange != null && Object.hasOwnProperty.call(message, "priceRange")) + $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.encode(message.priceRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {google.cloud.retail.v2alpha.IPriceInfo} message PriceInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Promotion.encodeDelimited = function encodeDelimited(message, writer) { + PriceInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes a PriceInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decode = function decode(reader, length) { + PriceInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Promotion(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.promotionId = reader.string(); + message.currencyCode = reader.string(); + break; + case 2: + message.price = reader.float(); + break; + case 3: + message.originalPrice = reader.float(); + break; + case 4: + message.cost = reader.float(); + break; + case 5: + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -31783,234 +31983,507 @@ }; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Promotion.decodeDelimited = function decodeDelimited(reader) { + PriceInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Promotion message. + * Verifies a PriceInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Promotion.verify = function verify(message) { + PriceInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - if (!$util.isString(message.promotionId)) - return "promotionId: string expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.price != null && message.hasOwnProperty("price")) + if (typeof message.price !== "number") + return "price: number expected"; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + if (typeof message.originalPrice !== "number") + return "originalPrice: number expected"; + if (message.cost != null && message.hasOwnProperty("cost")) + if (typeof message.cost !== "number") + return "cost: number expected"; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceEffectiveTime); + if (error) + return "priceEffectiveTime." + error; + } + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.priceExpireTime); + if (error) + return "priceExpireTime." + error; + } + if (message.priceRange != null && message.hasOwnProperty("priceRange")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify(message.priceRange); + if (error) + return "priceRange." + error; + } return null; }; /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @returns {google.cloud.retail.v2alpha.PriceInfo} PriceInfo */ - Promotion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.Promotion) + PriceInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.Promotion(); - if (object.promotionId != null) - message.promotionId = String(object.promotionId); + var message = new $root.google.cloud.retail.v2alpha.PriceInfo(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.price != null) + message.price = Number(object.price); + if (object.originalPrice != null) + message.originalPrice = Number(object.originalPrice); + if (object.cost != null) + message.cost = Number(object.cost); + if (object.priceEffectiveTime != null) { + if (typeof object.priceEffectiveTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceEffectiveTime: object expected"); + message.priceEffectiveTime = $root.google.protobuf.Timestamp.fromObject(object.priceEffectiveTime); + } + if (object.priceExpireTime != null) { + if (typeof object.priceExpireTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceExpireTime: object expected"); + message.priceExpireTime = $root.google.protobuf.Timestamp.fromObject(object.priceExpireTime); + } + if (object.priceRange != null) { + if (typeof object.priceRange !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.priceRange: object expected"); + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.fromObject(object.priceRange); + } return message; }; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @static - * @param {google.cloud.retail.v2alpha.Promotion} message Promotion + * @param {google.cloud.retail.v2alpha.PriceInfo} message PriceInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Promotion.toObject = function toObject(message, options) { + PriceInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.promotionId = ""; - if (message.promotionId != null && message.hasOwnProperty("promotionId")) - object.promotionId = message.promotionId; + if (options.defaults) { + object.currencyCode = ""; + object.price = 0; + object.originalPrice = 0; + object.cost = 0; + object.priceEffectiveTime = null; + object.priceExpireTime = null; + object.priceRange = null; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.price != null && message.hasOwnProperty("price")) + object.price = options.json && !isFinite(message.price) ? String(message.price) : message.price; + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = options.json && !isFinite(message.originalPrice) ? String(message.originalPrice) : message.originalPrice; + if (message.cost != null && message.hasOwnProperty("cost")) + object.cost = options.json && !isFinite(message.cost) ? String(message.cost) : message.cost; + if (message.priceEffectiveTime != null && message.hasOwnProperty("priceEffectiveTime")) + object.priceEffectiveTime = $root.google.protobuf.Timestamp.toObject(message.priceEffectiveTime, options); + if (message.priceExpireTime != null && message.hasOwnProperty("priceExpireTime")) + object.priceExpireTime = $root.google.protobuf.Timestamp.toObject(message.priceExpireTime, options); + if (message.priceRange != null && message.hasOwnProperty("priceRange")) + object.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.toObject(message.priceRange, options); return object; }; /** - * Converts this Promotion to JSON. + * Converts this PriceInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.Promotion + * @memberof google.cloud.retail.v2alpha.PriceInfo * @instance * @returns {Object.} JSON object */ - Promotion.prototype.toJSON = function toJSON() { + PriceInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Promotion; - })(); - - v2alpha.LocalInventory = (function() { + PriceInfo.PriceRange = (function() { - /** - * Properties of a LocalInventory. - * @memberof google.cloud.retail.v2alpha - * @interface ILocalInventory - * @property {string|null} [placeId] LocalInventory placeId - * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] LocalInventory priceInfo - * @property {Object.|null} [attributes] LocalInventory attributes - */ + /** + * Properties of a PriceRange. + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @interface IPriceRange + * @property {google.cloud.retail.v2alpha.IInterval|null} [price] PriceRange price + * @property {google.cloud.retail.v2alpha.IInterval|null} [originalPrice] PriceRange originalPrice + */ - /** - * Constructs a new LocalInventory. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a LocalInventory. - * @implements ILocalInventory - * @constructor - * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set - */ - function LocalInventory(properties) { - this.attributes = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new PriceRange. + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @classdesc Represents a PriceRange. + * @implements IPriceRange + * @constructor + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set + */ + function PriceRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * LocalInventory placeId. - * @member {string} placeId - * @memberof google.cloud.retail.v2alpha.LocalInventory - * @instance - */ - LocalInventory.prototype.placeId = ""; + /** + * PriceRange price. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} price + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.price = null; - /** - * LocalInventory priceInfo. - * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2alpha.LocalInventory - * @instance - */ - LocalInventory.prototype.priceInfo = null; + /** + * PriceRange originalPrice. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} originalPrice + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + */ + PriceRange.prototype.originalPrice = null; - /** - * LocalInventory attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.LocalInventory + /** + * Creates a new PriceRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange instance + */ + PriceRange.create = function create(properties) { + return new PriceRange(properties); + }; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.price != null && Object.hasOwnProperty.call(message, "price")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.price, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.originalPrice != null && Object.hasOwnProperty.call(message, "originalPrice")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.originalPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PriceInfo.PriceRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.IPriceRange} message PriceRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PriceRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + case 2: + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PriceRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PriceRange message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PriceRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.price != null && message.hasOwnProperty("price")) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.price); + if (error) + return "price." + error; + } + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.originalPrice); + if (error) + return "originalPrice." + error; + } + return null; + }; + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PriceInfo.PriceRange} PriceRange + */ + PriceRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange) + return object; + var message = new $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange(); + if (object.price != null) { + if (typeof object.price !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.price: object expected"); + message.price = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.price); + } + if (object.originalPrice != null) { + if (typeof object.originalPrice !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PriceInfo.PriceRange.originalPrice: object expected"); + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.originalPrice); + } + return message; + }; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {google.cloud.retail.v2alpha.PriceInfo.PriceRange} message PriceRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PriceRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.price = null; + object.originalPrice = null; + } + if (message.price != null && message.hasOwnProperty("price")) + object.price = $root.google.cloud.retail.v2alpha.Interval.toObject(message.price, options); + if (message.originalPrice != null && message.hasOwnProperty("originalPrice")) + object.originalPrice = $root.google.cloud.retail.v2alpha.Interval.toObject(message.originalPrice, options); + return object; + }; + + /** + * Converts this PriceRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @instance + * @returns {Object.} JSON object + */ + PriceRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PriceRange; + })(); + + return PriceInfo; + })(); + + v2alpha.Rating = (function() { + + /** + * Properties of a Rating. + * @memberof google.cloud.retail.v2alpha + * @interface IRating + * @property {number|null} [ratingCount] Rating ratingCount + * @property {number|null} [averageRating] Rating averageRating + * @property {Array.|null} [ratingHistogram] Rating ratingHistogram + */ + + /** + * Constructs a new Rating. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Rating. + * @implements IRating + * @constructor + * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set + */ + function Rating(properties) { + this.ratingHistogram = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Rating ratingCount. + * @member {number} ratingCount + * @memberof google.cloud.retail.v2alpha.Rating * @instance */ - LocalInventory.prototype.attributes = $util.emptyObject; + Rating.prototype.ratingCount = 0; /** - * Creates a new LocalInventory instance using the specified properties. + * Rating averageRating. + * @member {number} averageRating + * @memberof google.cloud.retail.v2alpha.Rating + * @instance + */ + Rating.prototype.averageRating = 0; + + /** + * Rating ratingHistogram. + * @member {Array.} ratingHistogram + * @memberof google.cloud.retail.v2alpha.Rating + * @instance + */ + Rating.prototype.ratingHistogram = $util.emptyArray; + + /** + * Creates a new Rating instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory instance + * @param {google.cloud.retail.v2alpha.IRating=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Rating} Rating instance */ - LocalInventory.create = function create(properties) { - return new LocalInventory(properties); + Rating.create = function create(properties) { + return new Rating(properties); }; /** - * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocalInventory.encode = function encode(message, writer) { + Rating.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } + if (message.ratingCount != null && Object.hasOwnProperty.call(message, "ratingCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ratingCount); + if (message.averageRating != null && Object.hasOwnProperty.call(message, "averageRating")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.averageRating); + if (message.ratingHistogram != null && message.ratingHistogram.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.ratingHistogram.length; ++i) + writer.int32(message.ratingHistogram[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Rating.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRating} message Rating message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { + Rating.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocalInventory message from the specified reader or buffer. + * Decodes a Rating message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @returns {google.cloud.retail.v2alpha.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocalInventory.decode = function decode(reader, length) { + Rating.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.LocalInventory(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Rating(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placeId = reader.string(); + message.ratingCount = reader.int32(); break; case 2: - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + message.averageRating = reader.float(); break; case 3: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else + message.ratingHistogram.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -32021,151 +32494,140 @@ }; /** - * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * Decodes a Rating message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @returns {google.cloud.retail.v2alpha.Rating} Rating * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocalInventory.decodeDelimited = function decodeDelimited(reader) { + Rating.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocalInventory message. + * Verifies a Rating message. * @function verify - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocalInventory.verify = function verify(message) { + Rating.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placeId != null && message.hasOwnProperty("placeId")) - if (!$util.isString(message.placeId)) - return "placeId: string expected"; - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { - var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); - if (error) - return "priceInfo." + error; - } - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + if (!$util.isInteger(message.ratingCount)) + return "ratingCount: integer expected"; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + if (typeof message.averageRating !== "number") + return "averageRating: number expected"; + if (message.ratingHistogram != null && message.hasOwnProperty("ratingHistogram")) { + if (!Array.isArray(message.ratingHistogram)) + return "ratingHistogram: array expected"; + for (var i = 0; i < message.ratingHistogram.length; ++i) + if (!$util.isInteger(message.ratingHistogram[i])) + return "ratingHistogram: integer[] expected"; } return null; }; /** - * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * Creates a Rating message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory + * @returns {google.cloud.retail.v2alpha.Rating} Rating */ - LocalInventory.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.LocalInventory) + Rating.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Rating) return object; - var message = new $root.google.cloud.retail.v2alpha.LocalInventory(); - if (object.placeId != null) - message.placeId = String(object.placeId); - if (object.priceInfo != null) { - if (typeof object.priceInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.priceInfo: object expected"); - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); - } - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } + var message = new $root.google.cloud.retail.v2alpha.Rating(); + if (object.ratingCount != null) + message.ratingCount = object.ratingCount | 0; + if (object.averageRating != null) + message.averageRating = Number(object.averageRating); + if (object.ratingHistogram) { + if (!Array.isArray(object.ratingHistogram)) + throw TypeError(".google.cloud.retail.v2alpha.Rating.ratingHistogram: array expected"); + message.ratingHistogram = []; + for (var i = 0; i < object.ratingHistogram.length; ++i) + message.ratingHistogram[i] = object.ratingHistogram[i] | 0; } return message; }; /** - * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * Creates a plain object from a Rating message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @static - * @param {google.cloud.retail.v2alpha.LocalInventory} message LocalInventory + * @param {google.cloud.retail.v2alpha.Rating} message Rating * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocalInventory.toObject = function toObject(message, options) { + Rating.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; + if (options.arrays || options.defaults) + object.ratingHistogram = []; if (options.defaults) { - object.placeId = ""; - object.priceInfo = null; + object.ratingCount = 0; + object.averageRating = 0; } - if (message.placeId != null && message.hasOwnProperty("placeId")) - object.placeId = message.placeId; - if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) - object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + if (message.ratingCount != null && message.hasOwnProperty("ratingCount")) + object.ratingCount = message.ratingCount; + if (message.averageRating != null && message.hasOwnProperty("averageRating")) + object.averageRating = options.json && !isFinite(message.averageRating) ? String(message.averageRating) : message.averageRating; + if (message.ratingHistogram && message.ratingHistogram.length) { + object.ratingHistogram = []; + for (var j = 0; j < message.ratingHistogram.length; ++j) + object.ratingHistogram[j] = message.ratingHistogram[j]; } return object; }; /** - * Converts this LocalInventory to JSON. + * Converts this Rating to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.LocalInventory + * @memberof google.cloud.retail.v2alpha.Rating * @instance * @returns {Object.} JSON object */ - LocalInventory.prototype.toJSON = function toJSON() { + Rating.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocalInventory; + return Rating; })(); - v2alpha.GcsSource = (function() { + v2alpha.UserInfo = (function() { /** - * Properties of a GcsSource. + * Properties of a UserInfo. * @memberof google.cloud.retail.v2alpha - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema + * @interface IUserInfo + * @property {string|null} [userId] UserInfo userId + * @property {string|null} [ipAddress] UserInfo ipAddress + * @property {string|null} [userAgent] UserInfo userAgent + * @property {boolean|null} [directUserRequest] UserInfo directUserRequest */ /** - * Constructs a new GcsSource. + * Constructs a new UserInfo. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents a UserInfo. + * @implements IUserInfo * @constructor - * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set */ - function GcsSource(properties) { - this.inputUris = []; + function UserInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32173,91 +32635,114 @@ } /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2alpha.GcsSource + * UserInfo userId. + * @member {string} userId + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance */ - GcsSource.prototype.inputUris = $util.emptyArray; + UserInfo.prototype.userId = ""; /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2alpha.GcsSource + * UserInfo ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance */ - GcsSource.prototype.dataSchema = ""; + UserInfo.prototype.ipAddress = ""; /** - * Creates a new GcsSource instance using the specified properties. + * UserInfo userAgent. + * @member {string} userAgent + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.userAgent = ""; + + /** + * UserInfo directUserRequest. + * @member {boolean} directUserRequest + * @memberof google.cloud.retail.v2alpha.UserInfo + * @instance + */ + UserInfo.prototype.directUserRequest = false; + + /** + * Creates a new UserInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance + * @param {google.cloud.retail.v2alpha.IUserInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + UserInfo.create = function create(properties) { + return new UserInfo(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + UserInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + if (message.userId != null && Object.hasOwnProperty.call(message, "userId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userId); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.directUserRequest != null && Object.hasOwnProperty.call(message, "directUserRequest")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.directUserRequest); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserInfo} message UserInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + UserInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a UserInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + UserInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); + message.userId = reader.string(); break; case 2: - message.dataSchema = reader.string(); + message.ipAddress = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.directUserRequest = reader.bool(); break; default: reader.skipType(tag & 7); @@ -32268,133 +32753,137 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a UserInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + UserInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies a UserInfo message. * @function verify - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + UserInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; - } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; + if (message.userId != null && message.hasOwnProperty("userId")) + if (!$util.isString(message.userId)) + return "userId: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + if (typeof message.directUserRequest !== "boolean") + return "directUserRequest: boolean expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource + * @returns {google.cloud.retail.v2alpha.UserInfo} UserInfo */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) + UserInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserInfo) return object; - var message = new $root.google.cloud.retail.v2alpha.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); - } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); + var message = new $root.google.cloud.retail.v2alpha.UserInfo(); + if (object.userId != null) + message.userId = String(object.userId); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.directUserRequest != null) + message.directUserRequest = Boolean(object.directUserRequest); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @static - * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource + * @param {google.cloud.retail.v2alpha.UserInfo} message UserInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + UserInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.inputUris = []; - if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; + if (options.defaults) { + object.userId = ""; + object.ipAddress = ""; + object.userAgent = ""; + object.directUserRequest = false; } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; + if (message.userId != null && message.hasOwnProperty("userId")) + object.userId = message.userId; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.directUserRequest != null && message.hasOwnProperty("directUserRequest")) + object.directUserRequest = message.directUserRequest; return object; }; /** - * Converts this GcsSource to JSON. + * Converts this UserInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.GcsSource + * @memberof google.cloud.retail.v2alpha.UserInfo * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + UserInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return UserInfo; })(); - v2alpha.BigQuerySource = (function() { + v2alpha.LocalInventory = (function() { /** - * Properties of a BigQuerySource. + * Properties of a LocalInventory. * @memberof google.cloud.retail.v2alpha - * @interface IBigQuerySource - * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema + * @interface ILocalInventory + * @property {string|null} [placeId] LocalInventory placeId + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] LocalInventory priceInfo + * @property {Object.|null} [attributes] LocalInventory attributes + * @property {Array.|null} [fulfillmentTypes] LocalInventory fulfillmentTypes */ /** - * Constructs a new BigQuerySource. + * Constructs a new LocalInventory. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource + * @classdesc Represents a LocalInventory. + * @implements ILocalInventory * @constructor - * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set */ - function BigQuerySource(properties) { + function LocalInventory(properties) { + this.attributes = {}; + this.fulfillmentTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32402,154 +32891,139 @@ } /** - * BigQuerySource partitionDate. - * @member {google.type.IDate|null|undefined} partitionDate - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance - */ - BigQuerySource.prototype.partitionDate = null; - - /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * LocalInventory placeId. + * @member {string} placeId + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - BigQuerySource.prototype.projectId = ""; + LocalInventory.prototype.placeId = ""; /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * LocalInventory priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - BigQuerySource.prototype.datasetId = ""; + LocalInventory.prototype.priceInfo = null; /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * LocalInventory attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - BigQuerySource.prototype.tableId = ""; + LocalInventory.prototype.attributes = $util.emptyObject; /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * LocalInventory fulfillmentTypes. + * @member {Array.} fulfillmentTypes + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance */ - BigQuerySource.prototype.gcsStagingDir = ""; + LocalInventory.prototype.fulfillmentTypes = $util.emptyArray; /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance + * Creates a new LocalInventory instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory instance */ - BigQuerySource.prototype.dataSchema = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + LocalInventory.create = function create(properties) { + return new LocalInventory(properties); + }; /** - * BigQuerySource partition. - * @member {"partitionDate"|undefined} partition - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @instance + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(BigQuerySource.prototype, "partition", { - get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BigQuerySource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance - */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); - }; - - /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.BigQuerySource - * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BigQuerySource.encode = function encode(message, writer) { + LocalInventory.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); - if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) - $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.placeId != null && Object.hasOwnProperty.call(message, "placeId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placeId); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.fulfillmentTypes != null && message.fulfillmentTypes.length) + for (var i = 0; i < message.fulfillmentTypes.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fulfillmentTypes[i]); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.LocalInventory.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static - * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2alpha.ILocalInventory} message LocalInventory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + LocalInventory.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a LocalInventory message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + LocalInventory.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.LocalInventory(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 5: - message.projectId = reader.string(); - break; case 1: - message.datasetId = reader.string(); + message.placeId = reader.string(); break; case 2: - message.tableId = reader.string(); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); break; case 3: - message.gcsStagingDir = reader.string(); + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; break; case 4: - message.dataSchema = reader.string(); + if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) + message.fulfillmentTypes = []; + message.fulfillmentTypes.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -32560,160 +33034,172 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + LocalInventory.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies a LocalInventory message. * @function verify - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + LocalInventory.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - properties.partition = 1; - { - var error = $root.google.type.Date.verify(message.partitionDate); + if (message.placeId != null && message.hasOwnProperty("placeId")) + if (!$util.isString(message.placeId)) + return "placeId: string expected"; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) { + var error = $root.google.cloud.retail.v2alpha.PriceInfo.verify(message.priceInfo); + if (error) + return "priceInfo." + error; + } + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); if (error) - return "partitionDate." + error; + return "attributes." + error; } } - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; + if (message.fulfillmentTypes != null && message.hasOwnProperty("fulfillmentTypes")) { + if (!Array.isArray(message.fulfillmentTypes)) + return "fulfillmentTypes: array expected"; + for (var i = 0; i < message.fulfillmentTypes.length; ++i) + if (!$util.isString(message.fulfillmentTypes[i])) + return "fulfillmentTypes: string[] expected"; + } return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2alpha.LocalInventory} LocalInventory */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) + LocalInventory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.LocalInventory) return object; - var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); - if (object.partitionDate != null) { - if (typeof object.partitionDate !== "object") - throw TypeError(".google.cloud.retail.v2alpha.BigQuerySource.partitionDate: object expected"); - message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); + var message = new $root.google.cloud.retail.v2alpha.LocalInventory(); + if (object.placeId != null) + message.placeId = String(object.placeId); + if (object.priceInfo != null) { + if (typeof object.priceInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.priceInfo: object expected"); + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.fromObject(object.priceInfo); + } + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + if (object.fulfillmentTypes) { + if (!Array.isArray(object.fulfillmentTypes)) + throw TypeError(".google.cloud.retail.v2alpha.LocalInventory.fulfillmentTypes: array expected"); + message.fulfillmentTypes = []; + for (var i = 0; i < object.fulfillmentTypes.length; ++i) + message.fulfillmentTypes[i] = String(object.fulfillmentTypes[i]); } - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @static - * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2alpha.LocalInventory} message LocalInventory * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + LocalInventory.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.fulfillmentTypes = []; + if (options.objects || options.defaults) + object.attributes = {}; if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; + object.placeId = ""; + object.priceInfo = null; } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); - if (options.oneofs) - object.partition = "partitionDate"; + if (message.placeId != null && message.hasOwnProperty("placeId")) + object.placeId = message.placeId; + if (message.priceInfo != null && message.hasOwnProperty("priceInfo")) + object.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.toObject(message.priceInfo, options); + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + if (message.fulfillmentTypes && message.fulfillmentTypes.length) { + object.fulfillmentTypes = []; + for (var j = 0; j < message.fulfillmentTypes.length; ++j) + object.fulfillmentTypes[j] = message.fulfillmentTypes[j]; } return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this LocalInventory to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @memberof google.cloud.retail.v2alpha.LocalInventory * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + LocalInventory.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BigQuerySource; + return LocalInventory; })(); - v2alpha.ProductInlineSource = (function() { + v2alpha.GcsSource = (function() { /** - * Properties of a ProductInlineSource. + * Properties of a GcsSource. * @memberof google.cloud.retail.v2alpha - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema */ /** - * Constructs a new ProductInlineSource. + * Constructs a new GcsSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set */ - function ProductInlineSource(properties) { - this.products = []; + function GcsSource(properties) { + this.inputUris = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32721,78 +33207,91 @@ } /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance */ - ProductInlineSource.prototype.products = $util.emptyArray; + GcsSource.prototype.inputUris = $util.emptyArray; /** - * Creates a new ProductInlineSource instance using the specified properties. + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance + * @param {google.cloud.retail.v2alpha.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource instance */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); return writer; }; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decode = function decode(reader, length) { + GcsSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + case 2: + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -32803,125 +33302,133 @@ }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInlineSource message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInlineSource.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); - if (error) - return "products." + error; - } + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2alpha.GcsSource} GcsSource */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GcsSource) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); - } + var message = new $root.google.cloud.retail.v2alpha.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2alpha.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @static - * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource + * @param {google.cloud.retail.v2alpha.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInlineSource.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; return object; }; /** - * Converts this ProductInlineSource to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @memberof google.cloud.retail.v2alpha.GcsSource * @instance * @returns {Object.} JSON object */ - ProductInlineSource.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInlineSource; + return GcsSource; })(); - v2alpha.UserEventInlineSource = (function() { + v2alpha.BigQuerySource = (function() { /** - * Properties of a UserEventInlineSource. + * Properties of a BigQuerySource. * @memberof google.cloud.retail.v2alpha - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema */ /** - * Constructs a new UserEventInlineSource. + * Constructs a new BigQuerySource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set */ - function UserEventInlineSource(properties) { - this.userEvents = []; + function BigQuerySource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32929,78 +33436,154 @@ } /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; + BigQuerySource.prototype.partitionDate = null; /** - * Creates a new UserEventInlineSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); - }; + BigQuerySource.prototype.projectId = ""; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance */ - UserEventInlineSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + BigQuerySource.prototype.datasetId = ""; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.tableId = ""; + + /** + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.gcsStagingDir = ""; + + /** + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + BigQuerySource.prototype.dataSchema = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @instance + */ + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource instance + */ + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); + }; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + BigQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {google.cloud.retail.v2alpha.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decode = function decode(reader, length) { + BigQuerySource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 6: + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + case 5: + message.projectId = reader.string(); + break; case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + case 3: + message.gcsStagingDir = reader.string(); + break; + case 4: + message.dataSchema = reader.string(); break; default: reader.skipType(tag & 7); @@ -33011,124 +33594,160 @@ }; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInlineSource message. + * Verifies a BigQuerySource message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInlineSource.verify = function verify(message) { + BigQuerySource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); + var properties = {}; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; + { + var error = $root.google.type.Date.verify(message.partitionDate); if (error) - return "userEvents." + error; + return "partitionDate." + error; } } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource + * @returns {google.cloud.retail.v2alpha.BigQuerySource} BigQuerySource */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.BigQuerySource) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); - } + var message = new $root.google.cloud.retail.v2alpha.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2alpha.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); } + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @static - * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource + * @param {google.cloud.retail.v2alpha.BigQuerySource} message BigQuerySource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInlineSource.toObject = function toObject(message, options) { + BigQuerySource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (options.oneofs) + object.partition = "partitionDate"; } return object; }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this BigQuerySource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @memberof google.cloud.retail.v2alpha.BigQuerySource * @instance * @returns {Object.} JSON object */ - UserEventInlineSource.prototype.toJSON = function toJSON() { + BigQuerySource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInlineSource; + return BigQuerySource; })(); - v2alpha.ImportErrorsConfig = (function() { + v2alpha.ProductInlineSource = (function() { /** - * Properties of an ImportErrorsConfig. + * Properties of a ProductInlineSource. * @memberof google.cloud.retail.v2alpha - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products */ /** - * Constructs a new ImportErrorsConfig. + * Constructs a new ProductInlineSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource * @constructor - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set */ - function ImportErrorsConfig(properties) { + function ProductInlineSource(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33136,89 +33755,78 @@ } /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig - * @instance - */ - ImportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @instance */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + ProductInlineSource.prototype.products = $util.emptyArray; /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance + * @param {google.cloud.retail.v2alpha.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource instance */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); }; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encode = function encode(message, writer) { + ProductInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decode = function decode(reader, length) { + ProductInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -33229,117 +33837,125 @@ }; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportErrorsConfig message. + * Verifies a ProductInlineSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportErrorsConfig.verify = function verify(message) { + ProductInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } } return null; }; /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig + * @returns {google.cloud.retail.v2alpha.ProductInlineSource} ProductInlineSource */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInlineSource) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); + var message = new $root.google.cloud.retail.v2alpha.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } + } return message; }; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @static - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig + * @param {google.cloud.retail.v2alpha.ProductInlineSource} message ProductInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportErrorsConfig.toObject = function toObject(message, options) { + ProductInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); } return object; }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this ProductInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @memberof google.cloud.retail.v2alpha.ProductInlineSource * @instance * @returns {Object.} JSON object */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { + ProductInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportErrorsConfig; + return ProductInlineSource; })(); - v2alpha.ImportProductsRequest = (function() { + v2alpha.UserEventInlineSource = (function() { /** - * Properties of an ImportProductsRequest. + * Properties of a UserEventInlineSource. * @memberof google.cloud.retail.v2alpha - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {string|null} [requestId] ImportProductsRequest requestId - * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask - * @property {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode - * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents */ /** - * Constructs a new ImportProductsRequest. + * Constructs a new UserEventInlineSource. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource * @constructor - * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set */ - function ImportProductsRequest(properties) { + function UserEventInlineSource(properties) { + this.userEvents = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33347,153 +33963,78 @@ } /** - * ImportProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.parent = ""; - - /** - * ImportProductsRequest requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.requestId = ""; - - /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.inputConfig = null; - - /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.errorsConfig = null; - - /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.updateMask = null; - - /** - * ImportProductsRequest reconciliationMode. - * @member {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} reconciliationMode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.reconciliationMode = 0; - - /** - * ImportProductsRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @instance */ - ImportProductsRequest.prototype.notificationPubsubTopic = ""; + UserEventInlineSource.prototype.userEvents = $util.emptyArray; /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new UserEventInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource instance */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); }; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encode = function encode(message, writer) { + UserEventInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decode = function decode(reader, length) { + UserEventInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.reconciliationMode = reader.int32(); - break; - case 7: - message.notificationPubsubTopic = reader.string(); + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -33504,207 +34045,124 @@ }; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsRequest message. + * Verifies a UserEventInlineSource message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsRequest.verify = function verify(message) { + UserEventInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - switch (message.reconciliationMode) { - default: - return "reconciliationMode: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; } - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; + } return null; }; /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest + * @returns {google.cloud.retail.v2alpha.UserEventInlineSource} UserEventInlineSource */ - ImportProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInlineSource) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - switch (object.reconciliationMode) { - case "RECONCILIATION_MODE_UNSPECIFIED": - case 0: - message.reconciliationMode = 0; - break; - case "INCREMENTAL": - case 1: - message.reconciliationMode = 1; - break; - case "FULL": - case 2: - message.reconciliationMode = 2; - break; + var message = new $root.google.cloud.retail.v2alpha.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvents[i]); + } } - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @static - * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest + * @param {google.cloud.retail.v2alpha.UserEventInlineSource} message UserEventInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsRequest.toObject = function toObject(message, options) { + UserEventInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; - object.updateMask = null; - object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + if (options.arrays || options.defaults) + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvents[j], options); } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this UserEventInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource * @instance * @returns {Object.} JSON object */ - ImportProductsRequest.prototype.toJSON = function toJSON() { + UserEventInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * ReconciliationMode enum. - * @name google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode - * @enum {number} - * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value - * @property {number} INCREMENTAL=1 INCREMENTAL value - * @property {number} FULL=2 FULL value - */ - ImportProductsRequest.ReconciliationMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INCREMENTAL"] = 1; - values[valuesById[2] = "FULL"] = 2; - return values; - })(); - - return ImportProductsRequest; + return UserEventInlineSource; })(); - v2alpha.ImportUserEventsRequest = (function() { + v2alpha.ImportErrorsConfig = (function() { /** - * Properties of an ImportUserEventsRequest. + * Properties of an ImportErrorsConfig. * @memberof google.cloud.retail.v2alpha - * @interface IImportUserEventsRequest - * @property {string|null} [parent] ImportUserEventsRequest parent - * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix */ /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new ImportErrorsConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportUserEventsRequest. - * @implements IImportUserEventsRequest + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig * @constructor - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set */ - function ImportUserEventsRequest(properties) { + function ImportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33712,101 +34170,89 @@ } /** - * ImportUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ImportUserEventsRequest.prototype.parent = ""; + ImportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ImportUserEventsRequest inputConfig. - * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance */ - ImportUserEventsRequest.prototype.inputConfig = null; + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * ImportUserEventsRequest errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest - * @instance - */ - ImportUserEventsRequest.prototype.errorsConfig = null; - - /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new ImportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig instance */ - ImportUserEventsRequest.create = function create(properties) { - return new ImportUserEventsRequest(properties); + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); }; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encode = function encode(message, writer) { + ImportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes an ImportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decode = function decode(reader, length) { + ImportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + message.gcsPrefix = reader.string(); break; default: reader.skipType(tag & 7); @@ -33817,136 +34263,117 @@ }; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsRequest message. + * Verifies an ImportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsRequest.verify = function verify(message) { + ImportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } return null; }; /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest + * @returns {google.cloud.retail.v2alpha.ImportErrorsConfig} ImportErrorsConfig */ - ImportUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2alpha.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest + * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} message ImportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsRequest.toObject = function toObject(message, options) { + ImportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = null; - object.errorsConfig = null; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this ImportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig * @instance * @returns {Object.} JSON object */ - ImportUserEventsRequest.prototype.toJSON = function toJSON() { + ImportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsRequest; + return ImportErrorsConfig; })(); - v2alpha.ImportCompletionDataRequest = (function() { + v2alpha.ImportProductsRequest = (function() { /** - * Properties of an ImportCompletionDataRequest. + * Properties of an ImportProductsRequest. * @memberof google.cloud.retail.v2alpha - * @interface IImportCompletionDataRequest - * @property {string|null} [parent] ImportCompletionDataRequest parent - * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig - * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2alpha.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic */ /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new ImportProductsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportCompletionDataRequest. - * @implements IImportCompletionDataRequest + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set */ - function ImportCompletionDataRequest(properties) { + function ImportProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -33954,100 +34381,152 @@ } /** - * ImportCompletionDataRequest parent. + * ImportProductsRequest parent. * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - ImportCompletionDataRequest.prototype.parent = ""; + ImportProductsRequest.prototype.parent = ""; /** - * ImportCompletionDataRequest inputConfig. - * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - ImportCompletionDataRequest.prototype.inputConfig = null; + ImportProductsRequest.prototype.requestId = ""; /** - * ImportCompletionDataRequest notificationPubsubTopic. + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance */ - ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; + ImportProductsRequest.prototype.notificationPubsubTopic = ""; /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new ImportProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest instance */ - ImportCompletionDataRequest.create = function create(properties) { - return new ImportCompletionDataRequest(properties); + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); }; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataRequest.encode = function encode(message, writer) { + ImportProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.cloud.retail.v2alpha.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataRequest.decode = function decode(reader, length) { + ImportProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.parent = reader.string(); break; + case 6: + message.requestId = reader.string(); + break; case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); break; case 3: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 4: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.reconciliationMode = reader.int32(); + break; + case 7: message.notificationPubsubTopic = reader.string(); break; default: @@ -34059,40 +34538,62 @@ }; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { + ImportProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies an ImportProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportCompletionDataRequest.verify = function verify(message) { + ImportProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.inputConfig); + var error = $root.google.cloud.retail.v2alpha.ProductInputConfig.verify(message.inputConfig); if (error) return "inputConfig." + error; } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + switch (message.reconciliationMode) { + default: + return "reconciliationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) if (!$util.isString(message.notificationPubsubTopic)) return "notificationPubsubTopic: string expected"; @@ -34100,23 +34601,49 @@ }; /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest + * @returns {google.cloud.retail.v2alpha.ImportProductsRequest} ImportProductsRequest */ - ImportCompletionDataRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest) + ImportProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + var message = new $root.google.cloud.retail.v2alpha.ImportProductsRequest(); if (object.parent != null) message.parent = String(object.parent); + if (object.requestId != null) + message.requestId = String(object.requestId); if (object.inputConfig != null) { if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.inputConfig); + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.fromObject(object.inputConfig); + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.reconciliationMode) { + case "RECONCILIATION_MODE_UNSPECIFIED": + case 0: + message.reconciliationMode = 0; + break; + case "INCREMENTAL": + case 1: + message.reconciliationMode = 1; + break; + case "FULL": + case 2: + message.reconciliationMode = 2; + break; } if (object.notificationPubsubTopic != null) message.notificationPubsubTopic = String(object.notificationPubsubTopic); @@ -34124,66 +34651,94 @@ }; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ImportCompletionDataRequest} message ImportCompletionDataRequest + * @param {google.cloud.retail.v2alpha.ImportProductsRequest} message ImportProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportCompletionDataRequest.toObject = function toObject(message, options) { + ImportProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.parent = ""; object.inputConfig = null; + object.errorsConfig = null; + object.updateMask = null; + object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; + object.requestId = ""; object.notificationPubsubTopic = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.inputConfig, options); + object.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this ImportProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest * @instance * @returns {Object.} JSON object */ - ImportCompletionDataRequest.prototype.toJSON = function toJSON() { + ImportProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportCompletionDataRequest; + /** + * ReconciliationMode enum. + * @name google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode + * @enum {number} + * @property {number} RECONCILIATION_MODE_UNSPECIFIED=0 RECONCILIATION_MODE_UNSPECIFIED value + * @property {number} INCREMENTAL=1 INCREMENTAL value + * @property {number} FULL=2 FULL value + */ + ImportProductsRequest.ReconciliationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECONCILIATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCREMENTAL"] = 1; + values[valuesById[2] = "FULL"] = 2; + return values; + })(); + + return ImportProductsRequest; })(); - v2alpha.ProductInputConfig = (function() { + v2alpha.ImportUserEventsRequest = (function() { /** - * Properties of a ProductInputConfig. + * Properties of an ImportUserEventsRequest. * @memberof google.cloud.retail.v2alpha - * @interface IProductInputConfig - * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource - * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource + * @interface IImportUserEventsRequest + * @property {string|null} [parent] ImportUserEventsRequest parent + * @property {google.cloud.retail.v2alpha.IUserEventInputConfig|null} [inputConfig] ImportUserEventsRequest inputConfig + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsRequest errorsConfig */ /** - * Constructs a new ProductInputConfig. + * Constructs a new ImportUserEventsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductInputConfig. - * @implements IProductInputConfig + * @classdesc Represents an ImportUserEventsRequest. + * @implements IImportUserEventsRequest * @constructor - * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set */ - function ProductInputConfig(properties) { + function ImportUserEventsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -34191,115 +34746,101 @@ } /** - * ProductInputConfig productInlineSource. - * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig - * @instance - */ - ProductInputConfig.prototype.productInlineSource = null; - - /** - * ProductInputConfig gcsSource. - * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * ImportUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - ProductInputConfig.prototype.gcsSource = null; + ImportUserEventsRequest.prototype.parent = ""; /** - * ProductInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * ImportUserEventsRequest inputConfig. + * @member {google.cloud.retail.v2alpha.IUserEventInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - ProductInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ImportUserEventsRequest.prototype.inputConfig = null; /** - * ProductInputConfig source. - * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * ImportUserEventsRequest errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance */ - Object.defineProperty(ProductInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + ImportUserEventsRequest.prototype.errorsConfig = null; /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new ImportUserEventsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest instance */ - ProductInputConfig.create = function create(properties) { - return new ProductInputConfig(properties); + ImportUserEventsRequest.create = function create(properties) { + return new ImportUserEventsRequest(properties); }; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encode = function encode(message, writer) { + ImportUserEventsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) - $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.UserEventInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsRequest} message ImportUserEventsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decode = function decode(reader, length) { + ImportUserEventsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + message.parent = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -34310,159 +34851,136 @@ }; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ProductInputConfig message. + * Verifies an ImportUserEventsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ProductInputConfig.verify = function verify(message) { + ImportUserEventsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); - if (error) - return "productInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.UserEventInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; } return null; }; /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig + * @returns {google.cloud.retail.v2alpha.ImportUserEventsRequest} ImportUserEventsRequest */ - ProductInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) + ImportUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); - if (object.productInlineSource != null) { - if (typeof object.productInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.fromObject(object.inputConfig); } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsRequest.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); } return message; }; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @static - * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig + * @param {google.cloud.retail.v2alpha.ImportUserEventsRequest} message ImportUserEventsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ProductInputConfig.toObject = function toObject(message, options) { + ImportUserEventsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { - object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); - if (options.oneofs) - object.source = "productInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.errorsConfig = null; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.toObject(message.inputConfig, options); + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ProductInputConfig to JSON. + * Converts this ImportUserEventsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest * @instance * @returns {Object.} JSON object */ - ProductInputConfig.prototype.toJSON = function toJSON() { + ImportUserEventsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ProductInputConfig; + return ImportUserEventsRequest; })(); - v2alpha.UserEventInputConfig = (function() { + v2alpha.ImportCompletionDataRequest = (function() { /** - * Properties of a UserEventInputConfig. + * Properties of an ImportCompletionDataRequest. * @memberof google.cloud.retail.v2alpha - * @interface IUserEventInputConfig - * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource - * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource + * @interface IImportCompletionDataRequest + * @property {string|null} [parent] ImportCompletionDataRequest parent + * @property {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null} [inputConfig] ImportCompletionDataRequest inputConfig + * @property {string|null} [notificationPubsubTopic] ImportCompletionDataRequest notificationPubsubTopic */ /** - * Constructs a new UserEventInputConfig. + * Constructs a new ImportCompletionDataRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventInputConfig. - * @implements IUserEventInputConfig + * @classdesc Represents an ImportCompletionDataRequest. + * @implements IImportCompletionDataRequest * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set */ - function UserEventInputConfig(properties) { + function ImportCompletionDataRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -34470,115 +34988,101 @@ } /** - * UserEventInputConfig userEventInlineSource. - * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig - * @instance - */ - UserEventInputConfig.prototype.userEventInlineSource = null; - - /** - * UserEventInputConfig gcsSource. - * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * ImportCompletionDataRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - UserEventInputConfig.prototype.gcsSource = null; + ImportCompletionDataRequest.prototype.parent = ""; /** - * UserEventInputConfig bigQuerySource. - * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * ImportCompletionDataRequest inputConfig. + * @member {google.cloud.retail.v2alpha.ICompletionDataInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - UserEventInputConfig.prototype.bigQuerySource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ImportCompletionDataRequest.prototype.inputConfig = null; /** - * UserEventInputConfig source. - * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * ImportCompletionDataRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance */ - Object.defineProperty(UserEventInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), - set: $util.oneOfSetter($oneOfFields) - }); + ImportCompletionDataRequest.prototype.notificationPubsubTopic = ""; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new ImportCompletionDataRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest instance */ - UserEventInputConfig.create = function create(properties) { - return new UserEventInputConfig(properties); + ImportCompletionDataRequest.create = function create(properties) { + return new ImportCompletionDataRequest(properties); }; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encode = function encode(message, writer) { + ImportCompletionDataRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) - $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} message ImportCompletionDataRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ImportCompletionDataRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decode = function decode(reader, length) { + ImportCompletionDataRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); + message.parent = reader.string(); break; case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); break; case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -34589,157 +35093,131 @@ }; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { + ImportCompletionDataRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventInputConfig message. + * Verifies an ImportCompletionDataRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventInputConfig.verify = function verify(message) { + ImportCompletionDataRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); - if (error) - return "userEventInlineSource." + error; - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); - if (error) - return "bigQuerySource." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; } + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataRequest} ImportCompletionDataRequest */ - UserEventInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) + ImportCompletionDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); - if (object.userEventInlineSource != null) { - if (typeof object.userEventInlineSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); - } - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); - } - if (object.bigQuerySource != null) { - if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); + var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.fromObject(object.inputConfig); } + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @static - * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig + * @param {google.cloud.retail.v2alpha.ImportCompletionDataRequest} message ImportCompletionDataRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventInputConfig.toObject = function toObject(message, options) { + ImportCompletionDataRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { - object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); - if (options.oneofs) - object.source = "userEventInlineSource"; - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { - object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); - if (options.oneofs) - object.source = "bigQuerySource"; + if (options.defaults) { + object.parent = ""; + object.inputConfig = null; + object.notificationPubsubTopic = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.toObject(message.inputConfig, options); + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this ImportCompletionDataRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest * @instance * @returns {Object.} JSON object */ - UserEventInputConfig.prototype.toJSON = function toJSON() { + ImportCompletionDataRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventInputConfig; + return ImportCompletionDataRequest; })(); - v2alpha.CompletionDataInputConfig = (function() { + v2alpha.ProductInputConfig = (function() { /** - * Properties of a CompletionDataInputConfig. + * Properties of a ProductInputConfig. * @memberof google.cloud.retail.v2alpha - * @interface ICompletionDataInputConfig - * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource + * @interface IProductInputConfig + * @property {google.cloud.retail.v2alpha.IProductInlineSource|null} [productInlineSource] ProductInputConfig productInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] ProductInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] ProductInputConfig bigQuerySource */ /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new ProductInputConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompletionDataInputConfig. - * @implements ICompletionDataInputConfig + * @classdesc Represents a ProductInputConfig. + * @implements IProductInputConfig * @constructor - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set */ - function CompletionDataInputConfig(properties) { + function ProductInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -34747,88 +35225,114 @@ } /** - * CompletionDataInputConfig bigQuerySource. + * ProductInputConfig productInlineSource. + * @member {google.cloud.retail.v2alpha.IProductInlineSource|null|undefined} productInlineSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.productInlineSource = null; + + /** + * ProductInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @instance + */ + ProductInputConfig.prototype.gcsSource = null; + + /** + * ProductInputConfig bigQuerySource. * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - CompletionDataInputConfig.prototype.bigQuerySource = null; + ProductInputConfig.prototype.bigQuerySource = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * CompletionDataInputConfig source. - * @member {"bigQuerySource"|undefined} source - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * ProductInputConfig source. + * @member {"productInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance */ - Object.defineProperty(CompletionDataInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + Object.defineProperty(ProductInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["productInlineSource", "gcsSource", "bigQuerySource"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * Creates a new ProductInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig instance + * @param {google.cloud.retail.v2alpha.IProductInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig instance */ - CompletionDataInputConfig.create = function create(properties) { - return new CompletionDataInputConfig(properties); + ProductInputConfig.create = function create(properties) { + return new ProductInputConfig(properties); }; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encode = function encode(message, writer) { + ProductInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.productInlineSource != null && Object.hasOwnProperty.call(message, "productInlineSource")) + $root.google.cloud.retail.v2alpha.ProductInlineSource.encode(message.productInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) - $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ProductInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IProductInputConfig} message ProductInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + ProductInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a ProductInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decode = function decode(reader, length) { + ProductInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + break; + case 2: + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + case 3: message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: @@ -34840,77 +35344,117 @@ }; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { + ProductInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a ProductInputConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompletionDataInputConfig.verify = function verify(message) { + ProductInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { properties.source = 1; { - var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + var error = $root.google.cloud.retail.v2alpha.ProductInlineSource.verify(message.productInlineSource); if (error) - return "bigQuerySource." + error; + return "productInlineSource." + error; } } - return null; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } + } + return null; }; /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig + * @returns {google.cloud.retail.v2alpha.ProductInputConfig} ProductInputConfig */ - CompletionDataInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDataInputConfig) + ProductInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ProductInputConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + var message = new $root.google.cloud.retail.v2alpha.ProductInputConfig(); + if (object.productInlineSource != null) { + if (typeof object.productInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.productInlineSource: object expected"); + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.fromObject(object.productInlineSource); + } + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } if (object.bigQuerySource != null) { if (typeof object.bigQuerySource !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompletionDataInputConfig.bigQuerySource: object expected"); + throw TypeError(".google.cloud.retail.v2alpha.ProductInputConfig.bigQuerySource: object expected"); message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); } return message; }; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @static - * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} message CompletionDataInputConfig + * @param {google.cloud.retail.v2alpha.ProductInputConfig} message ProductInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompletionDataInputConfig.toObject = function toObject(message, options) { + ProductInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (message.productInlineSource != null && message.hasOwnProperty("productInlineSource")) { + object.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.toObject(message.productInlineSource, options); + if (options.oneofs) + object.source = "productInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); if (options.oneofs) @@ -34920,42 +35464,39 @@ }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this ProductInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @memberof google.cloud.retail.v2alpha.ProductInputConfig * @instance * @returns {Object.} JSON object */ - CompletionDataInputConfig.prototype.toJSON = function toJSON() { + ProductInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompletionDataInputConfig; + return ProductInputConfig; })(); - v2alpha.ImportMetadata = (function() { + v2alpha.UserEventInputConfig = (function() { /** - * Properties of an ImportMetadata. + * Properties of a UserEventInputConfig. * @memberof google.cloud.retail.v2alpha - * @interface IImportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime - * @property {number|Long|null} [successCount] ImportMetadata successCount - * @property {number|Long|null} [failureCount] ImportMetadata failureCount - * @property {string|null} [requestId] ImportMetadata requestId - * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic + * @interface IUserEventInputConfig + * @property {google.cloud.retail.v2alpha.IUserEventInlineSource|null} [userEventInlineSource] UserEventInputConfig userEventInlineSource + * @property {google.cloud.retail.v2alpha.IGcsSource|null} [gcsSource] UserEventInputConfig gcsSource + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] UserEventInputConfig bigQuerySource */ /** - * Constructs a new ImportMetadata. + * Constructs a new UserEventInputConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportMetadata. - * @implements IImportMetadata + * @classdesc Represents a UserEventInputConfig. + * @implements IUserEventInputConfig * @constructor - * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set */ - function ImportMetadata(properties) { + function UserEventInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -34963,140 +35504,115 @@ } /** - * ImportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.createTime = null; - - /** - * ImportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * UserEventInputConfig userEventInlineSource. + * @member {google.cloud.retail.v2alpha.IUserEventInlineSource|null|undefined} userEventInlineSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - ImportMetadata.prototype.updateTime = null; + UserEventInputConfig.prototype.userEventInlineSource = null; /** - * ImportMetadata successCount. - * @member {number|Long} successCount - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * UserEventInputConfig gcsSource. + * @member {google.cloud.retail.v2alpha.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + UserEventInputConfig.prototype.gcsSource = null; /** - * ImportMetadata failureCount. - * @member {number|Long} failureCount - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * UserEventInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + UserEventInputConfig.prototype.bigQuerySource = null; - /** - * ImportMetadata requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2alpha.ImportMetadata - * @instance - */ - ImportMetadata.prototype.requestId = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ImportMetadata notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * UserEventInputConfig source. + * @member {"userEventInlineSource"|"gcsSource"|"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance */ - ImportMetadata.prototype.notificationPubsubTopic = ""; + Object.defineProperty(UserEventInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["userEventInlineSource", "gcsSource", "bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new UserEventInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig instance */ - ImportMetadata.create = function create(properties) { - return new ImportMetadata(properties); + UserEventInputConfig.create = function create(properties) { + return new UserEventInputConfig(properties); }; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encode = function encode(message, writer) { + UserEventInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); - if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); + if (message.userEventInlineSource != null && Object.hasOwnProperty.call(message, "userEventInlineSource")) + $root.google.cloud.retail.v2alpha.UserEventInlineSource.encode(message.userEventInlineSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.retail.v2alpha.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUserEventInputConfig} message UserEventInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + UserEventInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a UserEventInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decode = function decode(reader, length) { + UserEventInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); break; case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -35107,188 +35623,157 @@ }; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportMetadata.decodeDelimited = function decodeDelimited(reader) { + UserEventInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportMetadata message. + * Verifies a UserEventInputConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportMetadata.verify = function verify(message) { + UserEventInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; + var properties = {}; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.UserEventInlineSource.verify(message.userEventInlineSource); + if (error) + return "userEventInlineSource." + error; + } + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); + if (error) + return "bigQuerySource." + error; + } } - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) - return "successCount: integer|Long expected"; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) - return "failureCount: integer|Long expected"; - if (message.requestId != null && message.hasOwnProperty("requestId")) - if (!$util.isString(message.requestId)) - return "requestId: string expected"; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - if (!$util.isString(message.notificationPubsubTopic)) - return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata + * @returns {google.cloud.retail.v2alpha.UserEventInputConfig} UserEventInputConfig */ - ImportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) + UserEventInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventInputConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + var message = new $root.google.cloud.retail.v2alpha.UserEventInputConfig(); + if (object.userEventInlineSource != null) { + if (typeof object.userEventInlineSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.userEventInlineSource: object expected"); + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.fromObject(object.userEventInlineSource); } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.fromObject(object.gcsSource); + } + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UserEventInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); } - if (object.successCount != null) - if ($util.Long) - (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; - else if (typeof object.successCount === "string") - message.successCount = parseInt(object.successCount, 10); - else if (typeof object.successCount === "number") - message.successCount = object.successCount; - else if (typeof object.successCount === "object") - message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); - if (object.failureCount != null) - if ($util.Long) - (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; - else if (typeof object.failureCount === "string") - message.failureCount = parseInt(object.failureCount, 10); - else if (typeof object.failureCount === "number") - message.failureCount = object.failureCount; - else if (typeof object.failureCount === "object") - message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); - if (object.requestId != null) - message.requestId = String(object.requestId); - if (object.notificationPubsubTopic != null) - message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @static - * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata + * @param {google.cloud.retail.v2alpha.UserEventInputConfig} message UserEventInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportMetadata.toObject = function toObject(message, options) { + UserEventInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.createTime = null; - object.updateTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.successCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failureCount = options.longs === String ? "0" : 0; - object.requestId = ""; - object.notificationPubsubTopic = ""; + if (message.userEventInlineSource != null && message.hasOwnProperty("userEventInlineSource")) { + object.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.toObject(message.userEventInlineSource, options); + if (options.oneofs) + object.source = "userEventInlineSource"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); - if (message.successCount != null && message.hasOwnProperty("successCount")) - if (typeof message.successCount === "number") - object.successCount = options.longs === String ? String(message.successCount) : message.successCount; - else - object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; - if (message.failureCount != null && message.hasOwnProperty("failureCount")) - if (typeof message.failureCount === "number") - object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; - else - object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; - if (message.requestId != null && message.hasOwnProperty("requestId")) - object.requestId = message.requestId; - if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) - object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportMetadata to JSON. + * Converts this UserEventInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig * @instance * @returns {Object.} JSON object */ - ImportMetadata.prototype.toJSON = function toJSON() { + UserEventInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportMetadata; + return UserEventInputConfig; })(); - v2alpha.ImportProductsResponse = (function() { + v2alpha.CompletionDataInputConfig = (function() { /** - * Properties of an ImportProductsResponse. + * Properties of a CompletionDataInputConfig. * @memberof google.cloud.retail.v2alpha - * @interface IImportProductsResponse - * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig + * @interface ICompletionDataInputConfig + * @property {google.cloud.retail.v2alpha.IBigQuerySource|null} [bigQuerySource] CompletionDataInputConfig bigQuerySource */ /** - * Constructs a new ImportProductsResponse. + * Constructs a new CompletionDataInputConfig. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportProductsResponse. - * @implements IImportProductsResponse + * @classdesc Represents a CompletionDataInputConfig. + * @implements ICompletionDataInputConfig * @constructor - * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set */ - function ImportProductsResponse(properties) { - this.errorSamples = []; + function CompletionDataInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -35296,91 +35781,89 @@ } /** - * ImportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * CompletionDataInputConfig bigQuerySource. + * @member {google.cloud.retail.v2alpha.IBigQuerySource|null|undefined} bigQuerySource + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance */ - ImportProductsResponse.prototype.errorSamples = $util.emptyArray; + CompletionDataInputConfig.prototype.bigQuerySource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ImportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * CompletionDataInputConfig source. + * @member {"bigQuerySource"|undefined} source + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance */ - ImportProductsResponse.prototype.errorsConfig = null; + Object.defineProperty(CompletionDataInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["bigQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Creates a new CompletionDataInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig instance */ - ImportProductsResponse.create = function create(properties) { - return new ImportProductsResponse(properties); + CompletionDataInputConfig.create = function create(properties) { + return new CompletionDataInputConfig(properties); }; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encode = function encode(message, writer) { + CompletionDataInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bigQuerySource != null && Object.hasOwnProperty.call(message, "bigQuerySource")) + $root.google.cloud.retail.v2alpha.BigQuerySource.encode(message.bigQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompletionDataInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompletionDataInputConfig} message CompletionDataInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + CompletionDataInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decode = function decode(reader, length) { + CompletionDataInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -35391,141 +35874,122 @@ }; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + CompletionDataInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportProductsResponse message. + * Verifies a CompletionDataInputConfig message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportProductsResponse.verify = function verify(message) { + CompletionDataInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + var properties = {}; + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + properties.source = 1; + { + var error = $root.google.cloud.retail.v2alpha.BigQuerySource.verify(message.bigQuerySource); if (error) - return "errorSamples." + error; + return "bigQuerySource." + error; } } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } return null; }; /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + * @returns {google.cloud.retail.v2alpha.CompletionDataInputConfig} CompletionDataInputConfig */ - ImportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) + CompletionDataInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompletionDataInputConfig) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + var message = new $root.google.cloud.retail.v2alpha.CompletionDataInputConfig(); + if (object.bigQuerySource != null) { + if (typeof object.bigQuerySource !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompletionDataInputConfig.bigQuerySource: object expected"); + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.fromObject(object.bigQuerySource); } return message; }; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @static - * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse + * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} message CompletionDataInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportProductsResponse.toObject = function toObject(message, options) { + CompletionDataInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (message.bigQuerySource != null && message.hasOwnProperty("bigQuerySource")) { + object.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.toObject(message.bigQuerySource, options); + if (options.oneofs) + object.source = "bigQuerySource"; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this CompletionDataInputConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig * @instance * @returns {Object.} JSON object */ - ImportProductsResponse.prototype.toJSON = function toJSON() { + CompletionDataInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportProductsResponse; + return CompletionDataInputConfig; })(); - v2alpha.ImportUserEventsResponse = (function() { + v2alpha.ImportMetadata = (function() { /** - * Properties of an ImportUserEventsResponse. + * Properties of an ImportMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IImportUserEventsResponse - * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig - * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary + * @interface IImportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ImportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ImportMetadata updateTime + * @property {number|Long|null} [successCount] ImportMetadata successCount + * @property {number|Long|null} [failureCount] ImportMetadata failureCount + * @property {string|null} [requestId] ImportMetadata requestId + * @property {string|null} [notificationPubsubTopic] ImportMetadata notificationPubsubTopic */ /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new ImportMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportUserEventsResponse. - * @implements IImportUserEventsResponse + * @classdesc Represents an ImportMetadata. + * @implements IImportMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set */ - function ImportUserEventsResponse(properties) { - this.errorSamples = []; + function ImportMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -35533,104 +35997,140 @@ } /** - * ImportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * ImportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + ImportMetadata.prototype.createTime = null; /** - * ImportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * ImportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - ImportUserEventsResponse.prototype.errorsConfig = null; + ImportMetadata.prototype.updateTime = null; /** - * ImportUserEventsResponse importSummary. - * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * ImportMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance */ - ImportUserEventsResponse.prototype.importSummary = null; + ImportMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * ImportMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImportMetadata requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.requestId = ""; + + /** + * ImportMetadata notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @instance + */ + ImportMetadata.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IImportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata instance */ - ImportUserEventsResponse.create = function create(properties) { - return new ImportUserEventsResponse(properties); + ImportMetadata.create = function create(properties) { + return new ImportMetadata(properties); }; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encode = function encode(message, writer) { + ImportMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) - $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportMetadata} message ImportMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes an ImportMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decode = function decode(reader, length) { + ImportMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; case 3: - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + case 5: + message.requestId = reader.string(); + break; + case 6: + message.notificationPubsubTopic = reader.string(); break; default: reader.skipType(tag & 7); @@ -35641,153 +36141,188 @@ }; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ImportMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportUserEventsResponse message. + * Verifies an ImportMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportUserEventsResponse.verify = function verify(message) { + ImportMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) - return "errorsConfig." + error; + return "createTime." + error; } - if (message.importSummary != null && message.hasOwnProperty("importSummary")) { - var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); if (error) - return "importSummary." + error; + return "updateTime." + error; } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + if (!$util.isString(message.notificationPubsubTopic)) + return "notificationPubsubTopic: string expected"; return null; }; /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ImportMetadata} ImportMetadata */ - ImportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) + ImportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + var message = new $root.google.cloud.retail.v2alpha.ImportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.importSummary != null) { - if (typeof object.importSummary !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + if (object.requestId != null) + message.requestId = String(object.requestId); + if (object.notificationPubsubTopic != null) + message.notificationPubsubTopic = String(object.notificationPubsubTopic); return message; }; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @static - * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse + * @param {google.cloud.retail.v2alpha.ImportMetadata} message ImportMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportUserEventsResponse.toObject = function toObject(message, options) { + ImportMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; if (options.defaults) { - object.errorsConfig = null; - object.importSummary = null; - } - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + object.requestId = ""; + object.notificationPubsubTopic = ""; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); - if (message.importSummary != null && message.hasOwnProperty("importSummary")) - object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) + object.notificationPubsubTopic = message.notificationPubsubTopic; return object; }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this ImportMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ImportMetadata * @instance * @returns {Object.} JSON object */ - ImportUserEventsResponse.prototype.toJSON = function toJSON() { + ImportMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportUserEventsResponse; + return ImportMetadata; })(); - v2alpha.UserEventImportSummary = (function() { + v2alpha.ImportProductsResponse = (function() { /** - * Properties of a UserEventImportSummary. + * Properties of an ImportProductsResponse. * @memberof google.cloud.retail.v2alpha - * @interface IUserEventImportSummary - * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount - * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount + * @interface IImportProductsResponse + * @property {Array.|null} [errorSamples] ImportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportProductsResponse errorsConfig */ /** - * Constructs a new UserEventImportSummary. + * Constructs a new ImportProductsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a UserEventImportSummary. - * @implements IUserEventImportSummary + * @classdesc Represents an ImportProductsResponse. + * @implements IImportProductsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set */ - function UserEventImportSummary(properties) { + function ImportProductsResponse(properties) { + this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -35795,88 +36330,91 @@ } /** - * UserEventImportSummary joinedEventsCount. - * @member {number|Long} joinedEventsCount - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * ImportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance */ - UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportProductsResponse.prototype.errorSamples = $util.emptyArray; /** - * UserEventImportSummary unjoinedEventsCount. - * @member {number|Long} unjoinedEventsCount - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * ImportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance */ - UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ImportProductsResponse.prototype.errorsConfig = null; /** - * Creates a new UserEventImportSummary instance using the specified properties. + * Creates a new ImportProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance + * @param {google.cloud.retail.v2alpha.IImportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse instance */ - UserEventImportSummary.create = function create(properties) { - return new UserEventImportSummary(properties); + ImportProductsResponse.create = function create(properties) { + return new ImportProductsResponse(properties); }; /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encode = function encode(message, writer) { + ImportProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); - if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportProductsResponse} message ImportProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. + * Decodes an ImportProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decode = function decode(reader, length) { + ImportProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.joinedEventsCount = reader.int64(); + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; case 2: - message.unjoinedEventsCount = reader.int64(); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -35887,144 +36425,140 @@ }; /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + ImportProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a UserEventImportSummary message. + * Verifies an ImportProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UserEventImportSummary.verify = function verify(message) { + ImportProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) - return "joinedEventsCount: integer|Long expected"; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) - return "unjoinedEventsCount: integer|Long expected"; - return null; - }; - - /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary - */ - UserEventImportSummary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportProductsResponse} ImportProductsResponse + */ + ImportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportProductsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); - if (object.joinedEventsCount != null) - if ($util.Long) - (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; - else if (typeof object.joinedEventsCount === "string") - message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); - else if (typeof object.joinedEventsCount === "number") - message.joinedEventsCount = object.joinedEventsCount; - else if (typeof object.joinedEventsCount === "object") - message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); - if (object.unjoinedEventsCount != null) - if ($util.Long) - (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; - else if (typeof object.unjoinedEventsCount === "string") - message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); - else if (typeof object.unjoinedEventsCount === "number") - message.unjoinedEventsCount = object.unjoinedEventsCount; - else if (typeof object.unjoinedEventsCount === "object") - message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + var message = new $root.google.cloud.retail.v2alpha.ImportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } return message; }; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @static - * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary + * @param {google.cloud.retail.v2alpha.ImportProductsResponse} message ImportProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UserEventImportSummary.toObject = function toObject(message, options) { + ImportProductsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.joinedEventsCount = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.unjoinedEventsCount = options.longs === String ? "0" : 0; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } - if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) - if (typeof message.joinedEventsCount === "number") - object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; - else - object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; - if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) - if (typeof message.unjoinedEventsCount === "number") - object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; - else - object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); return object; }; /** - * Converts this UserEventImportSummary to JSON. + * Converts this ImportProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse * @instance * @returns {Object.} JSON object */ - UserEventImportSummary.prototype.toJSON = function toJSON() { + ImportProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UserEventImportSummary; + return ImportProductsResponse; })(); - v2alpha.ImportCompletionDataResponse = (function() { + v2alpha.ImportUserEventsResponse = (function() { /** - * Properties of an ImportCompletionDataResponse. + * Properties of an ImportUserEventsResponse. * @memberof google.cloud.retail.v2alpha - * @interface IImportCompletionDataResponse - * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples + * @interface IImportUserEventsResponse + * @property {Array.|null} [errorSamples] ImportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IImportErrorsConfig|null} [errorsConfig] ImportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2alpha.IUserEventImportSummary|null} [importSummary] ImportUserEventsResponse importSummary */ /** - * Constructs a new ImportCompletionDataResponse. + * Constructs a new ImportUserEventsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ImportCompletionDataResponse. - * @implements IImportCompletionDataResponse + * @classdesc Represents an ImportUserEventsResponse. + * @implements IImportUserEventsResponse * @constructor - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set */ - function ImportCompletionDataResponse(properties) { + function ImportUserEventsResponse(properties) { this.errorSamples = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -36033,71 +36567,91 @@ } /** - * ImportCompletionDataResponse errorSamples. + * ImportUserEventsResponse errorSamples. * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance */ - ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; + ImportUserEventsResponse.prototype.errorSamples = $util.emptyArray; /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. + * ImportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ImportUserEventsResponse importSummary. + * @member {google.cloud.retail.v2alpha.IUserEventImportSummary|null|undefined} importSummary + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @instance + */ + ImportUserEventsResponse.prototype.importSummary = null; + + /** + * Creates a new ImportUserEventsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse instance + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse instance */ - ImportCompletionDataResponse.create = function create(properties) { - return new ImportCompletionDataResponse(properties); + ImportUserEventsResponse.create = function create(properties) { + return new ImportUserEventsResponse(properties); }; /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encode = function encode(message, writer) { + ImportUserEventsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.errorSamples != null && message.errorSamples.length) for (var i = 0; i < message.errorSamples.length; ++i) $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importSummary != null && Object.hasOwnProperty.call(message, "importSummary")) + $root.google.cloud.retail.v2alpha.UserEventImportSummary.encode(message.importSummary, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportUserEventsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IImportUserEventsResponse} message ImportUserEventsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decode = function decode(reader, length) { + ImportUserEventsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -36106,6 +36660,12 @@ message.errorSamples = []; message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -36115,30 +36675,30 @@ }; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + ImportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImportCompletionDataResponse message. + * Verifies an ImportUserEventsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImportCompletionDataResponse.verify = function verify(message) { + ImportUserEventsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { @@ -36150,134 +36710,118 @@ return "errorSamples." + error; } } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.importSummary != null && message.hasOwnProperty("importSummary")) { + var error = $root.google.cloud.retail.v2alpha.UserEventImportSummary.verify(message.importSummary); + if (error) + return "importSummary." + error; + } return null; }; /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @returns {google.cloud.retail.v2alpha.ImportUserEventsResponse} ImportUserEventsResponse */ - ImportCompletionDataResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse) + ImportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportUserEventsResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + var message = new $root.google.cloud.retail.v2alpha.ImportUserEventsResponse(); if (object.errorSamples) { if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: array expected"); + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: array expected"); message.errorSamples = []; for (var i = 0; i < object.errorSamples.length; ++i) { if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: object expected"); + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorSamples: object expected"); message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); } } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.importSummary != null) { + if (typeof object.importSummary !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportUserEventsResponse.importSummary: object expected"); + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.fromObject(object.importSummary); + } return message; }; /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @static - * @param {google.cloud.retail.v2alpha.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {google.cloud.retail.v2alpha.ImportUserEventsResponse} message ImportUserEventsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImportCompletionDataResponse.toObject = function toObject(message, options) { + ImportUserEventsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.importSummary = null; + } if (message.errorSamples && message.errorSamples.length) { object.errorSamples = []; for (var j = 0; j < message.errorSamples.length; ++j) object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.toObject(message.errorsConfig, options); + if (message.importSummary != null && message.hasOwnProperty("importSummary")) + object.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.toObject(message.importSummary, options); return object; }; /** - * Converts this ImportCompletionDataResponse to JSON. + * Converts this ImportUserEventsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse * @instance * @returns {Object.} JSON object */ - ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + ImportUserEventsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImportCompletionDataResponse; + return ImportUserEventsResponse; })(); - v2alpha.Product = (function() { + v2alpha.UserEventImportSummary = (function() { /** - * Properties of a Product. + * Properties of a UserEventImportSummary. * @memberof google.cloud.retail.v2alpha - * @interface IProduct - * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime - * @property {google.protobuf.IDuration|null} [ttl] Product ttl - * @property {string|null} [name] Product name - * @property {string|null} [id] Product id - * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type - * @property {string|null} [primaryProductId] Product primaryProductId - * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds - * @property {string|null} [gtin] Product gtin - * @property {Array.|null} [categories] Product categories - * @property {string|null} [title] Product title - * @property {Array.|null} [brands] Product brands - * @property {string|null} [description] Product description - * @property {string|null} [languageCode] Product languageCode - * @property {Object.|null} [attributes] Product attributes - * @property {Array.|null} [tags] Product tags - * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo - * @property {google.cloud.retail.v2alpha.IRating|null} [rating] Product rating - * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime - * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability - * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity - * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo - * @property {string|null} [uri] Product uri - * @property {Array.|null} [images] Product images - * @property {google.cloud.retail.v2alpha.IAudience|null} [audience] Product audience - * @property {google.cloud.retail.v2alpha.IColorInfo|null} [colorInfo] Product colorInfo - * @property {Array.|null} [sizes] Product sizes - * @property {Array.|null} [materials] Product materials - * @property {Array.|null} [patterns] Product patterns - * @property {Array.|null} [conditions] Product conditions - * @property {Array.|null} [promotions] Product promotions - * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime - * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields - * @property {Array.|null} [variants] Product variants + * @interface IUserEventImportSummary + * @property {number|Long|null} [joinedEventsCount] UserEventImportSummary joinedEventsCount + * @property {number|Long|null} [unjoinedEventsCount] UserEventImportSummary unjoinedEventsCount */ /** - * Constructs a new Product. + * Constructs a new UserEventImportSummary. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a Product. - * @implements IProduct + * @classdesc Represents a UserEventImportSummary. + * @implements IUserEventImportSummary * @constructor - * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set */ - function Product(properties) { - this.collectionMemberIds = []; - this.categories = []; - this.brands = []; - this.attributes = {}; - this.tags = []; - this.fulfillmentInfo = []; - this.images = []; - this.sizes = []; - this.materials = []; - this.patterns = []; - this.conditions = []; - this.promotions = []; - this.variants = []; + function UserEventImportSummary(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36285,356 +36829,846 @@ } /** - * Product expireTime. - * @member {google.protobuf.ITimestamp|null|undefined} expireTime - * @memberof google.cloud.retail.v2alpha.Product + * UserEventImportSummary joinedEventsCount. + * @member {number|Long} joinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance */ - Product.prototype.expireTime = null; + UserEventImportSummary.prototype.joinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Product ttl. - * @member {google.protobuf.IDuration|null|undefined} ttl - * @memberof google.cloud.retail.v2alpha.Product + * UserEventImportSummary unjoinedEventsCount. + * @member {number|Long} unjoinedEventsCount + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance */ - Product.prototype.ttl = null; + UserEventImportSummary.prototype.unjoinedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Product name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a new UserEventImportSummary instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary instance */ - Product.prototype.name = ""; + UserEventImportSummary.create = function create(properties) { + return new UserEventImportSummary(properties); + }; /** - * Product id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.id = ""; + UserEventImportSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedEventsCount != null && Object.hasOwnProperty.call(message, "joinedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.joinedEventsCount); + if (message.unjoinedEventsCount != null && Object.hasOwnProperty.call(message, "unjoinedEventsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.unjoinedEventsCount); + return writer; + }; /** - * Product type. - * @member {google.cloud.retail.v2alpha.Product.Type} type - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UserEventImportSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.IUserEventImportSummary} message UserEventImportSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.type = 0; + UserEventImportSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product primaryProductId. - * @member {string} primaryProductId - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes a UserEventImportSummary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.primaryProductId = ""; + UserEventImportSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.joinedEventsCount = reader.int64(); + break; + case 2: + message.unjoinedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product collectionMemberIds. - * @member {Array.} collectionMemberIds - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.collectionMemberIds = $util.emptyArray; + UserEventImportSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product gtin. - * @member {string} gtin - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Verifies a UserEventImportSummary message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.gtin = ""; + UserEventImportSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (!$util.isInteger(message.joinedEventsCount) && !(message.joinedEventsCount && $util.isInteger(message.joinedEventsCount.low) && $util.isInteger(message.joinedEventsCount.high))) + return "joinedEventsCount: integer|Long expected"; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (!$util.isInteger(message.unjoinedEventsCount) && !(message.unjoinedEventsCount && $util.isInteger(message.unjoinedEventsCount.low) && $util.isInteger(message.unjoinedEventsCount.high))) + return "unjoinedEventsCount: integer|Long expected"; + return null; + }; /** - * Product categories. - * @member {Array.} categories - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UserEventImportSummary} UserEventImportSummary */ - Product.prototype.categories = $util.emptyArray; + UserEventImportSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UserEventImportSummary) + return object; + var message = new $root.google.cloud.retail.v2alpha.UserEventImportSummary(); + if (object.joinedEventsCount != null) + if ($util.Long) + (message.joinedEventsCount = $util.Long.fromValue(object.joinedEventsCount)).unsigned = false; + else if (typeof object.joinedEventsCount === "string") + message.joinedEventsCount = parseInt(object.joinedEventsCount, 10); + else if (typeof object.joinedEventsCount === "number") + message.joinedEventsCount = object.joinedEventsCount; + else if (typeof object.joinedEventsCount === "object") + message.joinedEventsCount = new $util.LongBits(object.joinedEventsCount.low >>> 0, object.joinedEventsCount.high >>> 0).toNumber(); + if (object.unjoinedEventsCount != null) + if ($util.Long) + (message.unjoinedEventsCount = $util.Long.fromValue(object.unjoinedEventsCount)).unsigned = false; + else if (typeof object.unjoinedEventsCount === "string") + message.unjoinedEventsCount = parseInt(object.unjoinedEventsCount, 10); + else if (typeof object.unjoinedEventsCount === "number") + message.unjoinedEventsCount = object.unjoinedEventsCount; + else if (typeof object.unjoinedEventsCount === "object") + message.unjoinedEventsCount = new $util.LongBits(object.unjoinedEventsCount.low >>> 0, object.unjoinedEventsCount.high >>> 0).toNumber(); + return message; + }; /** - * Product title. - * @member {string} title - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {google.cloud.retail.v2alpha.UserEventImportSummary} message UserEventImportSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Product.prototype.title = ""; + UserEventImportSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.joinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.joinedEventsCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.unjoinedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unjoinedEventsCount = options.longs === String ? "0" : 0; + } + if (message.joinedEventsCount != null && message.hasOwnProperty("joinedEventsCount")) + if (typeof message.joinedEventsCount === "number") + object.joinedEventsCount = options.longs === String ? String(message.joinedEventsCount) : message.joinedEventsCount; + else + object.joinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.joinedEventsCount) : options.longs === Number ? new $util.LongBits(message.joinedEventsCount.low >>> 0, message.joinedEventsCount.high >>> 0).toNumber() : message.joinedEventsCount; + if (message.unjoinedEventsCount != null && message.hasOwnProperty("unjoinedEventsCount")) + if (typeof message.unjoinedEventsCount === "number") + object.unjoinedEventsCount = options.longs === String ? String(message.unjoinedEventsCount) : message.unjoinedEventsCount; + else + object.unjoinedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.unjoinedEventsCount) : options.longs === Number ? new $util.LongBits(message.unjoinedEventsCount.low >>> 0, message.unjoinedEventsCount.high >>> 0).toNumber() : message.unjoinedEventsCount; + return object; + }; /** - * Product brands. - * @member {Array.} brands - * @memberof google.cloud.retail.v2alpha.Product + * Converts this UserEventImportSummary to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary * @instance + * @returns {Object.} JSON object */ - Product.prototype.brands = $util.emptyArray; + UserEventImportSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Product description. - * @member {string} description - * @memberof google.cloud.retail.v2alpha.Product - * @instance - */ - Product.prototype.description = ""; + return UserEventImportSummary; + })(); - /** - * Product languageCode. - * @member {string} languageCode - * @memberof google.cloud.retail.v2alpha.Product - * @instance - */ - Product.prototype.languageCode = ""; + v2alpha.ImportCompletionDataResponse = (function() { /** - * Product attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Properties of an ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IImportCompletionDataResponse + * @property {Array.|null} [errorSamples] ImportCompletionDataResponse errorSamples */ - Product.prototype.attributes = $util.emptyObject; /** - * Product tags. - * @member {Array.} tags - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Constructs a new ImportCompletionDataResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ImportCompletionDataResponse. + * @implements IImportCompletionDataResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set */ - Product.prototype.tags = $util.emptyArray; + function ImportCompletionDataResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Product priceInfo. - * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo - * @memberof google.cloud.retail.v2alpha.Product + * ImportCompletionDataResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse * @instance */ - Product.prototype.priceInfo = null; + ImportCompletionDataResponse.prototype.errorSamples = $util.emptyArray; /** - * Product rating. - * @member {google.cloud.retail.v2alpha.IRating|null|undefined} rating - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates a new ImportCompletionDataResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse instance */ - Product.prototype.rating = null; + ImportCompletionDataResponse.create = function create(properties) { + return new ImportCompletionDataResponse(properties); + }; /** - * Product availableTime. - * @member {google.protobuf.ITimestamp|null|undefined} availableTime - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.availableTime = null; + ImportCompletionDataResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; /** - * Product availability. - * @member {google.cloud.retail.v2alpha.Product.Availability} availability - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ImportCompletionDataResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2alpha.IImportCompletionDataResponse} message ImportCompletionDataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Product.prototype.availability = 0; + ImportCompletionDataResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Product availableQuantity. - * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.availableQuantity = null; + ImportCompletionDataResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Product fulfillmentInfo. - * @member {Array.} fulfillmentInfo - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Product.prototype.fulfillmentInfo = $util.emptyArray; + ImportCompletionDataResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Product uri. - * @member {string} uri - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Verifies an ImportCompletionDataResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Product.prototype.uri = ""; + ImportCompletionDataResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + return null; + }; /** - * Product images. - * @member {Array.} images - * @memberof google.cloud.retail.v2alpha.Product - * @instance + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ImportCompletionDataResponse} ImportCompletionDataResponse */ - Product.prototype.images = $util.emptyArray; + ImportCompletionDataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ImportCompletionDataResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ImportCompletionDataResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + return message; + }; /** - * Product audience. - * @member {google.cloud.retail.v2alpha.IAudience|null|undefined} audience + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {google.cloud.retail.v2alpha.ImportCompletionDataResponse} message ImportCompletionDataResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCompletionDataResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + return object; + }; + + /** + * Converts this ImportCompletionDataResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @instance + * @returns {Object.} JSON object + */ + ImportCompletionDataResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportCompletionDataResponse; + })(); + + v2alpha.Product = (function() { + + /** + * Properties of a Product. + * @memberof google.cloud.retail.v2alpha + * @interface IProduct + * @property {google.protobuf.ITimestamp|null} [expireTime] Product expireTime + * @property {google.protobuf.IDuration|null} [ttl] Product ttl + * @property {string|null} [name] Product name + * @property {string|null} [id] Product id + * @property {google.cloud.retail.v2alpha.Product.Type|null} [type] Product type + * @property {string|null} [primaryProductId] Product primaryProductId + * @property {Array.|null} [collectionMemberIds] Product collectionMemberIds + * @property {string|null} [gtin] Product gtin + * @property {Array.|null} [categories] Product categories + * @property {string|null} [title] Product title + * @property {Array.|null} [brands] Product brands + * @property {string|null} [description] Product description + * @property {string|null} [languageCode] Product languageCode + * @property {Object.|null} [attributes] Product attributes + * @property {Array.|null} [tags] Product tags + * @property {google.cloud.retail.v2alpha.IPriceInfo|null} [priceInfo] Product priceInfo + * @property {google.cloud.retail.v2alpha.IRating|null} [rating] Product rating + * @property {google.protobuf.ITimestamp|null} [availableTime] Product availableTime + * @property {google.cloud.retail.v2alpha.Product.Availability|null} [availability] Product availability + * @property {google.protobuf.IInt32Value|null} [availableQuantity] Product availableQuantity + * @property {Array.|null} [fulfillmentInfo] Product fulfillmentInfo + * @property {string|null} [uri] Product uri + * @property {Array.|null} [images] Product images + * @property {google.cloud.retail.v2alpha.IAudience|null} [audience] Product audience + * @property {google.cloud.retail.v2alpha.IColorInfo|null} [colorInfo] Product colorInfo + * @property {Array.|null} [sizes] Product sizes + * @property {Array.|null} [materials] Product materials + * @property {Array.|null} [patterns] Product patterns + * @property {Array.|null} [conditions] Product conditions + * @property {Array.|null} [promotions] Product promotions + * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime + * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields + * @property {Array.|null} [variants] Product variants + */ + + /** + * Constructs a new Product. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + */ + function Product(properties) { + this.collectionMemberIds = []; + this.categories = []; + this.brands = []; + this.attributes = {}; + this.tags = []; + this.fulfillmentInfo = []; + this.images = []; + this.sizes = []; + this.materials = []; + this.patterns = []; + this.conditions = []; + this.promotions = []; + this.variants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.audience = null; + Product.prototype.expireTime = null; /** - * Product colorInfo. - * @member {google.cloud.retail.v2alpha.IColorInfo|null|undefined} colorInfo + * Product ttl. + * @member {google.protobuf.IDuration|null|undefined} ttl * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.colorInfo = null; + Product.prototype.ttl = null; /** - * Product sizes. - * @member {Array.} sizes + * Product name. + * @member {string} name * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.sizes = $util.emptyArray; + Product.prototype.name = ""; /** - * Product materials. - * @member {Array.} materials + * Product id. + * @member {string} id * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.materials = $util.emptyArray; + Product.prototype.id = ""; /** - * Product patterns. - * @member {Array.} patterns + * Product type. + * @member {google.cloud.retail.v2alpha.Product.Type} type * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.patterns = $util.emptyArray; + Product.prototype.type = 0; /** - * Product conditions. - * @member {Array.} conditions + * Product primaryProductId. + * @member {string} primaryProductId * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.conditions = $util.emptyArray; + Product.prototype.primaryProductId = ""; /** - * Product promotions. - * @member {Array.} promotions + * Product collectionMemberIds. + * @member {Array.} collectionMemberIds * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.promotions = $util.emptyArray; + Product.prototype.collectionMemberIds = $util.emptyArray; /** - * Product publishTime. - * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * Product gtin. + * @member {string} gtin * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.publishTime = null; + Product.prototype.gtin = ""; /** - * Product retrievableFields. - * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * Product categories. + * @member {Array.} categories * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.retrievableFields = null; + Product.prototype.categories = $util.emptyArray; /** - * Product variants. - * @member {Array.} variants + * Product title. + * @member {string} title * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Product.prototype.variants = $util.emptyArray; + Product.prototype.title = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Product brands. + * @member {Array.} brands + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.brands = $util.emptyArray; /** - * Product expiration. - * @member {"expireTime"|"ttl"|undefined} expiration + * Product description. + * @member {string} description * @memberof google.cloud.retail.v2alpha.Product * @instance */ - Object.defineProperty(Product.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), - set: $util.oneOfSetter($oneOfFields) - }); + Product.prototype.description = ""; /** - * Creates a new Product instance using the specified properties. - * @function create + * Product languageCode. + * @member {string} languageCode * @memberof google.cloud.retail.v2alpha.Product - * @static - * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.Product} Product instance + * @instance */ - Product.create = function create(properties) { - return new Product(properties); - }; + Product.prototype.languageCode = ""; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. - * @function encode + * Product attributes. + * @member {Object.} attributes * @memberof google.cloud.retail.v2alpha.Product - * @static - * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * @instance */ - Product.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); - if (message.collectionMemberIds != null && message.collectionMemberIds.length) - for (var i = 0; i < message.collectionMemberIds.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); - if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); - if (message.brands != null && message.brands.length) - for (var i = 0; i < message.brands.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); - if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) - $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) - $root.google.cloud.retail.v2alpha.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) - $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) - $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) - $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); - if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) - $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) - for (var i = 0; i < message.fulfillmentInfo.length; ++i) + Product.prototype.attributes = $util.emptyObject; + + /** + * Product tags. + * @member {Array.} tags + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.tags = $util.emptyArray; + + /** + * Product priceInfo. + * @member {google.cloud.retail.v2alpha.IPriceInfo|null|undefined} priceInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.priceInfo = null; + + /** + * Product rating. + * @member {google.cloud.retail.v2alpha.IRating|null|undefined} rating + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.rating = null; + + /** + * Product availableTime. + * @member {google.protobuf.ITimestamp|null|undefined} availableTime + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.availableTime = null; + + /** + * Product availability. + * @member {google.cloud.retail.v2alpha.Product.Availability} availability + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.availability = 0; + + /** + * Product availableQuantity. + * @member {google.protobuf.IInt32Value|null|undefined} availableQuantity + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.availableQuantity = null; + + /** + * Product fulfillmentInfo. + * @member {Array.} fulfillmentInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.fulfillmentInfo = $util.emptyArray; + + /** + * Product uri. + * @member {string} uri + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.uri = ""; + + /** + * Product images. + * @member {Array.} images + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.images = $util.emptyArray; + + /** + * Product audience. + * @member {google.cloud.retail.v2alpha.IAudience|null|undefined} audience + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.audience = null; + + /** + * Product colorInfo. + * @member {google.cloud.retail.v2alpha.IColorInfo|null|undefined} colorInfo + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.colorInfo = null; + + /** + * Product sizes. + * @member {Array.} sizes + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.sizes = $util.emptyArray; + + /** + * Product materials. + * @member {Array.} materials + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.materials = $util.emptyArray; + + /** + * Product patterns. + * @member {Array.} patterns + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.patterns = $util.emptyArray; + + /** + * Product conditions. + * @member {Array.} conditions + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.conditions = $util.emptyArray; + + /** + * Product promotions. + * @member {Array.} promotions + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.promotions = $util.emptyArray; + + /** + * Product publishTime. + * @member {google.protobuf.ITimestamp|null|undefined} publishTime + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.publishTime = null; + + /** + * Product retrievableFields. + * @member {google.protobuf.IFieldMask|null|undefined} retrievableFields + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.retrievableFields = null; + + /** + * Product variants. + * @member {Array.} variants + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Product.prototype.variants = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Product expiration. + * @member {"expireTime"|"ttl"|undefined} expiration + * @memberof google.cloud.retail.v2alpha.Product + * @instance + */ + Object.defineProperty(Product.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["expireTime", "ttl"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.IProduct=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2alpha.Product.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {google.cloud.retail.v2alpha.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.primaryProductId != null && Object.hasOwnProperty.call(message, "primaryProductId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.primaryProductId); + if (message.collectionMemberIds != null && message.collectionMemberIds.length) + for (var i = 0; i < message.collectionMemberIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.collectionMemberIds[i]); + if (message.gtin != null && Object.hasOwnProperty.call(message, "gtin")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.gtin); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.categories[i]); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.title); + if (message.brands != null && message.brands.length) + for (var i = 0; i < message.brands.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.brands[i]); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.languageCode); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.tags[i]); + if (message.priceInfo != null && Object.hasOwnProperty.call(message, "priceInfo")) + $root.google.cloud.retail.v2alpha.PriceInfo.encode(message.priceInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.rating != null && Object.hasOwnProperty.call(message, "rating")) + $root.google.cloud.retail.v2alpha.Rating.encode(message.rating, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.availableTime != null && Object.hasOwnProperty.call(message, "availableTime")) + $root.google.protobuf.Timestamp.encode(message.availableTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.availability); + if (message.availableQuantity != null && Object.hasOwnProperty.call(message, "availableQuantity")) + $root.google.protobuf.Int32Value.encode(message.availableQuantity, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.fulfillmentInfo != null && message.fulfillmentInfo.length) + for (var i = 0; i < message.fulfillmentInfo.length; ++i) $root.google.cloud.retail.v2alpha.FulfillmentInfo.encode(message.fulfillmentInfo[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) writer.uint32(/* id 22, wireType 2 =*/178).string(message.uri); @@ -37530,22 +38564,209 @@ return Product; })(); - v2alpha.UserEvent = (function() { + v2alpha.Promotion = (function() { /** - * Properties of a UserEvent. + * Properties of a Promotion. * @memberof google.cloud.retail.v2alpha - * @interface IUserEvent - * @property {string|null} [eventType] UserEvent eventType - * @property {string|null} [visitorId] UserEvent visitorId - * @property {string|null} [sessionId] UserEvent sessionId - * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime - * @property {Array.|null} [experimentIds] UserEvent experimentIds - * @property {string|null} [attributionToken] UserEvent attributionToken - * @property {Array.|null} [productDetails] UserEvent productDetails - * @property {google.cloud.retail.v2alpha.ICompletionDetail|null} [completionDetail] UserEvent completionDetail - * @property {Object.|null} [attributes] UserEvent attributes - * @property {string|null} [cartId] UserEvent cartId + * @interface IPromotion + * @property {string|null} [promotionId] Promotion promotionId + */ + + /** + * Constructs a new Promotion. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Promotion. + * @implements IPromotion + * @constructor + * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set + */ + function Promotion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Promotion promotionId. + * @member {string} promotionId + * @memberof google.cloud.retail.v2alpha.Promotion + * @instance + */ + Promotion.prototype.promotionId = ""; + + /** + * Creates a new Promotion instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {google.cloud.retail.v2alpha.IPromotion=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion instance + */ + Promotion.create = function create(properties) { + return new Promotion(properties); + }; + + /** + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.promotionId != null && Object.hasOwnProperty.call(message, "promotionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.promotionId); + return writer; + }; + + /** + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Promotion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {google.cloud.retail.v2alpha.IPromotion} message Promotion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Promotion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Promotion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Promotion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.promotionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Promotion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Promotion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Promotion message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Promotion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + if (!$util.isString(message.promotionId)) + return "promotionId: string expected"; + return null; + }; + + /** + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Promotion} Promotion + */ + Promotion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Promotion) + return object; + var message = new $root.google.cloud.retail.v2alpha.Promotion(); + if (object.promotionId != null) + message.promotionId = String(object.promotionId); + return message; + }; + + /** + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {google.cloud.retail.v2alpha.Promotion} message Promotion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Promotion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.promotionId = ""; + if (message.promotionId != null && message.hasOwnProperty("promotionId")) + object.promotionId = message.promotionId; + return object; + }; + + /** + * Converts this Promotion to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Promotion + * @instance + * @returns {Object.} JSON object + */ + Promotion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Promotion; + })(); + + v2alpha.UserEvent = (function() { + + /** + * Properties of a UserEvent. + * @memberof google.cloud.retail.v2alpha + * @interface IUserEvent + * @property {string|null} [eventType] UserEvent eventType + * @property {string|null} [visitorId] UserEvent visitorId + * @property {string|null} [sessionId] UserEvent sessionId + * @property {google.protobuf.ITimestamp|null} [eventTime] UserEvent eventTime + * @property {Array.|null} [experimentIds] UserEvent experimentIds + * @property {string|null} [attributionToken] UserEvent attributionToken + * @property {Array.|null} [productDetails] UserEvent productDetails + * @property {google.cloud.retail.v2alpha.ICompletionDetail|null} [completionDetail] UserEvent completionDetail + * @property {Object.|null} [attributes] UserEvent attributes + * @property {string|null} [cartId] UserEvent cartId * @property {google.cloud.retail.v2alpha.IPurchaseTransaction|null} [purchaseTransaction] UserEvent purchaseTransaction * @property {string|null} [searchQuery] UserEvent searchQuery * @property {string|null} [filter] UserEvent filter @@ -39146,58 +40367,289 @@ * @variation 2 */ - return CatalogService; - })(); - - v2alpha.ListCatalogsRequest = (function() { - - /** - * Properties of a ListCatalogsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken - */ - /** - * Constructs a new ListCatalogsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getCompletionConfig}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef GetCompletionConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.CompletionConfig} [response] CompletionConfig */ - function ListCatalogsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * ListCatalogsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * Calls GetCompletionConfig. + * @function getCompletionConfig + * @memberof google.cloud.retail.v2alpha.CatalogService * @instance + * @param {google.cloud.retail.v2alpha.IGetCompletionConfigRequest} request GetCompletionConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.GetCompletionConfigCallback} callback Node-style callback called with the error, if any, and CompletionConfig + * @returns {undefined} + * @variation 1 */ - ListCatalogsRequest.prototype.parent = ""; + Object.defineProperty(CatalogService.prototype.getCompletionConfig = function getCompletionConfig(request, callback) { + return this.rpcCall(getCompletionConfig, $root.google.cloud.retail.v2alpha.GetCompletionConfigRequest, $root.google.cloud.retail.v2alpha.CompletionConfig, request, callback); + }, "name", { value: "GetCompletionConfig" }); /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * Calls GetCompletionConfig. + * @function getCompletionConfig + * @memberof google.cloud.retail.v2alpha.CatalogService * @instance + * @param {google.cloud.retail.v2alpha.IGetCompletionConfigRequest} request GetCompletionConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - ListCatalogsRequest.prototype.pageSize = 0; /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest - * @instance + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCompletionConfig}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef UpdateCompletionConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.CompletionConfig} [response] CompletionConfig */ - ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Calls UpdateCompletionConfig. + * @function updateCompletionConfig + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest} request UpdateCompletionConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfigCallback} callback Node-style callback called with the error, if any, and CompletionConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCompletionConfig = function updateCompletionConfig(request, callback) { + return this.rpcCall(updateCompletionConfig, $root.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest, $root.google.cloud.retail.v2alpha.CompletionConfig, request, callback); + }, "name", { value: "UpdateCompletionConfig" }); + + /** + * Calls UpdateCompletionConfig. + * @function updateCompletionConfig + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest} request UpdateCompletionConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getAttributesConfig}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef GetAttributesConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls GetAttributesConfig. + * @function getAttributesConfig + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IGetAttributesConfigRequest} request GetAttributesConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.GetAttributesConfigCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getAttributesConfig = function getAttributesConfig(request, callback) { + return this.rpcCall(getAttributesConfig, $root.google.cloud.retail.v2alpha.GetAttributesConfigRequest, $root.google.cloud.retail.v2alpha.AttributesConfig, request, callback); + }, "name", { value: "GetAttributesConfig" }); + + /** + * Calls GetAttributesConfig. + * @function getAttributesConfig + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IGetAttributesConfigRequest} request GetAttributesConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateAttributesConfig}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef UpdateAttributesConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls UpdateAttributesConfig. + * @function updateAttributesConfig + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest} request UpdateAttributesConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfigCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateAttributesConfig = function updateAttributesConfig(request, callback) { + return this.rpcCall(updateAttributesConfig, $root.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest, $root.google.cloud.retail.v2alpha.AttributesConfig, request, callback); + }, "name", { value: "UpdateAttributesConfig" }); + + /** + * Calls UpdateAttributesConfig. + * @function updateAttributesConfig + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest} request UpdateAttributesConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#addCatalogAttribute}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef AddCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls AddCatalogAttribute. + * @function addCatalogAttribute + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IAddCatalogAttributeRequest} request AddCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.AddCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.addCatalogAttribute = function addCatalogAttribute(request, callback) { + return this.rpcCall(addCatalogAttribute, $root.google.cloud.retail.v2alpha.AddCatalogAttributeRequest, $root.google.cloud.retail.v2alpha.AttributesConfig, request, callback); + }, "name", { value: "AddCatalogAttribute" }); + + /** + * Calls AddCatalogAttribute. + * @function addCatalogAttribute + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IAddCatalogAttributeRequest} request AddCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#removeCatalogAttribute}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef RemoveCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls RemoveCatalogAttribute. + * @function removeCatalogAttribute + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest} request RemoveCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.removeCatalogAttribute = function removeCatalogAttribute(request, callback) { + return this.rpcCall(removeCatalogAttribute, $root.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest, $root.google.cloud.retail.v2alpha.AttributesConfig, request, callback); + }, "name", { value: "RemoveCatalogAttribute" }); + + /** + * Calls RemoveCatalogAttribute. + * @function removeCatalogAttribute + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest} request RemoveCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#replaceCatalogAttribute}. + * @memberof google.cloud.retail.v2alpha.CatalogService + * @typedef ReplaceCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls ReplaceCatalogAttribute. + * @function replaceCatalogAttribute + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest} request ReplaceCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.replaceCatalogAttribute = function replaceCatalogAttribute(request, callback) { + return this.rpcCall(replaceCatalogAttribute, $root.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest, $root.google.cloud.retail.v2alpha.AttributesConfig, request, callback); + }, "name", { value: "ReplaceCatalogAttribute" }); + + /** + * Calls ReplaceCatalogAttribute. + * @function replaceCatalogAttribute + * @memberof google.cloud.retail.v2alpha.CatalogService + * @instance + * @param {google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest} request ReplaceCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2alpha.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; /** * Creates a new ListCatalogsRequest instance using the specified properties. @@ -39841,6 +41293,7 @@ * @property {string|null} [catalog] SetDefaultBranchRequest catalog * @property {string|null} [branchId] SetDefaultBranchRequest branchId * @property {string|null} [note] SetDefaultBranchRequest note + * @property {boolean|null} [force] SetDefaultBranchRequest force */ /** @@ -39882,6 +41335,14 @@ */ SetDefaultBranchRequest.prototype.note = ""; + /** + * SetDefaultBranchRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.force = false; + /** * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create @@ -39912,6 +41373,8 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); if (message.note != null && Object.hasOwnProperty.call(message, "note")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); return writer; }; @@ -39955,6 +41418,9 @@ case 3: message.note = reader.string(); break; + case 4: + message.force = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -39999,6 +41465,9 @@ if (message.note != null && message.hasOwnProperty("note")) if (!$util.isString(message.note)) return "note: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; @@ -40020,6 +41489,8 @@ message.branchId = String(object.branchId); if (object.note != null) message.note = String(object.note); + if (object.force != null) + message.force = Boolean(object.force); return message; }; @@ -40040,6 +41511,7 @@ object.catalog = ""; object.branchId = ""; object.note = ""; + object.force = false; } if (message.catalog != null && message.hasOwnProperty("catalog")) object.catalog = message.catalog; @@ -40047,6 +41519,8 @@ object.branchId = message.branchId; if (message.note != null && message.hasOwnProperty("note")) object.note = message.note; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; @@ -40488,289 +41962,100 @@ return GetDefaultBranchResponse; })(); - v2alpha.CompletionService = (function() { + v2alpha.GetCompletionConfigRequest = (function() { /** - * Constructs a new CompletionService service. + * Properties of a GetCompletionConfigRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompletionService - * @extends $protobuf.rpc.Service + * @interface IGetCompletionConfigRequest + * @property {string|null} [name] GetCompletionConfigRequest name + */ + + /** + * Constructs a new GetCompletionConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetCompletionConfigRequest. + * @implements IGetCompletionConfigRequest * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.retail.v2alpha.IGetCompletionConfigRequest=} [properties] Properties to set */ - function CompletionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function GetCompletionConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + /** + * GetCompletionConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest + * @instance + */ + GetCompletionConfigRequest.prototype.name = ""; /** - * Creates new CompletionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.CompletionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. - */ - CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. - * @memberof google.cloud.retail.v2alpha.CompletionService - * @typedef CompleteQueryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} [response] CompleteQueryResponse - */ - - /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @param {google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { - return this.rpcCall(completeQuery, $root.google.cloud.retail.v2alpha.CompleteQueryRequest, $root.google.cloud.retail.v2alpha.CompleteQueryResponse, request, callback); - }, "name", { value: "CompleteQuery" }); - - /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. - * @memberof google.cloud.retail.v2alpha.CompletionService - * @typedef ImportCompletionDataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @param {google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { - return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportCompletionData" }); - - /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2alpha.CompletionService - * @instance - * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return CompletionService; - })(); - - v2alpha.CompleteQueryRequest = (function() { - - /** - * Properties of a CompleteQueryRequest. - * @memberof google.cloud.retail.v2alpha - * @interface ICompleteQueryRequest - * @property {string|null} [catalog] CompleteQueryRequest catalog - * @property {string|null} [query] CompleteQueryRequest query - * @property {string|null} [visitorId] CompleteQueryRequest visitorId - * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes - * @property {string|null} [deviceType] CompleteQueryRequest deviceType - * @property {string|null} [dataset] CompleteQueryRequest dataset - * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions - */ - - /** - * Constructs a new CompleteQueryRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompleteQueryRequest. - * @implements ICompleteQueryRequest - * @constructor - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set - */ - function CompleteQueryRequest(properties) { - this.languageCodes = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompleteQueryRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.catalog = ""; - - /** - * CompleteQueryRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.query = ""; - - /** - * CompleteQueryRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.visitorId = ""; - - /** - * CompleteQueryRequest languageCodes. - * @member {Array.} languageCodes - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; - - /** - * CompleteQueryRequest deviceType. - * @member {string} deviceType - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.deviceType = ""; - - /** - * CompleteQueryRequest dataset. - * @member {string} dataset - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.dataset = ""; - - /** - * CompleteQueryRequest maxSuggestions. - * @member {number} maxSuggestions - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest - * @instance - */ - CompleteQueryRequest.prototype.maxSuggestions = 0; - - /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new GetCompletionConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest instance + * @param {google.cloud.retail.v2alpha.IGetCompletionConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetCompletionConfigRequest} GetCompletionConfigRequest instance */ - CompleteQueryRequest.create = function create(properties) { - return new CompleteQueryRequest(properties); + GetCompletionConfigRequest.create = function create(properties) { + return new GetCompletionConfigRequest(properties); }; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified GetCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetCompletionConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetCompletionConfigRequest} message GetCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encode = function encode(message, writer) { + GetCompletionConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); - if (message.languageCodes != null && message.languageCodes.length) - for (var i = 0; i < message.languageCodes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); - if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); - if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); - if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified GetCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetCompletionConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IGetCompletionConfigRequest} message GetCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetCompletionConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2alpha.GetCompletionConfigRequest} GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decode = function decode(reader, length) { + GetCompletionConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetCompletionConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.catalog = reader.string(); - break; - case 2: - message.query = reader.string(); - break; - case 7: - message.visitorId = reader.string(); - break; - case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - case 4: - message.deviceType = reader.string(); - break; - case 6: - message.dataset = reader.string(); - break; - case 5: - message.maxSuggestions = reader.int32(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -40781,173 +42066,108 @@ }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2alpha.GetCompletionConfigRequest} GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + GetCompletionConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryRequest message. + * Verifies a GetCompletionConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryRequest.verify = function verify(message) { + GetCompletionConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { - if (!Array.isArray(message.languageCodes)) - return "languageCodes: array expected"; - for (var i = 0; i < message.languageCodes.length; ++i) - if (!$util.isString(message.languageCodes[i])) - return "languageCodes: string[] expected"; - } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - if (!$util.isString(message.deviceType)) - return "deviceType: string expected"; - if (message.dataset != null && message.hasOwnProperty("dataset")) - if (!$util.isString(message.dataset)) - return "dataset: string expected"; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - if (!$util.isInteger(message.maxSuggestions)) - return "maxSuggestions: integer expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2alpha.GetCompletionConfigRequest} GetCompletionConfigRequest */ - CompleteQueryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryRequest) + GetCompletionConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetCompletionConfigRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.languageCodes) { - if (!Array.isArray(object.languageCodes)) - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryRequest.languageCodes: array expected"); - message.languageCodes = []; - for (var i = 0; i < object.languageCodes.length; ++i) - message.languageCodes[i] = String(object.languageCodes[i]); - } - if (object.deviceType != null) - message.deviceType = String(object.deviceType); - if (object.dataset != null) - message.dataset = String(object.dataset); - if (object.maxSuggestions != null) - message.maxSuggestions = object.maxSuggestions | 0; + var message = new $root.google.cloud.retail.v2alpha.GetCompletionConfigRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetCompletionConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryRequest} message CompleteQueryRequest + * @param {google.cloud.retail.v2alpha.GetCompletionConfigRequest} message GetCompletionConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryRequest.toObject = function toObject(message, options) { + GetCompletionConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.languageCodes = []; - if (options.defaults) { - object.catalog = ""; - object.query = ""; - object.deviceType = ""; - object.maxSuggestions = 0; - object.dataset = ""; - object.visitorId = ""; - } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.languageCodes && message.languageCodes.length) { - object.languageCodes = []; - for (var j = 0; j < message.languageCodes.length; ++j) - object.languageCodes[j] = message.languageCodes[j]; - } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - object.deviceType = message.deviceType; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - object.maxSuggestions = message.maxSuggestions; - if (message.dataset != null && message.hasOwnProperty("dataset")) - object.dataset = message.dataset; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this GetCompletionConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest * @instance * @returns {Object.} JSON object */ - CompleteQueryRequest.prototype.toJSON = function toJSON() { + GetCompletionConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CompleteQueryRequest; + return GetCompletionConfigRequest; })(); - v2alpha.CompleteQueryResponse = (function() { + v2alpha.UpdateCompletionConfigRequest = (function() { /** - * Properties of a CompleteQueryResponse. + * Properties of an UpdateCompletionConfigRequest. * @memberof google.cloud.retail.v2alpha - * @interface ICompleteQueryResponse - * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults - * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken - * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + * @interface IUpdateCompletionConfigRequest + * @property {google.cloud.retail.v2alpha.ICompletionConfig|null} [completionConfig] UpdateCompletionConfigRequest completionConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCompletionConfigRequest updateMask */ /** - * Constructs a new CompleteQueryResponse. + * Constructs a new UpdateCompletionConfigRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CompleteQueryResponse. - * @implements ICompleteQueryResponse + * @classdesc Represents an UpdateCompletionConfigRequest. + * @implements IUpdateCompletionConfigRequest * @constructor - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest=} [properties] Properties to set */ - function CompleteQueryResponse(properties) { - this.completionResults = []; - this.recentSearchResults = []; + function UpdateCompletionConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40955,107 +42175,88 @@ } /** - * CompleteQueryResponse completionResults. - * @member {Array.} completionResults - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @instance - */ - CompleteQueryResponse.prototype.completionResults = $util.emptyArray; - - /** - * CompleteQueryResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * UpdateCompletionConfigRequest completionConfig. + * @member {google.cloud.retail.v2alpha.ICompletionConfig|null|undefined} completionConfig + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @instance */ - CompleteQueryResponse.prototype.attributionToken = ""; + UpdateCompletionConfigRequest.prototype.completionConfig = null; /** - * CompleteQueryResponse recentSearchResults. - * @member {Array.} recentSearchResults - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * UpdateCompletionConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @instance */ - CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + UpdateCompletionConfigRequest.prototype.updateMask = null; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new UpdateCompletionConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse instance + * @param {google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest instance */ - CompleteQueryResponse.create = function create(properties) { - return new CompleteQueryResponse(properties); + UpdateCompletionConfigRequest.create = function create(properties) { + return new UpdateCompletionConfigRequest(properties); }; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified UpdateCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCompletionConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest} message UpdateCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encode = function encode(message, writer) { + UpdateCompletionConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionResults != null && message.completionResults.length) - for (var i = 0; i < message.completionResults.length; ++i) - $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.recentSearchResults != null && message.recentSearchResults.length) - for (var i = 0; i < message.recentSearchResults.length; ++i) - $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.completionConfig != null && Object.hasOwnProperty.call(message, "completionConfig")) + $root.google.cloud.retail.v2alpha.CompletionConfig.encode(message.completionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified UpdateCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateCompletionConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest} message UpdateCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + UpdateCompletionConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2alpha.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decode = function decode(reader, length) { + UpdateCompletionConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + message.completionConfig = $root.google.cloud.retail.v2alpha.CompletionConfig.decode(reader, reader.uint32()); break; case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -41066,688 +42267,403 @@ }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2alpha.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + UpdateCompletionConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryResponse message. + * Verifies an UpdateCompletionConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryResponse.verify = function verify(message) { + UpdateCompletionConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.completionResults != null && message.hasOwnProperty("completionResults")) { - if (!Array.isArray(message.completionResults)) - return "completionResults: array expected"; - for (var i = 0; i < message.completionResults.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); - if (error) - return "completionResults." + error; - } + if (message.completionConfig != null && message.hasOwnProperty("completionConfig")) { + var error = $root.google.cloud.retail.v2alpha.CompletionConfig.verify(message.completionConfig); + if (error) + return "completionConfig." + error; } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { - if (!Array.isArray(message.recentSearchResults)) - return "recentSearchResults: array expected"; - for (var i = 0; i < message.recentSearchResults.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); - if (error) - return "recentSearchResults." + error; - } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } return null; }; /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2alpha.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest */ - CompleteQueryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse) + UpdateCompletionConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); - if (object.completionResults) { - if (!Array.isArray(object.completionResults)) - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: array expected"); - message.completionResults = []; - for (var i = 0; i < object.completionResults.length; ++i) { - if (typeof object.completionResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: object expected"); - message.completionResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); - } + var message = new $root.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest(); + if (object.completionConfig != null) { + if (typeof object.completionConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCompletionConfigRequest.completionConfig: object expected"); + message.completionConfig = $root.google.cloud.retail.v2alpha.CompletionConfig.fromObject(object.completionConfig); } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.recentSearchResults) { - if (!Array.isArray(object.recentSearchResults)) - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: array expected"); - message.recentSearchResults = []; - for (var i = 0; i < object.recentSearchResults.length; ++i) { - if (typeof object.recentSearchResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: object expected"); - message.recentSearchResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); - } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateCompletionConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } return message; }; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * Creates a plain object from an UpdateCompletionConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} message CompleteQueryResponse + * @param {google.cloud.retail.v2alpha.UpdateCompletionConfigRequest} message UpdateCompletionConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryResponse.toObject = function toObject(message, options) { + UpdateCompletionConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.completionResults = []; - object.recentSearchResults = []; - } - if (options.defaults) - object.attributionToken = ""; - if (message.completionResults && message.completionResults.length) { - object.completionResults = []; - for (var j = 0; j < message.completionResults.length; ++j) - object.completionResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.recentSearchResults && message.recentSearchResults.length) { - object.recentSearchResults = []; - for (var j = 0; j < message.recentSearchResults.length; ++j) - object.recentSearchResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + if (options.defaults) { + object.completionConfig = null; + object.updateMask = null; } + if (message.completionConfig != null && message.hasOwnProperty("completionConfig")) + object.completionConfig = $root.google.cloud.retail.v2alpha.CompletionConfig.toObject(message.completionConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this UpdateCompletionConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest * @instance * @returns {Object.} JSON object */ - CompleteQueryResponse.prototype.toJSON = function toJSON() { + UpdateCompletionConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - CompleteQueryResponse.CompletionResult = (function() { + return UpdateCompletionConfigRequest; + })(); - /** - * Properties of a CompletionResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @interface ICompletionResult - * @property {string|null} [suggestion] CompletionResult suggestion - * @property {Object.|null} [attributes] CompletionResult attributes - */ + v2alpha.GetAttributesConfigRequest = (function() { - /** - * Constructs a new CompletionResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @classdesc Represents a CompletionResult. - * @implements ICompletionResult - * @constructor - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - */ - function CompletionResult(properties) { - this.attributes = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a GetAttributesConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetAttributesConfigRequest + * @property {string|null} [name] GetAttributesConfigRequest name + */ - /** - * CompletionResult suggestion. - * @member {string} suggestion - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.suggestion = ""; + /** + * Constructs a new GetAttributesConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetAttributesConfigRequest. + * @implements IGetAttributesConfigRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IGetAttributesConfigRequest=} [properties] Properties to set + */ + function GetAttributesConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CompletionResult attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.attributes = $util.emptyObject; + /** + * GetAttributesConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @instance + */ + GetAttributesConfigRequest.prototype.name = ""; - /** - * Creates a new CompletionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult instance - */ - CompletionResult.create = function create(properties) { - return new CompletionResult(properties); - }; + /** + * Creates a new GetAttributesConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetAttributesConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetAttributesConfigRequest} GetAttributesConfigRequest instance + */ + GetAttributesConfigRequest.create = function create(properties) { + return new GetAttributesConfigRequest(properties); + }; - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * Encodes the specified GetAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetAttributesConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetAttributesConfigRequest} message GetAttributesConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAttributesConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified GetAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetAttributesConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetAttributesConfigRequest} message GetAttributesConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAttributesConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetAttributesConfigRequest} GetAttributesConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAttributesConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetAttributesConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a CompletionResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompletionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - if (!$util.isString(message.suggestion)) - return "suggestion: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - return null; - }; + /** + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetAttributesConfigRequest} GetAttributesConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAttributesConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult - */ - CompletionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(); - if (object.suggestion != null) - message.suggestion = String(object.suggestion); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - return message; - }; + /** + * Verifies a GetAttributesConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAttributesConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} message CompletionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompletionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) - object.suggestion = ""; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - object.suggestion = message.suggestion; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } + /** + * Creates a GetAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetAttributesConfigRequest} GetAttributesConfigRequest + */ + GetAttributesConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetAttributesConfigRequest) return object; - }; - - /** - * Converts this CompletionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult - * @instance - * @returns {Object.} JSON object - */ - CompletionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + var message = new $root.google.cloud.retail.v2alpha.GetAttributesConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - return CompletionResult; - })(); + /** + * Creates a plain object from a GetAttributesConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.GetAttributesConfigRequest} message GetAttributesConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAttributesConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; - CompleteQueryResponse.RecentSearchResult = (function() { + /** + * Converts this GetAttributesConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetAttributesConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a RecentSearchResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @interface IRecentSearchResult - * @property {string|null} [recentSearch] RecentSearchResult recentSearch - */ + return GetAttributesConfigRequest; + })(); - /** - * Constructs a new RecentSearchResult. - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse - * @classdesc Represents a RecentSearchResult. - * @implements IRecentSearchResult - * @constructor - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - */ - function RecentSearchResult(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2alpha.UpdateAttributesConfigRequest = (function() { - /** - * RecentSearchResult recentSearch. - * @member {string} recentSearch - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @instance - */ - RecentSearchResult.prototype.recentSearch = ""; + /** + * Properties of an UpdateAttributesConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateAttributesConfigRequest + * @property {google.cloud.retail.v2alpha.IAttributesConfig|null} [attributesConfig] UpdateAttributesConfigRequest attributesConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAttributesConfigRequest updateMask + */ - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance - */ - RecentSearchResult.create = function create(properties) { - return new RecentSearchResult(properties); - }; + /** + * Constructs a new UpdateAttributesConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateAttributesConfigRequest. + * @implements IUpdateAttributesConfigRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest=} [properties] Properties to set + */ + function UpdateAttributesConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); - return writer; - }; + /** + * UpdateAttributesConfigRequest attributesConfig. + * @member {google.cloud.retail.v2alpha.IAttributesConfig|null|undefined} attributesConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest + * @instance + */ + UpdateAttributesConfigRequest.prototype.attributesConfig = null; - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RecentSearchResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RecentSearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - if (!$util.isString(message.recentSearch)) - return "recentSearch: string expected"; - return null; - }; - - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - */ - RecentSearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); - if (object.recentSearch != null) - message.recentSearch = String(object.recentSearch); - return message; - }; - - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RecentSearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.recentSearch = ""; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - object.recentSearch = message.recentSearch; - return object; - }; - - /** - * Converts this RecentSearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult - * @instance - * @returns {Object.} JSON object - */ - RecentSearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RecentSearchResult; - })(); - - return CompleteQueryResponse; - })(); - - v2alpha.ExportErrorsConfig = (function() { - - /** - * Properties of an ExportErrorsConfig. - * @memberof google.cloud.retail.v2alpha - * @interface IExportErrorsConfig - * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix - */ - - /** - * Constructs a new ExportErrorsConfig. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportErrorsConfig. - * @implements IExportErrorsConfig - * @constructor - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set - */ - function ExportErrorsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig - * @instance - */ - ExportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ExportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig - * @instance - */ - Object.defineProperty(ExportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * UpdateAttributesConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest + * @instance + */ + UpdateAttributesConfigRequest.prototype.updateMask = null; /** - * Creates a new ExportErrorsConfig instance using the specified properties. + * Creates a new UpdateAttributesConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance + * @param {google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest instance */ - ExportErrorsConfig.create = function create(properties) { - return new ExportErrorsConfig(properties); + UpdateAttributesConfigRequest.create = function create(properties) { + return new UpdateAttributesConfigRequest(properties); }; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified UpdateAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateAttributesConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest} message UpdateAttributesConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encode = function encode(message, writer) { + UpdateAttributesConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + $root.google.cloud.retail.v2alpha.AttributesConfig.encode(message.attributesConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified UpdateAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateAttributesConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest} message UpdateAttributesConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + UpdateAttributesConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decode = function decode(reader, length) { + UpdateAttributesConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + message.attributesConfig = $root.google.cloud.retail.v2alpha.AttributesConfig.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -41758,112 +42674,127 @@ }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + UpdateAttributesConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportErrorsConfig message. + * Verifies an UpdateAttributesConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportErrorsConfig.verify = function verify(message) { + UpdateAttributesConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) { + var error = $root.google.cloud.retail.v2alpha.AttributesConfig.verify(message.attributesConfig); + if (error) + return "attributesConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } return null; }; /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest */ - ExportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) + UpdateAttributesConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); + var message = new $root.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest(); + if (object.attributesConfig != null) { + if (typeof object.attributesConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateAttributesConfigRequest.attributesConfig: object expected"); + message.attributesConfig = $root.google.cloud.retail.v2alpha.AttributesConfig.fromObject(object.attributesConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateAttributesConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } return message; }; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from an UpdateAttributesConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig + * @param {google.cloud.retail.v2alpha.UpdateAttributesConfigRequest} message UpdateAttributesConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportErrorsConfig.toObject = function toObject(message, options) { + UpdateAttributesConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; + if (options.defaults) { + object.attributesConfig = null; + object.updateMask = null; } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = $root.google.cloud.retail.v2alpha.AttributesConfig.toObject(message.attributesConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this ExportErrorsConfig to JSON. + * Converts this UpdateAttributesConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest * @instance * @returns {Object.} JSON object */ - ExportErrorsConfig.prototype.toJSON = function toJSON() { + UpdateAttributesConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportErrorsConfig; + return UpdateAttributesConfigRequest; })(); - v2alpha.ExportMetadata = (function() { + v2alpha.AddCatalogAttributeRequest = (function() { /** - * Properties of an ExportMetadata. + * Properties of an AddCatalogAttributeRequest. * @memberof google.cloud.retail.v2alpha - * @interface IExportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + * @interface IAddCatalogAttributeRequest + * @property {string|null} [attributesConfig] AddCatalogAttributeRequest attributesConfig + * @property {google.cloud.retail.v2alpha.ICatalogAttribute|null} [catalogAttribute] AddCatalogAttributeRequest catalogAttribute */ /** - * Constructs a new ExportMetadata. + * Constructs a new AddCatalogAttributeRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportMetadata. - * @implements IExportMetadata + * @classdesc Represents an AddCatalogAttributeRequest. + * @implements IAddCatalogAttributeRequest * @constructor - * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddCatalogAttributeRequest=} [properties] Properties to set */ - function ExportMetadata(properties) { + function AddCatalogAttributeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41871,88 +42802,88 @@ } /** - * ExportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * AddCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @instance */ - ExportMetadata.prototype.createTime = null; + AddCatalogAttributeRequest.prototype.attributesConfig = ""; /** - * ExportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * AddCatalogAttributeRequest catalogAttribute. + * @member {google.cloud.retail.v2alpha.ICatalogAttribute|null|undefined} catalogAttribute + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @instance */ - ExportMetadata.prototype.updateTime = null; + AddCatalogAttributeRequest.prototype.catalogAttribute = null; /** - * Creates a new ExportMetadata instance using the specified properties. + * Creates a new AddCatalogAttributeRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance + * @param {google.cloud.retail.v2alpha.IAddCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddCatalogAttributeRequest} AddCatalogAttributeRequest instance */ - ExportMetadata.create = function create(properties) { - return new ExportMetadata(properties); + AddCatalogAttributeRequest.create = function create(properties) { + return new AddCatalogAttributeRequest(properties); }; /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * Encodes the specified AddCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddCatalogAttributeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddCatalogAttributeRequest} message AddCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encode = function encode(message, writer) { + AddCatalogAttributeRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.catalogAttribute != null && Object.hasOwnProperty.call(message, "catalogAttribute")) + $root.google.cloud.retail.v2alpha.CatalogAttribute.encode(message.catalogAttribute, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * Encodes the specified AddCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddCatalogAttributeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddCatalogAttributeRequest} message AddCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AddCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportMetadata message from the specified reader or buffer. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.AddCatalogAttributeRequest} AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decode = function decode(reader, length) { + AddCatalogAttributeRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddCatalogAttributeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.attributesConfig = reader.string(); break; case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -41963,128 +42894,122 @@ }; /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.AddCatalogAttributeRequest} AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + AddCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportMetadata message. + * Verifies an AddCatalogAttributeRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportMetadata.verify = function verify(message) { + AddCatalogAttributeRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) { + var error = $root.google.cloud.retail.v2alpha.CatalogAttribute.verify(message.catalogAttribute); if (error) - return "updateTime." + error; + return "catalogAttribute." + error; } return null; }; /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.AddCatalogAttributeRequest} AddCatalogAttributeRequest */ - ExportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) + AddCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddCatalogAttributeRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.retail.v2alpha.AddCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.catalogAttribute != null) { + if (typeof object.catalogAttribute !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddCatalogAttributeRequest.catalogAttribute: object expected"); + message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.fromObject(object.catalogAttribute); } return message; }; /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AddCatalogAttributeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata + * @param {google.cloud.retail.v2alpha.AddCatalogAttributeRequest} message AddCatalogAttributeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportMetadata.toObject = function toObject(message, options) { + AddCatalogAttributeRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.createTime = null; - object.updateTime = null; + object.attributesConfig = ""; + object.catalogAttribute = null; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) + object.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.toObject(message.catalogAttribute, options); return object; }; /** - * Converts this ExportMetadata to JSON. + * Converts this AddCatalogAttributeRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest * @instance * @returns {Object.} JSON object */ - ExportMetadata.prototype.toJSON = function toJSON() { + AddCatalogAttributeRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportMetadata; + return AddCatalogAttributeRequest; })(); - v2alpha.ExportProductsResponse = (function() { + v2alpha.RemoveCatalogAttributeRequest = (function() { /** - * Properties of an ExportProductsResponse. + * Properties of a RemoveCatalogAttributeRequest. * @memberof google.cloud.retail.v2alpha - * @interface IExportProductsResponse - * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + * @interface IRemoveCatalogAttributeRequest + * @property {string|null} [attributesConfig] RemoveCatalogAttributeRequest attributesConfig + * @property {string|null} [key] RemoveCatalogAttributeRequest key */ /** - * Constructs a new ExportProductsResponse. + * Constructs a new RemoveCatalogAttributeRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportProductsResponse. - * @implements IExportProductsResponse + * @classdesc Represents a RemoveCatalogAttributeRequest. + * @implements IRemoveCatalogAttributeRequest * @constructor - * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest=} [properties] Properties to set */ - function ExportProductsResponse(properties) { - this.errorSamples = []; + function RemoveCatalogAttributeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42092,91 +43017,88 @@ } /** - * ExportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * RemoveCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @instance */ - ExportProductsResponse.prototype.errorSamples = $util.emptyArray; + RemoveCatalogAttributeRequest.prototype.attributesConfig = ""; /** - * ExportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * RemoveCatalogAttributeRequest key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @instance */ - ExportProductsResponse.prototype.errorsConfig = null; + RemoveCatalogAttributeRequest.prototype.key = ""; /** - * Creates a new ExportProductsResponse instance using the specified properties. + * Creates a new RemoveCatalogAttributeRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance + * @param {google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest instance */ - ExportProductsResponse.create = function create(properties) { - return new ExportProductsResponse(properties); + RemoveCatalogAttributeRequest.create = function create(properties) { + return new RemoveCatalogAttributeRequest(properties); }; /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * Encodes the specified RemoveCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encode = function encode(message, writer) { + RemoveCatalogAttributeRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); return writer; }; /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * Encodes the specified RemoveCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decode = function decode(reader, length) { + RemoveCatalogAttributeRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.attributesConfig = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + message.key = reader.string(); break; default: reader.skipType(tag & 7); @@ -42187,140 +43109,118 @@ }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportProductsResponse message. + * Verifies a RemoveCatalogAttributeRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportProductsResponse.verify = function verify(message) { + RemoveCatalogAttributeRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; return null; }; /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest */ - ExportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) + RemoveCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.key != null) + message.key = String(object.key); return message; }; /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a RemoveCatalogAttributeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse + * @param {google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportProductsResponse.toObject = function toObject(message, options) { + RemoveCatalogAttributeRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.attributesConfig = ""; + object.key = ""; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; return object; }; /** - * Converts this ExportProductsResponse to JSON. + * Converts this RemoveCatalogAttributeRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest * @instance * @returns {Object.} JSON object */ - ExportProductsResponse.prototype.toJSON = function toJSON() { + RemoveCatalogAttributeRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportProductsResponse; + return RemoveCatalogAttributeRequest; })(); - v2alpha.ExportUserEventsResponse = (function() { + v2alpha.ReplaceCatalogAttributeRequest = (function() { /** - * Properties of an ExportUserEventsResponse. + * Properties of a ReplaceCatalogAttributeRequest. * @memberof google.cloud.retail.v2alpha - * @interface IExportUserEventsResponse - * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + * @interface IReplaceCatalogAttributeRequest + * @property {string|null} [attributesConfig] ReplaceCatalogAttributeRequest attributesConfig + * @property {google.cloud.retail.v2alpha.ICatalogAttribute|null} [catalogAttribute] ReplaceCatalogAttributeRequest catalogAttribute + * @property {google.protobuf.IFieldMask|null} [updateMask] ReplaceCatalogAttributeRequest updateMask */ /** - * Constructs a new ExportUserEventsResponse. + * Constructs a new ReplaceCatalogAttributeRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportUserEventsResponse. - * @implements IExportUserEventsResponse + * @classdesc Represents a ReplaceCatalogAttributeRequest. + * @implements IReplaceCatalogAttributeRequest * @constructor - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest=} [properties] Properties to set */ - function ExportUserEventsResponse(properties) { - this.errorSamples = []; + function ReplaceCatalogAttributeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42328,91 +43228,101 @@ } /** - * ExportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * ReplaceCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @instance */ - ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + ReplaceCatalogAttributeRequest.prototype.attributesConfig = ""; /** - * ExportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * ReplaceCatalogAttributeRequest catalogAttribute. + * @member {google.cloud.retail.v2alpha.ICatalogAttribute|null|undefined} catalogAttribute + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @instance */ - ExportUserEventsResponse.prototype.errorsConfig = null; + ReplaceCatalogAttributeRequest.prototype.catalogAttribute = null; /** - * Creates a new ExportUserEventsResponse instance using the specified properties. + * ReplaceCatalogAttributeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.updateMask = null; + + /** + * Creates a new ReplaceCatalogAttributeRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest instance */ - ExportUserEventsResponse.create = function create(properties) { - return new ExportUserEventsResponse(properties); + ReplaceCatalogAttributeRequest.create = function create(properties) { + return new ReplaceCatalogAttributeRequest(properties); }; /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified ReplaceCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encode = function encode(message, writer) { + ReplaceCatalogAttributeRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.catalogAttribute != null && Object.hasOwnProperty.call(message, "catalogAttribute")) + $root.google.cloud.retail.v2alpha.CatalogAttribute.encode(message.catalogAttribute, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified ReplaceCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + ReplaceCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decode = function decode(reader, length) { + ReplaceCatalogAttributeRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.attributesConfig = reader.string(); break; case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); + break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -42423,215 +43333,242 @@ }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + ReplaceCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a ReplaceCatalogAttributeRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportUserEventsResponse.verify = function verify(message) { + ReplaceCatalogAttributeRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) { + var error = $root.google.cloud.retail.v2alpha.CatalogAttribute.verify(message.catalogAttribute); + if (error) + return "catalogAttribute." + error; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); if (error) - return "errorsConfig." + error; + return "updateMask." + error; } return null; }; /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ReplaceCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest */ - ExportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) + ReplaceCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } + var message = new $root.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.catalogAttribute != null) { + if (typeof object.catalogAttribute !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest.catalogAttribute: object expected"); + message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.fromObject(object.catalogAttribute); } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } return message; }; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a ReplaceCatalogAttributeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportUserEventsResponse.toObject = function toObject(message, options) { + ReplaceCatalogAttributeRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + if (options.defaults) { + object.attributesConfig = ""; + object.catalogAttribute = null; + object.updateMask = null; } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) + object.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.toObject(message.catalogAttribute, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this ReplaceCatalogAttributeRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest * @instance * @returns {Object.} JSON object */ - ExportUserEventsResponse.prototype.toJSON = function toJSON() { + ReplaceCatalogAttributeRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportUserEventsResponse; + return ReplaceCatalogAttributeRequest; })(); - v2alpha.PredictionService = (function() { + v2alpha.CompletionService = (function() { /** - * Constructs a new PredictionService service. + * Constructs a new CompletionService service. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictionService + * @classdesc Represents a CompletionService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; /** - * Creates new PredictionService service using the specified rpc implementation. + * Creates new CompletionService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2alpha.PredictionService + * @memberof google.cloud.retail.v2alpha.CompletionService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. - * @memberof google.cloud.retail.v2alpha.PredictionService - * @typedef PredictCallback + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * @memberof google.cloud.retail.v2alpha.CompletionService + * @typedef CompleteQueryCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} [response] CompleteQueryResponse */ /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2alpha.PredictionService + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2alpha.CompletionService * @instance - * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2alpha.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); - }, "name", { value: "Predict" }); - + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2alpha.CompleteQueryRequest, $root.google.cloud.retail.v2alpha.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); + /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2alpha.PredictionService + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2alpha.CompletionService * @instance - * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return PredictionService; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * @memberof google.cloud.retail.v2alpha.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2alpha.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2alpha.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); + + /** + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2alpha.CompletionService + * @instance + * @param {google.cloud.retail.v2alpha.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CompletionService; })(); - v2alpha.PredictRequest = (function() { + v2alpha.CompleteQueryRequest = (function() { /** - * Properties of a PredictRequest. + * Properties of a CompleteQueryRequest. * @memberof google.cloud.retail.v2alpha - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions */ /** - * Constructs a new PredictRequest. + * Constructs a new CompleteQueryRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest * @constructor - * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; + function CompleteQueryRequest(properties) { + this.languageCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42639,211 +43576,159 @@ } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2alpha.PredictRequest - * @instance - */ - PredictRequest.prototype.placement = ""; - - /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.userEvent = null; + CompleteQueryRequest.prototype.catalog = ""; /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.pageSize = 0; + CompleteQueryRequest.prototype.query = ""; /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.pageToken = ""; + CompleteQueryRequest.prototype.visitorId = ""; /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.filter = ""; + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.validateOnly = false; + CompleteQueryRequest.prototype.deviceType = ""; /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.params = $util.emptyObject; + CompleteQueryRequest.prototype.dataset = ""; /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2alpha.PredictRequest + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance */ - PredictRequest.prototype.labels = $util.emptyObject; + CompleteQueryRequest.prototype.maxSuggestions = 0; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + CompleteQueryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + CompleteQueryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); + message.catalog = reader.string(); break; case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + message.query = reader.string(); + break; + case 7: + message.visitorId = reader.string(); break; case 3: - message.pageSize = reader.int32(); + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); break; case 4: - message.pageToken = reader.string(); + message.deviceType = reader.string(); + break; + case 6: + message.dataset = reader.string(); break; case 5: - message.filter = reader.string(); + message.maxSuggestions = reader.int32(); break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - default: - reader.skipType(tag & 7); + default: + reader.skipType(tag & 7); break; } } @@ -42851,208 +43736,173 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies a CompleteQueryRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + CompleteQueryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; return null; }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2alpha.CompleteQueryRequest} CompleteQueryRequest */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); } + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; return message; }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest + * @param {google.cloud.retail.v2alpha.CompleteQueryRequest} message CompleteQueryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictRequest.toObject = function toObject(message, options) { + CompleteQueryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } + if (options.arrays || options.defaults) + object.languageCodes = []; if (options.defaults) { - object.placement = ""; - object.userEvent = null; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; } + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; return object; }; /** - * Converts this PredictRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictRequest + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest * @instance * @returns {Object.} JSON object */ - PredictRequest.prototype.toJSON = function toJSON() { + CompleteQueryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PredictRequest; + return CompleteQueryRequest; })(); - v2alpha.PredictResponse = (function() { + v2alpha.CompleteQueryResponse = (function() { /** - * Properties of a PredictResponse. + * Properties of a CompleteQueryResponse. * @memberof google.cloud.retail.v2alpha - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults */ /** - * Constructs a new PredictResponse. + * Constructs a new CompleteQueryResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse * @constructor - * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43060,120 +43910,107 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2alpha.PredictResponse + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - PredictResponse.prototype.results = $util.emptyArray; + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; /** - * PredictResponse attributionToken. + * CompleteQueryResponse attributionToken. * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @instance - */ - PredictResponse.prototype.attributionToken = ""; - - /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - PredictResponse.prototype.missingIds = $util.emptyArray; + CompleteQueryResponse.prototype.attributionToken = ""; /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2alpha.PredictResponse + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance */ - PredictResponse.prototype.validateOnly = false; + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + CompleteQueryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + CompleteQueryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); break; case 2: message.attributionToken = reader.string(); break; case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -43184,162 +44021,158 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies a CompleteQueryResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + CompleteQueryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); if (error) - return "results." + error; + return "completionResults." + error; } } if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) if (!$util.isString(message.attributionToken)) return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse} CompleteQueryResponse */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); } } if (object.attributionToken != null) message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse} message CompleteQueryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + CompleteQueryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; + object.completionResults = []; + object.recentSearchResults = []; } - if (options.defaults) { + if (options.defaults) object.attributionToken = ""; - object.validateOnly = false; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); } if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this CompleteQueryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictResponse + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + CompleteQueryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - PredictResponse.PredictionResult = (function() { + CompleteQueryResponse.CompletionResult = (function() { /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes */ /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2alpha.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43347,92 +44180,92 @@ } /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @instance */ - PredictionResult.prototype.id = ""; + CompletionResult.prototype.suggestion = ""; /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @instance */ - PredictionResult.prototype.metadata = $util.emptyObject; + CompletionResult.prototype.attributes = $util.emptyObject; /** - * Creates a new PredictionResult instance using the specified properties. + * Creates a new CompletionResult instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult instance */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); }; /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictionResult.encode = function encode(message, writer) { + CompletionResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.google.cloud.retail.v2alpha.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } return writer; }; /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictionResult message from the specified reader or buffer. + * Decodes a CompletionResult message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictionResult.decode = function decode(reader, length) { + CompletionResult.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.id = reader.string(); + message.suggestion = reader.string(); break; case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; + if (message.attributes === $util.emptyObject) + message.attributes = {}; var end2 = reader.uint32() + reader.pos; key = ""; value = null; @@ -43443,14 +44276,14 @@ key = reader.string(); break; case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); break; default: reader.skipType(tag2 & 7); break; } } - message.metadata[key] = value; + message.attributes[key] = value; break; default: reader.skipType(tag & 7); @@ -43461,538 +44294,878 @@ }; /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { + CompletionResult.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictionResult message. + * Verifies a CompletionResult message. * @function verify - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictionResult.verify = function verify(message) { + CompletionResult.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + var error = $root.google.cloud.retail.v2alpha.CustomAttribute.verify(message.attributes[key[i]]); if (error) - return "metadata." + error; + return "attributes." + error; } } return null; }; /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} CompletionResult */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult) return object; - var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2alpha.CustomAttribute.fromObject(object.attributes[keys[i]]); } } return message; }; /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @static - * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult} message CompletionResult * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictionResult.toObject = function toObject(message, options) { + CompletionResult.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.objects || options.defaults) - object.metadata = {}; + object.attributes = {}; if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + object.attributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CustomAttribute.toObject(message.attributes[keys2[j]], options); } return object; }; /** - * Converts this PredictionResult to JSON. + * Converts this CompletionResult to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult * @instance * @returns {Object.} JSON object */ - PredictionResult.prototype.toJSON = function toJSON() { + CompletionResult.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PredictionResult; + return CompletionResult; })(); - return PredictResponse; - })(); + CompleteQueryResponse.RecentSearchResult = (function() { - v2alpha.ProductService = (function() { + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ - /** - * Constructs a new ProductService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ProductService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; - /** - * Creates new ProductService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.ProductService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. - */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product - */ + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recentSearch = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; + })(); + + v2alpha.Control = (function() { /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 + * Properties of a Control. + * @memberof google.cloud.retail.v2alpha + * @interface IControl + * @property {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec|null} [facetSpec] Control facetSpec + * @property {google.cloud.retail.v2alpha.IRule|null} [rule] Control rule + * @property {string|null} [name] Control name + * @property {string|null} [displayName] Control displayName + * @property {Array.|null} [associatedServingConfigIds] Control associatedServingConfigIds + * @property {Array.|null} [solutionTypes] Control solutionTypes + * @property {Array.|null} [searchSolutionUseCase] Control searchSolutionUseCase */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "CreateProduct" }); /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Constructs a new Control. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Control. + * @implements IControl + * @constructor + * @param {google.cloud.retail.v2alpha.IControl=} [properties] Properties to set */ + function Control(properties) { + this.associatedServingConfigIds = []; + this.solutionTypes = []; + this.searchSolutionUseCase = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product + * Control facetSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec|null|undefined} facetSpec + * @memberof google.cloud.retail.v2alpha.Control + * @instance */ + Control.prototype.facetSpec = null; /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2alpha.ProductService + * Control rule. + * @member {google.cloud.retail.v2alpha.IRule|null|undefined} rule + * @memberof google.cloud.retail.v2alpha.Control * @instance - * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "GetProduct" }); + Control.prototype.rule = null; /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2alpha.ProductService + * Control name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Control * @instance - * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Control.prototype.name = ""; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.ListProductsResponse} [response] ListProductsResponse + * Control displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Control + * @instance */ + Control.prototype.displayName = ""; /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2alpha.ProductService + * Control associatedServingConfigIds. + * @member {Array.} associatedServingConfigIds + * @memberof google.cloud.retail.v2alpha.Control * @instance - * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.retail.v2alpha.ListProductsRequest, $root.google.cloud.retail.v2alpha.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); + Control.prototype.associatedServingConfigIds = $util.emptyArray; /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2alpha.ProductService + * Control solutionTypes. + * @member {Array.} solutionTypes + * @memberof google.cloud.retail.v2alpha.Control * @instance - * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Control.prototype.solutionTypes = $util.emptyArray; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.Product} [response] Product + * Control searchSolutionUseCase. + * @member {Array.} searchSolutionUseCase + * @memberof google.cloud.retail.v2alpha.Control + * @instance */ + Control.prototype.searchSolutionUseCase = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2alpha.ProductService + * Control control. + * @member {"facetSpec"|"rule"|undefined} control + * @memberof google.cloud.retail.v2alpha.Control * @instance - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty */ + Object.defineProperty(Control.prototype, "control", { + get: $util.oneOfGetter($oneOfFields = ["facetSpec", "rule"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 + * Creates a new Control instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {google.cloud.retail.v2alpha.IControl=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Control} Control instance */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); + Control.create = function create(properties) { + return new Control(properties); + }; /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Encodes the specified Control message. Does not implicitly {@link google.cloud.retail.v2alpha.Control.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {google.cloud.retail.v2alpha.IControl} message Control message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + Control.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.facetSpec != null && Object.hasOwnProperty.call(message, "facetSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.encode(message.facetSpec, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rule != null && Object.hasOwnProperty.call(message, "rule")) + $root.google.cloud.retail.v2alpha.Rule.encode(message.rule, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.associatedServingConfigIds != null && message.associatedServingConfigIds.length) + for (var i = 0; i < message.associatedServingConfigIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.associatedServingConfigIds[i]); + if (message.solutionTypes != null && message.solutionTypes.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.solutionTypes.length; ++i) + writer.int32(message.solutionTypes[i]); + writer.ldelim(); + } + if (message.searchSolutionUseCase != null && message.searchSolutionUseCase.length) { + writer.uint32(/* id 7, wireType 2 =*/58).fork(); + for (var i = 0; i < message.searchSolutionUseCase.length; ++i) + writer.int32(message.searchSolutionUseCase[i]); + writer.ldelim(); + } + return writer; + }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Encodes the specified Control message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Control.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {google.cloud.retail.v2alpha.IControl} message Control message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + Control.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Decodes a Control message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Control} Control + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); + Control.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Control(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.facetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32()); + break; + case 4: + message.rule = $root.google.cloud.retail.v2alpha.Rule.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 5: + if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) + message.associatedServingConfigIds = []; + message.associatedServingConfigIds.push(reader.string()); + break; + case 6: + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else + message.solutionTypes.push(reader.int32()); + break; + case 7: + if (!(message.searchSolutionUseCase && message.searchSolutionUseCase.length)) + message.searchSolutionUseCase = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.searchSolutionUseCase.push(reader.int32()); + } else + message.searchSolutionUseCase.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a Control message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Control} Control + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + Control.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef SetInventoryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Verifies a Control message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ + Control.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.facetSpec != null && message.hasOwnProperty("facetSpec")) { + properties.control = 1; + { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify(message.facetSpec); + if (error) + return "facetSpec." + error; + } + } + if (message.rule != null && message.hasOwnProperty("rule")) { + if (properties.control === 1) + return "control: multiple values"; + properties.control = 1; + { + var error = $root.google.cloud.retail.v2alpha.Rule.verify(message.rule); + if (error) + return "rule." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.associatedServingConfigIds != null && message.hasOwnProperty("associatedServingConfigIds")) { + if (!Array.isArray(message.associatedServingConfigIds)) + return "associatedServingConfigIds: array expected"; + for (var i = 0; i < message.associatedServingConfigIds.length; ++i) + if (!$util.isString(message.associatedServingConfigIds[i])) + return "associatedServingConfigIds: string[] expected"; + } + if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { + if (!Array.isArray(message.solutionTypes)) + return "solutionTypes: array expected"; + for (var i = 0; i < message.solutionTypes.length; ++i) + switch (message.solutionTypes[i]) { + default: + return "solutionTypes: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.searchSolutionUseCase != null && message.hasOwnProperty("searchSolutionUseCase")) { + if (!Array.isArray(message.searchSolutionUseCase)) + return "searchSolutionUseCase: array expected"; + for (var i = 0; i < message.searchSolutionUseCase.length; ++i) + switch (message.searchSolutionUseCase[i]) { + default: + return "searchSolutionUseCase: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { - return this.rpcCall(setInventory, $root.google.cloud.retail.v2alpha.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "SetInventory" }); - - /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef AddFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Creates a Control message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Control} Control */ + Control.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Control) + return object; + var message = new $root.google.cloud.retail.v2alpha.Control(); + if (object.facetSpec != null) { + if (typeof object.facetSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Control.facetSpec: object expected"); + message.facetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.fromObject(object.facetSpec); + } + if (object.rule != null) { + if (typeof object.rule !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Control.rule: object expected"); + message.rule = $root.google.cloud.retail.v2alpha.Rule.fromObject(object.rule); + } + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.associatedServingConfigIds) { + if (!Array.isArray(object.associatedServingConfigIds)) + throw TypeError(".google.cloud.retail.v2alpha.Control.associatedServingConfigIds: array expected"); + message.associatedServingConfigIds = []; + for (var i = 0; i < object.associatedServingConfigIds.length; ++i) + message.associatedServingConfigIds[i] = String(object.associatedServingConfigIds[i]); + } + if (object.solutionTypes) { + if (!Array.isArray(object.solutionTypes)) + throw TypeError(".google.cloud.retail.v2alpha.Control.solutionTypes: array expected"); + message.solutionTypes = []; + for (var i = 0; i < object.solutionTypes.length; ++i) + switch (object.solutionTypes[i]) { + default: + case "SOLUTION_TYPE_UNSPECIFIED": + case 0: + message.solutionTypes[i] = 0; + break; + case "SOLUTION_TYPE_RECOMMENDATION": + case 1: + message.solutionTypes[i] = 1; + break; + case "SOLUTION_TYPE_SEARCH": + case 2: + message.solutionTypes[i] = 2; + break; + } + } + if (object.searchSolutionUseCase) { + if (!Array.isArray(object.searchSolutionUseCase)) + throw TypeError(".google.cloud.retail.v2alpha.Control.searchSolutionUseCase: array expected"); + message.searchSolutionUseCase = []; + for (var i = 0; i < object.searchSolutionUseCase.length; ++i) + switch (object.searchSolutionUseCase[i]) { + default: + case "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": + case 0: + message.searchSolutionUseCase[i] = 0; + break; + case "SEARCH_SOLUTION_USE_CASE_SEARCH": + case 1: + message.searchSolutionUseCase[i] = 1; + break; + case "SEARCH_SOLUTION_USE_CASE_BROWSE": + case 2: + message.searchSolutionUseCase[i] = 2; + break; + } + } + return message; + }; /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Creates a plain object from a Control message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {google.cloud.retail.v2alpha.Control} message Control + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { - return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddFulfillmentPlaces" }); + Control.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.associatedServingConfigIds = []; + object.solutionTypes = []; + object.searchSolutionUseCase = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.facetSpec != null && message.hasOwnProperty("facetSpec")) { + object.facetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.toObject(message.facetSpec, options); + if (options.oneofs) + object.control = "facetSpec"; + } + if (message.rule != null && message.hasOwnProperty("rule")) { + object.rule = $root.google.cloud.retail.v2alpha.Rule.toObject(message.rule, options); + if (options.oneofs) + object.control = "rule"; + } + if (message.associatedServingConfigIds && message.associatedServingConfigIds.length) { + object.associatedServingConfigIds = []; + for (var j = 0; j < message.associatedServingConfigIds.length; ++j) + object.associatedServingConfigIds[j] = message.associatedServingConfigIds[j]; + } + if (message.solutionTypes && message.solutionTypes.length) { + object.solutionTypes = []; + for (var j = 0; j < message.solutionTypes.length; ++j) + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + } + if (message.searchSolutionUseCase && message.searchSolutionUseCase.length) { + object.searchSolutionUseCase = []; + for (var j = 0; j < message.searchSolutionUseCase.length; ++j) + object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; + } + return object; + }; /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService + * Converts this Control to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Control * @instance - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef RemoveFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * @returns {Object.} JSON object */ + Control.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { - return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveFulfillmentPlaces" }); + return Control; + })(); - /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + v2alpha.SearchService = (function() { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef AddLocalInventoriesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * Calls AddLocalInventories. - * @function addLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { - return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddLocalInventories" }); + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; /** - * Calls AddLocalInventories. - * @function addLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService - * @instance - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. - * @memberof google.cloud.retail.v2alpha.ProductService - * @typedef RemoveLocalInventoriesCallback + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * @memberof google.cloud.retail.v2alpha.SearchService + * @typedef SearchCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * @param {google.cloud.retail.v2alpha.SearchResponse} [response] SearchResponse */ /** - * Calls RemoveLocalInventories. - * @function removeLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2alpha.SearchService * @instance - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object - * @param {google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2alpha.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { - return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveLocalInventories" }); + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2alpha.SearchRequest, $root.google.cloud.retail.v2alpha.SearchResponse, request, callback); + }, "name", { value: "Search" }); /** - * Calls RemoveLocalInventories. - * @function removeLocalInventories - * @memberof google.cloud.retail.v2alpha.ProductService + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2alpha.SearchService * @instance - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return ProductService; + return SearchService; })(); - v2alpha.CreateProductRequest = (function() { + v2alpha.SearchRequest = (function() { /** - * Properties of a CreateProductRequest. + * Properties of a SearchRequest. * @memberof google.cloud.retail.v2alpha - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null} [relevanceThreshold] SearchRequest relevanceThreshold + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2alpha.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + * @property {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec */ /** - * Constructs a new CreateProductRequest. + * Constructs a new SearchRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest * @constructor - * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set */ - function CreateProductRequest(properties) { + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44000,310 +45173,331 @@ } /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CreateProductRequest.prototype.parent = ""; + SearchRequest.prototype.placement = ""; /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CreateProductRequest.prototype.product = null; + SearchRequest.prototype.branch = ""; /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - CreateProductRequest.prototype.productId = ""; + SearchRequest.prototype.query = ""; /** - * Creates a new CreateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); - }; + SearchRequest.prototype.visitorId = ""; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SearchRequest userInfo. + * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); - return writer; - }; + SearchRequest.prototype.userInfo = null; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + SearchRequest.prototype.pageSize = 0; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 3: - message.productId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + SearchRequest.prototype.pageToken = ""; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + SearchRequest.prototype.offset = 0; /** - * Verifies a CreateProductRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; - return null; - }; + SearchRequest.prototype.filter = ""; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); - } - if (object.productId != null) - message.productId = String(object.productId); - return message; - }; + SearchRequest.prototype.canonicalFilter = ""; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.CreateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - CreateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; - return object; - }; + SearchRequest.prototype.orderBy = ""; /** - * Converts this CreateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance - * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + SearchRequest.prototype.facetSpecs = $util.emptyArray; - return CreateProductRequest; - })(); + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; - v2alpha.GetProductRequest = (function() { + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; /** - * Properties of a GetProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ + SearchRequest.prototype.queryExpansionSpec = null; /** - * Constructs a new GetProductRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * SearchRequest relevanceThreshold. + * @member {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} relevanceThreshold + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance */ - function GetProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + SearchRequest.prototype.relevanceThreshold = 0; /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance */ - GetProductRequest.prototype.name = ""; + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; /** - * Creates a new GetProductRequest instance using the specified properties. + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2alpha.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + + /** + * SearchRequest personalizationSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.personalizationSpec = null; + + /** + * Creates a new SearchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance + * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest instance */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encode = function encode(message, writer) { + SearchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.relevanceThreshold != null && Object.hasOwnProperty.call(message, "relevanceThreshold")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.relevanceThreshold); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); + if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.placement = reader.string(); + break; + case 2: + message.branch = reader.string(); + break; + case 3: + message.query = reader.string(); + break; + case 4: + message.visitorId = reader.string(); + break; + case 5: + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pageSize = reader.int32(); + break; + case 8: + message.pageToken = reader.string(); + break; + case 9: + message.offset = reader.int32(); + break; + case 10: + message.filter = reader.string(); + break; + case 28: + message.canonicalFilter = reader.string(); + break; + case 11: + message.orderBy = reader.string(); + break; + case 12: + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + case 21: + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 13: + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + case 14: + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + case 15: + message.relevanceThreshold = reader.int32(); + break; + case 17: + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + case 23: + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + case 31: + message.searchMode = reader.int32(); + break; + case 32: + message.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -44314,842 +45508,8362 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + SearchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a SearchRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.GetProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest - */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (error) + return "facetSpecs." + error; + } + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) + switch (message.relevanceThreshold) { + default: + return "relevanceThreshold: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); + if (error) + return "personalizationSpec." + error; + } + return null; + }; + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + */ + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + switch (object.relevanceThreshold) { + case "RELEVANCE_THRESHOLD_UNSPECIFIED": + case 0: + message.relevanceThreshold = 0; + break; + case "HIGH": + case 1: + message.relevanceThreshold = 1; + break; + case "MEDIUM": + case 2: + message.relevanceThreshold = 2; + break; + case "LOW": + case 3: + message.relevanceThreshold = 3; + break; + case "LOWEST": + case 4: + message.relevanceThreshold = 4; + break; + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } + if (object.personalizationSpec != null) { + if (typeof object.personalizationSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.personalizationSpec: object expected"); + message.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); + } return message; }; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @memberof google.cloud.retail.v2alpha.SearchRequest * @static - * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest + * @param {google.cloud.retail.v2alpha.SearchRequest} message SearchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProductRequest.toObject = function toObject(message, options) { + SearchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.GetProductRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetProductRequest; - })(); - - v2alpha.UpdateProductRequest = (function() { - - /** - * Properties of an UpdateProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing - */ - - /** - * Constructs a new UpdateProductRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set - */ - function UpdateProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.updateMask = null; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; + } + if (options.defaults) { + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.relevanceThreshold = options.enums === String ? "RELEVANCE_THRESHOLD_UNSPECIFIED" : 0; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; + object.personalizationSpec = null; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) + object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) + object.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + return object; + }; /** - * UpdateProductRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * Converts this SearchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest * @instance + * @returns {Object.} JSON object */ - UpdateProductRequest.prototype.allowMissing = false; - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance - */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); + SearchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); - return writer; - }; + SearchRequest.FacetSpec = (function() { - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return message; - }; - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; - /** - * Verifies an UpdateProductRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; - return null; - }; + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; - /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest - */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - return message; - }; + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @static - * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - return object; - }; + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; - /** - * Converts this UpdateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.UpdateProductRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; - return UpdateProductRequest; - })(); + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; - v2alpha.DeleteProductRequest = (function() { + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Properties of a DeleteProductRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name - */ + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + case 2: + message.limit = reader.int32(); + break; + case 3: + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + case 4: + message.enableDynamicPosition = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Constructs a new DeleteProductRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set - */ - function DeleteProductRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @instance - */ - DeleteProductRequest.prototype.name = ""; + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); + if (error) + return "facetKey." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance - */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); - }; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); } - } - return message; - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductRequest message. - * @function verify - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; - /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest - */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; + } + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; return object; - var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; + }; - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @static - * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this DeleteProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.DeleteProductRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + FacetSpec.FacetKey = (function() { - return DeleteProductRequest; - })(); + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + */ - v2alpha.ListProductsRequest = (function() { + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Properties of a ListProductsRequest. - * @memberof google.cloud.retail.v2alpha - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - * @property {string|null} [filter] ListProductsRequest filter - * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask - * @property {boolean|null} [requireTotalSize] ListProductsRequest requireTotalSize - */ - - /** - * Constructs a new ListProductsRequest. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest - * @constructor - * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set - */ - function ListProductsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; - /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageToken = ""; + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; - /** - * ListProductsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.filter = ""; + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; - /** - * ListProductsRequest readMask. - * @member {google.protobuf.IFieldMask|null|undefined} readMask - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.readMask = null; + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; - /** - * ListProductsRequest requireTotalSize. - * @member {boolean} requireTotalSize - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.requireTotalSize = false; + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @static - * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest instance - */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); - }; + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @static - * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) - $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.requireTotalSize != null && Object.hasOwnProperty.call(message, "requireTotalSize")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requireTotalSize); - return writer; - }; + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @static - * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2alpha.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + return writer; + }; - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.ListProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 6: - message.requireTotalSize = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + case 8: + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + case 9: + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + case 4: + message.orderBy = reader.string(); + break; + case 5: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + return null; + }; + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + return message; + }; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2alpha.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + return object; + }; + + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetKey; + })(); + + return FacetSpec; + })(); + + SearchRequest.DynamicFacetSpec = (function() { + + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ + + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); + + return DynamicFacetSpec; + })(); + + SearchRequest.BoostSpec = (function() { + + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + * @property {boolean|null} [skipBoostSpecValidation] BoostSpec skipBoostSpecValidation + */ + + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + + /** + * BoostSpec skipBoostSpecValidation. + * @member {boolean|null|undefined} skipBoostSpecValidation + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.skipBoostSpecValidation = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BoostSpec _skipBoostSpecValidation. + * @member {"skipBoostSpecValidation"|undefined} _skipBoostSpecValidation + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @instance + */ + Object.defineProperty(BoostSpec.prototype, "_skipBoostSpecValidation", { + get: $util.oneOfGetter($oneOfFields = ["skipBoostSpecValidation"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; + + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.skipBoostSpecValidation != null && Object.hasOwnProperty.call(message, "skipBoostSpecValidation")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.skipBoostSpecValidation); + return writer; + }; + + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + case 2: + message.skipBoostSpecValidation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + properties._skipBoostSpecValidation = 1; + if (typeof message.skipBoostSpecValidation !== "boolean") + return "skipBoostSpecValidation: boolean expected"; + } + return null; + }; + + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + if (object.skipBoostSpecValidation != null) + message.skipBoostSpecValidation = Boolean(object.skipBoostSpecValidation); + return message; + }; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + object.skipBoostSpecValidation = message.skipBoostSpecValidation; + if (options.oneofs) + object._skipBoostSpecValidation = "skipBoostSpecValidation"; + } + return object; + }; + + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + BoostSpec.ConditionBoostSpec = (function() { + + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ + + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; + + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; + + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; + + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConditionBoostSpec; + })(); + + return BoostSpec; + })(); + + SearchRequest.QueryExpansionSpec = (function() { + + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults + */ + + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; + + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; + + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; + + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); + return writer; + }; + + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.int32(); + break; + case 2: + message.pinUnexpandedResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; + break; + } + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; + return object; + }; + + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Condition enum. + * @name google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); + + return QueryExpansionSpec; + })(); + + SearchRequest.PersonalizationSpec = (function() { + + /** + * Properties of a PersonalizationSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface IPersonalizationSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode|null} [mode] PersonalizationSpec mode + */ + + /** + * Constructs a new PersonalizationSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a PersonalizationSpec. + * @implements IPersonalizationSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + */ + function PersonalizationSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PersonalizationSpec mode. + * @member {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode} mode + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @instance + */ + PersonalizationSpec.prototype.mode = 0; + + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} PersonalizationSpec instance + */ + PersonalizationSpec.create = function create(properties) { + return new PersonalizationSpec(properties); + }; + + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PersonalizationSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersonalizationSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} PersonalizationSpec + */ + PersonalizationSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "AUTO": + case 1: + message.mode = 1; + break; + case "DISABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} message PersonalizationSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersonalizationSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this PersonalizationSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @instance + * @returns {Object.} JSON object + */ + PersonalizationSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} AUTO=1 AUTO value + * @property {number} DISABLED=2 DISABLED value + */ + PersonalizationSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); + + return PersonalizationSpec; + })(); + + /** + * RelevanceThreshold enum. + * @name google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold + * @enum {number} + * @property {number} RELEVANCE_THRESHOLD_UNSPECIFIED=0 RELEVANCE_THRESHOLD_UNSPECIFIED value + * @property {number} HIGH=1 HIGH value + * @property {number} MEDIUM=2 MEDIUM value + * @property {number} LOW=3 LOW value + * @property {number} LOWEST=4 LOWEST value + */ + SearchRequest.RelevanceThreshold = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RELEVANCE_THRESHOLD_UNSPECIFIED"] = 0; + values[valuesById[1] = "HIGH"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + values[valuesById[3] = "LOW"] = 3; + values[valuesById[4] = "LOWEST"] = 4; + return values; + })(); + + /** + * SearchMode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + */ + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); + + return SearchRequest; + })(); + + v2alpha.SearchResponse = (function() { + + /** + * Properties of a SearchResponse. + * @memberof google.cloud.retail.v2alpha + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * @property {Array.|null} [invalidConditionBoostSpecs] SearchResponse invalidConditionBoostSpecs + */ + + /** + * Constructs a new SearchResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse + * @constructor + * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + */ + function SearchResponse(properties) { + this.results = []; + this.facets = []; + this.appliedControls = []; + this.invalidConditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.results = $util.emptyArray; + + /** + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.facets = $util.emptyArray; + + /** + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.totalSize = 0; + + /** + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.correctedQuery = ""; + + /** + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.attributionToken = ""; + + /** + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.nextPageToken = ""; + + /** + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.queryExpansionInfo = null; + + /** + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.redirectUri = ""; + + /** + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.appliedControls = $util.emptyArray; + + /** + * SearchResponse invalidConditionBoostSpecs. + * @member {Array.} invalidConditionBoostSpecs + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + */ + SearchResponse.prototype.invalidConditionBoostSpecs = $util.emptyArray; + + /** + * Creates a new SearchResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse instance + */ + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); + }; + + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + if (message.invalidConditionBoostSpecs != null && message.invalidConditionBoostSpecs.length) + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.invalidConditionBoostSpecs[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + case 3: + message.totalSize = reader.int32(); + break; + case 4: + message.correctedQuery = reader.string(); + break; + case 5: + message.attributionToken = reader.string(); + break; + case 6: + message.nextPageToken = reader.string(); + break; + case 7: + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + case 10: + message.redirectUri = reader.string(); + break; + case 12: + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; + case 14: + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.verify(message.facets[i]); + if (error) + return "facets." + error; + } + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (error) + return "queryExpansionInfo." + error; + } + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; + } + if (message.invalidConditionBoostSpecs != null && message.hasOwnProperty("invalidConditionBoostSpecs")) { + if (!Array.isArray(message.invalidConditionBoostSpecs)) + return "invalidConditionBoostSpecs: array expected"; + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.invalidConditionBoostSpecs[i]); + if (error) + return "invalidConditionBoostSpecs." + error; + } + } + return null; + }; + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + */ + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.fromObject(object.results[i]); + } + } + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.fromObject(object.facets[i]); + } + } + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); + } + if (object.invalidConditionBoostSpecs) { + if (!Array.isArray(object.invalidConditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.invalidConditionBoostSpecs: array expected"); + message.invalidConditionBoostSpecs = []; + for (var i = 0; i < object.invalidConditionBoostSpecs.length; ++i) { + if (typeof object.invalidConditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.invalidConditionBoostSpecs: object expected"); + message.invalidConditionBoostSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.invalidConditionBoostSpecs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse} message SearchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + object.appliedControls = []; + object.invalidConditionBoostSpecs = []; + } + if (options.defaults) { + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; + } + if (message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length) { + object.invalidConditionBoostSpecs = []; + for (var j = 0; j < message.invalidConditionBoostSpecs.length; ++j) + object.invalidConditionBoostSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.invalidConditionBoostSpecs[j], options); + } + return object; + }; + + /** + * Converts this SearchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @instance + * @returns {Object.} JSON object + */ + SearchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SearchResponse.SearchResult = (function() { + + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + */ + + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; + + /** + * SearchResult product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; + + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; + + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; + + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; + + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.matchingVariantCount = reader.int32(); + break; + case 4: + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + case 5: + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + return null; + }; + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } + } + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; + } + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } + return object; + }; + + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SearchResult; + })(); + + SearchResponse.Facet = (function() { + + /** + * Properties of a Facet. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet + */ + + /** + * Constructs a new Facet. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set + */ + function Facet(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.key = ""; + + /** + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.values = $util.emptyArray; + + /** + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + */ + Facet.prototype.dynamicFacet = false; + + /** + * Creates a new Facet instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet instance + */ + Facet.create = function create(properties) { + return new Facet(properties); + }; + + /** + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); + return writer; + }; + + /** + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Facet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Facet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + case 3: + message.dynamicFacet = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Facet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Facet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Facet message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Facet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; + return null; + }; + + /** + * Creates a Facet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet + */ + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } + } + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); + return message; + }; + + /** + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet} message Facet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Facet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) { + object.key = ""; + object.dynamicFacet = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); + } + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; + return object; + }; + + /** + * Converts this Facet to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @instance + * @returns {Object.} JSON object + */ + Facet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Facet.FacetValue = (function() { + + /** + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2alpha.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + */ + + /** + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + */ + function FacetValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.value = null; + + /** + * FacetValue interval. + * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.interval = null; + + /** + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FacetValue instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue instance + */ + FacetValue.create = function create(properties) { + return new FacetValue(properties); + }; + + /** + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2alpha.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + return writer; + }; + + /** + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + case 3: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetValue message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.interval); + if (error) + return "interval." + error; + } + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; + + /** + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue + */ + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.interval); + } + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} message FacetValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2alpha.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; + + /** + * Converts this FacetValue to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + * @returns {Object.} JSON object + */ + FacetValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FacetValue; + })(); + + return Facet; + })(); + + SearchResponse.QueryExpansionInfo = (function() { + + /** + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount + */ + + /** + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo + * @constructor + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + */ + function QueryExpansionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.expandedQuery = false; + + /** + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance + */ + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); + }; + + /** + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); + return writer; + }; + + /** + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expandedQuery = reader.bool(); + break; + case 2: + message.pinnedResultCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionInfo message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo + */ + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + return object; + }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryExpansionInfo; + })(); + + return SearchResponse; + })(); + + v2alpha.ControlService = (function() { + + /** + * Constructs a new ControlService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ControlService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ControlService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ControlService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ControlService; + + /** + * Creates new ControlService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ControlService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ControlService} RPC service. Useful where requests and/or responses are streamed. + */ + ControlService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#createControl}. + * @memberof google.cloud.retail.v2alpha.ControlService + * @typedef CreateControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Control} [response] Control + */ + + /** + * Calls CreateControl. + * @function createControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateControlRequest} request CreateControlRequest message or plain object + * @param {google.cloud.retail.v2alpha.ControlService.CreateControlCallback} callback Node-style callback called with the error, if any, and Control + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.createControl = function createControl(request, callback) { + return this.rpcCall(createControl, $root.google.cloud.retail.v2alpha.CreateControlRequest, $root.google.cloud.retail.v2alpha.Control, request, callback); + }, "name", { value: "CreateControl" }); + + /** + * Calls CreateControl. + * @function createControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateControlRequest} request CreateControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#deleteControl}. + * @memberof google.cloud.retail.v2alpha.ControlService + * @typedef DeleteControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteControl. + * @function deleteControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteControlRequest} request DeleteControlRequest message or plain object + * @param {google.cloud.retail.v2alpha.ControlService.DeleteControlCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.deleteControl = function deleteControl(request, callback) { + return this.rpcCall(deleteControl, $root.google.cloud.retail.v2alpha.DeleteControlRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteControl" }); + + /** + * Calls DeleteControl. + * @function deleteControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteControlRequest} request DeleteControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#updateControl}. + * @memberof google.cloud.retail.v2alpha.ControlService + * @typedef UpdateControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Control} [response] Control + */ + + /** + * Calls UpdateControl. + * @function updateControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateControlRequest} request UpdateControlRequest message or plain object + * @param {google.cloud.retail.v2alpha.ControlService.UpdateControlCallback} callback Node-style callback called with the error, if any, and Control + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.updateControl = function updateControl(request, callback) { + return this.rpcCall(updateControl, $root.google.cloud.retail.v2alpha.UpdateControlRequest, $root.google.cloud.retail.v2alpha.Control, request, callback); + }, "name", { value: "UpdateControl" }); + + /** + * Calls UpdateControl. + * @function updateControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateControlRequest} request UpdateControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#getControl}. + * @memberof google.cloud.retail.v2alpha.ControlService + * @typedef GetControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Control} [response] Control + */ + + /** + * Calls GetControl. + * @function getControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IGetControlRequest} request GetControlRequest message or plain object + * @param {google.cloud.retail.v2alpha.ControlService.GetControlCallback} callback Node-style callback called with the error, if any, and Control + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.getControl = function getControl(request, callback) { + return this.rpcCall(getControl, $root.google.cloud.retail.v2alpha.GetControlRequest, $root.google.cloud.retail.v2alpha.Control, request, callback); + }, "name", { value: "GetControl" }); + + /** + * Calls GetControl. + * @function getControl + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IGetControlRequest} request GetControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#listControls}. + * @memberof google.cloud.retail.v2alpha.ControlService + * @typedef ListControlsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListControlsResponse} [response] ListControlsResponse + */ + + /** + * Calls ListControls. + * @function listControls + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IListControlsRequest} request ListControlsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ControlService.ListControlsCallback} callback Node-style callback called with the error, if any, and ListControlsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.listControls = function listControls(request, callback) { + return this.rpcCall(listControls, $root.google.cloud.retail.v2alpha.ListControlsRequest, $root.google.cloud.retail.v2alpha.ListControlsResponse, request, callback); + }, "name", { value: "ListControls" }); + + /** + * Calls ListControls. + * @function listControls + * @memberof google.cloud.retail.v2alpha.ControlService + * @instance + * @param {google.cloud.retail.v2alpha.IListControlsRequest} request ListControlsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ControlService; + })(); + + v2alpha.CreateControlRequest = (function() { + + /** + * Properties of a CreateControlRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICreateControlRequest + * @property {string|null} [parent] CreateControlRequest parent + * @property {google.cloud.retail.v2alpha.IControl|null} [control] CreateControlRequest control + * @property {string|null} [controlId] CreateControlRequest controlId + */ + + /** + * Constructs a new CreateControlRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CreateControlRequest. + * @implements ICreateControlRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICreateControlRequest=} [properties] Properties to set + */ + function CreateControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateControlRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @instance + */ + CreateControlRequest.prototype.parent = ""; + + /** + * CreateControlRequest control. + * @member {google.cloud.retail.v2alpha.IControl|null|undefined} control + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @instance + */ + CreateControlRequest.prototype.control = null; + + /** + * CreateControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @instance + */ + CreateControlRequest.prototype.controlId = ""; + + /** + * Creates a new CreateControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateControlRequest} CreateControlRequest instance + */ + CreateControlRequest.create = function create(properties) { + return new CreateControlRequest(properties); + }; + + /** + * Encodes the specified CreateControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateControlRequest} message CreateControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.control != null && Object.hasOwnProperty.call(message, "control")) + $root.google.cloud.retail.v2alpha.Control.encode(message.control, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.controlId); + return writer; + }; + + /** + * Encodes the specified CreateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateControlRequest} message CreateControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CreateControlRequest} CreateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.control = $root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32()); + break; + case 3: + message.controlId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CreateControlRequest} CreateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.control != null && message.hasOwnProperty("control")) { + var error = $root.google.cloud.retail.v2alpha.Control.verify(message.control); + if (error) + return "control." + error; + } + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; + + /** + * Creates a CreateControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CreateControlRequest} CreateControlRequest + */ + CreateControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateControlRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CreateControlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.control != null) { + if (typeof object.control !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateControlRequest.control: object expected"); + message.control = $root.google.cloud.retail.v2alpha.Control.fromObject(object.control); + } + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; + + /** + * Creates a plain object from a CreateControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.CreateControlRequest} message CreateControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.control = null; + object.controlId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.control != null && message.hasOwnProperty("control")) + object.control = $root.google.cloud.retail.v2alpha.Control.toObject(message.control, options); + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; + + /** + * Converts this CreateControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @instance + * @returns {Object.} JSON object + */ + CreateControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateControlRequest; + })(); + + v2alpha.UpdateControlRequest = (function() { + + /** + * Properties of an UpdateControlRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateControlRequest + * @property {google.cloud.retail.v2alpha.IControl|null} [control] UpdateControlRequest control + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateControlRequest updateMask + */ + + /** + * Constructs a new UpdateControlRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateControlRequest. + * @implements IUpdateControlRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateControlRequest=} [properties] Properties to set + */ + function UpdateControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateControlRequest control. + * @member {google.cloud.retail.v2alpha.IControl|null|undefined} control + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @instance + */ + UpdateControlRequest.prototype.control = null; + + /** + * UpdateControlRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @instance + */ + UpdateControlRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateControlRequest} UpdateControlRequest instance + */ + UpdateControlRequest.create = function create(properties) { + return new UpdateControlRequest(properties); + }; + + /** + * Encodes the specified UpdateControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateControlRequest} message UpdateControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.control != null && Object.hasOwnProperty.call(message, "control")) + $root.google.cloud.retail.v2alpha.Control.encode(message.control, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateControlRequest} message UpdateControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UpdateControlRequest} UpdateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.control = $root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UpdateControlRequest} UpdateControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.control != null && message.hasOwnProperty("control")) { + var error = $root.google.cloud.retail.v2alpha.Control.verify(message.control); + if (error) + return "control." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UpdateControlRequest} UpdateControlRequest + */ + UpdateControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateControlRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.UpdateControlRequest(); + if (object.control != null) { + if (typeof object.control !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateControlRequest.control: object expected"); + message.control = $root.google.cloud.retail.v2alpha.Control.fromObject(object.control); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateControlRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {google.cloud.retail.v2alpha.UpdateControlRequest} message UpdateControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.control = null; + object.updateMask = null; + } + if (message.control != null && message.hasOwnProperty("control")) + object.control = $root.google.cloud.retail.v2alpha.Control.toObject(message.control, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateControlRequest; + })(); + + v2alpha.DeleteControlRequest = (function() { + + /** + * Properties of a DeleteControlRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IDeleteControlRequest + * @property {string|null} [name] DeleteControlRequest name + */ + + /** + * Constructs a new DeleteControlRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a DeleteControlRequest. + * @implements IDeleteControlRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IDeleteControlRequest=} [properties] Properties to set + */ + function DeleteControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteControlRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @instance + */ + DeleteControlRequest.prototype.name = ""; + + /** + * Creates a new DeleteControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteControlRequest} DeleteControlRequest instance + */ + DeleteControlRequest.create = function create(properties) { + return new DeleteControlRequest(properties); + }; + + /** + * Encodes the specified DeleteControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteControlRequest} message DeleteControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteControlRequest} message DeleteControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.DeleteControlRequest} DeleteControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.DeleteControlRequest} DeleteControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.DeleteControlRequest} DeleteControlRequest + */ + DeleteControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteControlRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.DeleteControlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {google.cloud.retail.v2alpha.DeleteControlRequest} message DeleteControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteControlRequest; + })(); + + v2alpha.GetControlRequest = (function() { + + /** + * Properties of a GetControlRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetControlRequest + * @property {string|null} [name] GetControlRequest name + */ + + /** + * Constructs a new GetControlRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetControlRequest. + * @implements IGetControlRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IGetControlRequest=} [properties] Properties to set + */ + function GetControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetControlRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @instance + */ + GetControlRequest.prototype.name = ""; + + /** + * Creates a new GetControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetControlRequest} GetControlRequest instance + */ + GetControlRequest.create = function create(properties) { + return new GetControlRequest(properties); + }; + + /** + * Encodes the specified GetControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetControlRequest} message GetControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetControlRequest} message GetControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetControlRequest} GetControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetControlRequest} GetControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetControlRequest} GetControlRequest + */ + GetControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetControlRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.GetControlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {google.cloud.retail.v2alpha.GetControlRequest} message GetControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @instance + * @returns {Object.} JSON object + */ + GetControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetControlRequest; + })(); + + v2alpha.ListControlsRequest = (function() { + + /** + * Properties of a ListControlsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListControlsRequest + * @property {string|null} [parent] ListControlsRequest parent + * @property {number|null} [pageSize] ListControlsRequest pageSize + * @property {string|null} [pageToken] ListControlsRequest pageToken + * @property {string|null} [filter] ListControlsRequest filter + */ + + /** + * Constructs a new ListControlsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListControlsRequest. + * @implements IListControlsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IListControlsRequest=} [properties] Properties to set + */ + function ListControlsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListControlsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.parent = ""; + + /** + * ListControlsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.pageSize = 0; + + /** + * ListControlsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.pageToken = ""; + + /** + * ListControlsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.filter = ""; + + /** + * Creates a new ListControlsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListControlsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListControlsRequest} ListControlsRequest instance + */ + ListControlsRequest.create = function create(properties) { + return new ListControlsRequest(properties); + }; + + /** + * Encodes the specified ListControlsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListControlsRequest} message ListControlsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListControlsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListControlsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListControlsRequest} message ListControlsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListControlsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListControlsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListControlsRequest} ListControlsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListControlsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListControlsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListControlsRequest} ListControlsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListControlsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListControlsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListControlsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListControlsRequest} ListControlsRequest + */ + ListControlsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListControlsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListControlsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListControlsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {google.cloud.retail.v2alpha.ListControlsRequest} message ListControlsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListControlsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListControlsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @instance + * @returns {Object.} JSON object + */ + ListControlsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListControlsRequest; + })(); + + v2alpha.ListControlsResponse = (function() { + + /** + * Properties of a ListControlsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IListControlsResponse + * @property {Array.|null} [controls] ListControlsResponse controls + * @property {string|null} [nextPageToken] ListControlsResponse nextPageToken + */ + + /** + * Constructs a new ListControlsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListControlsResponse. + * @implements IListControlsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IListControlsResponse=} [properties] Properties to set + */ + function ListControlsResponse(properties) { + this.controls = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListControlsResponse controls. + * @member {Array.} controls + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @instance + */ + ListControlsResponse.prototype.controls = $util.emptyArray; + + /** + * ListControlsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @instance + */ + ListControlsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListControlsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListControlsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListControlsResponse} ListControlsResponse instance + */ + ListControlsResponse.create = function create(properties) { + return new ListControlsResponse(properties); + }; + + /** + * Encodes the specified ListControlsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListControlsResponse} message ListControlsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListControlsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.controls != null && message.controls.length) + for (var i = 0; i < message.controls.length; ++i) + $root.google.cloud.retail.v2alpha.Control.encode(message.controls[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListControlsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListControlsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListControlsResponse} message ListControlsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListControlsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListControlsResponse} ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListControlsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.controls && message.controls.length)) + message.controls = []; + message.controls.push($root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListControlsResponse} ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListControlsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListControlsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.controls != null && message.hasOwnProperty("controls")) { + if (!Array.isArray(message.controls)) + return "controls: array expected"; + for (var i = 0; i < message.controls.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Control.verify(message.controls[i]); + if (error) + return "controls." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListControlsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListControlsResponse} ListControlsResponse + */ + ListControlsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListControlsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListControlsResponse(); + if (object.controls) { + if (!Array.isArray(object.controls)) + throw TypeError(".google.cloud.retail.v2alpha.ListControlsResponse.controls: array expected"); + message.controls = []; + for (var i = 0; i < object.controls.length; ++i) { + if (typeof object.controls[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListControlsResponse.controls: object expected"); + message.controls[i] = $root.google.cloud.retail.v2alpha.Control.fromObject(object.controls[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListControlsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {google.cloud.retail.v2alpha.ListControlsResponse} message ListControlsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListControlsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.controls = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.controls && message.controls.length) { + object.controls = []; + for (var j = 0; j < message.controls.length; ++j) + object.controls[j] = $root.google.cloud.retail.v2alpha.Control.toObject(message.controls[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListControlsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @instance + * @returns {Object.} JSON object + */ + ListControlsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListControlsResponse; + })(); + + v2alpha.ExportErrorsConfig = (function() { + + /** + * Properties of an ExportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IExportErrorsConfig + * @property {string|null} [gcsPrefix] ExportErrorsConfig gcsPrefix + */ + + /** + * Constructs a new ExportErrorsConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportErrorsConfig. + * @implements IExportErrorsConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set + */ + function ExportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @instance + */ + ExportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @instance + */ + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance + */ + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); + }; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + */ + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ExportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportErrorsConfig; + })(); + + v2alpha.ExportMetadata = (function() { + + /** + * Properties of an ExportMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + */ + + /** + * Constructs a new ExportMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + */ + function ExportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @instance + */ + ExportMetadata.prototype.createTime = null; + + /** + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @instance + */ + ExportMetadata.prototype.updateTime = null; + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance + */ + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); + }; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + */ + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this ExportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportMetadata; + })(); + + v2alpha.ExportProductsResponse = (function() { + + /** + * Properties of an ExportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IExportProductsResponse + * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + */ + + /** + * Constructs a new ExportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportProductsResponse. + * @implements IExportProductsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + */ + function ExportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ExportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance + */ + ExportProductsResponse.create = function create(properties) { + return new ExportProductsResponse(properties); + }; + + /** + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + */ + ExportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ExportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportProductsResponse; + })(); + + v2alpha.ExportUserEventsResponse = (function() { + + /** + * Properties of an ExportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IExportUserEventsResponse + * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + */ + + /** + * Constructs a new ExportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportUserEventsResponse. + * @implements IExportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + */ + function ExportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorsConfig = null; + + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance + */ + ExportUserEventsResponse.create = function create(properties) { + return new ExportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + return null; + }; + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + */ + ExportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + } + return message; + }; + + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) + object.errorsConfig = null; + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + return object; + }; + + /** + * Converts this ExportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportUserEventsResponse; + })(); + + v2alpha.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * @memberof google.cloud.retail.v2alpha.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService + * @instance + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2alpha.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2alpha.PredictRequest, $root.google.cloud.retail.v2alpha.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2alpha.PredictionService + * @instance + * @param {google.cloud.retail.v2alpha.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2alpha.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2alpha.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2alpha.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2alpha.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.placement = reader.string(); + break; + case 2: + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + case 5: + message.filter = reader.string(); + break; + case 6: + message.validateOnly = reader.bool(); + break; + case 7: + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2alpha.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictRequest} PredictRequest + */ + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {google.cloud.retail.v2alpha.PredictRequest} message PredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this PredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @instance + * @returns {Object.} JSON object + */ + PredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictRequest; + })(); + + v2alpha.PredictResponse = (function() { + + /** + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly + */ + + /** + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.results = $util.emptyArray; + + /** + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse instance + */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + case 2: + message.attributionToken = reader.string(); + break; + case 3: + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictResponse} PredictResponse + */ + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this PredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @instance + * @returns {Object.} JSON object + */ + PredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2alpha.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2alpha.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + + /** + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + */ + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2alpha.CreateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "CreateProduct" }); + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2alpha.GetProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "GetProduct" }); + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListProductsResponse} [response] ListProductsResponse + */ + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2alpha.ListProductsRequest, $root.google.cloud.retail.v2alpha.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2alpha.UpdateProductRequest, $root.google.cloud.retail.v2alpha.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2alpha.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#purgeProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef PurgeProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls PurgeProducts. + * @function purgeProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeProductsRequest} request PurgeProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.PurgeProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.purgeProducts = function purgeProducts(request, callback) { + return this.rpcCall(purgeProducts, $root.google.cloud.retail.v2alpha.PurgeProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "PurgeProducts" }); + + /** + * Calls PurgeProducts. + * @function purgeProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IPurgeProductsRequest} request PurgeProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2alpha.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2alpha.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * @memberof google.cloud.retail.v2alpha.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2alpha.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2alpha.ProductService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; + })(); + + v2alpha.CreateProductRequest = (function() { + + /** + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId + */ + + /** + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + */ + function CreateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest instance + */ + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); + }; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + return writer; + }; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 3: + message.productId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CreateProductRequest} CreateProductRequest + */ + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.CreateProductRequest} message CreateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this CreateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProductRequest; + })(); + + v2alpha.GetProductRequest = (function() { + + /** + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name + */ + + /** + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest instance + */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetProductRequest} GetProductRequest + */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {google.cloud.retail.v2alpha.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @instance + * @returns {Object.} JSON object + */ + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProductRequest; + })(); + + v2alpha.UpdateProductRequest = (function() { + + /** + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing + */ + + /** + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProductRequest product. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.product = null; + + /** + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.updateMask = null; + + /** + * UpdateProductRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.allowMissing = false; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest instance + */ + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + return writer; + }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsRequest message. + * Verifies an UpdateProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsRequest.verify = function verify(message) { + UpdateProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.readMask != null && message.hasOwnProperty("readMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); if (error) - return "readMask." + error; + return "product." + error; } - if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) - if (typeof message.requireTotalSize !== "boolean") - return "requireTotalSize: boolean expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2alpha.UpdateProductRequest} UpdateProductRequest */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsRequest) + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateProductRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.readMask != null) { - if (typeof object.readMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ListProductsRequest.readMask: object expected"); - message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + var message = new $root.google.cloud.retail.v2alpha.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); } - if (object.requireTotalSize != null) - message.requireTotalSize = Boolean(object.requireTotalSize); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); return message; }; /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @static - * @param {google.cloud.retail.v2alpha.ListProductsRequest} message ListProductsRequest + * @param {google.cloud.retail.v2alpha.UpdateProductRequest} message UpdateProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsRequest.toObject = function toObject(message, options) { + UpdateProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.readMask = null; - object.requireTotalSize = false; + object.product = null; + object.updateMask = null; + object.allowMissing = false; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.readMask != null && message.hasOwnProperty("readMask")) - object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); - if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) - object.requireTotalSize = message.requireTotalSize; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; return object; }; /** - * Converts this ListProductsRequest to JSON. + * Converts this UpdateProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest * @instance * @returns {Object.} JSON object */ - ListProductsRequest.prototype.toJSON = function toJSON() { + UpdateProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProductsRequest; + return UpdateProductRequest; })(); - v2alpha.ListProductsResponse = (function() { + v2alpha.DeleteProductRequest = (function() { /** - * Properties of a ListProductsResponse. + * Properties of a DeleteProductRequest. * @memberof google.cloud.retail.v2alpha - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken - * @property {number|null} [totalSize] ListProductsResponse totalSize + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name */ /** - * Constructs a new ListProductsResponse. + * Constructs a new DeleteProductRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest * @constructor - * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set */ - function ListProductsResponse(properties) { - this.products = []; + function DeleteProductRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45157,104 +53871,75 @@ } /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.retail.v2alpha.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2alpha.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.nextPageToken = ""; - - /** - * ListProductsResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @instance */ - ListProductsResponse.prototype.totalSize = 0; + DeleteProductRequest.prototype.name = ""; /** - * Creates a new ListProductsResponse instance using the specified properties. + * Creates a new DeleteProductRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse instance + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest instance */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); }; /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encode = function encode(message, writer) { + DeleteProductRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteProductRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer. + * Decodes a DeleteProductRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decode = function decode(reader, length) { + DeleteProductRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - message.totalSize = reader.int32(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -45265,145 +53950,112 @@ }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsResponse message. + * Verifies a DeleteProductRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsResponse.verify = function verify(message) { + DeleteProductRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2alpha.DeleteProductRequest} DeleteProductRequest */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsResponse) + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteProductRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; + var message = new $root.google.cloud.retail.v2alpha.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @static - * @param {google.cloud.retail.v2alpha.ListProductsResponse} message ListProductsResponse + * @param {google.cloud.retail.v2alpha.DeleteProductRequest} message DeleteProductRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsResponse.toObject = function toObject(message, options) { + DeleteProductRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) { - object.nextPageToken = ""; - object.totalSize = 0; - } - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this ListProductsResponse to JSON. + * Converts this DeleteProductRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest * @instance * @returns {Object.} JSON object */ - ListProductsResponse.prototype.toJSON = function toJSON() { + DeleteProductRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListProductsResponse; + return DeleteProductRequest; })(); - v2alpha.SetInventoryRequest = (function() { + v2alpha.ListProductsRequest = (function() { /** - * Properties of a SetInventoryRequest. + * Properties of a ListProductsRequest. * @memberof google.cloud.retail.v2alpha - * @interface ISetInventoryRequest - * @property {google.cloud.retail.v2alpha.IProduct|null} [inventory] SetInventoryRequest inventory - * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask - * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime - * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + * @property {boolean|null} [requireTotalSize] ListProductsRequest requireTotalSize */ /** - * Constructs a new SetInventoryRequest. + * Constructs a new ListProductsRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetInventoryRequest. - * @implements ISetInventoryRequest + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest * @constructor - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set */ - function SetInventoryRequest(properties) { + function ListProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45411,114 +54063,140 @@ } /** - * SetInventoryRequest inventory. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} inventory - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * ListProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @instance */ - SetInventoryRequest.prototype.inventory = null; + ListProductsRequest.prototype.parent = ""; /** - * SetInventoryRequest setMask. - * @member {google.protobuf.IFieldMask|null|undefined} setMask - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * ListProductsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @instance */ - SetInventoryRequest.prototype.setMask = null; + ListProductsRequest.prototype.pageSize = 0; /** - * SetInventoryRequest setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * ListProductsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @instance */ - SetInventoryRequest.prototype.setTime = null; + ListProductsRequest.prototype.pageToken = ""; /** - * SetInventoryRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @instance */ - SetInventoryRequest.prototype.allowMissing = false; + ListProductsRequest.prototype.filter = ""; /** - * Creates a new SetInventoryRequest instance using the specified properties. + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * ListProductsRequest requireTotalSize. + * @member {boolean} requireTotalSize + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.requireTotalSize = false; + + /** + * Creates a new ListProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest instance + * @param {google.cloud.retail.v2alpha.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest instance */ - SetInventoryRequest.create = function create(properties) { - return new SetInventoryRequest(properties); + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); }; /** - * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encode = function encode(message, writer) { + ListProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) - $root.google.cloud.retail.v2alpha.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) - $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.requireTotalSize != null && Object.hasOwnProperty.call(message, "requireTotalSize")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.requireTotalSize); return writer; }; /** - * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsRequest} message ListProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer. + * Decodes a ListProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decode = function decode(reader, length) { + ListProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + message.parent = reader.string(); break; case 2: - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); break; case 3: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.pageToken = reader.string(); break; case 4: - message.allowMissing = reader.bool(); + message.filter = reader.string(); + break; + case 5: + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 6: + message.requireTotalSize = reader.bool(); break; default: reader.skipType(tag & 7); @@ -45529,146 +54207,156 @@ }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryRequest message. + * Verifies a ListProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryRequest.verify = function verify(message) { + ListProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inventory != null && message.hasOwnProperty("inventory")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.inventory); - if (error) - return "inventory." + error; - } - if (message.setMask != null && message.hasOwnProperty("setMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.setMask); - if (error) - return "setMask." + error; - } - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); if (error) - return "setTime." + error; + return "readMask." + error; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) + if (typeof message.requireTotalSize !== "boolean") + return "requireTotalSize: boolean expected"; return null; }; /** - * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2alpha.ListProductsRequest} ListProductsRequest */ - SetInventoryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryRequest) + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); - if (object.inventory != null) { - if (typeof object.inventory !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.inventory: object expected"); - message.inventory = $root.google.cloud.retail.v2alpha.Product.fromObject(object.inventory); - } - if (object.setMask != null) { - if (typeof object.setMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setMask: object expected"); - message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); - } - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + var message = new $root.google.cloud.retail.v2alpha.ListProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + if (object.requireTotalSize != null) + message.requireTotalSize = Boolean(object.requireTotalSize); return message; }; /** - * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @static - * @param {google.cloud.retail.v2alpha.SetInventoryRequest} message SetInventoryRequest + * @param {google.cloud.retail.v2alpha.ListProductsRequest} message ListProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryRequest.toObject = function toObject(message, options) { + ListProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.inventory = null; - object.setMask = null; - object.setTime = null; - object.allowMissing = false; + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.readMask = null; + object.requireTotalSize = false; } - if (message.inventory != null && message.hasOwnProperty("inventory")) - object.inventory = $root.google.cloud.retail.v2alpha.Product.toObject(message.inventory, options); - if (message.setMask != null && message.hasOwnProperty("setMask")) - object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); + if (message.requireTotalSize != null && message.hasOwnProperty("requireTotalSize")) + object.requireTotalSize = message.requireTotalSize; return object; }; /** - * Converts this SetInventoryRequest to JSON. + * Converts this ListProductsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @memberof google.cloud.retail.v2alpha.ListProductsRequest * @instance * @returns {Object.} JSON object */ - SetInventoryRequest.prototype.toJSON = function toJSON() { + ListProductsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryRequest; + return ListProductsRequest; })(); - v2alpha.SetInventoryMetadata = (function() { + v2alpha.ListProductsResponse = (function() { /** - * Properties of a SetInventoryMetadata. + * Properties of a ListProductsResponse. * @memberof google.cloud.retail.v2alpha - * @interface ISetInventoryMetadata + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + * @property {number|null} [totalSize] ListProductsResponse totalSize */ /** - * Constructs a new SetInventoryMetadata. + * Constructs a new ListProductsResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetInventoryMetadata. - * @implements ISetInventoryMetadata + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse * @constructor - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set */ - function SetInventoryMetadata(properties) { + function ListProductsResponse(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45676,63 +54364,105 @@ } /** - * Creates a new SetInventoryMetadata instance using the specified properties. + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.products = $util.emptyArray; + + /** + * ListProductsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.nextPageToken = ""; + + /** + * ListProductsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListProductsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata instance + * @param {google.cloud.retail.v2alpha.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse instance */ - SetInventoryMetadata.create = function create(properties) { - return new SetInventoryMetadata(properties); + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); }; /** - * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encode = function encode(message, writer) { + ListProductsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2alpha.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); return writer; }; /** - * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListProductsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IListProductsResponse} message ListProductsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * Decodes a ListProductsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decode = function decode(reader, length) { + ListProductsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + message.totalSize = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -45742,93 +54472,145 @@ }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryMetadata message. + * Verifies a ListProductsResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryMetadata.verify = function verify(message) { + ListProductsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; return null; }; /** - * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2alpha.ListProductsResponse} ListProductsResponse */ - SetInventoryMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryMetadata) + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListProductsResponse) return object; - return new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); + var message = new $root.google.cloud.retail.v2alpha.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2alpha.Product.fromObject(object.products[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; }; /** - * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @static - * @param {google.cloud.retail.v2alpha.SetInventoryMetadata} message SetInventoryMetadata + * @param {google.cloud.retail.v2alpha.ListProductsResponse} message ListProductsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryMetadata.toObject = function toObject() { - return {}; + ListProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2alpha.Product.toObject(message.products[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; }; /** - * Converts this SetInventoryMetadata to JSON. + * Converts this ListProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @memberof google.cloud.retail.v2alpha.ListProductsResponse * @instance * @returns {Object.} JSON object */ - SetInventoryMetadata.prototype.toJSON = function toJSON() { + ListProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryMetadata; + return ListProductsResponse; })(); - v2alpha.SetInventoryResponse = (function() { + v2alpha.SetInventoryRequest = (function() { /** - * Properties of a SetInventoryResponse. + * Properties of a SetInventoryRequest. * @memberof google.cloud.retail.v2alpha - * @interface ISetInventoryResponse + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2alpha.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing */ /** - * Constructs a new SetInventoryResponse. + * Constructs a new SetInventoryRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SetInventoryResponse. - * @implements ISetInventoryResponse + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest * @constructor - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set */ - function SetInventoryResponse(properties) { + function SetInventoryRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45836,63 +54618,115 @@ } /** - * Creates a new SetInventoryResponse instance using the specified properties. + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.inventory = null; + + /** + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setMask = null; + + /** + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse instance + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest instance */ - SetInventoryResponse.create = function create(properties) { - return new SetInventoryResponse(properties); + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); }; /** - * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryResponse.encode = function encode(message, writer) { + SetInventoryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2alpha.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); return writer; }; /** - * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer. + * Decodes a SetInventoryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryResponse.decode = function decode(reader, length) { + SetInventoryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + case 2: + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -45902,99 +54736,146 @@ }; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryResponse message. + * Verifies a SetInventoryRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryResponse.verify = function verify(message) { + SetInventoryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2alpha.Product.verify(message.inventory); + if (error) + return "inventory." + error; + } + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); + if (error) + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2alpha.SetInventoryRequest} SetInventoryRequest */ - SetInventoryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryResponse) + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryRequest) return object; - return new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); + var message = new $root.google.cloud.retail.v2alpha.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2alpha.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @static - * @param {google.cloud.retail.v2alpha.SetInventoryResponse} message SetInventoryResponse + * @param {google.cloud.retail.v2alpha.SetInventoryRequest} message SetInventoryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object - */ - SetInventoryResponse.toObject = function toObject() { - return {}; + */ + SetInventoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2alpha.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; }; /** - * Converts this SetInventoryResponse to JSON. + * Converts this SetInventoryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest * @instance * @returns {Object.} JSON object */ - SetInventoryResponse.prototype.toJSON = function toJSON() { + SetInventoryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SetInventoryResponse; + return SetInventoryRequest; })(); - v2alpha.AddFulfillmentPlacesRequest = (function() { + v2alpha.SetInventoryMetadata = (function() { /** - * Properties of an AddFulfillmentPlacesRequest. + * Properties of a SetInventoryMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IAddFulfillmentPlacesRequest - * @property {string|null} [product] AddFulfillmentPlacesRequest product - * @property {string|null} [type] AddFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime - * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + * @interface ISetInventoryMetadata */ /** - * Constructs a new AddFulfillmentPlacesRequest. + * Constructs a new SetInventoryMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddFulfillmentPlacesRequest. - * @implements IAddFulfillmentPlacesRequest + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set */ - function AddFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function SetInventoryMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46002,131 +54883,63 @@ } /** - * AddFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.product = ""; - - /** - * AddFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.type = ""; - - /** - * AddFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; - - /** - * AddFulfillmentPlacesRequest addTime. - * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.addTime = null; - - /** - * AddFulfillmentPlacesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.allowMissing = false; - - /** - * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * Creates a new SetInventoryMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata instance */ - AddFulfillmentPlacesRequest.create = function create(properties) { - return new AddFulfillmentPlacesRequest(properties); + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); }; /** - * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + SetInventoryMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a SetInventoryMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + SetInventoryMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -46136,157 +54949,93 @@ }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesRequest message. + * Verifies a SetInventoryMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesRequest.verify = function verify(message) { + SetInventoryMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.addTime); - if (error) - return "addTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.SetInventoryMetadata} SetInventoryMetadata */ - AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest) + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.addTime != null) { - if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.addTime: object expected"); - message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - return message; + return new $root.google.cloud.retail.v2alpha.SetInventoryMetadata(); }; /** - * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @static - * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {google.cloud.retail.v2alpha.SetInventoryMetadata} message SetInventoryMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) { - object.product = ""; - object.type = ""; - object.addTime = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) - object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - return object; + * @returns {Object.} Plain object + */ + SetInventoryMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this AddFulfillmentPlacesRequest to JSON. + * Converts this SetInventoryMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + SetInventoryMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesRequest; + return SetInventoryMetadata; })(); - v2alpha.AddFulfillmentPlacesMetadata = (function() { + v2alpha.SetInventoryResponse = (function() { /** - * Properties of an AddFulfillmentPlacesMetadata. + * Properties of a SetInventoryResponse. * @memberof google.cloud.retail.v2alpha - * @interface IAddFulfillmentPlacesMetadata + * @interface ISetInventoryResponse */ /** - * Constructs a new AddFulfillmentPlacesMetadata. + * Constructs a new SetInventoryResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddFulfillmentPlacesMetadata. - * @implements IAddFulfillmentPlacesMetadata + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse * @constructor - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set */ - function AddFulfillmentPlacesMetadata(properties) { + function SetInventoryResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46294,60 +55043,60 @@ } /** - * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new SetInventoryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse instance */ - AddFulfillmentPlacesMetadata.create = function create(properties) { - return new AddFulfillmentPlacesMetadata(properties); + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); }; /** - * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { + SetInventoryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SetInventoryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a SetInventoryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { + SetInventoryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -46360,93 +55109,99 @@ }; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesMetadata message. + * Verifies a SetInventoryResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesMetadata.verify = function verify(message) { + SetInventoryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.SetInventoryResponse} SetInventoryResponse */ - AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata) + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SetInventoryResponse) return object; - return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); + return new $root.google.cloud.retail.v2alpha.SetInventoryResponse(); }; /** - * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @static - * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2alpha.SetInventoryResponse} message SetInventoryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesMetadata.toObject = function toObject() { + SetInventoryResponse.toObject = function toObject() { return {}; }; /** - * Converts this AddFulfillmentPlacesMetadata to JSON. + * Converts this SetInventoryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + SetInventoryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesMetadata; + return SetInventoryResponse; })(); - v2alpha.AddFulfillmentPlacesResponse = (function() { + v2alpha.AddFulfillmentPlacesRequest = (function() { /** - * Properties of an AddFulfillmentPlacesResponse. + * Properties of an AddFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @interface IAddFulfillmentPlacesResponse + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new AddFulfillmentPlacesResponse. + * Constructs a new AddFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddFulfillmentPlacesResponse. - * @implements IAddFulfillmentPlacesResponse + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set */ - function AddFulfillmentPlacesResponse(properties) { + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46454,63 +55209,131 @@ } /** - * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.product = ""; + + /** + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.type = ""; + + /** + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.addTime = null; + + /** + * AddFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance */ - AddFulfillmentPlacesResponse.create = function create(properties) { - return new AddFulfillmentPlacesResponse(properties); + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -46520,99 +55343,157 @@ }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesResponse message. + * Verifies an AddFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesResponse.verify = function verify(message) { + AddFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest */ - AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse) + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest) return object; - return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); + var message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesResponse.toObject = function toObject() { - return {}; + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; }; /** - * Converts this AddFulfillmentPlacesResponse to JSON. + * Converts this AddFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddFulfillmentPlacesResponse; + return AddFulfillmentPlacesRequest; })(); - v2alpha.AddLocalInventoriesRequest = (function() { + v2alpha.AddFulfillmentPlacesMetadata = (function() { /** - * Properties of an AddLocalInventoriesRequest. + * Properties of an AddFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IAddLocalInventoriesRequest - * @property {string|null} [product] AddLocalInventoriesRequest product - * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories - * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask - * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime - * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing + * @interface IAddFulfillmentPlacesMetadata */ /** - * Constructs a new AddLocalInventoriesRequest. + * Constructs a new AddFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddLocalInventoriesRequest. - * @implements IAddLocalInventoriesRequest + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set */ - function AddLocalInventoriesRequest(properties) { - this.localInventories = []; + function AddFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46620,131 +55501,63 @@ } /** - * AddLocalInventoriesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @instance - */ - AddLocalInventoriesRequest.prototype.product = ""; - - /** - * AddLocalInventoriesRequest localInventories. - * @member {Array.} localInventories - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @instance - */ - AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; - - /** - * AddLocalInventoriesRequest addMask. - * @member {google.protobuf.IFieldMask|null|undefined} addMask - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @instance - */ - AddLocalInventoriesRequest.prototype.addMask = null; - - /** - * AddLocalInventoriesRequest addTime. - * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @instance - */ - AddLocalInventoriesRequest.prototype.addTime = null; - - /** - * AddLocalInventoriesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest - * @instance - */ - AddLocalInventoriesRequest.prototype.allowMissing = false; - - /** - * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance */ - AddLocalInventoriesRequest.create = function create(properties) { - return new AddLocalInventoriesRequest(properties); + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesRequest.encode = function encode(message, writer) { + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.localInventories != null && message.localInventories.length) - for (var i = 0; i < message.localInventories.length; ++i) - $root.google.cloud.retail.v2alpha.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) - $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); return writer; }; /** - * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesRequest.decode = function decode(reader, length) { + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.localInventories && message.localInventories.length)) - message.localInventories = []; - message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); - break; - case 4: - message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.allowMissing = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -46754,167 +55567,93 @@ }; /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesRequest message. + * Verifies an AddFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesRequest.verify = function verify(message) { + AddFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.localInventories != null && message.hasOwnProperty("localInventories")) { - if (!Array.isArray(message.localInventories)) - return "localInventories: array expected"; - for (var i = 0; i < message.localInventories.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.LocalInventory.verify(message.localInventories[i]); - if (error) - return "localInventories." + error; - } - } - if (message.addMask != null && message.hasOwnProperty("addMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.addMask); - if (error) - return "addMask." + error; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.addTime); - if (error) - return "addTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata */ - AddLocalInventoriesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest) + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.localInventories) { - if (!Array.isArray(object.localInventories)) - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: array expected"); - message.localInventories = []; - for (var i = 0; i < object.localInventories.length; ++i) { - if (typeof object.localInventories[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: object expected"); - message.localInventories[i] = $root.google.cloud.retail.v2alpha.LocalInventory.fromObject(object.localInventories[i]); - } - } - if (object.addMask != null) { - if (typeof object.addMask !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addMask: object expected"); - message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); - } - if (object.addTime != null) { - if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addTime: object expected"); - message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - return message; + return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} message AddLocalInventoriesRequest + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.localInventories = []; - if (options.defaults) { - object.product = ""; - object.addMask = null; - object.addTime = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.localInventories && message.localInventories.length) { - object.localInventories = []; - for (var j = 0; j < message.localInventories.length; ++j) - object.localInventories[j] = $root.google.cloud.retail.v2alpha.LocalInventory.toObject(message.localInventories[j], options); - } - if (message.addMask != null && message.hasOwnProperty("addMask")) - object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); - if (message.addTime != null && message.hasOwnProperty("addTime")) - object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - return object; + AddFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this AddLocalInventoriesRequest to JSON. + * Converts this AddFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddLocalInventoriesRequest; + return AddFulfillmentPlacesMetadata; })(); - v2alpha.AddLocalInventoriesMetadata = (function() { + v2alpha.AddFulfillmentPlacesResponse = (function() { /** - * Properties of an AddLocalInventoriesMetadata. + * Properties of an AddFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2alpha - * @interface IAddLocalInventoriesMetadata + * @interface IAddFulfillmentPlacesResponse */ /** - * Constructs a new AddLocalInventoriesMetadata. + * Constructs a new AddFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddLocalInventoriesMetadata. - * @implements IAddLocalInventoriesMetadata + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse * @constructor - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set */ - function AddLocalInventoriesMetadata(properties) { + function AddFulfillmentPlacesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46922,60 +55661,60 @@ } /** - * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance */ - AddLocalInventoriesMetadata.create = function create(properties) { - return new AddLocalInventoriesMetadata(properties); + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); }; /** - * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesMetadata.encode = function encode(message, writer) { + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesMetadata.decode = function decode(reader, length) { + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -46988,93 +55727,99 @@ }; /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesMetadata message. + * Verifies an AddFulfillmentPlacesResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesMetadata.verify = function verify(message) { + AddFulfillmentPlacesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse */ - AddLocalInventoriesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata) + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse) return object; - return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); + return new $root.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse(); }; /** - * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesMetadata.toObject = function toObject() { + AddFulfillmentPlacesResponse.toObject = function toObject() { return {}; }; /** - * Converts this AddLocalInventoriesMetadata to JSON. + * Converts this AddFulfillmentPlacesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddLocalInventoriesMetadata; + return AddFulfillmentPlacesResponse; })(); - v2alpha.AddLocalInventoriesResponse = (function() { + v2alpha.AddLocalInventoriesRequest = (function() { /** - * Properties of an AddLocalInventoriesResponse. + * Properties of an AddLocalInventoriesRequest. * @memberof google.cloud.retail.v2alpha - * @interface IAddLocalInventoriesResponse + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing */ /** - * Constructs a new AddLocalInventoriesResponse. + * Constructs a new AddLocalInventoriesRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an AddLocalInventoriesResponse. - * @implements IAddLocalInventoriesResponse + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest * @constructor - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set */ - function AddLocalInventoriesResponse(properties) { + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47082,63 +55827,131 @@ } /** - * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * AddLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.product = ""; + + /** + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; + + /** + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addMask = null; + + /** + * AddLocalInventoriesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addTime = null; + + /** + * AddLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance */ - AddLocalInventoriesResponse.create = function create(properties) { - return new AddLocalInventoriesResponse(properties); + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); }; /** - * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesResponse.encode = function encode(message, writer) { + AddLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2alpha.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); return writer; }; /** - * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesResponse.decode = function decode(reader, length) { + AddLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); + break; + case 4: + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 5: + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -47148,98 +55961,167 @@ }; /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesResponse message. + * Verifies an AddLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesResponse.verify = function verify(message) { + AddLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); + if (error) + return "addMask." + error; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} AddLocalInventoriesRequest */ - AddLocalInventoriesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse) + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest) return object; - return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); + var message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2alpha.LocalInventory.fromObject(object.localInventories[i]); + } + } + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.AddLocalInventoriesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} message AddLocalInventoriesResponse + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesRequest} message AddLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesResponse.toObject = function toObject() { - return {}; + AddLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.localInventories = []; + if (options.defaults) { + object.product = ""; + object.addMask = null; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2alpha.LocalInventory.toObject(message.localInventories[j], options); + } + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; }; /** - * Converts this AddLocalInventoriesResponse to JSON. + * Converts this AddLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AddLocalInventoriesResponse; + return AddLocalInventoriesRequest; })(); - v2alpha.RemoveLocalInventoriesRequest = (function() { + v2alpha.AddLocalInventoriesMetadata = (function() { /** - * Properties of a RemoveLocalInventoriesRequest. + * Properties of an AddLocalInventoriesMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveLocalInventoriesRequest - * @property {string|null} [product] RemoveLocalInventoriesRequest product - * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + * @interface IAddLocalInventoriesMetadata */ /** - * Constructs a new RemoveLocalInventoriesRequest. + * Constructs a new AddLocalInventoriesMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveLocalInventoriesRequest. - * @implements IRemoveLocalInventoriesRequest + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set */ - function RemoveLocalInventoriesRequest(properties) { - this.placeIds = []; + function AddLocalInventoriesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47247,118 +56129,63 @@ } /** - * RemoveLocalInventoriesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest - * @instance - */ - RemoveLocalInventoriesRequest.prototype.product = ""; - - /** - * RemoveLocalInventoriesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest - * @instance - */ - RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; - - /** - * RemoveLocalInventoriesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest - * @instance - */ - RemoveLocalInventoriesRequest.prototype.removeTime = null; - - /** - * RemoveLocalInventoriesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest - * @instance - */ - RemoveLocalInventoriesRequest.prototype.allowMissing = false; - - /** - * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance */ - RemoveLocalInventoriesRequest.create = function create(properties) { - return new RemoveLocalInventoriesRequest(properties); + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); }; /** - * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + AddLocalInventoriesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + AddLocalInventoriesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 5: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -47368,149 +56195,93 @@ }; /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesRequest message. + * Verifies an AddLocalInventoriesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesRequest.verify = function verify(message) { + AddLocalInventoriesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); - if (error) - return "removeTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata */ - RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest) + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - return message; + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata(); }; /** - * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) { - object.product = ""; - object.allowMissing = false; - object.removeTime = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); - return object; + AddLocalInventoriesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this RemoveLocalInventoriesRequest to JSON. + * Converts this AddLocalInventoriesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveLocalInventoriesRequest; + return AddLocalInventoriesMetadata; })(); - v2alpha.RemoveLocalInventoriesMetadata = (function() { + v2alpha.AddLocalInventoriesResponse = (function() { /** - * Properties of a RemoveLocalInventoriesMetadata. + * Properties of an AddLocalInventoriesResponse. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveLocalInventoriesMetadata + * @interface IAddLocalInventoriesResponse */ /** - * Constructs a new RemoveLocalInventoriesMetadata. + * Constructs a new AddLocalInventoriesResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveLocalInventoriesMetadata. - * @implements IRemoveLocalInventoriesMetadata + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set */ - function RemoveLocalInventoriesMetadata(properties) { + function AddLocalInventoriesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47518,60 +56289,60 @@ } /** - * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * Creates a new AddLocalInventoriesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance */ - RemoveLocalInventoriesMetadata.create = function create(properties) { - return new RemoveLocalInventoriesMetadata(properties); + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); }; /** - * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + AddLocalInventoriesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddLocalInventoriesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + AddLocalInventoriesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -47584,157 +56355,217 @@ }; /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesMetadata message. + * Verifies an AddLocalInventoriesResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesMetadata.verify = function verify(message) { + AddLocalInventoriesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} AddLocalInventoriesResponse */ - RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata) + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse) return object; - return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); + return new $root.google.cloud.retail.v2alpha.AddLocalInventoriesResponse(); }; /** - * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {google.cloud.retail.v2alpha.AddLocalInventoriesResponse} message AddLocalInventoriesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesMetadata.toObject = function toObject() { + AddLocalInventoriesResponse.toObject = function toObject() { return {}; }; /** - * Converts this RemoveLocalInventoriesMetadata to JSON. + * Converts this AddLocalInventoriesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveLocalInventoriesMetadata; + return AddLocalInventoriesResponse; })(); - v2alpha.RemoveLocalInventoriesResponse = (function() { + v2alpha.RemoveLocalInventoriesRequest = (function() { + + /** + * Properties of a RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + */ + function RemoveLocalInventoriesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.product = ""; + + /** + * RemoveLocalInventoriesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; /** - * Properties of a RemoveLocalInventoriesResponse. - * @memberof google.cloud.retail.v2alpha - * @interface IRemoveLocalInventoriesResponse + * RemoveLocalInventoriesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance */ + RemoveLocalInventoriesRequest.prototype.removeTime = null; /** - * Constructs a new RemoveLocalInventoriesResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveLocalInventoriesResponse. - * @implements IRemoveLocalInventoriesResponse - * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * RemoveLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @instance */ - function RemoveLocalInventoriesResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + RemoveLocalInventoriesRequest.prototype.allowMissing = false; /** - * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance */ - RemoveLocalInventoriesResponse.create = function create(properties) { - return new RemoveLocalInventoriesResponse(properties); + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 5: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -47744,231 +56575,213 @@ }; /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesResponse message. + * Verifies a RemoveLocalInventoriesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesResponse.verify = function verify(message) { + RemoveLocalInventoriesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest */ - RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse) + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest) return object; - return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); + var message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @static - * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesResponse.toObject = function toObject() { - return {}; + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.allowMissing = false; + object.removeTime = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + return object; }; /** - * Converts this RemoveLocalInventoriesResponse to JSON. + * Converts this RemoveLocalInventoriesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveLocalInventoriesResponse; + return RemoveLocalInventoriesRequest; })(); - v2alpha.RemoveFulfillmentPlacesRequest = (function() { + v2alpha.RemoveLocalInventoriesMetadata = (function() { /** - * Properties of a RemoveFulfillmentPlacesRequest. + * Properties of a RemoveLocalInventoriesMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveFulfillmentPlacesRequest - * @property {string|null} [product] RemoveFulfillmentPlacesRequest product - * @property {string|null} [type] RemoveFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + * @interface IRemoveLocalInventoriesMetadata */ /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new RemoveLocalInventoriesMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveFulfillmentPlacesRequest. - * @implements IRemoveFulfillmentPlacesRequest + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set */ - function RemoveFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function RemoveLocalInventoriesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RemoveFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.product = ""; - - /** - * RemoveFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.type = ""; - - /** - * RemoveFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; - - /** - * RemoveFulfillmentPlacesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.removeTime = null; - - /** - * RemoveFulfillmentPlacesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + this[keys[i]] = properties[keys[i]]; + } /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance */ - RemoveFulfillmentPlacesRequest.create = function create(properties) { - return new RemoveFulfillmentPlacesRequest(properties); + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -47978,157 +56791,93 @@ }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies a RemoveLocalInventoriesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesRequest.verify = function verify(message) { + RemoveLocalInventoriesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); - if (error) - return "removeTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata */ - RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest) + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - return message; + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @static - * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) { - object.product = ""; - object.type = ""; - object.removeTime = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - return object; + RemoveLocalInventoriesMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this RemoveLocalInventoriesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesRequest; + return RemoveLocalInventoriesMetadata; })(); - v2alpha.RemoveFulfillmentPlacesMetadata = (function() { + v2alpha.RemoveLocalInventoriesResponse = (function() { /** - * Properties of a RemoveFulfillmentPlacesMetadata. + * Properties of a RemoveLocalInventoriesResponse. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveFulfillmentPlacesMetadata + * @interface IRemoveLocalInventoriesResponse */ /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new RemoveLocalInventoriesResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveFulfillmentPlacesMetadata. - * @implements IRemoveFulfillmentPlacesMetadata + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set */ - function RemoveFulfillmentPlacesMetadata(properties) { + function RemoveLocalInventoriesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -48136,60 +56885,60 @@ } /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance */ - RemoveFulfillmentPlacesMetadata.create = function create(properties) { - return new RemoveFulfillmentPlacesMetadata(properties); + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -48202,93 +56951,99 @@ }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesMetadata message. + * Verifies a RemoveLocalInventoriesResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + RemoveLocalInventoriesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse */ - RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata) + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse) return object; - return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); + return new $root.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse(); }; /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @static - * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + RemoveLocalInventoriesResponse.toObject = function toObject() { return {}; }; /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * Converts this RemoveLocalInventoriesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesMetadata; + return RemoveLocalInventoriesResponse; })(); - v2alpha.RemoveFulfillmentPlacesResponse = (function() { + v2alpha.RemoveFulfillmentPlacesRequest = (function() { /** - * Properties of a RemoveFulfillmentPlacesResponse. + * Properties of a RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @interface IRemoveFulfillmentPlacesResponse + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing */ /** - * Constructs a new RemoveFulfillmentPlacesResponse. + * Constructs a new RemoveFulfillmentPlacesRequest. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a RemoveFulfillmentPlacesResponse. - * @implements IRemoveFulfillmentPlacesResponse + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest * @constructor - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set */ - function RemoveFulfillmentPlacesResponse(properties) { + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -48296,63 +57051,131 @@ } /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.product = ""; + + /** + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.type = ""; + + /** + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + + /** + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance */ - RemoveFulfillmentPlacesResponse.create = function create(properties) { - return new RemoveFulfillmentPlacesResponse(properties); + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.product = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + case 4: + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.allowMissing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -48362,93 +57185,157 @@ }; /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesResponse message. + * Verifies a RemoveFulfillmentPlacesRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesResponse.verify = function verify(message) { + RemoveFulfillmentPlacesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest */ - RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse) + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest) return object; - return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); + var message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; }; /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @static - * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesResponse.toObject = function toObject() { - return {}; + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; }; /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. + * Converts this RemoveFulfillmentPlacesRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return RemoveFulfillmentPlacesResponse; + return RemoveFulfillmentPlacesRequest; })(); - v2alpha.PurgeMetadata = (function() { + v2alpha.RemoveFulfillmentPlacesMetadata = (function() { /** - * Properties of a PurgeMetadata. + * Properties of a RemoveFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeMetadata + * @interface IRemoveFulfillmentPlacesMetadata */ /** - * Constructs a new PurgeMetadata. + * Constructs a new RemoveFulfillmentPlacesMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set */ - function PurgeMetadata(properties) { + function RemoveFulfillmentPlacesMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -48456,60 +57343,60 @@ } /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); }; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encode = function encode(message, writer) { + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); return writer; }; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decode = function decode(reader, length) { + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -48522,96 +57409,93 @@ }; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeMetadata message. + * Verifies a RemoveFulfillmentPlacesMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeMetadata.verify = function verify(message) { + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; return null; }; /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata) return object; - return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); + return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata(); }; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @static - * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeMetadata.toObject = function toObject() { + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { return {}; }; /** - * Converts this PurgeMetadata to JSON. + * Converts this RemoveFulfillmentPlacesMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata * @instance * @returns {Object.} JSON object */ - PurgeMetadata.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeMetadata; + return RemoveFulfillmentPlacesMetadata; })(); - v2alpha.PurgeUserEventsRequest = (function() { + v2alpha.RemoveFulfillmentPlacesResponse = (function() { /** - * Properties of a PurgeUserEventsRequest. + * Properties of a RemoveFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force + * @interface IRemoveFulfillmentPlacesResponse */ /** - * Constructs a new PurgeUserEventsRequest. + * Constructs a new RemoveFulfillmentPlacesResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set */ - function PurgeUserEventsRequest(properties) { + function RemoveFulfillmentPlacesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -48619,102 +57503,63 @@ } /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.parent = ""; - - /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.filter = ""; - - /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.force = false; - - /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); }; /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encode = function encode(message, writer) { + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); return writer; }; /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decode = function decode(reader, length) { + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; - case 3: - message.force = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -48724,124 +57569,93 @@ }; /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsRequest message. + * Verifies a RemoveFulfillmentPlacesResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsRequest.verify = function verify(message) { + RemoveFulfillmentPlacesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; return null; }; /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest - */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) - return object; - var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); - return message; - }; - - /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest - * @static - * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * @returns {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; - return object; + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse(); }; /** - * Converts this PurgeUserEventsRequest to JSON. + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse * @instance * @returns {Object.} JSON object */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsRequest; + return RemoveFulfillmentPlacesResponse; })(); - v2alpha.PurgeUserEventsResponse = (function() { + v2alpha.PurgeMetadata = (function() { /** - * Properties of a PurgeUserEventsResponse. + * Properties of a PurgeMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + * @interface IPurgeMetadata */ /** - * Constructs a new PurgeUserEventsResponse. + * Constructs a new PurgeMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set */ - function PurgeUserEventsResponse(properties) { + function PurgeMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -48849,76 +57663,63 @@ } /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse - * @instance - */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. + * Creates a new PurgeMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata instance */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); }; /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encode = function encode(message, writer) { + PurgeMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); return writer; }; /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurgeMetadata} message PurgeMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * Decodes a PurgeMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decode = function decode(reader, length) { + PurgeMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; default: reader.skipType(tag & 7); break; @@ -48928,210 +57729,97 @@ }; /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PurgeUserEventsResponse message. + * Verifies a PurgeMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PurgeUserEventsResponse.verify = function verify(message) { + PurgeMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; return null; }; /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @returns {google.cloud.retail.v2alpha.PurgeMetadata} PurgeMetadata */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); - return message; + return new $root.google.cloud.retail.v2alpha.PurgeMetadata(); }; /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @static - * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {google.cloud.retail.v2alpha.PurgeMetadata} message PurgeMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; - return object; + PurgeMetadata.toObject = function toObject() { + return {}; }; /** - * Converts this PurgeUserEventsResponse to JSON. + * Converts this PurgeMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @memberof google.cloud.retail.v2alpha.PurgeMetadata * @instance * @returns {Object.} JSON object */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + PurgeMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PurgeUserEventsResponse; - })(); - - v2alpha.SearchService = (function() { - - /** - * Constructs a new SearchService service. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SearchService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SearchService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; - - /** - * Creates new SearchService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. - */ - SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. - * @memberof google.cloud.retail.v2alpha.SearchService - * @typedef SearchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2alpha.SearchResponse} [response] SearchResponse - */ - - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2alpha.SearchService - * @instance - * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object - * @param {google.cloud.retail.v2alpha.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SearchService.prototype.search = function search(request, callback) { - return this.rpcCall(search, $root.google.cloud.retail.v2alpha.SearchRequest, $root.google.cloud.retail.v2alpha.SearchResponse, request, callback); - }, "name", { value: "Search" }); - - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2alpha.SearchService - * @instance - * @param {google.cloud.retail.v2alpha.ISearchRequest} request SearchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SearchService; + return PurgeMetadata; })(); - v2alpha.SearchRequest = (function() { - - /** - * Properties of a SearchRequest. - * @memberof google.cloud.retail.v2alpha - * @interface ISearchRequest - * @property {string|null} [placement] SearchRequest placement - * @property {string|null} [branch] SearchRequest branch - * @property {string|null} [query] SearchRequest query - * @property {string|null} [visitorId] SearchRequest visitorId - * @property {google.cloud.retail.v2alpha.IUserInfo|null} [userInfo] SearchRequest userInfo - * @property {number|null} [pageSize] SearchRequest pageSize - * @property {string|null} [pageToken] SearchRequest pageToken - * @property {number|null} [offset] SearchRequest offset - * @property {string|null} [filter] SearchRequest filter - * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter - * @property {string|null} [orderBy] SearchRequest orderBy - * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs - * @property {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold|null} [relevanceThreshold] SearchRequest relevanceThreshold - * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys - * @property {Array.|null} [pageCategories] SearchRequest pageCategories - * @property {google.cloud.retail.v2alpha.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + v2alpha.PurgeProductsMetadata = (function() { + + /** + * Properties of a PurgeProductsMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeProductsMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] PurgeProductsMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] PurgeProductsMetadata updateTime + * @property {number|Long|null} [successCount] PurgeProductsMetadata successCount + * @property {number|Long|null} [failureCount] PurgeProductsMetadata failureCount */ /** - * Constructs a new SearchRequest. + * Constructs a new PurgeProductsMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SearchRequest. - * @implements ISearchRequest + * @classdesc Represents a PurgeProductsMetadata. + * @implements IPurgeProductsMetadata * @constructor - * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.IPurgeProductsMetadata=} [properties] Properties to set */ - function SearchRequest(properties) { - this.facetSpecs = []; - this.variantRollupKeys = []; - this.pageCategories = []; + function PurgeProductsMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -49139,318 +57827,392 @@ } /** - * SearchRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata * @instance */ - SearchRequest.prototype.placement = ""; + PurgeProductsMetadata.prototype.createTime = null; /** - * SearchRequest branch. - * @member {string} branch - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata * @instance */ - SearchRequest.prototype.branch = ""; + PurgeProductsMetadata.prototype.updateTime = null; /** - * SearchRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsMetadata successCount. + * @member {number|Long} successCount + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata * @instance */ - SearchRequest.prototype.query = ""; + PurgeProductsMetadata.prototype.successCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * SearchRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsMetadata failureCount. + * @member {number|Long} failureCount + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata * @instance */ - SearchRequest.prototype.visitorId = ""; + PurgeProductsMetadata.prototype.failureCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * SearchRequest userInfo. - * @member {google.cloud.retail.v2alpha.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Creates a new PurgeProductsMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeProductsMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeProductsMetadata} PurgeProductsMetadata instance */ - SearchRequest.prototype.userInfo = null; + PurgeProductsMetadata.create = function create(properties) { + return new PurgeProductsMetadata(properties); + }; /** - * SearchRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Encodes the specified PurgeProductsMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeProductsMetadata} message PurgeProductsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - SearchRequest.prototype.pageSize = 0; + PurgeProductsMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.successCount != null && Object.hasOwnProperty.call(message, "successCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.successCount); + if (message.failureCount != null && Object.hasOwnProperty.call(message, "failureCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failureCount); + return writer; + }; /** - * SearchRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Encodes the specified PurgeProductsMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {google.cloud.retail.v2alpha.IPurgeProductsMetadata} message PurgeProductsMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - SearchRequest.prototype.pageToken = ""; + PurgeProductsMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * SearchRequest offset. - * @member {number} offset - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Decodes a PurgeProductsMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeProductsMetadata} PurgeProductsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.prototype.offset = 0; + PurgeProductsMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeProductsMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.successCount = reader.int64(); + break; + case 4: + message.failureCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * SearchRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Decodes a PurgeProductsMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeProductsMetadata} PurgeProductsMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.prototype.filter = ""; + PurgeProductsMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * SearchRequest canonicalFilter. - * @member {string} canonicalFilter - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Verifies a PurgeProductsMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.prototype.canonicalFilter = ""; + PurgeProductsMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (!$util.isInteger(message.successCount) && !(message.successCount && $util.isInteger(message.successCount.low) && $util.isInteger(message.successCount.high))) + return "successCount: integer|Long expected"; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (!$util.isInteger(message.failureCount) && !(message.failureCount && $util.isInteger(message.failureCount.low) && $util.isInteger(message.failureCount.high))) + return "failureCount: integer|Long expected"; + return null; + }; /** - * SearchRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Creates a PurgeProductsMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeProductsMetadata} PurgeProductsMetadata */ - SearchRequest.prototype.orderBy = ""; + PurgeProductsMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeProductsMetadata) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeProductsMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PurgeProductsMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.PurgeProductsMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.successCount != null) + if ($util.Long) + (message.successCount = $util.Long.fromValue(object.successCount)).unsigned = false; + else if (typeof object.successCount === "string") + message.successCount = parseInt(object.successCount, 10); + else if (typeof object.successCount === "number") + message.successCount = object.successCount; + else if (typeof object.successCount === "object") + message.successCount = new $util.LongBits(object.successCount.low >>> 0, object.successCount.high >>> 0).toNumber(); + if (object.failureCount != null) + if ($util.Long) + (message.failureCount = $util.Long.fromValue(object.failureCount)).unsigned = false; + else if (typeof object.failureCount === "string") + message.failureCount = parseInt(object.failureCount, 10); + else if (typeof object.failureCount === "number") + message.failureCount = object.failureCount; + else if (typeof object.failureCount === "object") + message.failureCount = new $util.LongBits(object.failureCount.low >>> 0, object.failureCount.high >>> 0).toNumber(); + return message; + }; /** - * SearchRequest facetSpecs. - * @member {Array.} facetSpecs - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Creates a plain object from a PurgeProductsMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {google.cloud.retail.v2alpha.PurgeProductsMetadata} message PurgeProductsMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchRequest.prototype.facetSpecs = $util.emptyArray; + PurgeProductsMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.successCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.successCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failureCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failureCount = options.longs === String ? "0" : 0; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.successCount != null && message.hasOwnProperty("successCount")) + if (typeof message.successCount === "number") + object.successCount = options.longs === String ? String(message.successCount) : message.successCount; + else + object.successCount = options.longs === String ? $util.Long.prototype.toString.call(message.successCount) : options.longs === Number ? new $util.LongBits(message.successCount.low >>> 0, message.successCount.high >>> 0).toNumber() : message.successCount; + if (message.failureCount != null && message.hasOwnProperty("failureCount")) + if (typeof message.failureCount === "number") + object.failureCount = options.longs === String ? String(message.failureCount) : message.failureCount; + else + object.failureCount = options.longs === String ? $util.Long.prototype.toString.call(message.failureCount) : options.longs === Number ? new $util.LongBits(message.failureCount.low >>> 0, message.failureCount.high >>> 0).toNumber() : message.failureCount; + return object; + }; /** - * SearchRequest dynamicFacetSpec. - * @member {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec - * @memberof google.cloud.retail.v2alpha.SearchRequest + * Converts this PurgeProductsMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata * @instance + * @returns {Object.} JSON object */ - SearchRequest.prototype.dynamicFacetSpec = null; + PurgeProductsMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * SearchRequest boostSpec. - * @member {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec|null|undefined} boostSpec - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance - */ - SearchRequest.prototype.boostSpec = null; + return PurgeProductsMetadata; + })(); + + v2alpha.PurgeProductsRequest = (function() { /** - * SearchRequest queryExpansionSpec. - * @member {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + * Properties of a PurgeProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeProductsRequest + * @property {string|null} [parent] PurgeProductsRequest parent + * @property {string|null} [filter] PurgeProductsRequest filter + * @property {boolean|null} [force] PurgeProductsRequest force */ - SearchRequest.prototype.queryExpansionSpec = null; - /** - * SearchRequest relevanceThreshold. - * @member {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} relevanceThreshold - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @instance + /** + * Constructs a new PurgeProductsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeProductsRequest. + * @implements IPurgeProductsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeProductsRequest=} [properties] Properties to set */ - SearchRequest.prototype.relevanceThreshold = 0; + function PurgeProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * SearchRequest variantRollupKeys. - * @member {Array.} variantRollupKeys - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @instance */ - SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + PurgeProductsRequest.prototype.parent = ""; /** - * SearchRequest pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @instance */ - SearchRequest.prototype.pageCategories = $util.emptyArray; + PurgeProductsRequest.prototype.filter = ""; /** - * SearchRequest searchMode. - * @member {google.cloud.retail.v2alpha.SearchRequest.SearchMode} searchMode - * @memberof google.cloud.retail.v2alpha.SearchRequest + * PurgeProductsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @instance */ - SearchRequest.prototype.searchMode = 0; + PurgeProductsRequest.prototype.force = false; /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new PurgeProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest instance + * @param {google.cloud.retail.v2alpha.IPurgeProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeProductsRequest} PurgeProductsRequest instance */ - SearchRequest.create = function create(properties) { - return new SearchRequest(properties); + PurgeProductsRequest.create = function create(properties) { + return new PurgeProductsRequest(properties); }; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * Encodes the specified PurgeProductsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurgeProductsRequest} message PurgeProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encode = function encode(message, writer) { + PurgeProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2alpha.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); - if (message.facetSpecs != null && message.facetSpecs.length) - for (var i = 0; i < message.facetSpecs.length; ++i) - $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) - $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) - $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.relevanceThreshold != null && Object.hasOwnProperty.call(message, "relevanceThreshold")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.relevanceThreshold); - if (message.variantRollupKeys != null && message.variantRollupKeys.length) - for (var i = 0; i < message.variantRollupKeys.length; ++i) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); - if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) - $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); - if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); - if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); return writer; }; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.verify|verify} messages. + * Encodes the specified PurgeProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2alpha.IPurgeProductsRequest} message PurgeProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + PurgeProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a PurgeProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2alpha.PurgeProductsRequest} PurgeProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decode = function decode(reader, length) { + PurgeProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.placement = reader.string(); + message.parent = reader.string(); break; case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); - break; - case 4: - message.visitorId = reader.string(); - break; - case 5: - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: message.filter = reader.string(); break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 15: - message.relevanceThreshold = reader.int32(); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 31: - message.searchMode = reader.int32(); + case 3: + message.force = reader.bool(); break; default: reader.skipType(tag & 7); @@ -49461,2147 +58223,2125 @@ }; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a PurgeProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2alpha.PurgeProductsRequest} PurgeProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decodeDelimited = function decodeDelimited(reader) { + PurgeProductsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchRequest message. + * Verifies a PurgeProductsRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.verify = function verify(message) { + PurgeProductsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2alpha.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; if (message.filter != null && message.hasOwnProperty("filter")) if (!$util.isString(message.filter)) return "filter: string expected"; - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - if (!$util.isString(message.canonicalFilter)) - return "canonicalFilter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { - if (!Array.isArray(message.facetSpecs)) - return "facetSpecs: array expected"; - for (var i = 0; i < message.facetSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); - if (error) - return "facetSpecs." + error; - } - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); - if (error) - return "dynamicFacetSpec." + error; - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify(message.boostSpec); - if (error) - return "boostSpec." + error; - } - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); - if (error) - return "queryExpansionSpec." + error; - } - if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) - switch (message.relevanceThreshold) { - default: - return "relevanceThreshold: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { - if (!Array.isArray(message.variantRollupKeys)) - return "variantRollupKeys: array expected"; - for (var i = 0; i < message.variantRollupKeys.length; ++i) - if (!$util.isString(message.variantRollupKeys[i])) - return "variantRollupKeys: string[] expected"; - } - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; - } - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - switch (message.searchMode) { - default: - return "searchMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PurgeProductsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2alpha.PurgeProductsRequest} PurgeProductsRequest */ - SearchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest) + PurgeProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeProductsRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.branch != null) - message.branch = String(object.branch); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.fromObject(object.userInfo); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.offset != null) - message.offset = object.offset | 0; + var message = new $root.google.cloud.retail.v2alpha.PurgeProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); if (object.filter != null) message.filter = String(object.filter); - if (object.canonicalFilter != null) - message.canonicalFilter = String(object.canonicalFilter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.facetSpecs) { - if (!Array.isArray(object.facetSpecs)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: array expected"); - message.facetSpecs = []; - for (var i = 0; i < object.facetSpecs.length; ++i) { - if (typeof object.facetSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.facetSpecs: object expected"); - message.facetSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); - } - } - if (object.dynamicFacetSpec != null) { - if (typeof object.dynamicFacetSpec !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.dynamicFacetSpec: object expected"); - message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); - } - if (object.boostSpec != null) { - if (typeof object.boostSpec !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.boostSpec: object expected"); - message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.fromObject(object.boostSpec); - } - if (object.queryExpansionSpec != null) { - if (typeof object.queryExpansionSpec !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.queryExpansionSpec: object expected"); - message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); - } - switch (object.relevanceThreshold) { - case "RELEVANCE_THRESHOLD_UNSPECIFIED": - case 0: - message.relevanceThreshold = 0; - break; - case "HIGH": - case 1: - message.relevanceThreshold = 1; - break; - case "MEDIUM": - case 2: - message.relevanceThreshold = 2; - break; - case "LOW": - case 3: - message.relevanceThreshold = 3; - break; - case "LOWEST": - case 4: - message.relevanceThreshold = 4; - break; - } - if (object.variantRollupKeys) { - if (!Array.isArray(object.variantRollupKeys)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.variantRollupKeys: array expected"); - message.variantRollupKeys = []; - for (var i = 0; i < object.variantRollupKeys.length; ++i) - message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); - } - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - switch (object.searchMode) { - case "SEARCH_MODE_UNSPECIFIED": - case 0: - message.searchMode = 0; - break; - case "PRODUCT_SEARCH_ONLY": - case 1: - message.searchMode = 1; - break; - case "FACETED_SEARCH_ONLY": - case 2: - message.searchMode = 2; - break; - } + if (object.force != null) + message.force = Boolean(object.force); return message; }; /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * Creates a plain object from a PurgeProductsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest * @static - * @param {google.cloud.retail.v2alpha.SearchRequest} message SearchRequest + * @param {google.cloud.retail.v2alpha.PurgeProductsRequest} message PurgeProductsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchRequest.toObject = function toObject(message, options) { + PurgeProductsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.facetSpecs = []; - object.variantRollupKeys = []; - object.pageCategories = []; - } if (options.defaults) { - object.placement = ""; - object.branch = ""; - object.query = ""; - object.visitorId = ""; - object.userInfo = null; - object.pageSize = 0; - object.pageToken = ""; - object.offset = 0; + object.parent = ""; object.filter = ""; - object.orderBy = ""; - object.boostSpec = null; - object.queryExpansionSpec = null; - object.relevanceThreshold = options.enums === String ? "RELEVANCE_THRESHOLD_UNSPECIFIED" : 0; - object.dynamicFacetSpec = null; - object.canonicalFilter = ""; - object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; + object.force = false; } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.toObject(message.userInfo, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; if (message.filter != null && message.hasOwnProperty("filter")) object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.facetSpecs && message.facetSpecs.length) { - object.facetSpecs = []; - for (var j = 0; j < message.facetSpecs.length; ++j) - object.facetSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PurgeProductsRequest; + })(); + + v2alpha.PurgeProductsResponse = (function() { + + /** + * Properties of a PurgeProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeProductsResponse + * @property {number|Long|null} [purgeCount] PurgeProductsResponse purgeCount + * @property {Array.|null} [purgeSample] PurgeProductsResponse purgeSample + */ + + /** + * Constructs a new PurgeProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeProductsResponse. + * @implements IPurgeProductsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeProductsResponse=} [properties] Properties to set + */ + function PurgeProductsResponse(properties) { + this.purgeSample = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeProductsResponse purgeCount. + * @member {number|Long} purgeCount + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @instance + */ + PurgeProductsResponse.prototype.purgeCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PurgeProductsResponse purgeSample. + * @member {Array.} purgeSample + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @instance + */ + PurgeProductsResponse.prototype.purgeSample = $util.emptyArray; + + /** + * Creates a new PurgeProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeProductsResponse} PurgeProductsResponse instance + */ + PurgeProductsResponse.create = function create(properties) { + return new PurgeProductsResponse(properties); + }; + + /** + * Encodes the specified PurgeProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeProductsResponse} message PurgeProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgeCount != null && Object.hasOwnProperty.call(message, "purgeCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgeCount); + if (message.purgeSample != null && message.purgeSample.length) + for (var i = 0; i < message.purgeSample.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.purgeSample[i]); + return writer; + }; + + /** + * Encodes the specified PurgeProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeProductsResponse} message PurgeProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeProductsResponse} PurgeProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgeCount = reader.int64(); + break; + case 2: + if (!(message.purgeSample && message.purgeSample.length)) + message.purgeSample = []; + message.purgeSample.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeProductsResponse} PurgeProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgeCount != null && message.hasOwnProperty("purgeCount")) + if (!$util.isInteger(message.purgeCount) && !(message.purgeCount && $util.isInteger(message.purgeCount.low) && $util.isInteger(message.purgeCount.high))) + return "purgeCount: integer|Long expected"; + if (message.purgeSample != null && message.hasOwnProperty("purgeSample")) { + if (!Array.isArray(message.purgeSample)) + return "purgeSample: array expected"; + for (var i = 0; i < message.purgeSample.length; ++i) + if (!$util.isString(message.purgeSample[i])) + return "purgeSample: string[] expected"; } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) - object.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.toObject(message.boostSpec, options); - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) - object.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); - if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) - object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; - if (message.variantRollupKeys && message.variantRollupKeys.length) { - object.variantRollupKeys = []; - for (var j = 0; j < message.variantRollupKeys.length; ++j) - object.variantRollupKeys[j] = message.variantRollupKeys[j]; + return null; + }; + + /** + * Creates a PurgeProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeProductsResponse} PurgeProductsResponse + */ + PurgeProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeProductsResponse(); + if (object.purgeCount != null) + if ($util.Long) + (message.purgeCount = $util.Long.fromValue(object.purgeCount)).unsigned = false; + else if (typeof object.purgeCount === "string") + message.purgeCount = parseInt(object.purgeCount, 10); + else if (typeof object.purgeCount === "number") + message.purgeCount = object.purgeCount; + else if (typeof object.purgeCount === "object") + message.purgeCount = new $util.LongBits(object.purgeCount.low >>> 0, object.purgeCount.high >>> 0).toNumber(); + if (object.purgeSample) { + if (!Array.isArray(object.purgeSample)) + throw TypeError(".google.cloud.retail.v2alpha.PurgeProductsResponse.purgeSample: array expected"); + message.purgeSample = []; + for (var i = 0; i < object.purgeSample.length; ++i) + message.purgeSample[i] = String(object.purgeSample[i]); } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) - object.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; + return message; + }; + + /** + * Creates a plain object from a PurgeProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.PurgeProductsResponse} message PurgeProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.purgeSample = []; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgeCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgeCount = options.longs === String ? "0" : 0; + if (message.purgeCount != null && message.hasOwnProperty("purgeCount")) + if (typeof message.purgeCount === "number") + object.purgeCount = options.longs === String ? String(message.purgeCount) : message.purgeCount; + else + object.purgeCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgeCount) : options.longs === Number ? new $util.LongBits(message.purgeCount.low >>> 0, message.purgeCount.high >>> 0).toNumber() : message.purgeCount; + if (message.purgeSample && message.purgeSample.length) { + object.purgeSample = []; + for (var j = 0; j < message.purgeSample.length; ++j) + object.purgeSample[j] = message.purgeSample[j]; } - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - object.canonicalFilter = message.canonicalFilter; - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; return object; }; /** - * Converts this SearchRequest to JSON. + * Converts this PurgeProductsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse * @instance * @returns {Object.} JSON object */ - SearchRequest.prototype.toJSON = function toJSON() { + PurgeProductsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - SearchRequest.FacetSpec = (function() { - - /** - * Properties of a FacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IFacetSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey - * @property {number|null} [limit] FacetSpec limit - * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys - * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition - */ - - /** - * Constructs a new FacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a FacetSpec. - * @implements IFacetSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set - */ - function FacetSpec(properties) { - this.excludedFilterKeys = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return PurgeProductsResponse; + })(); - /** - * FacetSpec facetKey. - * @member {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.facetKey = null; + v2alpha.PurgeUserEventsRequest = (function() { - /** - * FacetSpec limit. - * @member {number} limit - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.limit = 0; + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ - /** - * FacetSpec excludedFilterKeys. - * @member {Array.} excludedFilterKeys - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FacetSpec enableDynamicPosition. - * @member {boolean} enableDynamicPosition - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.enableDynamicPosition = false; + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; - /** - * Creates a new FacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec instance - */ - FacetSpec.create = function create(properties) { - return new FacetSpec(properties); - }; + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; - /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) - $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); - if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); - if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); - return writer; - }; + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; - /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; - /** - * Decodes a FacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; - /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a FacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.facetKey != null && message.hasOwnProperty("facetKey")) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); - if (error) - return "facetKey." + error; - } - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit)) - return "limit: integer expected"; - if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { - if (!Array.isArray(message.excludedFilterKeys)) - return "excludedFilterKeys: array expected"; - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - if (!$util.isString(message.excludedFilterKeys[i])) - return "excludedFilterKeys: string[] expected"; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + case 3: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - if (typeof message.enableDynamicPosition !== "boolean") - return "enableDynamicPosition: boolean expected"; - return null; - }; + } + return message; + }; - /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} FacetSpec - */ - FacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec(); - if (object.facetKey != null) { - if (typeof object.facetKey !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.facetKey: object expected"); - message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); - } - if (object.limit != null) - message.limit = object.limit | 0; - if (object.excludedFilterKeys) { - if (!Array.isArray(object.excludedFilterKeys)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); - message.excludedFilterKeys = []; - for (var i = 0; i < object.excludedFilterKeys.length; ++i) - message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); - } - if (object.enableDynamicPosition != null) - message.enableDynamicPosition = Boolean(object.enableDynamicPosition); - return message; - }; + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec} message FacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.excludedFilterKeys = []; - if (options.defaults) { - object.facetKey = null; - object.limit = 0; - object.enableDynamicPosition = false; - } - if (message.facetKey != null && message.hasOwnProperty("facetKey")) - object.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = message.limit; - if (message.excludedFilterKeys && message.excludedFilterKeys.length) { - object.excludedFilterKeys = []; - for (var j = 0; j < message.excludedFilterKeys.length; ++j) - object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; - } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - object.enableDynamicPosition = message.enableDynamicPosition; + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest) return object; - }; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this FacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @instance - * @returns {Object.} JSON object - */ - FacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return PurgeUserEventsRequest; + })(); - FacetSpec.FacetKey = (function() { + v2alpha.PurgeUserEventsResponse = (function() { - /** - * Properties of a FacetKey. - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @interface IFacetKey - * @property {string|null} [key] FacetKey key - * @property {Array.|null} [intervals] FacetKey intervals - * @property {Array.|null} [restrictedValues] FacetKey restrictedValues - * @property {Array.|null} [prefixes] FacetKey prefixes - * @property {Array.|null} [contains] FacetKey contains - * @property {string|null} [orderBy] FacetKey orderBy - * @property {string|null} [query] FacetKey query - */ + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ - /** - * Constructs a new FacetKey. - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec - * @classdesc Represents a FacetKey. - * @implements IFacetKey - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - */ - function FacetKey(properties) { - this.intervals = []; - this.restrictedValues = []; - this.prefixes = []; - this.contains = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * FacetKey key. - * @member {string} key - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.key = ""; + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - /** - * FacetKey intervals. - * @member {Array.} intervals - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.intervals = $util.emptyArray; + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; - /** - * FacetKey restrictedValues. - * @member {Array.} restrictedValues - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.restrictedValues = $util.emptyArray; + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; - /** - * FacetKey prefixes. - * @member {Array.} prefixes - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.prefixes = $util.emptyArray; + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * FacetKey contains. - * @member {Array.} contains - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.contains = $util.emptyArray; + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purgedEventsCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * FacetKey orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.orderBy = ""; + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * FacetKey query. - * @member {string} query - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.query = ""; + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; - /** - * Creates a new FacetKey instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey instance - */ - FacetKey.create = function create(properties) { - return new FacetKey(properties); - }; + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.intervals != null && message.intervals.length) - for (var i = 0; i < message.intervals.length; ++i) - $root.google.cloud.retail.v2alpha.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.restrictedValues != null && message.restrictedValues.length) - for (var i = 0; i < message.restrictedValues.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); - if (message.prefixes != null && message.prefixes.length) - for (var i = 0; i < message.prefixes.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); - if (message.contains != null && message.contains.length) - for (var i = 0; i < message.contains.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); - return writer; - }; + return PurgeUserEventsResponse; + })(); - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + v2alpha.ServingConfig = (function() { - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Properties of a ServingConfig. + * @memberof google.cloud.retail.v2alpha + * @interface IServingConfig + * @property {string|null} [name] ServingConfig name + * @property {string|null} [displayName] ServingConfig displayName + * @property {string|null} [modelId] ServingConfig modelId + * @property {string|null} [priceRerankingLevel] ServingConfig priceRerankingLevel + * @property {Array.|null} [facetControlIds] ServingConfig facetControlIds + * @property {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] ServingConfig dynamicFacetSpec + * @property {Array.|null} [boostControlIds] ServingConfig boostControlIds + * @property {Array.|null} [filterControlIds] ServingConfig filterControlIds + * @property {Array.|null} [redirectControlIds] ServingConfig redirectControlIds + * @property {Array.|null} [twowaySynonymsControlIds] ServingConfig twowaySynonymsControlIds + * @property {Array.|null} [onewaySynonymsControlIds] ServingConfig onewaySynonymsControlIds + * @property {Array.|null} [doNotAssociateControlIds] ServingConfig doNotAssociateControlIds + * @property {Array.|null} [replacementControlIds] ServingConfig replacementControlIds + * @property {Array.|null} [ignoreControlIds] ServingConfig ignoreControlIds + * @property {string|null} [diversityLevel] ServingConfig diversityLevel + * @property {string|null} [enableCategoryFilterLevel] ServingConfig enableCategoryFilterLevel + * @property {Array.|null} [solutionTypes] ServingConfig solutionTypes + */ - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Constructs a new ServingConfig. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ServingConfig. + * @implements IServingConfig + * @constructor + * @param {google.cloud.retail.v2alpha.IServingConfig=} [properties] Properties to set + */ + function ServingConfig(properties) { + this.facetControlIds = []; + this.boostControlIds = []; + this.filterControlIds = []; + this.redirectControlIds = []; + this.twowaySynonymsControlIds = []; + this.onewaySynonymsControlIds = []; + this.doNotAssociateControlIds = []; + this.replacementControlIds = []; + this.ignoreControlIds = []; + this.solutionTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Verifies a FacetKey message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.intervals != null && message.hasOwnProperty("intervals")) { - if (!Array.isArray(message.intervals)) - return "intervals: array expected"; - for (var i = 0; i < message.intervals.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.intervals[i]); - if (error) - return "intervals." + error; - } - } - if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { - if (!Array.isArray(message.restrictedValues)) - return "restrictedValues: array expected"; - for (var i = 0; i < message.restrictedValues.length; ++i) - if (!$util.isString(message.restrictedValues[i])) - return "restrictedValues: string[] expected"; - } - if (message.prefixes != null && message.hasOwnProperty("prefixes")) { - if (!Array.isArray(message.prefixes)) - return "prefixes: array expected"; - for (var i = 0; i < message.prefixes.length; ++i) - if (!$util.isString(message.prefixes[i])) - return "prefixes: string[] expected"; - } - if (message.contains != null && message.hasOwnProperty("contains")) { - if (!Array.isArray(message.contains)) - return "contains: array expected"; - for (var i = 0; i < message.contains.length; ++i) - if (!$util.isString(message.contains[i])) - return "contains: string[] expected"; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - return null; - }; + /** + * ServingConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.name = ""; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} FacetKey - */ - FacetKey.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey(); - if (object.key != null) - message.key = String(object.key); - if (object.intervals) { - if (!Array.isArray(object.intervals)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); - message.intervals = []; - for (var i = 0; i < object.intervals.length; ++i) { - if (typeof object.intervals[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); - message.intervals[i] = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.intervals[i]); - } - } - if (object.restrictedValues) { - if (!Array.isArray(object.restrictedValues)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); - message.restrictedValues = []; - for (var i = 0; i < object.restrictedValues.length; ++i) - message.restrictedValues[i] = String(object.restrictedValues[i]); - } - if (object.prefixes) { - if (!Array.isArray(object.prefixes)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); - message.prefixes = []; - for (var i = 0; i < object.prefixes.length; ++i) - message.prefixes[i] = String(object.prefixes[i]); - } - if (object.contains) { - if (!Array.isArray(object.contains)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.contains: array expected"); - message.contains = []; - for (var i = 0; i < object.contains.length; ++i) - message.contains[i] = String(object.contains[i]); - } - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.query != null) - message.query = String(object.query); - return message; - }; + /** + * ServingConfig displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.displayName = ""; - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey} message FacetKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.intervals = []; - object.restrictedValues = []; - object.prefixes = []; - object.contains = []; - } - if (options.defaults) { - object.key = ""; - object.orderBy = ""; - object.query = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.intervals && message.intervals.length) { - object.intervals = []; - for (var j = 0; j < message.intervals.length; ++j) - object.intervals[j] = $root.google.cloud.retail.v2alpha.Interval.toObject(message.intervals[j], options); - } - if (message.restrictedValues && message.restrictedValues.length) { - object.restrictedValues = []; - for (var j = 0; j < message.restrictedValues.length; ++j) - object.restrictedValues[j] = message.restrictedValues[j]; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.prefixes && message.prefixes.length) { - object.prefixes = []; - for (var j = 0; j < message.prefixes.length; ++j) - object.prefixes[j] = message.prefixes[j]; - } - if (message.contains && message.contains.length) { - object.contains = []; - for (var j = 0; j < message.contains.length; ++j) - object.contains[j] = message.contains[j]; - } - return object; - }; + /** + * ServingConfig modelId. + * @member {string} modelId + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.modelId = ""; - /** - * Converts this FacetKey to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey - * @instance - * @returns {Object.} JSON object - */ - FacetKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * ServingConfig priceRerankingLevel. + * @member {string} priceRerankingLevel + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.priceRerankingLevel = ""; - return FacetKey; - })(); + /** + * ServingConfig facetControlIds. + * @member {Array.} facetControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.facetControlIds = $util.emptyArray; - return FacetSpec; - })(); + /** + * ServingConfig dynamicFacetSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.dynamicFacetSpec = null; - SearchRequest.DynamicFacetSpec = (function() { + /** + * ServingConfig boostControlIds. + * @member {Array.} boostControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.boostControlIds = $util.emptyArray; - /** - * Properties of a DynamicFacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IDynamicFacetSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode - */ + /** + * ServingConfig filterControlIds. + * @member {Array.} filterControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.filterControlIds = $util.emptyArray; - /** - * Constructs a new DynamicFacetSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a DynamicFacetSpec. - * @implements IDynamicFacetSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - */ - function DynamicFacetSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * ServingConfig redirectControlIds. + * @member {Array.} redirectControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.redirectControlIds = $util.emptyArray; - /** - * DynamicFacetSpec mode. - * @member {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode} mode - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @instance - */ - DynamicFacetSpec.prototype.mode = 0; + /** + * ServingConfig twowaySynonymsControlIds. + * @member {Array.} twowaySynonymsControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.twowaySynonymsControlIds = $util.emptyArray; - /** - * Creates a new DynamicFacetSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance - */ - DynamicFacetSpec.create = function create(properties) { - return new DynamicFacetSpec(properties); - }; + /** + * ServingConfig onewaySynonymsControlIds. + * @member {Array.} onewaySynonymsControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.onewaySynonymsControlIds = $util.emptyArray; - /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; + /** + * ServingConfig doNotAssociateControlIds. + * @member {Array.} doNotAssociateControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.doNotAssociateControlIds = $util.emptyArray; + + /** + * ServingConfig replacementControlIds. + * @member {Array.} replacementControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.replacementControlIds = $util.emptyArray; + + /** + * ServingConfig ignoreControlIds. + * @member {Array.} ignoreControlIds + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.ignoreControlIds = $util.emptyArray; + + /** + * ServingConfig diversityLevel. + * @member {string} diversityLevel + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.diversityLevel = ""; - /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ServingConfig enableCategoryFilterLevel. + * @member {string} enableCategoryFilterLevel + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.enableCategoryFilterLevel = ""; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * ServingConfig solutionTypes. + * @member {Array.} solutionTypes + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + */ + ServingConfig.prototype.solutionTypes = $util.emptyArray; - /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a new ServingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {google.cloud.retail.v2alpha.IServingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ServingConfig} ServingConfig instance + */ + ServingConfig.create = function create(properties) { + return new ServingConfig(properties); + }; - /** - * Verifies a DynamicFacetSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DynamicFacetSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; + /** + * Encodes the specified ServingConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ServingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {google.cloud.retail.v2alpha.IServingConfig} message ServingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.modelId != null && Object.hasOwnProperty.call(message, "modelId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelId); + if (message.priceRerankingLevel != null && Object.hasOwnProperty.call(message, "priceRerankingLevel")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.priceRerankingLevel); + if (message.facetControlIds != null && message.facetControlIds.length) + for (var i = 0; i < message.facetControlIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.facetControlIds[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.boostControlIds != null && message.boostControlIds.length) + for (var i = 0; i < message.boostControlIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.boostControlIds[i]); + if (message.diversityLevel != null && Object.hasOwnProperty.call(message, "diversityLevel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.diversityLevel); + if (message.filterControlIds != null && message.filterControlIds.length) + for (var i = 0; i < message.filterControlIds.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.filterControlIds[i]); + if (message.redirectControlIds != null && message.redirectControlIds.length) + for (var i = 0; i < message.redirectControlIds.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectControlIds[i]); + if (message.onewaySynonymsControlIds != null && message.onewaySynonymsControlIds.length) + for (var i = 0; i < message.onewaySynonymsControlIds.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.onewaySynonymsControlIds[i]); + if (message.doNotAssociateControlIds != null && message.doNotAssociateControlIds.length) + for (var i = 0; i < message.doNotAssociateControlIds.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.doNotAssociateControlIds[i]); + if (message.replacementControlIds != null && message.replacementControlIds.length) + for (var i = 0; i < message.replacementControlIds.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.replacementControlIds[i]); + if (message.ignoreControlIds != null && message.ignoreControlIds.length) + for (var i = 0; i < message.ignoreControlIds.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.ignoreControlIds[i]); + if (message.enableCategoryFilterLevel != null && Object.hasOwnProperty.call(message, "enableCategoryFilterLevel")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.enableCategoryFilterLevel); + if (message.twowaySynonymsControlIds != null && message.twowaySynonymsControlIds.length) + for (var i = 0; i < message.twowaySynonymsControlIds.length; ++i) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.twowaySynonymsControlIds[i]); + if (message.solutionTypes != null && message.solutionTypes.length) { + writer.uint32(/* id 19, wireType 2 =*/154).fork(); + for (var i = 0; i < message.solutionTypes.length; ++i) + writer.int32(message.solutionTypes[i]); + writer.ldelim(); + } + return writer; + }; - /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} DynamicFacetSpec - */ - DynamicFacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; + /** + * Encodes the specified ServingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ServingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {google.cloud.retail.v2alpha.IServingConfig} message ServingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ServingConfig} ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ServingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.modelId = reader.string(); + break; + case 4: + message.priceRerankingLevel = reader.string(); + break; + case 5: + if (!(message.facetControlIds && message.facetControlIds.length)) + message.facetControlIds = []; + message.facetControlIds.push(reader.string()); + break; + case 6: + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + case 7: + if (!(message.boostControlIds && message.boostControlIds.length)) + message.boostControlIds = []; + message.boostControlIds.push(reader.string()); + break; + case 9: + if (!(message.filterControlIds && message.filterControlIds.length)) + message.filterControlIds = []; + message.filterControlIds.push(reader.string()); + break; + case 10: + if (!(message.redirectControlIds && message.redirectControlIds.length)) + message.redirectControlIds = []; + message.redirectControlIds.push(reader.string()); + break; + case 18: + if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) + message.twowaySynonymsControlIds = []; + message.twowaySynonymsControlIds.push(reader.string()); + break; + case 12: + if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) + message.onewaySynonymsControlIds = []; + message.onewaySynonymsControlIds.push(reader.string()); + break; + case 13: + if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) + message.doNotAssociateControlIds = []; + message.doNotAssociateControlIds.push(reader.string()); + break; + case 14: + if (!(message.replacementControlIds && message.replacementControlIds.length)) + message.replacementControlIds = []; + message.replacementControlIds.push(reader.string()); + break; + case 15: + if (!(message.ignoreControlIds && message.ignoreControlIds.length)) + message.ignoreControlIds = []; + message.ignoreControlIds.push(reader.string()); break; - case "DISABLED": - case 1: - message.mode = 1; + case 8: + message.diversityLevel = reader.string(); break; - case "ENABLED": - case 2: - message.mode = 2; + case 16: + message.enableCategoryFilterLevel = reader.string(); + break; + case 19: + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else + message.solutionTypes.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); break; } - return message; - }; - - /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DynamicFacetSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; - return object; - }; - - /** - * Converts this DynamicFacetSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec - * @instance - * @returns {Object.} JSON object - */ - DynamicFacetSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Mode enum. - * @name google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} ENABLED=2 ENABLED value - */ - DynamicFacetSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[2] = "ENABLED"] = 2; - return values; - })(); - - return DynamicFacetSpec; - })(); - - SearchRequest.BoostSpec = (function() { - - /** - * Properties of a BoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IBoostSpec - * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs - */ - - /** - * Constructs a new BoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a BoostSpec. - * @implements IBoostSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set - */ - function BoostSpec(properties) { - this.conditionBoostSpecs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; } + return message; + }; - /** - * BoostSpec conditionBoostSpecs. - * @member {Array.} conditionBoostSpecs - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @instance - */ - BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; - - /** - * Creates a new BoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec instance - */ - BoostSpec.create = function create(properties) { - return new BoostSpec(properties); - }; - - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) - $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a ServingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ServingConfig} ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; + /** + * Verifies a ServingConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.modelId != null && message.hasOwnProperty("modelId")) + if (!$util.isString(message.modelId)) + return "modelId: string expected"; + if (message.priceRerankingLevel != null && message.hasOwnProperty("priceRerankingLevel")) + if (!$util.isString(message.priceRerankingLevel)) + return "priceRerankingLevel: string expected"; + if (message.facetControlIds != null && message.hasOwnProperty("facetControlIds")) { + if (!Array.isArray(message.facetControlIds)) + return "facetControlIds: array expected"; + for (var i = 0; i < message.facetControlIds.length; ++i) + if (!$util.isString(message.facetControlIds[i])) + return "facetControlIds: string[] expected"; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostControlIds != null && message.hasOwnProperty("boostControlIds")) { + if (!Array.isArray(message.boostControlIds)) + return "boostControlIds: array expected"; + for (var i = 0; i < message.boostControlIds.length; ++i) + if (!$util.isString(message.boostControlIds[i])) + return "boostControlIds: string[] expected"; + } + if (message.filterControlIds != null && message.hasOwnProperty("filterControlIds")) { + if (!Array.isArray(message.filterControlIds)) + return "filterControlIds: array expected"; + for (var i = 0; i < message.filterControlIds.length; ++i) + if (!$util.isString(message.filterControlIds[i])) + return "filterControlIds: string[] expected"; + } + if (message.redirectControlIds != null && message.hasOwnProperty("redirectControlIds")) { + if (!Array.isArray(message.redirectControlIds)) + return "redirectControlIds: array expected"; + for (var i = 0; i < message.redirectControlIds.length; ++i) + if (!$util.isString(message.redirectControlIds[i])) + return "redirectControlIds: string[] expected"; + } + if (message.twowaySynonymsControlIds != null && message.hasOwnProperty("twowaySynonymsControlIds")) { + if (!Array.isArray(message.twowaySynonymsControlIds)) + return "twowaySynonymsControlIds: array expected"; + for (var i = 0; i < message.twowaySynonymsControlIds.length; ++i) + if (!$util.isString(message.twowaySynonymsControlIds[i])) + return "twowaySynonymsControlIds: string[] expected"; + } + if (message.onewaySynonymsControlIds != null && message.hasOwnProperty("onewaySynonymsControlIds")) { + if (!Array.isArray(message.onewaySynonymsControlIds)) + return "onewaySynonymsControlIds: array expected"; + for (var i = 0; i < message.onewaySynonymsControlIds.length; ++i) + if (!$util.isString(message.onewaySynonymsControlIds[i])) + return "onewaySynonymsControlIds: string[] expected"; + } + if (message.doNotAssociateControlIds != null && message.hasOwnProperty("doNotAssociateControlIds")) { + if (!Array.isArray(message.doNotAssociateControlIds)) + return "doNotAssociateControlIds: array expected"; + for (var i = 0; i < message.doNotAssociateControlIds.length; ++i) + if (!$util.isString(message.doNotAssociateControlIds[i])) + return "doNotAssociateControlIds: string[] expected"; + } + if (message.replacementControlIds != null && message.hasOwnProperty("replacementControlIds")) { + if (!Array.isArray(message.replacementControlIds)) + return "replacementControlIds: array expected"; + for (var i = 0; i < message.replacementControlIds.length; ++i) + if (!$util.isString(message.replacementControlIds[i])) + return "replacementControlIds: string[] expected"; + } + if (message.ignoreControlIds != null && message.hasOwnProperty("ignoreControlIds")) { + if (!Array.isArray(message.ignoreControlIds)) + return "ignoreControlIds: array expected"; + for (var i = 0; i < message.ignoreControlIds.length; ++i) + if (!$util.isString(message.ignoreControlIds[i])) + return "ignoreControlIds: string[] expected"; + } + if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) + if (!$util.isString(message.diversityLevel)) + return "diversityLevel: string expected"; + if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) + if (!$util.isString(message.enableCategoryFilterLevel)) + return "enableCategoryFilterLevel: string expected"; + if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { + if (!Array.isArray(message.solutionTypes)) + return "solutionTypes: array expected"; + for (var i = 0; i < message.solutionTypes.length; ++i) + switch (message.solutionTypes[i]) { default: - reader.skipType(tag & 7); + return "solutionTypes: enum value[] expected"; + case 0: + case 1: + case 2: break; } - } - return message; - }; - - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { - if (!Array.isArray(message.conditionBoostSpecs)) - return "conditionBoostSpecs: array expected"; - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); - if (error) - return "conditionBoostSpecs." + error; - } - } - return null; - }; - - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} BoostSpec - */ - BoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec(); - if (object.conditionBoostSpecs) { - if (!Array.isArray(object.conditionBoostSpecs)) - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); - message.conditionBoostSpecs = []; - for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { - if (typeof object.conditionBoostSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); - message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); - } - } - return message; - }; + } + return null; + }; - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} message BoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.conditionBoostSpecs = []; - if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { - object.conditionBoostSpecs = []; - for (var j = 0; j < message.conditionBoostSpecs.length; ++j) - object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); - } + /** + * Creates a ServingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ServingConfig} ServingConfig + */ + ServingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ServingConfig) return object; - }; - - /** - * Converts this BoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @instance - * @returns {Object.} JSON object - */ - BoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - BoostSpec.ConditionBoostSpec = (function() { + var message = new $root.google.cloud.retail.v2alpha.ServingConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.modelId != null) + message.modelId = String(object.modelId); + if (object.priceRerankingLevel != null) + message.priceRerankingLevel = String(object.priceRerankingLevel); + if (object.facetControlIds) { + if (!Array.isArray(object.facetControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.facetControlIds: array expected"); + message.facetControlIds = []; + for (var i = 0; i < object.facetControlIds.length; ++i) + message.facetControlIds[i] = String(object.facetControlIds[i]); + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostControlIds) { + if (!Array.isArray(object.boostControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.boostControlIds: array expected"); + message.boostControlIds = []; + for (var i = 0; i < object.boostControlIds.length; ++i) + message.boostControlIds[i] = String(object.boostControlIds[i]); + } + if (object.filterControlIds) { + if (!Array.isArray(object.filterControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.filterControlIds: array expected"); + message.filterControlIds = []; + for (var i = 0; i < object.filterControlIds.length; ++i) + message.filterControlIds[i] = String(object.filterControlIds[i]); + } + if (object.redirectControlIds) { + if (!Array.isArray(object.redirectControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.redirectControlIds: array expected"); + message.redirectControlIds = []; + for (var i = 0; i < object.redirectControlIds.length; ++i) + message.redirectControlIds[i] = String(object.redirectControlIds[i]); + } + if (object.twowaySynonymsControlIds) { + if (!Array.isArray(object.twowaySynonymsControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.twowaySynonymsControlIds: array expected"); + message.twowaySynonymsControlIds = []; + for (var i = 0; i < object.twowaySynonymsControlIds.length; ++i) + message.twowaySynonymsControlIds[i] = String(object.twowaySynonymsControlIds[i]); + } + if (object.onewaySynonymsControlIds) { + if (!Array.isArray(object.onewaySynonymsControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.onewaySynonymsControlIds: array expected"); + message.onewaySynonymsControlIds = []; + for (var i = 0; i < object.onewaySynonymsControlIds.length; ++i) + message.onewaySynonymsControlIds[i] = String(object.onewaySynonymsControlIds[i]); + } + if (object.doNotAssociateControlIds) { + if (!Array.isArray(object.doNotAssociateControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.doNotAssociateControlIds: array expected"); + message.doNotAssociateControlIds = []; + for (var i = 0; i < object.doNotAssociateControlIds.length; ++i) + message.doNotAssociateControlIds[i] = String(object.doNotAssociateControlIds[i]); + } + if (object.replacementControlIds) { + if (!Array.isArray(object.replacementControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.replacementControlIds: array expected"); + message.replacementControlIds = []; + for (var i = 0; i < object.replacementControlIds.length; ++i) + message.replacementControlIds[i] = String(object.replacementControlIds[i]); + } + if (object.ignoreControlIds) { + if (!Array.isArray(object.ignoreControlIds)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.ignoreControlIds: array expected"); + message.ignoreControlIds = []; + for (var i = 0; i < object.ignoreControlIds.length; ++i) + message.ignoreControlIds[i] = String(object.ignoreControlIds[i]); + } + if (object.diversityLevel != null) + message.diversityLevel = String(object.diversityLevel); + if (object.enableCategoryFilterLevel != null) + message.enableCategoryFilterLevel = String(object.enableCategoryFilterLevel); + if (object.solutionTypes) { + if (!Array.isArray(object.solutionTypes)) + throw TypeError(".google.cloud.retail.v2alpha.ServingConfig.solutionTypes: array expected"); + message.solutionTypes = []; + for (var i = 0; i < object.solutionTypes.length; ++i) + switch (object.solutionTypes[i]) { + default: + case "SOLUTION_TYPE_UNSPECIFIED": + case 0: + message.solutionTypes[i] = 0; + break; + case "SOLUTION_TYPE_RECOMMENDATION": + case 1: + message.solutionTypes[i] = 1; + break; + case "SOLUTION_TYPE_SEARCH": + case 2: + message.solutionTypes[i] = 2; + break; + } + } + return message; + }; - /** - * Properties of a ConditionBoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @interface IConditionBoostSpec - * @property {string|null} [condition] ConditionBoostSpec condition - * @property {number|null} [boost] ConditionBoostSpec boost - */ + /** + * Creates a plain object from a ServingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {google.cloud.retail.v2alpha.ServingConfig} message ServingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetControlIds = []; + object.boostControlIds = []; + object.filterControlIds = []; + object.redirectControlIds = []; + object.onewaySynonymsControlIds = []; + object.doNotAssociateControlIds = []; + object.replacementControlIds = []; + object.ignoreControlIds = []; + object.twowaySynonymsControlIds = []; + object.solutionTypes = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.modelId = ""; + object.priceRerankingLevel = ""; + object.dynamicFacetSpec = null; + object.diversityLevel = ""; + object.enableCategoryFilterLevel = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.modelId != null && message.hasOwnProperty("modelId")) + object.modelId = message.modelId; + if (message.priceRerankingLevel != null && message.hasOwnProperty("priceRerankingLevel")) + object.priceRerankingLevel = message.priceRerankingLevel; + if (message.facetControlIds && message.facetControlIds.length) { + object.facetControlIds = []; + for (var j = 0; j < message.facetControlIds.length; ++j) + object.facetControlIds[j] = message.facetControlIds[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.boostControlIds && message.boostControlIds.length) { + object.boostControlIds = []; + for (var j = 0; j < message.boostControlIds.length; ++j) + object.boostControlIds[j] = message.boostControlIds[j]; + } + if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) + object.diversityLevel = message.diversityLevel; + if (message.filterControlIds && message.filterControlIds.length) { + object.filterControlIds = []; + for (var j = 0; j < message.filterControlIds.length; ++j) + object.filterControlIds[j] = message.filterControlIds[j]; + } + if (message.redirectControlIds && message.redirectControlIds.length) { + object.redirectControlIds = []; + for (var j = 0; j < message.redirectControlIds.length; ++j) + object.redirectControlIds[j] = message.redirectControlIds[j]; + } + if (message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length) { + object.onewaySynonymsControlIds = []; + for (var j = 0; j < message.onewaySynonymsControlIds.length; ++j) + object.onewaySynonymsControlIds[j] = message.onewaySynonymsControlIds[j]; + } + if (message.doNotAssociateControlIds && message.doNotAssociateControlIds.length) { + object.doNotAssociateControlIds = []; + for (var j = 0; j < message.doNotAssociateControlIds.length; ++j) + object.doNotAssociateControlIds[j] = message.doNotAssociateControlIds[j]; + } + if (message.replacementControlIds && message.replacementControlIds.length) { + object.replacementControlIds = []; + for (var j = 0; j < message.replacementControlIds.length; ++j) + object.replacementControlIds[j] = message.replacementControlIds[j]; + } + if (message.ignoreControlIds && message.ignoreControlIds.length) { + object.ignoreControlIds = []; + for (var j = 0; j < message.ignoreControlIds.length; ++j) + object.ignoreControlIds[j] = message.ignoreControlIds[j]; + } + if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) + object.enableCategoryFilterLevel = message.enableCategoryFilterLevel; + if (message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length) { + object.twowaySynonymsControlIds = []; + for (var j = 0; j < message.twowaySynonymsControlIds.length; ++j) + object.twowaySynonymsControlIds[j] = message.twowaySynonymsControlIds[j]; + } + if (message.solutionTypes && message.solutionTypes.length) { + object.solutionTypes = []; + for (var j = 0; j < message.solutionTypes.length; ++j) + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + } + return object; + }; - /** - * Constructs a new ConditionBoostSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec - * @classdesc Represents a ConditionBoostSpec. - * @implements IConditionBoostSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - */ - function ConditionBoostSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Converts this ServingConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @instance + * @returns {Object.} JSON object + */ + ServingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * ConditionBoostSpec condition. - * @member {string} condition - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.condition = ""; + return ServingConfig; + })(); - /** - * ConditionBoostSpec boost. - * @member {number} boost - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.boost = 0; + v2alpha.ServingConfigService = (function() { - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance - */ - ConditionBoostSpec.create = function create(properties) { - return new ConditionBoostSpec(properties); - }; + /** + * Constructs a new ServingConfigService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ServingConfigService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ServingConfigService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); - return writer; - }; + (ServingConfigService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ServingConfigService; - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates new ServingConfigService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ServingConfigService} RPC service. Useful where requests and/or responses are streamed. + */ + ServingConfigService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#createServingConfig}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef CreateServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ServingConfig} [response] ServingConfig + */ - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Calls CreateServingConfig. + * @function createServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateServingConfigRequest} request CreateServingConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.createServingConfig = function createServingConfig(request, callback) { + return this.rpcCall(createServingConfig, $root.google.cloud.retail.v2alpha.CreateServingConfigRequest, $root.google.cloud.retail.v2alpha.ServingConfig, request, callback); + }, "name", { value: "CreateServingConfig" }); - /** - * Verifies a ConditionBoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConditionBoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - if (!$util.isString(message.condition)) - return "condition: string expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - return null; - }; + /** + * Calls CreateServingConfig. + * @function createServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateServingConfigRequest} request CreateServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - */ - ConditionBoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec(); - if (object.condition != null) - message.condition = String(object.condition); - if (object.boost != null) - message.boost = Number(object.boost); - return message; - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#deleteServingConfig}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef DeleteServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConditionBoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = ""; - object.boost = 0; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = message.condition; - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - return object; - }; + /** + * Calls DeleteServingConfig. + * @function deleteServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteServingConfigRequest} request DeleteServingConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfigCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.deleteServingConfig = function deleteServingConfig(request, callback) { + return this.rpcCall(deleteServingConfig, $root.google.cloud.retail.v2alpha.DeleteServingConfigRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteServingConfig" }); - /** - * Converts this ConditionBoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - * @returns {Object.} JSON object - */ - ConditionBoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Calls DeleteServingConfig. + * @function deleteServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteServingConfigRequest} request DeleteServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - return ConditionBoostSpec; - })(); + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#updateServingConfig}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef UpdateServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ServingConfig} [response] ServingConfig + */ - return BoostSpec; - })(); + /** + * Calls UpdateServingConfig. + * @function updateServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateServingConfigRequest} request UpdateServingConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.updateServingConfig = function updateServingConfig(request, callback) { + return this.rpcCall(updateServingConfig, $root.google.cloud.retail.v2alpha.UpdateServingConfigRequest, $root.google.cloud.retail.v2alpha.ServingConfig, request, callback); + }, "name", { value: "UpdateServingConfig" }); - SearchRequest.QueryExpansionSpec = (function() { + /** + * Calls UpdateServingConfig. + * @function updateServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateServingConfigRequest} request UpdateServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Properties of a QueryExpansionSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @interface IQueryExpansionSpec - * @property {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition - * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults - */ + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#getServingConfig}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef GetServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ServingConfig} [response] ServingConfig + */ - /** - * Constructs a new QueryExpansionSpec. - * @memberof google.cloud.retail.v2alpha.SearchRequest - * @classdesc Represents a QueryExpansionSpec. - * @implements IQueryExpansionSpec - * @constructor - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - */ - function QueryExpansionSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Calls GetServingConfig. + * @function getServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IGetServingConfigRequest} request GetServingConfigRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.GetServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.getServingConfig = function getServingConfig(request, callback) { + return this.rpcCall(getServingConfig, $root.google.cloud.retail.v2alpha.GetServingConfigRequest, $root.google.cloud.retail.v2alpha.ServingConfig, request, callback); + }, "name", { value: "GetServingConfig" }); - /** - * QueryExpansionSpec condition. - * @member {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition} condition - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.condition = 0; + /** + * Calls GetServingConfig. + * @function getServingConfig + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IGetServingConfigRequest} request GetServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * QueryExpansionSpec pinUnexpandedResults. - * @member {boolean} pinUnexpandedResults - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.pinUnexpandedResults = false; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#listServingConfigs}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef ListServingConfigsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListServingConfigsResponse} [response] ListServingConfigsResponse + */ - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance - */ - QueryExpansionSpec.create = function create(properties) { - return new QueryExpansionSpec(properties); - }; + /** + * Calls ListServingConfigs. + * @function listServingConfigs + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IListServingConfigsRequest} request ListServingConfigsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigsCallback} callback Node-style callback called with the error, if any, and ListServingConfigsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.listServingConfigs = function listServingConfigs(request, callback) { + return this.rpcCall(listServingConfigs, $root.google.cloud.retail.v2alpha.ListServingConfigsRequest, $root.google.cloud.retail.v2alpha.ListServingConfigsResponse, request, callback); + }, "name", { value: "ListServingConfigs" }); - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); - if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); - return writer; - }; + /** + * Calls ListServingConfigs. + * @function listServingConfigs + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IListServingConfigsRequest} request ListServingConfigsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#addControl}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef AddControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ServingConfig} [response] ServingConfig + */ + + /** + * Calls AddControl. + * @function addControl + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IAddControlRequest} request AddControlRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.AddControlCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.addControl = function addControl(request, callback) { + return this.rpcCall(addControl, $root.google.cloud.retail.v2alpha.AddControlRequest, $root.google.cloud.retail.v2alpha.ServingConfig, request, callback); + }, "name", { value: "AddControl" }); + + /** + * Calls AddControl. + * @function addControl + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IAddControlRequest} request AddControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#removeControl}. + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @typedef RemoveControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ServingConfig} [response] ServingConfig + */ - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Calls RemoveControl. + * @function removeControl + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveControlRequest} request RemoveControlRequest message or plain object + * @param {google.cloud.retail.v2alpha.ServingConfigService.RemoveControlCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.removeControl = function removeControl(request, callback) { + return this.rpcCall(removeControl, $root.google.cloud.retail.v2alpha.RemoveControlRequest, $root.google.cloud.retail.v2alpha.ServingConfig, request, callback); + }, "name", { value: "RemoveControl" }); - /** - * Verifies a QueryExpansionSpec message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - switch (message.condition) { - default: - return "condition: enum value expected"; - case 0: - case 1: - case 3: - break; - } - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - if (typeof message.pinUnexpandedResults !== "boolean") - return "pinUnexpandedResults: boolean expected"; - return null; - }; + /** + * Calls RemoveControl. + * @function removeControl + * @memberof google.cloud.retail.v2alpha.ServingConfigService + * @instance + * @param {google.cloud.retail.v2alpha.IRemoveControlRequest} request RemoveControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - */ - QueryExpansionSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); - switch (object.condition) { - case "CONDITION_UNSPECIFIED": - case 0: - message.condition = 0; - break; - case "DISABLED": - case 1: - message.condition = 1; - break; - case "AUTO": - case 3: - message.condition = 3; - break; - } - if (object.pinUnexpandedResults != null) - message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); - return message; - }; + return ServingConfigService; + })(); - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; - object.pinUnexpandedResults = false; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - object.pinUnexpandedResults = message.pinUnexpandedResults; - return object; - }; + v2alpha.CreateServingConfigRequest = (function() { - /** - * Converts this QueryExpansionSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Properties of a CreateServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICreateServingConfigRequest + * @property {string|null} [parent] CreateServingConfigRequest parent + * @property {google.cloud.retail.v2alpha.IServingConfig|null} [servingConfig] CreateServingConfigRequest servingConfig + * @property {string|null} [servingConfigId] CreateServingConfigRequest servingConfigId + */ - /** - * Condition enum. - * @name google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition - * @enum {number} - * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} AUTO=3 AUTO value - */ - QueryExpansionSpec.Condition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[3] = "AUTO"] = 3; - return values; - })(); + /** + * Constructs a new CreateServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CreateServingConfigRequest. + * @implements ICreateServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICreateServingConfigRequest=} [properties] Properties to set + */ + function CreateServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - return QueryExpansionSpec; - })(); + /** + * CreateServingConfigRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.parent = ""; /** - * RelevanceThreshold enum. - * @name google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold - * @enum {number} - * @property {number} RELEVANCE_THRESHOLD_UNSPECIFIED=0 RELEVANCE_THRESHOLD_UNSPECIFIED value - * @property {number} HIGH=1 HIGH value - * @property {number} MEDIUM=2 MEDIUM value - * @property {number} LOW=3 LOW value - * @property {number} LOWEST=4 LOWEST value + * CreateServingConfigRequest servingConfig. + * @member {google.cloud.retail.v2alpha.IServingConfig|null|undefined} servingConfig + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @instance */ - SearchRequest.RelevanceThreshold = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RELEVANCE_THRESHOLD_UNSPECIFIED"] = 0; - values[valuesById[1] = "HIGH"] = 1; - values[valuesById[2] = "MEDIUM"] = 2; - values[valuesById[3] = "LOW"] = 3; - values[valuesById[4] = "LOWEST"] = 4; - return values; - })(); + CreateServingConfigRequest.prototype.servingConfig = null; /** - * SearchMode enum. - * @name google.cloud.retail.v2alpha.SearchRequest.SearchMode - * @enum {number} - * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value - * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value - * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + * CreateServingConfigRequest servingConfigId. + * @member {string} servingConfigId + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @instance */ - SearchRequest.SearchMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; - values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; - return values; - })(); + CreateServingConfigRequest.prototype.servingConfigId = ""; - return SearchRequest; - })(); + /** + * Creates a new CreateServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateServingConfigRequest} CreateServingConfigRequest instance + */ + CreateServingConfigRequest.create = function create(properties) { + return new CreateServingConfigRequest(properties); + }; - v2alpha.SearchResponse = (function() { + /** + * Encodes the specified CreateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateServingConfigRequest} message CreateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + $root.google.cloud.retail.v2alpha.ServingConfig.encode(message.servingConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.servingConfigId != null && Object.hasOwnProperty.call(message, "servingConfigId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.servingConfigId); + return writer; + }; /** - * Properties of a SearchResponse. - * @memberof google.cloud.retail.v2alpha - * @interface ISearchResponse - * @property {Array.|null} [results] SearchResponse results - * @property {Array.|null} [facets] SearchResponse facets - * @property {number|null} [totalSize] SearchResponse totalSize - * @property {string|null} [correctedQuery] SearchResponse correctedQuery - * @property {string|null} [attributionToken] SearchResponse attributionToken - * @property {string|null} [nextPageToken] SearchResponse nextPageToken - * @property {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo - * @property {string|null} [redirectUri] SearchResponse redirectUri - * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * Encodes the specified CreateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateServingConfigRequest} message CreateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + CreateServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Constructs a new SearchResponse. - * @memberof google.cloud.retail.v2alpha - * @classdesc Represents a SearchResponse. - * @implements ISearchResponse - * @constructor - * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set + * Decodes a CreateServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CreateServingConfigRequest} CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - function SearchResponse(properties) { - this.results = []; - this.facets = []; - this.appliedControls = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + CreateServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32()); + break; + case 3: + message.servingConfigId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * SearchResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance + * Decodes a CreateServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CreateServingConfigRequest} CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.prototype.results = $util.emptyArray; + CreateServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * SearchResponse facets. - * @member {Array.} facets - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance + * Verifies a CreateServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.prototype.facets = $util.emptyArray; + CreateServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) { + var error = $root.google.cloud.retail.v2alpha.ServingConfig.verify(message.servingConfig); + if (error) + return "servingConfig." + error; + } + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) + if (!$util.isString(message.servingConfigId)) + return "servingConfigId: string expected"; + return null; + }; /** - * SearchResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance + * Creates a CreateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CreateServingConfigRequest} CreateServingConfigRequest */ - SearchResponse.prototype.totalSize = 0; + CreateServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CreateServingConfigRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.servingConfig != null) { + if (typeof object.servingConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateServingConfigRequest.servingConfig: object expected"); + message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.fromObject(object.servingConfig); + } + if (object.servingConfigId != null) + message.servingConfigId = String(object.servingConfigId); + return message; + }; /** - * SearchResponse correctedQuery. - * @member {string} correctedQuery - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance + * Creates a plain object from a CreateServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.CreateServingConfigRequest} message CreateServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - SearchResponse.prototype.correctedQuery = ""; + CreateServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.servingConfig = null; + object.servingConfigId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.toObject(message.servingConfig, options); + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) + object.servingConfigId = message.servingConfigId; + return object; + }; /** - * SearchResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2alpha.SearchResponse + * Converts this CreateServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest * @instance + * @returns {Object.} JSON object */ - SearchResponse.prototype.attributionToken = ""; + CreateServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateServingConfigRequest; + })(); + + v2alpha.UpdateServingConfigRequest = (function() { /** - * SearchResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance + * Properties of an UpdateServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateServingConfigRequest + * @property {google.cloud.retail.v2alpha.IServingConfig|null} [servingConfig] UpdateServingConfigRequest servingConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateServingConfigRequest updateMask */ - SearchResponse.prototype.nextPageToken = ""; /** - * SearchResponse queryExpansionInfo. - * @member {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @instance + * Constructs a new UpdateServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateServingConfigRequest. + * @implements IUpdateServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateServingConfigRequest=} [properties] Properties to set */ - SearchResponse.prototype.queryExpansionInfo = null; + function UpdateServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * SearchResponse redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2alpha.SearchResponse + * UpdateServingConfigRequest servingConfig. + * @member {google.cloud.retail.v2alpha.IServingConfig|null|undefined} servingConfig + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @instance */ - SearchResponse.prototype.redirectUri = ""; + UpdateServingConfigRequest.prototype.servingConfig = null; /** - * SearchResponse appliedControls. - * @member {Array.} appliedControls - * @memberof google.cloud.retail.v2alpha.SearchResponse + * UpdateServingConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @instance */ - SearchResponse.prototype.appliedControls = $util.emptyArray; + UpdateServingConfigRequest.prototype.updateMask = null; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new UpdateServingConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @static - * @param {google.cloud.retail.v2alpha.ISearchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse instance - */ - SearchResponse.create = function create(properties) { - return new SearchResponse(properties); - }; - - /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.facets != null && message.facets.length) - for (var i = 0; i < message.facets.length; ++i) - $root.google.cloud.retail.v2alpha.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); - if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); - if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) - $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); - if (message.appliedControls != null && message.appliedControls.length) - for (var i = 0; i < message.appliedControls.length; ++i) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + * @param {google.cloud.retail.v2alpha.IUpdateServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateServingConfigRequest} UpdateServingConfigRequest instance + */ + UpdateServingConfigRequest.create = function create(properties) { + return new UpdateServingConfigRequest(properties); + }; + + /** + * Encodes the specified UpdateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateServingConfigRequest} message UpdateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + $root.google.cloud.retail.v2alpha.ServingConfig.encode(message.servingConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.verify|verify} messages. + * Encodes the specified UpdateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateServingConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static - * @param {google.cloud.retail.v2alpha.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.IUpdateServingConfigRequest} message UpdateServingConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + UpdateServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2alpha.UpdateServingConfigRequest} UpdateServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decode = function decode(reader, length) { + UpdateServingConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateServingConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); + message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32()); break; case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); - break; - case 3: - message.totalSize = reader.int32(); - break; - case 4: - message.correctedQuery = reader.string(); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); - break; - case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - case 10: - message.redirectUri = reader.string(); - break; - case 12: - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -51612,1325 +60352,1363 @@ }; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2alpha.UpdateServingConfigRequest} UpdateServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decodeDelimited = function decodeDelimited(reader) { + UpdateServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchResponse message. + * Verifies an UpdateServingConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.verify = function verify(message) { + UpdateServingConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.facets != null && message.hasOwnProperty("facets")) { - if (!Array.isArray(message.facets)) - return "facets: array expected"; - for (var i = 0; i < message.facets.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.verify(message.facets[i]); - if (error) - return "facets." + error; - } - } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - if (!$util.isString(message.correctedQuery)) - return "correctedQuery: string expected"; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) { + var error = $root.google.cloud.retail.v2alpha.ServingConfig.verify(message.servingConfig); if (error) - return "queryExpansionInfo." + error; + return "servingConfig." + error; } - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; - if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { - if (!Array.isArray(message.appliedControls)) - return "appliedControls: array expected"; - for (var i = 0; i < message.appliedControls.length; ++i) - if (!$util.isString(message.appliedControls[i])) - return "appliedControls: string[] expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } return null; }; /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateServingConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2alpha.UpdateServingConfigRequest} UpdateServingConfigRequest */ - SearchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse) + UpdateServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateServingConfigRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.fromObject(object.results[i]); - } - } - if (object.facets) { - if (!Array.isArray(object.facets)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: array expected"); - message.facets = []; - for (var i = 0; i < object.facets.length; ++i) { - if (typeof object.facets[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.facets: object expected"); - message.facets[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.fromObject(object.facets[i]); - } - } - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; - if (object.correctedQuery != null) - message.correctedQuery = String(object.correctedQuery); - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.queryExpansionInfo != null) { - if (typeof object.queryExpansionInfo !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.queryExpansionInfo: object expected"); - message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + var message = new $root.google.cloud.retail.v2alpha.UpdateServingConfigRequest(); + if (object.servingConfig != null) { + if (typeof object.servingConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateServingConfigRequest.servingConfig: object expected"); + message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.fromObject(object.servingConfig); } - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); - if (object.appliedControls) { - if (!Array.isArray(object.appliedControls)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.appliedControls: array expected"); - message.appliedControls = []; - for (var i = 0; i < object.appliedControls.length; ++i) - message.appliedControls[i] = String(object.appliedControls[i]); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateServingConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } return message; }; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * Creates a plain object from an UpdateServingConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @static - * @param {google.cloud.retail.v2alpha.SearchResponse} message SearchResponse + * @param {google.cloud.retail.v2alpha.UpdateServingConfigRequest} message UpdateServingConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchResponse.toObject = function toObject(message, options) { + UpdateServingConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.facets = []; - object.appliedControls = []; - } if (options.defaults) { - object.totalSize = 0; - object.correctedQuery = ""; - object.attributionToken = ""; - object.nextPageToken = ""; - object.queryExpansionInfo = null; - object.redirectUri = ""; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.toObject(message.results[j], options); - } - if (message.facets && message.facets.length) { - object.facets = []; - for (var j = 0; j < message.facets.length; ++j) - object.facets[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.toObject(message.facets[j], options); - } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - object.correctedQuery = message.correctedQuery; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) - object.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; - if (message.appliedControls && message.appliedControls.length) { - object.appliedControls = []; - for (var j = 0; j < message.appliedControls.length; ++j) - object.appliedControls[j] = message.appliedControls[j]; + object.servingConfig = null; + object.updateMask = null; } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.toObject(message.servingConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this SearchResponse to JSON. + * Converts this UpdateServingConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest * @instance * @returns {Object.} JSON object */ - SearchResponse.prototype.toJSON = function toJSON() { + UpdateServingConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - SearchResponse.SearchResult = (function() { - - /** - * Properties of a SearchResult. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @interface ISearchResult - * @property {string|null} [id] SearchResult id - * @property {google.cloud.retail.v2alpha.IProduct|null} [product] SearchResult product - * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount - * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields - * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues - */ - - /** - * Constructs a new SearchResult. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @classdesc Represents a SearchResult. - * @implements ISearchResult - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set - */ - function SearchResult(properties) { - this.matchingVariantFields = {}; - this.variantRollupValues = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + }; - /** - * SearchResult id. - * @member {string} id - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.id = ""; + return UpdateServingConfigRequest; + })(); - /** - * SearchResult product. - * @member {google.cloud.retail.v2alpha.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.product = null; + v2alpha.DeleteServingConfigRequest = (function() { - /** - * SearchResult matchingVariantCount. - * @member {number} matchingVariantCount - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantCount = 0; + /** + * Properties of a DeleteServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IDeleteServingConfigRequest + * @property {string|null} [name] DeleteServingConfigRequest name + */ - /** - * SearchResult matchingVariantFields. - * @member {Object.} matchingVariantFields - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantFields = $util.emptyObject; + /** + * Constructs a new DeleteServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a DeleteServingConfigRequest. + * @implements IDeleteServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IDeleteServingConfigRequest=} [properties] Properties to set + */ + function DeleteServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * SearchResult variantRollupValues. - * @member {Object.} variantRollupValues - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.variantRollupValues = $util.emptyObject; + /** + * DeleteServingConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @instance + */ + DeleteServingConfigRequest.prototype.name = ""; - /** - * Creates a new SearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult instance - */ - SearchResult.create = function create(properties) { - return new SearchResult(properties); - }; + /** + * Creates a new DeleteServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteServingConfigRequest} DeleteServingConfigRequest instance + */ + DeleteServingConfigRequest.create = function create(properties) { + return new DeleteServingConfigRequest(properties); + }; - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2alpha.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); - if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) - for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) - for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * Encodes the specified DeleteServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteServingConfigRequest} message DeleteServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.SearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified DeleteServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteServingConfigRequest} message DeleteServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 3: - message.matchingVariantCount = reader.int32(); - break; - case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.variantRollupValues[key] = value; - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.DeleteServingConfigRequest} DeleteServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; + + /** + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.DeleteServingConfigRequest} DeleteServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Verifies a DeleteServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; - /** - * Verifies a SearchResult message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2alpha.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - if (!$util.isInteger(message.matchingVariantCount)) - return "matchingVariantCount: integer expected"; - if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { - if (!$util.isObject(message.matchingVariantFields)) - return "matchingVariantFields: object expected"; - var key = Object.keys(message.matchingVariantFields); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); - if (error) - return "matchingVariantFields." + error; - } - } - if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { - if (!$util.isObject(message.variantRollupValues)) - return "variantRollupValues: object expected"; - var key = Object.keys(message.variantRollupValues); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); - if (error) - return "variantRollupValues." + error; - } - } - return null; - }; + /** + * Creates a DeleteServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.DeleteServingConfigRequest} DeleteServingConfigRequest + */ + DeleteServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.DeleteServingConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.SearchResult} SearchResult - */ - SearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.SearchResult(); - if (object.id != null) - message.id = String(object.id); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.product: object expected"); - message.product = $root.google.cloud.retail.v2alpha.Product.fromObject(object.product); - } - if (object.matchingVariantCount != null) - message.matchingVariantCount = object.matchingVariantCount | 0; - if (object.matchingVariantFields) { - if (typeof object.matchingVariantFields !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields = {}; - for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { - if (typeof object.matchingVariantFields[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); - } - } - if (object.variantRollupValues) { - if (typeof object.variantRollupValues !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues = {}; - for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { - if (typeof object.variantRollupValues[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); - } - } - return message; - }; + /** + * Creates a plain object from a DeleteServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.DeleteServingConfigRequest} message DeleteServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.SearchResult} message SearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) { - object.matchingVariantFields = {}; - object.variantRollupValues = {}; - } - if (options.defaults) { - object.id = ""; - object.product = null; - object.matchingVariantCount = 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2alpha.Product.toObject(message.product, options); - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - object.matchingVariantCount = message.matchingVariantCount; - var keys2; - if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { - object.matchingVariantFields = {}; - for (var j = 0; j < keys2.length; ++j) - object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); - } - if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { - object.variantRollupValues = {}; - for (var j = 0; j < keys2.length; ++j) - object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + /** + * Converts this DeleteServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteServingConfigRequest; + })(); + + v2alpha.GetServingConfigRequest = (function() { + + /** + * Properties of a GetServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IGetServingConfigRequest + * @property {string|null} [name] GetServingConfigRequest name + */ + + /** + * Constructs a new GetServingConfigRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a GetServingConfigRequest. + * @implements IGetServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IGetServingConfigRequest=} [properties] Properties to set + */ + function GetServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetServingConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @instance + */ + GetServingConfigRequest.prototype.name = ""; + + /** + * Creates a new GetServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.GetServingConfigRequest} GetServingConfigRequest instance + */ + GetServingConfigRequest.create = function create(properties) { + return new GetServingConfigRequest(properties); + }; + + /** + * Encodes the specified GetServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.GetServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetServingConfigRequest} message GetServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.GetServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.IGetServingConfigRequest} message GetServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.GetServingConfigRequest} GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.GetServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } + } + return message; + }; + + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.GetServingConfigRequest} GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.GetServingConfigRequest} GetServingConfigRequest + */ + GetServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.GetServingConfigRequest) return object; - }; + var message = new $root.google.cloud.retail.v2alpha.GetServingConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Converts this SearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult - * @instance - * @returns {Object.} JSON object - */ - SearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2alpha.GetServingConfigRequest} message GetServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; - return SearchResult; - })(); + /** + * Converts this GetServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - SearchResponse.Facet = (function() { + return GetServingConfigRequest; + })(); - /** - * Properties of a Facet. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @interface IFacet - * @property {string|null} [key] Facet key - * @property {Array.|null} [values] Facet values - * @property {boolean|null} [dynamicFacet] Facet dynamicFacet - */ + v2alpha.ListServingConfigsRequest = (function() { - /** - * Constructs a new Facet. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @classdesc Represents a Facet. - * @implements IFacet - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set - */ - function Facet(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a ListServingConfigsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListServingConfigsRequest + * @property {string|null} [parent] ListServingConfigsRequest parent + * @property {number|null} [pageSize] ListServingConfigsRequest pageSize + * @property {string|null} [pageToken] ListServingConfigsRequest pageToken + */ - /** - * Facet key. - * @member {string} key - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - */ - Facet.prototype.key = ""; + /** + * Constructs a new ListServingConfigsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListServingConfigsRequest. + * @implements IListServingConfigsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IListServingConfigsRequest=} [properties] Properties to set + */ + function ListServingConfigsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Facet values. - * @member {Array.} values - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - */ - Facet.prototype.values = $util.emptyArray; + /** + * ListServingConfigsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @instance + */ + ListServingConfigsRequest.prototype.parent = ""; + + /** + * ListServingConfigsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @instance + */ + ListServingConfigsRequest.prototype.pageSize = 0; + + /** + * ListServingConfigsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @instance + */ + ListServingConfigsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListServingConfigsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListServingConfigsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListServingConfigsRequest} ListServingConfigsRequest instance + */ + ListServingConfigsRequest.create = function create(properties) { + return new ListServingConfigsRequest(properties); + }; + + /** + * Encodes the specified ListServingConfigsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListServingConfigsRequest} message ListServingConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListServingConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListServingConfigsRequest} message ListServingConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListServingConfigsRequest} ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListServingConfigsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Facet dynamicFacet. - * @member {boolean} dynamicFacet - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - */ - Facet.prototype.dynamicFacet = false; + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListServingConfigsRequest} ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a new Facet instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet instance - */ - Facet.create = function create(properties) { - return new Facet(properties); - }; + /** + * Verifies a ListServingConfigsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServingConfigsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); - return writer; - }; + /** + * Creates a ListServingConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListServingConfigsRequest} ListServingConfigsRequest + */ + ListServingConfigsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListServingConfigsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListServingConfigsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a plain object from a ListServingConfigsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {google.cloud.retail.v2alpha.ListServingConfigsRequest} message ListServingConfigsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServingConfigsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; - /** - * Decodes a Facet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Converts this ListServingConfigsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @instance + * @returns {Object.} JSON object + */ + ListServingConfigsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return ListServingConfigsRequest; + })(); - /** - * Verifies a Facet message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Facet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - if (typeof message.dynamicFacet !== "boolean") - return "dynamicFacet: boolean expected"; - return null; - }; + v2alpha.ListServingConfigsResponse = (function() { - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet} Facet - */ - Facet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet(); - if (object.key != null) - message.key = String(object.key); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.values: object expected"); - message.values[i] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); - } - } - if (object.dynamicFacet != null) - message.dynamicFacet = Boolean(object.dynamicFacet); - return message; - }; + /** + * Properties of a ListServingConfigsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IListServingConfigsResponse + * @property {Array.|null} [servingConfigs] ListServingConfigsResponse servingConfigs + * @property {string|null} [nextPageToken] ListServingConfigsResponse nextPageToken + */ - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet} message Facet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Facet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (options.defaults) { - object.key = ""; - object.dynamicFacet = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - object.dynamicFacet = message.dynamicFacet; - return object; - }; + /** + * Constructs a new ListServingConfigsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListServingConfigsResponse. + * @implements IListServingConfigsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IListServingConfigsResponse=} [properties] Properties to set + */ + function ListServingConfigsResponse(properties) { + this.servingConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Converts this Facet to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @instance - * @returns {Object.} JSON object - */ - Facet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * ListServingConfigsResponse servingConfigs. + * @member {Array.} servingConfigs + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @instance + */ + ListServingConfigsResponse.prototype.servingConfigs = $util.emptyArray; - Facet.FacetValue = (function() { + /** + * ListServingConfigsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @instance + */ + ListServingConfigsResponse.prototype.nextPageToken = ""; - /** - * Properties of a FacetValue. - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @interface IFacetValue - * @property {string|null} [value] FacetValue value - * @property {google.cloud.retail.v2alpha.IInterval|null} [interval] FacetValue interval - * @property {number|Long|null} [count] FacetValue count - */ + /** + * Creates a new ListServingConfigsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListServingConfigsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListServingConfigsResponse} ListServingConfigsResponse instance + */ + ListServingConfigsResponse.create = function create(properties) { + return new ListServingConfigsResponse(properties); + }; - /** - * Constructs a new FacetValue. - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet - * @classdesc Represents a FacetValue. - * @implements IFacetValue - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - */ - function FacetValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified ListServingConfigsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListServingConfigsResponse} message ListServingConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfigs != null && message.servingConfigs.length) + for (var i = 0; i < message.servingConfigs.length; ++i) + $root.google.cloud.retail.v2alpha.ServingConfig.encode(message.servingConfigs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; - /** - * FacetValue value. - * @member {string|null|undefined} value - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.value = null; + /** + * Encodes the specified ListServingConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListServingConfigsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListServingConfigsResponse} message ListServingConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * FacetValue interval. - * @member {google.cloud.retail.v2alpha.IInterval|null|undefined} interval - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.interval = null; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListServingConfigsResponse} ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListServingConfigsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.servingConfigs && message.servingConfigs.length)) + message.servingConfigs = []; + message.servingConfigs.push($root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * FacetValue count. - * @member {number|Long} count - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListServingConfigsResponse} ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Verifies a ListServingConfigsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServingConfigsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfigs != null && message.hasOwnProperty("servingConfigs")) { + if (!Array.isArray(message.servingConfigs)) + return "servingConfigs: array expected"; + for (var i = 0; i < message.servingConfigs.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.ServingConfig.verify(message.servingConfigs[i]); + if (error) + return "servingConfigs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; - /** - * FacetValue facetValue. - * @member {"value"|"interval"|undefined} facetValue - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - */ - Object.defineProperty(FacetValue.prototype, "facetValue", { - get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Creates a ListServingConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListServingConfigsResponse} ListServingConfigsResponse + */ + ListServingConfigsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListServingConfigsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListServingConfigsResponse(); + if (object.servingConfigs) { + if (!Array.isArray(object.servingConfigs)) + throw TypeError(".google.cloud.retail.v2alpha.ListServingConfigsResponse.servingConfigs: array expected"); + message.servingConfigs = []; + for (var i = 0; i < object.servingConfigs.length; ++i) { + if (typeof object.servingConfigs[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListServingConfigsResponse.servingConfigs: object expected"); + message.servingConfigs[i] = $root.google.cloud.retail.v2alpha.ServingConfig.fromObject(object.servingConfigs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListServingConfigsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2alpha.ListServingConfigsResponse} message ListServingConfigsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServingConfigsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.servingConfigs && message.servingConfigs.length) { + object.servingConfigs = []; + for (var j = 0; j < message.servingConfigs.length; ++j) + object.servingConfigs[j] = $root.google.cloud.retail.v2alpha.ServingConfig.toObject(message.servingConfigs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; - /** - * Creates a new FacetValue instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue instance - */ - FacetValue.create = function create(properties) { - return new FacetValue(properties); - }; + /** + * Converts this ListServingConfigsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @instance + * @returns {Object.} JSON object + */ + ListServingConfigsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) - $root.google.cloud.retail.v2alpha.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); - return writer; - }; + return ListServingConfigsResponse; + })(); - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + v2alpha.AddControlRequest = (function() { - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; - case 3: - message.count = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Properties of an AddControlRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IAddControlRequest + * @property {string|null} [servingConfig] AddControlRequest servingConfig + * @property {string|null} [controlId] AddControlRequest controlId + */ - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Constructs a new AddControlRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an AddControlRequest. + * @implements IAddControlRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IAddControlRequest=} [properties] Properties to set + */ + function AddControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Verifies a FacetValue message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.value != null && message.hasOwnProperty("value")) { - properties.facetValue = 1; - if (!$util.isString(message.value)) - return "value: string expected"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - if (properties.facetValue === 1) - return "facetValue: multiple values"; - properties.facetValue = 1; - { - var error = $root.google.cloud.retail.v2alpha.Interval.verify(message.interval); - if (error) - return "interval." + error; - } - } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - return null; - }; + /** + * AddControlRequest servingConfig. + * @member {string} servingConfig + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @instance + */ + AddControlRequest.prototype.servingConfig = ""; - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} FacetValue - */ - FacetValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue(); - if (object.value != null) - message.value = String(object.value); - if (object.interval != null) { - if (typeof object.interval !== "object") - throw TypeError(".google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval: object expected"); - message.interval = $root.google.cloud.retail.v2alpha.Interval.fromObject(object.interval); - } - if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - return message; - }; + /** + * AddControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @instance + */ + AddControlRequest.prototype.controlId = ""; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue} message FacetValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) { - object.value = message.value; - if (options.oneofs) - object.facetValue = "value"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - object.interval = $root.google.cloud.retail.v2alpha.Interval.toObject(message.interval, options); - if (options.oneofs) - object.facetValue = "interval"; - } - if (message.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - return object; - }; + /** + * Creates a new AddControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.AddControlRequest} AddControlRequest instance + */ + AddControlRequest.create = function create(properties) { + return new AddControlRequest(properties); + }; + + /** + * Encodes the specified AddControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.AddControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddControlRequest} message AddControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfig); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.controlId); + return writer; + }; - /** - * Converts this FacetValue to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue - * @instance - * @returns {Object.} JSON object - */ - FacetValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified AddControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.AddControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IAddControlRequest} message AddControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - return FacetValue; - })(); + /** + * Decodes an AddControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.AddControlRequest} AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.AddControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.servingConfig = reader.string(); + break; + case 2: + message.controlId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - return Facet; - })(); + /** + * Decodes an AddControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.AddControlRequest} AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - SearchResponse.QueryExpansionInfo = (function() { + /** + * Verifies an AddControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + if (!$util.isString(message.servingConfig)) + return "servingConfig: string expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; - /** - * Properties of a QueryExpansionInfo. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @interface IQueryExpansionInfo - * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery - * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount - */ + /** + * Creates an AddControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.AddControlRequest} AddControlRequest + */ + AddControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.AddControlRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.AddControlRequest(); + if (object.servingConfig != null) + message.servingConfig = String(object.servingConfig); + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; - /** - * Constructs a new QueryExpansionInfo. - * @memberof google.cloud.retail.v2alpha.SearchResponse - * @classdesc Represents a QueryExpansionInfo. - * @implements IQueryExpansionInfo - * @constructor - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - */ - function QueryExpansionInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a plain object from an AddControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {google.cloud.retail.v2alpha.AddControlRequest} message AddControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = ""; + object.controlId = ""; } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = message.servingConfig; + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; - /** - * QueryExpansionInfo expandedQuery. - * @member {boolean} expandedQuery - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.expandedQuery = false; + /** + * Converts this AddControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @instance + * @returns {Object.} JSON object + */ + AddControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * QueryExpansionInfo pinnedResultCount. - * @member {number|Long} pinnedResultCount - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + return AddControlRequest; + })(); - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance - */ - QueryExpansionInfo.create = function create(properties) { - return new QueryExpansionInfo(properties); - }; + v2alpha.RemoveControlRequest = (function() { - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); - if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); - return writer; - }; + /** + * Properties of a RemoveControlRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IRemoveControlRequest + * @property {string|null} [servingConfig] RemoveControlRequest servingConfig + * @property {string|null} [controlId] RemoveControlRequest controlId + */ + + /** + * Constructs a new RemoveControlRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a RemoveControlRequest. + * @implements IRemoveControlRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IRemoveControlRequest=} [properties] Properties to set + */ + function RemoveControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveControlRequest servingConfig. + * @member {string} servingConfig + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @instance + */ + RemoveControlRequest.prototype.servingConfig = ""; + + /** + * RemoveControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @instance + */ + RemoveControlRequest.prototype.controlId = ""; + + /** + * Creates a new RemoveControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.RemoveControlRequest} RemoveControlRequest instance + */ + RemoveControlRequest.create = function create(properties) { + return new RemoveControlRequest(properties); + }; + + /** + * Encodes the specified RemoveControlRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveControlRequest} message RemoveControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfig); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.controlId); + return writer; + }; - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified RemoveControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.RemoveControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2alpha.IRemoveControlRequest} message RemoveControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.RemoveControlRequest} RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.RemoveControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.servingConfig = reader.string(); + break; + case 2: + message.controlId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a QueryExpansionInfo message. - * @function verify - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - if (typeof message.expandedQuery !== "boolean") - return "expandedQuery: boolean expected"; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) - return "pinnedResultCount: integer|Long expected"; - return null; - }; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.RemoveControlRequest} RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - */ - QueryExpansionInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo) - return object; - var message = new $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo(); - if (object.expandedQuery != null) - message.expandedQuery = Boolean(object.expandedQuery); - if (object.pinnedResultCount != null) - if ($util.Long) - (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; - else if (typeof object.pinnedResultCount === "string") - message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); - else if (typeof object.pinnedResultCount === "number") - message.pinnedResultCount = object.pinnedResultCount; - else if (typeof object.pinnedResultCount === "object") - message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); - return message; - }; + /** + * Verifies a RemoveControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + if (!$util.isString(message.servingConfig)) + return "servingConfig: string expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.expandedQuery = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pinnedResultCount = options.longs === String ? "0" : 0; - } - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - object.expandedQuery = message.expandedQuery; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (typeof message.pinnedResultCount === "number") - object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; - else - object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + /** + * Creates a RemoveControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.RemoveControlRequest} RemoveControlRequest + */ + RemoveControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.RemoveControlRequest) return object; - }; + var message = new $root.google.cloud.retail.v2alpha.RemoveControlRequest(); + if (object.servingConfig != null) + message.servingConfig = String(object.servingConfig); + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; - /** - * Converts this QueryExpansionInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a RemoveControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2alpha.RemoveControlRequest} message RemoveControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = ""; + object.controlId = ""; + } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = message.servingConfig; + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; - return QueryExpansionInfo; - })(); + /** + * Converts this RemoveControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return SearchResponse; + return RemoveControlRequest; })(); v2alpha.UserEventService = (function() { diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index bce4cdd8b67..daf9f12a04d 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -2664,6 +2664,173 @@ } } }, + "CatalogAttribute": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inUse": { + "type": "bool", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { + "type": "AttributeType", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "indexableOption": { + "type": "IndexableOption", + "id": 5 + }, + "dynamicFacetableOption": { + "type": "DynamicFacetableOption", + "id": 6 + }, + "searchableOption": { + "type": "SearchableOption", + "id": 7 + } + }, + "nested": { + "AttributeType": { + "values": { + "UNKNOWN": 0, + "TEXTUAL": 1, + "NUMERICAL": 2 + } + }, + "IndexableOption": { + "values": { + "INDEXABLE_OPTION_UNSPECIFIED": 0, + "INDEXABLE_ENABLED": 1, + "INDEXABLE_DISABLED": 2 + } + }, + "DynamicFacetableOption": { + "values": { + "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": 0, + "DYNAMIC_FACETABLE_ENABLED": 1, + "DYNAMIC_FACETABLE_DISABLED": 2 + } + }, + "SearchableOption": { + "values": { + "SEARCHABLE_OPTION_UNSPECIFIED": 0, + "SEARCHABLE_ENABLED": 1, + "SEARCHABLE_DISABLED": 2 + } + } + } + }, + "AttributesConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/AttributesConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "catalogAttributes": { + "keyType": "string", + "type": "CatalogAttribute", + "id": 2 + }, + "attributeConfigLevel": { + "type": "AttributeConfigLevel", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CompletionConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/CompletionConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "matchingOrder": { + "type": "string", + "id": 2 + }, + "maxSuggestions": { + "type": "int32", + "id": 3 + }, + "minPrefixLength": { + "type": "int32", + "id": 4 + }, + "autoLearning": { + "type": "bool", + "id": 11 + }, + "suggestionsInputConfig": { + "type": "CompletionDataInputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastSuggestionsImportOperation": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "denylistInputConfig": { + "type": "CompletionDataInputConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastDenylistImportOperation": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "allowlistInputConfig": { + "type": "CompletionDataInputConfig", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastAllowlistImportOperation": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, "MerchantCenterLink": { "fields": { "merchantCenterAccountId": { @@ -2734,6 +2901,13 @@ } } }, + "AttributeConfigLevel": { + "values": { + "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": 0, + "PRODUCT_LEVEL_ATTRIBUTE_CONFIG": 1, + "CATALOG_LEVEL_ATTRIBUTE_CONFIG": 2 + } + }, "SolutionType": { "values": { "SOLUTION_TYPE_UNSPECIFIED": 0, @@ -2741,6 +2915,13 @@ "SOLUTION_TYPE_SEARCH": 2 } }, + "SearchSolutionUseCase": { + "values": { + "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": 0, + "SEARCH_SOLUTION_USE_CASE_SEARCH": 1, + "SEARCH_SOLUTION_USE_CASE_BROWSE": 2 + } + }, "Condition": { "fields": { "queryTerms": { @@ -3161,14 +3342,6 @@ } } }, - "Promotion": { - "fields": { - "promotionId": { - "type": "string", - "id": 1 - } - } - }, "LocalInventory": { "fields": { "placeId": { @@ -3183,6 +3356,14 @@ "keyType": "string", "type": "CustomAttribute", "id": 3 + }, + "fulfillmentTypes": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } } } }, @@ -3294,7 +3475,10 @@ }, "requestId": { "type": "string", - "id": 6 + "id": 6, + "options": { + "deprecated": true + } }, "inputConfig": { "type": "ProductInputConfig", @@ -3473,7 +3657,10 @@ }, "requestId": { "type": "string", - "id": 5 + "id": 5, + "options": { + "deprecated": true + } }, "notificationPubsubTopic": { "type": "string", @@ -3730,6 +3917,14 @@ } } }, + "Promotion": { + "fields": { + "promotionId": { + "type": "string", + "id": 1 + } + } + }, "UserEvent": { "fields": { "eventType": { @@ -3966,34 +4161,158 @@ "(google.api.method_signature)": "catalog" } ] - } - } - }, - "ListCatalogsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } }, - "pageSize": { - "type": "int32", - "id": 2 + "GetCompletionConfig": { + "requestType": "GetCompletionConfigRequest", + "responseType": "CompletionConfig", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/completionConfig}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/completionConfig}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListCatalogsResponse": { - "fields": { - "catalogs": { - "rule": "repeated", - "type": "Catalog", + "UpdateCompletionConfig": { + "requestType": "UpdateCompletionConfigRequest", + "responseType": "CompletionConfig", + "options": { + "(google.api.http).patch": "/v2alpha/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}", + "(google.api.http).body": "completion_config", + "(google.api.method_signature)": "completion_config,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}", + "body": "completion_config" + } + }, + { + "(google.api.method_signature)": "completion_config,update_mask" + } + ] + }, + "GetAttributesConfig": { + "requestType": "GetAttributesConfigRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/attributesConfig}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/attributesConfig}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateAttributesConfig": { + "requestType": "UpdateAttributesConfigRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).patch": "/v2alpha/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}", + "(google.api.http).body": "attributes_config", + "(google.api.method_signature)": "attributes_config,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}", + "body": "attributes_config" + } + }, + { + "(google.api.method_signature)": "attributes_config,update_mask" + } + ] + }, + "AddCatalogAttribute": { + "requestType": "AddCatalogAttributeRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).post": "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", + "body": "*" + } + } + ] + }, + "RemoveCatalogAttribute": { + "requestType": "RemoveCatalogAttributeRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).post": "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", + "body": "*" + } + } + ] + }, + "ReplaceCatalogAttribute": { + "requestType": "ReplaceCatalogAttributeRequest", + "responseType": "AttributesConfig", + "options": { + "(google.api.http).post": "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", + "body": "*" + } + } + ] + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListCatalogsResponse": { + "fields": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", "id": 1 }, "nextPageToken": { @@ -4036,6 +4355,10 @@ "note": { "type": "string", "id": 3 + }, + "force": { + "type": "bool", + "id": 4 } } }, @@ -4069,6 +4392,121 @@ } } }, + "GetCompletionConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/CompletionConfig" + } + } + } + }, + "UpdateCompletionConfigRequest": { + "fields": { + "completionConfig": { + "type": "CompletionConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "GetAttributesConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + } + } + }, + "UpdateAttributesConfigRequest": { + "fields": { + "attributesConfig": { + "type": "AttributesConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "AddCatalogAttributeRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "catalogAttribute": { + "type": "CatalogAttribute", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RemoveCatalogAttributeRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "key": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ReplaceCatalogAttributeRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "catalogAttribute": { + "type": "CatalogAttribute", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, "CompletionService": { "options": { "(google.api.default_host)": "retail.googleapis.com", @@ -4196,76 +4634,85 @@ } } }, - "ExportErrorsConfig": { + "Control": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Control", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }, "oneofs": { - "destination": { + "control": { "oneof": [ - "gcsPrefix" + "facetSpec", + "rule" ] } }, "fields": { - "gcsPrefix": { - "type": "string", - "id": 1 - } - } - }, - "ExportMetadata": { - "fields": { - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 1 + "facetSpec": { + "type": "SearchRequest.FacetSpec", + "id": 3 }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - } - } - }, - "ExportProductsResponse": { - "fields": { - "errorSamples": { + "rule": { + "type": "Rule", + "id": 4 + }, + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "associatedServingConfigIds": { "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "errorsConfig": { - "type": "ExportErrorsConfig", - "id": 2 - } - } - }, - "ExportUserEventsResponse": { - "fields": { - "errorSamples": { + "solutionTypes": { "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 + "type": "SolutionType", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } }, - "errorsConfig": { - "type": "ExportErrorsConfig", - "id": 2 + "searchSolutionUseCase": { + "rule": "repeated", + "type": "SearchSolutionUseCase", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, - "PredictionService": { + "SearchService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "Predict": { - "requestType": "PredictRequest", - "responseType": "PredictResponse", + "Search": { + "requestType": "SearchRequest", + "responseType": "SearchResponse", "options": { - "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", "(google.api.http).body": "*" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", "body": "*" } } @@ -4273,7 +4720,7 @@ } } }, - "PredictRequest": { + "SearchRequest": { "fields": { "placement": { "type": "string", @@ -4282,132 +4729,827 @@ "(google.api.field_behavior)": "REQUIRED" } }, - "userEvent": { - "type": "UserEvent", + "branch": { + "type": "string", "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "query": { + "type": "string", + "id": 3 + }, + "visitorId": { + "type": "string", + "id": 4, "options": { "(google.api.field_behavior)": "REQUIRED" } }, + "userInfo": { + "type": "UserInfo", + "id": 5 + }, "pageSize": { "type": "int32", - "id": 3 + "id": 7 }, "pageToken": { "type": "string", - "id": 4 + "id": 8 + }, + "offset": { + "type": "int32", + "id": 9 }, "filter": { "type": "string", - "id": 5 - }, - "validateOnly": { - "type": "bool", - "id": 6 + "id": 10 }, - "params": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 7 + "canonicalFilter": { + "type": "string", + "id": 28 }, - "labels": { - "keyType": "string", + "orderBy": { "type": "string", - "id": 8 - } - } - }, - "PredictResponse": { - "fields": { - "results": { + "id": 11 + }, + "facetSpecs": { "rule": "repeated", - "type": "PredictionResult", - "id": 1 + "type": "FacetSpec", + "id": 12 }, - "attributionToken": { + "dynamicFacetSpec": { + "type": "DynamicFacetSpec", + "id": 21, + "options": { + "deprecated": true + } + }, + "boostSpec": { + "type": "BoostSpec", + "id": 13 + }, + "queryExpansionSpec": { + "type": "QueryExpansionSpec", + "id": 14 + }, + "relevanceThreshold": { + "type": "RelevanceThreshold", + "id": 15 + }, + "variantRollupKeys": { + "rule": "repeated", "type": "string", - "id": 2 + "id": 17 }, - "missingIds": { + "pageCategories": { "rule": "repeated", "type": "string", - "id": 3 + "id": 23 }, - "validateOnly": { - "type": "bool", - "id": 4 + "searchMode": { + "type": "SearchMode", + "id": 31 + }, + "personalizationSpec": { + "type": "PersonalizationSpec", + "id": 32 } }, "nested": { - "PredictionResult": { + "FacetSpec": { "fields": { - "id": { - "type": "string", - "id": 1 + "facetKey": { + "type": "FacetKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "metadata": { - "keyType": "string", - "type": "google.protobuf.Value", + "limit": { + "type": "int32", "id": 2 - } - } - } - } - }, - "ProductService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "body": "product" - } }, - { - "(google.api.method_signature)": "parent,product,product_id" - } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - } + "excludedFilterKeys": { + "rule": "repeated", + "type": "string", + "id": 3 }, - { - "(google.api.method_signature)": "name" + "enableDynamicPosition": { + "type": "bool", + "id": 4 } - ] - }, - "ListProducts": { - "requestType": "ListProductsRequest", - "responseType": "ListProductsResponse", - "options": { - "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.method_signature)": "parent" }, - "parsedOptions": [ - { - "(google.api.http)": { + "nested": { + "FacetKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "intervals": { + "rule": "repeated", + "type": "Interval", + "id": 2 + }, + "restrictedValues": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "prefixes": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "contains": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "orderBy": { + "type": "string", + "id": 4 + }, + "query": { + "type": "string", + "id": 5 + } + } + } + } + }, + "DynamicFacetSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "DISABLED": 1, + "ENABLED": 2 + } + } + } + }, + "BoostSpec": { + "oneofs": { + "_skipBoostSpecValidation": { + "oneof": [ + "skipBoostSpecValidation" + ] + } + }, + "fields": { + "conditionBoostSpecs": { + "rule": "repeated", + "type": "ConditionBoostSpec", + "id": 1 + }, + "skipBoostSpecValidation": { + "type": "bool", + "id": 2, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "ConditionBoostSpec": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } + } + }, + "QueryExpansionSpec": { + "fields": { + "condition": { + "type": "Condition", + "id": 1 + }, + "pinUnexpandedResults": { + "type": "bool", + "id": 2 + } + }, + "nested": { + "Condition": { + "values": { + "CONDITION_UNSPECIFIED": 0, + "DISABLED": 1, + "AUTO": 3 + } + } + } + }, + "PersonalizationSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "AUTO": 1, + "DISABLED": 2 + } + } + } + }, + "RelevanceThreshold": { + "values": { + "RELEVANCE_THRESHOLD_UNSPECIFIED": 0, + "HIGH": 1, + "MEDIUM": 2, + "LOW": 3, + "LOWEST": 4 + } + }, + "SearchMode": { + "values": { + "SEARCH_MODE_UNSPECIFIED": 0, + "PRODUCT_SEARCH_ONLY": 1, + "FACETED_SEARCH_ONLY": 2 + } + } + } + }, + "SearchResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "SearchResult", + "id": 1 + }, + "facets": { + "rule": "repeated", + "type": "Facet", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + }, + "correctedQuery": { + "type": "string", + "id": 4 + }, + "attributionToken": { + "type": "string", + "id": 5 + }, + "nextPageToken": { + "type": "string", + "id": 6 + }, + "queryExpansionInfo": { + "type": "QueryExpansionInfo", + "id": 7 + }, + "redirectUri": { + "type": "string", + "id": 10 + }, + "appliedControls": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "invalidConditionBoostSpecs": { + "rule": "repeated", + "type": "SearchRequest.BoostSpec.ConditionBoostSpec", + "id": 14 + } + }, + "nested": { + "SearchResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "product": { + "type": "Product", + "id": 2 + }, + "matchingVariantCount": { + "type": "int32", + "id": 3 + }, + "matchingVariantFields": { + "keyType": "string", + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "variantRollupValues": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 5 + } + } + }, + "Facet": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "values": { + "rule": "repeated", + "type": "FacetValue", + "id": 2 + }, + "dynamicFacet": { + "type": "bool", + "id": 3 + } + }, + "nested": { + "FacetValue": { + "oneofs": { + "facetValue": { + "oneof": [ + "value", + "interval" + ] + } + }, + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "interval": { + "type": "Interval", + "id": 2 + }, + "count": { + "type": "int64", + "id": 3 + } + } + } + } + }, + "QueryExpansionInfo": { + "fields": { + "expandedQuery": { + "type": "bool", + "id": 1 + }, + "pinnedResultCount": { + "type": "int64", + "id": 2 + } + } + } + } + }, + "ControlService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateControl": { + "requestType": "CreateControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.http).body": "control", + "(google.api.method_signature)": "parent,control,control_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "body": "control" + } + }, + { + "(google.api.method_signature)": "parent,control,control_id" + } + ] + }, + "DeleteControl": { + "requestType": "DeleteControlRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateControl": { + "requestType": "UpdateControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).patch": "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.http).body": "control", + "(google.api.method_signature)": "control,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "body": "control" + } + }, + { + "(google.api.method_signature)": "control,update_mask" + } + ] + }, + "GetControl": { + "requestType": "GetControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListControls": { + "requestType": "ListControlsRequest", + "responseType": "ListControlsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "CreateControlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "control": { + "type": "Control", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "controlId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateControlRequest": { + "fields": { + "control": { + "type": "Control", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteControlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" + } + } + } + }, + "GetControlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" + } + } + } + }, + "ListControlsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListControlsResponse": { + "fields": { + "controls": { + "rule": "repeated", + "type": "Control", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ExportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ExportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "ExportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + } + } + }, + "ExportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + } + } + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*" + } + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" + } + ] + }, + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListProducts": { + "requestType": "ListProductsRequest", + "responseType": "ListProductsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" } }, @@ -4454,6 +5596,30 @@ } ] }, + "PurgeProducts": { + "requestType": "PurgeProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2alpha.PurgeProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2alpha.PurgeProductsMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2alpha.PurgeProductsResponse", + "metadata_type": "google.cloud.retail.v2alpha.PurgeProductsMetadata" + } + } + ] + }, "ImportProducts": { "requestType": "ImportProductsRequest", "responseType": "google.longrunning.Operation", @@ -4924,6 +6090,65 @@ "PurgeMetadata": { "fields": {} }, + "PurgeProductsMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "successCount": { + "type": "int64", + "id": 3 + }, + "failureCount": { + "type": "int64", + "id": 4 + } + } + }, + "PurgeProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeProductsResponse": { + "fields": { + "purgeCount": { + "type": "int64", + "id": 1 + }, + "purgeSample": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, "PurgeUserEventsRequest": { "fields": { "parent": { @@ -4954,388 +6179,381 @@ } } }, - "SearchService": { + "ServingConfig": { "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + "(google.api.resource).type": "retail.googleapis.com/ServingConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" }, - "methods": { - "Search": { - "requestType": "SearchRequest", - "responseType": "SearchResponse", - "options": { - "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "body": "*" - } - } - ] - } - } - }, - "SearchRequest": { "fields": { - "placement": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "branch": { + "displayName": { "type": "string", "id": 2, "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.field_behavior)": "REQUIRED" } }, - "query": { + "modelId": { "type": "string", "id": 3 }, - "visitorId": { + "priceRerankingLevel": { "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 4 }, - "userInfo": { - "type": "UserInfo", + "facetControlIds": { + "rule": "repeated", + "type": "string", "id": 5 }, - "pageSize": { - "type": "int32", + "dynamicFacetSpec": { + "type": "SearchRequest.DynamicFacetSpec", + "id": 6 + }, + "boostControlIds": { + "rule": "repeated", + "type": "string", "id": 7 }, - "pageToken": { + "filterControlIds": { + "rule": "repeated", "type": "string", - "id": 8 - }, - "offset": { - "type": "int32", "id": 9 }, - "filter": { + "redirectControlIds": { + "rule": "repeated", "type": "string", "id": 10 }, - "canonicalFilter": { - "type": "string", - "id": 28 - }, - "orderBy": { + "twowaySynonymsControlIds": { + "rule": "repeated", "type": "string", - "id": 11 + "id": 18 }, - "facetSpecs": { + "onewaySynonymsControlIds": { "rule": "repeated", - "type": "FacetSpec", + "type": "string", "id": 12 }, - "dynamicFacetSpec": { - "type": "DynamicFacetSpec", - "id": 21 - }, - "boostSpec": { - "type": "BoostSpec", + "doNotAssociateControlIds": { + "rule": "repeated", + "type": "string", "id": 13 }, - "queryExpansionSpec": { - "type": "QueryExpansionSpec", + "replacementControlIds": { + "rule": "repeated", + "type": "string", "id": 14 }, - "relevanceThreshold": { - "type": "RelevanceThreshold", + "ignoreControlIds": { + "rule": "repeated", + "type": "string", "id": 15 }, - "variantRollupKeys": { - "rule": "repeated", + "diversityLevel": { "type": "string", - "id": 17 + "id": 8 }, - "pageCategories": { - "rule": "repeated", + "enableCategoryFilterLevel": { "type": "string", - "id": 23 + "id": 16 }, - "searchMode": { - "type": "SearchMode", - "id": 31 + "solutionTypes": { + "rule": "repeated", + "type": "SolutionType", + "id": 19, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } } + } + }, + "ServingConfigService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, - "nested": { - "FacetSpec": { - "fields": { - "facetKey": { - "type": "FacetKey", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" + "methods": { + "CreateServingConfig": { + "requestType": "CreateServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "(google.api.http).body": "serving_config", + "(google.api.method_signature)": "parent,serving_config,serving_config_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "body": "serving_config" } }, - "limit": { - "type": "int32", - "id": 2 - }, - "excludedFilterKeys": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "enableDynamicPosition": { - "type": "bool", - "id": 4 + { + "(google.api.method_signature)": "parent,serving_config,serving_config_id" } + ] + }, + "DeleteServingConfig": { + "requestType": "DeleteServingConfigRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.method_signature)": "name" }, - "nested": { - "FacetKey": { - "fields": { - "key": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "intervals": { - "rule": "repeated", - "type": "Interval", - "id": 2 - }, - "restrictedValues": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "prefixes": { - "rule": "repeated", - "type": "string", - "id": 8 - }, - "contains": { - "rule": "repeated", - "type": "string", - "id": 9 - }, - "orderBy": { - "type": "string", - "id": 4 - }, - "query": { - "type": "string", - "id": 5 - } + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" } + }, + { + "(google.api.method_signature)": "name" } - } + ] }, - "DynamicFacetSpec": { - "fields": { - "mode": { - "type": "Mode", - "id": 1 - } + "UpdateServingConfig": { + "requestType": "UpdateServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).patch": "/v2alpha/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.http).body": "serving_config", + "(google.api.method_signature)": "serving_config,update_mask" }, - "nested": { - "Mode": { - "values": { - "MODE_UNSPECIFIED": 0, - "DISABLED": 1, - "ENABLED": 2 + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "body": "serving_config" } + }, + { + "(google.api.method_signature)": "serving_config,update_mask" } - } + ] }, - "BoostSpec": { - "fields": { - "conditionBoostSpecs": { - "rule": "repeated", - "type": "ConditionBoostSpec", - "id": 1 + "GetServingConfig": { + "requestType": "GetServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" } + ] + }, + "ListServingConfigs": { + "requestType": "ListServingConfigsRequest", + "responseType": "ListServingConfigsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "(google.api.method_signature)": "parent" }, - "nested": { - "ConditionBoostSpec": { - "fields": { - "condition": { - "type": "string", - "id": 1 - }, - "boost": { - "type": "float", - "id": 2 - } + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" } + }, + { + "(google.api.method_signature)": "parent" } - } + ] }, - "QueryExpansionSpec": { - "fields": { - "condition": { - "type": "Condition", - "id": 1 + "AddControl": { + "requestType": "AddControlRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + "(google.api.http).body": "*", + "(google.api.method_signature)": "serving_config" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + "body": "*" + } }, - "pinUnexpandedResults": { - "type": "bool", - "id": 2 + { + "(google.api.method_signature)": "serving_config" } + ] + }, + "RemoveControl": { + "requestType": "RemoveControlRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + "(google.api.http).body": "*", + "(google.api.method_signature)": "serving_config" }, - "nested": { - "Condition": { - "values": { - "CONDITION_UNSPECIFIED": 0, - "DISABLED": 1, - "AUTO": 3 + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + "body": "*" } + }, + { + "(google.api.method_signature)": "serving_config" } + ] + } + } + }, + "CreateServingConfigRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "RelevanceThreshold": { - "values": { - "RELEVANCE_THRESHOLD_UNSPECIFIED": 0, - "HIGH": 1, - "MEDIUM": 2, - "LOW": 3, - "LOWEST": 4 + "servingConfig": { + "type": "ServingConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" } }, - "SearchMode": { - "values": { - "SEARCH_MODE_UNSPECIFIED": 0, - "PRODUCT_SEARCH_ONLY": 1, - "FACETED_SEARCH_ONLY": 2 + "servingConfigId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" } } } }, - "SearchResponse": { + "UpdateServingConfigRequest": { "fields": { - "results": { - "rule": "repeated", - "type": "SearchResult", - "id": 1 + "servingConfig": { + "type": "ServingConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "facets": { - "rule": "repeated", - "type": "Facet", + "updateMask": { + "type": "google.protobuf.FieldMask", "id": 2 - }, - "totalSize": { - "type": "int32", - "id": 3 - }, - "correctedQuery": { + } + } + }, + "DeleteServingConfigRequest": { + "fields": { + "name": { "type": "string", - "id": 4 - }, - "attributionToken": { + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" + } + } + } + }, + "GetServingConfigRequest": { + "fields": { + "name": { "type": "string", - "id": 5 - }, - "nextPageToken": { + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" + } + } + } + }, + "ListServingConfigsRequest": { + "fields": { + "parent": { "type": "string", - "id": 6 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } }, - "queryExpansionInfo": { - "type": "QueryExpansionInfo", - "id": 7 + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "redirectUri": { + "pageToken": { "type": "string", - "id": 10 - }, - "appliedControls": { + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListServingConfigsResponse": { + "fields": { + "servingConfigs": { "rule": "repeated", + "type": "ServingConfig", + "id": 1 + }, + "nextPageToken": { "type": "string", - "id": 12 + "id": 2 } - }, - "nested": { - "SearchResult": { - "fields": { - "id": { - "type": "string", - "id": 1 - }, - "product": { - "type": "Product", - "id": 2 - }, - "matchingVariantCount": { - "type": "int32", - "id": 3 - }, - "matchingVariantFields": { - "keyType": "string", - "type": "google.protobuf.FieldMask", - "id": 4 - }, - "variantRollupValues": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 5 - } + } + }, + "AddControlRequest": { + "fields": { + "servingConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" } }, - "Facet": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "values": { - "rule": "repeated", - "type": "FacetValue", - "id": 2 - }, - "dynamicFacet": { - "type": "bool", - "id": 3 - } - }, - "nested": { - "FacetValue": { - "oneofs": { - "facetValue": { - "oneof": [ - "value", - "interval" - ] - } - }, - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "interval": { - "type": "Interval", - "id": 2 - }, - "count": { - "type": "int64", - "id": 3 - } - } - } + "controlId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RemoveControlRequest": { + "fields": { + "servingConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" } }, - "QueryExpansionInfo": { - "fields": { - "expandedQuery": { - "type": "bool", - "id": 1 - }, - "pinnedResultCount": { - "type": "int64", - "id": 2 - } + "controlId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" } } } diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js new file mode 100644 index 00000000000..0a46b0bb0ff --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, catalogAttribute) { + // [START retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const attributesConfig = 'abc123' + /** + * Required. The + * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to add. + */ + // const catalogAttribute = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callAddCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + catalogAttribute, + }; + + // Run request + const response = await retailClient.addCatalogAttribute(request); + console.log(response); + } + + callAddCatalogAttribute(); + // [END retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js new file mode 100644 index 00000000000..8fe314bf03f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const name = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callGetAttributesConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getAttributesConfig(request); + console.log(response); + } + + callGetAttributesConfig(); + // [END retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js new file mode 100644 index 00000000000..b189f66ee58 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + */ + // const name = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callGetCompletionConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getCompletionConfig(request); + console.log(response); + } + + callGetCompletionConfig(); + // [END retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js new file mode 100644 index 00000000000..81358df93aa --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, key) { + // [START retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const attributesConfig = 'abc123' + /** + * Required. The attribute name key of the + * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to remove. + */ + // const key = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callRemoveCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + key, + }; + + // Run request + const response = await retailClient.removeCatalogAttribute(request); + console.log(response); + } + + callRemoveCatalogAttribute(); + // [END retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js new file mode 100644 index 00000000000..2fdfc582a78 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js @@ -0,0 +1,73 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, catalogAttribute) { + // [START retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + */ + // const attributesConfig = 'abc123' + /** + * Required. The updated + * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute. + */ + // const catalogAttribute = {} + /** + * Indicates which fields in the provided + * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to update. + * The following are NOT supported: + * * CatalogAttribute.key google.cloud.retail.v2alpha.CatalogAttribute.key + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callReplaceCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + catalogAttribute, + }; + + // Run request + const response = await retailClient.replaceCatalogAttribute(request); + console.log(response); + } + + callReplaceCatalogAttribute(); + // [END retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js index 288a6dc9d4b..7fce54ef4f3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js @@ -34,6 +34,9 @@ function main() { * The final component of the resource name of a branch. * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT * error is returned. + * If there are no sufficient active products in the targeted branch and + * force google.cloud.retail.v2alpha.SetDefaultBranchRequest.force is not + * set, a FAILED_PRECONDITION error is returned. */ // const branchId = 'abc123' /** @@ -44,6 +47,12 @@ function main() { * characters. Otherwise, an INVALID_ARGUMENT error is returned. */ // const note = 'abc123' + /** + * If set to true, it permits switching to a branch with + * branch_id google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id + * even if it has no sufficient active products. + */ + // const force = true // Imports the Retail library const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js new file mode 100644 index 00000000000..bf5828a2fa4 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js @@ -0,0 +1,67 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig) { + // [START retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The + * AttributesConfig google.cloud.retail.v2alpha.AttributesConfig to update. + */ + // const attributesConfig = {} + /** + * Indicates which fields in the provided + * AttributesConfig google.cloud.retail.v2alpha.AttributesConfig to update. + * The following is the only supported field: + * * AttributesConfig.catalog_attributes google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callUpdateAttributesConfig() { + // Construct request + const request = { + attributesConfig, + }; + + // Run request + const response = await retailClient.updateAttributesConfig(request); + console.log(response); + } + + callUpdateAttributesConfig(); + // [END retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js new file mode 100644 index 00000000000..62e6eea357d --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(completionConfig) { + // [START retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The + * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to update. + * If the caller does not have permission to update the + * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig, then a + * PERMISSION_DENIED error is returned. + * If the CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to + * update does not exist, a NOT_FOUND error is returned. + */ + // const completionConfig = {} + /** + * Indicates which fields in the provided + * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to update. + * The following are the only supported fields: + * * CompletionConfig.matching_order google.cloud.retail.v2alpha.CompletionConfig.matching_order + * * CompletionConfig.max_suggestions google.cloud.retail.v2alpha.CompletionConfig.max_suggestions + * * CompletionConfig.min_prefix_length google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length + * * CompletionConfig.auto_learning google.cloud.retail.v2alpha.CompletionConfig.auto_learning + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callUpdateCompletionConfig() { + // Construct request + const request = { + completionConfig, + }; + + // Run request + const response = await retailClient.updateCompletionConfig(request); + console.log(response); + } + + callUpdateCompletionConfig(); + // [END retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index 35881432233..6f768b764ca 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -37,21 +37,21 @@ function main(catalog, query) { */ // const query = 'abc123' /** - * 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 logs in or out of the website. + * Required field. 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 logs in or 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. */ // const visitorId = 'abc123' /** - * The list of languages of the query. This is - * the BCP-47 language code, such as "en-US" or "sr-Latn". - * For more information, see - * Tags for Identifying Languages (https://tools.ietf.org/html/bcp47). - * The maximum number of allowed characters is 255. - * Only "en-US" is currently supported. + * The language filters applied to the output suggestions. If set, it should + * contain the language of the query. If not set, suggestions are returned + * without considering language restrictions. This is the BCP-47 language + * code, such as "en-US" or "sr-Latn". For more information, see Tags for + * Identifying Languages (https://tools.ietf.org/html/bcp47). The maximum + * number of language codes is 3. */ // const languageCodes = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js new file mode 100644 index 00000000000..bacd422aea4 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, control, controlId) { + // [START retail_v2alpha_generated_ControlService_CreateControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of parent catalog. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Required. The Control to create. + */ + // const control = {} + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-_/. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callCreateControl() { + // Construct request + const request = { + parent, + control, + controlId, + }; + + // Run request + const response = await retailClient.createControl(request); + console.log(response); + } + + callCreateControl(); + // [END retail_v2alpha_generated_ControlService_CreateControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js new file mode 100644 index 00000000000..6afa1e03319 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ControlService_DeleteControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callDeleteControl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteControl(request); + console.log(response); + } + + callDeleteControl(); + // [END retail_v2alpha_generated_ControlService_DeleteControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js new file mode 100644 index 00000000000..a0c4c927f9a --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ControlService_GetControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callGetControl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getControl(request); + console.log(response); + } + + callGetControl(); + // [END retail_v2alpha_generated_ControlService_GetControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js new file mode 100644 index 00000000000..c09815fd97c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js @@ -0,0 +1,79 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2alpha_generated_ControlService_ListControls_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * filter google.cloud.retail.v2alpha.ListControlsRequest.filter is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + */ + // const filter = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callListControls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listControlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListControls(); + // [END retail_v2alpha_generated_ControlService_ListControls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js new file mode 100644 index 00000000000..7f0e4c67230 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js @@ -0,0 +1,66 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(control) { + // [START retail_v2alpha_generated_ControlService_UpdateControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Control to update. + */ + // const control = {} + /** + * Indicates which fields in the provided + * Control google.cloud.retail.v2alpha.Control to update. The following are + * NOT supported: + * * Control.name google.cloud.retail.v2alpha.Control.name + * If not set or empty, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callUpdateControl() { + // Construct request + const request = { + control, + }; + + // Run request + const response = await retailClient.updateControl(request); + console.log(response); + } + + callUpdateControl(); + // [END retail_v2alpha_generated_ControlService_UpdateControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js index a4105bf6a9b..f49c45f1105 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -72,9 +72,12 @@ function main(placement, userEvent) { * * 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`. + * If your filter blocks all prediction results, the API will return generic + * (unfiltered) popular products. If you only want results strictly matching + * the filters, set `strictFiltering` to True in `PredictRequest.params` to + * receive empty results instead. + * Note that the API will never return items with storageStatus of "EXPIRED" + * or "DELETED" regardless of filter choices. */ // const filter = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index 6f3d4566bdf..26a70a511a4 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -32,17 +32,6 @@ function main(parent, inputConfig) { * If updateMask is specified, requires products.update permission. */ // const parent = 'abc123' - /** - * Unique identifier provided by client, within the ancestor - * dataset scope. Ensures idempotency and used for request deduplication. - * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in - * ImportMetadata google.cloud.retail.v2alpha.ImportMetadata. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const requestId = 'abc123' /** * Required. The desired input location of the data. */ diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js new file mode 100644 index 00000000000..55d09aef102 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js @@ -0,0 +1,101 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, filter) { + // [START retail_v2alpha_generated_ProductService_PurgeProducts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the branch under which the products are + * created. The format is + * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` + */ + // const parent = 'abc123' + /** + * Required. The filter string to specify the products to be deleted with a + * length limit of 5,000 characters. + * Empty string filter is not allowed. "*" implies delete all items in a + * branch. + * The eligible fields for filtering are: + * * `availability`: Double quoted + * Product.availability google.cloud.retail.v2alpha.Product.availability + * string. + * * `create_time` : in ISO 8601 "zulu" format. + * Supported syntax: + * * Comparators (">", "<", ">=", "<=", "="). + * Examples: + * * create_time <= "2015-02-13T17:05:46Z" + * * availability = "IN_STOCK" + * * Conjunctions ("AND") + * Examples: + * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" + * * Disjunctions ("OR") + * Examples: + * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" + * * Can support nested queries. + * Examples: + * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") + * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") + * * Filter Limits: + * * Filter should not contain more than 6 conditions. + * * Max nesting depth should not exceed 2 levels. + * Examples queries: + * * Delete back order products created before a timestamp. + * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" + */ + // const filter = 'abc123' + /** + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any products. + */ + // const force = true + + // Imports the Retail library + const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ProductServiceClient(); + + async function callPurgeProducts() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const [operation] = await retailClient.purgeProducts(request); + const [response] = await operation.promise(); + console.log(response); + } + + callPurgeProducts(); + // [END retail_v2alpha_generated_ProductService_PurgeProducts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index ea7b0435fbb..00d0437657a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -48,6 +48,20 @@ function main(inventory) { * merged while respecting the last update time for each inventory field, * using the provided or default value for * SetInventoryRequest.set_time google.cloud.retail.v2alpha.SetInventoryRequest.set_time. + * The caller can replace place IDs for a subset of fulfillment types in the + * following ways: + * * Adds "fulfillment_info" in + * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask + * * Specifies only the desired fulfillment types and corresponding place IDs + * to update in SetInventoryRequest.inventory.fulfillment_info + * The caller can clear all place IDs from a subset of fulfillment types in + * the following ways: + * * Adds "fulfillment_info" in + * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask + * * Specifies only the desired fulfillment types to clear in + * SetInventoryRequest.inventory.fulfillment_info + * * Checks that only the desired fulfillment info types have empty + * SetInventoryRequest.inventory.fulfillment_info.place_ids * The last update time is recorded for the following inventory fields: * * Product.price_info google.cloud.retail.v2alpha.Product.price_info * * Product.availability google.cloud.retail.v2alpha.Product.availability diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index f433adcde3c..9c4c8b0daa5 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -27,7 +27,7 @@ function main(placement, visitorId) { */ /** * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -96,6 +96,8 @@ function main(placement, visitorId) { */ // const filter = 'abc123' /** + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -122,13 +124,6 @@ function main(placement, visitorId) { * is returned. */ // const facetSpecs = 1234 - /** - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. - */ - // const dynamicFacetSpec = {} /** * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). @@ -250,6 +245,10 @@ function main(placement, visitorId) { * request triggers both product search and faceted search. */ // const searchMode = {} + /** + * The specification for personalization. + */ + // const personalizationSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2alpha; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js new file mode 100644 index 00000000000..5145a2cb67f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig, controlId) { + // [START retail_v2alpha_generated_ServingConfigService_AddControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const servingConfig = 'abc123' + /** + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config - if id is not found a NOT_FOUND error is returned. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callAddControl() { + // Construct request + const request = { + servingConfig, + controlId, + }; + + // Run request + const response = await retailClient.addControl(request); + console.log(response); + } + + callAddControl(); + // [END retail_v2alpha_generated_ServingConfigService_AddControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js new file mode 100644 index 00000000000..5a4982b7ffb --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, servingConfig, servingConfigId) { + // [START retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of parent. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Required. The ServingConfig to create. + */ + // const servingConfig = {} + /** + * Required. The ID to use for the ServingConfig, which will become the final + * component of the ServingConfig's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-_/. + */ + // const servingConfigId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callCreateServingConfig() { + // Construct request + const request = { + parent, + servingConfig, + servingConfigId, + }; + + // Run request + const response = await retailClient.createServingConfig(request); + console.log(response); + } + + callCreateServingConfig(); + // [END retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js new file mode 100644 index 00000000000..4ca230b46bf --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callDeleteServingConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteServingConfig(request); + console.log(response); + } + + callDeleteServingConfig(); + // [END retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js new file mode 100644 index 00000000000..b88b3af38fa --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callGetServingConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getServingConfig(request); + console.log(response); + } + + callGetServingConfig(); + // [END retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js new file mode 100644 index 00000000000..b79bfca1e4c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callListServingConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listServingConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServingConfigs(); + // [END retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js new file mode 100644 index 00000000000..c1ea7176564 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js @@ -0,0 +1,65 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig, controlId) { + // [START retail_v2alpha_generated_ServingConfigService_RemoveControl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const servingConfig = 'abc123' + /** + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callRemoveControl() { + // Construct request + const request = { + servingConfig, + controlId, + }; + + // Run request + const response = await retailClient.removeControl(request); + console.log(response); + } + + callRemoveControl(); + // [END retail_v2alpha_generated_ServingConfigService_RemoveControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js new file mode 100644 index 00000000000..7f236fba4eb --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js @@ -0,0 +1,66 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig) { + // [START retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ServingConfig to update. + */ + // const servingConfig = {} + /** + * Indicates which fields in the provided + * ServingConfig google.cloud.retail.v2alpha.ServingConfig to update. The + * following are NOT supported: + * * ServingConfig.name google.cloud.retail.v2alpha.ServingConfig.name + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callUpdateServingConfig() { + // Construct request + const request = { + servingConfig, + }; + + // Run request + const response = await retailClient.updateServingConfig(request); + console.log(response); + } + + callUpdateServingConfig(); + // [END retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index ba90db93d2b..1072ee9498c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -107,14 +107,14 @@ "regionTag": "retail_v2alpha_generated_CatalogService_SetDefaultBranch_async", "title": "CatalogService setDefaultBranch Sample", "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", "canonical": true, "file": "catalog_service.set_default_branch.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 64, + "end": 73, "type": "FULL" } ], @@ -134,6 +134,10 @@ { "name": "note", "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" } ], "resultType": ".google.protobuf.Empty", @@ -155,7 +159,7 @@ "regionTag": "retail_v2alpha_generated_CatalogService_GetDefaultBranch_async", "title": "CatalogService getDefaultBranch Sample", "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.", "canonical": true, "file": "catalog_service.get_default_branch.js", "language": "JAVASCRIPT", @@ -191,11 +195,315 @@ } } }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_GetCompletionConfig_async", + "title": "CatalogService getCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].", + "canonical": true, + "file": "catalog_service.get_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async", + "title": "CatalogService updateCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.", + "canonical": true, + "file": "catalog_service.update_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", + "async": true, + "parameters": [ + { + "name": "completion_config", + "type": ".google.cloud.retail.v2alpha.CompletionConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_GetAttributesConfig_async", + "title": "CatalogService getAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", + "canonical": true, + "file": "catalog_service.get_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async", + "title": "CatalogService updateAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", + "canonical": true, + "file": "catalog_service.update_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": ".google.cloud.retail.v2alpha.AttributesConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async", + "title": "CatalogService addCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "catalog_service.add_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2alpha.CatalogAttribute" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async", + "title": "CatalogService removeCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.remove_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "key", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async", + "title": "CatalogService replaceCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.replace_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2alpha.CatalogAttribute" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } + }, { "regionTag": "retail_v2alpha_generated_CompletionService_CompleteQuery_async", "title": "CatalogService completeQuery Sample", "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "completion_service.complete_query.js", "language": "JAVASCRIPT", @@ -259,7 +567,7 @@ "regionTag": "retail_v2alpha_generated_CompletionService_ImportCompletionData_async", "title": "CatalogService importCompletionData Sample", "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing may be synchronous. Partial updating is not supported. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "completion_service.import_completion_data.js", "language": "JAVASCRIPT", @@ -284,21 +592,245 @@ "type": ".google.cloud.retail.v2alpha.CompletionDataInputConfig" }, { - "name": "notification_pubsub_topic", + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2alpha.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ControlService_CreateControl_async", + "title": "CatalogService createControl Sample", + "origin": "API_DEFINITION", + "description": " Creates a Control. If the [Control][google.cloud.retail.v2alpha.Control] to create already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "control_service.create_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "control", + "type": ".google.cloud.retail.v2alpha.Control" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ControlService_DeleteControl_async", + "title": "CatalogService deleteControl Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Control. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.delete_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ControlService_UpdateControl_async", + "title": "CatalogService updateControl Sample", + "origin": "API_DEFINITION", + "description": " Updates a Control. [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.update_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", + "async": true, + "parameters": [ + { + "name": "control", + "type": ".google.cloud.retail.v2alpha.Control" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ControlService_GetControl_async", + "title": "CatalogService getControl Sample", + "origin": "API_DEFINITION", + "description": " Gets a Control.", + "canonical": true, + "file": "control_service.get_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ControlService_ListControls_async", + "title": "CatalogService listControls Sample", + "origin": "API_DEFINITION", + "description": " Lists all Controls linked to this catalog.", + "canonical": true, + "file": "control_service.list_controls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", "type": "TYPE_STRING" } ], - "resultType": ".google.longrunning.Operation", + "resultType": ".google.cloud.retail.v2alpha.ListControlsResponse", "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" }, "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" } } } @@ -314,7 +846,7 @@ "segments": [ { "start": 25, - "end": 150, + "end": 153, "type": "FULL" } ], @@ -607,6 +1139,54 @@ } } }, + { + "regionTag": "retail_v2alpha_generated_ProductService_PurgeProducts_async", + "title": "CatalogService purgeProducts Sample", + "origin": "API_DEFINITION", + "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", + "canonical": true, + "file": "product_service.purge_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "PurgeProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } + }, { "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", "title": "CatalogService importProducts Sample", @@ -618,7 +1198,7 @@ "segments": [ { "start": 25, - "end": 96, + "end": 85, "type": "FULL" } ], @@ -675,14 +1255,14 @@ "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 102, + "end": 116, "type": "FULL" } ], @@ -727,7 +1307,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", @@ -783,7 +1363,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", @@ -839,7 +1419,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact Cloud sales if you are interested in using Retail Search.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", @@ -895,7 +1475,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact Cloud sales if you are interested in using Retail Search.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", @@ -947,14 +1527,14 @@ "regionTag": "retail_v2alpha_generated_SearchService_Search_async", "title": "CatalogService search Sample", "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please submit a form [here](https://cloud.google.com/contact) to contact cloud sales if you are interested in using Retail Search.", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "search_service.search.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 274, + "end": 273, "type": "FULL" } ], @@ -1038,6 +1618,10 @@ { "name": "search_mode", "type": ".google.cloud.retail.v2alpha.SearchRequest.SearchMode" + }, + { + "name": "personalization_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec" } ], "resultType": ".google.cloud.retail.v2alpha.SearchResponse", @@ -1055,6 +1639,314 @@ } } }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async", + "title": "CatalogService createServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.", + "canonical": true, + "file": "serving_config_service.create_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "serving_config", + "type": ".google.cloud.retail.v2alpha.ServingConfig" + }, + { + "name": "serving_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async", + "title": "CatalogService deleteServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.delete_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async", + "title": "CatalogService updateServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ServingConfig.", + "canonical": true, + "file": "serving_config_service.update_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": ".google.cloud.retail.v2alpha.ServingConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_GetServingConfig_async", + "title": "CatalogService getServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.get_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async", + "title": "CatalogService listServingConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists all ServingConfigs linked to this catalog.", + "canonical": true, + "file": "serving_config_service.list_serving_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListServingConfigsResponse", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_AddControl_async", + "title": "CatalogService addControl Sample", + "origin": "API_DEFINITION", + "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", + "canonical": true, + "file": "serving_config_service.add_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ServingConfigService_RemoveControl_async", + "title": "CatalogService removeControl Sample", + "origin": "API_DEFINITION", + "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", + "canonical": true, + "file": "serving_config_service.remove_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } + }, { "regionTag": "retail_v2alpha_generated_UserEventService_WriteUserEvent_async", "title": "CatalogService writeUserEvent Sample", @@ -1251,7 +2143,7 @@ "regionTag": "retail_v2alpha_generated_UserEventService_RejoinUserEvents_async", "title": "CatalogService rejoinUserEvents Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", "canonical": true, "file": "user_event_service.rejoin_user_events.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index 051ed95de95..b05d4fe2140 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -164,18 +164,30 @@ export class CatalogServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -243,6 +255,13 @@ export class CatalogServiceClient { 'updateCatalog', 'setDefaultBranch', 'getDefaultBranch', + 'getCompletionConfig', + 'updateCompletionConfig', + 'getAttributesConfig', + 'updateAttributesConfig', + 'addCatalogAttribute', + 'removeCatalogAttribute', + 'replaceCatalogAttribute', ]; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( @@ -464,90 +483,835 @@ export class CatalogServiceClient { * * UserEventService will only join events with products from branch * {newBranch}. * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.branchId + * The final component of the resource name of a branch. + * + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + * + * If there are no sufficient active products in the targeted branch and + * {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.force|force} is not + * set, a FAILED_PRECONDITION error is returned. + * @param {string} request.note + * Some note on this request, this can be retrieved by + * {@link google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} + * before next valid default branch set occurs. + * + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {boolean} request.force + * If set to true, it permits switching to a branch with + * {@link google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id|branch_id} + * even if it has no sufficient active products. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.set_default_branch.js + * region_tag:retail_v2alpha_generated_CatalogService_SetDefaultBranch_async + */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultBranch(request, options, callback); + } + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2alpha.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.get_default_branch.js + * region_tag:retail_v2alpha_generated_CatalogService_GetDefaultBranch_async + */ + getDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + getDefaultBranch( + request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.getDefaultBranch(request, options, callback); + } + /** + * Gets a {@link google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompletionConfig]{@link google.cloud.retail.v2alpha.CompletionConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.get_completion_config.js + * region_tag:retail_v2alpha_generated_CatalogService_GetCompletionConfig_async + */ + getCompletionConfig( + request?: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompletionConfig, + ( + | protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest + | undefined + ), + {} | undefined + ] + >; + getCompletionConfig( + request: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getCompletionConfig( + request: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getCompletionConfig( + request?: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompletionConfig, + ( + | protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCompletionConfig(request, options, callback); + } + /** + * Updates the + * {@link google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.CompletionConfig} request.completionConfig + * Required. The + * {@link google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}, then a + * PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to + * update does not exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to update. + * The following are the only supported fields: + * + * * {@link google.cloud.retail.v2alpha.CompletionConfig.matching_order|CompletionConfig.matching_order} + * * {@link google.cloud.retail.v2alpha.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions} + * * {@link google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length|CompletionConfig.min_prefix_length} + * * {@link google.cloud.retail.v2alpha.CompletionConfig.auto_learning|CompletionConfig.auto_learning} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompletionConfig]{@link google.cloud.retail.v2alpha.CompletionConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.update_completion_config.js + * region_tag:retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async + */ + updateCompletionConfig( + request?: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompletionConfig, + ( + | protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest + | undefined + ), + {} | undefined + ] + >; + updateCompletionConfig( + request: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCompletionConfig( + request: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCompletionConfig( + request?: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.ICompletionConfig, + | protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.ICompletionConfig, + ( + | protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'completion_config.name': request.completionConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCompletionConfig( + request, + options, + callback + ); + } + /** + * Gets an {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2alpha.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.get_attributes_config.js + * region_tag:retail_v2alpha_generated_CatalogService_GetAttributesConfig_async + */ + getAttributesConfig( + request?: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest + | undefined + ), + {} | undefined + ] + >; + getAttributesConfig( + request: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAttributesConfig( + request: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAttributesConfig( + request?: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAttributesConfig(request, options, callback); + } + /** + * Updates the + * {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. + * + * The catalog attributes in the request will be updated in the catalog, or + * inserted if they do not exist. Existing catalog attributes not included in + * the request will remain unchanged. Attributes that are assigned to + * products, but do not exist at the catalog level, are always included in the + * response. The product attribute is assigned default values for missing + * catalog attribute fields, e.g., searchable and dynamic facetable options. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.AttributesConfig} request.attributesConfig + * Required. The + * {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} to update. + * The following is the only supported field: + * + * * {@link google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes|AttributesConfig.catalog_attributes} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2alpha.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.update_attributes_config.js + * region_tag:retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async + */ + updateAttributesConfig( + request?: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest + | undefined + ), + {} | undefined + ] + >; + updateAttributesConfig( + request: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAttributesConfig( + request: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAttributesConfig( + request?: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'attributes_config.name': request.attributesConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAttributesConfig( + request, + options, + callback + ); + } + /** + * Adds the specified + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to the + * {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. + * + * If the {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to + * add already exists, an ALREADY_EXISTS error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute + * Required. The + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to add. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2alpha.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/catalog_service.add_catalog_attribute.js + * region_tag:retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async + */ + addCatalogAttribute( + request?: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest + | undefined + ), + {} | undefined + ] + >; + addCatalogAttribute( + request: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + addCatalogAttribute( + request: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + addCatalogAttribute( + request?: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + attributes_config: request.attributesConfig || '', + }); + this.initialize(); + return this.innerApiCalls.addCatalogAttribute(request, options, callback); + } + /** + * Removes the specified + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} from the + * {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. + * + * If the {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to + * remove does not exist, a NOT_FOUND error is returned. * * @param {Object} request * The request object that will be sent. - * @param {string} request.catalog - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.branchId - * The final component of the resource name of a branch. - * - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * @param {string} request.note - * Some note on this request, this can be retrieved by - * {@link google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} - * before next valid default branch set occurs. - * - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {string} request.key + * Required. The attribute name key of the + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to remove. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2alpha.AttributesConfig}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.set_default_branch.js - * region_tag:retail_v2alpha_generated_CatalogService_SetDefaultBranch_async + * @example include:samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js + * region_tag:retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async */ - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + removeCatalogAttribute( + request?: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, options?: CallOptions ): Promise< [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest + | undefined + ), {} | undefined ] >; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + removeCatalogAttribute( + request: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, options: CallOptions, callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + removeCatalogAttribute( + request: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, + removeCatalogAttribute( + request?: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, optionsOrCallback?: | CallOptions | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined >, callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined > ): Promise< [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest + | undefined + ), {} | undefined ] > | void { @@ -564,88 +1328,110 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - catalog: request.catalog || '', + attributes_config: request.attributesConfig || '', }); this.initialize(); - return this.innerApiCalls.setDefaultBranch(request, options, callback); + return this.innerApiCalls.removeCatalogAttribute( + request, + options, + callback + ); } /** - * Get which branch is currently default branch set by - * {@link google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. + * Replaces the specified + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} in the + * {@link google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} by + * updating the catalog attribute with the same + * {@link google.cloud.retail.v2alpha.CatalogAttribute.key|CatalogAttribute.key}. * - * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * If the {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to + * replace does not exist, a NOT_FOUND error is returned. * * @param {Object} request * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute + * Required. The updated + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to update. + * The following are NOT supported: + * + * * {@link google.cloud.retail.v2alpha.CatalogAttribute.key|CatalogAttribute.key} + * + * If not set, all supported fields are updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2alpha.GetDefaultBranchResponse}. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2alpha.AttributesConfig}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_default_branch.js - * region_tag:retail_v2alpha_generated_CatalogService_GetDefaultBranch_async + * @example include:samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js + * region_tag:retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async */ - getDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request?: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, options?: CallOptions ): Promise< [ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest + | undefined + ), {} | undefined ] >; - getDefaultBranch( - request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, options: CallOptions, callback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - getDefaultBranch( - request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, callback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined > ): void; - getDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request?: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, optionsOrCallback?: | CallOptions | Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined >, callback?: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest + protos.google.cloud.retail.v2alpha.IAttributesConfig, + | protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined > ): Promise< [ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2alpha.IAttributesConfig, + ( + | protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest + | undefined + ), {} | undefined ] > | void { @@ -662,10 +1448,14 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - catalog: request.catalog || '', + attributes_config: request.attributesConfig || '', }); this.initialize(); - return this.innerApiCalls.getDefaultBranch(request, options, callback); + return this.innerApiCalls.replaceCatalogAttribute( + request, + options, + callback + ); } /** @@ -916,6 +1706,61 @@ export class CatalogServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -1032,6 +1877,128 @@ export class CatalogServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified location resource name string. * @@ -1149,6 +2116,77 @@ export class CatalogServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json index 6a6a6289bf2..08407daa19a 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client_config.json @@ -48,6 +48,41 @@ "timeout_millis": 5000, "retry_codes_name": "idempotent", "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "GetCompletionConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "UpdateCompletionConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "GetAttributesConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "UpdateAttributesConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "AddCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "RemoveCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "ReplaceCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json index 89776f5d72d..3355857af31 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 0e387d057f9..6a0d0bf5f58 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -41,8 +41,7 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2alpha */ @@ -166,12 +165,24 @@ export class CompletionServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -339,8 +350,7 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -354,21 +364,20 @@ export class CompletionServiceClient { * * The maximum number of allowed characters is 255. * @param {string} request.visitorId - * 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 logs in or out of the website. + * Required field. 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 logs in or 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. * @param {string[]} request.languageCodes - * The list of languages of the query. This is - * the BCP-47 language code, such as "en-US" or "sr-Latn". - * For more information, see - * [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). - * - * The maximum number of allowed characters is 255. - * Only "en-US" is currently supported. + * The language filters applied to the output suggestions. If set, it should + * contain the language of the query. If not set, suggestions are returned + * without considering language restrictions. This is the BCP-47 language + * code, such as "en-US" or "sr-Latn". For more information, see [Tags for + * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + * number of language codes is 3. * @param {string} request.deviceType * The device type context for completion suggestions. * It is useful to apply different suggestions on different device types, e.g. @@ -493,11 +502,13 @@ export class CompletionServiceClient { /** * Bulk import of processed completion dataset. * - * Request processing may be synchronous. Partial updating is not supported. + * Request processing is asynchronous. Partial updating is not supported. + * + * The operation is successfully finished only after the imported suggestions + * are indexed successfully and ready for serving. The process takes hours. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -647,6 +658,61 @@ export class CompletionServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -696,6 +762,128 @@ export class CompletionServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -777,6 +965,77 @@ export class CompletionServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json index 89776f5d72d..3355857af31 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts new file mode 100644 index 00000000000..e424e8505ee --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts @@ -0,0 +1,1340 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/control_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './control_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for modifying Control. + * @class + * @memberof v2alpha + */ +export class ControlServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + controlServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ControlServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ControlServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listControls: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'controls' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.ControlService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.controlServiceStub) { + return this.controlServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.ControlService. + this.controlServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.ControlService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.ControlService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const controlServiceStubMethods = [ + 'createControl', + 'deleteControl', + 'updateControl', + 'getControl', + 'listControls', + ]; + for (const methodName of controlServiceStubMethods) { + const callPromise = this.controlServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.controlServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a Control. + * + * If the {@link google.cloud.retail.v2alpha.Control|Control} to create already + * exists, an ALREADY_EXISTS error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full resource name of parent catalog. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {google.cloud.retail.v2alpha.Control} request.control + * Required. The Control to create. + * @param {string} request.controlId + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-_/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2alpha.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/control_service.create_control.js + * region_tag:retail_v2alpha_generated_ControlService_CreateControl_async + */ + createControl( + request?: protos.google.cloud.retail.v2alpha.ICreateControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.ICreateControlRequest | undefined, + {} | undefined + ] + >; + createControl( + request: protos.google.cloud.retail.v2alpha.ICreateControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.ICreateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createControl( + request: protos.google.cloud.retail.v2alpha.ICreateControlRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.ICreateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createControl( + request?: protos.google.cloud.retail.v2alpha.ICreateControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.ICreateControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.ICreateControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.ICreateControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createControl(request, options, callback); + } + /** + * Deletes a Control. + * + * If the {@link google.cloud.retail.v2alpha.Control|Control} to delete does not + * exist, a NOT_FOUND error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/control_service.delete_control.js + * region_tag:retail_v2alpha_generated_ControlService_DeleteControl_async + */ + deleteControl( + request?: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteControlRequest | undefined, + {} | undefined + ] + >; + deleteControl( + request: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteControl( + request: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteControl( + request?: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteControl(request, options, callback); + } + /** + * Updates a Control. + * + * {@link google.cloud.retail.v2alpha.Control|Control} cannot be set to a different + * oneof field, if so an INVALID_ARGUMENT is returned. If the + * {@link google.cloud.retail.v2alpha.Control|Control} to delete does not exist, a + * NOT_FOUND error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.Control} request.control + * Required. The Control to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.Control|Control} to update. The following are + * NOT supported: + * + * * {@link google.cloud.retail.v2alpha.Control.name|Control.name} + * + * If not set or empty, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2alpha.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/control_service.update_control.js + * region_tag:retail_v2alpha_generated_ControlService_UpdateControl_async + */ + updateControl( + request?: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IUpdateControlRequest | undefined, + {} | undefined + ] + >; + updateControl( + request: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateControl( + request: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateControl( + request?: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IUpdateControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'control.name': request.control!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateControl(request, options, callback); + } + /** + * Gets a Control. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Control to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2alpha.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/control_service.get_control.js + * region_tag:retail_v2alpha_generated_ControlService_GetControl_async + */ + getControl( + request?: protos.google.cloud.retail.v2alpha.IGetControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IGetControlRequest | undefined, + {} | undefined + ] + >; + getControl( + request: protos.google.cloud.retail.v2alpha.IGetControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): void; + getControl( + request: protos.google.cloud.retail.v2alpha.IGetControlRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): void; + getControl( + request?: protos.google.cloud.retail.v2alpha.IGetControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IControl, + | protos.google.cloud.retail.v2alpha.IGetControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl, + protos.google.cloud.retail.v2alpha.IGetControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getControl(request, options, callback); + } + + /** + * Lists all Controls linked to this catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Control]{@link google.cloud.retail.v2alpha.Control}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listControlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listControls( + request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl[], + protos.google.cloud.retail.v2alpha.IListControlsRequest | null, + protos.google.cloud.retail.v2alpha.IListControlsResponse + ] + >; + listControls( + request: protos.google.cloud.retail.v2alpha.IListControlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListControlsRequest, + | protos.google.cloud.retail.v2alpha.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IControl + > + ): void; + listControls( + request: protos.google.cloud.retail.v2alpha.IListControlsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListControlsRequest, + | protos.google.cloud.retail.v2alpha.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IControl + > + ): void; + listControls( + request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2alpha.IListControlsRequest, + | protos.google.cloud.retail.v2alpha.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IControl + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListControlsRequest, + | protos.google.cloud.retail.v2alpha.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IControl + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IControl[], + protos.google.cloud.retail.v2alpha.IListControlsRequest | null, + protos.google.cloud.retail.v2alpha.IListControlsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listControls(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Control]{@link google.cloud.retail.v2alpha.Control} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listControlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listControlsStream( + request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listControls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listControls.createStream( + this.innerApiCalls.listControls as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listControls`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Control]{@link google.cloud.retail.v2alpha.Control}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2alpha/control_service.list_controls.js + * region_tag:retail_v2alpha_generated_ControlService_ListControls_async + */ + listControlsAsync( + request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listControls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listControls.asyncIterate( + this.innerApiCalls['listControls'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.controlServiceStub && !this._terminated) { + return this.controlServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/control_service_client_config.json new file mode 100644 index 00000000000..9a86d786b23 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.ControlService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListControls": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json new file mode 100644 index 00000000000..3355857af31 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json @@ -0,0 +1,20 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json index 194f361b0fd..aeabbe198a7 100644 --- a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json @@ -25,6 +25,41 @@ "getDefaultBranch" ] }, + "GetCompletionConfig": { + "methods": [ + "getCompletionConfig" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "updateCompletionConfig" + ] + }, + "GetAttributesConfig": { + "methods": [ + "getAttributesConfig" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "updateAttributesConfig" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "addCatalogAttribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "removeCatalogAttribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replaceCatalogAttribute" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -52,6 +87,41 @@ "getDefaultBranch" ] }, + "GetCompletionConfig": { + "methods": [ + "getCompletionConfig" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "updateCompletionConfig" + ] + }, + "GetAttributesConfig": { + "methods": [ + "getAttributesConfig" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "updateAttributesConfig" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "addCatalogAttribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "removeCatalogAttribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replaceCatalogAttribute" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -97,6 +167,74 @@ } } }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls", + "listControlsStream", + "listControlsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls", + "listControlsStream", + "listControlsAsync" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -146,6 +284,11 @@ "deleteProduct" ] }, + "PurgeProducts": { + "methods": [ + "purgeProducts" + ] + }, "ImportProducts": { "methods": [ "importProducts" @@ -208,6 +351,11 @@ "deleteProduct" ] }, + "PurgeProducts": { + "methods": [ + "purgeProducts" + ] + }, "ImportProducts": { "methods": [ "importProducts" @@ -277,6 +425,94 @@ } } }, + "ServingConfigService": { + "clients": { + "grpc": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "createServingConfig" + ] + }, + "DeleteServingConfig": { + "methods": [ + "deleteServingConfig" + ] + }, + "UpdateServingConfig": { + "methods": [ + "updateServingConfig" + ] + }, + "GetServingConfig": { + "methods": [ + "getServingConfig" + ] + }, + "AddControl": { + "methods": [ + "addControl" + ] + }, + "RemoveControl": { + "methods": [ + "removeControl" + ] + }, + "ListServingConfigs": { + "methods": [ + "listServingConfigs", + "listServingConfigsStream", + "listServingConfigsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "createServingConfig" + ] + }, + "DeleteServingConfig": { + "methods": [ + "deleteServingConfig" + ] + }, + "UpdateServingConfig": { + "methods": [ + "updateServingConfig" + ] + }, + "GetServingConfig": { + "methods": [ + "getServingConfig" + ] + }, + "AddControl": { + "methods": [ + "addControl" + ] + }, + "RemoveControl": { + "methods": [ + "removeControl" + ] + }, + "ListServingConfigs": { + "methods": [ + "listServingConfigs", + "listServingConfigsStream", + "listServingConfigsAsync" + ] + } + } + } + } + }, "UserEventService": { "clients": { "grpc": { diff --git a/packages/google-cloud-retail/src/v2alpha/index.ts b/packages/google-cloud-retail/src/v2alpha/index.ts index 79cde8aa80a..a7e4f6ba79f 100644 --- a/packages/google-cloud-retail/src/v2alpha/index.ts +++ b/packages/google-cloud-retail/src/v2alpha/index.ts @@ -18,7 +18,9 @@ export {CatalogServiceClient} from './catalog_service_client'; export {CompletionServiceClient} from './completion_service_client'; +export {ControlServiceClient} from './control_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; export {SearchServiceClient} from './search_service_client'; +export {ServingConfigServiceClient} from './serving_config_service_client'; export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 0f563f287b0..88d4855e391 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -155,12 +155,24 @@ export class PredictionServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Put together the default options sent with requests. @@ -345,9 +357,12 @@ export class PredictionServiceClient { * * 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`. + * If your filter blocks all prediction results, the API will return generic + * (unfiltered) popular products. If you only want results strictly matching + * the filters, set `strictFiltering` to True in `PredictRequest.params` to + * receive empty results instead. + * Note that the API will never return items with storageStatus of "EXPIRED" + * or "DELETED" regardless of filter choices. * @param {boolean} request.validateOnly * Use validate only mode for this prediction query. If set to true, a * dummy model will be used that returns arbitrary products. @@ -478,6 +493,61 @@ export class PredictionServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -527,6 +597,128 @@ export class PredictionServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -608,6 +800,77 @@ export class PredictionServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json index 89776f5d72d..3355857af31 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 2806ae36306..5ddaea14b3d 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -167,15 +167,27 @@ export class ProductServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -201,6 +213,12 @@ export class ProductServiceClient { grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }) .operationsClient(opts); + const purgeProductsResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.PurgeProductsResponse' + ) as gax.protobuf.Type; + const purgeProductsMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.PurgeProductsMetadata' + ) as gax.protobuf.Type; const importProductsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.ImportProductsResponse' ) as gax.protobuf.Type; @@ -239,6 +257,11 @@ export class ProductServiceClient { ) as gax.protobuf.Type; this.descriptors.longrunning = { + purgeProducts: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + purgeProductsResponse.decode.bind(purgeProductsResponse), + purgeProductsMetadata.decode.bind(purgeProductsMetadata) + ), importProducts: new this._gaxModule.LongrunningDescriptor( this.operationsClient, importProductsResponse.decode.bind(importProductsResponse), @@ -334,6 +357,7 @@ export class ProductServiceClient { 'listProducts', 'updateProduct', 'deleteProduct', + 'purgeProducts', 'importProducts', 'setInventory', 'addFulfillmentPlaces', @@ -854,6 +878,205 @@ export class ProductServiceClient { return this.innerApiCalls.deleteProduct(request, options, callback); } + /** + * Permanently deletes all selected + * {@link google.cloud.retail.v2alpha.Product|Product}s under a branch. + * + * This process is asynchronous. If the request is valid, the removal will be + * enqueued and processed offline. Depending on the number of + * {@link google.cloud.retail.v2alpha.Product|Product}s, this operation could take + * hours to complete. Before the operation completes, some + * {@link google.cloud.retail.v2alpha.Product|Product}s may still be returned by + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * + * Depending on the number of {@link google.cloud.retail.v2alpha.Product|Product}s, + * this operation could take hours to complete. To get a sample of + * {@link google.cloud.retail.v2alpha.Product|Product}s that would be deleted, set + * {@link google.cloud.retail.v2alpha.PurgeProductsRequest.force|PurgeProductsRequest.force} + * to false. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the branch under which the products are + * created. The format is + * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` + * @param {string} request.filter + * Required. The filter string to specify the products to be deleted with a + * length limit of 5,000 characters. + * + * Empty string filter is not allowed. "*" implies delete all items in a + * branch. + * + * The eligible fields for filtering are: + * + * * `availability`: Double quoted + * {@link google.cloud.retail.v2alpha.Product.availability|Product.availability} + * string. + * * `create_time` : in ISO 8601 "zulu" format. + * + * Supported syntax: + * + * * Comparators (">", "<", ">=", "<=", "="). + * Examples: + * * create_time <= "2015-02-13T17:05:46Z" + * * availability = "IN_STOCK" + * + * * Conjunctions ("AND") + * Examples: + * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" + * + * * Disjunctions ("OR") + * Examples: + * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" + * + * * Can support nested queries. + * Examples: + * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") + * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") + * + * * Filter Limits: + * * Filter should not contain more than 6 conditions. + * * Max nesting depth should not exceed 2 levels. + * + * Examples queries: + * * Delete back order products created before a timestamp. + * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" + * @param {boolean} request.force + * Actually perform the purge. + * If `force` is set to false, the method will return the expected purge count + * without deleting any products. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/product_service.purge_products.js + * region_tag:retail_v2alpha_generated_ProductService_PurgeProducts_async + */ + purgeProducts( + request?: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeProducts( + request: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeProducts( + request: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + purgeProducts( + request?: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.purgeProducts(request, options, callback); + } + /** + * Check the status of the long running operation returned by `purgeProducts()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/product_service.purge_products.js + * region_tag:retail_v2alpha_generated_ProductService_PurgeProducts_async + */ + async checkPurgeProductsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.PurgeProductsResponse, + protos.google.cloud.retail.v2alpha.PurgeProductsMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.purgeProducts, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.PurgeProductsResponse, + protos.google.cloud.retail.v2alpha.PurgeProductsMetadata + >; + } /** * Bulk import of multiple {@link google.cloud.retail.v2alpha.Product|Product}s. * @@ -872,15 +1095,7 @@ export class ProductServiceClient { * If no updateMask is specified, requires products.create permission. * If updateMask is specified, requires products.update permission. * @param {string} request.requestId - * Unique identifier provided by client, within the ancestor - * dataset scope. Ensures idempotency and used for request deduplication. - * Server-generated if unspecified. Up to 128 characters long and must match - * the pattern: `{@link |a-zA-Z0-9_]+`. This is returned as [Operation.name} in - * {@link google.cloud.retail.v2alpha.ImportMetadata|ImportMetadata}. - * - * Only supported when - * {@link google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. + * Deprecated. This field has no effect. * @param {google.cloud.retail.v2alpha.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig @@ -1063,7 +1278,8 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.CreateProductRequest.product|CreateProductRequest.product}, * then any pre-existing inventory information for this product will be used. * - * If no inventory fields are set in {@link |UpdateProductRequest.set_mask}, + * If no inventory fields are set in + * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, * then any existing inventory information will be preserved. * * Pre-existing inventory information can only be updated with @@ -1073,8 +1289,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1106,6 +1321,24 @@ export class ProductServiceClient { * using the provided or default value for * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. * + * The caller can replace place IDs for a subset of fulfillment types in the + * following ways: + * + * * Adds "fulfillment_info" in + * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} + * * Specifies only the desired fulfillment types and corresponding place IDs + * to update in {@link |SetInventoryRequest.inventory.fulfillment_info} + * + * The caller can clear all place IDs from a subset of fulfillment types in + * the following ways: + * + * * Adds "fulfillment_info" in + * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} + * * Specifies only the desired fulfillment types to clear in + * {@link |SetInventoryRequest.inventory.fulfillment_info} + * * Checks that only the desired fulfillment info types have empty + * {@link |SetInventoryRequest.inventory.fulfillment_info.place_ids} + * * The last update time is recorded for the following inventory fields: * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} * * {@link google.cloud.retail.v2alpha.Product.availability|Product.availability} @@ -1277,8 +1510,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1481,8 +1713,7 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1691,8 +1922,7 @@ export class ProductServiceClient { * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * Cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1884,8 +2114,7 @@ export class ProductServiceClient { * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * Cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -2469,6 +2698,61 @@ export class ProductServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -2585,6 +2869,128 @@ export class ProductServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -2666,6 +3072,77 @@ export class ProductServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json index 60238d936f1..416ef1ec1c3 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client_config.json @@ -63,6 +63,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" }, + "PurgeProducts": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, "ImportProducts": { "timeout_millis": 300000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json index 89776f5d72d..3355857af31 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index d329cb4a810..bc6f801bff3 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -44,8 +44,7 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2alpha */ @@ -168,15 +167,27 @@ export class SearchServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -326,14 +337,13 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Please submit a form [here](https://cloud.google.com/contact) to contact - * cloud sales if you are interested in using Retail Search. + * Please enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -391,6 +401,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -415,11 +428,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -537,6 +550,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -623,7 +638,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -681,6 +696,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -705,11 +723,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -827,6 +845,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -869,7 +889,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -927,6 +947,9 @@ export class SearchServiceClient { * * If this field is unrecognizable, an INVALID_ARGUMENT is returned. * @param {string} request.canonicalFilter + * The default filter that is applied when a user performs a search without + * checking any filters on the search page. + * * The filter applied to every search request when quality improvement such as * query expansion is needed. For example, if a query does not have enough * results, an expanded query with @@ -951,11 +974,11 @@ export class SearchServiceClient { * A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error * is returned. * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec + * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + * to enable dynamic facets. Do not set this field. + * * The specification for dynamically generated facets. Notice that only * textual facets can be dynamically generated. - * - * This feature requires additional allowlisting. Contact Retail Search - * support team if you are interested in using dynamic facet feature. * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). @@ -1073,6 +1096,8 @@ export class SearchServiceClient { * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode * The search mode of the search request. If not specified, a single search * request triggers both product search and faceted search. + * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec + * The specification for personalization. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1111,6 +1136,61 @@ export class SearchServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -1227,6 +1307,128 @@ export class SearchServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1308,6 +1510,77 @@ export class SearchServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json index 89776f5d72d..3355857af31 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts new file mode 100644 index 00000000000..bffcf4f665f --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts @@ -0,0 +1,1540 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/serving_config_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './serving_config_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for modifying ServingConfig. + * @class + * @memberof v2alpha + */ +export class ServingConfigServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + servingConfigServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ServingConfigServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ServingConfigServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServingConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'servingConfigs' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.ServingConfigService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.servingConfigServiceStub) { + return this.servingConfigServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.ServingConfigService. + this.servingConfigServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.ServingConfigService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha + .ServingConfigService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const servingConfigServiceStubMethods = [ + 'createServingConfig', + 'deleteServingConfig', + 'updateServingConfig', + 'getServingConfig', + 'listServingConfigs', + 'addControl', + 'removeControl', + ]; + for (const methodName of servingConfigServiceStubMethods) { + const callPromise = this.servingConfigServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.servingConfigServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a ServingConfig. + * + * A maximum of 100 + * {@link google.cloud.retail.v2alpha.ServingConfig|ServingConfig}s are allowed in + * a {@link google.cloud.retail.v2alpha.Catalog|Catalog}, otherwise a + * FAILED_PRECONDITION error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full resource name of parent. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig + * Required. The ServingConfig to create. + * @param {string} request.servingConfigId + * Required. The ID to use for the ServingConfig, which will become the final + * component of the ServingConfig's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-_/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.create_serving_config.js + * region_tag:retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async + */ + createServingConfig( + request?: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + ( + | protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest + | undefined + ), + {} | undefined + ] + >; + createServingConfig( + request: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServingConfig( + request: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServingConfig( + request?: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + ( + | protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createServingConfig(request, options, callback); + } + /** + * Deletes a ServingConfig. + * + * Returns a NotFound error if the ServingConfig does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.delete_serving_config.js + * region_tag:retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async + */ + deleteServingConfig( + request?: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest + | undefined + ), + {} | undefined + ] + >; + deleteServingConfig( + request: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServingConfig( + request: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServingConfig( + request?: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteServingConfig(request, options, callback); + } + /** + * Updates a ServingConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig + * Required. The ServingConfig to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2alpha.ServingConfig|ServingConfig} to update. The + * following are NOT supported: + * + * * {@link google.cloud.retail.v2alpha.ServingConfig.name|ServingConfig.name} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.update_serving_config.js + * region_tag:retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async + */ + updateServingConfig( + request?: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + ( + | protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest + | undefined + ), + {} | undefined + ] + >; + updateServingConfig( + request: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServingConfig( + request: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServingConfig( + request?: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + ( + | protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'serving_config.name': request.servingConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateServingConfig(request, options, callback); + } + /** + * Gets a ServingConfig. + * + * Returns a NotFound error if the ServingConfig does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.get_serving_config.js + * region_tag:retail_v2alpha_generated_ServingConfigService_GetServingConfig_async + */ + getServingConfig( + request?: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IGetServingConfigRequest | undefined, + {} | undefined + ] + >; + getServingConfig( + request: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getServingConfig( + request: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getServingConfig( + request?: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IGetServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getServingConfig(request, options, callback); + } + /** + * Enables a Control on the specified ServingConfig. + * The control is added in the last position of the list of controls + * it belongs to (e.g. if it's a facet spec control it will be applied + * in the last position of servingConfig.facetSpecIds) + * Returns a ALREADY_EXISTS error if the control has already been applied. + * Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.servingConfig + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {string} request.controlId + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config - if id is not found a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.add_control.js + * region_tag:retail_v2alpha_generated_ServingConfigService_AddControl_async + */ + addControl( + request?: protos.google.cloud.retail.v2alpha.IAddControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IAddControlRequest | undefined, + {} | undefined + ] + >; + addControl( + request: protos.google.cloud.retail.v2alpha.IAddControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): void; + addControl( + request: protos.google.cloud.retail.v2alpha.IAddControlRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): void; + addControl( + request?: protos.google.cloud.retail.v2alpha.IAddControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IAddControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IAddControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + serving_config: request.servingConfig || '', + }); + this.initialize(); + return this.innerApiCalls.addControl(request, options, callback); + } + /** + * Disables a Control on the specified ServingConfig. + * The control is removed from the ServingConfig. + * Returns a NOT_FOUND error if the Control is not enabled for the + * ServingConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.servingConfig + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {string} request.controlId + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.remove_control.js + * region_tag:retail_v2alpha_generated_ServingConfigService_RemoveControl_async + */ + removeControl( + request?: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IRemoveControlRequest | undefined, + {} | undefined + ] + >; + removeControl( + request: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + removeControl( + request: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + removeControl( + request?: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IServingConfig, + | protos.google.cloud.retail.v2alpha.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig, + protos.google.cloud.retail.v2alpha.IRemoveControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + serving_config: request.servingConfig || '', + }); + this.initialize(); + return this.innerApiCalls.removeControl(request, options, callback); + } + + /** + * Lists all ServingConfigs linked to this catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServingConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServingConfigs( + request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig[], + protos.google.cloud.retail.v2alpha.IListServingConfigsRequest | null, + protos.google.cloud.retail.v2alpha.IListServingConfigsResponse + ] + >; + listServingConfigs( + request: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + | protos.google.cloud.retail.v2alpha.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IServingConfig + > + ): void; + listServingConfigs( + request: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + | protos.google.cloud.retail.v2alpha.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IServingConfig + > + ): void; + listServingConfigs( + request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + | protos.google.cloud.retail.v2alpha.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IServingConfig + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + | protos.google.cloud.retail.v2alpha.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IServingConfig + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IServingConfig[], + protos.google.cloud.retail.v2alpha.IListServingConfigsRequest | null, + protos.google.cloud.retail.v2alpha.IListServingConfigsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listServingConfigs(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServingConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServingConfigsStream( + request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listServingConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServingConfigs.createStream( + this.innerApiCalls.listServingConfigs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listServingConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ServingConfig]{@link google.cloud.retail.v2alpha.ServingConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2alpha/serving_config_service.list_serving_configs.js + * region_tag:retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async + */ + listServingConfigsAsync( + request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listServingConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServingConfigs.asyncIterate( + this.innerApiCalls['listServingConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.servingConfigServiceStub && !this._terminated) { + return this.servingConfigServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client_config.json new file mode 100644 index 00000000000..6489c5db6ef --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.ServingConfigService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServingConfigs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RemoveControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json new file mode 100644 index 00000000000..3355857af31 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json @@ -0,0 +1,20 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index b14372d79be..5e7939c61bf 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -162,12 +162,24 @@ export class UserEventServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -879,13 +891,14 @@ export class UserEventServiceClient { >; } /** - * Triggers a user event rejoin operation with latest product catalog. Events + * Starts 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 + * serving. This method can be used to start 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. + * correct events joined with the wrong product catalog. A rejoin operation + * can take hours or days to complete. * * @param {Object} request * The request object that will be sent. @@ -1031,6 +1044,61 @@ export class UserEventServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -1080,6 +1148,128 @@ export class UserEventServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1161,6 +1351,77 @@ export class UserEventServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json index 89776f5d72d..3355857af31 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json @@ -3,13 +3,18 @@ "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", "../../protos/google/cloud/retail/v2alpha/common.proto", "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", "../../protos/google/cloud/retail/v2alpha/purge_config.proto", "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", "../../protos/google/cloud/retail/v2alpha/user_event.proto", "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 8d0d62be931..4980f39f899 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -592,6 +592,927 @@ describe('v2alpha.CatalogServiceClient', () => { }); }); + describe('getCompletionConfig', () => { + it('invokes getCompletionConfig without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompletionConfig() + ); + client.innerApiCalls.getCompletionConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getCompletionConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getCompletionConfig without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompletionConfig() + ); + client.innerApiCalls.getCompletionConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCompletionConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.ICompletionConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getCompletionConfig with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCompletionConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getCompletionConfig(request), expectedError); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getCompletionConfig with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCompletionConfig(request), expectedError); + }); + }); + + describe('updateCompletionConfig', () => { + it('invokes updateCompletionConfig without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompletionConfig() + ); + client.innerApiCalls.updateCompletionConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateCompletionConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCompletionConfig without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CompletionConfig() + ); + client.innerApiCalls.updateCompletionConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCompletionConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.ICompletionConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateCompletionConfig with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCompletionConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateCompletionConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCompletionConfig with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateCompletionConfig(request), + expectedError + ); + }); + }); + + describe('getAttributesConfig', () => { + it('invokes getAttributesConfig without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.getAttributesConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getAttributesConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAttributesConfig without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.getAttributesConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAttributesConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getAttributesConfig with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAttributesConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAttributesConfig(request), expectedError); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAttributesConfig with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAttributesConfig(request), expectedError); + }); + }); + + describe('updateAttributesConfig', () => { + it('invokes updateAttributesConfig without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.updateAttributesConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateAttributesConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAttributesConfig without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.updateAttributesConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAttributesConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateAttributesConfig with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAttributesConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateAttributesConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAttributesConfig with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateAttributesConfig(request), + expectedError + ); + }); + }); + + describe('addCatalogAttribute', () => { + it('invokes addCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.addCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + }); + }); + + describe('removeCatalogAttribute', () => { + it('invokes removeCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.removeCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); + }); + }); + + describe('replaceCatalogAttribute', () => { + it('invokes replaceCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.replaceCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.replaceCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes replaceCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AttributesConfig() + ); + client.innerApiCalls.replaceCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes replaceCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.replaceCatalogAttribute(request), + expectedError + ); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes replaceCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.replaceCatalogAttribute(request), + expectedError + ); + }); + }); + describe('listCatalogs', () => { it('invokes listCatalogs without error', async () => { const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ @@ -876,6 +1797,73 @@ describe('v2alpha.CatalogServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -1016,6 +2004,149 @@ describe('v2alpha.CatalogServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('location', () => { const fakePath = '/rendered/path/location'; const expectedParameters = { @@ -1152,5 +2283,81 @@ describe('v2alpha.CatalogServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index e55d2535879..c63c4064c1f 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -511,6 +511,74 @@ describe('v2alpha.CompletionServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -576,6 +644,151 @@ describe('v2alpha.CompletionServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -664,5 +877,82 @@ describe('v2alpha.CompletionServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts new file mode 100644 index 00000000000..516a0c0c65d --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts @@ -0,0 +1,1443 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as controlserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.ControlServiceClient', () => { + it('has servicePath', () => { + const servicePath = + controlserviceModule.v2alpha.ControlServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + controlserviceModule.v2alpha.ControlServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = controlserviceModule.v2alpha.ControlServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + await client.initialize(); + assert(client.controlServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.controlServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createControl', () => { + it('invokes createControl without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Control() + ); + client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); + const [response] = await client.createControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createControl without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Control() + ); + client.innerApiCalls.createControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createControl with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createControl(request), expectedError); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createControl with closed client', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateControlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createControl(request), expectedError); + }); + }); + + describe('deleteControl', () => { + it('invokes deleteControl without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); + const [response] = await client.deleteControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteControl without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteControl( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteControl with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteControl(request), expectedError); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteControl with closed client', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteControlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteControl(request), expectedError); + }); + }); + + describe('updateControl', () => { + it('invokes updateControl without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Control() + ); + client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); + const [response] = await client.updateControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateControl without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Control() + ); + client.innerApiCalls.updateControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateControl with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateControl(request), expectedError); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateControl with closed client', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateControl(request), expectedError); + }); + }); + + describe('getControl', () => { + it('invokes getControl without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Control() + ); + client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); + const [response] = await client.getControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getControl without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Control() + ); + client.innerApiCalls.getControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getControl with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getControl(request), expectedError); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getControl with closed client', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetControlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getControl(request), expectedError); + }); + }); + + describe('listControls', () => { + it('invokes listControls without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + ]; + client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); + const [response] = await client.listControls(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listControls without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + ]; + client.innerApiCalls.listControls = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listControls( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IControl[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listControls with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listControls = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listControls(request), expectedError); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listControlsStream without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + ]; + client.descriptors.page.listControls.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listControlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Control[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Control) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listControls, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listControlsStream with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listControls.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listControlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Control[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Control) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listControls, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listControls without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), + ]; + client.descriptors.page.listControls.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2alpha.IControl[] = []; + const iterable = client.listControlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listControls with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listControls.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listControlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2alpha.IControl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index b8ac848119e..5eef59184ba 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -276,6 +276,74 @@ describe('v2alpha.PredictionServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -341,6 +409,151 @@ describe('v2alpha.PredictionServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -429,5 +642,82 @@ describe('v2alpha.PredictionServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index ecde1a2a1a6..4bed145b7f7 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -750,6 +750,200 @@ describe('v2alpha.ProductServiceClient', () => { }); }); + describe('purgeProducts', () => { + it('invokes purgeProducts without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeProducts = + stubLongRunningCall(expectedResponse); + const [operation] = await client.purgeProducts(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeProducts without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.purgeProducts = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.purgeProducts( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IPurgeProductsResponse, + protos.google.cloud.retail.v2alpha.IPurgeProductsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.purgeProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes purgeProducts with call error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeProducts = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.purgeProducts(request), expectedError); + assert( + (client.innerApiCalls.purgeProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes purgeProducts with LRO error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.purgeProducts = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.purgeProducts(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.purgeProducts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkPurgeProductsProgress without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkPurgeProductsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkPurgeProductsProgress with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkPurgeProductsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('importProducts', () => { it('invokes importProducts without error', async () => { const client = new productserviceModule.v2alpha.ProductServiceClient({ @@ -2205,6 +2399,73 @@ describe('v2alpha.ProductServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -2345,6 +2606,149 @@ describe('v2alpha.ProductServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -2432,5 +2836,81 @@ describe('v2alpha.ProductServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index cc14a9e1427..da2b3f8839a 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -521,6 +521,73 @@ describe('v2alpha.SearchServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -661,6 +728,149 @@ describe('v2alpha.SearchServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -748,5 +958,81 @@ describe('v2alpha.SearchServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts new file mode 100644 index 00000000000..8a7b441d8bc --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts @@ -0,0 +1,1769 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as servingconfigserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.ServingConfigServiceClient', () => { + it('has servicePath', () => { + const servicePath = + servingconfigserviceModule.v2alpha.ServingConfigServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + servingconfigserviceModule.v2alpha.ServingConfigServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + servingconfigserviceModule.v2alpha.ServingConfigServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + await client.initialize(); + assert(client.servingConfigServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.servingConfigServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createServingConfig', () => { + it('invokes createServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.createServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.createServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.createServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createServingConfig(request), expectedError); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createServingConfig(request), expectedError); + }); + }); + + describe('deleteServingConfig', () => { + it('invokes deleteServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteServingConfig(request), expectedError); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteServingConfig(request), expectedError); + }); + }); + + describe('updateServingConfig', () => { + it('invokes updateServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.updateServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.updateServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateServingConfig(request), expectedError); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateServingConfig(request), expectedError); + }); + }); + + describe('getServingConfig', () => { + it('invokes getServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.getServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getServingConfig(request), expectedError); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServingConfig(request), expectedError); + }); + }); + + describe('addControl', () => { + it('invokes addControl without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); + const [response] = await client.addControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addControl without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.addControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addControl with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addControl(request), expectedError); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addControl with closed client', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.AddControlRequest() + ); + request.servingConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addControl(request), expectedError); + }); + }); + + describe('removeControl', () => { + it('invokes removeControl without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); + const [response] = await client.removeControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeControl without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ); + client.innerApiCalls.removeControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeControl with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.removeControl(request), expectedError); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeControl with closed client', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.removeControl(request), expectedError); + }); + }); + + describe('listServingConfigs', () => { + it('invokes listServingConfigs without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + ]; + client.innerApiCalls.listServingConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listServingConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServingConfigs without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + ]; + client.innerApiCalls.listServingConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServingConfigs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IServingConfig[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listServingConfigs with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listServingConfigs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listServingConfigs(request), expectedError); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServingConfigsStream without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + ]; + client.descriptors.page.listServingConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServingConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.ServingConfig[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.ServingConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServingConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listServingConfigsStream with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServingConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServingConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.ServingConfig[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.ServingConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServingConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServingConfigs without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ServingConfig() + ), + ]; + client.descriptors.page.listServingConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2alpha.IServingConfig[] = []; + const iterable = client.listServingConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServingConfigs with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServingConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServingConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2alpha.IServingConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index 648be5e755d..100e656b92a 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -1011,6 +1011,73 @@ describe('v2alpha.UserEventServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -1075,6 +1142,149 @@ describe('v2alpha.UserEventServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -1162,5 +1372,81 @@ describe('v2alpha.UserEventServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); From 9cf811c265bbfc6dfc3973bfd027f85fb4431526 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 16:31:05 -0400 Subject: [PATCH 076/103] chore(main): release 1.8.0 (#168) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-retail/CHANGELOG.md | 12 ++++++++++++ packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index f80f6a417df..55e8f443317 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.8.0](https://github.com/googleapis/nodejs-retail/compare/v1.7.0...v1.8.0) (2022-04-08) + + +### Features + +* allow search users to skip validation for invalid boost specs (v2alpha) ([3c6ffc1](https://github.com/googleapis/nodejs-retail/commit/3c6ffc1d6fee7095213824d45c3ca5bb0f974a1b)) +* Retail Tutorials. If create BQ table is requested, check if it exists and remove before creation ([#157](https://github.com/googleapis/nodejs-retail/issues/157)) ([349e171](https://github.com/googleapis/nodejs-retail/commit/349e171baacff751044665389e92e67f02ebc22c)) +* search returns applied control ids in the response (v2alpha) ([3c6ffc1](https://github.com/googleapis/nodejs-retail/commit/3c6ffc1d6fee7095213824d45c3ca5bb0f974a1b)) +* support batch products purge (v2alpha) ([#167](https://github.com/googleapis/nodejs-retail/issues/167)) ([3c6ffc1](https://github.com/googleapis/nodejs-retail/commit/3c6ffc1d6fee7095213824d45c3ca5bb0f974a1b)) +* support search personalization (v2alpha) ([3c6ffc1](https://github.com/googleapis/nodejs-retail/commit/3c6ffc1d6fee7095213824d45c3ca5bb0f974a1b)) +* users cannot switch to empty default branch unless force override (v2alpha) ([3c6ffc1](https://github.com/googleapis/nodejs-retail/commit/3c6ffc1d6fee7095213824d45c3ca5bb0f974a1b)) + ## [1.7.0](https://github.com/googleapis/nodejs-retail/compare/v1.6.1...v1.7.0) (2022-04-01) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 7e71aa2e6d2..a879468c020 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.7.0", + "version": "1.8.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index ebb5a52d186..332fa5e55da 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.7.0", + "@google-cloud/retail": "^1.8.0", "@google-cloud/bigquery": "^5.9.2", "@google-cloud/storage": "^5.16.1" }, From 222583cd4715066a9855b88d5b6e9c0fdfb22ade Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:24:21 +0000 Subject: [PATCH 077/103] build(node): update client library version in samples metadata (#1356) (#174) * build(node): add feat in node post-processor to add client library version number in snippet metadata Co-authored-by: Benjamin E. Coe Source-Link: https://github.com/googleapis/synthtool/commit/d337b88dd1494365183718a2de0b7b4056b6fdfe Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:d106724ad2a96daa1b8d88de101ba50bdb30b8df62ffa0aa2b451d93b4556641 --- ...ippet_metadata.google.cloud.retail.v2.json | 2492 +++++----- ..._metadata.google.cloud.retail.v2alpha.json | 4196 ++++++++--------- ...t_metadata.google.cloud.retail.v2beta.json | 4088 ++++++++-------- 3 files changed, 5388 insertions(+), 5388 deletions(-) diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 6dbcb2633bf..f2afb141aed 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -1,1295 +1,1295 @@ { - "clientLibrary": { - "name": "nodejs-retail", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.retail.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "retail_v2_generated_CatalogService_ListCatalogs_async", - "title": "CatalogService listCatalogs Sample", - "origin": "API_DEFINITION", - "description": " Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.", - "canonical": true, - "file": "catalog_service.list_catalogs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2.CatalogService.ListCatalogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2.ListCatalogsResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2.CatalogServiceClient" - }, - "method": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2.CatalogService.ListCatalogs", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2.CatalogService" - } - } - } + "clientLibrary": { + "name": "nodejs-retail", + "version": "1.8.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.retail.v2", + "version": "v2" + } + ] }, - { - "regionTag": "retail_v2_generated_CatalogService_UpdateCatalog_async", - "title": "CatalogService updateCatalog Sample", - "origin": "API_DEFINITION", - "description": " Updates the [Catalog][google.cloud.retail.v2.Catalog]s.", - "canonical": true, - "file": "catalog_service.update_catalog.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2.CatalogService.UpdateCatalog", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": ".google.cloud.retail.v2.Catalog" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2.Catalog", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2.CatalogServiceClient" + "regionTag": "retail_v2_generated_CatalogService_ListCatalogs_async", + "title": "CatalogService listCatalogs Sample", + "origin": "API_DEFINITION", + "description": " Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.", + "canonical": true, + "file": "catalog_service.list_catalogs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2.CatalogService.ListCatalogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ListCatalogsResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2.CatalogService.ListCatalogs", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2.CatalogService.UpdateCatalog", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_CatalogService_SetDefaultBranch_async", - "title": "CatalogService setDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", - "canonical": true, - "file": "catalog_service.set_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "branch_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2.CatalogServiceClient" + "regionTag": "retail_v2_generated_CatalogService_UpdateCatalog_async", + "title": "CatalogService updateCatalog Sample", + "origin": "API_DEFINITION", + "description": " Updates the [Catalog][google.cloud.retail.v2.Catalog]s.", + "canonical": true, + "file": "catalog_service.update_catalog.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateCatalog", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": ".google.cloud.retail.v2.Catalog" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.Catalog", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateCatalog", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } }, - "method": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_CatalogService_GetDefaultBranch_async", - "title": "CatalogService getDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] method under a specified parent catalog.", - "canonical": true, - "file": "catalog_service.get_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2.GetDefaultBranchResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2.CatalogServiceClient" + "regionTag": "retail_v2_generated_CatalogService_SetDefaultBranch_async", + "title": "CatalogService setDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", + "canonical": true, + "file": "catalog_service.set_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "branch_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } }, - "method": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_CompletionService_CompleteQuery_async", - "title": "CatalogService completeQuery Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.complete_query.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 108, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "device_type", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.retail.v2.CompleteQueryResponse", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2.CompletionServiceClient" + "regionTag": "retail_v2_generated_CatalogService_GetDefaultBranch_async", + "title": "CatalogService getDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] method under a specified parent catalog.", + "canonical": true, + "file": "catalog_service.get_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.GetDefaultBranchResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } }, - "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", - "title": "CatalogService importCompletionData Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.import_completion_data.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2.CompletionDataInputConfig" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2.CompletionServiceClient" + "regionTag": "retail_v2_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.complete_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 108, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2.CompletionService" + } + } + } }, - "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_PredictionService_Predict_async", - "title": "CatalogService predict Sample", - "origin": "API_DEFINITION", - "description": " Makes a recommendation prediction.", - "canonical": true, - "file": "prediction_service.predict.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 153, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2.PredictionService.Predict", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2.UserEvent" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "params", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2.PredictResponse", - "client": { - "shortName": "PredictionServiceClient", - "fullName": "google.cloud.retail.v2.PredictionServiceClient" + "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2.CompletionService" + } + } + } }, - "method": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2.PredictionService.Predict", - "service": { - "shortName": "PredictionService", - "fullName": "google.cloud.retail.v2.PredictionService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_CreateProduct_async", - "title": "CatalogService createProduct Sample", - "origin": "API_DEFINITION", - "description": " Creates a [Product][google.cloud.retail.v2.Product].", - "canonical": true, - "file": "product_service.create_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2.ProductService.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.retail.v2.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 153, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2.PredictionService" + } + } + } }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2.ProductService.CreateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_GetProduct_async", - "title": "CatalogService getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets a [Product][google.cloud.retail.v2.Product].", - "canonical": true, - "file": "product_service.get_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2.ProductService.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2.ProductService.GetProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_ListProducts_async", - "title": "CatalogService listProducts Sample", - "origin": "API_DEFINITION", - "description": " Gets a list of [Product][google.cloud.retail.v2.Product]s.", - "canonical": true, - "file": "product_service.list_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 122, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2.ProductService.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "read_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2.ListProductsResponse", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2.ProductService.ListProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_UpdateProduct_async", - "title": "CatalogService updateProduct Sample", - "origin": "API_DEFINITION", - "description": " Updates a [Product][google.cloud.retail.v2.Product].", - "canonical": true, - "file": "product_service.update_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2.ProductService.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.retail.v2.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 122, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2.ProductService.UpdateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_DeleteProduct_async", - "title": "CatalogService deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [Product][google.cloud.retail.v2.Product].", - "canonical": true, - "file": "product_service.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2.ProductService.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2.ProductService.DeleteProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_ImportProducts_async", - "title": "CatalogService importProducts Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_service.import_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2.ProductService.ImportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2.ProductInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2.ImportErrorsConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "reconciliation_mode", - "type": ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2.ProductService.DeleteProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2.ProductService.ImportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_SetInventory_async", - "title": "CatalogService setInventory Sample", - "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.set_inventory.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 116, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2.ProductService.SetInventory", - "async": true, - "parameters": [ - { - "name": "inventory", - "type": ".google.cloud.retail.v2.Product" - }, - { - "name": "set_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "set_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_ImportProducts_async", + "title": "CatalogService importProducts Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "product_service.import_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2.ProductService.ImportProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.ProductInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2.ImportErrorsConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "reconciliation_mode", + "type": ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2.ProductService.ImportProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2.ProductService.SetInventory", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", - "title": "CatalogService addFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.add_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_SetInventory_async", + "title": "CatalogService setInventory Sample", + "origin": "API_DEFINITION", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.set_inventory.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 116, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "CatalogService removeFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.remove_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 103, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_AddLocalInventories_async", - "title": "CatalogService addLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.add_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 91, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2.ProductService.AddLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "local_inventories", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "add_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2.ProductService.AddLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_ProductService_RemoveLocalInventories_async", - "title": "CatalogService removeLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.remove_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2.ProductServiceClient" + "regionTag": "retail_v2_generated_ProductService_AddLocalInventories_async", + "title": "CatalogService addLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 91, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.AddLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "local_inventories", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "add_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.AddLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_SearchService_Search_async", - "title": "CatalogService search Sample", - "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "search_service.search.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 252, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2.SearchService.Search", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2.UserInfo" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "offset", - "type": "TYPE_INT32" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "canonical_filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "facet_specs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "dynamic_facet_spec", - "type": ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec" - }, - { - "name": "boost_spec", - "type": ".google.cloud.retail.v2.SearchRequest.BoostSpec" - }, - { - "name": "query_expansion_spec", - "type": ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec" - }, - { - "name": "variant_rollup_keys", - "type": "TYPE_STRING[]" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "search_mode", - "type": ".google.cloud.retail.v2.SearchRequest.SearchMode" - }, - { - "name": "personalization_spec", - "type": ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec" - } - ], - "resultType": ".google.cloud.retail.v2.SearchResponse", - "client": { - "shortName": "SearchServiceClient", - "fullName": "google.cloud.retail.v2.SearchServiceClient" + "regionTag": "retail_v2_generated_ProductService_RemoveLocalInventories_async", + "title": "CatalogService removeLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2.ProductServiceClient" + }, + "method": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2.ProductService" + } + } + } }, - "method": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2.SearchService.Search", - "service": { - "shortName": "SearchService", - "fullName": "google.cloud.retail.v2.SearchService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_UserEventService_WriteUserEvent_async", - "title": "CatalogService writeUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event.", - "canonical": true, - "file": "user_event_service.write_user_event.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2.UserEventService.WriteUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2.UserEvent" - } - ], - "resultType": ".google.cloud.retail.v2.UserEvent", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2.UserEventServiceClient" + "regionTag": "retail_v2_generated_SearchService_Search_async", + "title": "CatalogService search Sample", + "origin": "API_DEFINITION", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "search_service.search.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 252, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2.SearchService.Search", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "branch", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "user_info", + "type": ".google.cloud.retail.v2.UserInfo" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "offset", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "canonical_filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "facet_specs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "dynamic_facet_spec", + "type": ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec" + }, + { + "name": "boost_spec", + "type": ".google.cloud.retail.v2.SearchRequest.BoostSpec" + }, + { + "name": "query_expansion_spec", + "type": ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec" + }, + { + "name": "variant_rollup_keys", + "type": "TYPE_STRING[]" + }, + { + "name": "page_categories", + "type": "TYPE_STRING[]" + }, + { + "name": "search_mode", + "type": ".google.cloud.retail.v2.SearchRequest.SearchMode" + }, + { + "name": "personalization_spec", + "type": ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec" + } + ], + "resultType": ".google.cloud.retail.v2.SearchResponse", + "client": { + "shortName": "SearchServiceClient", + "fullName": "google.cloud.retail.v2.SearchServiceClient" + }, + "method": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2.SearchService.Search", + "service": { + "shortName": "SearchService", + "fullName": "google.cloud.retail.v2.SearchService" + } + } + } }, - "method": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2.UserEventService.WriteUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_UserEventService_CollectUserEvent_async", - "title": "CatalogService collectUserEvent Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.collect_user_event.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2.UserEventService.CollectUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": "TYPE_STRING" - }, - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "ets", - "type": "TYPE_INT64" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2.UserEventServiceClient" + "regionTag": "retail_v2_generated_UserEventService_WriteUserEvent_async", + "title": "CatalogService writeUserEvent Sample", + "origin": "API_DEFINITION", + "description": " Writes a single user event.", + "canonical": true, + "file": "user_event_service.write_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.WriteUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2.UserEvent" + } + ], + "resultType": ".google.cloud.retail.v2.UserEvent", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.WriteUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } }, - "method": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2.UserEventService.CollectUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_UserEventService_PurgeUserEvents_async", - "title": "CatalogService purgeUserEvents Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.purge_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2.UserEventServiceClient" + "regionTag": "retail_v2_generated_UserEventService_CollectUserEvent_async", + "title": "CatalogService collectUserEvent Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.collect_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.CollectUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": "TYPE_STRING" + }, + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "ets", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2.UserEventService.CollectUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } }, - "method": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_UserEventService_ImportUserEvents_async", - "title": "CatalogService importUserEvents Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.import_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2.UserEventService.ImportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2.UserEventInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2.ImportErrorsConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2.UserEventServiceClient" + "regionTag": "retail_v2_generated_UserEventService_PurgeUserEvents_async", + "title": "CatalogService purgeUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.purge_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } }, - "method": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2.UserEventService.ImportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2_generated_UserEventService_RejoinUserEvents_async", - "title": "CatalogService rejoinUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", - "canonical": true, - "file": "user_event_service.rejoin_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event_rejoin_scope", - "type": ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2.UserEventServiceClient" + "regionTag": "retail_v2_generated_UserEventService_ImportUserEvents_async", + "title": "CatalogService importUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.import_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.ImportUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.UserEventInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2.ImportErrorsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.ImportUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } }, - "method": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2.UserEventService" - } + { + "regionTag": "retail_v2_generated_UserEventService_RejoinUserEvents_async", + "title": "CatalogService rejoinUserEvents Sample", + "origin": "API_DEFINITION", + "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", + "canonical": true, + "file": "user_event_service.rejoin_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event_rejoin_scope", + "type": ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2.UserEventServiceClient" + }, + "method": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2.UserEventService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index 1072ee9498c..0fd32166f5f 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -1,2187 +1,2187 @@ { - "clientLibrary": { - "name": "nodejs-retail", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.retail.v2alpha", - "version": "v2alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "retail_v2alpha_generated_CatalogService_ListCatalogs_async", - "title": "CatalogService listCatalogs Sample", - "origin": "API_DEFINITION", - "description": " Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.", - "canonical": true, - "file": "catalog_service.list_catalogs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListCatalogsResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } + "clientLibrary": { + "name": "nodejs-retail", + "version": "1.8.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.retail.v2alpha", + "version": "v2alpha" + } + ] }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCatalog_async", - "title": "CatalogService updateCatalog Sample", - "origin": "API_DEFINITION", - "description": " Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.", - "canonical": true, - "file": "catalog_service.update_catalog.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": ".google.cloud.retail.v2alpha.Catalog" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Catalog", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_ListCatalogs_async", + "title": "CatalogService listCatalogs Sample", + "origin": "API_DEFINITION", + "description": " Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.", + "canonical": true, + "file": "catalog_service.list_catalogs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListCatalogsResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_SetDefaultBranch_async", - "title": "CatalogService setDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", - "canonical": true, - "file": "catalog_service.set_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "branch_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCatalog_async", + "title": "CatalogService updateCatalog Sample", + "origin": "API_DEFINITION", + "description": " Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.", + "canonical": true, + "file": "catalog_service.update_catalog.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": ".google.cloud.retail.v2alpha.Catalog" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Catalog", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetDefaultBranch_async", - "title": "CatalogService getDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.", - "canonical": true, - "file": "catalog_service.get_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GetDefaultBranchResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_SetDefaultBranch_async", + "title": "CatalogService setDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", + "canonical": true, + "file": "catalog_service.set_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "branch_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetCompletionConfig_async", - "title": "CatalogService getCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].", - "canonical": true, - "file": "catalog_service.get_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_GetDefaultBranch_async", + "title": "CatalogService getDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.", + "canonical": true, + "file": "catalog_service.get_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.GetDefaultBranchResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async", - "title": "CatalogService updateCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.", - "canonical": true, - "file": "catalog_service.update_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", - "async": true, - "parameters": [ - { - "name": "completion_config", - "type": ".google.cloud.retail.v2alpha.CompletionConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_GetCompletionConfig_async", + "title": "CatalogService getCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].", + "canonical": true, + "file": "catalog_service.get_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetAttributesConfig_async", - "title": "CatalogService getAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", - "canonical": true, - "file": "catalog_service.get_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async", + "title": "CatalogService updateCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.", + "canonical": true, + "file": "catalog_service.update_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", + "async": true, + "parameters": [ + { + "name": "completion_config", + "type": ".google.cloud.retail.v2alpha.CompletionConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async", - "title": "CatalogService updateAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", - "canonical": true, - "file": "catalog_service.update_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": ".google.cloud.retail.v2alpha.AttributesConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_GetAttributesConfig_async", + "title": "CatalogService getAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", + "canonical": true, + "file": "catalog_service.get_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async", - "title": "CatalogService addCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "catalog_service.add_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2alpha.CatalogAttribute" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async", + "title": "CatalogService updateAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", + "canonical": true, + "file": "catalog_service.update_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": ".google.cloud.retail.v2alpha.AttributesConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async", - "title": "CatalogService removeCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.remove_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "key", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async", + "title": "CatalogService addCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "catalog_service.add_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2alpha.CatalogAttribute" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async", - "title": "CatalogService replaceCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.replace_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2alpha.CatalogAttribute" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async", + "title": "CatalogService removeCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.remove_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "key", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CompletionService_CompleteQuery_async", - "title": "CatalogService completeQuery Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.complete_query.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 109, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "device_type", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompleteQueryResponse", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + "regionTag": "retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async", + "title": "CatalogService replaceCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.replace_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2alpha.CatalogAttribute" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" + }, + "method": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2alpha.CatalogService" + } + } + } }, - "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CompletionService_ImportCompletionData_async", - "title": "CatalogService importCompletionData Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.import_completion_data.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.CompletionDataInputConfig" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + "regionTag": "retail_v2alpha_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.complete_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 109, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2alpha.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2alpha.CompletionService" + } + } + } }, - "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_CreateControl_async", - "title": "CatalogService createControl Sample", - "origin": "API_DEFINITION", - "description": " Creates a Control. If the [Control][google.cloud.retail.v2alpha.Control] to create already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "control_service.create_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "control", - "type": ".google.cloud.retail.v2alpha.Control" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + "regionTag": "retail_v2alpha_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2alpha.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2alpha.CompletionService" + } + } + } }, - "method": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_DeleteControl_async", - "title": "CatalogService deleteControl Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Control. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.delete_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + "regionTag": "retail_v2alpha_generated_ControlService_CreateControl_async", + "title": "CatalogService createControl Sample", + "origin": "API_DEFINITION", + "description": " Creates a Control. If the [Control][google.cloud.retail.v2alpha.Control] to create already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "control_service.create_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "control", + "type": ".google.cloud.retail.v2alpha.Control" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } }, - "method": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_UpdateControl_async", - "title": "CatalogService updateControl Sample", - "origin": "API_DEFINITION", - "description": " Updates a Control. [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.update_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", - "async": true, - "parameters": [ - { - "name": "control", - "type": ".google.cloud.retail.v2alpha.Control" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + "regionTag": "retail_v2alpha_generated_ControlService_DeleteControl_async", + "title": "CatalogService deleteControl Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Control. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.delete_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } }, - "method": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_GetControl_async", - "title": "CatalogService getControl Sample", - "origin": "API_DEFINITION", - "description": " Gets a Control.", - "canonical": true, - "file": "control_service.get_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + "regionTag": "retail_v2alpha_generated_ControlService_UpdateControl_async", + "title": "CatalogService updateControl Sample", + "origin": "API_DEFINITION", + "description": " Updates a Control. [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.update_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", + "async": true, + "parameters": [ + { + "name": "control", + "type": ".google.cloud.retail.v2alpha.Control" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } }, - "method": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_ListControls_async", - "title": "CatalogService listControls Sample", - "origin": "API_DEFINITION", - "description": " Lists all Controls linked to this catalog.", - "canonical": true, - "file": "control_service.list_controls.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListControlsResponse", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + "regionTag": "retail_v2alpha_generated_ControlService_GetControl_async", + "title": "CatalogService getControl Sample", + "origin": "API_DEFINITION", + "description": " Gets a Control.", + "canonical": true, + "file": "control_service.get_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } }, - "method": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_PredictionService_Predict_async", - "title": "CatalogService predict Sample", - "origin": "API_DEFINITION", - "description": " Makes a recommendation prediction.", - "canonical": true, - "file": "prediction_service.predict.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 153, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2alpha.UserEvent" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "params", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.PredictResponse", - "client": { - "shortName": "PredictionServiceClient", - "fullName": "google.cloud.retail.v2alpha.PredictionServiceClient" + "regionTag": "retail_v2alpha_generated_ControlService_ListControls_async", + "title": "CatalogService listControls Sample", + "origin": "API_DEFINITION", + "description": " Lists all Controls linked to this catalog.", + "canonical": true, + "file": "control_service.list_controls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListControlsResponse", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" + }, + "method": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2alpha.ControlService" + } + } + } }, - "method": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", - "service": { - "shortName": "PredictionService", - "fullName": "google.cloud.retail.v2alpha.PredictionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_CreateProduct_async", - "title": "CatalogService createProduct Sample", - "origin": "API_DEFINITION", - "description": " Creates a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.create_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 153, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2alpha.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2alpha.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2alpha.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2alpha.PredictionService" + } + } + } }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_GetProduct_async", - "title": "CatalogService getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.get_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2alpha.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ListProducts_async", - "title": "CatalogService listProducts Sample", - "origin": "API_DEFINITION", - "description": " Gets a list of [Product][google.cloud.retail.v2alpha.Product]s.", - "canonical": true, - "file": "product_service.list_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 133, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "read_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "require_total_size", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListProductsResponse", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_UpdateProduct_async", - "title": "CatalogService updateProduct Sample", - "origin": "API_DEFINITION", - "description": " Updates a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.update_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2alpha.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 133, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "require_total_size", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_DeleteProduct_async", - "title": "CatalogService deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2alpha.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_PurgeProducts_async", - "title": "CatalogService purgeProducts Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", - "canonical": true, - "file": "product_service.purge_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2alpha.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", - "title": "CatalogService importProducts Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s to be successfully updated.", - "canonical": true, - "file": "product_service.import_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.ProductInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "reconciliation_mode", - "type": ".google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_PurgeProducts_async", + "title": "CatalogService purgeProducts Sample", + "origin": "API_DEFINITION", + "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", + "canonical": true, + "file": "product_service.purge_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "PurgeProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", - "title": "CatalogService setInventory Sample", - "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.set_inventory.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 116, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", - "async": true, - "parameters": [ - { - "name": "inventory", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "set_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "set_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", + "title": "CatalogService importProducts Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s to be successfully updated.", + "canonical": true, + "file": "product_service.import_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2alpha.ProductInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "reconciliation_mode", + "type": ".google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", - "title": "CatalogService addFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.add_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", + "title": "CatalogService setInventory Sample", + "origin": "API_DEFINITION", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.set_inventory.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 116, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2alpha.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "CatalogService removeFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.remove_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 103, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", - "title": "CatalogService addLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.add_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "local_inventories", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "add_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", - "title": "CatalogService removeLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.remove_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", + "title": "CatalogService addLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "local_inventories", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "add_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_SearchService_Search_async", - "title": "CatalogService search Sample", - "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "search_service.search.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 273, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2alpha.SearchService.Search", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2alpha.UserInfo" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "offset", - "type": "TYPE_INT32" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "canonical_filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "facet_specs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "dynamic_facet_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec" - }, - { - "name": "boost_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.BoostSpec" - }, - { - "name": "query_expansion_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec" - }, - { - "name": "relevance_threshold", - "type": ".google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold" - }, - { - "name": "variant_rollup_keys", - "type": "TYPE_STRING[]" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "search_mode", - "type": ".google.cloud.retail.v2alpha.SearchRequest.SearchMode" - }, - { - "name": "personalization_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec" - } - ], - "resultType": ".google.cloud.retail.v2alpha.SearchResponse", - "client": { - "shortName": "SearchServiceClient", - "fullName": "google.cloud.retail.v2alpha.SearchServiceClient" + "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", + "title": "CatalogService removeLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" + }, + "method": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2alpha.ProductService" + } + } + } }, - "method": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2alpha.SearchService.Search", - "service": { - "shortName": "SearchService", - "fullName": "google.cloud.retail.v2alpha.SearchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async", - "title": "CatalogService createServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.", - "canonical": true, - "file": "serving_config_service.create_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "serving_config", - "type": ".google.cloud.retail.v2alpha.ServingConfig" - }, - { - "name": "serving_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_SearchService_Search_async", + "title": "CatalogService search Sample", + "origin": "API_DEFINITION", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "search_service.search.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 273, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2alpha.SearchService.Search", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "branch", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "user_info", + "type": ".google.cloud.retail.v2alpha.UserInfo" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "offset", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "canonical_filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "facet_specs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "dynamic_facet_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec" + }, + { + "name": "boost_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.BoostSpec" + }, + { + "name": "query_expansion_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec" + }, + { + "name": "relevance_threshold", + "type": ".google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold" + }, + { + "name": "variant_rollup_keys", + "type": "TYPE_STRING[]" + }, + { + "name": "page_categories", + "type": "TYPE_STRING[]" + }, + { + "name": "search_mode", + "type": ".google.cloud.retail.v2alpha.SearchRequest.SearchMode" + }, + { + "name": "personalization_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec" + } + ], + "resultType": ".google.cloud.retail.v2alpha.SearchResponse", + "client": { + "shortName": "SearchServiceClient", + "fullName": "google.cloud.retail.v2alpha.SearchServiceClient" + }, + "method": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2alpha.SearchService.Search", + "service": { + "shortName": "SearchService", + "fullName": "google.cloud.retail.v2alpha.SearchService" + } + } + } }, - "method": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async", - "title": "CatalogService deleteServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.delete_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async", + "title": "CatalogService createServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.", + "canonical": true, + "file": "serving_config_service.create_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "serving_config", + "type": ".google.cloud.retail.v2alpha.ServingConfig" + }, + { + "name": "serving_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async", - "title": "CatalogService updateServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ServingConfig.", - "canonical": true, - "file": "serving_config_service.update_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": ".google.cloud.retail.v2alpha.ServingConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async", + "title": "CatalogService deleteServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.delete_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_GetServingConfig_async", - "title": "CatalogService getServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.get_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async", + "title": "CatalogService updateServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ServingConfig.", + "canonical": true, + "file": "serving_config_service.update_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": ".google.cloud.retail.v2alpha.ServingConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async", - "title": "CatalogService listServingConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists all ServingConfigs linked to this catalog.", - "canonical": true, - "file": "serving_config_service.list_serving_configs.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListServingConfigsResponse", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_GetServingConfig_async", + "title": "CatalogService getServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.get_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_AddControl_async", - "title": "CatalogService addControl Sample", - "origin": "API_DEFINITION", - "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", - "canonical": true, - "file": "serving_config_service.add_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async", + "title": "CatalogService listServingConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists all ServingConfigs linked to this catalog.", + "canonical": true, + "file": "serving_config_service.list_serving_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListServingConfigsResponse", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_RemoveControl_async", - "title": "CatalogService removeControl Sample", - "origin": "API_DEFINITION", - "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", - "canonical": true, - "file": "serving_config_service.remove_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_AddControl_async", + "title": "CatalogService addControl Sample", + "origin": "API_DEFINITION", + "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", + "canonical": true, + "file": "serving_config_service.add_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_WriteUserEvent_async", - "title": "CatalogService writeUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event.", - "canonical": true, - "file": "user_event_service.write_user_event.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2alpha.UserEvent" - } - ], - "resultType": ".google.cloud.retail.v2alpha.UserEvent", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + "regionTag": "retail_v2alpha_generated_ServingConfigService_RemoveControl_async", + "title": "CatalogService removeControl Sample", + "origin": "API_DEFINITION", + "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", + "canonical": true, + "file": "serving_config_service.remove_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" + }, + "method": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2alpha.ServingConfigService" + } + } + } }, - "method": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_CollectUserEvent_async", - "title": "CatalogService collectUserEvent Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.collect_user_event.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": "TYPE_STRING" - }, - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "ets", - "type": "TYPE_INT64" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + "regionTag": "retail_v2alpha_generated_UserEventService_WriteUserEvent_async", + "title": "CatalogService writeUserEvent Sample", + "origin": "API_DEFINITION", + "description": " Writes a single user event.", + "canonical": true, + "file": "user_event_service.write_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2alpha.UserEvent" + } + ], + "resultType": ".google.cloud.retail.v2alpha.UserEvent", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } }, - "method": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_PurgeUserEvents_async", - "title": "CatalogService purgeUserEvents Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.purge_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + "regionTag": "retail_v2alpha_generated_UserEventService_CollectUserEvent_async", + "title": "CatalogService collectUserEvent Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.collect_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": "TYPE_STRING" + }, + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "ets", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } }, - "method": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_ImportUserEvents_async", - "title": "CatalogService importUserEvents Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.import_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.UserEventInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + "regionTag": "retail_v2alpha_generated_UserEventService_PurgeUserEvents_async", + "title": "CatalogService purgeUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.purge_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } }, - "method": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_RejoinUserEvents_async", - "title": "CatalogService rejoinUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", - "canonical": true, - "file": "user_event_service.rejoin_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event_rejoin_scope", - "type": ".google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + "regionTag": "retail_v2alpha_generated_UserEventService_ImportUserEvents_async", + "title": "CatalogService importUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.import_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2alpha.UserEventInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } }, - "method": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } + { + "regionTag": "retail_v2alpha_generated_UserEventService_RejoinUserEvents_async", + "title": "CatalogService rejoinUserEvents Sample", + "origin": "API_DEFINITION", + "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", + "canonical": true, + "file": "user_event_service.rejoin_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event_rejoin_scope", + "type": ".google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" + }, + "method": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2alpha.UserEventService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 8e89b650252..a8a773b8ae0 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -1,2131 +1,2131 @@ { - "clientLibrary": { - "name": "nodejs-retail", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.retail.v2beta", - "version": "v2beta" - } - ] - }, - "snippets": [ - { - "regionTag": "retail_v2beta_generated_CatalogService_ListCatalogs_async", - "title": "CatalogService listCatalogs Sample", - "origin": "API_DEFINITION", - "description": " Lists all the [Catalog][google.cloud.retail.v2beta.Catalog]s associated with the project.", - "canonical": true, - "file": "catalog_service.list_catalogs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2beta.CatalogService.ListCatalogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ListCatalogsResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" - }, - "method": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2beta.CatalogService.ListCatalogs", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } + "clientLibrary": { + "name": "nodejs-retail", + "version": "1.8.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.retail.v2beta", + "version": "v2beta" + } + ] }, - { - "regionTag": "retail_v2beta_generated_CatalogService_UpdateCatalog_async", - "title": "CatalogService updateCatalog Sample", - "origin": "API_DEFINITION", - "description": " Updates the [Catalog][google.cloud.retail.v2beta.Catalog]s.", - "canonical": true, - "file": "catalog_service.update_catalog.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCatalog", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": ".google.cloud.retail.v2beta.Catalog" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.Catalog", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_ListCatalogs_async", + "title": "CatalogService listCatalogs Sample", + "origin": "API_DEFINITION", + "description": " Lists all the [Catalog][google.cloud.retail.v2beta.Catalog]s associated with the project.", + "canonical": true, + "file": "catalog_service.list_catalogs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2beta.CatalogService.ListCatalogs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListCatalogsResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "ListCatalogs", + "fullName": "google.cloud.retail.v2beta.CatalogService.ListCatalogs", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCatalog", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_SetDefaultBranch_async", - "title": "CatalogService setDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", - "canonical": true, - "file": "catalog_service.set_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2beta.CatalogService.SetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "branch_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_UpdateCatalog_async", + "title": "CatalogService updateCatalog Sample", + "origin": "API_DEFINITION", + "description": " Updates the [Catalog][google.cloud.retail.v2beta.Catalog]s.", + "canonical": true, + "file": "catalog_service.update_catalog.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCatalog", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": ".google.cloud.retail.v2beta.Catalog" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.Catalog", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCatalog", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCatalog", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2beta.CatalogService.SetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_GetDefaultBranch_async", - "title": "CatalogService getDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] method under a specified parent catalog.", - "canonical": true, - "file": "catalog_service.get_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2beta.CatalogService.GetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.GetDefaultBranchResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_SetDefaultBranch_async", + "title": "CatalogService setDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2beta.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", + "canonical": true, + "file": "catalog_service.set_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.SetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "branch_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "SetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.SetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2beta.CatalogService.GetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_GetCompletionConfig_async", - "title": "CatalogService getCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig].", - "canonical": true, - "file": "catalog_service.get_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.GetCompletionConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_GetDefaultBranch_async", + "title": "CatalogService getDefaultBranch Sample", + "origin": "API_DEFINITION", + "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2beta.CatalogService.SetDefaultBranch] method under a specified parent catalog.", + "canonical": true, + "file": "catalog_service.get_default_branch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetDefaultBranch", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.GetDefaultBranchResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "GetDefaultBranch", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetDefaultBranch", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.GetCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async", - "title": "CatalogService updateCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig]s.", - "canonical": true, - "file": "catalog_service.update_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig", - "async": true, - "parameters": [ - { - "name": "completion_config", - "type": ".google.cloud.retail.v2beta.CompletionConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_GetCompletionConfig_async", + "title": "CatalogService getCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig].", + "canonical": true, + "file": "catalog_service.get_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetCompletionConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_GetAttributesConfig_async", - "title": "CatalogService getAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets an [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig].", - "canonical": true, - "file": "catalog_service.get_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.GetAttributesConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async", + "title": "CatalogService updateCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [CompletionConfig][google.cloud.retail.v2beta.CompletionConfig]s.", + "canonical": true, + "file": "catalog_service.update_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig", + "async": true, + "parameters": [ + { + "name": "completion_config", + "type": ".google.cloud.retail.v2beta.CompletionConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.GetAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async", - "title": "CatalogService updateAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", - "canonical": true, - "file": "catalog_service.update_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": ".google.cloud.retail.v2beta.AttributesConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_GetAttributesConfig_async", + "title": "CatalogService getAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets an [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig].", + "canonical": true, + "file": "catalog_service.get_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetAttributesConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.GetAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_AddCatalogAttribute_async", - "title": "CatalogService addCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "catalog_service.add_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2beta.CatalogAttribute" - } - ], - "resultType": ".google.cloud.retail.v2beta.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async", + "title": "CatalogService updateAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", + "canonical": true, + "file": "catalog_service.update_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": ".google.cloud.retail.v2beta.AttributesConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async", - "title": "CatalogService removeCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.remove_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "key", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_AddCatalogAttribute_async", + "title": "CatalogService addCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "catalog_service.add_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2beta.CatalogAttribute" + } + ], + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async", - "title": "CatalogService replaceCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2beta.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.replace_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2beta.CatalogAttribute" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async", + "title": "CatalogService removeCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.remove_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "key", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.RemoveCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2beta.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CompletionService_CompleteQuery_async", - "title": "CatalogService completeQuery Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.complete_query.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 109, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "device_type", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.retail.v2beta.CompleteQueryResponse", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + "regionTag": "retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async", + "title": "CatalogService replaceCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2beta.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.replace_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2beta.CatalogAttribute" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } }, - "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2beta.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_CompletionService_ImportCompletionData_async", - "title": "CatalogService importCompletionData Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.import_completion_data.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2beta.CompletionDataInputConfig" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + "regionTag": "retail_v2beta_generated_CompletionService_CompleteQuery_async", + "title": "CatalogService completeQuery Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.complete_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 109, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "async": true, + "parameters": [ + { + "name": "catalog", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "device_type", + "type": "TYPE_STRING" + }, + { + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2beta.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2beta.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2beta.CompletionService" + } + } + } }, - "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2beta.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ControlService_CreateControl_async", - "title": "CatalogService createControl Sample", - "origin": "API_DEFINITION", - "description": " Creates a Control. If the [Control][google.cloud.retail.v2beta.Control] to create already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "control_service.create_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2beta.ControlService.CreateControl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "control", - "type": ".google.cloud.retail.v2beta.Control" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + "regionTag": "retail_v2beta_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2beta.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2beta.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2beta.CompletionService" + } + } + } }, - "method": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2beta.ControlService.CreateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2beta.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ControlService_DeleteControl_async", - "title": "CatalogService deleteControl Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Control. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.delete_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2beta.ControlService.DeleteControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + "regionTag": "retail_v2beta_generated_ControlService_CreateControl_async", + "title": "CatalogService createControl Sample", + "origin": "API_DEFINITION", + "description": " Creates a Control. If the [Control][google.cloud.retail.v2beta.Control] to create already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "control_service.create_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.CreateControl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "control", + "type": ".google.cloud.retail.v2beta.Control" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.CreateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } }, - "method": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2beta.ControlService.DeleteControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2beta.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ControlService_UpdateControl_async", - "title": "CatalogService updateControl Sample", - "origin": "API_DEFINITION", - "description": " Updates a Control. [Control][google.cloud.retail.v2beta.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.update_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2beta.ControlService.UpdateControl", - "async": true, - "parameters": [ - { - "name": "control", - "type": ".google.cloud.retail.v2beta.Control" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + "regionTag": "retail_v2beta_generated_ControlService_DeleteControl_async", + "title": "CatalogService deleteControl Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Control. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.delete_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2beta.ControlService.DeleteControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2beta.ControlService.DeleteControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } }, - "method": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2beta.ControlService.UpdateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2beta.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ControlService_GetControl_async", - "title": "CatalogService getControl Sample", - "origin": "API_DEFINITION", - "description": " Gets a Control.", - "canonical": true, - "file": "control_service.get_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2beta.ControlService.GetControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + "regionTag": "retail_v2beta_generated_ControlService_UpdateControl_async", + "title": "CatalogService updateControl Sample", + "origin": "API_DEFINITION", + "description": " Updates a Control. [Control][google.cloud.retail.v2beta.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.update_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.UpdateControl", + "async": true, + "parameters": [ + { + "name": "control", + "type": ".google.cloud.retail.v2beta.Control" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2beta.ControlService.UpdateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } }, - "method": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2beta.ControlService.GetControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2beta.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ControlService_ListControls_async", - "title": "CatalogService listControls Sample", - "origin": "API_DEFINITION", - "description": " Lists all Controls linked to this catalog.", - "canonical": true, - "file": "control_service.list_controls.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2beta.ControlService.ListControls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ListControlsResponse", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + "regionTag": "retail_v2beta_generated_ControlService_GetControl_async", + "title": "CatalogService getControl Sample", + "origin": "API_DEFINITION", + "description": " Gets a Control.", + "canonical": true, + "file": "control_service.get_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2beta.ControlService.GetControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2beta.ControlService.GetControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } }, - "method": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2beta.ControlService.ListControls", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2beta.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_PredictionService_Predict_async", - "title": "CatalogService predict Sample", - "origin": "API_DEFINITION", - "description": " Makes a recommendation prediction.", - "canonical": true, - "file": "prediction_service.predict.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 153, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2beta.UserEvent" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "params", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2beta.PredictResponse", - "client": { - "shortName": "PredictionServiceClient", - "fullName": "google.cloud.retail.v2beta.PredictionServiceClient" + "regionTag": "retail_v2beta_generated_ControlService_ListControls_async", + "title": "CatalogService listControls Sample", + "origin": "API_DEFINITION", + "description": " Lists all Controls linked to this catalog.", + "canonical": true, + "file": "control_service.list_controls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2beta.ControlService.ListControls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListControlsResponse", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2beta.ControlServiceClient" + }, + "method": { + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2beta.ControlService.ListControls", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2beta.ControlService" + } + } + } }, - "method": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", - "service": { - "shortName": "PredictionService", - "fullName": "google.cloud.retail.v2beta.PredictionService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_CreateProduct_async", - "title": "CatalogService createProduct Sample", - "origin": "API_DEFINITION", - "description": " Creates a [Product][google.cloud.retail.v2beta.Product].", - "canonical": true, - "file": "product_service.create_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.retail.v2beta.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_PredictionService_Predict_async", + "title": "CatalogService predict Sample", + "origin": "API_DEFINITION", + "description": " Makes a recommendation prediction.", + "canonical": true, + "file": "prediction_service.predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 153, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2beta.UserEvent" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "params", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.retail.v2beta.PredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.retail.v2beta.PredictionServiceClient" + }, + "method": { + "shortName": "Predict", + "fullName": "google.cloud.retail.v2beta.PredictionService.Predict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.retail.v2beta.PredictionService" + } + } + } }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_GetProduct_async", - "title": "CatalogService getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets a [Product][google.cloud.retail.v2beta.Product].", - "canonical": true, - "file": "product_service.get_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_CreateProduct_async", + "title": "CatalogService createProduct Sample", + "origin": "API_DEFINITION", + "description": " Creates a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.create_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "product", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "product_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "CreateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.CreateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_ListProducts_async", - "title": "CatalogService listProducts Sample", - "origin": "API_DEFINITION", - "description": " Gets a list of [Product][google.cloud.retail.v2beta.Product]s.", - "canonical": true, - "file": "product_service.list_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 124, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "read_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.ListProductsResponse", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_GetProduct_async", + "title": "CatalogService getProduct Sample", + "origin": "API_DEFINITION", + "description": " Gets a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.get_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "GetProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.GetProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_UpdateProduct_async", - "title": "CatalogService updateProduct Sample", - "origin": "API_DEFINITION", - "description": " Updates a [Product][google.cloud.retail.v2beta.Product].", - "canonical": true, - "file": "product_service.update_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.retail.v2beta.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2beta.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_ListProducts_async", + "title": "CatalogService listProducts Sample", + "origin": "API_DEFINITION", + "description": " Gets a list of [Product][google.cloud.retail.v2beta.Product]s.", + "canonical": true, + "file": "product_service.list_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 124, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListProductsResponse", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "ListProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ListProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_DeleteProduct_async", - "title": "CatalogService deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [Product][google.cloud.retail.v2beta.Product].", - "canonical": true, - "file": "product_service.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_UpdateProduct_async", + "title": "CatalogService updateProduct Sample", + "origin": "API_DEFINITION", + "description": " Updates a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.update_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "async": true, + "parameters": [ + { + "name": "product", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.retail.v2beta.Product", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "UpdateProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.UpdateProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_ImportProducts_async", - "title": "CatalogService importProducts Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2beta.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.v2beta.Product]s to be successfully updated.", - "canonical": true, - "file": "product_service.import_products.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2beta.ProductService.ImportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2beta.ProductInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2beta.ImportErrorsConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "reconciliation_mode", - "type": ".google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_DeleteProduct_async", + "title": "CatalogService deleteProduct Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Product][google.cloud.retail.v2beta.Product].", + "canonical": true, + "file": "product_service.delete_product.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "DeleteProduct", + "fullName": "google.cloud.retail.v2beta.ProductService.DeleteProduct", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2beta.ProductService.ImportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_SetInventory_async", - "title": "CatalogService setInventory Sample", - "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.set_inventory.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 116, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", - "async": true, - "parameters": [ - { - "name": "inventory", - "type": ".google.cloud.retail.v2beta.Product" - }, - { - "name": "set_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "set_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_ImportProducts_async", + "title": "CatalogService importProducts Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2beta.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.v2beta.Product]s to be successfully updated.", + "canonical": true, + "file": "product_service.import_products.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ImportProducts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.ProductInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2beta.ImportErrorsConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "reconciliation_mode", + "type": ".google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "ImportProducts", + "fullName": "google.cloud.retail.v2beta.ProductService.ImportProducts", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", - "title": "CatalogService addFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.add_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_SetInventory_async", + "title": "CatalogService setInventory Sample", + "origin": "API_DEFINITION", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.set_inventory.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 116, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "async": true, + "parameters": [ + { + "name": "inventory", + "type": ".google.cloud.retail.v2beta.Product" + }, + { + "name": "set_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "set_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "SetInventory", + "fullName": "google.cloud.retail.v2beta.ProductService.SetInventory", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "CatalogService removeFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.remove_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 103, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", + "title": "CatalogService addFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "AddFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_AddLocalInventories_async", - "title": "CatalogService addLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.add_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2beta.ProductService.AddLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "local_inventories", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "add_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", + "title": "CatalogService removeFulfillmentPlaces Sample", + "origin": "API_DEFINITION", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_fulfillment_places.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 103, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "type", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "RemoveFulfillmentPlaces", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2beta.ProductService.AddLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ProductService_RemoveLocalInventories_async", - "title": "CatalogService removeLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "product_service.remove_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2beta.ProductService.RemoveLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_AddLocalInventories_async", + "title": "CatalogService addLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.add_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 92, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.AddLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "local_inventories", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "add_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "add_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "AddLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.AddLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2beta.ProductService.RemoveLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2beta.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_SearchService_Search_async", - "title": "CatalogService search Sample", - "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "search_service.search.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 253, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2beta.SearchService.Search", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2beta.UserInfo" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "offset", - "type": "TYPE_INT32" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "canonical_filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "facet_specs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "dynamic_facet_spec", - "type": ".google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec" - }, - { - "name": "boost_spec", - "type": ".google.cloud.retail.v2beta.SearchRequest.BoostSpec" - }, - { - "name": "query_expansion_spec", - "type": ".google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec" - }, - { - "name": "variant_rollup_keys", - "type": "TYPE_STRING[]" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "search_mode", - "type": ".google.cloud.retail.v2beta.SearchRequest.SearchMode" - }, - { - "name": "personalization_spec", - "type": ".google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec" - } - ], - "resultType": ".google.cloud.retail.v2beta.SearchResponse", - "client": { - "shortName": "SearchServiceClient", - "fullName": "google.cloud.retail.v2beta.SearchServiceClient" + "regionTag": "retail_v2beta_generated_ProductService_RemoveLocalInventories_async", + "title": "CatalogService removeLocalInventories Sample", + "origin": "API_DEFINITION", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "product_service.remove_local_inventories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveLocalInventories", + "async": true, + "parameters": [ + { + "name": "product", + "type": "TYPE_STRING" + }, + { + "name": "place_ids", + "type": "TYPE_STRING[]" + }, + { + "name": "remove_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProductServiceClient", + "fullName": "google.cloud.retail.v2beta.ProductServiceClient" + }, + "method": { + "shortName": "RemoveLocalInventories", + "fullName": "google.cloud.retail.v2beta.ProductService.RemoveLocalInventories", + "service": { + "shortName": "ProductService", + "fullName": "google.cloud.retail.v2beta.ProductService" + } + } + } }, - "method": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2beta.SearchService.Search", - "service": { - "shortName": "SearchService", - "fullName": "google.cloud.retail.v2beta.SearchService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_CreateServingConfig_async", - "title": "CatalogService createServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2beta.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2beta.Catalog], otherwise a FAILED_PRECONDITION error is returned.", - "canonical": true, - "file": "serving_config_service.create_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.CreateServingConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "serving_config", - "type": ".google.cloud.retail.v2beta.ServingConfig" - }, - { - "name": "serving_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_SearchService_Search_async", + "title": "CatalogService search Sample", + "origin": "API_DEFINITION", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "search_service.search.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 253, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2beta.SearchService.Search", + "async": true, + "parameters": [ + { + "name": "placement", + "type": "TYPE_STRING" + }, + { + "name": "branch", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "visitor_id", + "type": "TYPE_STRING" + }, + { + "name": "user_info", + "type": ".google.cloud.retail.v2beta.UserInfo" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "offset", + "type": "TYPE_INT32" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "canonical_filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "facet_specs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "dynamic_facet_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec" + }, + { + "name": "boost_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.BoostSpec" + }, + { + "name": "query_expansion_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec" + }, + { + "name": "variant_rollup_keys", + "type": "TYPE_STRING[]" + }, + { + "name": "page_categories", + "type": "TYPE_STRING[]" + }, + { + "name": "search_mode", + "type": ".google.cloud.retail.v2beta.SearchRequest.SearchMode" + }, + { + "name": "personalization_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec" + } + ], + "resultType": ".google.cloud.retail.v2beta.SearchResponse", + "client": { + "shortName": "SearchServiceClient", + "fullName": "google.cloud.retail.v2beta.SearchServiceClient" + }, + "method": { + "shortName": "Search", + "fullName": "google.cloud.retail.v2beta.SearchService.Search", + "service": { + "shortName": "SearchService", + "fullName": "google.cloud.retail.v2beta.SearchService" + } + } + } }, - "method": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.CreateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async", - "title": "CatalogService deleteServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.delete_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_CreateServingConfig_async", + "title": "CatalogService createServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2beta.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2beta.Catalog], otherwise a FAILED_PRECONDITION error is returned.", + "canonical": true, + "file": "serving_config_service.create_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.CreateServingConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "serving_config", + "type": ".google.cloud.retail.v2beta.ServingConfig" + }, + { + "name": "serving_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.CreateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async", - "title": "CatalogService updateServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ServingConfig.", - "canonical": true, - "file": "serving_config_service.update_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfig", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": ".google.cloud.retail.v2beta.ServingConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2beta.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async", + "title": "CatalogService deleteServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.delete_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.DeleteServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_GetServingConfig_async", - "title": "CatalogService getServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.get_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.GetServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async", + "title": "CatalogService updateServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ServingConfig.", + "canonical": true, + "file": "serving_config_service.update_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfig", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": ".google.cloud.retail.v2beta.ServingConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.UpdateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.GetServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_ListServingConfigs_async", - "title": "CatalogService listServingConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists all ServingConfigs linked to this catalog.", - "canonical": true, - "file": "serving_config_service.list_serving_configs.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.ListServingConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ListServingConfigsResponse", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_GetServingConfig_async", + "title": "CatalogService getServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.get_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.GetServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.GetServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.ListServingConfigs", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_AddControl_async", - "title": "CatalogService addControl Sample", - "origin": "API_DEFINITION", - "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", - "canonical": true, - "file": "serving_config_service.add_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.AddControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_ListServingConfigs_async", + "title": "CatalogService listServingConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists all ServingConfigs linked to this catalog.", + "canonical": true, + "file": "serving_config_service.list_serving_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.ListServingConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListServingConfigsResponse", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.ListServingConfigs", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.AddControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_ServingConfigService_RemoveControl_async", - "title": "CatalogService removeControl Sample", - "origin": "API_DEFINITION", - "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", - "canonical": true, - "file": "serving_config_service.remove_control.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.RemoveControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2beta.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_AddControl_async", + "title": "CatalogService addControl Sample", + "origin": "API_DEFINITION", + "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", + "canonical": true, + "file": "serving_config_service.add_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.AddControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.AddControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2beta.ServingConfigService.RemoveControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2beta.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_UserEventService_WriteUserEvent_async", - "title": "CatalogService writeUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event.", - "canonical": true, - "file": "user_event_service.write_user_event.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2beta.UserEventService.WriteUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2beta.UserEvent" - } - ], - "resultType": ".google.cloud.retail.v2beta.UserEvent", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + "regionTag": "retail_v2beta_generated_ServingConfigService_RemoveControl_async", + "title": "CatalogService removeControl Sample", + "origin": "API_DEFINITION", + "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", + "canonical": true, + "file": "serving_config_service.remove_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.RemoveControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2beta.ServingConfigServiceClient" + }, + "method": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2beta.ServingConfigService.RemoveControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2beta.ServingConfigService" + } + } + } }, - "method": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2beta.UserEventService.WriteUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2beta.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_UserEventService_CollectUserEvent_async", - "title": "CatalogService collectUserEvent Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.collect_user_event.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2beta.UserEventService.CollectUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": "TYPE_STRING" - }, - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "ets", - "type": "TYPE_INT64" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + "regionTag": "retail_v2beta_generated_UserEventService_WriteUserEvent_async", + "title": "CatalogService writeUserEvent Sample", + "origin": "API_DEFINITION", + "description": " Writes a single user event.", + "canonical": true, + "file": "user_event_service.write_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.WriteUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": ".google.cloud.retail.v2beta.UserEvent" + } + ], + "resultType": ".google.cloud.retail.v2beta.UserEvent", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "WriteUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.WriteUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } }, - "method": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2beta.UserEventService.CollectUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2beta.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_UserEventService_PurgeUserEvents_async", - "title": "CatalogService purgeUserEvents Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.purge_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2beta.UserEventService.PurgeUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + "regionTag": "retail_v2beta_generated_UserEventService_CollectUserEvent_async", + "title": "CatalogService collectUserEvent Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.collect_user_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.CollectUserEvent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event", + "type": "TYPE_STRING" + }, + { + "name": "uri", + "type": "TYPE_STRING" + }, + { + "name": "ets", + "type": "TYPE_INT64" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "CollectUserEvent", + "fullName": "google.cloud.retail.v2beta.UserEventService.CollectUserEvent", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } }, - "method": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2beta.UserEventService.PurgeUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2beta.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_UserEventService_ImportUserEvents_async", - "title": "CatalogService importUserEvents Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "user_event_service.import_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2beta.UserEventService.ImportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2beta.UserEventInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2beta.ImportErrorsConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + "regionTag": "retail_v2beta_generated_UserEventService_PurgeUserEvents_async", + "title": "CatalogService purgeUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.purge_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.PurgeUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "PurgeUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.PurgeUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } }, - "method": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2beta.UserEventService.ImportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2beta.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2beta_generated_UserEventService_RejoinUserEvents_async", - "title": "CatalogService rejoinUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", - "canonical": true, - "file": "user_event_service.rejoin_user_events.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2beta.UserEventService.RejoinUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event_rejoin_scope", - "type": ".google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + "regionTag": "retail_v2beta_generated_UserEventService_ImportUserEvents_async", + "title": "CatalogService importUserEvents Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "user_event_service.import_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.ImportUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2beta.UserEventInputConfig" + }, + { + "name": "errors_config", + "type": ".google.cloud.retail.v2beta.ImportErrorsConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "ImportUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.ImportUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } }, - "method": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2beta.UserEventService.RejoinUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2beta.UserEventService" - } + { + "regionTag": "retail_v2beta_generated_UserEventService_RejoinUserEvents_async", + "title": "CatalogService rejoinUserEvents Sample", + "origin": "API_DEFINITION", + "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", + "canonical": true, + "file": "user_event_service.rejoin_user_events.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.RejoinUserEvents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "user_event_rejoin_scope", + "type": ".google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "UserEventServiceClient", + "fullName": "google.cloud.retail.v2beta.UserEventServiceClient" + }, + "method": { + "shortName": "RejoinUserEvents", + "fullName": "google.cloud.retail.v2beta.UserEventService.RejoinUserEvents", + "service": { + "shortName": "UserEventService", + "fullName": "google.cloud.retail.v2beta.UserEventService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file From 6467896999205efdf52b9a05fa4a819a07ceb5dd Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 3 May 2022 02:28:38 +0200 Subject: [PATCH 078/103] chore(deps): update dependency @types/mocha to v9 (#175) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^8.0.4` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/8.2.3/9.1.1) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/compatibility-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/confidence-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index a879468c020..ea687b6fa3b 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -45,7 +45,7 @@ "google-gax": "^2.24.1" }, "devDependencies": { - "@types/mocha": "^8.0.4", + "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.3.5", From 35744ba44fe24f0082fe0f45fd897b3f97825dd5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 6 May 2022 12:35:57 -0700 Subject: [PATCH 079/103] chore(main): release 1.8.1 (#170) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 1.8.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- .../v2/snippet_metadata.google.cloud.retail.v2.json | 2 +- .../snippet_metadata.google.cloud.retail.v2alpha.json | 2 +- .../snippet_metadata.google.cloud.retail.v2beta.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 55e8f443317..de8bb688fba 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.8.1](https://github.com/googleapis/nodejs-retail/compare/v1.8.0...v1.8.1) (2022-05-06) + + +### Bug Fixes + +* read projectId from retailClient.getProjectId ([#159](https://github.com/googleapis/nodejs-retail/issues/159)) ([f4fa61c](https://github.com/googleapis/nodejs-retail/commit/f4fa61c2a385b197dd0cfd923b1ac1d07d6539de)) + ## [1.8.0](https://github.com/googleapis/nodejs-retail/compare/v1.7.0...v1.8.0) (2022-04-08) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index ea687b6fa3b..c96eaf8c9f4 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.8.0", + "version": "1.8.1", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index f2afb141aed..7949361c9a5 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "1.8.0", + "version": "1.8.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index 0fd32166f5f..5226b68613c 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "1.8.0", + "version": "1.8.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index a8a773b8ae0..6281670cda9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "1.8.0", + "version": "1.8.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 332fa5e55da..487fd5b606a 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.8.0", + "@google-cloud/retail": "^1.8.1", "@google-cloud/bigquery": "^5.9.2", "@google-cloud/storage": "^5.16.1" }, From e1369746f99fd407398432ed464ad837cca43ec8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 9 May 2022 17:36:22 +0200 Subject: [PATCH 080/103] chore(deps): update dependency sinon to v14 (#178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^13.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/sinon/13.0.2/14.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/compatibility-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/confidence-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v14.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1400) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v13.0.2...v14.0.0) - [`c2bbd826`](https://togithub.com/sinonjs/sinon/commit/c2bbd82641444eb5b32822489ae40f185afbbf00) Drop node 12 (Morgan Roderick) > And embrace Node 18 > > See https://nodejs.org/en/about/releases/ *Released by Morgan Roderick on 2022-05-07.*
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index c96eaf8c9f4..82b638477d8 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -57,7 +57,7 @@ "mocha": "^8.2.1", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", + "sinon": "^14.0.0", "ts-loader": "^9.0.0", "typescript": "^4.1.2", "webpack": "^5.9.0", From 427a6629b0256baf6fb36a7e6aa1bd6907dd5750 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Fri, 20 May 2022 11:19:47 -0700 Subject: [PATCH 081/103] build!: update library to use Node 12 (#181) * build!: Update library to use Node 12 --- packages/google-cloud-retail/package.json | 10 +++++----- packages/google-cloud-retail/samples/package.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 82b638477d8..ebccf802dbd 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,28 +42,28 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^2.24.1" + "google-gax": "^3.0.1" }, "devDependencies": { "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.3.5", - "gts": "^3.0.3", + "gts": "^3.1.0", "jsdoc": "^3.6.6", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.6", "linkinator": "^2.7.0", - "mocha": "^8.2.1", + "mocha": "^9.2.2", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", "sinon": "^14.0.0", "ts-loader": "^9.0.0", - "typescript": "^4.1.2", + "typescript": "^4.6.4", "webpack": "^5.9.0", "webpack-cli": "^4.2.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=12.0.0" } } diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 487fd5b606a..6ef964792e5 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "files": [ "*.js" @@ -22,4 +22,4 @@ "chai": "^4.2.0", "mocha": "^8.0.0" } -} +} \ No newline at end of file From c4669fb1293cd85568765da48ce3b0d4b7edc42e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:01:02 -0700 Subject: [PATCH 082/103] feat: allow users to disable spell check in search requests (#183) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: fix docstring formatting Committer: parthea PiperOrigin-RevId: 449545643 Source-Link: https://github.com/googleapis/googleapis/commit/1bed8a0d6886720c5bfc8ba1076de3db68c23b83 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d4ccc5fc612c260546bcecef2873575688a02d8b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDRjY2M1ZmM2MTJjMjYwNTQ2YmNlY2VmMjg3MzU3NTY4OGEwMmQ4YiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: allow users to disable spell check in search requests feat: allow users to add labels in search requests docs: deprecate indexable/searchable on the product level custom attributes docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 452193046 Source-Link: https://github.com/googleapis/googleapis/commit/4e0282f92e4e581b79062063488bf62fa837a905 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3fa3c84e3da8c8e604e129c141367dd0926878f3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2ZhM2M4NGUzZGE4YzhlNjA0ZTEyOWMxNDEzNjdkZDA5MjY4NzhmMyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/retail/v2/catalog.proto | 16 +- .../google/cloud/retail/v2/common.proto | 36 +- .../cloud/retail/v2/completion_service.proto | 15 +- .../cloud/retail/v2/import_config.proto | 11 +- .../cloud/retail/v2/prediction_service.proto | 16 +- .../google/cloud/retail/v2/product.proto | 4 +- .../cloud/retail/v2/product_service.proto | 36 +- .../google/cloud/retail/v2/purge_config.proto | 5 +- .../cloud/retail/v2/search_service.proto | 108 ++++-- .../google/cloud/retail/v2/user_event.proto | 9 +- .../google/cloud/retail/v2alpha/catalog.proto | 4 +- .../google/cloud/retail/v2beta/catalog.proto | 4 +- .../google-cloud-retail/protos/protos.d.ts | 115 ++++++ packages/google-cloud-retail/protos/protos.js | 328 +++++++++++++++++- .../google-cloud-retail/protos/protos.json | 41 ++- .../v2/completion_service.complete_query.js | 6 +- .../v2/prediction_service.predict.js | 11 +- .../v2/product_service.import_products.js | 10 +- ...oduct_service.remove_fulfillment_places.js | 3 +- .../v2/product_service.update_product.js | 4 + .../generated/v2/search_service.search.js | 40 ++- ...ippet_metadata.google.cloud.retail.v2.json | 22 +- .../src/v2/completion_service_client.ts | 6 +- .../src/v2/prediction_service_client.ts | 12 +- .../src/v2/product_service_client.ts | 23 +- .../src/v2/search_service_client.ts | 117 ++++++- 26 files changed, 884 insertions(+), 118 deletions(-) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto index b5de698d9c4..119afaf3697 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto @@ -40,10 +40,10 @@ message ProductLevelConfig { // default to // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if // unset. - // * `variant`: You can only ingest - // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2.Product]s. - // This means + // * `variant` (incompatible with Retail Search): 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. // @@ -54,8 +54,8 @@ message ProductLevelConfig { // [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 product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string ingestion_product_type = 1; @@ -76,8 +76,8 @@ message ProductLevelConfig { // [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type] // is `variant`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string merchant_center_product_id_field = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 733b8cca913..386a9aa65eb 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -115,24 +115,29 @@ message CustomAttribute { // Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // searchable by text queries in + // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level + // attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are searchable by text queries in // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. // // Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is // set. Otherwise, a INVALID_ARGUMENT error is returned. - optional bool searchable = 3; + optional bool searchable = 3 [deprecated = true]; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // indexed, so that it can be filtered, faceted or boosted in + // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level + // attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are indexed, so that they can be filtered, + // faceted or boosted in // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. @@ -142,7 +147,7 @@ message CustomAttribute { // and // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] // for more details. - optional bool indexable = 4; + optional bool indexable = 4 [deprecated = true]; } // Fulfillment information, such as the store IDs for in-store pickup or region @@ -284,7 +289,10 @@ message PriceInfo { 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]. + // the [price][google.cloud.retail.v2.PriceInfo.price]. If set, + // [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be + // greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price], + // otherwise an INVALID_ARGUMENT error is thrown. float original_price = 3; // The costs associated with the sale of a particular product. Used for gross @@ -368,10 +376,14 @@ message Rating { // Information of an end user. message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in - // user, such as a user name. + // user, such as a user name. Don't set for anonymous users. // // Always use a hashed value for this ID. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded + // model quality. + // // 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; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto index 5e7e9a6c713..68306218992 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -133,9 +133,9 @@ message CompleteQueryRequest { // // * user-data // - // * cloud-retail - // This option requires additional allowlisting. Before using cloud-retail, - // contact Cloud Retail support team first. + // * cloud-retail: + // This option requires enabling auto-learning function first. See + // [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback @@ -154,10 +154,13 @@ message CompleteQueryResponse { string suggestion = 1; // Custom attributes for the suggestion term. + // // * For "user-data", the attributes are additional custom attributes // ingested through BigQuery. + // // * For "cloud-retail", the attributes are product attributes generated - // by Cloud Retail. + // by Cloud Retail. This is an experimental feature. Contact Retail Search + // support team if you are interested in enabling it. map attributes = 2; } @@ -185,11 +188,15 @@ message CompleteQueryResponse { // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id] // field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported. // The recent searches satisfy the follow rules: + // // * They are ordered from latest to oldest. + // // * They are matched with // [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query] // case insensitively. + // // * They are transformed to lower cases. + // // * They are UTF-8 safe. // // Recent searches are deduplicated. More recent searches will be reserved diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index 74cec22a637..cadec119405 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -214,11 +214,18 @@ message ImportProductsRequest { // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. ReconciliationMode reconciliation_mode = 5; - // Pub/Sub topic for receiving notification. If this field is set, + // Full Pub/Sub topic name for receiving notification. If this field is set, // when the import is finished, a notification will be sent to // specified Pub/Sub topic. The message data will be JSON string of a // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + // to be within the same project as + // [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent]. + // Make sure that both + // `cloud-retail-customer-data-access@system.gserviceaccount.com` and + // `service-@gcp-sa-retail.iam.gserviceaccount.com` + // have the `pubsub.topics.publish` IAM permission on the topic. // // Only supported when // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto index 061db1427b0..f1f1b4e11c7 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto @@ -63,6 +63,16 @@ message PredictRequest { // 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. + // + // Don't set + // [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or + // [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same + // fixed ID for different users. If you are trying to receive non-personalized + // recommendations (not recommended; this can negatively impact model + // performance), instead set + // [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a + // random unique ID and leave + // [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; // Maximum number of results to return per page. Set this property @@ -143,7 +153,7 @@ message PredictRequest { // * Each resource can have multiple labels, up to a maximum of 64. // * Each label must be a key-value pair. // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters, and cannot be empty. Values can be empty, and have a maximum + // characters and cannot be empty. Values can be empty and have a maximum // length of 63 characters. // * Keys and values can contain only lowercase letters, numeric characters, // underscores, and dashes. All characters must use UTF-8 encoding, and @@ -169,9 +179,9 @@ message PredictResponse { // // Possible values: // - // * `product`: JSON representation of the product. Will be set if + // * `product`: JSON representation of the product. Is set if // `returnProduct` is set to true in `PredictRequest.params`. - // * `score`: Prediction score in double value. Will be set if + // * `score`: Prediction score in double value. Is set if // `returnScore` is set to true in `PredictRequest.params`. map metadata = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index ea861fb6cfb..43443295317 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -536,11 +536,11 @@ message Product { // * [name][google.cloud.retail.v2.Product.name] // * [color_info][google.cloud.retail.v2.Product.color_info] // - // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is + // The maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. // // Note: Returning more fields in - // [SearchResponse][google.cloud.retail.v2.SearchResponse] may increase + // [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index 7131983460d..ba8d8d18e37 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -88,7 +88,7 @@ service ProductService { // Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. // - // Request processing may be synchronous. No partial updating is supported. + // Request processing may be synchronous. // Non-existing items are created. // // Note that it is possible for a subset of the @@ -139,7 +139,7 @@ service ProductService { // // Pre-existing inventory information can only be updated with // [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], - // [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], + // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], // and // [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // @@ -345,6 +345,11 @@ message UpdateProductRequest { // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. + // + // The attribute key can be updated by setting the mask path as + // "attributes.${key_name}". If a key name is present in the mask but not in + // the patching product from the request, this key will be deleted after the + // update. google.protobuf.FieldMask update_mask = 2; // If set to true, and the [Product][google.cloud.retail.v2.Product] is not @@ -572,7 +577,9 @@ message SetInventoryMetadata {} // method. message SetInventoryResponse {} -// Request message for [AddFulfillmentPlaces][] method. +// Request message for +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -640,15 +647,19 @@ message AddFulfillmentPlacesRequest { // Metadata related to the progress of the AddFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [AddFulfillmentPlaces][] method. +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesMetadata {} // Response of the AddFulfillmentPlacesRequest. Currently empty because -// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// there is no meaningful response populated from the +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] // method. message AddFulfillmentPlacesResponse {} -// Request message for [AddLocalInventories][] method. +// Request message for +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -700,11 +711,15 @@ message AddLocalInventoriesRequest { // Metadata related to the progress of the AddLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [AddLocalInventories][] method. +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesMetadata {} -// Response of the [AddLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [AddLocalInventories][] +// Response of the +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] // method. message AddLocalInventoriesResponse {} @@ -782,7 +797,8 @@ message RemoveFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto index 6c8d54c7e06..cb510745025 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/purge_config.proto @@ -37,7 +37,10 @@ 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]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // 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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index ec8750ae30a..82242742e8a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -113,8 +113,8 @@ message SearchRequest { // Only get facet for the given restricted values. For example, when using // "pickupInStore" as key and set restricted values to // ["store123", "store456"], only facets for "store123" and "store456" are - // returned. Only supported on textual fields and fulfillments. - // Maximum is 20. + // returned. Only supported on predefined textual fields, custom textual + // attributes and fulfillments. Maximum is 20. // // Must be set for the fulfillment facet keys: // @@ -206,19 +206,29 @@ message SearchRequest { // List of keys to exclude when faceting. // + // // By default, // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] // is not excluded from the filter unless it is listed in this field. // - // For example, suppose there are 100 products with color facet "Red" and - // 200 products with color facet "Blue". A query containing the filter - // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // Listing a facet key in this field allows its values to appear as facet + // results, even when they are filtered out of search results. Using this + // field does not affect what search results are returned. + // + // For example, suppose there are 100 products with the color facet "Red" + // and 200 products with the color facet "Blue". A query containing the + // filter "colorFamilies:ANY("Red")" and having "colorFamilies" as // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] - // will by default return the "Red" with count 100. + // would by default return only "Red" products in the search results, and + // also return "Red" with count 100 as the only color facet. Although there + // are also blue products available, "Blue" would not be shown as an + // available facet value. // - // If this field contains "colorFamilies", then the query returns both the - // "Red" with count 100 and "Blue" with count 200, because the - // "colorFamilies" key is now excluded from the filter. + // If "colorFamilies" is listed in "excludedFilterKeys", then the query + // returns the facet values "Red" with count 100 and "Blue" with count + // 200, because the "colorFamilies" key is now excluded from the filter. + // Because this field doesn't affect search results, the search results + // are still correctly filtered to return only "Red" products. // // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error // is returned. @@ -317,7 +327,7 @@ message SearchRequest { // Condition boost specifications. If a product matches multiple conditions // in the specifictions, boost scores from these specifications are all // applied and combined in a non-linear way. Maximum number of - // specifications is 10. + // specifications is 20. repeated ConditionBoostSpec condition_boost_specs = 1; // Whether to skip boostspec validation. If this field is set to true, @@ -377,6 +387,31 @@ message SearchRequest { Mode mode = 1; } + // The specification for query spell correction. + message SpellCorrectionSpec { + // Enum describing under which mode spell correction should occur. + enum Mode { + // Unspecified spell correction mode. This defaults to + // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Google Retail Search will try to find a spell suggestion if there + // is any and put in the + // [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query]. + // The spell suggestion will not be used as the search query. + SUGGESTION_ONLY = 1; + + // Automatic spell correction built by Google Retail Search. Search will + // be based on the corrected query if found. + AUTO = 2; + } + + // The mode under which spell correction should take effect to + // replace the original search query. Default to + // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + Mode mode = 1; + } + // The search mode of each search request. enum SearchMode { // Default value. In this case both product search and faceted search will @@ -398,7 +433,9 @@ message SearchRequest { // Only faceted search will be performed. The product search will be // disabled. // - // When in this mode, one or both of [SearchRequest.facet_spec][] and + // When in this mode, one or both of + // [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs] + // and // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec] // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] @@ -407,7 +444,7 @@ message SearchRequest { } // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -422,6 +459,11 @@ message SearchRequest { ]; // Raw search query. + // + // If this field is empty, the request is considered a category browsing + // request and returned results are based on + // [filter][google.cloud.retail.v2.SearchRequest.filter] and + // [page_categories][google.cloud.retail.v2.SearchRequest.page_categories]. string query = 3; // Required. A unique identifier for tracking visitors. For example, this @@ -515,10 +557,10 @@ message SearchRequest { // [user guide](https://cloud.google.com/retail/docs/boosting). // // Notice that if both [ServingConfig.boost_control_ids][] and - // [SearchRequest.boost_spec] are set, the boost conditions from both places - // are evaluated. If a search request matches multiple boost conditions, - // the final boost score is equal to the sum of the boost scores from all - // matched boost conditions. + // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which @@ -553,7 +595,8 @@ message SearchRequest { // * inventory(place_id,price) // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the - // [Product.inventories.attributes][] map. + // [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes] + // map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2.Product.attributes] map. // * pickupInStore.id, where id is any @@ -617,6 +660,29 @@ message SearchRequest { // The specification for personalization. PersonalizationSpec personalization_spec = 32; + + // The labels applied to a resource must meet the following requirements: + // + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters and cannot be empty. Values can be empty and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. + // + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. + map labels = 34; + + // The spell correction specification that specifies the mode under + // which spell correction will take effect. + optional SpellCorrectionSpec spell_correction_spec = 35; } // Response message for @@ -750,7 +816,9 @@ message SearchResponse { // matches. int32 total_size = 3; - // If spell correction applies, the corrected query. Otherwise, empty. + // Contains the spell corrected query, if found. If the spell correction type + // is AUTOMATIC, then the search results are based on corrected_query. + // Otherwise the original query will be used for search. string corrected_query = 4; // A unique search token. This should be included in the @@ -768,10 +836,10 @@ message SearchResponse { QueryExpansionInfo query_expansion_info = 7; // The URI of a customer-defined redirect page. If redirect action is - // triggered, no search will be performed, and only + // triggered, no search is performed, and only // [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and // [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token] - // will be set in the response. + // are set in the response. string redirect_uri = 10; // The fully qualified resource name of applied diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto index 8e21f8aa0cb..fc315f88f1a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event.proto @@ -54,11 +54,15 @@ message UserEvent { // 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. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded model + // quality. + // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // The field should not contain PII or user-data. We recommend to use Google - // Analystics [Client + // Analytics [Client // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; @@ -111,12 +115,11 @@ message UserEvent { // The main product details related to the event. // - // This field is required for the following event types: + // This field is optional except for the following event types: // // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` - // * `search` // // 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 browsing the diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index 8dcb23f60d5..9b3d8cb0abd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -204,7 +204,7 @@ message AttributesConfig { }; // Required. Immutable. The fully qualified resource name of the attribute - // config. Format: "projects/*/locations/*/catalogs/*/attributesConfig" + // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE @@ -237,7 +237,7 @@ message CompletionConfig { }; // Required. Immutable. Fully qualified name - // projects/*/locations/*/catalogs/*/completionConfig + // `projects/*/locations/*/catalogs/*/completionConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto index e6d768f5f56..e0b844ef639 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto @@ -204,7 +204,7 @@ message AttributesConfig { }; // Required. Immutable. The fully qualified resource name of the attribute - // config. Format: "projects/*/locations/*/catalogs/*/attributesConfig" + // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE @@ -237,7 +237,7 @@ message CompletionConfig { }; // Required. Immutable. Fully qualified name - // projects/*/locations/*/catalogs/*/completionConfig + // `projects/*/locations/*/catalogs/*/completionConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 2e6a9dfa755..d535c5a5f00 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -8131,6 +8131,12 @@ export namespace google { /** SearchRequest personalizationSpec */ personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** SearchRequest labels */ + labels?: ({ [k: string]: string }|null); + + /** SearchRequest spellCorrectionSpec */ + spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); } /** Represents a SearchRequest. */ @@ -8199,6 +8205,15 @@ export namespace google { /** SearchRequest personalizationSpec. */ public personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + /** SearchRequest labels. */ + public labels: { [k: string]: string }; + + /** SearchRequest spellCorrectionSpec. */ + public spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); + + /** SearchRequest _spellCorrectionSpec. */ + public _spellCorrectionSpec?: "spellCorrectionSpec"; + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -9013,6 +9028,106 @@ export namespace google { } } + /** Properties of a SpellCorrectionSpec. */ + interface ISpellCorrectionSpec { + + /** SpellCorrectionSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null); + } + + /** Represents a SpellCorrectionSpec. */ + class SpellCorrectionSpec implements ISpellCorrectionSpec { + + /** + * Constructs a new SpellCorrectionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec); + + /** SpellCorrectionSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode); + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SpellCorrectionSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Verifies a SpellCorrectionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpellCorrectionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @param message SpellCorrectionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SpellCorrectionSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + SUGGESTION_ONLY = 1, + AUTO = 2 + } + } + /** SearchMode enum. */ enum SearchMode { SEARCH_MODE_UNSPECIFIED = 0, diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 6fbed5b5c5a..a3d00834462 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -19705,6 +19705,8 @@ * @property {Array.|null} [pageCategories] SearchRequest pageCategories * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode * @property {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec + * @property {Object.|null} [labels] SearchRequest labels + * @property {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null} [spellCorrectionSpec] SearchRequest spellCorrectionSpec */ /** @@ -19719,6 +19721,7 @@ this.facetSpecs = []; this.variantRollupKeys = []; this.pageCategories = []; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19877,6 +19880,36 @@ */ SearchRequest.prototype.personalizationSpec = null; + /** + * SearchRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.labels = $util.emptyObject; + + /** + * SearchRequest spellCorrectionSpec. + * @member {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null|undefined} spellCorrectionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.spellCorrectionSpec = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SearchRequest _spellCorrectionSpec. + * @member {"spellCorrectionSpec"|undefined} _spellCorrectionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + Object.defineProperty(SearchRequest.prototype, "_spellCorrectionSpec", { + get: $util.oneOfGetter($oneOfFields = ["spellCorrectionSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -19942,6 +19975,11 @@ writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.spellCorrectionSpec != null && Object.hasOwnProperty.call(message, "spellCorrectionSpec")) + $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.encode(message.spellCorrectionSpec, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); return writer; }; @@ -19972,7 +20010,7 @@ SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -20039,6 +20077,31 @@ case 32: message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); break; + case 34: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 35: + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -20074,6 +20137,7 @@ SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.placement != null && message.hasOwnProperty("placement")) if (!$util.isString(message.placement)) return "placement: string expected"; @@ -20161,6 +20225,22 @@ if (error) return "personalizationSpec." + error; } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + properties._spellCorrectionSpec = 1; + { + var error = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify(message.spellCorrectionSpec); + if (error) + return "spellCorrectionSpec." + error; + } + } return null; }; @@ -20259,6 +20339,18 @@ throw TypeError(".google.cloud.retail.v2.SearchRequest.personalizationSpec: object expected"); message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.spellCorrectionSpec != null) { + if (typeof object.spellCorrectionSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.spellCorrectionSpec: object expected"); + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.fromObject(object.spellCorrectionSpec); + } return message; }; @@ -20280,6 +20372,8 @@ object.variantRollupKeys = []; object.pageCategories = []; } + if (options.objects || options.defaults) + object.labels = {}; if (options.defaults) { object.placement = ""; object.branch = ""; @@ -20345,6 +20439,17 @@ object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + object.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.toObject(message.spellCorrectionSpec, options); + if (options.oneofs) + object._spellCorrectionSpec = "spellCorrectionSpec"; + } return object; }; @@ -22171,6 +22276,227 @@ return PersonalizationSpec; })(); + SearchRequest.SpellCorrectionSpec = (function() { + + /** + * Properties of a SpellCorrectionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface ISpellCorrectionSpec + * @property {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null} [mode] SpellCorrectionSpec mode + */ + + /** + * Constructs a new SpellCorrectionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a SpellCorrectionSpec. + * @implements ISpellCorrectionSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + */ + function SpellCorrectionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpellCorrectionSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @instance + */ + SpellCorrectionSpec.prototype.mode = 0; + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec instance + */ + SpellCorrectionSpec.create = function create(properties) { + return new SpellCorrectionSpec(properties); + }; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpellCorrectionSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpellCorrectionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + */ + SpellCorrectionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SUGGESTION_ONLY": + case 1: + message.mode = 1; + break; + case "AUTO": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} message SpellCorrectionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpellCorrectionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @instance + * @returns {Object.} JSON object + */ + SpellCorrectionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} SUGGESTION_ONLY=1 SUGGESTION_ONLY value + * @property {number} AUTO=2 AUTO value + */ + SpellCorrectionSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SUGGESTION_ONLY"] = 1; + values[valuesById[2] = "AUTO"] = 2; + return values; + })(); + + return SpellCorrectionSpec; + })(); + /** * SearchMode enum. * @name google.cloud.retail.v2.SearchRequest.SearchMode diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index daf9f12a04d..9454ba85c9d 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -305,6 +305,7 @@ "type": "bool", "id": 3, "options": { + "deprecated": true, "proto3_optional": true } }, @@ -312,6 +313,7 @@ "type": "bool", "id": 4, "options": { + "deprecated": true, "proto3_optional": true } } @@ -2007,7 +2009,8 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, "filter": { @@ -2056,6 +2059,13 @@ } }, "SearchRequest": { + "oneofs": { + "_spellCorrectionSpec": { + "oneof": [ + "spellCorrectionSpec" + ] + } + }, "fields": { "placement": { "type": "string", @@ -2147,6 +2157,18 @@ "personalizationSpec": { "type": "PersonalizationSpec", "id": 32 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "spellCorrectionSpec": { + "type": "SpellCorrectionSpec", + "id": 35, + "options": { + "proto3_optional": true + } } }, "nested": { @@ -2307,6 +2329,23 @@ } } }, + "SpellCorrectionSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "SUGGESTION_ONLY": 1, + "AUTO": 2 + } + } + } + }, "SearchMode": { "values": { "SEARCH_MODE_UNSPECIFIED": 0, diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index 738d1b40bfa..51c1efcdbd8 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -74,9 +74,9 @@ function main(catalog, query) { * events. If leave empty, it will use the "user-data". * Current supported values: * * user-data - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * guidelines (https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). */ // const dataset = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index af3de61999a..d2db6c72062 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -41,6 +41,15 @@ function main(placement, userEvent) { * 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. + * Don't set + * UserEvent.visitor_id google.cloud.retail.v2.UserEvent.visitor_id or + * UserInfo.user_id google.cloud.retail.v2.UserInfo.user_id to the same + * fixed ID for different users. If you are trying to receive non-personalized + * recommendations (not recommended; this can negatively impact model + * performance), instead set + * UserEvent.visitor_id google.cloud.retail.v2.UserEvent.visitor_id to a + * random unique ID and leave + * UserInfo.user_id google.cloud.retail.v2.UserInfo.user_id unset. */ // const userEvent = {} /** @@ -118,7 +127,7 @@ function main(placement, userEvent) { * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index 39cc5522cea..3de379978ca 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -52,11 +52,17 @@ function main(parent, inputConfig) { */ // const reconciliationMode = {} /** - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * ImportProductsRequest.parent google.cloud.retail.v2.ImportProductsRequest.parent. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * Only supported when * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode * is set to `FULL`. diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js index 3be188b891d..8824fefaf54 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js index 359a30ef80d..7c7a9f41859 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js @@ -43,6 +43,10 @@ function main(product) { * fields that are neither immutable nor output only) are updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. */ // const updateMask = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 2083811f7be..26118e14c07 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -27,7 +27,7 @@ function main(placement, visitorId) { */ /** * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -41,6 +41,10 @@ function main(placement, visitorId) { // const branch = 'abc123' /** * Raw search query. + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * filter google.cloud.retail.v2.SearchRequest.filter and + * page_categories google.cloud.retail.v2.SearchRequest.page_categories. */ // const query = 'abc123' /** @@ -126,10 +130,10 @@ function main(placement, visitorId) { * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). * Notice that if both ServingConfig.boost_control_ids and - * SearchRequest.boost_spec are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * SearchRequest.boost_spec google.cloud.retail.v2.SearchRequest.boost_spec + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. */ // const boostSpec = {} /** @@ -163,7 +167,8 @@ function main(placement, visitorId) { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * Product.inventories.attributes map. + * Product.local_inventories.attributes google.cloud.retail.v2.LocalInventory.attributes + * map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2.Product.attributes map. * * pickupInStore.id, where id is any @@ -228,6 +233,29 @@ function main(placement, visitorId) { * The specification for personalization. */ // const personalizationSpec = {} + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + /** + * The spell correction specification that specifies the mode under + * which spell correction will take effect. + */ + // const spellCorrectionSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2; diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 7949361c9a5..2d159003192 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -318,7 +318,7 @@ "segments": [ { "start": 25, - "end": 153, + "end": 162, "type": "FULL" } ], @@ -530,7 +530,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 76, "type": "FULL" } ], @@ -611,14 +611,14 @@ "regionTag": "retail_v2_generated_ProductService_ImportProducts_async", "title": "CatalogService importProducts Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. Request processing may be synchronous. 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.", "canonical": true, "file": "product_service.import_products.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 85, + "end": 91, "type": "FULL" } ], @@ -675,7 +675,7 @@ "regionTag": "retail_v2_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", @@ -790,7 +790,7 @@ "segments": [ { "start": 25, - "end": 103, + "end": 104, "type": "FULL" } ], @@ -954,7 +954,7 @@ "segments": [ { "start": 25, - "end": 252, + "end": 280, "type": "FULL" } ], @@ -1038,6 +1038,14 @@ { "name": "personalization_spec", "type": ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "spell_correction_spec", + "type": ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec" } ], "resultType": ".google.cloud.retail.v2.SearchResponse", diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index ceec448c353..2cdbab92d66 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -392,9 +392,9 @@ export class CompletionServiceClient { * * * user-data * - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). * @param {number} request.maxSuggestions * Completion max suggestions. If left unset or set to 0, then will fallback * to the configured value {@link |CompletionConfig.max_suggestions}. diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 436b568e8ad..1aa966c652d 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -314,6 +314,16 @@ export class PredictionServiceClient { * 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. + * + * Don't set + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id} or + * {@link google.cloud.retail.v2.UserInfo.user_id|UserInfo.user_id} to the same + * fixed ID for different users. If you are trying to receive non-personalized + * recommendations (not recommended; this can negatively impact model + * performance), instead set + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id} to a + * random unique ID and leave + * {@link google.cloud.retail.v2.UserInfo.user_id|UserInfo.user_id} unset. * @param {number} request.pageSize * Maximum number of results to return per page. Set this property * to the number of prediction results needed. If zero, the service will @@ -388,7 +398,7 @@ export class PredictionServiceClient { * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 5c4d892aed9..7e91e71adb5 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -645,6 +645,11 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. * @param {boolean} request.allowMissing * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not * found, a new {@link google.cloud.retail.v2.Product|Product} will be created. In @@ -836,7 +841,7 @@ export class ProductServiceClient { /** * Bulk import of multiple {@link google.cloud.retail.v2.Product|Product}s. * - * Request processing may be synchronous. No partial updating is supported. + * Request processing may be synchronous. * Non-existing items are created. * * Note that it is possible for a subset of the @@ -864,11 +869,18 @@ export class ProductServiceClient { * imported. Defaults to * {@link google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * {@link google.cloud.retail.v2.ImportProductsRequest.parent|ImportProductsRequest.parent}. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * * Only supported when * {@link google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} @@ -1038,7 +1050,7 @@ export class ProductServiceClient { * * Pre-existing inventory information can only be updated with * {@link google.cloud.retail.v2.ProductService.SetInventory|SetInventory}, - * {@link google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * {@link google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, * and * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * @@ -1498,7 +1510,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type|type}, such as diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index cf269f4497d..15c6c05e2b9 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -331,7 +331,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -342,6 +342,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -424,10 +429,10 @@ export class SearchServiceClient { * [user guide](https://cloud.google.com/retail/docs/boosting). * * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -460,7 +465,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -520,6 +526,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -606,7 +633,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -617,6 +644,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -699,10 +731,10 @@ export class SearchServiceClient { * [user guide](https://cloud.google.com/retail/docs/boosting). * * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -735,7 +767,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -795,6 +828,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -837,7 +891,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -848,6 +902,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -930,10 +989,10 @@ export class SearchServiceClient { * [user guide](https://cloud.google.com/retail/docs/boosting). * * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -966,7 +1025,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -1026,6 +1086,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} From d15fcf5a854ac97324a7a63fe048f3253b75ae91 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jun 2022 17:04:21 +0200 Subject: [PATCH 083/103] chore(deps): update dependency jsdoc-fresh to v2 (#188) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc-fresh](https://togithub.com/googleapis/jsdoc-fresh) | [`^1.0.2` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-fresh/1.1.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/compatibility-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/confidence-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/jsdoc-fresh ### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-fresh/blob/HEAD/CHANGELOG.md#​200-httpsgithubcomgoogleapisjsdoc-freshcomparev111v200-2022-05-18) [Compare Source](https://togithub.com/googleapis/jsdoc-fresh/compare/v1.1.1...v2.0.0) ##### ⚠ BREAKING CHANGES - update library to use Node 12 ([#​108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ##### Build System - update library to use Node 12 ([#​108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ([e61c223](https://togithub.com/googleapis/jsdoc-fresh/commit/e61c2238db8900e339e5fe7fb8aea09642290182)) ##### [1.1.1](https://www.github.com/googleapis/jsdoc-fresh/compare/v1.1.0...v1.1.1) (2021-08-11) ##### Bug Fixes - **build:** migrate to using main branch ([#​83](https://www.togithub.com/googleapis/jsdoc-fresh/issues/83)) ([9474adb](https://www.github.com/googleapis/jsdoc-fresh/commit/9474adbf0d559d319ff207397ba2be6b557999ac))
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index ebccf802dbd..697ef1eeb1e 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -51,7 +51,7 @@ "c8": "^7.3.5", "gts": "^3.1.0", "jsdoc": "^3.6.6", - "jsdoc-fresh": "^1.0.2", + "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^1.0.6", "linkinator": "^2.7.0", "mocha": "^9.2.2", From 6e3283a69568ea672d9c367d5c6a3672111d70a3 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jun 2022 17:28:23 +0200 Subject: [PATCH 084/103] chore(deps): update dependency jsdoc-region-tag to v2 (#189) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc-region-tag](https://togithub.com/googleapis/jsdoc-region-tag) | [`^1.0.6` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-region-tag/1.3.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/compatibility-slim/1.3.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/confidence-slim/1.3.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/jsdoc-region-tag ### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-region-tag/blob/HEAD/CHANGELOG.md#​200-httpsgithubcomgoogleapisjsdoc-region-tagcomparev131v200-2022-05-20) [Compare Source](https://togithub.com/googleapis/jsdoc-region-tag/compare/v1.3.1...v2.0.0) ##### ⚠ BREAKING CHANGES - update library to use Node 12 ([#​107](https://togithub.com/googleapis/jsdoc-region-tag/issues/107)) ##### Build System - update library to use Node 12 ([#​107](https://togithub.com/googleapis/jsdoc-region-tag/issues/107)) ([5b51796](https://togithub.com/googleapis/jsdoc-region-tag/commit/5b51796771984cf8b978990025f14faa03c19923)) ##### [1.3.1](https://www.github.com/googleapis/jsdoc-region-tag/compare/v1.3.0...v1.3.1) (2021-08-11) ##### Bug Fixes - **build:** migrate to using main branch ([#​79](https://www.togithub.com/googleapis/jsdoc-region-tag/issues/79)) ([5050615](https://www.github.com/googleapis/jsdoc-region-tag/commit/50506150b7758592df5e389c6a5c3d82b3b20881))
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 697ef1eeb1e..1ab134a4e9f 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -52,7 +52,7 @@ "gts": "^3.1.0", "jsdoc": "^3.6.6", "jsdoc-fresh": "^2.0.0", - "jsdoc-region-tag": "^1.0.6", + "jsdoc-region-tag": "^2.0.0", "linkinator": "^2.7.0", "mocha": "^9.2.2", "null-loader": "^4.0.1", From 6821bd50851a2ae46bbc2c83de936bc93d94315b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 20 Jun 2022 21:41:28 +0200 Subject: [PATCH 085/103] fix(deps): update dependency @google-cloud/bigquery to v6 (#186) --- packages/google-cloud-retail/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 6ef964792e5..bff67a852d6 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@google-cloud/retail": "^1.8.1", - "@google-cloud/bigquery": "^5.9.2", + "@google-cloud/bigquery": "^6.0.0", "@google-cloud/storage": "^5.16.1" }, "devDependencies": { From 2db8e972af6401fed8bc158298557fbdec9d34e0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 19:24:21 +0000 Subject: [PATCH 086/103] chore(main): release 2.0.0 (#184) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :robot: I have created a release *beep* *boop* --- ## [2.0.0](https://github.com/googleapis/nodejs-retail/compare/v1.8.1...v2.0.0) (2022-06-20) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#181) ### Features * allow users to disable spell check in search requests ([#183](https://github.com/googleapis/nodejs-retail/issues/183)) ([05005ea](https://github.com/googleapis/nodejs-retail/commit/05005ea09accff4d04b152f2fa2bf452f6b9768b)) ### Bug Fixes * **deps:** update dependency @google-cloud/bigquery to v6 ([#186](https://github.com/googleapis/nodejs-retail/issues/186)) ([fc07923](https://github.com/googleapis/nodejs-retail/commit/fc0792311aac235e917fe045fc491858408bd770)) ### Build System * update library to use Node 12 ([#181](https://github.com/googleapis/nodejs-retail/issues/181)) ([809853f](https://github.com/googleapis/nodejs-retail/commit/809853f84e0bfe0f09ccb59ca750963732e23965)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 21 +++++++++++++++++++ packages/google-cloud-retail/package.json | 2 +- ...ippet_metadata.google.cloud.retail.v2.json | 2 +- ..._metadata.google.cloud.retail.v2alpha.json | 2 +- ...t_metadata.google.cloud.retail.v2beta.json | 2 +- .../google-cloud-retail/samples/package.json | 2 +- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index de8bb688fba..889b81105ef 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [2.0.0](https://github.com/googleapis/nodejs-retail/compare/v1.8.1...v2.0.0) (2022-06-20) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#181) + +### Features + +* allow users to disable spell check in search requests ([#183](https://github.com/googleapis/nodejs-retail/issues/183)) ([05005ea](https://github.com/googleapis/nodejs-retail/commit/05005ea09accff4d04b152f2fa2bf452f6b9768b)) + + +### Bug Fixes + +* **deps:** update dependency @google-cloud/bigquery to v6 ([#186](https://github.com/googleapis/nodejs-retail/issues/186)) ([fc07923](https://github.com/googleapis/nodejs-retail/commit/fc0792311aac235e917fe045fc491858408bd770)) + + +### Build System + +* update library to use Node 12 ([#181](https://github.com/googleapis/nodejs-retail/issues/181)) ([809853f](https://github.com/googleapis/nodejs-retail/commit/809853f84e0bfe0f09ccb59ca750963732e23965)) + ### [1.8.1](https://github.com/googleapis/nodejs-retail/compare/v1.8.0...v1.8.1) (2022-05-06) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 1ab134a4e9f..62f501a2405 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "1.8.1", + "version": "2.0.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 2d159003192..d3ee61cd48a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "1.8.1", + "version": "2.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index 5226b68613c..b58f3b170d4 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "1.8.1", + "version": "2.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 6281670cda9..5dd4727274a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "1.8.1", + "version": "2.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index bff67a852d6..a9eef453780 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^1.8.1", + "@google-cloud/retail": "^2.0.0", "@google-cloud/bigquery": "^6.0.0", "@google-cloud/storage": "^5.16.1" }, From e4ba4ae07f8efdd4207dbc5c1bb32fbd7f278508 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 4 Jul 2022 14:43:40 -0400 Subject: [PATCH 087/103] feat: support regapic LRO Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Use gapic-generator-typescript v2.15.2. PiperOrigin-RevId: 458552034 Source-Link: https://github.com/googleapis/googleapis/commit/ae65014049c6eb195741d7efbd0b10bee3f83d4f Source-Link: https://github.com/googleapis/googleapis-gen/commit/b09ede435cce110446d4ab9f62a081b571d37e3f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjA5ZWRlNDM1Y2NlMTEwNDQ2ZDRhYjlmNjJhMDgxYjU3MWQzN2UzZiJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Benjamin E. Coe --- .../src/v2/catalog_service_client.ts | 11 ++--- .../src/v2/completion_service_client.ts | 47 ++++++++++++++----- .../src/v2/prediction_service_client.ts | 11 ++--- .../src/v2/product_service_client.ts | 47 ++++++++++++++----- .../src/v2/search_service_client.ts | 11 ++--- .../src/v2/user_event_service_client.ts | 47 ++++++++++++++----- .../src/v2alpha/catalog_service_client.ts | 11 ++--- .../src/v2alpha/completion_service_client.ts | 47 ++++++++++++++----- .../src/v2alpha/control_service_client.ts | 11 ++--- .../src/v2alpha/prediction_service_client.ts | 11 ++--- .../src/v2alpha/product_service_client.ts | 47 ++++++++++++++----- .../src/v2alpha/search_service_client.ts | 11 ++--- .../v2alpha/serving_config_service_client.ts | 11 ++--- .../src/v2alpha/user_event_service_client.ts | 47 ++++++++++++++----- .../src/v2beta/catalog_service_client.ts | 11 ++--- .../src/v2beta/completion_service_client.ts | 47 ++++++++++++++----- .../src/v2beta/control_service_client.ts | 11 ++--- .../src/v2beta/prediction_service_client.ts | 11 ++--- .../src/v2beta/product_service_client.ts | 47 ++++++++++++++----- .../src/v2beta/search_service_client.ts | 11 ++--- .../v2beta/serving_config_service_client.ts | 11 ++--- .../src/v2beta/user_event_service_client.ts | 47 ++++++++++++++----- 22 files changed, 380 insertions(+), 186 deletions(-) diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index a6efcec5f60..d32c514bc41 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -70,7 +70,7 @@ export class CatalogServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class CatalogServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index 2cdbab92d66..2839667e3d0 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -71,7 +72,7 @@ export class CompletionServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -94,11 +95,10 @@ export class CompletionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -174,16 +174,39 @@ export class CompletionServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const importCompletionDataResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2.ImportCompletionDataResponse' diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 1aa966c652d..1107dccb567 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -61,7 +61,7 @@ export class PredictionServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -84,11 +84,10 @@ export class PredictionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 7e91e71adb5..b8f05a0da1a 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -73,7 +74,7 @@ export class ProductServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +97,10 @@ export class ProductServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -190,16 +190,39 @@ export class ProductServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const importProductsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2.ImportProductsResponse' diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 15c6c05e2b9..d11787df88c 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -73,7 +73,7 @@ export class SearchServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +96,10 @@ export class SearchServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 4853609b4b1..69ff6bed199 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -68,7 +69,7 @@ export class UserEventServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -91,11 +92,10 @@ export class UserEventServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -171,16 +171,39 @@ export class UserEventServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const purgeUserEventsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2.PurgeUserEventsResponse' diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index b05d4fe2140..eb6f3cd8990 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -70,7 +70,7 @@ export class CatalogServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class CatalogServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 6a0d0bf5f58..f4a2288b477 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -71,7 +72,7 @@ export class CompletionServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -94,11 +95,10 @@ export class CompletionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -186,16 +186,39 @@ export class CompletionServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const importCompletionDataResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.ImportCompletionDataResponse' diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts index e424e8505ee..b42b3b07685 100644 --- a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts @@ -70,7 +70,7 @@ export class ControlServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class ControlServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 88d4855e391..f7f8862dab8 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -61,7 +61,7 @@ export class PredictionServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -84,11 +84,10 @@ export class PredictionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 5ddaea14b3d..14a2f414dd9 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -73,7 +74,7 @@ export class ProductServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +97,10 @@ export class ProductServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -202,16 +202,39 @@ export class ProductServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const purgeProductsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.PurgeProductsResponse' diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index bc6f801bff3..2df05eab279 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -73,7 +73,7 @@ export class SearchServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +96,10 @@ export class SearchServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts index bffcf4f665f..28b63d14db3 100644 --- a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts @@ -70,7 +70,7 @@ export class ServingConfigServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class ServingConfigServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 5e7939c61bf..6e0f61a6a78 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -68,7 +69,7 @@ export class UserEventServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -91,11 +92,10 @@ export class UserEventServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -183,16 +183,39 @@ export class UserEventServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const purgeUserEventsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2alpha.PurgeUserEventsResponse' diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index d723d5c0e49..efc71e654d1 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -70,7 +70,7 @@ export class CatalogServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class CatalogServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index c74abaf3f70..42a24bf8a57 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -71,7 +72,7 @@ export class CompletionServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -94,11 +95,10 @@ export class CompletionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -186,16 +186,39 @@ export class CompletionServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const importCompletionDataResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2beta.ImportCompletionDataResponse' diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client.ts b/packages/google-cloud-retail/src/v2beta/control_service_client.ts index 4f05678336f..228aca8881e 100644 --- a/packages/google-cloud-retail/src/v2beta/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/control_service_client.ts @@ -70,7 +70,7 @@ export class ControlServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class ControlServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 514d4e4b083..cd68c2d564b 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -61,7 +61,7 @@ export class PredictionServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -84,11 +84,10 @@ export class PredictionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index cb218273048..42bce46a71e 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -73,7 +74,7 @@ export class ProductServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +97,10 @@ export class ProductServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -202,16 +202,39 @@ export class ProductServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const importProductsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2beta.ImportProductsResponse' diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 69ca63706c3..9596b1dd21f 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -73,7 +73,7 @@ export class SearchServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -96,11 +96,10 @@ export class SearchServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts index 2695705160d..4088623a24d 100644 --- a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts @@ -70,7 +70,7 @@ export class ServingConfigServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class ServingConfigServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 68813baf6ad..040cd40e9ff 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, } from 'google-gax'; @@ -68,7 +69,7 @@ export class UserEventServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -91,11 +92,10 @@ export class UserEventServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -183,16 +183,39 @@ export class UserEventServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. - + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const purgeUserEventsResponse = protoFilesRoot.lookup( '.google.cloud.retail.v2beta.PurgeUserEventsResponse' From f3e831e4e795400849c5349bbb495404743e85a0 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 4 Jul 2022 20:57:17 +0200 Subject: [PATCH 088/103] fix(deps): update dependency @google-cloud/storage to v6 (#185) Co-authored-by: Benjamin E. Coe --- packages/google-cloud-retail/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index a9eef453780..0794a15e611 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -15,7 +15,7 @@ "dependencies": { "@google-cloud/retail": "^2.0.0", "@google-cloud/bigquery": "^6.0.0", - "@google-cloud/storage": "^5.16.1" + "@google-cloud/storage": "^6.0.0" }, "devDependencies": { "c8": "^7.1.0", From 11cddb47ff4db2d4620510544f5e37bedb941b52 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 13 Jul 2022 02:02:10 +0200 Subject: [PATCH 089/103] chore(deps): update dependency linkinator to v4 (#194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [linkinator](https://togithub.com/JustinBeckwith/linkinator) | [`^2.7.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/linkinator/2.16.2/4.0.2) | [![age](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/compatibility-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/confidence-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
JustinBeckwith/linkinator ### [`v4.0.2`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v4.0.2) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v4.0.1...v4.0.2) ##### Bug Fixes - address srcset parsing with multiple spaces ([#​512](https://togithub.com/JustinBeckwith/linkinator/issues/512)) ([fefb5b6](https://togithub.com/JustinBeckwith/linkinator/commit/fefb5b6734fc4ab335793358c5f491338ecbeb90)) ### [`v4.0.1`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v4.0.1) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v4.0.0...v4.0.1) ##### Bug Fixes - properly parse srcset attribute ([#​510](https://togithub.com/JustinBeckwith/linkinator/issues/510)) ([9a8a83c](https://togithub.com/JustinBeckwith/linkinator/commit/9a8a83c35182b3cd4daee62a00f156767fe5c6a7)) ### [`v4.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v4.0.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.1.0...v4.0.0) ##### Features - create new release with notes ([#​508](https://togithub.com/JustinBeckwith/linkinator/issues/508)) ([2cab633](https://togithub.com/JustinBeckwith/linkinator/commit/2cab633c9659eb10794a4bac06f8b0acdc3e2c0c)) ##### BREAKING CHANGES - The commits in [#​507](https://togithub.com/JustinBeckwith/linkinator/issues/507) and [#​506](https://togithub.com/JustinBeckwith/linkinator/issues/506) both had breaking changes. They included dropping support for Node.js 12.x and updating the CSV export to be streaming, and to use a new way of writing the CSV file. This is an empty to commit using the `BREAKING CHANGE` format in the commit message to ensure a release is triggered. ### [`v3.1.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.1.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.6...v3.1.0) ##### Features - allow --skip to be defined multiple times ([#​399](https://togithub.com/JustinBeckwith/linkinator/issues/399)) ([5ca5a46](https://togithub.com/JustinBeckwith/linkinator/commit/5ca5a461508e688de12e5ae6b4cfb6565f832ebf)) ### [`v3.0.6`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.6) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.5...v3.0.6) ##### Bug Fixes - **deps:** upgrade node-glob to v8 ([#​397](https://togithub.com/JustinBeckwith/linkinator/issues/397)) ([d334dc6](https://togithub.com/JustinBeckwith/linkinator/commit/d334dc6734cd7c2b73d7ed3dea0550a6c3072ad5)) ### [`v3.0.5`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.5) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.4...v3.0.5) ##### Bug Fixes - **deps:** upgrade to htmlparser2 v8.0.1 ([#​396](https://togithub.com/JustinBeckwith/linkinator/issues/396)) ([ba3b9a8](https://togithub.com/JustinBeckwith/linkinator/commit/ba3b9a8a9b19d39af6ed91790135e833b80c1eb6)) ### [`v3.0.4`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.4) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.3...v3.0.4) ##### Bug Fixes - **deps:** update dependency gaxios to v5 ([#​391](https://togithub.com/JustinBeckwith/linkinator/issues/391)) ([48af50e](https://togithub.com/JustinBeckwith/linkinator/commit/48af50e787731204aeb7eff41325c62291311e45)) ### [`v3.0.3`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.3) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.2...v3.0.3) ##### Bug Fixes - export getConfig from index ([#​371](https://togithub.com/JustinBeckwith/linkinator/issues/371)) ([0bc0355](https://togithub.com/JustinBeckwith/linkinator/commit/0bc0355c7e2ea457f247e6b52d1577b8c4ecb3a1)) ### [`v3.0.2`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.2) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.1...v3.0.2) ##### Bug Fixes - allow server root with trailing slash ([#​370](https://togithub.com/JustinBeckwith/linkinator/issues/370)) ([8adf6b0](https://togithub.com/JustinBeckwith/linkinator/commit/8adf6b025fda250e38461f1cdad40fe08c3b3b7c)) ### [`v3.0.1`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.1) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.0...v3.0.1) ##### Bug Fixes - decode path parts in local web server ([#​369](https://togithub.com/JustinBeckwith/linkinator/issues/369)) ([4696a0c](https://togithub.com/JustinBeckwith/linkinator/commit/4696a0c38c341b178ed815f47371fca955979feb)) ### [`v3.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v2.16.2...v3.0.0) ##### Bug Fixes - **deps:** update dependency chalk to v5 ([#​362](https://togithub.com/JustinBeckwith/linkinator/issues/362)) ([4b17a8d](https://togithub.com/JustinBeckwith/linkinator/commit/4b17a8d87b649eaf813428f8ee6955e1d21dae4f)) - feat!: convert to es modules, drop node 10 ([#​359](https://togithub.com/JustinBeckwith/linkinator/issues/359)) ([efee299](https://togithub.com/JustinBeckwith/linkinator/commit/efee299ab8a805accef751eecf8538915a4e7783)), closes [#​359](https://togithub.com/JustinBeckwith/linkinator/issues/359) ##### BREAKING CHANGES - this module now requires node.js 12 and above, and has moved to es modules by default.
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 62f501a2405..4e71696b6cf 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -53,7 +53,7 @@ "jsdoc": "^3.6.6", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", - "linkinator": "^2.7.0", + "linkinator": "^4.0.0", "mocha": "^9.2.2", "null-loader": "^4.0.1", "pack-n-play": "^1.0.0-2", From 6412954ac157dca6ff0fa0e2655b36071b4d5c4b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 19 Aug 2022 20:34:15 +0000 Subject: [PATCH 090/103] chore: remove unused proto imports (#199) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 468735472 Source-Link: https://github.com/googleapis/googleapis/commit/cfa1b3782da7ccae31673d45401a0b79d2d4a84b Source-Link: https://github.com/googleapis/googleapis-gen/commit/09b7666656510f5b00b893f003a0ba5766f9e250 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDliNzY2NjY1NjUxMGY1YjAwYjg5M2YwMDNhMGJhNTc2NmY5ZTI1MCJ9 feat: new model service to manage recommendation models feat: support case insensitive match on search facets feat: allow disabling spell check in search requests feat: allow adding labels in search requests feat: allow returning min/max values on search numeric facets feat: allow using serving configs as an alias of placements feat: allow enabling recommendation filtering on custom attributes feat: return output BigQuery table on product / event export response feat: allow skiping default branch protection when doing product full import docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 464664497 Source-Link: https://github.com/googleapis/googleapis/commit/c30c9ccfd90bebbe16375d19a666e2651e81931f Source-Link: https://github.com/googleapis/googleapis-gen/commit/a7fe8d672b8cbbadc5ab32253dea50e4c3d8e390 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTdmZThkNjcyYjhjYmJhZGM1YWIzMjI1M2RlYTUwZTRjM2Q4ZTM5MCJ9 feat: support case insensitive match on search facets feat: allow to return min/max values on search numeric facets feat: allow to use serving configs as an alias of placements docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 464560246 Source-Link: https://github.com/googleapis/googleapis/commit/139f56eefb531a0d47bd52720160103a2b9e7fe5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/eca9b7ecbdc2c64c2d0ec2e6688f6353aff162ef Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWNhOWI3ZWNiZGMyYzY0YzJkMGVjMmU2Njg4ZjYzNTNhZmYxNjJlZiJ9 feat: support case insensitive match on search facets feat: allow disabling spell check in search requests feat: allow adding labels in search requests feat: allow returning min/max values on search numeric facets feat: allow using serving configs as an alias of placements feat: allow enabling recommendation filtering on custom attributes feat: return output BigQuery table on product / event export response docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 463980128 Source-Link: https://github.com/googleapis/googleapis/commit/d6bce0ee59fb796e8df417f3058e4197a1a0c38a Source-Link: https://github.com/googleapis/googleapis-gen/commit/e3d1296a9592b9fe714a7cbe8d2acc4bf42f4ec2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTNkMTI5NmE5NTkyYjlmZTcxNGE3Y2JlOGQyYWNjNGJmNDJmNGVjMiJ9 --- .../google/cloud/retail/v2/common.proto | 10 +- .../cloud/retail/v2/completion_service.proto | 10 +- .../cloud/retail/v2/prediction_service.proto | 45 +- .../cloud/retail/v2/product_service.proto | 125 +- .../cloud/retail/v2/search_service.proto | 58 +- .../cloud/retail/v2/user_event_service.proto | 1 - .../google/cloud/retail/v2alpha/catalog.proto | 72 +- .../retail/v2alpha/catalog_service.proto | 8 +- .../google/cloud/retail/v2alpha/common.proto | 82 +- .../retail/v2alpha/completion_service.proto | 21 +- .../google/cloud/retail/v2alpha/control.proto | 2 +- .../retail/v2alpha/control_service.proto | 8 +- .../cloud/retail/v2alpha/export_config.proto | 28 +- .../cloud/retail/v2alpha/import_config.proto | 20 +- .../google/cloud/retail/v2alpha/model.proto | 432 + .../cloud/retail/v2alpha/model_service.proto | 241 + .../retail/v2alpha/prediction_service.proto | 53 +- .../google/cloud/retail/v2alpha/product.proto | 4 +- .../retail/v2alpha/product_service.proto | 156 +- .../cloud/retail/v2alpha/purge_config.proto | 5 +- .../cloud/retail/v2alpha/search_service.proto | 165 +- .../cloud/retail/v2alpha/serving_config.proto | 11 +- .../v2alpha/serving_config_service.proto | 2 +- .../cloud/retail/v2alpha/user_event.proto | 9 +- .../retail/v2alpha/user_event_service.proto | 1 - .../google/cloud/retail/v2beta/catalog.proto | 71 +- .../cloud/retail/v2beta/catalog_service.proto | 8 +- .../google/cloud/retail/v2beta/common.proto | 82 +- .../retail/v2beta/completion_service.proto | 21 +- .../google/cloud/retail/v2beta/control.proto | 2 +- .../cloud/retail/v2beta/control_service.proto | 8 +- .../cloud/retail/v2beta/export_config.proto | 28 +- .../cloud/retail/v2beta/import_config.proto | 11 +- .../retail/v2beta/prediction_service.proto | 51 +- .../google/cloud/retail/v2beta/product.proto | 4 +- .../cloud/retail/v2beta/product_service.proto | 152 +- .../cloud/retail/v2beta/purge_config.proto | 5 +- .../cloud/retail/v2beta/search_service.proto | 160 +- .../cloud/retail/v2beta/serving_config.proto | 11 +- .../v2beta/serving_config_service.proto | 2 +- .../cloud/retail/v2beta/user_event.proto | 9 +- .../retail/v2beta/user_event_service.proto | 1 - .../google-cloud-retail/protos/protos.d.ts | 2566 +++++- packages/google-cloud-retail/protos/protos.js | 7000 ++++++++++++++++- .../google-cloud-retail/protos/protos.json | 1024 ++- .../v2/completion_service.complete_query.js | 2 + .../v2/prediction_service.predict.js | 37 +- .../product_service.add_fulfillment_places.js | 3 +- .../v2/product_service.set_inventory.js | 16 +- .../generated/v2/search_service.search.js | 4 +- ...ippet_metadata.google.cloud.retail.v2.json | 20 +- .../catalog_service.add_catalog_attribute.js | 2 +- .../catalog_service.get_attributes_config.js | 2 +- ...atalog_service.remove_catalog_attribute.js | 2 +- ...talog_service.replace_catalog_attribute.js | 2 +- .../completion_service.complete_query.js | 8 +- .../v2alpha/control_service.create_control.js | 2 +- .../v2alpha/control_service.delete_control.js | 2 +- .../v2alpha/control_service.get_control.js | 2 +- .../v2alpha/control_service.list_controls.js | 2 +- .../v2alpha/model_service.create_model.js | 70 + .../v2alpha/model_service.delete_model.js | 60 + .../v2alpha/model_service.list_models.js | 72 + .../v2alpha/model_service.pause_model.js | 60 + .../v2alpha/model_service.resume_model.js | 60 + .../v2alpha/model_service.tune_model.js | 61 + .../v2alpha/model_service.update_model.js | 63 + .../v2alpha/prediction_service.predict.js | 40 +- .../product_service.add_fulfillment_places.js | 3 +- .../product_service.import_products.js | 19 +- ...oduct_service.remove_fulfillment_places.js | 3 +- .../v2alpha/product_service.set_inventory.js | 16 +- .../v2alpha/product_service.update_product.js | 4 + .../v2alpha/search_service.search.js | 45 +- ...ng_config_service.create_serving_config.js | 2 +- ..._metadata.google.cloud.retail.v2alpha.json | 342 +- .../catalog_service.add_catalog_attribute.js | 2 +- .../catalog_service.get_attributes_config.js | 2 +- ...atalog_service.remove_catalog_attribute.js | 2 +- ...talog_service.replace_catalog_attribute.js | 2 +- .../completion_service.complete_query.js | 8 +- .../v2beta/control_service.create_control.js | 2 +- .../v2beta/control_service.delete_control.js | 2 +- .../v2beta/control_service.get_control.js | 2 +- .../v2beta/control_service.list_controls.js | 2 +- .../v2beta/prediction_service.predict.js | 40 +- .../product_service.add_fulfillment_places.js | 3 +- .../v2beta/product_service.import_products.js | 10 +- ...oduct_service.remove_fulfillment_places.js | 3 +- .../v2beta/product_service.set_inventory.js | 16 +- .../v2beta/product_service.update_product.js | 4 + .../generated/v2beta/search_service.search.js | 45 +- ...ng_config_service.create_serving_config.js | 2 +- ...t_metadata.google.cloud.retail.v2beta.json | 36 +- .../src/v2/catalog_service_client.ts | 305 +- .../src/v2/completion_service_client.ts | 265 + .../src/v2/prediction_service_client.ts | 353 +- .../src/v2/product_service_client.ts | 337 +- .../src/v2/search_service_client.ts | 317 +- .../src/v2/user_event_service_client.ts | 262 + .../src/v2alpha/catalog_service_client.ts | 378 +- .../v2alpha/catalog_service_proto_list.json | 2 + .../src/v2alpha/completion_service_client.ts | 336 +- .../completion_service_proto_list.json | 2 + .../src/v2alpha/control_service_client.ts | 382 +- .../v2alpha/control_service_proto_list.json | 2 + .../src/v2alpha/gapic_metadata.json | 88 + .../google-cloud-retail/src/v2alpha/index.ts | 1 + .../src/v2alpha/model_service_client.ts | 1968 +++++ .../v2alpha/model_service_client_config.json | 61 + .../src/v2alpha/model_service_proto_list.json | 22 + .../src/v2alpha/prediction_service_client.ts | 422 +- .../prediction_service_proto_list.json | 2 + .../src/v2alpha/product_service_client.ts | 428 +- .../v2alpha/product_service_proto_list.json | 2 + .../src/v2alpha/search_service_client.ts | 502 +- .../v2alpha/search_service_proto_list.json | 2 + .../v2alpha/serving_config_service_client.ts | 372 +- .../serving_config_service_proto_list.json | 2 + .../src/v2alpha/user_event_service_client.ts | 327 + .../user_event_service_proto_list.json | 2 + .../src/v2beta/catalog_service_client.ts | 313 +- .../src/v2beta/completion_service_client.ts | 271 +- .../src/v2beta/control_service_client.ts | 317 +- .../src/v2beta/prediction_service_client.ts | 357 +- .../src/v2beta/product_service_client.ts | 351 +- .../src/v2beta/search_service_client.ts | 437 +- .../v2beta/serving_config_service_client.ts | 307 +- .../src/v2beta/user_event_service_client.ts | 262 + .../test/gapic_catalog_service_v2.ts | 504 +- .../test/gapic_catalog_service_v2alpha.ts | 580 +- .../test/gapic_catalog_service_v2beta.ts | 504 +- .../test/gapic_completion_service_v2.ts | 527 +- .../test/gapic_completion_service_v2alpha.ts | 620 +- .../test/gapic_completion_service_v2beta.ts | 559 +- .../test/gapic_control_service_v2alpha.ts | 580 +- .../test/gapic_control_service_v2beta.ts | 504 +- .../test/gapic_model_service_v2alpha.ts | 2435 ++++++ .../test/gapic_prediction_service_v2.ts | 527 +- .../test/gapic_prediction_service_v2alpha.ts | 620 +- .../test/gapic_prediction_service_v2beta.ts | 559 +- .../test/gapic_product_service_v2.ts | 504 +- .../test/gapic_product_service_v2alpha.ts | 580 +- .../test/gapic_product_service_v2beta.ts | 504 +- .../test/gapic_search_service_v2.ts | 504 +- .../test/gapic_search_service_v2alpha.ts | 580 +- .../test/gapic_search_service_v2beta.ts | 504 +- .../gapic_serving_config_service_v2alpha.ts | 597 +- .../gapic_serving_config_service_v2beta.ts | 520 +- .../test/gapic_user_event_service_v2.ts | 527 +- .../test/gapic_user_event_service_v2alpha.ts | 603 +- .../test/gapic_user_event_service_v2beta.ts | 527 +- 152 files changed, 36866 insertions(+), 1354 deletions(-) create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model_service.proto create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js create mode 100644 packages/google-cloud-retail/src/v2alpha/model_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2alpha/model_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2alpha/model_service_proto_list.json create mode 100644 packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 386a9aa65eb..57b054bca81 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -219,9 +219,8 @@ message Interval { // The lower bound of the interval. If neither of the min fields are set, then // the lower bound is negative infinity. // - // This field must be not larger than - // [max][google.cloud.retail.v2.Interval.max]. Otherwise, an INVALID_ARGUMENT - // error is returned. + // This field must not be larger than max. + // Otherwise, an INVALID_ARGUMENT error is returned. oneof min { // Inclusive lower bound. double minimum = 1; @@ -233,9 +232,8 @@ message Interval { // The upper bound of the interval. If neither of the max fields are set, then // the upper bound is positive infinity. // - // This field must be not smaller than - // [min][google.cloud.retail.v2.Interval.min]. Otherwise, an INVALID_ARGUMENT - // error is returned. + // This field must be not smaller than min. + // Otherwise, an INVALID_ARGUMENT error is returned. oneof max { // Inclusive upper bound. double maximum = 3; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto index 68306218992..14cb26d760f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -99,6 +99,9 @@ message CompleteQueryRequest { // characters. Otherwise, an INVALID_ARGUMENT error is returned. string visitor_id = 7; + // Note that this field applies for `user-data` dataset only. For requests + // with `cloud-retail` dataset, setting this field has no effect. + // // The language filters applied to the output suggestions. If set, it should // contain the language of the query. If not set, suggestions are returned // without considering language restrictions. This is the BCP-47 language @@ -159,8 +162,9 @@ message CompleteQueryResponse { // ingested through BigQuery. // // * For "cloud-retail", the attributes are product attributes generated - // by Cloud Retail. This is an experimental feature. Contact Retail Search - // support team if you are interested in enabling it. + // by Cloud Retail. It requires + // [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details] + // is imported properly. map attributes = 2; } @@ -195,7 +199,7 @@ message CompleteQueryResponse { // [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query] // case insensitively. // - // * They are transformed to lower cases. + // * They are transformed to lower case. // // * They are UTF-8 safe. // diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto index f1f1b4e11c7..717405b2b81 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/prediction_service.proto @@ -42,6 +42,10 @@ service PredictionService { option (google.api.http) = { post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict" body: "*" + additional_bindings { + post: "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict" + body: "*" + } }; } } @@ -49,14 +53,19 @@ service PredictionService { // 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 Recommendations AI placement. Before you can request - // predictions from your model, you must create at least one placement for it. - // For more information, see [Managing - // placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + // `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` + // or + // `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. + // We recommend using the `servingConfigs` resource. `placements` is a legacy + // resource. + // The ID of the Recommendations AI serving config or placement. + // Before you can request predictions from your model, you must create at + // least one serving config or placement for it. For more information, see + // [Managing serving configurations] + // (https://cloud.google.com/retail/docs/manage-configs). // - // The full list of available placements can be seen at - // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + // The full list of available serving configs can be seen at + // https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs string placement = 1 [(google.api.field_behavior) = REQUIRED]; // Required. Context about the user, what they are looking at and what action @@ -75,14 +84,14 @@ message PredictRequest { // [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 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. + // Maximum number of results to return. 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; + // This field is not used; leave it unset. + string page_token = 4 [deprecated = true]; // Filter for restricting prediction results with a length limit of 5,000 // characters. Accepts values for tags and the `filterOutOfStockItems` flag. @@ -113,6 +122,14 @@ message PredictRequest { // receive empty results instead. // Note that the API will never return items with storageStatus of "EXPIRED" // or "DELETED" regardless of filter choices. + // + // If `filterSyntaxV2` is set to true under the `params` field, then + // attribute-based expressions are expected instead of the above described + // tag-based syntax. Examples: + // + // * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + // * (availability: ANY("IN_STOCK")) AND + // (colors: ANY("Red") OR categories: ANY("Phones")) string filter = 5; // Use validate only mode for this prediction query. If set to true, a @@ -146,6 +163,8 @@ message PredictRequest { // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives // request-level control and adjusts prediction results based on product // category. + // * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + // field is interpreteted according to the new, attribute-based syntax. map params = 7; // The labels applied to a resource must meet the following requirements: diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index ba8d8d18e37..e278d81e331 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -115,18 +115,21 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, updates are not immediately manifested in the // [Product][google.cloud.retail.v2.Product] queried by - // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // When inventory is updated with - // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and - // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the - // specified inventory field value(s) will overwrite any existing value(s) + // [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + // and + // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], + // the specified inventory field value(s) will overwrite any existing value(s) // while ignoring the last update time for this field. Furthermore, the last // update time for the specified inventory fields will be overwritten to the // time of the - // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or - // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + // or + // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] // request. // // If no inventory fields are set in @@ -138,10 +141,10 @@ service ProductService { // then any existing inventory information will be preserved. // // Pre-existing inventory information can only be updated with - // [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], + // [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], // and - // [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -166,8 +169,9 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, the added place IDs are not immediately manifested in the // [Product][google.cloud.retail.v2.Product] queried by - // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -193,8 +197,9 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, the removed place IDs are not immediately manifested in the // [Product][google.cloud.retail.v2.Product] queried by - // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -221,13 +226,15 @@ service ProductService { // and processed downstream. As a consequence, when a response is returned, // updates are not immediately manifested in the // [Product][google.cloud.retail.v2.Product] queried by - // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // Local inventory information can only be modified using this method. - // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and - // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no - // effect on local inventories. + // [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + // and + // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -252,13 +259,15 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, removals are not immediately manifested in the // [Product][google.cloud.retail.v2.Product] queried by - // [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // // Local inventory information can only be removed using this method. - // [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and - // [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no - // effect on local inventories. + // [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + // and + // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -276,7 +285,9 @@ service ProductService { } } -// Request message for [CreateProduct][] method. +// Request message for +// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] +// method. message CreateProductRequest { // Required. The parent catalog resource name, such as // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. @@ -306,7 +317,9 @@ message CreateProductRequest { string product_id = 3 [(google.api.field_behavior) = REQUIRED]; } -// Request message for [GetProduct][] method. +// Request message for +// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] +// method. message GetProductRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -324,7 +337,9 @@ message GetProductRequest { ]; } -// Request message for [UpdateProduct][] method. +// Request message for +// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] +// method. message UpdateProductRequest { // Required. The product to update/create. // @@ -358,7 +373,9 @@ message UpdateProductRequest { bool allow_missing = 3; } -// Request message for [DeleteProduct][] method. +// Request message for +// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct] +// method. message DeleteProductRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -487,10 +504,13 @@ message ListProductsResponse { string next_page_token = 2; } -// Request message for [SetInventory][] method. +// Request message for +// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory] +// method. message SetInventoryRequest { // Required. The inventory information to update. The allowable fields to // update are: + // // * [Product.price_info][google.cloud.retail.v2.Product.price_info] // * [Product.availability][google.cloud.retail.v2.Product.availability] // * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity] @@ -498,8 +518,9 @@ message SetInventoryRequest { // The updated inventory fields must be specified in // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]. // - // If [SetInventoryRequest.inventory.name][] is empty or invalid, an - // INVALID_ARGUMENT error is returned. + // If + // [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name] + // is empty or invalid, an INVALID_ARGUMENT error is returned. // // If the caller does not have permission to update the // [Product][google.cloud.retail.v2.Product] named in @@ -522,7 +543,8 @@ message SetInventoryRequest { // * Adds "fulfillment_info" in // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask] // * Specifies only the desired fulfillment types and corresponding place IDs - // to update in [SetInventoryRequest.inventory.fulfillment_info][] + // to update in + // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] // // The caller can clear all place IDs from a subset of fulfillment types in // the following ways: @@ -530,9 +552,9 @@ message SetInventoryRequest { // * Adds "fulfillment_info" in // [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask] // * Specifies only the desired fulfillment types to clear in - // [SetInventoryRequest.inventory.fulfillment_info][] + // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] // * Checks that only the desired fulfillment info types have empty - // [SetInventoryRequest.inventory.fulfillment_info.place_ids][] + // [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids] // // The last update time is recorded for the following inventory fields: // * [Product.price_info][google.cloud.retail.v2.Product.price_info] @@ -541,7 +563,9 @@ message SetInventoryRequest { // * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info] // // If a full overwrite of inventory information while ignoring timestamps is - // needed, [UpdateProduct][] should be invoked instead. + // needed, + // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + // should be invoked instead. Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which inventory fields in the provided @@ -569,11 +593,13 @@ message SetInventoryRequest { // Metadata related to the progress of the SetInventory operation. // Currently empty because there is no meaningful metadata populated from the -// [SetInventory][] method. +// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory] +// method. message SetInventoryMetadata {} // Response of the SetInventoryRequest. Currently empty because -// there is no meaningful response populated from the [SetInventory][] +// there is no meaningful response populated from the +// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory] // method. message SetInventoryResponse {} @@ -611,7 +637,8 @@ message AddFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this @@ -723,7 +750,9 @@ message AddLocalInventoriesMetadata {} // method. message AddLocalInventoriesResponse {} -// Request message for [RemoveLocalInventories][] method. +// Request message for +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] +// method. message RemoveLocalInventoriesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -757,15 +786,21 @@ message RemoveLocalInventoriesRequest { // Metadata related to the progress of the RemoveLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [RemoveLocalInventories][] method. +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] +// method. message RemoveLocalInventoriesMetadata {} -// Response of the [RemoveLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [RemoveLocalInventories][] +// Response of the +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] // method. message RemoveLocalInventoriesResponse {} -// Request message for [RemoveFulfillmentPlaces][] method. +// Request message for +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces] +// method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -829,10 +864,12 @@ message RemoveFulfillmentPlacesRequest { // Metadata related to the progress of the RemoveFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [RemoveFulfillmentPlaces][] method. +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces] +// method. message RemoveFulfillmentPlacesMetadata {} // Response of the RemoveFulfillmentPlacesRequest. Currently empty because there -// is no meaningful response populated from the [RemoveFulfillmentPlaces][] +// is no meaningful response populated from the +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces] // method. message RemoveFulfillmentPlacesResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 82242742e8a..4e666281700 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -51,6 +51,10 @@ service SearchService { option (google.api.http) = { post: "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" body: "*" + additional_bindings { + post: "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search" + body: "*" + } }; } } @@ -151,14 +155,22 @@ message SearchRequest { // Only supported on textual fields. Maximum is 10. repeated string contains = 9; - // The order in which [Facet.values][] are returned. + // True to make facet keys case insensitive when getting faceting + // values with prefixes or contains; false otherwise. + bool case_insensitive = 10; + + // The order in which + // [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values] + // are returned. // // Allowed values are: // - // * "count desc", which means order by [Facet.FacetValue.count][] + // * "count desc", which means order by + // [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count] // descending. // - // * "value desc", which means order by [Facet.FacetValue.value][] + // * "value desc", which means order by + // [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value] // descending. // Only applies to textual facets. // @@ -179,9 +191,11 @@ message SearchRequest { // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] // when query is specified. // - // In the response, [FacetValue.value][] will be always "1" and - // [FacetValue.count][] will be the number of results that matches the - // query. + // In the response, + // [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value] + // will be always "1" and + // [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count] + // will be the number of results that match the query. // // For example, you can set a customized facet for "shipToStore", // where @@ -192,6 +206,10 @@ message SearchRequest { // Then the facet will count the products that are both in stock and ship // to store "123". string query = 5; + + // Returns the min and max value for each numerical facet intervals. + // Ignored for textual facets. + bool return_min_max = 11; } // Required. The facet key specification. @@ -344,7 +362,8 @@ message SearchRequest { message QueryExpansionSpec { // Enum describing under which condition query expansion should occur. enum Condition { - // Unspecified query expansion condition. This defaults to + // Unspecified query expansion condition. In this case, server behavior + // defaults to // [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. CONDITION_UNSPECIFIED = 0; @@ -371,7 +390,7 @@ message SearchRequest { message PersonalizationSpec { // The personalization mode of each search request. enum Mode { - // Default value. Defaults to + // Default value. In this case, server behavior defaults to // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; @@ -391,7 +410,8 @@ message SearchRequest { message SpellCorrectionSpec { // Enum describing under which mode spell correction should occur. enum Mode { - // Unspecified spell correction mode. This defaults to + // Unspecified spell correction mode. In this case, server behavior + // defaults to // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; @@ -443,7 +463,9 @@ message SearchRequest { FACETED_SEARCH_ONLY = 2; } - // Required. The resource name of the search engine placement, such as + // Required. The resource name of the Retail Search serving config, such as + // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + // or the name of the legacy placement resource, such as // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. @@ -777,6 +799,20 @@ message SearchResponse { // Number of items that have this facet value. int64 count = 3; + + // The minimum value in the + // [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]. + // Only supported on numerical facets and returned if + // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max] + // is true. + double min_value = 5; + + // The maximum value in the + // [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]. + // Only supported on numerical facets and returned if + // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max] + // is true. + double max_value = 6; } // The key for this facet. E.g., "colorFamilies" or "price" or @@ -818,7 +854,7 @@ message SearchResponse { // Contains the spell corrected query, if found. If the spell correction type // is AUTOMATIC, then the search results are based on corrected_query. - // Otherwise the original query will be used for search. + // Otherwise the original query is used for search. string corrected_query = 4; // A unique search token. This should be included in the diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto index 4446906a21a..1b0c190df16 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto @@ -20,7 +20,6 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; -import "google/api/resource.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"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto index 9b3d8cb0abd..f6c114d7ca4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog.proto @@ -42,10 +42,10 @@ message ProductLevelConfig { // default to // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] // if unset. - // * `variant`: You can only ingest - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. - // This means + // * `variant` (incompatible with Retail Search): You can only + // ingest + // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2alpha.Product]s. This means // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] // cannot be empty. // @@ -56,8 +56,8 @@ message ProductLevelConfig { // [merchant_center_product_id_field][google.cloud.retail.v2alpha.ProductLevelConfig.merchant_center_product_id_field] // is `itemGroupId`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string ingestion_product_type = 1; @@ -78,8 +78,8 @@ message ProductLevelConfig { // [ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] // is `variant`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string merchant_center_product_id_field = 2; } @@ -144,6 +144,10 @@ message CatalogAttribute { // Required. Attribute name. // For example: `color`, `brands`, `attributes.custom_attribute`, such as // `attributes.xyz`. + // To be indexable, the attribute name can contain only alpha-numeric + // characters and underscores. For example, an attribute named + // `attributes.abc_xyz` can be indexed, but an attribute named + // `attributes.abc-xyz` cannot be indexed. string key = 1 [(google.api.field_behavior) = REQUIRED]; // Output only. Indicates whether this attribute has been used by any @@ -153,15 +157,21 @@ message CatalogAttribute { // Otherwise, this field is `False`. // // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] can be - // pre-loaded by using [AddCatalogAttribute][], [ImportCatalogAttributes][], - // or [UpdateAttributesConfig][] APIs. This field is `False` for pre-loaded + // pre-loaded by using + // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute], + // [CatalogService.ImportCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.ImportCatalogAttributes], + // or + // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig] + // APIs. This field is `False` for pre-loaded // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s. // - // Only [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s that - // are not in use by products can be deleted. + // Only pre-loaded // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s that are - // in use by products cannot be deleted; however, their configuration - // properties will reset to default values upon removal request. + // neither in use by products nor predefined can be deleted. + // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s that are + // either in use by products or are predefined cannot be deleted; however, + // their configuration properties will reset to default values upon removal + // request. // // After catalog changes, it takes about 10 minutes for this field to update. bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -194,6 +204,14 @@ message CatalogAttribute { // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], // as there are no text values associated to numerical attributes. SearchableOption searchable_option = 7; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if RECOMMENDATIONS_FILTERING_ENABLED, + // attribute values are filterable for recommendations. + // This option works for categorical features only, + // does not work for numerical features, inventory filtering. + RecommendationsFilteringOption recommendations_filtering_option = 8; } // Catalog level attribute config. @@ -254,14 +272,18 @@ message CompletionConfig { // Default value: 'exact-prefix'. string matching_order = 2; - // The maximum number of autocomplete suggestions returned per term. The - // maximum allowed max suggestions is 20. Default value is 20. If left unset - // or set to 0, then will fallback to default value. + // The maximum number of autocomplete suggestions returned per term. Default + // value is 20. If left unset or set to 0, then will fallback to default + // value. + // + // Value range is 1 to 20. int32 max_suggestions = 3; // The minimum number of characters needed to be typed in order to get // suggestions. Default value is 2. If left unset or set to 0, then will // fallback to default value. + // + // Value range is 1 to 20. int32 min_prefix_length = 4; // If set to true, the auto learning function is enabled. Auto learning uses @@ -271,8 +293,8 @@ message CompletionConfig { // [CompleteQueryRequest][google.cloud.retail.v2alpha.CompleteQueryRequest]. bool auto_learning = 11; - // Output only. The input config for the import of the source data that - // contains the autocomplete phrases uploaded by the customer. + // Output only. The source data for the latest import of the autocomplete + // suggestion phrases. CompletionDataInputConfig suggestions_input_config = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -284,24 +306,24 @@ message CompletionConfig { string last_suggestions_import_operation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The input config for the import of the source data that - // contains the / autocomplete denylist phrases uploaded by the customer. + // Output only. The source data for the latest import of the autocomplete + // denylist phrases. CompletionDataInputConfig denylist_input_config = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. LRO corresponding to the latest denylist import. + // Output only. Name of the LRO corresponding to the latest denylist import. // // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to // retrieve the latest state of the Long Running Operation. string last_denylist_import_operation = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The input config for the import of the source data that - // contains the autocomplete allowlist phrases uploaded by the customer. + // Output only. The source data for the latest import of the autocomplete + // allowlist phrases. CompletionDataInputConfig allowlist_input_config = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. LRO corresponding to the latest allowlist import. + // Output only. Name of the LRO corresponding to the latest allowlist import. // // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to // retrieve the latest state of the Long Running Operation. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto index 6ecab7251c3..088c01922de 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/catalog_service.proto @@ -384,7 +384,7 @@ message UpdateCompletionConfigRequest { // method. message GetAttributesConfigRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -417,7 +417,7 @@ message UpdateAttributesConfigRequest { // method. message AddCatalogAttributeRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string attributes_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -436,7 +436,7 @@ message AddCatalogAttributeRequest { // method. message RemoveCatalogAttributeRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string attributes_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -454,7 +454,7 @@ message RemoveCatalogAttributeRequest { // method. message ReplaceCatalogAttributeRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string attributes_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto index ae33d3f60b4..02cf05ba8ec 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/common.proto @@ -30,7 +30,7 @@ option ruby_package = "Google::Cloud::Retail::V2alpha"; // At which level we offer configuration for attributes. enum AttributeConfigLevel { - // Value used when unset. Defaults to + // Value used when unset. In this case, server behavior defaults to // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2alpha.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; @@ -55,10 +55,24 @@ enum SolutionType { SOLUTION_TYPE_SEARCH = 2; } +// If filtering for recommendations is enabled. +enum RecommendationsFilteringOption { + // Value used when unset. + // In this case, server behavior defaults to + // [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2alpha.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]. + RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0; + + // Recommendation filtering is disabled. + RECOMMENDATIONS_FILTERING_DISABLED = 1; + + // Recommendation filtering is enabled. + RECOMMENDATIONS_FILTERING_ENABLED = 3; +} + // The use case of Cloud Retail Search. enum SearchSolutionUseCase { - // The value when it's unspecified. Defaults to - // [SEARCH][]. + // The value when it's unspecified. In this case, server behavior defaults to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][]. SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; // Search use case. Expects the traffic has a non-empty @@ -157,10 +171,13 @@ message Rule { } // * Rule Condition: - // - No [Condition][query_terms] provided is a global match. - // - 1 or more [Condition][query_terms] provided is combined with OR - // operator. - // * Action Input: The request query and filter that will be applied to the + // - No + // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] + // provided is a global match. + // - 1 or more + // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] + // provided are combined with OR operator. + // * Action Input: The request query and filter that are applied to the // retrieved products, in addition to any filters already provided with the // SearchRequest. The AND operator is used to combine the query's existing // filters with the filter rule(s). NOTE: May result in 0 results when @@ -187,8 +204,10 @@ message Rule { } // Redirects a shopper to a specific page. + // // * Rule Condition: - // - Must specify [Condition][query_terms]. + // - Must specify + // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms]. // * Action Input: Request Query // * Action Result: Redirects shopper to provided uri. message RedirectAction { @@ -388,11 +407,13 @@ message CustomAttribute { // set. Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // searchable by text queries in + // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is set to the + // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about + // product-level attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are searchable by text queries in // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. // // This field is ignored in a @@ -400,13 +421,16 @@ message CustomAttribute { // // Only set if type [text][google.cloud.retail.v2alpha.CustomAttribute.text] // is set. Otherwise, a INVALID_ARGUMENT error is returned. - optional bool searchable = 3; + optional bool searchable = 3 [deprecated = true]; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // indexed, so that it can be filtered, faceted or boosted in + // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is set to the + // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about + // product-level attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are indexed, so that they can be filtered, + // faceted or boosted in // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. // // This field is ignored in a @@ -418,7 +442,7 @@ message CustomAttribute { // and // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] // for more details. - optional bool indexable = 4; + optional bool indexable = 4 [deprecated = true]; } // Fulfillment information, such as the store IDs for in-store pickup or region @@ -490,9 +514,8 @@ message Interval { // The lower bound of the interval. If neither of the min fields are set, then // the lower bound is negative infinity. // - // This field must be not larger than - // [max][google.cloud.retail.v2alpha.Interval.max]. Otherwise, an - // INVALID_ARGUMENT error is returned. + // This field must not be larger than max. + // Otherwise, an INVALID_ARGUMENT error is returned. oneof min { // Inclusive lower bound. double minimum = 1; @@ -504,9 +527,8 @@ message Interval { // The upper bound of the interval. If neither of the max fields are set, then // the upper bound is positive infinity. // - // This field must be not smaller than - // [min][google.cloud.retail.v2alpha.Interval.min]. Otherwise, an - // INVALID_ARGUMENT error is returned. + // This field must be not smaller than min. + // Otherwise, an INVALID_ARGUMENT error is returned. oneof max { // Inclusive upper bound. double maximum = 3; @@ -563,7 +585,11 @@ message PriceInfo { float price = 2; // Price of the product without any discount. If zero, by default set to be - // the [price][google.cloud.retail.v2alpha.PriceInfo.price]. + // the [price][google.cloud.retail.v2alpha.PriceInfo.price]. If set, + // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] + // should be greater than or equal to + // [price][google.cloud.retail.v2alpha.PriceInfo.price], otherwise an + // INVALID_ARGUMENT error is thrown. float original_price = 3; // The costs associated with the sale of a particular product. Used for gross @@ -650,10 +676,14 @@ message Rating { // Information of an end user. message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in - // user, such as a user name. + // user, such as a user name. Don't set for anonymous users. // // Always use a hashed value for this ID. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded + // model quality. + // // 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; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto index a91aa618734..9f399d2233b 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/completion_service.proto @@ -99,6 +99,9 @@ message CompleteQueryRequest { // characters. Otherwise, an INVALID_ARGUMENT error is returned. string visitor_id = 7; + // Note that this field applies for `user-data` dataset only. For requests + // with `cloud-retail` dataset, setting this field has no effect. + // // The language filters applied to the output suggestions. If set, it should // contain the language of the query. If not set, suggestions are returned // without considering language restrictions. This is the BCP-47 language @@ -133,9 +136,9 @@ message CompleteQueryRequest { // // * user-data // - // * cloud-retail - // This option requires additional allowlisting. Before using cloud-retail, - // contact Cloud Retail support team first. + // * cloud-retail: + // This option requires enabling auto-learning function first. See + // [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback @@ -155,10 +158,14 @@ message CompleteQueryResponse { string suggestion = 1; // Custom attributes for the suggestion term. + // // * For "user-data", the attributes are additional custom attributes // ingested through BigQuery. + // // * For "cloud-retail", the attributes are product attributes generated - // by Cloud Retail. + // by Cloud Retail. It requires + // [UserEvent.product_details][google.cloud.retail.v2alpha.UserEvent.product_details] + // is imported properly. map attributes = 2; } @@ -186,11 +193,15 @@ message CompleteQueryResponse { // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2alpha.CompleteQueryRequest.visitor_id] // field is set and [UserEvent][google.cloud.retail.v2alpha.UserEvent] is // imported. The recent searches satisfy the follow rules: + // // * They are ordered from latest to oldest. + // // * They are matched with // [CompleteQueryRequest.query][google.cloud.retail.v2alpha.CompleteQueryRequest.query] // case insensitively. - // * They are transformed to lower cases. + // + // * They are transformed to lower case. + // // * They are UTF-8 safe. // // Recent searches are deduplicated. More recent searches will be reserved diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto index 4d85015e4d8..cdd683d573e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control.proto @@ -54,7 +54,7 @@ message Control { } // Immutable. Fully qualified name - // projects/*/locations/global/catalogs/*/controls/* + // `projects/*/locations/global/catalogs/*/controls/*` string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Required. The human readable control display name. Used in Retail UI. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto index 6372aca6a39..d69201a3d18 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/control_service.proto @@ -96,7 +96,7 @@ service ControlService { // Request for CreateControl method. message CreateControlRequest { // Required. Full resource name of parent catalog. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } @@ -131,7 +131,7 @@ message UpdateControlRequest { // Request for DeleteControl method. message DeleteControlRequest { // Required. The resource name of the Control to delete. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } @@ -141,7 +141,7 @@ message DeleteControlRequest { // Request for GetControl method. message GetControlRequest { // Required. The resource name of the Control to delete. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } @@ -151,7 +151,7 @@ message GetControlRequest { // Request for ListControls method. message ListControlsRequest { // Required. The catalog resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto index f29c7f9a3fb..dd907d1ea91 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/export_config.proto @@ -16,8 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2alpha; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -60,8 +58,11 @@ message ExportProductsResponse { // 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. + // This field is never set. ExportErrorsConfig errors_config = 2; + + // Output result indicating where the data were exported to. + OutputResult output_result = 3; } // Response of the ExportUserEventsRequest. If the long running @@ -71,7 +72,24 @@ message ExportUserEventsResponse { // 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. + // This field is never set. ExportErrorsConfig errors_config = 2; + + // Output result indicating where the data were exported to. + OutputResult output_result = 3; +} + +// Output result. +message OutputResult { + // Export result in BigQuery. + repeated BigQueryOutputResult bigquery_result = 1; +} + +// A BigQuery output result. +message BigQueryOutputResult { + // The ID of a BigQuery Dataset. + string dataset_id = 1; + + // The ID of a BigQuery Table. + string table_id = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto index a1fcf240c46..319edb1eacb 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/import_config.proto @@ -217,16 +217,32 @@ message ImportProductsRequest { // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. ReconciliationMode reconciliation_mode = 5; - // Pub/Sub topic for receiving notification. If this field is set, + // Full Pub/Sub topic name for receiving notification. If this field is set, // when the import is finished, a notification will be sent to // specified Pub/Sub topic. The message data will be JSON string of a // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + // to be within the same project as + // [ImportProductsRequest.parent][google.cloud.retail.v2alpha.ImportProductsRequest.parent]. + // Make sure that both + // `cloud-retail-customer-data-access@system.gserviceaccount.com` and + // `service-@gcp-sa-retail.iam.gserviceaccount.com` + // have the `pubsub.topics.publish` IAM permission on the topic. // // Only supported when // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] // is set to `FULL`. string notification_pubsub_topic = 7; + + // If true, will perform the FULL import even if it would delete a large + // proportion of the products in the default branch, which could potentially + // cause outages if you have live predict/search traffic. + // + // Only supported when + // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] + // is set to `FULL`. + bool skip_default_branch_protection = 8; } // Request message for the ImportUserEvents request. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model.proto new file mode 100644 index 00000000000..5f4ead9f7d2 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model.proto @@ -0,0 +1,432 @@ +// Copyright 2021 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.v2alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2alpha/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ModelProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Metadata that describes the training and serving parameters of a +// [Model][google.cloud.retail.v2alpha.Model]. A +// [Model][google.cloud.retail.v2alpha.Model] can be associated with a +// [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] and then queried +// through the Predict api. +message Model { + option (google.api.resource) = { + type: "retail.googleapis.com/Model" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}" + }; + + // The PageOptimizationConfig for model training. + // + // This determines how many panels to optimize for, and which serving + // configurations to consider for each panel. + // The purpose of this model is to optimize which + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to show on which + // panels in way that optimizes the visitors shopping journey. + message PageOptimizationConfig { + // A candidate to consider for a given panel. Currently only + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] are valid + // candidates. + message Candidate { + oneof candidate { + // This has to be a valid + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] + // identifier. e.g. for a ServingConfig with full name: + // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/my_candidate_config` + // this would be 'my_candidate_config' + string serving_config_id = 1; + } + } + + // An individual panel with a list of + // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] to consider + // for it. + message Panel { + // Optional. The name to display for the panel. + string display_name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The candidates to consider on the panel. + // + // Limit = 10. + repeated Candidate candidates = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The default candidate (in case the model fails at serving + // time, we can fall back to the default). + Candidate default_candidate = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // Restrictions of expected returned results. + enum Restriction { + // Unspecified value for restriction. + RESTRICTION_UNSPECIFIED = 0; + + // Allow any [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to + // be show on any number of panels. + // + // Example: + // + // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity + // + // `Panel2 candidates`: home_page_ctr_no_diversity, + // home_page_ctr_diversity, + // pdp_cvr_no_diversity + // + // `Restriction` = NO_RESTRICTION + // + // `Valid combinations`: + // + // * (pdp_ctr, home_page_ctr_no_diversity) + // * (pdp_ctr, home_page_ctr_diversity) + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_cvr, home_page_ctr_no_diversity) + // * (pdp_cvr, home_page_ctr_diversity) + // * (pdp_cvr, pdp_cvr_no_diversity) + // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) + // * (home_page_ctr_no_diversity, home_page_ctr_diversity) + // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) + // + // `Invalid combinations`: [] + NO_RESTRICTION = 1; + + // Do not allow the same + // [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name] to + // be shown on multiple panels. + // + // Example: + // + // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity + // + // + // `Panel2 candidates`: home_page_ctr_no_diversity, + // home_page_ctr_diversity_low, + // pdp_cvr_no_diversity + // + // `Restriction` = UNIQUE_SERVING_CONFIG_RESTRICTION + // + // `Valid combinations`: + // + // * (pdp_ctr, home_page_ctr_no_diversity) + // * (pdp_ctr, home_page_ctr_diversity_low) + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_cvr, home_page_ctr_no_diversity) + // * (pdp_cvr, home_page_ctr_diversity_low) + // * (pdp_cvr, pdp_cvr_no_diversity) + // * (home_page_ctr_no_diversity, home_page_ctr_diversity_low) + // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) + // + // `Invalid combinations`: + // + // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) + UNIQUE_SERVING_CONFIG_RESTRICTION = 2; + + // Do not allow multiple + // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] with same + // [Model.name][google.cloud.retail.v2alpha.Model.name] to be show on on + // different panels. + // + // Example: + // + // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity + // + // + // `Panel2 candidates`: home_page_ctr_no_diversity, + // home_page_ctr_diversity_low, + // pdp_cvr_no_diversity + // + // `Restriction` = UNIQUE_MODEL_RESTRICTION + // + // `Valid combinations`: + // + // * (pdp_ctr, home_page_ctr_no_diversity) + // * (pdp_ctr, home_page_ctr_diversity) + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_cvr, home_page_ctr_no_diversity) + // * (pdp_cvr, home_page_ctr_diversity_low) + // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) + // + // `Invalid combinations`: + // + // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) + // * (pdp_cvr, pdp_cvr_no_diversity) + UNIQUE_MODEL_RESTRICTION = 3; + + // Do not allow multiple + // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] with same + // [Model.type][google.cloud.retail.v2alpha.Model.type] to be shown on + // different panels. + // + // Example: + // + // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity + // + // + // `Panel2 candidates`: home_page_ctr_no_diversity, + // home_page_ctr_diversity_low, + // pdp_cvr_no_diversity + // + // `Restriction` = UNIQUE_MODEL_RESTRICTION + // + // `Valid combinations`: + // + // * (pdp_ctr, home_page_ctr_no_diversity) + // * (pdp_ctr, home_page_ctr_diversity) + // * (pdp_cvr, home_page_ctr_no_diversity) + // * (pdp_cvr, home_page_ctr_diversity_low) + // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) + // + // `Invalid combinations`: + // + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_ctr, pdp_cvr_no_diversity) + // * (pdp_cvr, pdp_cvr_no_diversity) + // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) + // * (home_page_ctr_no_diversity, home_page_ctr_diversity) + UNIQUE_MODEL_TYPE_RESTRICTION = 4; + } + + // Required. The type of [UserEvent][google.cloud.retail.v2alpha.UserEvent] + // this page optimization is shown for. + // + // Each page has an associated event type - this will be the + // corresponding event type for the page that the page optimization + // model is used on. + // + // Supported types: + // + // * `add-to-cart`: Products being added to cart. + // * `detail-page-view`: Products detail page viewed. + // * `home-page-view`: Homepage viewed + // * `category-page-view`: Homepage viewed + // * `shopping-cart-page-view`: User viewing a shopping cart. + // + // `home-page-view` only allows models with type `recommended-for-you`. + // All other page_optimization_event_type allow all + // [Model.types][google.cloud.retail.v2alpha.Model.type]. + string page_optimization_event_type = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of panel configurations. + // + // Limit = 5. + repeated Panel panels = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. How to restrict results across panels e.g. can the same + // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] be shown on + // multiple panels at once. + // + // If unspecified, default to `UNIQUE_MODEL_RESTRICTION`. + Restriction restriction = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents an ordered combination of valid serving configs, which + // / may be used for PAGE_OPTIMIZATION recommendations. + message ServingConfigList { + // Optional. A set of valid serving configs that may be used for + // PAGE_OPTIMIZATION. + repeated string serving_config_ids = 1 + [(google.api.field_behavior) = OPTIONAL]; + } + + // The serving state of the model. + enum ServingState { + // Unspecified serving state. + SERVING_STATE_UNSPECIFIED = 0; + + // The model is not serving. + INACTIVE = 1; + + // The model is serving and can be queried. + ACTIVE = 2; + + // The model is trained on tuned hyperparameters, and can be + // queried. + TUNED = 3; + } + + // The training state of the model. + enum TrainingState { + // Unspecified training state. + TRAINING_STATE_UNSPECIFIED = 0; + + // The model training is paused. + PAUSED = 1; + + // The model is training. + TRAINING = 2; + } + + // Describes whether periodic tuning is enabled for this model + // or not. Periodic tuning is scheduled at most every three months. You can + // start a tuning process manually by using the ModelTune + // method, which starts a tuning process immediately and resets the quarterly + // schedule. Enabling or disabling periodic tuning does not affect any + // current tuning processes. + enum PeriodicTuningState { + // Unspecified default value - should never be explicitly set. + PERIODIC_TUNING_STATE_UNSPECIFIED = 0; + + // The model has periodic tuning disabled. Tuning + // can be reenabled by calling the EnableModelPeriodicTuning + // method or by calling the TuneModel method. + PERIODIC_TUNING_DISABLED = 1; + + // The model cannot be tuned with periodic tuning OR the + // TuneModel method. Hide the options in customer UI and + // reject any requests through the backend self serve API. + ALL_TUNING_DISABLED = 3; + + // The model has periodic tuning enabled. Tuning + // can be disabled by calling the DisableModelPeriodicTuning + // method. + PERIODIC_TUNING_ENABLED = 2; + } + + // Describes whether this model have sufficient training data + // to be continuously trained. + enum DataState { + // Unspecified default value - should never be explicitly set. + DATA_STATE_UNSPECIFIED = 0; + + // The model has sufficient training data. + DATA_OK = 1; + + // The model does not have sufficient training data. Error + // messages can be queried via Stackdriver. + DATA_ERROR = 2; + } + + // Training configuration specific to a + // [Model.type][google.cloud.retail.v2alpha.Model.type] - currently, only for + // page optimization. + oneof training_config { + // Optional. The page optimization config. + PageOptimizationConfig page_optimization_config = 17 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. The fully qualified resource name of the model. + // + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + // catalog_id has char limit of 50. + // recommendation_model_id has char limit of 40. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The display name of the model. + // + // Should be human readable, used to display Recommendation Models in the + // Retail Cloud Cosole Dashboard. UTF-8 encoded string with limit of 1024 + // characters. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The training state that the model is in (e.g. + // TRAINING or PAUSED). + // + // Since part of the cost of running the service + // is frequency of training - this can be used to determine when to train + // model in order to control cost. If not specified: the default value for + // CreateModel method is TRAINING. the default value for + // UpdateModel method is to keep the state the same as before. + TrainingState training_state = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The serving state of the model: ACTIVE, NOT_ACTIVE. + ServingState serving_state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp the Recommendation Model was created at. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp the Recommendation Model was last updated. E.g. + // if a Recommendation Model was paused - this would be the time the pause was + // initiated. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The type of model e.g. `home-page`. + // + // Currently supported values: `recommended-for-you`, `others-you-may-like`, + // `frequently-bought-together`, `page-optimization`, 'similar-items', + // 'buy-it-again', `recently-viewed`(readonly value). + string type = 7 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The optimization objective e.g. `cvr`. + // + // Currently supported + // values: `ctr`, `cvr`, `revenue-per-order`. + // + // If not specified, we choose default based on model type. + // Default depends on type of recommendation: + // + // `recommended-for-you` => `ctr` + // + // `others-you-may-like` => `ctr` + // + // `frequently-bought-together` => `revenue_per_order` + string optimization_objective = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The state of periodic tuning. + // + // The period we use is 3 months - to do a + // one-off tune earlier use the TuneModel method. Default value + // is PERIODIC_TUNING_ENABLED. + PeriodicTuningState periodic_tuning_state = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The timestamp when the latest successful tune finished. + google.protobuf.Timestamp last_tune_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The tune operation associated with the model. + // + // Can be used to determine if there is an ongoing tune for this + // recommendation. Empty field implies no tune is goig on. + string tuning_operation = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of data requirements for this model: DATA_OK and + // DATA_ERROR. + // + // Recommendation model cannot be trained if the data is in + // DATA_ERROR state. Recommendation model can have DATA_ERROR state even if + // serving state is ACTIVE: models were trained successfully before, but + // cannot be refreshed because model no longer has sufficient + // data for training. + DataState data_state = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. If RECOMMENDATIONS_FILTERING_ENABLED, recommendation filtering by + // attributes is enabled for the model. + RecommendationsFilteringOption filtering_option = 18 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The list of valid serving configs associated with the + // PageOptimizationConfig. + repeated ServingConfigList serving_config_lists = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model_service.proto new file mode 100644 index 00000000000..30690f538f5 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/model_service.proto @@ -0,0 +1,241 @@ +// Copyright 2021 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.v2alpha; + +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/v2alpha/model.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail"; +option java_multiple_files = true; +option java_outer_classname = "ModelServiceProto"; +option java_package = "com.google.cloud.retail.v2alpha"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; +option ruby_package = "Google::Cloud::Retail::V2alpha"; + +// Service for performing CRUD operations on models. +// Recommendation models contain all the metadata necessary to generate a set of +// models for the Predict() api. A model is queried +// indirectly via a ServingConfig, which associates a model with a +// given Placement (e.g. Frequently Bought Together on Home Page). +// +// This service allows customers to e.g.: +// +// * Initiate training of a model. +// * Pause training of an existing model. +// * List all the available models along with their metadata. +// * Control their tuning schedule. +service ModelService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new model. + rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" + body: "model" + }; + option (google.api.method_signature) = "parent,model"; + option (google.longrunning.operation_info) = { + response_type: "Model" + metadata_type: "CreateModelMetadata" + }; + } + + // Pauses the training of an existing model. + rpc PauseModel(PauseModelRequest) returns (Model) { + option (google.api.http) = { + post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:pause" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Resumes the training of an existing model. + rpc ResumeModel(ResumeModelRequest) returns (Model) { + option (google.api.http) = { + post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:resume" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an existing model. + rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the models linked to this event store. + rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" + }; + option (google.api.method_signature) = "parent"; + } + + // Update of model metadata. Only fields that + // currently can be updated are: filtering_option, periodic_tuning_state. + // If other values are provided, this API method will ignore them. + rpc UpdateModel(UpdateModelRequest) returns (Model) { + option (google.api.http) = { + patch: "/v2alpha/{model.name=projects/*/locations/*/catalogs/*/models/*}" + body: "model" + }; + option (google.api.method_signature) = "model,update_mask"; + } + + // Tunes an existing model. + rpc TuneModel(TuneModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:tune" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "TuneModelResponse" + metadata_type: "TuneModelMetadata" + }; + } +} + +// Request for creating a model. +message CreateModelRequest { + // Required. The parent resource under which to create the model. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The payload of the [Model] to create. + Model model = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Whether to run a dry_run to validate the request (without + // actually creating the model). + bool dry_run = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for updating an existing model. +message UpdateModelRequest { + // Required. The body of the updated [Model]. + Model model = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates which fields in the provided 'model' to + // update. If not set, will by default update all fields. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for pausing training of a model. +message PauseModelRequest { + // Required. The name of the model to pause. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } + ]; +} + +// Request for resuming training of a model. +message ResumeModelRequest { + // Required. The name of the model to resume. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for listing models associated with a resource. +message ListModelsRequest { + // Required. The parent for which to list models. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 50. Max allowed value is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListModels` + // call. Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for deleting a model. +message DeleteModelRequest { + // Required. The resource name of the [Model] to delete. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } + ]; +} + +// Response to a ListModelRequest. +message ListModelsResponse { + // List of Models. + repeated Model models = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} + +// Request to manually start a tuning process now (instead of waiting for +// the periodically scheduled tuning to happen). +message TuneModelRequest { + // Required. The resource name of the model to tune. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } + ]; +} + +// Metadata associated with a create operation. +message CreateModelMetadata { + // The resource name of the model that this create applies to. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + string model = 1; +} + +// Metadata associated with a tune operation. +message TuneModelMetadata { + // The resource name of the model that this tune applies to. + // Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + string model = 1; +} + +// Response associated with a tune operation. +message TuneModelResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto index 5b89bceb40f..b76aed50b11 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/prediction_service.proto @@ -42,6 +42,10 @@ service PredictionService { option (google.api.http) = { post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict" body: "*" + additional_bindings { + post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict" + body: "*" + } }; } } @@ -49,20 +53,35 @@ service PredictionService { // 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 Recommendations AI placement. Before you can request - // predictions from your model, you must create at least one placement for it. - // For more information, see [Managing - // placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + // `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` + // or + // `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. + // We recommend using the `servingConfigs` resource. `placements` is a legacy + // resource. + // The ID of the Recommendations AI serving config or placement. + // Before you can request predictions from your model, you must create at + // least one serving config or placement for it. For more information, see + // [Managing serving configurations] + // (https://cloud.google.com/retail/docs/manage-configs). // - // The full list of available placements can be seen at - // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + // The full list of available serving configs can be seen at + // https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 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. + // + // Don't set + // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id] or + // [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id] to the + // same fixed ID for different users. If you are trying to receive + // non-personalized recommendations (not recommended; this can negatively + // impact model performance), instead set + // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id] to + // a random unique ID and leave + // [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id] unset. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; // Maximum number of results to return per page. Set this property @@ -71,8 +90,8 @@ message PredictRequest { // above 100 will be coerced to 100. int32 page_size = 3; - // The previous PredictResponse.next_page_token. - string page_token = 4; + // This field is not used for now; leave it unset. + string page_token = 4 [deprecated = true]; // Filter for restricting prediction results with a length limit of 5,000 // characters. Accepts values for tags and the `filterOutOfStockItems` flag. @@ -103,6 +122,14 @@ message PredictRequest { // receive empty results instead. // Note that the API will never return items with storageStatus of "EXPIRED" // or "DELETED" regardless of filter choices. + // + // If `filterSyntaxV2` is set to true under the `params` field, then + // attribute-based expressions are expected instead of the above described + // tag-based syntax. Examples: + // + // * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + // * (availability: ANY("IN_STOCK")) AND + // (colors: ANY("Red") OR categories: ANY("Phones")) string filter = 5; // Use validate only mode for this prediction query. If set to true, a @@ -136,6 +163,8 @@ message PredictRequest { // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives // request-level control and adjusts prediction results based on product // category. + // * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + // field is interpreteted according to the new, attribute-based syntax. map params = 7; // The labels applied to a resource must meet the following requirements: @@ -143,7 +172,7 @@ message PredictRequest { // * Each resource can have multiple labels, up to a maximum of 64. // * Each label must be a key-value pair. // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters, and cannot be empty. Values can be empty, and have a maximum + // characters and cannot be empty. Values can be empty and have a maximum // length of 63 characters. // * Keys and values can contain only lowercase letters, numeric characters, // underscores, and dashes. All characters must use UTF-8 encoding, and @@ -169,9 +198,9 @@ message PredictResponse { // // Possible values: // - // * `product`: JSON representation of the product. Will be set if + // * `product`: JSON representation of the product. Is set if // `returnProduct` is set to true in `PredictRequest.params`. - // * `score`: Prediction score in double value. Will be set if + // * `score`: Prediction score in double value. Is set if // `returnScore` is set to true in `PredictRequest.params`. map metadata = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto index cbadc568119..f4826f1bdd0 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product.proto @@ -545,11 +545,11 @@ message Product { // * [name][google.cloud.retail.v2alpha.Product.name] // * [color_info][google.cloud.retail.v2alpha.Product.color_info] // - // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is + // The maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. // // Note: Returning more fields in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] may increase + // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] can increase // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto index 7bced3fb3dd..1a5f702bb05 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/product_service.proto @@ -95,8 +95,9 @@ service ProductService { // [Product][google.cloud.retail.v2alpha.Product]s, this operation could take // hours to complete. Before the operation completes, some // [Product][google.cloud.retail.v2alpha.Product]s may still be returned by - // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, // this operation could take hours to complete. To get a sample of @@ -117,7 +118,7 @@ service ProductService { // Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. // - // Request processing may be synchronous. No partial updating is supported. + // Request processing may be synchronous. // Non-existing items are created. // // Note that it is possible for a subset of the @@ -144,20 +145,21 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, updates are not immediately manifested in the // [Product][google.cloud.retail.v2alpha.Product] queried by - // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // When inventory is updated with - // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] // and - // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], + // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], // the specified inventory field value(s) will overwrite any existing value(s) // while ignoring the last update time for this field. Furthermore, the last // update time for the specified inventory fields will be overwritten to the // time of the - // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] // or - // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] // request. // // If no inventory fields are set in @@ -169,10 +171,10 @@ service ProductService { // then any existing inventory information will be preserved. // // Pre-existing inventory information can only be updated with - // [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], - // [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], + // [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], + // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], // and - // [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. + // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -197,8 +199,9 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, the added place IDs are not immediately manifested in the // [Product][google.cloud.retail.v2alpha.Product] queried by - // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -224,8 +227,9 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, the removed place IDs are not immediately manifested in the // [Product][google.cloud.retail.v2alpha.Product] queried by - // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -252,13 +256,14 @@ service ProductService { // and processed downstream. As a consequence, when a response is returned, // updates are not immediately manifested in the // [Product][google.cloud.retail.v2alpha.Product] queried by - // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // Local inventory information can only be modified using this method. - // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] // and - // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. @@ -284,13 +289,14 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, removals are not immediately manifested in the // [Product][google.cloud.retail.v2alpha.Product] queried by - // [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. // // Local inventory information can only be removed using this method. - // [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] // and - // [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. @@ -309,7 +315,9 @@ service ProductService { } } -// Request message for [CreateProduct][] method. +// Request message for +// [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] +// method. message CreateProductRequest { // Required. The parent catalog resource name, such as // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. @@ -339,7 +347,9 @@ message CreateProductRequest { string product_id = 3 [(google.api.field_behavior) = REQUIRED]; } -// Request message for [GetProduct][] method. +// Request message for +// [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] +// method. message GetProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as @@ -357,7 +367,9 @@ message GetProductRequest { ]; } -// Request message for [UpdateProduct][] method. +// Request message for +// [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] +// method. message UpdateProductRequest { // Required. The product to update/create. // @@ -378,6 +390,11 @@ message UpdateProductRequest { // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. + // + // The attribute key can be updated by setting the mask path as + // "attributes.${key_name}". If a key name is present in the mask but not in + // the patching product from the request, this key will be deleted after the + // update. google.protobuf.FieldMask update_mask = 2; // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is @@ -386,7 +403,9 @@ message UpdateProductRequest { bool allow_missing = 3; } -// Request message for [DeleteProduct][] method. +// Request message for +// [ProductService.DeleteProduct][google.cloud.retail.v2alpha.ProductService.DeleteProduct] +// method. message DeleteProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as @@ -541,10 +560,13 @@ message ListProductsResponse { int32 total_size = 3; } -// Request message for [SetInventory][] method. +// Request message for +// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] +// method. message SetInventoryRequest { // Required. The inventory information to update. The allowable fields to // update are: + // // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] @@ -552,8 +574,9 @@ message SetInventoryRequest { // The updated inventory fields must be specified in // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask]. // - // If [SetInventoryRequest.inventory.name][] is empty or invalid, an - // INVALID_ARGUMENT error is returned. + // If + // [SetInventoryRequest.inventory.name][google.cloud.retail.v2alpha.Product.name] + // is empty or invalid, an INVALID_ARGUMENT error is returned. // // If the caller does not have permission to update the // [Product][google.cloud.retail.v2alpha.Product] named in @@ -576,7 +599,8 @@ message SetInventoryRequest { // * Adds "fulfillment_info" in // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] // * Specifies only the desired fulfillment types and corresponding place IDs - // to update in [SetInventoryRequest.inventory.fulfillment_info][] + // to update in + // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] // // The caller can clear all place IDs from a subset of fulfillment types in // the following ways: @@ -584,9 +608,9 @@ message SetInventoryRequest { // * Adds "fulfillment_info" in // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] // * Specifies only the desired fulfillment types to clear in - // [SetInventoryRequest.inventory.fulfillment_info][] + // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] // * Checks that only the desired fulfillment info types have empty - // [SetInventoryRequest.inventory.fulfillment_info.place_ids][] + // [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] // // The last update time is recorded for the following inventory fields: // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] @@ -595,7 +619,9 @@ message SetInventoryRequest { // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] // // If a full overwrite of inventory information while ignoring timestamps is - // needed, [UpdateProduct][] should be invoked instead. + // needed, + // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] + // should be invoked instead. Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which inventory fields in the provided @@ -623,15 +649,19 @@ message SetInventoryRequest { // Metadata related to the progress of the SetInventory operation. // Currently empty because there is no meaningful metadata populated from the -// [SetInventory][] method. +// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] +// method. message SetInventoryMetadata {} // Response of the SetInventoryRequest. Currently empty because -// there is no meaningful response populated from the [SetInventory][] +// there is no meaningful response populated from the +// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] // method. message SetInventoryResponse {} -// Request message for [AddFulfillmentPlaces][] method. +// Request message for +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as @@ -663,7 +693,8 @@ message AddFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this @@ -699,15 +730,19 @@ message AddFulfillmentPlacesRequest { // Metadata related to the progress of the AddFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [AddFulfillmentPlaces][] method. +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesMetadata {} // Response of the AddFulfillmentPlacesRequest. Currently empty because -// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// there is no meaningful response populated from the +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] // method. message AddFulfillmentPlacesResponse {} -// Request message for [AddLocalInventories][] method. +// Request message for +// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as @@ -760,15 +795,21 @@ message AddLocalInventoriesRequest { // Metadata related to the progress of the AddLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [AddLocalInventories][] method. +// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesMetadata {} -// Response of the [AddLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [AddLocalInventories][] +// Response of the +// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] // method. message AddLocalInventoriesResponse {} -// Request message for [RemoveLocalInventories][] method. +// Request message for +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] +// method. message RemoveLocalInventoriesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as @@ -802,15 +843,21 @@ message RemoveLocalInventoriesRequest { // Metadata related to the progress of the RemoveLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [RemoveLocalInventories][] method. +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] +// method. message RemoveLocalInventoriesMetadata {} -// Response of the [RemoveLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [RemoveLocalInventories][] +// Response of the +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] // method. message RemoveLocalInventoriesResponse {} -// Request message for [RemoveFulfillmentPlaces][] method. +// Request message for +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] +// method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2alpha.Product], such as @@ -842,7 +889,8 @@ message RemoveFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this @@ -873,10 +921,12 @@ message RemoveFulfillmentPlacesRequest { // Metadata related to the progress of the RemoveFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [RemoveFulfillmentPlaces][] method. +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] +// method. message RemoveFulfillmentPlacesMetadata {} // Response of the RemoveFulfillmentPlacesRequest. Currently empty because there -// is no meaningful response populated from the [RemoveFulfillmentPlaces][] +// is no meaningful response populated from the +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] // method. message RemoveFulfillmentPlacesResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto index 6b929f268c6..d05376b6e32 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/purge_config.proto @@ -128,7 +128,10 @@ 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]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // 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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto index f9612734dbf..24bfa34aacd 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/search_service.proto @@ -51,6 +51,10 @@ service SearchService { option (google.api.http) = { post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" body: "*" + additional_bindings { + post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search" + body: "*" + } }; } } @@ -114,8 +118,8 @@ message SearchRequest { // Only get facet for the given restricted values. For example, when using // "pickupInStore" as key and set restricted values to // ["store123", "store456"], only facets for "store123" and "store456" are - // returned. Only supported on textual fields and fulfillments. - // Maximum is 20. + // returned. Only supported on predefined textual fields, custom textual + // attributes and fulfillments. Maximum is 20. // // Must be set for the fulfillment facet keys: // @@ -152,14 +156,22 @@ message SearchRequest { // Only supported on textual fields. Maximum is 10. repeated string contains = 9; - // The order in which [Facet.values][] are returned. + // True to make facet keys case insensitive when getting faceting + // values with prefixes or contains; false otherwise. + bool case_insensitive = 10; + + // The order in which + // [SearchResponse.Facet.values][google.cloud.retail.v2alpha.SearchResponse.Facet.values] + // are returned. // // Allowed values are: // - // * "count desc", which means order by [Facet.FacetValue.count][] + // * "count desc", which means order by + // [SearchResponse.Facet.values.count][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.count] // descending. // - // * "value desc", which means order by [Facet.FacetValue.value][] + // * "value desc", which means order by + // [SearchResponse.Facet.values.value][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.value] // descending. // Only applies to textual facets. // @@ -181,9 +193,11 @@ message SearchRequest { // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] // when query is specified. // - // In the response, [FacetValue.value][] will be always "1" and - // [FacetValue.count][] will be the number of results that matches the - // query. + // In the response, + // [SearchResponse.Facet.values.value][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.value] + // will be always "1" and + // [SearchResponse.Facet.values.count][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.count] + // will be the number of results that match the query. // // For example, you can set a customized facet for "shipToStore", // where @@ -194,6 +208,10 @@ message SearchRequest { // Then the facet will count the products that are both in stock and ship // to store "123". string query = 5; + + // Returns the min and max value for each numerical facet intervals. + // Ignored for textual facets. + bool return_min_max = 11; } // Required. The facet key specification. @@ -208,19 +226,29 @@ message SearchRequest { // List of keys to exclude when faceting. // + // // By default, // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] // is not excluded from the filter unless it is listed in this field. // - // For example, suppose there are 100 products with color facet "Red" and - // 200 products with color facet "Blue". A query containing the filter - // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // Listing a facet key in this field allows its values to appear as facet + // results, even when they are filtered out of search results. Using this + // field does not affect what search results are returned. + // + // For example, suppose there are 100 products with the color facet "Red" + // and 200 products with the color facet "Blue". A query containing the + // filter "colorFamilies:ANY("Red")" and having "colorFamilies" as // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // will by default return the "Red" with count 100. + // would by default return only "Red" products in the search results, and + // also return "Red" with count 100 as the only color facet. Although there + // are also blue products available, "Blue" would not be shown as an + // available facet value. // - // If this field contains "colorFamilies", then the query returns both the - // "Red" with count 100 and "Blue" with count 200, because the - // "colorFamilies" key is now excluded from the filter. + // If "colorFamilies" is listed in "excludedFilterKeys", then the query + // returns the facet values "Red" with count 100 and "Blue" with count + // 200, because the "colorFamilies" key is now excluded from the filter. + // Because this field doesn't affect search results, the search results + // are still correctly filtered to return only "Red" products. // // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error // is returned. @@ -319,7 +347,7 @@ message SearchRequest { // Condition boost specifications. If a product matches multiple conditions // in the specifictions, boost scores from these specifications are all // applied and combined in a non-linear way. Maximum number of - // specifications is 10. + // specifications is 20. repeated ConditionBoostSpec condition_boost_specs = 1; // Whether to skip boostspec validation. If this field is set to true, @@ -336,7 +364,8 @@ message SearchRequest { message QueryExpansionSpec { // Enum describing under which condition query expansion should occur. enum Condition { - // Unspecified query expansion condition. This defaults to + // Unspecified query expansion condition. In this case, server behavior + // defaults to // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. CONDITION_UNSPECIFIED = 0; @@ -363,7 +392,7 @@ message SearchRequest { message PersonalizationSpec { // The personalization mode of each search request. enum Mode { - // Default value. Defaults to + // Default value. In this case, server behavior defaults to // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; @@ -379,11 +408,37 @@ message SearchRequest { Mode mode = 1; } + // The specification for query spell correction. + message SpellCorrectionSpec { + // Enum describing under which mode spell correction should occur. + enum Mode { + // Unspecified spell correction mode. In this case, server behavior + // defaults to + // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Google Retail Search will try to find a spell suggestion if there + // is any and put in the + // [SearchResponse.corrected_query][google.cloud.retail.v2alpha.SearchResponse.corrected_query]. + // The spell suggestion will not be used as the search query. + SUGGESTION_ONLY = 1; + + // Automatic spell correction built by Google Retail Search. Search will + // be based on the corrected query if found. + AUTO = 2; + } + + // The mode under which spell correction should take effect to + // replace the original search query. Default to + // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + Mode mode = 1; + } + // The relevance threshold of the search results. The higher relevance // threshold is, the higher relevant results are shown and the less number of // results are returned. enum RelevanceThreshold { - // Default value. Defaults to + // Default value. In this case, server behavior defaults to // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH]. RELEVANCE_THRESHOLD_UNSPECIFIED = 0; @@ -421,7 +476,9 @@ message SearchRequest { // Only faceted search will be performed. The product search will be // disabled. // - // When in this mode, one or both of [SearchRequest.facet_spec][] and + // When in this mode, one or both of + // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] + // and // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] @@ -429,8 +486,10 @@ message SearchRequest { FACETED_SEARCH_ONLY = 2; } - // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + // Required. The resource name of the Retail Search serving config, such as + // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + // or the name of the legacy placement resource, such as + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -445,6 +504,11 @@ message SearchRequest { ]; // Raw search query. + // + // If this field is empty, the request is considered a category browsing + // request and returned results are based on + // [filter][google.cloud.retail.v2alpha.SearchRequest.filter] and + // [page_categories][google.cloud.retail.v2alpha.SearchRequest.page_categories]. string query = 3; // Required. A unique identifier for tracking visitors. For example, this @@ -541,10 +605,11 @@ message SearchRequest { // // Notice that if both // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - // and [SearchRequest.boost_spec] are set, the boost conditions from both - // places are evaluated. If a search request matches multiple boost - // conditions, the final boost score is equal to the sum of the boost scores - // from all matched boost conditions. + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which @@ -588,7 +653,8 @@ message SearchRequest { // * inventory(place_id,price) // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the - // [Product.inventories.attributes][] map. + // [Product.local_inventories.attributes][google.cloud.retail.v2alpha.LocalInventory.attributes] + // map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. // * pickupInStore.id, where id is any @@ -661,6 +727,29 @@ message SearchRequest { // The specification for personalization. PersonalizationSpec personalization_spec = 32; + + // The labels applied to a resource must meet the following requirements: + // + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters and cannot be empty. Values can be empty and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. + // + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. + map labels = 34; + + // The spell correction specification that specifies the mode under + // which spell correction will take effect. + optional SpellCorrectionSpec spell_correction_spec = 35; } // Response message for @@ -757,6 +846,20 @@ message SearchResponse { // Number of items that have this facet value. int64 count = 3; + + // The minimum value in the + // [FacetValue.interval][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval]. + // Only supported on numerical facets and returned if + // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.return_min_max] + // is true. + double min_value = 5; + + // The maximum value in the + // [FacetValue.interval][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval]. + // Only supported on numerical facets and returned if + // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.return_min_max] + // is true. + double max_value = 6; } // The key for this facet. E.g., "colorFamilies" or "price" or @@ -796,7 +899,9 @@ message SearchResponse { // matches. int32 total_size = 3; - // If spell correction applies, the corrected query. Otherwise, empty. + // Contains the spell corrected query, if found. If the spell correction type + // is AUTOMATIC, then the search results are based on corrected_query. + // Otherwise the original query is used for search. string corrected_query = 4; // A unique search token. This should be included in the @@ -814,10 +919,10 @@ message SearchResponse { QueryExpansionInfo query_expansion_info = 7; // The URI of a customer-defined redirect page. If redirect action is - // triggered, no search will be performed, and only + // triggered, no search is performed, and only // [redirect_uri][google.cloud.retail.v2alpha.SearchResponse.redirect_uri] and // [attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] - // will be set in the response. + // are set in the response. string redirect_uri = 10; // The fully qualified resource name of applied diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto index c339f3106d4..d0524012454 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config.proto @@ -41,7 +41,7 @@ message ServingConfig { }; // Immutable. Fully qualified name - // projects/*/locations/global/catalogs/*/servingConfig/* + // `projects/*/locations/global/catalogs/*/servingConfig/*` string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Required. The human readable serving config display name. Used in Retail @@ -114,10 +114,11 @@ message ServingConfig { // // Notice that if both // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - // and [SearchRequest.boost_spec] are set, the boost conditions from both - // places are evaluated. If a search request matches multiple boost - // conditions, the final boost score is equal to the sum of the boost scores - // from all matched boost conditions. + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. // // Can only be set if // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto index 4828679766e..311126510e2 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto @@ -124,7 +124,7 @@ service ServingConfigService { // Request for CreateServingConfig method. message CreateServingConfigRequest { // Required. Full resource name of parent. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto index 94f728791f9..ca25f3003fe 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event.proto @@ -54,11 +54,15 @@ message UserEvent { // 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. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded model + // quality. + // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // The field should not contain PII or user-data. We recommend to use Google - // Analystics [Client + // Analytics [Client // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; @@ -111,12 +115,11 @@ message UserEvent { // The main product details related to the event. // - // This field is required for the following event types: + // This field is optional except for the following event types: // // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` - // * `search` // // 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 browsing the diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto index af97dad9dbc..35fe33f4bae 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2alpha/user_event_service.proto @@ -20,7 +20,6 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; -import "google/api/resource.proto"; import "google/cloud/retail/v2alpha/import_config.proto"; import "google/cloud/retail/v2alpha/purge_config.proto"; import "google/cloud/retail/v2alpha/user_event.proto"; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto index e0b844ef639..0c2cab63c10 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto @@ -42,10 +42,10 @@ message ProductLevelConfig { // default to // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] // if unset. - // * `variant`: You can only ingest - // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2beta.Product]s. - // This means + // * `variant` (incompatible with Retail Search): You can only + // ingest + // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2beta.Product]s. This means // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id] // cannot be empty. // @@ -56,8 +56,8 @@ message ProductLevelConfig { // [merchant_center_product_id_field][google.cloud.retail.v2beta.ProductLevelConfig.merchant_center_product_id_field] // is `itemGroupId`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string ingestion_product_type = 1; @@ -78,8 +78,8 @@ message ProductLevelConfig { // [ingestion_product_type][google.cloud.retail.v2beta.ProductLevelConfig.ingestion_product_type] // is `variant`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string merchant_center_product_id_field = 2; } @@ -144,6 +144,10 @@ message CatalogAttribute { // Required. Attribute name. // For example: `color`, `brands`, `attributes.custom_attribute`, such as // `attributes.xyz`. + // To be indexable, the attribute name can contain only alpha-numeric + // characters and underscores. For example, an attribute named + // `attributes.abc_xyz` can be indexed, but an attribute named + // `attributes.abc-xyz` cannot be indexed. string key = 1 [(google.api.field_behavior) = REQUIRED]; // Output only. Indicates whether this attribute has been used by any @@ -153,15 +157,20 @@ message CatalogAttribute { // Otherwise, this field is `False`. // // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] can be - // pre-loaded by using [AddCatalogAttribute][], [ImportCatalogAttributes][], - // or [UpdateAttributesConfig][] APIs. This field is `False` for pre-loaded + // pre-loaded by using + // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2beta.CatalogService.AddCatalogAttribute], + // [CatalogService.ImportCatalogAttributes][], or + // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2beta.CatalogService.UpdateAttributesConfig] + // APIs. This field is `False` for pre-loaded // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s. // - // Only [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s that - // are not in use by products can be deleted. + // Only pre-loaded // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s that are - // in use by products cannot be deleted; however, their configuration - // properties will reset to default values upon removal request. + // neither in use by products nor predefined can be deleted. + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s that are + // either in use by products or are predefined cannot be deleted; however, + // their configuration properties will reset to default values upon removal + // request. // // After catalog changes, it takes about 10 minutes for this field to update. bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -194,6 +203,14 @@ message CatalogAttribute { // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search], as // there are no text values associated to numerical attributes. SearchableOption searchable_option = 7; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if RECOMMENDATIONS_FILTERING_ENABLED, + // attribute values are filterable for recommendations. + // This option works for categorical features only, + // does not work for numerical features, inventory filtering. + RecommendationsFilteringOption recommendations_filtering_option = 8; } // Catalog level attribute config. @@ -254,14 +271,18 @@ message CompletionConfig { // Default value: 'exact-prefix'. string matching_order = 2; - // The maximum number of autocomplete suggestions returned per term. The - // maximum allowed max suggestions is 20. Default value is 20. If left unset - // or set to 0, then will fallback to default value. + // The maximum number of autocomplete suggestions returned per term. Default + // value is 20. If left unset or set to 0, then will fallback to default + // value. + // + // Value range is 1 to 20. int32 max_suggestions = 3; // The minimum number of characters needed to be typed in order to get // suggestions. Default value is 2. If left unset or set to 0, then will // fallback to default value. + // + // Value range is 1 to 20. int32 min_prefix_length = 4; // If set to true, the auto learning function is enabled. Auto learning uses @@ -271,8 +292,8 @@ message CompletionConfig { // [CompleteQueryRequest][google.cloud.retail.v2beta.CompleteQueryRequest]. bool auto_learning = 11; - // Output only. The input config for the import of the source data that - // contains the autocomplete phrases uploaded by the customer. + // Output only. The source data for the latest import of the autocomplete + // suggestion phrases. CompletionDataInputConfig suggestions_input_config = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -284,24 +305,24 @@ message CompletionConfig { string last_suggestions_import_operation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The input config for the import of the source data that - // contains the / autocomplete denylist phrases uploaded by the customer. + // Output only. The source data for the latest import of the autocomplete + // denylist phrases. CompletionDataInputConfig denylist_input_config = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. LRO corresponding to the latest denylist import. + // Output only. Name of the LRO corresponding to the latest denylist import. // // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to // retrieve the latest state of the Long Running Operation. string last_denylist_import_operation = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The input config for the import of the source data that - // contains the autocomplete allowlist phrases uploaded by the customer. + // Output only. The source data for the latest import of the autocomplete + // allowlist phrases. CompletionDataInputConfig allowlist_input_config = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. LRO corresponding to the latest allowlist import. + // Output only. Name of the LRO corresponding to the latest allowlist import. // // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to // retrieve the latest state of the Long Running Operation. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto index 7e27c916b1e..fb6f8bca0f0 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto @@ -384,7 +384,7 @@ message UpdateCompletionConfigRequest { // method. message GetAttributesConfigRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -417,7 +417,7 @@ message UpdateAttributesConfigRequest { // method. message AddCatalogAttributeRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string attributes_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -436,7 +436,7 @@ message AddCatalogAttributeRequest { // method. message RemoveCatalogAttributeRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string attributes_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -454,7 +454,7 @@ message RemoveCatalogAttributeRequest { // method. message ReplaceCatalogAttributeRequest { // Required. Full AttributesConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` string attributes_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index ada7dd1508d..3a500afc586 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -30,7 +30,7 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // At which level we offer configuration for attributes. enum AttributeConfigLevel { - // Value used when unset. Defaults to + // Value used when unset. In this case, server behavior defaults to // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2beta.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; @@ -55,10 +55,24 @@ enum SolutionType { SOLUTION_TYPE_SEARCH = 2; } +// If filtering for recommendations is enabled. +enum RecommendationsFilteringOption { + // Value used when unset. + // In this case, server behavior defaults to + // [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2beta.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]. + RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0; + + // Recommendation filtering is disabled. + RECOMMENDATIONS_FILTERING_DISABLED = 1; + + // Recommendation filtering is enabled. + RECOMMENDATIONS_FILTERING_ENABLED = 3; +} + // The use case of Cloud Retail Search. enum SearchSolutionUseCase { - // The value when it's unspecified. Defaults to - // [SEARCH][]. + // The value when it's unspecified. In this case, server behavior defaults to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][]. SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; // Search use case. Expects the traffic has a non-empty @@ -157,10 +171,13 @@ message Rule { } // * Rule Condition: - // - No [Condition][query_terms] provided is a global match. - // - 1 or more [Condition][query_terms] provided is combined with OR - // operator. - // * Action Input: The request query and filter that will be applied to the + // - No + // [Condition.query_terms][google.cloud.retail.v2beta.Condition.query_terms] + // provided is a global match. + // - 1 or more + // [Condition.query_terms][google.cloud.retail.v2beta.Condition.query_terms] + // provided are combined with OR operator. + // * Action Input: The request query and filter that are applied to the // retrieved products, in addition to any filters already provided with the // SearchRequest. The AND operator is used to combine the query's existing // filters with the filter rule(s). NOTE: May result in 0 results when @@ -187,8 +204,10 @@ message Rule { } // Redirects a shopper to a specific page. + // // * Rule Condition: - // - Must specify [Condition][query_terms]. + // - Must specify + // [Condition.query_terms][google.cloud.retail.v2beta.Condition.query_terms]. // * Action Input: Request Query // * Action Result: Redirects shopper to provided uri. message RedirectAction { @@ -388,11 +407,13 @@ message CustomAttribute { // set. Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2beta.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // searchable by text queries in + // of the [Catalog][google.cloud.retail.v2beta.Catalog] is set to the + // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about + // product-level attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are searchable by text queries in // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. // // This field is ignored in a @@ -400,13 +421,16 @@ message CustomAttribute { // // Only set if type [text][google.cloud.retail.v2beta.CustomAttribute.text] is // set. Otherwise, a INVALID_ARGUMENT error is returned. - optional bool searchable = 3; + optional bool searchable = 3 [deprecated = true]; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][google.cloud.retail.v2beta.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2beta.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // indexed, so that it can be filtered, faceted or boosted in + // of the [Catalog][google.cloud.retail.v2beta.Catalog] is set to the + // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about + // product-level attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are indexed, so that they can be filtered, + // faceted or boosted in // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]. // // This field is ignored in a @@ -418,7 +442,7 @@ message CustomAttribute { // and // [SearchRequest.boost_spec][google.cloud.retail.v2beta.SearchRequest.boost_spec] // for more details. - optional bool indexable = 4; + optional bool indexable = 4 [deprecated = true]; } // Fulfillment information, such as the store IDs for in-store pickup or region @@ -490,9 +514,8 @@ message Interval { // The lower bound of the interval. If neither of the min fields are set, then // the lower bound is negative infinity. // - // This field must be not larger than - // [max][google.cloud.retail.v2beta.Interval.max]. Otherwise, an - // INVALID_ARGUMENT error is returned. + // This field must not be larger than max. + // Otherwise, an INVALID_ARGUMENT error is returned. oneof min { // Inclusive lower bound. double minimum = 1; @@ -504,9 +527,8 @@ message Interval { // The upper bound of the interval. If neither of the max fields are set, then // the upper bound is positive infinity. // - // This field must be not smaller than - // [min][google.cloud.retail.v2beta.Interval.min]. Otherwise, an - // INVALID_ARGUMENT error is returned. + // This field must be not smaller than min. + // Otherwise, an INVALID_ARGUMENT error is returned. oneof max { // Inclusive upper bound. double maximum = 3; @@ -562,7 +584,11 @@ message PriceInfo { float price = 2; // Price of the product without any discount. If zero, by default set to be - // the [price][google.cloud.retail.v2beta.PriceInfo.price]. + // the [price][google.cloud.retail.v2beta.PriceInfo.price]. If set, + // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] + // should be greater than or equal to + // [price][google.cloud.retail.v2beta.PriceInfo.price], otherwise an + // INVALID_ARGUMENT error is thrown. float original_price = 3; // The costs associated with the sale of a particular product. Used for gross @@ -649,10 +675,14 @@ message Rating { // Information of an end user. message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in - // user, such as a user name. + // user, such as a user name. Don't set for anonymous users. // // Always use a hashed value for this ID. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded + // model quality. + // // 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; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto index 6a1f2907681..0d6480a1a2e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto @@ -99,6 +99,9 @@ message CompleteQueryRequest { // characters. Otherwise, an INVALID_ARGUMENT error is returned. string visitor_id = 7; + // Note that this field applies for `user-data` dataset only. For requests + // with `cloud-retail` dataset, setting this field has no effect. + // // The language filters applied to the output suggestions. If set, it should // contain the language of the query. If not set, suggestions are returned // without considering language restrictions. This is the BCP-47 language @@ -133,9 +136,9 @@ message CompleteQueryRequest { // // * user-data // - // * cloud-retail - // This option requires additional allowlisting. Before using cloud-retail, - // contact Cloud Retail support team first. + // * cloud-retail: + // This option requires enabling auto-learning function first. See + // [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback @@ -155,10 +158,14 @@ message CompleteQueryResponse { string suggestion = 1; // Custom attributes for the suggestion term. + // // * For "user-data", the attributes are additional custom attributes // ingested through BigQuery. + // // * For "cloud-retail", the attributes are product attributes generated - // by Cloud Retail. + // by Cloud Retail. It requires + // [UserEvent.product_details][google.cloud.retail.v2beta.UserEvent.product_details] + // is imported properly. map attributes = 2; } @@ -186,11 +193,15 @@ message CompleteQueryResponse { // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2beta.CompleteQueryRequest.visitor_id] // field is set and [UserEvent][google.cloud.retail.v2beta.UserEvent] is // imported. The recent searches satisfy the follow rules: + // // * They are ordered from latest to oldest. + // // * They are matched with // [CompleteQueryRequest.query][google.cloud.retail.v2beta.CompleteQueryRequest.query] // case insensitively. - // * They are transformed to lower cases. + // + // * They are transformed to lower case. + // // * They are UTF-8 safe. // // Recent searches are deduplicated. More recent searches will be reserved diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto index e55622272a4..2cd59be4b7e 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto @@ -54,7 +54,7 @@ message Control { } // Immutable. Fully qualified name - // projects/*/locations/global/catalogs/*/controls/* + // `projects/*/locations/global/catalogs/*/controls/*` string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Required. The human readable control display name. Used in Retail UI. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto index 922c46f2fb6..3ec62e6c674 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto @@ -96,7 +96,7 @@ service ControlService { // Request for CreateControl method. message CreateControlRequest { // Required. Full resource name of parent catalog. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } @@ -131,7 +131,7 @@ message UpdateControlRequest { // Request for DeleteControl method. message DeleteControlRequest { // Required. The resource name of the Control to delete. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } @@ -141,7 +141,7 @@ message DeleteControlRequest { // Request for GetControl method. message GetControlRequest { // Required. The resource name of the Control to delete. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } @@ -151,7 +151,7 @@ message GetControlRequest { // Request for ListControls method. message ListControlsRequest { // Required. The catalog resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto index 249f50119d4..52ef46a42e7 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto @@ -16,8 +16,6 @@ syntax = "proto3"; package google.cloud.retail.v2beta; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -60,8 +58,11 @@ message ExportProductsResponse { // 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. + // This field is never set. ExportErrorsConfig errors_config = 2; + + // Output result indicating where the data were exported to. + OutputResult output_result = 3; } // Response of the ExportUserEventsRequest. If the long running @@ -71,7 +72,24 @@ message ExportUserEventsResponse { // 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. + // This field is never set. ExportErrorsConfig errors_config = 2; + + // Output result indicating where the data were exported to. + OutputResult output_result = 3; +} + +// Output result. +message OutputResult { + // Export result in BigQuery. + repeated BigQueryOutputResult bigquery_result = 1; +} + +// A BigQuery output result. +message BigQueryOutputResult { + // The ID of a BigQuery Dataset. + string dataset_id = 1; + + // The ID of a BigQuery Table. + string table_id = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index c1390ab0d1c..4e53ca636b2 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -217,11 +217,18 @@ message ImportProductsRequest { // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. ReconciliationMode reconciliation_mode = 5; - // Pub/Sub topic for receiving notification. If this field is set, + // Full Pub/Sub topic name for receiving notification. If this field is set, // when the import is finished, a notification will be sent to // specified Pub/Sub topic. The message data will be JSON string of a // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + // to be within the same project as + // [ImportProductsRequest.parent][google.cloud.retail.v2beta.ImportProductsRequest.parent]. + // Make sure that both + // `cloud-retail-customer-data-access@system.gserviceaccount.com` and + // `service-@gcp-sa-retail.iam.gserviceaccount.com` + // have the `pubsub.topics.publish` IAM permission on the topic. // // Only supported when // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto index c5ec1871580..d4d18ee1020 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto @@ -42,6 +42,10 @@ service PredictionService { option (google.api.http) = { post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict" body: "*" + additional_bindings { + post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict" + body: "*" + } }; } } @@ -49,20 +53,35 @@ service PredictionService { // 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 Recommendations AI placement. Before you can request - // predictions from your model, you must create at least one placement for it. - // For more information, see [Managing - // placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). + // `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` + // or + // `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. + // We recommend using the `servingConfigs` resource. `placements` is a legacy + // resource. + // The ID of the Recommendations AI serving config or placement. + // Before you can request predictions from your model, you must create at + // least one serving config or placement for it. For more information, see + // [Managing serving configurations] + // (https://cloud.google.com/retail/docs/manage-configs). // - // The full list of available placements can be seen at - // https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + // The full list of available serving configs can be seen at + // https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 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. + // + // Don't set + // [UserEvent.visitor_id][google.cloud.retail.v2beta.UserEvent.visitor_id] or + // [UserInfo.user_id][google.cloud.retail.v2beta.UserInfo.user_id] to the same + // fixed ID for different users. If you are trying to receive non-personalized + // recommendations (not recommended; this can negatively impact model + // performance), instead set + // [UserEvent.visitor_id][google.cloud.retail.v2beta.UserEvent.visitor_id] to + // a random unique ID and leave + // [UserInfo.user_id][google.cloud.retail.v2beta.UserInfo.user_id] unset. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; // Maximum number of results to return per page. Set this property @@ -71,7 +90,7 @@ message PredictRequest { // above 100 will be coerced to 100. int32 page_size = 3; - // The previous PredictResponse.next_page_token. + // This field is not used for now; leave it unset. string page_token = 4; // Filter for restricting prediction results with a length limit of 5,000 @@ -103,6 +122,14 @@ message PredictRequest { // receive empty results instead. // Note that the API will never return items with storageStatus of "EXPIRED" // or "DELETED" regardless of filter choices. + // + // If `filterSyntaxV2` is set to true under the `params` field, then + // attribute-based expressions are expected instead of the above described + // tag-based syntax. Examples: + // + // * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + // * (availability: ANY("IN_STOCK")) AND + // (colors: ANY("Red") OR categories: ANY("Phones")) string filter = 5; // Use validate only mode for this prediction query. If set to true, a @@ -136,6 +163,8 @@ message PredictRequest { // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives // request-level control and adjusts prediction results based on product // category. + // * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + // field is interpreteted according to the new, attribute-based syntax. map params = 7; // The labels applied to a resource must meet the following requirements: @@ -143,7 +172,7 @@ message PredictRequest { // * Each resource can have multiple labels, up to a maximum of 64. // * Each label must be a key-value pair. // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters, and cannot be empty. Values can be empty, and have a maximum + // characters and cannot be empty. Values can be empty and have a maximum // length of 63 characters. // * Keys and values can contain only lowercase letters, numeric characters, // underscores, and dashes. All characters must use UTF-8 encoding, and @@ -169,9 +198,9 @@ message PredictResponse { // // Possible values: // - // * `product`: JSON representation of the product. Will be set if + // * `product`: JSON representation of the product. Is set if // `returnProduct` is set to true in `PredictRequest.params`. - // * `score`: Prediction score in double value. Will be set if + // * `score`: Prediction score in double value. Is set if // `returnScore` is set to true in `PredictRequest.params`. map metadata = 2; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 4e6dfec8239..9490e09fcb8 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -544,11 +544,11 @@ message Product { // * [name][google.cloud.retail.v2beta.Product.name] // * [color_info][google.cloud.retail.v2beta.Product.color_info] // - // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is + // The maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. // // Note: Returning more fields in - // [SearchResponse][google.cloud.retail.v2beta.SearchResponse] may increase + // [SearchResponse][google.cloud.retail.v2beta.SearchResponse] can increase // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index 0ad73436d3e..a9bfd96581c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -88,7 +88,7 @@ service ProductService { // Bulk import of multiple [Product][google.cloud.retail.v2beta.Product]s. // - // Request processing may be synchronous. No partial updating is supported. + // Request processing may be synchronous. // Non-existing items are created. // // Note that it is possible for a subset of the @@ -115,19 +115,21 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, updates are not immediately manifested in the // [Product][google.cloud.retail.v2beta.Product] queried by - // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // When inventory is updated with - // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] // and - // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], + // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], // the specified inventory field value(s) will overwrite any existing value(s) // while ignoring the last update time for this field. Furthermore, the last // update time for the specified inventory fields will be overwritten to the // time of the - // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or - // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // or + // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] // request. // // If no inventory fields are set in @@ -139,10 +141,10 @@ service ProductService { // then any existing inventory information will be preserved. // // Pre-existing inventory information can only be updated with - // [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], - // [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], + // [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], + // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], // and - // [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. + // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -167,8 +169,9 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, the added place IDs are not immediately manifested in the // [Product][google.cloud.retail.v2beta.Product] queried by - // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -194,8 +197,9 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, the removed place IDs are not immediately manifested in the // [Product][google.cloud.retail.v2beta.Product] queried by - // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. @@ -222,13 +226,14 @@ service ProductService { // and processed downstream. As a consequence, when a response is returned, // updates are not immediately manifested in the // [Product][google.cloud.retail.v2beta.Product] queried by - // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // Local inventory information can only be modified using this method. - // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] // and - // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. @@ -254,13 +259,14 @@ service ProductService { // enqueued and processed downstream. As a consequence, when a response is // returned, removals are not immediately manifested in the // [Product][google.cloud.retail.v2beta.Product] queried by - // [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or - // [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. + // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] + // or + // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // // Local inventory information can only be removed using this method. - // [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] + // [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] // and - // [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] // has no effect on local inventories. // // This feature is only available for users who have Retail Search enabled. @@ -279,7 +285,9 @@ service ProductService { } } -// Request message for [CreateProduct][] method. +// Request message for +// [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] +// method. message CreateProductRequest { // Required. The parent catalog resource name, such as // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. @@ -309,7 +317,9 @@ message CreateProductRequest { string product_id = 3 [(google.api.field_behavior) = REQUIRED]; } -// Request message for [GetProduct][] method. +// Request message for +// [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] +// method. message GetProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as @@ -327,7 +337,9 @@ message GetProductRequest { ]; } -// Request message for [UpdateProduct][] method. +// Request message for +// [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] +// method. message UpdateProductRequest { // Required. The product to update/create. // @@ -348,6 +360,11 @@ message UpdateProductRequest { // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. + // + // The attribute key can be updated by setting the mask path as + // "attributes.${key_name}". If a key name is present in the mask but not in + // the patching product from the request, this key will be deleted after the + // update. google.protobuf.FieldMask update_mask = 2; // If set to true, and the [Product][google.cloud.retail.v2beta.Product] is @@ -356,7 +373,9 @@ message UpdateProductRequest { bool allow_missing = 3; } -// Request message for [DeleteProduct][] method. +// Request message for +// [ProductService.DeleteProduct][google.cloud.retail.v2beta.ProductService.DeleteProduct] +// method. message DeleteProductRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as @@ -488,10 +507,13 @@ message ListProductsResponse { string next_page_token = 2; } -// Request message for [SetInventory][] method. +// Request message for +// [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory] +// method. message SetInventoryRequest { // Required. The inventory information to update. The allowable fields to // update are: + // // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] // * [Product.availability][google.cloud.retail.v2beta.Product.availability] // * [Product.available_quantity][google.cloud.retail.v2beta.Product.available_quantity] @@ -499,8 +521,9 @@ message SetInventoryRequest { // The updated inventory fields must be specified in // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask]. // - // If [SetInventoryRequest.inventory.name][] is empty or invalid, an - // INVALID_ARGUMENT error is returned. + // If + // [SetInventoryRequest.inventory.name][google.cloud.retail.v2beta.Product.name] + // is empty or invalid, an INVALID_ARGUMENT error is returned. // // If the caller does not have permission to update the // [Product][google.cloud.retail.v2beta.Product] named in @@ -523,7 +546,8 @@ message SetInventoryRequest { // * Adds "fulfillment_info" in // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask] // * Specifies only the desired fulfillment types and corresponding place IDs - // to update in [SetInventoryRequest.inventory.fulfillment_info][] + // to update in + // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] // // The caller can clear all place IDs from a subset of fulfillment types in // the following ways: @@ -531,9 +555,9 @@ message SetInventoryRequest { // * Adds "fulfillment_info" in // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask] // * Specifies only the desired fulfillment types to clear in - // [SetInventoryRequest.inventory.fulfillment_info][] + // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] // * Checks that only the desired fulfillment info types have empty - // [SetInventoryRequest.inventory.fulfillment_info.place_ids][] + // [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids] // // The last update time is recorded for the following inventory fields: // * [Product.price_info][google.cloud.retail.v2beta.Product.price_info] @@ -542,7 +566,9 @@ message SetInventoryRequest { // * [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info] // // If a full overwrite of inventory information while ignoring timestamps is - // needed, [UpdateProduct][] should be invoked instead. + // needed, + // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] + // should be invoked instead. Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; // Indicates which inventory fields in the provided @@ -570,15 +596,19 @@ message SetInventoryRequest { // Metadata related to the progress of the SetInventory operation. // Currently empty because there is no meaningful metadata populated from the -// [SetInventory][] method. +// [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory] +// method. message SetInventoryMetadata {} // Response of the SetInventoryRequest. Currently empty because -// there is no meaningful response populated from the [SetInventory][] +// there is no meaningful response populated from the +// [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory] // method. message SetInventoryResponse {} -// Request message for [AddFulfillmentPlaces][] method. +// Request message for +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as @@ -610,7 +640,8 @@ message AddFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2beta.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this @@ -646,15 +677,19 @@ message AddFulfillmentPlacesRequest { // Metadata related to the progress of the AddFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [AddFulfillmentPlaces][] method. +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesMetadata {} // Response of the AddFulfillmentPlacesRequest. Currently empty because -// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// there is no meaningful response populated from the +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces] // method. message AddFulfillmentPlacesResponse {} -// Request message for [AddLocalInventories][] method. +// Request message for +// [ProductService.AddLocalInventories][google.cloud.retail.v2beta.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as @@ -707,15 +742,21 @@ message AddLocalInventoriesRequest { // Metadata related to the progress of the AddLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [AddLocalInventories][] method. +// [ProductService.AddLocalInventories][google.cloud.retail.v2beta.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesMetadata {} -// Response of the [AddLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [AddLocalInventories][] +// Response of the +// [ProductService.AddLocalInventories][google.cloud.retail.v2beta.ProductService.AddLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.AddLocalInventories][google.cloud.retail.v2beta.ProductService.AddLocalInventories] // method. message AddLocalInventoriesResponse {} -// Request message for [RemoveLocalInventories][] method. +// Request message for +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2beta.ProductService.RemoveLocalInventories] +// method. message RemoveLocalInventoriesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as @@ -749,15 +790,21 @@ message RemoveLocalInventoriesRequest { // Metadata related to the progress of the RemoveLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [RemoveLocalInventories][] method. +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2beta.ProductService.RemoveLocalInventories] +// method. message RemoveLocalInventoriesMetadata {} -// Response of the [RemoveLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [RemoveLocalInventories][] +// Response of the +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2beta.ProductService.RemoveLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.RemoveLocalInventories][google.cloud.retail.v2beta.ProductService.RemoveLocalInventories] // method. message RemoveLocalInventoriesResponse {} -// Request message for [RemoveFulfillmentPlaces][] method. +// Request message for +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces] +// method. message RemoveFulfillmentPlacesRequest { // Required. Full resource name of // [Product][google.cloud.retail.v2beta.Product], such as @@ -789,7 +836,8 @@ message RemoveFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2beta.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this @@ -820,10 +868,12 @@ message RemoveFulfillmentPlacesRequest { // Metadata related to the progress of the RemoveFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [RemoveFulfillmentPlaces][] method. +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces] +// method. message RemoveFulfillmentPlacesMetadata {} // Response of the RemoveFulfillmentPlacesRequest. Currently empty because there -// is no meaningful response populated from the [RemoveFulfillmentPlaces][] +// is no meaningful response populated from the +// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces] // method. message RemoveFulfillmentPlacesResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto index 5ab09aa348b..25502cd7d16 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/purge_config.proto @@ -37,7 +37,10 @@ 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]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // 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 diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index b8b2156a840..bf0764fd970 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -51,6 +51,10 @@ service SearchService { option (google.api.http) = { post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" body: "*" + additional_bindings { + post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search" + body: "*" + } }; } } @@ -114,8 +118,8 @@ message SearchRequest { // Only get facet for the given restricted values. For example, when using // "pickupInStore" as key and set restricted values to // ["store123", "store456"], only facets for "store123" and "store456" are - // returned. Only supported on textual fields and fulfillments. - // Maximum is 20. + // returned. Only supported on predefined textual fields, custom textual + // attributes and fulfillments. Maximum is 20. // // Must be set for the fulfillment facet keys: // @@ -152,14 +156,22 @@ message SearchRequest { // Only supported on textual fields. Maximum is 10. repeated string contains = 9; - // The order in which [Facet.values][] are returned. + // True to make facet keys case insensitive when getting faceting + // values with prefixes or contains; false otherwise. + bool case_insensitive = 10; + + // The order in which + // [SearchResponse.Facet.values][google.cloud.retail.v2beta.SearchResponse.Facet.values] + // are returned. // // Allowed values are: // - // * "count desc", which means order by [Facet.FacetValue.count][] + // * "count desc", which means order by + // [SearchResponse.Facet.values.count][google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.count] // descending. // - // * "value desc", which means order by [Facet.FacetValue.value][] + // * "value desc", which means order by + // [SearchResponse.Facet.values.value][google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.value] // descending. // Only applies to textual facets. // @@ -181,9 +193,11 @@ message SearchRequest { // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] // when query is specified. // - // In the response, [FacetValue.value][] will be always "1" and - // [FacetValue.count][] will be the number of results that matches the - // query. + // In the response, + // [SearchResponse.Facet.values.value][google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.value] + // will be always "1" and + // [SearchResponse.Facet.values.count][google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.count] + // will be the number of results that match the query. // // For example, you can set a customized facet for "shipToStore", // where @@ -194,6 +208,10 @@ message SearchRequest { // Then the facet will count the products that are both in stock and ship // to store "123". string query = 5; + + // Returns the min and max value for each numerical facet intervals. + // Ignored for textual facets. + bool return_min_max = 11; } // Required. The facet key specification. @@ -208,19 +226,29 @@ message SearchRequest { // List of keys to exclude when faceting. // + // // By default, // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] // is not excluded from the filter unless it is listed in this field. // - // For example, suppose there are 100 products with color facet "Red" and - // 200 products with color facet "Blue". A query containing the filter - // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // Listing a facet key in this field allows its values to appear as facet + // results, even when they are filtered out of search results. Using this + // field does not affect what search results are returned. + // + // For example, suppose there are 100 products with the color facet "Red" + // and 200 products with the color facet "Blue". A query containing the + // filter "colorFamilies:ANY("Red")" and having "colorFamilies" as // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key] - // will by default return the "Red" with count 100. + // would by default return only "Red" products in the search results, and + // also return "Red" with count 100 as the only color facet. Although there + // are also blue products available, "Blue" would not be shown as an + // available facet value. // - // If this field contains "colorFamilies", then the query returns both the - // "Red" with count 100 and "Blue" with count 200, because the - // "colorFamilies" key is now excluded from the filter. + // If "colorFamilies" is listed in "excludedFilterKeys", then the query + // returns the facet values "Red" with count 100 and "Blue" with count + // 200, because the "colorFamilies" key is now excluded from the filter. + // Because this field doesn't affect search results, the search results + // are still correctly filtered to return only "Red" products. // // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error // is returned. @@ -319,7 +347,7 @@ message SearchRequest { // Condition boost specifications. If a product matches multiple conditions // in the specifictions, boost scores from these specifications are all // applied and combined in a non-linear way. Maximum number of - // specifications is 10. + // specifications is 20. repeated ConditionBoostSpec condition_boost_specs = 1; // Whether to skip boostspec validation. If this field is set to true, @@ -363,7 +391,7 @@ message SearchRequest { message PersonalizationSpec { // The personalization mode of each search request. enum Mode { - // Default value. Defaults to + // Default value. In this case, server behavior defaults to // [Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; @@ -379,6 +407,32 @@ message SearchRequest { Mode mode = 1; } + // The specification for query spell correction. + message SpellCorrectionSpec { + // Enum describing under which mode spell correction should occur. + enum Mode { + // Unspecified spell correction mode. In this case, server behavior + // defaults to + // [Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Google Retail Search will try to find a spell suggestion if there + // is any and put in the + // [SearchResponse.corrected_query][google.cloud.retail.v2beta.SearchResponse.corrected_query]. + // The spell suggestion will not be used as the search query. + SUGGESTION_ONLY = 1; + + // Automatic spell correction built by Google Retail Search. Search will + // be based on the corrected query if found. + AUTO = 2; + } + + // The mode under which spell correction should take effect to + // replace the original search query. Default to + // [Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + Mode mode = 1; + } + // The search mode of each search request. enum SearchMode { // Default value. In this case both product search and faceted search will @@ -400,7 +454,9 @@ message SearchRequest { // Only faceted search will be performed. The product search will be // disabled. // - // When in this mode, one or both of [SearchRequest.facet_spec][] and + // When in this mode, one or both of + // [SearchRequest.facet_specs][google.cloud.retail.v2beta.SearchRequest.facet_specs] + // and // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2beta.SearchRequest.dynamic_facet_spec] // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] @@ -408,8 +464,10 @@ message SearchRequest { FACETED_SEARCH_ONLY = 2; } - // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + // Required. The resource name of the Retail Search serving config, such as + // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + // or the name of the legacy placement resource, such as + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -424,6 +482,11 @@ message SearchRequest { ]; // Raw search query. + // + // If this field is empty, the request is considered a category browsing + // request and returned results are based on + // [filter][google.cloud.retail.v2beta.SearchRequest.filter] and + // [page_categories][google.cloud.retail.v2beta.SearchRequest.page_categories]. string query = 3; // Required. A unique identifier for tracking visitors. For example, this @@ -518,10 +581,11 @@ message SearchRequest { // // Notice that if both // [ServingConfig.boost_control_ids][google.cloud.retail.v2beta.ServingConfig.boost_control_ids] - // and [SearchRequest.boost_spec] are set, the boost conditions from both - // places are evaluated. If a search request matches multiple boost - // conditions, the final boost score is equal to the sum of the boost scores - // from all matched boost conditions. + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2beta.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which @@ -556,7 +620,8 @@ message SearchRequest { // * inventory(place_id,price) // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the - // [Product.inventories.attributes][] map. + // [Product.local_inventories.attributes][google.cloud.retail.v2beta.LocalInventory.attributes] + // map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map. // * pickupInStore.id, where id is any @@ -620,6 +685,29 @@ message SearchRequest { // The specification for personalization. PersonalizationSpec personalization_spec = 32; + + // The labels applied to a resource must meet the following requirements: + // + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters and cannot be empty. Values can be empty and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. + // + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. + map labels = 34; + + // The spell correction specification that specifies the mode under + // which spell correction will take effect. + optional SpellCorrectionSpec spell_correction_spec = 35; } // Response message for @@ -716,6 +804,20 @@ message SearchResponse { // Number of items that have this facet value. int64 count = 3; + + // The minimum value in the + // [FacetValue.interval][google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.interval]. + // Only supported on numerical facets and returned if + // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.return_min_max] + // is true. + double min_value = 5; + + // The maximum value in the + // [FacetValue.interval][google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.interval]. + // Only supported on numerical facets and returned if + // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.return_min_max] + // is true. + double max_value = 6; } // The key for this facet. E.g., "colorFamilies" or "price" or @@ -755,7 +857,9 @@ message SearchResponse { // matches. int32 total_size = 3; - // If spell correction applies, the corrected query. Otherwise, empty. + // Contains the spell corrected query, if found. If the spell correction type + // is AUTOMATIC, then the search results are based on corrected_query. + // Otherwise the original query is used for search. string corrected_query = 4; // A unique search token. This should be included in the @@ -773,10 +877,10 @@ message SearchResponse { QueryExpansionInfo query_expansion_info = 7; // The URI of a customer-defined redirect page. If redirect action is - // triggered, no search will be performed, and only + // triggered, no search is performed, and only // [redirect_uri][google.cloud.retail.v2beta.SearchResponse.redirect_uri] and // [attribution_token][google.cloud.retail.v2beta.SearchResponse.attribution_token] - // will be set in the response. + // are set in the response. string redirect_uri = 10; // The fully qualified resource name of applied diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto index 20112e61570..431a4a41149 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto @@ -41,7 +41,7 @@ message ServingConfig { }; // Immutable. Fully qualified name - // projects/*/locations/global/catalogs/*/servingConfig/* + // `projects/*/locations/global/catalogs/*/servingConfig/*` string name = 1 [(google.api.field_behavior) = IMMUTABLE]; // Required. The human readable serving config display name. Used in Retail @@ -114,10 +114,11 @@ message ServingConfig { // // Notice that if both // [ServingConfig.boost_control_ids][google.cloud.retail.v2beta.ServingConfig.boost_control_ids] - // and [SearchRequest.boost_spec] are set, the boost conditions from both - // places are evaluated. If a search request matches multiple boost - // conditions, the final boost score is equal to the sum of the boost scores - // from all matched boost conditions. + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2beta.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. // // Can only be set if // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto index e56c28accc0..e2d5319a463 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto @@ -123,7 +123,7 @@ service ServingConfigService { // Request for CreateServingConfig method. message CreateServingConfigRequest { // Required. Full resource name of parent. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index e21758012ee..06c8e64c231 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -54,11 +54,15 @@ message UserEvent { // 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. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded model + // quality. + // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // The field should not contain PII or user-data. We recommend to use Google - // Analystics [Client + // Analytics [Client // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; @@ -111,12 +115,11 @@ message UserEvent { // The main product details related to the event. // - // This field is required for the following event types: + // This field is optional except for the following event types: // // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` - // * `search` // // 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 browsing the diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto index ab7a0b3514a..c647a45bb24 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto @@ -20,7 +20,6 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; -import "google/api/resource.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/purge_config.proto"; import "google/cloud/retail/v2beta/user_event.proto"; diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index d535c5a5f00..6e14ff51795 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -8415,11 +8415,17 @@ export namespace google { /** FacetKey contains */ contains?: (string[]|null); + /** FacetKey caseInsensitive */ + caseInsensitive?: (boolean|null); + /** FacetKey orderBy */ orderBy?: (string|null); /** FacetKey query */ query?: (string|null); + + /** FacetKey returnMinMax */ + returnMinMax?: (boolean|null); } /** Represents a FacetKey. */ @@ -8446,12 +8452,18 @@ export namespace google { /** FacetKey contains. */ public contains: string[]; + /** FacetKey caseInsensitive. */ + public caseInsensitive: boolean; + /** FacetKey orderBy. */ public orderBy: string; /** FacetKey query. */ public query: string; + /** FacetKey returnMinMax. */ + public returnMinMax: boolean; + /** * Creates a new FacetKey instance using the specified properties. * @param [properties] Properties to set @@ -9511,6 +9523,12 @@ export namespace google { /** FacetValue count */ count?: (number|Long|string|null); + + /** FacetValue minValue */ + minValue?: (number|null); + + /** FacetValue maxValue */ + maxValue?: (number|null); } /** Represents a FacetValue. */ @@ -9531,6 +9549,12 @@ export namespace google { /** FacetValue count. */ public count: (number|Long|string); + /** FacetValue minValue. */ + public minValue: number; + + /** FacetValue maxValue. */ + public maxValue: number; + /** FacetValue facetValue. */ public facetValue?: ("value"|"interval"); @@ -10436,6 +10460,9 @@ export namespace google { /** CatalogAttribute searchableOption */ searchableOption?: (google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|null); + + /** CatalogAttribute recommendationsFilteringOption */ + recommendationsFilteringOption?: (google.cloud.retail.v2alpha.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2alpha.RecommendationsFilteringOption|null); } /** Represents a CatalogAttribute. */ @@ -10465,6 +10492,9 @@ export namespace google { /** CatalogAttribute searchableOption. */ public searchableOption: (google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption); + /** CatalogAttribute recommendationsFilteringOption. */ + public recommendationsFilteringOption: (google.cloud.retail.v2alpha.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2alpha.RecommendationsFilteringOption); + /** * Creates a new CatalogAttribute instance using the specified properties. * @param [properties] Properties to set @@ -11145,6 +11175,13 @@ export namespace google { SOLUTION_TYPE_SEARCH = 2 } + /** RecommendationsFilteringOption enum. */ + enum RecommendationsFilteringOption { + RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0, + RECOMMENDATIONS_FILTERING_DISABLED = 1, + RECOMMENDATIONS_FILTERING_ENABLED = 3 + } + /** SearchSolutionUseCase enum. */ enum SearchSolutionUseCase { SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0, @@ -14025,6 +14062,9 @@ export namespace google { /** ImportProductsRequest notificationPubsubTopic */ notificationPubsubTopic?: (string|null); + + /** ImportProductsRequest skipDefaultBranchProtection */ + skipDefaultBranchProtection?: (boolean|null); } /** Represents an ImportProductsRequest. */ @@ -14057,6 +14097,9 @@ export namespace google { /** ImportProductsRequest notificationPubsubTopic. */ public notificationPubsubTopic: string; + /** ImportProductsRequest skipDefaultBranchProtection. */ + public skipDefaultBranchProtection: boolean; + /** * Creates a new ImportProductsRequest instance using the specified properties. * @param [properties] Properties to set @@ -18294,6 +18337,12 @@ export namespace google { /** SearchRequest personalizationSpec */ personalizationSpec?: (google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null); + + /** SearchRequest labels */ + labels?: ({ [k: string]: string }|null); + + /** SearchRequest spellCorrectionSpec */ + spellCorrectionSpec?: (google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec|null); } /** Represents a SearchRequest. */ @@ -18365,6 +18414,15 @@ export namespace google { /** SearchRequest personalizationSpec. */ public personalizationSpec?: (google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null); + /** SearchRequest labels. */ + public labels: { [k: string]: string }; + + /** SearchRequest spellCorrectionSpec. */ + public spellCorrectionSpec?: (google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec|null); + + /** SearchRequest _spellCorrectionSpec. */ + public _spellCorrectionSpec?: "spellCorrectionSpec"; + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -18566,11 +18624,17 @@ export namespace google { /** FacetKey contains */ contains?: (string[]|null); + /** FacetKey caseInsensitive */ + caseInsensitive?: (boolean|null); + /** FacetKey orderBy */ orderBy?: (string|null); /** FacetKey query */ query?: (string|null); + + /** FacetKey returnMinMax */ + returnMinMax?: (boolean|null); } /** Represents a FacetKey. */ @@ -18597,12 +18661,18 @@ export namespace google { /** FacetKey contains. */ public contains: string[]; + /** FacetKey caseInsensitive. */ + public caseInsensitive: boolean; + /** FacetKey orderBy. */ public orderBy: string; /** FacetKey query. */ public query: string; + /** FacetKey returnMinMax. */ + public returnMinMax: boolean; + /** * Creates a new FacetKey instance using the specified properties. * @param [properties] Properties to set @@ -19179,6 +19249,106 @@ export namespace google { } } + /** Properties of a SpellCorrectionSpec. */ + interface ISpellCorrectionSpec { + + /** SpellCorrectionSpec mode */ + mode?: (google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode|null); + } + + /** Represents a SpellCorrectionSpec. */ + class SpellCorrectionSpec implements ISpellCorrectionSpec { + + /** + * Constructs a new SpellCorrectionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec); + + /** SpellCorrectionSpec mode. */ + public mode: (google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode); + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SpellCorrectionSpec instance + */ + public static create(properties?: google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec): google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec; + + /** + * Verifies a SpellCorrectionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpellCorrectionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @param message SpellCorrectionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SpellCorrectionSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + SUGGESTION_ONLY = 1, + AUTO = 2 + } + } + /** RelevanceThreshold enum. */ enum RelevanceThreshold { RELEVANCE_THRESHOLD_UNSPECIFIED = 0, @@ -19571,6 +19741,12 @@ export namespace google { /** FacetValue count */ count?: (number|Long|string|null); + + /** FacetValue minValue */ + minValue?: (number|null); + + /** FacetValue maxValue */ + maxValue?: (number|null); } /** Represents a FacetValue. */ @@ -19591,6 +19767,12 @@ export namespace google { /** FacetValue count. */ public count: (number|Long|string); + /** FacetValue minValue. */ + public minValue: number; + + /** FacetValue maxValue. */ + public maxValue: number; + /** FacetValue facetValue. */ public facetValue?: ("value"|"interval"); @@ -20671,6 +20853,9 @@ export namespace google { /** ExportProductsResponse errorsConfig */ errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + + /** ExportProductsResponse outputResult */ + outputResult?: (google.cloud.retail.v2alpha.IOutputResult|null); } /** Represents an ExportProductsResponse. */ @@ -20688,6 +20873,9 @@ export namespace google { /** ExportProductsResponse errorsConfig. */ public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** ExportProductsResponse outputResult. */ + public outputResult?: (google.cloud.retail.v2alpha.IOutputResult|null); + /** * Creates a new ExportProductsResponse instance using the specified properties. * @param [properties] Properties to set @@ -20767,6 +20955,9 @@ export namespace google { /** ExportUserEventsResponse errorsConfig */ errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + + /** ExportUserEventsResponse outputResult */ + outputResult?: (google.cloud.retail.v2alpha.IOutputResult|null); } /** Represents an ExportUserEventsResponse. */ @@ -20784,6 +20975,9 @@ export namespace google { /** ExportUserEventsResponse errorsConfig. */ public errorsConfig?: (google.cloud.retail.v2alpha.IExportErrorsConfig|null); + /** ExportUserEventsResponse outputResult. */ + public outputResult?: (google.cloud.retail.v2alpha.IOutputResult|null); + /** * Creates a new ExportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set @@ -20797,59 +20991,2045 @@ export namespace google { * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @param message ExportUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Verifies an ExportUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; + + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @param message ExportUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OutputResult. */ + interface IOutputResult { + + /** OutputResult bigqueryResult */ + bigqueryResult?: (google.cloud.retail.v2alpha.IBigQueryOutputResult[]|null); + } + + /** Represents an OutputResult. */ + class OutputResult implements IOutputResult { + + /** + * Constructs a new OutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IOutputResult); + + /** OutputResult bigqueryResult. */ + public bigqueryResult: google.cloud.retail.v2alpha.IBigQueryOutputResult[]; + + /** + * Creates a new OutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IOutputResult): google.cloud.retail.v2alpha.OutputResult; + + /** + * Encodes the specified OutputResult message. Does not implicitly {@link google.cloud.retail.v2alpha.OutputResult.verify|verify} messages. + * @param message OutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.OutputResult.verify|verify} messages. + * @param message OutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.OutputResult; + + /** + * Decodes an OutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.OutputResult; + + /** + * Verifies an OutputResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.OutputResult; + + /** + * Creates a plain object from an OutputResult message. Also converts values to other types if specified. + * @param message OutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.OutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQueryOutputResult. */ + interface IBigQueryOutputResult { + + /** BigQueryOutputResult datasetId */ + datasetId?: (string|null); + + /** BigQueryOutputResult tableId */ + tableId?: (string|null); + } + + /** Represents a BigQueryOutputResult. */ + class BigQueryOutputResult implements IBigQueryOutputResult { + + /** + * Constructs a new BigQueryOutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IBigQueryOutputResult); + + /** BigQueryOutputResult datasetId. */ + public datasetId: string; + + /** BigQueryOutputResult tableId. */ + public tableId: string; + + /** + * Creates a new BigQueryOutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQueryOutputResult instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IBigQueryOutputResult): google.cloud.retail.v2alpha.BigQueryOutputResult; + + /** + * Encodes the specified BigQueryOutputResult message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQueryOutputResult.verify|verify} messages. + * @param message BigQueryOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IBigQueryOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQueryOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQueryOutputResult.verify|verify} messages. + * @param message BigQueryOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IBigQueryOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.BigQueryOutputResult; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.BigQueryOutputResult; + + /** + * Verifies a BigQueryOutputResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQueryOutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQueryOutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.BigQueryOutputResult; + + /** + * Creates a plain object from a BigQueryOutputResult message. Also converts values to other types if specified. + * @param message BigQueryOutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.BigQueryOutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQueryOutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Model. */ + interface IModel { + + /** Model pageOptimizationConfig */ + pageOptimizationConfig?: (google.cloud.retail.v2alpha.Model.IPageOptimizationConfig|null); + + /** Model name */ + name?: (string|null); + + /** Model displayName */ + displayName?: (string|null); + + /** Model trainingState */ + trainingState?: (google.cloud.retail.v2alpha.Model.TrainingState|keyof typeof google.cloud.retail.v2alpha.Model.TrainingState|null); + + /** Model servingState */ + servingState?: (google.cloud.retail.v2alpha.Model.ServingState|keyof typeof google.cloud.retail.v2alpha.Model.ServingState|null); + + /** Model createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Model updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Model type */ + type?: (string|null); + + /** Model optimizationObjective */ + optimizationObjective?: (string|null); + + /** Model periodicTuningState */ + periodicTuningState?: (google.cloud.retail.v2alpha.Model.PeriodicTuningState|keyof typeof google.cloud.retail.v2alpha.Model.PeriodicTuningState|null); + + /** Model lastTuneTime */ + lastTuneTime?: (google.protobuf.ITimestamp|null); + + /** Model tuningOperation */ + tuningOperation?: (string|null); + + /** Model dataState */ + dataState?: (google.cloud.retail.v2alpha.Model.DataState|keyof typeof google.cloud.retail.v2alpha.Model.DataState|null); + + /** Model filteringOption */ + filteringOption?: (google.cloud.retail.v2alpha.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2alpha.RecommendationsFilteringOption|null); + + /** Model servingConfigLists */ + servingConfigLists?: (google.cloud.retail.v2alpha.Model.IServingConfigList[]|null); + } + + /** Represents a Model. */ + class Model implements IModel { + + /** + * Constructs a new Model. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IModel); + + /** Model pageOptimizationConfig. */ + public pageOptimizationConfig?: (google.cloud.retail.v2alpha.Model.IPageOptimizationConfig|null); + + /** Model name. */ + public name: string; + + /** Model displayName. */ + public displayName: string; + + /** Model trainingState. */ + public trainingState: (google.cloud.retail.v2alpha.Model.TrainingState|keyof typeof google.cloud.retail.v2alpha.Model.TrainingState); + + /** Model servingState. */ + public servingState: (google.cloud.retail.v2alpha.Model.ServingState|keyof typeof google.cloud.retail.v2alpha.Model.ServingState); + + /** Model createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Model updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Model type. */ + public type: string; + + /** Model optimizationObjective. */ + public optimizationObjective: string; + + /** Model periodicTuningState. */ + public periodicTuningState: (google.cloud.retail.v2alpha.Model.PeriodicTuningState|keyof typeof google.cloud.retail.v2alpha.Model.PeriodicTuningState); + + /** Model lastTuneTime. */ + public lastTuneTime?: (google.protobuf.ITimestamp|null); + + /** Model tuningOperation. */ + public tuningOperation: string; + + /** Model dataState. */ + public dataState: (google.cloud.retail.v2alpha.Model.DataState|keyof typeof google.cloud.retail.v2alpha.Model.DataState); + + /** Model filteringOption. */ + public filteringOption: (google.cloud.retail.v2alpha.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2alpha.RecommendationsFilteringOption); + + /** Model servingConfigLists. */ + public servingConfigLists: google.cloud.retail.v2alpha.Model.IServingConfigList[]; + + /** Model trainingConfig. */ + public trainingConfig?: "pageOptimizationConfig"; + + /** + * Creates a new Model instance using the specified properties. + * @param [properties] Properties to set + * @returns Model instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IModel): google.cloud.retail.v2alpha.Model; + + /** + * Encodes the specified Model message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.verify|verify} messages. + * @param message Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IModel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Model message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.verify|verify} messages. + * @param message Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IModel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Model message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Model; + + /** + * Decodes a Model message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Model; + + /** + * Verifies a Model message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Model message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Model + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Model; + + /** + * Creates a plain object from a Model message. Also converts values to other types if specified. + * @param message Model + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Model, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Model to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Model { + + /** Properties of a PageOptimizationConfig. */ + interface IPageOptimizationConfig { + + /** PageOptimizationConfig pageOptimizationEventType */ + pageOptimizationEventType?: (string|null); + + /** PageOptimizationConfig panels */ + panels?: (google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel[]|null); + + /** PageOptimizationConfig restriction */ + restriction?: (google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction|keyof typeof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction|null); + } + + /** Represents a PageOptimizationConfig. */ + class PageOptimizationConfig implements IPageOptimizationConfig { + + /** + * Constructs a new PageOptimizationConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Model.IPageOptimizationConfig); + + /** PageOptimizationConfig pageOptimizationEventType. */ + public pageOptimizationEventType: string; + + /** PageOptimizationConfig panels. */ + public panels: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel[]; + + /** PageOptimizationConfig restriction. */ + public restriction: (google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction|keyof typeof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction); + + /** + * Creates a new PageOptimizationConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PageOptimizationConfig instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Model.IPageOptimizationConfig): google.cloud.retail.v2alpha.Model.PageOptimizationConfig; + + /** + * Encodes the specified PageOptimizationConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.verify|verify} messages. + * @param message PageOptimizationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Model.IPageOptimizationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageOptimizationConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.verify|verify} messages. + * @param message PageOptimizationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Model.IPageOptimizationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageOptimizationConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageOptimizationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Model.PageOptimizationConfig; + + /** + * Decodes a PageOptimizationConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageOptimizationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Model.PageOptimizationConfig; + + /** + * Verifies a PageOptimizationConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PageOptimizationConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageOptimizationConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Model.PageOptimizationConfig; + + /** + * Creates a plain object from a PageOptimizationConfig message. Also converts values to other types if specified. + * @param message PageOptimizationConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageOptimizationConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageOptimizationConfig { + + /** Properties of a Candidate. */ + interface ICandidate { + + /** Candidate servingConfigId */ + servingConfigId?: (string|null); + } + + /** Represents a Candidate. */ + class Candidate implements ICandidate { + + /** + * Constructs a new Candidate. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate); + + /** Candidate servingConfigId. */ + public servingConfigId?: (string|null); + + /** Candidate candidate. */ + public candidate?: "servingConfigId"; + + /** + * Creates a new Candidate instance using the specified properties. + * @param [properties] Properties to set + * @returns Candidate instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate; + + /** + * Encodes the specified Candidate message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.verify|verify} messages. + * @param message Candidate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Candidate message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.verify|verify} messages. + * @param message Candidate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Candidate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Candidate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate; + + /** + * Decodes a Candidate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Candidate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate; + + /** + * Verifies a Candidate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Candidate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Candidate + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate; + + /** + * Creates a plain object from a Candidate message. Also converts values to other types if specified. + * @param message Candidate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Candidate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Panel. */ + interface IPanel { + + /** Panel displayName */ + displayName?: (string|null); + + /** Panel candidates */ + candidates?: (google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate[]|null); + + /** Panel defaultCandidate */ + defaultCandidate?: (google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate|null); + } + + /** Represents a Panel. */ + class Panel implements IPanel { + + /** + * Constructs a new Panel. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel); + + /** Panel displayName. */ + public displayName: string; + + /** Panel candidates. */ + public candidates: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate[]; + + /** Panel defaultCandidate. */ + public defaultCandidate?: (google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate|null); + + /** + * Creates a new Panel instance using the specified properties. + * @param [properties] Properties to set + * @returns Panel instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel; + + /** + * Encodes the specified Panel message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.verify|verify} messages. + * @param message Panel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Panel message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.verify|verify} messages. + * @param message Panel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Panel message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Panel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel; + + /** + * Decodes a Panel message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Panel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel; + + /** + * Verifies a Panel message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Panel message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Panel + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel; + + /** + * Creates a plain object from a Panel message. Also converts values to other types if specified. + * @param message Panel + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Panel to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Restriction enum. */ + enum Restriction { + RESTRICTION_UNSPECIFIED = 0, + NO_RESTRICTION = 1, + UNIQUE_SERVING_CONFIG_RESTRICTION = 2, + UNIQUE_MODEL_RESTRICTION = 3, + UNIQUE_MODEL_TYPE_RESTRICTION = 4 + } + } + + /** Properties of a ServingConfigList. */ + interface IServingConfigList { + + /** ServingConfigList servingConfigIds */ + servingConfigIds?: (string[]|null); + } + + /** Represents a ServingConfigList. */ + class ServingConfigList implements IServingConfigList { + + /** + * Constructs a new ServingConfigList. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.Model.IServingConfigList); + + /** ServingConfigList servingConfigIds. */ + public servingConfigIds: string[]; + + /** + * Creates a new ServingConfigList instance using the specified properties. + * @param [properties] Properties to set + * @returns ServingConfigList instance + */ + public static create(properties?: google.cloud.retail.v2alpha.Model.IServingConfigList): google.cloud.retail.v2alpha.Model.ServingConfigList; + + /** + * Encodes the specified ServingConfigList message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.ServingConfigList.verify|verify} messages. + * @param message ServingConfigList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.Model.IServingConfigList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServingConfigList message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.ServingConfigList.verify|verify} messages. + * @param message ServingConfigList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.Model.IServingConfigList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.Model.ServingConfigList; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.Model.ServingConfigList; + + /** + * Verifies a ServingConfigList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServingConfigList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServingConfigList + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.Model.ServingConfigList; + + /** + * Creates a plain object from a ServingConfigList message. Also converts values to other types if specified. + * @param message ServingConfigList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.Model.ServingConfigList, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServingConfigList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** ServingState enum. */ + enum ServingState { + SERVING_STATE_UNSPECIFIED = 0, + INACTIVE = 1, + ACTIVE = 2, + TUNED = 3 + } + + /** TrainingState enum. */ + enum TrainingState { + TRAINING_STATE_UNSPECIFIED = 0, + PAUSED = 1, + TRAINING = 2 + } + + /** PeriodicTuningState enum. */ + enum PeriodicTuningState { + PERIODIC_TUNING_STATE_UNSPECIFIED = 0, + PERIODIC_TUNING_DISABLED = 1, + ALL_TUNING_DISABLED = 3, + PERIODIC_TUNING_ENABLED = 2 + } + + /** DataState enum. */ + enum DataState { + DATA_STATE_UNSPECIFIED = 0, + DATA_OK = 1, + DATA_ERROR = 2 + } + } + + /** Represents a ModelService */ + class ModelService extends $protobuf.rpc.Service { + + /** + * Constructs a new ModelService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ModelService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ModelService; + + /** + * Calls CreateModel. + * @param request CreateModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createModel(request: google.cloud.retail.v2alpha.ICreateModelRequest, callback: google.cloud.retail.v2alpha.ModelService.CreateModelCallback): void; + + /** + * Calls CreateModel. + * @param request CreateModelRequest message or plain object + * @returns Promise + */ + public createModel(request: google.cloud.retail.v2alpha.ICreateModelRequest): Promise; + + /** + * Calls PauseModel. + * @param request PauseModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Model + */ + public pauseModel(request: google.cloud.retail.v2alpha.IPauseModelRequest, callback: google.cloud.retail.v2alpha.ModelService.PauseModelCallback): void; + + /** + * Calls PauseModel. + * @param request PauseModelRequest message or plain object + * @returns Promise + */ + public pauseModel(request: google.cloud.retail.v2alpha.IPauseModelRequest): Promise; + + /** + * Calls ResumeModel. + * @param request ResumeModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Model + */ + public resumeModel(request: google.cloud.retail.v2alpha.IResumeModelRequest, callback: google.cloud.retail.v2alpha.ModelService.ResumeModelCallback): void; + + /** + * Calls ResumeModel. + * @param request ResumeModelRequest message or plain object + * @returns Promise + */ + public resumeModel(request: google.cloud.retail.v2alpha.IResumeModelRequest): Promise; + + /** + * Calls DeleteModel. + * @param request DeleteModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteModel(request: google.cloud.retail.v2alpha.IDeleteModelRequest, callback: google.cloud.retail.v2alpha.ModelService.DeleteModelCallback): void; + + /** + * Calls DeleteModel. + * @param request DeleteModelRequest message or plain object + * @returns Promise + */ + public deleteModel(request: google.cloud.retail.v2alpha.IDeleteModelRequest): Promise; + + /** + * Calls ListModels. + * @param request ListModelsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListModelsResponse + */ + public listModels(request: google.cloud.retail.v2alpha.IListModelsRequest, callback: google.cloud.retail.v2alpha.ModelService.ListModelsCallback): void; + + /** + * Calls ListModels. + * @param request ListModelsRequest message or plain object + * @returns Promise + */ + public listModels(request: google.cloud.retail.v2alpha.IListModelsRequest): Promise; + + /** + * Calls UpdateModel. + * @param request UpdateModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Model + */ + public updateModel(request: google.cloud.retail.v2alpha.IUpdateModelRequest, callback: google.cloud.retail.v2alpha.ModelService.UpdateModelCallback): void; + + /** + * Calls UpdateModel. + * @param request UpdateModelRequest message or plain object + * @returns Promise + */ + public updateModel(request: google.cloud.retail.v2alpha.IUpdateModelRequest): Promise; + + /** + * Calls TuneModel. + * @param request TuneModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public tuneModel(request: google.cloud.retail.v2alpha.ITuneModelRequest, callback: google.cloud.retail.v2alpha.ModelService.TuneModelCallback): void; + + /** + * Calls TuneModel. + * @param request TuneModelRequest message or plain object + * @returns Promise + */ + public tuneModel(request: google.cloud.retail.v2alpha.ITuneModelRequest): Promise; + } + + namespace ModelService { + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#createModel}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#pauseModel}. + * @param error Error, if any + * @param [response] Model + */ + type PauseModelCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Model) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#resumeModel}. + * @param error Error, if any + * @param [response] Model + */ + type ResumeModelCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Model) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#deleteModel}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteModelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#listModels}. + * @param error Error, if any + * @param [response] ListModelsResponse + */ + type ListModelsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListModelsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#updateModel}. + * @param error Error, if any + * @param [response] Model + */ + type UpdateModelCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Model) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#tuneModel}. + * @param error Error, if any + * @param [response] Operation + */ + type TuneModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateModelRequest. */ + interface ICreateModelRequest { + + /** CreateModelRequest parent */ + parent?: (string|null); + + /** CreateModelRequest model */ + model?: (google.cloud.retail.v2alpha.IModel|null); + + /** CreateModelRequest dryRun */ + dryRun?: (boolean|null); + } + + /** Represents a CreateModelRequest. */ + class CreateModelRequest implements ICreateModelRequest { + + /** + * Constructs a new CreateModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateModelRequest); + + /** CreateModelRequest parent. */ + public parent: string; + + /** CreateModelRequest model. */ + public model?: (google.cloud.retail.v2alpha.IModel|null); + + /** CreateModelRequest dryRun. */ + public dryRun: boolean; + + /** + * Creates a new CreateModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateModelRequest): google.cloud.retail.v2alpha.CreateModelRequest; + + /** + * Encodes the specified CreateModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelRequest.verify|verify} messages. + * @param message CreateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelRequest.verify|verify} messages. + * @param message CreateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateModelRequest; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateModelRequest; + + /** + * Verifies a CreateModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateModelRequest; + + /** + * Creates a plain object from a CreateModelRequest message. Also converts values to other types if specified. + * @param message CreateModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateModelRequest. */ + interface IUpdateModelRequest { + + /** UpdateModelRequest model */ + model?: (google.cloud.retail.v2alpha.IModel|null); + + /** UpdateModelRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateModelRequest. */ + class UpdateModelRequest implements IUpdateModelRequest { + + /** + * Constructs a new UpdateModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IUpdateModelRequest); + + /** UpdateModelRequest model. */ + public model?: (google.cloud.retail.v2alpha.IModel|null); + + /** UpdateModelRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IUpdateModelRequest): google.cloud.retail.v2alpha.UpdateModelRequest; + + /** + * Encodes the specified UpdateModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateModelRequest.verify|verify} messages. + * @param message UpdateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IUpdateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateModelRequest.verify|verify} messages. + * @param message UpdateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IUpdateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.UpdateModelRequest; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.UpdateModelRequest; + + /** + * Verifies an UpdateModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.UpdateModelRequest; + + /** + * Creates a plain object from an UpdateModelRequest message. Also converts values to other types if specified. + * @param message UpdateModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.UpdateModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PauseModelRequest. */ + interface IPauseModelRequest { + + /** PauseModelRequest name */ + name?: (string|null); + } + + /** Represents a PauseModelRequest. */ + class PauseModelRequest implements IPauseModelRequest { + + /** + * Constructs a new PauseModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IPauseModelRequest); + + /** PauseModelRequest name. */ + public name: string; + + /** + * Creates a new PauseModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PauseModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IPauseModelRequest): google.cloud.retail.v2alpha.PauseModelRequest; + + /** + * Encodes the specified PauseModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PauseModelRequest.verify|verify} messages. + * @param message PauseModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IPauseModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PauseModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PauseModelRequest.verify|verify} messages. + * @param message PauseModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IPauseModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.PauseModelRequest; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.PauseModelRequest; + + /** + * Verifies a PauseModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PauseModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PauseModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.PauseModelRequest; + + /** + * Creates a plain object from a PauseModelRequest message. Also converts values to other types if specified. + * @param message PauseModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.PauseModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PauseModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ResumeModelRequest. */ + interface IResumeModelRequest { + + /** ResumeModelRequest name */ + name?: (string|null); + } + + /** Represents a ResumeModelRequest. */ + class ResumeModelRequest implements IResumeModelRequest { + + /** + * Constructs a new ResumeModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IResumeModelRequest); + + /** ResumeModelRequest name. */ + public name: string; + + /** + * Creates a new ResumeModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ResumeModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IResumeModelRequest): google.cloud.retail.v2alpha.ResumeModelRequest; + + /** + * Encodes the specified ResumeModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ResumeModelRequest.verify|verify} messages. + * @param message ResumeModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IResumeModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResumeModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ResumeModelRequest.verify|verify} messages. + * @param message ResumeModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IResumeModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ResumeModelRequest; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ResumeModelRequest; + + /** + * Verifies a ResumeModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResumeModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResumeModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ResumeModelRequest; + + /** + * Creates a plain object from a ResumeModelRequest message. Also converts values to other types if specified. + * @param message ResumeModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ResumeModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResumeModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListModelsRequest. */ + interface IListModelsRequest { + + /** ListModelsRequest parent */ + parent?: (string|null); + + /** ListModelsRequest pageSize */ + pageSize?: (number|null); + + /** ListModelsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListModelsRequest. */ + class ListModelsRequest implements IListModelsRequest { + + /** + * Constructs a new ListModelsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListModelsRequest); + + /** ListModelsRequest parent. */ + public parent: string; + + /** ListModelsRequest pageSize. */ + public pageSize: number; + + /** ListModelsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListModelsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListModelsRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListModelsRequest): google.cloud.retail.v2alpha.ListModelsRequest; + + /** + * Encodes the specified ListModelsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsRequest.verify|verify} messages. + * @param message ListModelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListModelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListModelsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsRequest.verify|verify} messages. + * @param message ListModelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListModelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListModelsRequest; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListModelsRequest; + + /** + * Verifies a ListModelsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListModelsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListModelsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListModelsRequest; + + /** + * Creates a plain object from a ListModelsRequest message. Also converts values to other types if specified. + * @param message ListModelsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListModelsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListModelsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteModelRequest. */ + interface IDeleteModelRequest { + + /** DeleteModelRequest name */ + name?: (string|null); + } + + /** Represents a DeleteModelRequest. */ + class DeleteModelRequest implements IDeleteModelRequest { + + /** + * Constructs a new DeleteModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IDeleteModelRequest); + + /** DeleteModelRequest name. */ + public name: string; + + /** + * Creates a new DeleteModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IDeleteModelRequest): google.cloud.retail.v2alpha.DeleteModelRequest; + + /** + * Encodes the specified DeleteModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteModelRequest.verify|verify} messages. + * @param message DeleteModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IDeleteModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteModelRequest.verify|verify} messages. + * @param message DeleteModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IDeleteModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.DeleteModelRequest; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.DeleteModelRequest; + + /** + * Verifies a DeleteModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.DeleteModelRequest; + + /** + * Creates a plain object from a DeleteModelRequest message. Also converts values to other types if specified. + * @param message DeleteModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.DeleteModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListModelsResponse. */ + interface IListModelsResponse { + + /** ListModelsResponse models */ + models?: (google.cloud.retail.v2alpha.IModel[]|null); + + /** ListModelsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListModelsResponse. */ + class ListModelsResponse implements IListModelsResponse { + + /** + * Constructs a new ListModelsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.IListModelsResponse); + + /** ListModelsResponse models. */ + public models: google.cloud.retail.v2alpha.IModel[]; + + /** ListModelsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListModelsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListModelsResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.IListModelsResponse): google.cloud.retail.v2alpha.ListModelsResponse; + + /** + * Encodes the specified ListModelsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsResponse.verify|verify} messages. + * @param message ListModelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.IListModelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListModelsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsResponse.verify|verify} messages. + * @param message ListModelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.IListModelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ListModelsResponse; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ListModelsResponse; + + /** + * Verifies a ListModelsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListModelsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListModelsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ListModelsResponse; + + /** + * Creates a plain object from a ListModelsResponse message. Also converts values to other types if specified. + * @param message ListModelsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.ListModelsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListModelsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TuneModelRequest. */ + interface ITuneModelRequest { + + /** TuneModelRequest name */ + name?: (string|null); + } + + /** Represents a TuneModelRequest. */ + class TuneModelRequest implements ITuneModelRequest { + + /** + * Constructs a new TuneModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ITuneModelRequest); + + /** TuneModelRequest name. */ + public name: string; + + /** + * Creates a new TuneModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TuneModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ITuneModelRequest): google.cloud.retail.v2alpha.TuneModelRequest; + + /** + * Encodes the specified TuneModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelRequest.verify|verify} messages. + * @param message TuneModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ITuneModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TuneModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelRequest.verify|verify} messages. + * @param message TuneModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ITuneModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TuneModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TuneModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.TuneModelRequest; + + /** + * Decodes a TuneModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TuneModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.TuneModelRequest; + + /** + * Verifies a TuneModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TuneModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TuneModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.TuneModelRequest; + + /** + * Creates a plain object from a TuneModelRequest message. Also converts values to other types if specified. + * @param message TuneModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.TuneModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TuneModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateModelMetadata. */ + interface ICreateModelMetadata { + + /** CreateModelMetadata model */ + model?: (string|null); + } + + /** Represents a CreateModelMetadata. */ + class CreateModelMetadata implements ICreateModelMetadata { + + /** + * Constructs a new CreateModelMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ICreateModelMetadata); + + /** CreateModelMetadata model. */ + public model: string; + + /** + * Creates a new CreateModelMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateModelMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ICreateModelMetadata): google.cloud.retail.v2alpha.CreateModelMetadata; + + /** + * Encodes the specified CreateModelMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelMetadata.verify|verify} messages. + * @param message CreateModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ICreateModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelMetadata.verify|verify} messages. + * @param message CreateModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ICreateModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateModelMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.CreateModelMetadata; + + /** + * Decodes a CreateModelMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.CreateModelMetadata; + + /** + * Verifies a CreateModelMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateModelMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateModelMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.CreateModelMetadata; + + /** + * Creates a plain object from a CreateModelMetadata message. Also converts values to other types if specified. + * @param message CreateModelMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.CreateModelMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateModelMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TuneModelMetadata. */ + interface ITuneModelMetadata { + + /** TuneModelMetadata model */ + model?: (string|null); + } + + /** Represents a TuneModelMetadata. */ + class TuneModelMetadata implements ITuneModelMetadata { + + /** + * Constructs a new TuneModelMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ITuneModelMetadata); + + /** TuneModelMetadata model. */ + public model: string; + + /** + * Creates a new TuneModelMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns TuneModelMetadata instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ITuneModelMetadata): google.cloud.retail.v2alpha.TuneModelMetadata; + + /** + * Encodes the specified TuneModelMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelMetadata.verify|verify} messages. + * @param message TuneModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ITuneModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TuneModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelMetadata.verify|verify} messages. + * @param message TuneModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2alpha.ITuneModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TuneModelMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TuneModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.TuneModelMetadata; + + /** + * Decodes a TuneModelMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TuneModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.TuneModelMetadata; + + /** + * Verifies a TuneModelMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TuneModelMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TuneModelMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.TuneModelMetadata; + + /** + * Creates a plain object from a TuneModelMetadata message. Also converts values to other types if specified. + * @param message TuneModelMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2alpha.TuneModelMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TuneModelMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TuneModelResponse. */ + interface ITuneModelResponse { + } + + /** Represents a TuneModelResponse. */ + class TuneModelResponse implements ITuneModelResponse { + + /** + * Constructs a new TuneModelResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2alpha.ITuneModelResponse); + + /** + * Creates a new TuneModelResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TuneModelResponse instance + */ + public static create(properties?: google.cloud.retail.v2alpha.ITuneModelResponse): google.cloud.retail.v2alpha.TuneModelResponse; + + /** + * Encodes the specified TuneModelResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelResponse.verify|verify} messages. + * @param message TuneModelResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2alpha.ITuneModelResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. - * @param message ExportUserEventsResponse message or plain object to encode + * Encodes the specified TuneModelResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelResponse.verify|verify} messages. + * @param message TuneModelResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2alpha.IExportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2alpha.ITuneModelResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a TuneModelResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ExportUserEventsResponse + * @returns TuneModelResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2alpha.TuneModelResponse; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a TuneModelResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ExportUserEventsResponse + * @returns TuneModelResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2alpha.TuneModelResponse; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a TuneModelResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a TuneModelResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ExportUserEventsResponse + * @returns TuneModelResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.ExportUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2alpha.TuneModelResponse; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. - * @param message ExportUserEventsResponse + * Creates a plain object from a TuneModelResponse message. Also converts values to other types if specified. + * @param message TuneModelResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2alpha.ExportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2alpha.TuneModelResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this TuneModelResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -25959,6 +28139,9 @@ export namespace google { /** CatalogAttribute searchableOption */ searchableOption?: (google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|null); + + /** CatalogAttribute recommendationsFilteringOption */ + recommendationsFilteringOption?: (google.cloud.retail.v2beta.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2beta.RecommendationsFilteringOption|null); } /** Represents a CatalogAttribute. */ @@ -25988,6 +28171,9 @@ export namespace google { /** CatalogAttribute searchableOption. */ public searchableOption: (google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.SearchableOption); + /** CatalogAttribute recommendationsFilteringOption. */ + public recommendationsFilteringOption: (google.cloud.retail.v2beta.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2beta.RecommendationsFilteringOption); + /** * Creates a new CatalogAttribute instance using the specified properties. * @param [properties] Properties to set @@ -26668,6 +28854,13 @@ export namespace google { SOLUTION_TYPE_SEARCH = 2 } + /** RecommendationsFilteringOption enum. */ + enum RecommendationsFilteringOption { + RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0, + RECOMMENDATIONS_FILTERING_DISABLED = 1, + RECOMMENDATIONS_FILTERING_ENABLED = 3 + } + /** SearchSolutionUseCase enum. */ enum SearchSolutionUseCase { SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0, @@ -33808,6 +36001,12 @@ export namespace google { /** SearchRequest personalizationSpec */ personalizationSpec?: (google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null); + + /** SearchRequest labels */ + labels?: ({ [k: string]: string }|null); + + /** SearchRequest spellCorrectionSpec */ + spellCorrectionSpec?: (google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec|null); } /** Represents a SearchRequest. */ @@ -33876,6 +36075,15 @@ export namespace google { /** SearchRequest personalizationSpec. */ public personalizationSpec?: (google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null); + /** SearchRequest labels. */ + public labels: { [k: string]: string }; + + /** SearchRequest spellCorrectionSpec. */ + public spellCorrectionSpec?: (google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec|null); + + /** SearchRequest _spellCorrectionSpec. */ + public _spellCorrectionSpec?: "spellCorrectionSpec"; + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -34077,11 +36285,17 @@ export namespace google { /** FacetKey contains */ contains?: (string[]|null); + /** FacetKey caseInsensitive */ + caseInsensitive?: (boolean|null); + /** FacetKey orderBy */ orderBy?: (string|null); /** FacetKey query */ query?: (string|null); + + /** FacetKey returnMinMax */ + returnMinMax?: (boolean|null); } /** Represents a FacetKey. */ @@ -34108,12 +36322,18 @@ export namespace google { /** FacetKey contains. */ public contains: string[]; + /** FacetKey caseInsensitive. */ + public caseInsensitive: boolean; + /** FacetKey orderBy. */ public orderBy: string; /** FacetKey query. */ public query: string; + /** FacetKey returnMinMax. */ + public returnMinMax: boolean; + /** * Creates a new FacetKey instance using the specified properties. * @param [properties] Properties to set @@ -34690,6 +36910,106 @@ export namespace google { } } + /** Properties of a SpellCorrectionSpec. */ + interface ISpellCorrectionSpec { + + /** SpellCorrectionSpec mode */ + mode?: (google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode|null); + } + + /** Represents a SpellCorrectionSpec. */ + class SpellCorrectionSpec implements ISpellCorrectionSpec { + + /** + * Constructs a new SpellCorrectionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec); + + /** SpellCorrectionSpec mode. */ + public mode: (google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode); + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SpellCorrectionSpec instance + */ + public static create(properties?: google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec): google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec; + + /** + * Verifies a SpellCorrectionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpellCorrectionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @param message SpellCorrectionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SpellCorrectionSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + SUGGESTION_ONLY = 1, + AUTO = 2 + } + } + /** SearchMode enum. */ enum SearchMode { SEARCH_MODE_UNSPECIFIED = 0, @@ -35073,6 +37393,12 @@ export namespace google { /** FacetValue count */ count?: (number|Long|string|null); + + /** FacetValue minValue */ + minValue?: (number|null); + + /** FacetValue maxValue */ + maxValue?: (number|null); } /** Represents a FacetValue. */ @@ -35093,6 +37419,12 @@ export namespace google { /** FacetValue count. */ public count: (number|Long|string); + /** FacetValue minValue. */ + public minValue: number; + + /** FacetValue maxValue. */ + public maxValue: number; + /** FacetValue facetValue. */ public facetValue?: ("value"|"interval"); @@ -36173,6 +38505,9 @@ export namespace google { /** ExportProductsResponse errorsConfig */ errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + + /** ExportProductsResponse outputResult */ + outputResult?: (google.cloud.retail.v2beta.IOutputResult|null); } /** Represents an ExportProductsResponse. */ @@ -36190,6 +38525,9 @@ export namespace google { /** ExportProductsResponse errorsConfig. */ public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + /** ExportProductsResponse outputResult. */ + public outputResult?: (google.cloud.retail.v2beta.IOutputResult|null); + /** * Creates a new ExportProductsResponse instance using the specified properties. * @param [properties] Properties to set @@ -36269,6 +38607,9 @@ export namespace google { /** ExportUserEventsResponse errorsConfig */ errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + + /** ExportUserEventsResponse outputResult */ + outputResult?: (google.cloud.retail.v2beta.IOutputResult|null); } /** Represents an ExportUserEventsResponse. */ @@ -36286,6 +38627,9 @@ export namespace google { /** ExportUserEventsResponse errorsConfig. */ public errorsConfig?: (google.cloud.retail.v2beta.IExportErrorsConfig|null); + /** ExportUserEventsResponse outputResult. */ + public outputResult?: (google.cloud.retail.v2beta.IOutputResult|null); + /** * Creates a new ExportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set @@ -36357,6 +38701,192 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an OutputResult. */ + interface IOutputResult { + + /** OutputResult bigqueryResult */ + bigqueryResult?: (google.cloud.retail.v2beta.IBigQueryOutputResult[]|null); + } + + /** Represents an OutputResult. */ + class OutputResult implements IOutputResult { + + /** + * Constructs a new OutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IOutputResult); + + /** OutputResult bigqueryResult. */ + public bigqueryResult: google.cloud.retail.v2beta.IBigQueryOutputResult[]; + + /** + * Creates a new OutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.IOutputResult): google.cloud.retail.v2beta.OutputResult; + + /** + * Encodes the specified OutputResult message. Does not implicitly {@link google.cloud.retail.v2beta.OutputResult.verify|verify} messages. + * @param message OutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.OutputResult.verify|verify} messages. + * @param message OutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.OutputResult; + + /** + * Decodes an OutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.OutputResult; + + /** + * Verifies an OutputResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.OutputResult; + + /** + * Creates a plain object from an OutputResult message. Also converts values to other types if specified. + * @param message OutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.OutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BigQueryOutputResult. */ + interface IBigQueryOutputResult { + + /** BigQueryOutputResult datasetId */ + datasetId?: (string|null); + + /** BigQueryOutputResult tableId */ + tableId?: (string|null); + } + + /** Represents a BigQueryOutputResult. */ + class BigQueryOutputResult implements IBigQueryOutputResult { + + /** + * Constructs a new BigQueryOutputResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IBigQueryOutputResult); + + /** BigQueryOutputResult datasetId. */ + public datasetId: string; + + /** BigQueryOutputResult tableId. */ + public tableId: string; + + /** + * Creates a new BigQueryOutputResult instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQueryOutputResult instance + */ + public static create(properties?: google.cloud.retail.v2beta.IBigQueryOutputResult): google.cloud.retail.v2beta.BigQueryOutputResult; + + /** + * Encodes the specified BigQueryOutputResult message. Does not implicitly {@link google.cloud.retail.v2beta.BigQueryOutputResult.verify|verify} messages. + * @param message BigQueryOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IBigQueryOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQueryOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQueryOutputResult.verify|verify} messages. + * @param message BigQueryOutputResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IBigQueryOutputResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BigQueryOutputResult; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BigQueryOutputResult; + + /** + * Verifies a BigQueryOutputResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQueryOutputResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQueryOutputResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BigQueryOutputResult; + + /** + * Creates a plain object from a BigQueryOutputResult message. Also converts values to other types if specified. + * @param message BigQueryOutputResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.BigQueryOutputResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQueryOutputResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents a PredictionService */ class PredictionService extends $protobuf.rpc.Service { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index a3d00834462..47e004eb750 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -20748,8 +20748,10 @@ * @property {Array.|null} [restrictedValues] FacetKey restrictedValues * @property {Array.|null} [prefixes] FacetKey prefixes * @property {Array.|null} [contains] FacetKey contains + * @property {boolean|null} [caseInsensitive] FacetKey caseInsensitive * @property {string|null} [orderBy] FacetKey orderBy * @property {string|null} [query] FacetKey query + * @property {boolean|null} [returnMinMax] FacetKey returnMinMax */ /** @@ -20811,6 +20813,14 @@ */ FacetKey.prototype.contains = $util.emptyArray; + /** + * FacetKey caseInsensitive. + * @member {boolean} caseInsensitive + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.caseInsensitive = false; + /** * FacetKey orderBy. * @member {string} orderBy @@ -20827,6 +20837,14 @@ */ FacetKey.prototype.query = ""; + /** + * FacetKey returnMinMax. + * @member {boolean} returnMinMax + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.returnMinMax = false; + /** * Creates a new FacetKey instance using the specified properties. * @function create @@ -20869,6 +20887,10 @@ if (message.contains != null && message.contains.length) for (var i = 0; i < message.contains.length; ++i) writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + if (message.caseInsensitive != null && Object.hasOwnProperty.call(message, "caseInsensitive")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.caseInsensitive); + if (message.returnMinMax != null && Object.hasOwnProperty.call(message, "returnMinMax")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.returnMinMax); return writer; }; @@ -20926,12 +20948,18 @@ message.contains = []; message.contains.push(reader.string()); break; + case 10: + message.caseInsensitive = reader.bool(); + break; case 4: message.orderBy = reader.string(); break; case 5: message.query = reader.string(); break; + case 11: + message.returnMinMax = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -21000,12 +21028,18 @@ if (!$util.isString(message.contains[i])) return "contains: string[] expected"; } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + if (typeof message.caseInsensitive !== "boolean") + return "caseInsensitive: boolean expected"; if (message.orderBy != null && message.hasOwnProperty("orderBy")) if (!$util.isString(message.orderBy)) return "orderBy: string expected"; if (message.query != null && message.hasOwnProperty("query")) if (!$util.isString(message.query)) return "query: string expected"; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + if (typeof message.returnMinMax !== "boolean") + return "returnMinMax: boolean expected"; return null; }; @@ -21054,10 +21088,14 @@ for (var i = 0; i < object.contains.length; ++i) message.contains[i] = String(object.contains[i]); } + if (object.caseInsensitive != null) + message.caseInsensitive = Boolean(object.caseInsensitive); if (object.orderBy != null) message.orderBy = String(object.orderBy); if (object.query != null) message.query = String(object.query); + if (object.returnMinMax != null) + message.returnMinMax = Boolean(object.returnMinMax); return message; }; @@ -21084,6 +21122,8 @@ object.key = ""; object.orderBy = ""; object.query = ""; + object.caseInsensitive = false; + object.returnMinMax = false; } if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; @@ -21111,6 +21151,10 @@ for (var j = 0; j < message.contains.length; ++j) object.contains[j] = message.contains[j]; } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + object.caseInsensitive = message.caseInsensitive; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + object.returnMinMax = message.returnMinMax; return object; }; @@ -23611,6 +23655,8 @@ * @property {string|null} [value] FacetValue value * @property {google.cloud.retail.v2.IInterval|null} [interval] FacetValue interval * @property {number|Long|null} [count] FacetValue count + * @property {number|null} [minValue] FacetValue minValue + * @property {number|null} [maxValue] FacetValue maxValue */ /** @@ -23652,6 +23698,22 @@ */ FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * FacetValue minValue. + * @member {number} minValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.minValue = 0; + + /** + * FacetValue maxValue. + * @member {number} maxValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.maxValue = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -23696,6 +23758,10 @@ $root.google.cloud.retail.v2.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.count != null && Object.hasOwnProperty.call(message, "count")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.minValue); + if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.maxValue); return writer; }; @@ -23739,6 +23805,12 @@ case 3: message.count = reader.int64(); break; + case 5: + message.minValue = reader.double(); + break; + case 6: + message.maxValue = reader.double(); + break; default: reader.skipType(tag & 7); break; @@ -23793,6 +23865,12 @@ if (message.count != null && message.hasOwnProperty("count")) if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; + if (message.minValue != null && message.hasOwnProperty("minValue")) + if (typeof message.minValue !== "number") + return "minValue: number expected"; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + if (typeof message.maxValue !== "number") + return "maxValue: number expected"; return null; }; @@ -23824,6 +23902,10 @@ message.count = object.count; else if (typeof object.count === "object") message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.minValue != null) + message.minValue = Number(object.minValue); + if (object.maxValue != null) + message.maxValue = Number(object.maxValue); return message; }; @@ -23840,12 +23922,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.count = options.longs === String ? "0" : 0; + object.minValue = 0; + object.maxValue = 0; + } if (message.value != null && message.hasOwnProperty("value")) { object.value = message.value; if (options.oneofs) @@ -23861,6 +23946,10 @@ object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (message.minValue != null && message.hasOwnProperty("minValue")) + object.minValue = options.json && !isFinite(message.minValue) ? String(message.minValue) : message.minValue; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + object.maxValue = options.json && !isFinite(message.maxValue) ? String(message.maxValue) : message.maxValue; return object; }; @@ -25630,6 +25719,7 @@ * @property {google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption|null} [indexableOption] CatalogAttribute indexableOption * @property {google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption|null} [dynamicFacetableOption] CatalogAttribute dynamicFacetableOption * @property {google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption|null} [searchableOption] CatalogAttribute searchableOption + * @property {google.cloud.retail.v2alpha.RecommendationsFilteringOption|null} [recommendationsFilteringOption] CatalogAttribute recommendationsFilteringOption */ /** @@ -25695,6 +25785,14 @@ */ CatalogAttribute.prototype.searchableOption = 0; + /** + * CatalogAttribute recommendationsFilteringOption. + * @member {google.cloud.retail.v2alpha.RecommendationsFilteringOption} recommendationsFilteringOption + * @memberof google.cloud.retail.v2alpha.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.recommendationsFilteringOption = 0; + /** * Creates a new CatalogAttribute instance using the specified properties. * @function create @@ -25727,6 +25825,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).int32(message.dynamicFacetableOption); if (message.searchableOption != null && Object.hasOwnProperty.call(message, "searchableOption")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.searchableOption); + if (message.recommendationsFilteringOption != null && Object.hasOwnProperty.call(message, "recommendationsFilteringOption")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.recommendationsFilteringOption); if (message.inUse != null && Object.hasOwnProperty.call(message, "inUse")) writer.uint32(/* id 9, wireType 0 =*/72).bool(message.inUse); if (message.type != null && Object.hasOwnProperty.call(message, "type")) @@ -25783,6 +25883,9 @@ case 7: message.searchableOption = reader.int32(); break; + case 8: + message.recommendationsFilteringOption = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -25860,6 +25963,15 @@ case 2: break; } + if (message.recommendationsFilteringOption != null && message.hasOwnProperty("recommendationsFilteringOption")) + switch (message.recommendationsFilteringOption) { + default: + return "recommendationsFilteringOption: enum value expected"; + case 0: + case 1: + case 3: + break; + } return null; }; @@ -25935,6 +26047,20 @@ message.searchableOption = 2; break; } + switch (object.recommendationsFilteringOption) { + case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": + case 0: + message.recommendationsFilteringOption = 0; + break; + case "RECOMMENDATIONS_FILTERING_DISABLED": + case 1: + message.recommendationsFilteringOption = 1; + break; + case "RECOMMENDATIONS_FILTERING_ENABLED": + case 3: + message.recommendationsFilteringOption = 3; + break; + } return message; }; @@ -25956,6 +26082,7 @@ object.indexableOption = options.enums === String ? "INDEXABLE_OPTION_UNSPECIFIED" : 0; object.dynamicFacetableOption = options.enums === String ? "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" : 0; object.searchableOption = options.enums === String ? "SEARCHABLE_OPTION_UNSPECIFIED" : 0; + object.recommendationsFilteringOption = options.enums === String ? "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" : 0; object.inUse = false; object.type = options.enums === String ? "UNKNOWN" : 0; } @@ -25967,6 +26094,8 @@ object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + if (message.recommendationsFilteringOption != null && message.hasOwnProperty("recommendationsFilteringOption")) + object.recommendationsFilteringOption = options.enums === String ? $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.recommendationsFilteringOption] : message.recommendationsFilteringOption; if (message.inUse != null && message.hasOwnProperty("inUse")) object.inUse = message.inUse; if (message.type != null && message.hasOwnProperty("type")) @@ -27579,6 +27708,22 @@ return values; })(); + /** + * RecommendationsFilteringOption enum. + * @name google.cloud.retail.v2alpha.RecommendationsFilteringOption + * @enum {number} + * @property {number} RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED=0 RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED value + * @property {number} RECOMMENDATIONS_FILTERING_DISABLED=1 RECOMMENDATIONS_FILTERING_DISABLED value + * @property {number} RECOMMENDATIONS_FILTERING_ENABLED=3 RECOMMENDATIONS_FILTERING_ENABLED value + */ + v2alpha.RecommendationsFilteringOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "RECOMMENDATIONS_FILTERING_DISABLED"] = 1; + values[valuesById[3] = "RECOMMENDATIONS_FILTERING_ENABLED"] = 3; + return values; + })(); + /** * SearchSolutionUseCase enum. * @name google.cloud.retail.v2alpha.SearchSolutionUseCase @@ -34689,6 +34834,7 @@ * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask * @property {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic + * @property {boolean|null} [skipDefaultBranchProtection] ImportProductsRequest skipDefaultBranchProtection */ /** @@ -34762,6 +34908,14 @@ */ ImportProductsRequest.prototype.notificationPubsubTopic = ""; + /** + * ImportProductsRequest skipDefaultBranchProtection. + * @member {boolean} skipDefaultBranchProtection + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.skipDefaultBranchProtection = false; + /** * Creates a new ImportProductsRequest instance using the specified properties. * @function create @@ -34800,6 +34954,8 @@ writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); + if (message.skipDefaultBranchProtection != null && Object.hasOwnProperty.call(message, "skipDefaultBranchProtection")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.skipDefaultBranchProtection); return writer; }; @@ -34855,6 +35011,9 @@ case 7: message.notificationPubsubTopic = reader.string(); break; + case 8: + message.skipDefaultBranchProtection = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -34923,6 +35082,9 @@ if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) if (!$util.isString(message.notificationPubsubTopic)) return "notificationPubsubTopic: string expected"; + if (message.skipDefaultBranchProtection != null && message.hasOwnProperty("skipDefaultBranchProtection")) + if (typeof message.skipDefaultBranchProtection !== "boolean") + return "skipDefaultBranchProtection: boolean expected"; return null; }; @@ -34973,6 +35135,8 @@ } if (object.notificationPubsubTopic != null) message.notificationPubsubTopic = String(object.notificationPubsubTopic); + if (object.skipDefaultBranchProtection != null) + message.skipDefaultBranchProtection = Boolean(object.skipDefaultBranchProtection); return message; }; @@ -34997,6 +35161,7 @@ object.reconciliationMode = options.enums === String ? "RECONCILIATION_MODE_UNSPECIFIED" : 0; object.requestId = ""; object.notificationPubsubTopic = ""; + object.skipDefaultBranchProtection = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -35012,6 +35177,8 @@ object.requestId = message.requestId; if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) object.notificationPubsubTopic = message.notificationPubsubTopic; + if (message.skipDefaultBranchProtection != null && message.hasOwnProperty("skipDefaultBranchProtection")) + object.skipDefaultBranchProtection = message.skipDefaultBranchProtection; return object; }; @@ -45478,6 +45645,8 @@ * @property {Array.|null} [pageCategories] SearchRequest pageCategories * @property {google.cloud.retail.v2alpha.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode * @property {google.cloud.retail.v2alpha.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec + * @property {Object.|null} [labels] SearchRequest labels + * @property {google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec|null} [spellCorrectionSpec] SearchRequest spellCorrectionSpec */ /** @@ -45492,6 +45661,7 @@ this.facetSpecs = []; this.variantRollupKeys = []; this.pageCategories = []; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45658,6 +45828,36 @@ */ SearchRequest.prototype.personalizationSpec = null; + /** + * SearchRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.labels = $util.emptyObject; + + /** + * SearchRequest spellCorrectionSpec. + * @member {google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec|null|undefined} spellCorrectionSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + SearchRequest.prototype.spellCorrectionSpec = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SearchRequest _spellCorrectionSpec. + * @member {"spellCorrectionSpec"|undefined} _spellCorrectionSpec + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @instance + */ + Object.defineProperty(SearchRequest.prototype, "_spellCorrectionSpec", { + get: $util.oneOfGetter($oneOfFields = ["spellCorrectionSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -45725,6 +45925,11 @@ writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.spellCorrectionSpec != null && Object.hasOwnProperty.call(message, "spellCorrectionSpec")) + $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.encode(message.spellCorrectionSpec, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); return writer; }; @@ -45755,7 +45960,7 @@ SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -45825,6 +46030,31 @@ case 32: message.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); break; + case 34: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 35: + message.spellCorrectionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -45860,6 +46090,7 @@ SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.placement != null && message.hasOwnProperty("placement")) if (!$util.isString(message.placement)) return "placement: string expected"; @@ -45958,6 +46189,22 @@ if (error) return "personalizationSpec." + error; } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + properties._spellCorrectionSpec = 1; + { + var error = $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.verify(message.spellCorrectionSpec); + if (error) + return "spellCorrectionSpec." + error; + } + } return null; }; @@ -46078,6 +46325,18 @@ throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.personalizationSpec: object expected"); message.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.spellCorrectionSpec != null) { + if (typeof object.spellCorrectionSpec !== "object") + throw TypeError(".google.cloud.retail.v2alpha.SearchRequest.spellCorrectionSpec: object expected"); + message.spellCorrectionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.fromObject(object.spellCorrectionSpec); + } return message; }; @@ -46099,6 +46358,8 @@ object.variantRollupKeys = []; object.pageCategories = []; } + if (options.objects || options.defaults) + object.labels = {}; if (options.defaults) { object.placement = ""; object.branch = ""; @@ -46167,6 +46428,17 @@ object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + object.spellCorrectionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.toObject(message.spellCorrectionSpec, options); + if (options.oneofs) + object._spellCorrectionSpec = "spellCorrectionSpec"; + } return object; }; @@ -46465,8 +46737,10 @@ * @property {Array.|null} [restrictedValues] FacetKey restrictedValues * @property {Array.|null} [prefixes] FacetKey prefixes * @property {Array.|null} [contains] FacetKey contains + * @property {boolean|null} [caseInsensitive] FacetKey caseInsensitive * @property {string|null} [orderBy] FacetKey orderBy * @property {string|null} [query] FacetKey query + * @property {boolean|null} [returnMinMax] FacetKey returnMinMax */ /** @@ -46528,6 +46802,14 @@ */ FacetKey.prototype.contains = $util.emptyArray; + /** + * FacetKey caseInsensitive. + * @member {boolean} caseInsensitive + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.caseInsensitive = false; + /** * FacetKey orderBy. * @member {string} orderBy @@ -46544,6 +46826,14 @@ */ FacetKey.prototype.query = ""; + /** + * FacetKey returnMinMax. + * @member {boolean} returnMinMax + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.returnMinMax = false; + /** * Creates a new FacetKey instance using the specified properties. * @function create @@ -46586,6 +46876,10 @@ if (message.contains != null && message.contains.length) for (var i = 0; i < message.contains.length; ++i) writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + if (message.caseInsensitive != null && Object.hasOwnProperty.call(message, "caseInsensitive")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.caseInsensitive); + if (message.returnMinMax != null && Object.hasOwnProperty.call(message, "returnMinMax")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.returnMinMax); return writer; }; @@ -46643,12 +46937,18 @@ message.contains = []; message.contains.push(reader.string()); break; + case 10: + message.caseInsensitive = reader.bool(); + break; case 4: message.orderBy = reader.string(); break; case 5: message.query = reader.string(); break; + case 11: + message.returnMinMax = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -46717,12 +47017,18 @@ if (!$util.isString(message.contains[i])) return "contains: string[] expected"; } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + if (typeof message.caseInsensitive !== "boolean") + return "caseInsensitive: boolean expected"; if (message.orderBy != null && message.hasOwnProperty("orderBy")) if (!$util.isString(message.orderBy)) return "orderBy: string expected"; if (message.query != null && message.hasOwnProperty("query")) if (!$util.isString(message.query)) return "query: string expected"; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + if (typeof message.returnMinMax !== "boolean") + return "returnMinMax: boolean expected"; return null; }; @@ -46771,10 +47077,14 @@ for (var i = 0; i < object.contains.length; ++i) message.contains[i] = String(object.contains[i]); } + if (object.caseInsensitive != null) + message.caseInsensitive = Boolean(object.caseInsensitive); if (object.orderBy != null) message.orderBy = String(object.orderBy); if (object.query != null) message.query = String(object.query); + if (object.returnMinMax != null) + message.returnMinMax = Boolean(object.returnMinMax); return message; }; @@ -46801,6 +47111,8 @@ object.key = ""; object.orderBy = ""; object.query = ""; + object.caseInsensitive = false; + object.returnMinMax = false; } if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; @@ -46828,6 +47140,10 @@ for (var j = 0; j < message.contains.length; ++j) object.contains[j] = message.contains[j]; } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + object.caseInsensitive = message.caseInsensitive; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + object.returnMinMax = message.returnMinMax; return object; }; @@ -47993,6 +48309,227 @@ return PersonalizationSpec; })(); + SearchRequest.SpellCorrectionSpec = (function() { + + /** + * Properties of a SpellCorrectionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @interface ISpellCorrectionSpec + * @property {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode|null} [mode] SpellCorrectionSpec mode + */ + + /** + * Constructs a new SpellCorrectionSpec. + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @classdesc Represents a SpellCorrectionSpec. + * @implements ISpellCorrectionSpec + * @constructor + * @param {google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + */ + function SpellCorrectionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpellCorrectionSpec mode. + * @member {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode} mode + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @instance + */ + SpellCorrectionSpec.prototype.mode = 0; + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec instance + */ + SpellCorrectionSpec.create = function create(properties) { + return new SpellCorrectionSpec(properties); + }; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpellCorrectionSpec message. + * @function verify + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpellCorrectionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + */ + SpellCorrectionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec) + return object; + var message = new $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SUGGESTION_ONLY": + case 1: + message.mode = 1; + break; + case "AUTO": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} message SpellCorrectionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpellCorrectionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @instance + * @returns {Object.} JSON object + */ + SpellCorrectionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} SUGGESTION_ONLY=1 SUGGESTION_ONLY value + * @property {number} AUTO=2 AUTO value + */ + SpellCorrectionSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SUGGESTION_ONLY"] = 1; + values[valuesById[2] = "AUTO"] = 2; + return values; + })(); + + return SpellCorrectionSpec; + })(); + /** * RelevanceThreshold enum. * @name google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold @@ -49127,6 +49664,8 @@ * @property {string|null} [value] FacetValue value * @property {google.cloud.retail.v2alpha.IInterval|null} [interval] FacetValue interval * @property {number|Long|null} [count] FacetValue count + * @property {number|null} [minValue] FacetValue minValue + * @property {number|null} [maxValue] FacetValue maxValue */ /** @@ -49168,6 +49707,22 @@ */ FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * FacetValue minValue. + * @member {number} minValue + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.minValue = 0; + + /** + * FacetValue maxValue. + * @member {number} maxValue + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.maxValue = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -49212,6 +49767,10 @@ $root.google.cloud.retail.v2alpha.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.count != null && Object.hasOwnProperty.call(message, "count")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.minValue); + if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.maxValue); return writer; }; @@ -49255,6 +49814,12 @@ case 3: message.count = reader.int64(); break; + case 5: + message.minValue = reader.double(); + break; + case 6: + message.maxValue = reader.double(); + break; default: reader.skipType(tag & 7); break; @@ -49309,6 +49874,12 @@ if (message.count != null && message.hasOwnProperty("count")) if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; + if (message.minValue != null && message.hasOwnProperty("minValue")) + if (typeof message.minValue !== "number") + return "minValue: number expected"; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + if (typeof message.maxValue !== "number") + return "maxValue: number expected"; return null; }; @@ -49340,6 +49911,10 @@ message.count = object.count; else if (typeof object.count === "object") message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.minValue != null) + message.minValue = Number(object.minValue); + if (object.maxValue != null) + message.maxValue = Number(object.maxValue); return message; }; @@ -49356,12 +49931,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.count = options.longs === String ? "0" : 0; + object.minValue = 0; + object.maxValue = 0; + } if (message.value != null && message.hasOwnProperty("value")) { object.value = message.value; if (options.oneofs) @@ -49377,6 +49955,10 @@ object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (message.minValue != null && message.hasOwnProperty("minValue")) + object.minValue = options.json && !isFinite(message.minValue) ? String(message.minValue) : message.minValue; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + object.maxValue = options.json && !isFinite(message.maxValue) ? String(message.maxValue) : message.maxValue; return object; }; @@ -51157,7 +51739,4820 @@ * @constructor * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set */ - function ExportErrorsConfig(properties) { + function ExportErrorsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @instance + */ + ExportErrorsConfig.prototype.gcsPrefix = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @instance + */ + Object.defineProperty(ExportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportErrorsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance + */ + ExportErrorsConfig.create = function create(properties) { + return new ExportErrorsConfig(properties); + }; + + /** + * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + return writer; + }; + + /** + * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsPrefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportErrorsConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportErrorsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; + } + return null; + }; + + /** + * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + */ + ExportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); + return message; + }; + + /** + * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportErrorsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; + if (options.oneofs) + object.destination = "gcsPrefix"; + } + return object; + }; + + /** + * Converts this ExportErrorsConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @instance + * @returns {Object.} JSON object + */ + ExportErrorsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportErrorsConfig; + })(); + + v2alpha.ExportMetadata = (function() { + + /** + * Properties of an ExportMetadata. + * @memberof google.cloud.retail.v2alpha + * @interface IExportMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + */ + + /** + * Constructs a new ExportMetadata. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportMetadata. + * @implements IExportMetadata + * @constructor + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + */ + function ExportMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @instance + */ + ExportMetadata.prototype.createTime = null; + + /** + * ExportMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @instance + */ + ExportMetadata.prototype.updateTime = null; + + /** + * Creates a new ExportMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance + */ + ExportMetadata.create = function create(properties) { + return new ExportMetadata(properties); + }; + + /** + * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportMetadata message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + */ + ExportMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.updateTime = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this ExportMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportMetadata; + })(); + + v2alpha.ExportProductsResponse = (function() { + + /** + * Properties of an ExportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IExportProductsResponse + * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + * @property {google.cloud.retail.v2alpha.IOutputResult|null} [outputResult] ExportProductsResponse outputResult + */ + + /** + * Constructs a new ExportProductsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportProductsResponse. + * @implements IExportProductsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + */ + function ExportProductsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportProductsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportProductsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.errorsConfig = null; + + /** + * ExportProductsResponse outputResult. + * @member {google.cloud.retail.v2alpha.IOutputResult|null|undefined} outputResult + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.outputResult = null; + + /** + * Creates a new ExportProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance + */ + ExportProductsResponse.create = function create(properties) { + return new ExportProductsResponse(properties); + }; + + /** + * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputResult != null && Object.hasOwnProperty.call(message, "outputResult")) + $root.google.cloud.retail.v2alpha.OutputResult.encode(message.outputResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.outputResult != null && message.hasOwnProperty("outputResult")) { + var error = $root.google.cloud.retail.v2alpha.OutputResult.verify(message.outputResult); + if (error) + return "outputResult." + error; + } + return null; + }; + + /** + * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + */ + ExportProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.outputResult != null) { + if (typeof object.outputResult !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.outputResult: object expected"); + message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.fromObject(object.outputResult); + } + return message; + }; + + /** + * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.outputResult = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.outputResult != null && message.hasOwnProperty("outputResult")) + object.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.toObject(message.outputResult, options); + return object; + }; + + /** + * Converts this ExportProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportProductsResponse; + })(); + + v2alpha.ExportUserEventsResponse = (function() { + + /** + * Properties of an ExportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IExportUserEventsResponse + * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples + * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2alpha.IOutputResult|null} [outputResult] ExportUserEventsResponse outputResult + */ + + /** + * Constructs a new ExportUserEventsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an ExportUserEventsResponse. + * @implements IExportUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + */ + function ExportUserEventsResponse(properties) { + this.errorSamples = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportUserEventsResponse errorSamples. + * @member {Array.} errorSamples + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; + + /** + * ExportUserEventsResponse errorsConfig. + * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.errorsConfig = null; + + /** + * ExportUserEventsResponse outputResult. + * @member {google.cloud.retail.v2alpha.IOutputResult|null|undefined} outputResult + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.outputResult = null; + + /** + * Creates a new ExportUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance + */ + ExportUserEventsResponse.create = function create(properties) { + return new ExportUserEventsResponse(properties); + }; + + /** + * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errorSamples != null && message.errorSamples.length) + for (var i = 0; i < message.errorSamples.length; ++i) + $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputResult != null && Object.hasOwnProperty.call(message, "outputResult")) + $root.google.cloud.retail.v2alpha.OutputResult.encode(message.outputResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 2: + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + case 3: + message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { + if (!Array.isArray(message.errorSamples)) + return "errorSamples: array expected"; + for (var i = 0; i < message.errorSamples.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errorSamples[i]); + if (error) + return "errorSamples." + error; + } + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { + var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); + if (error) + return "errorsConfig." + error; + } + if (message.outputResult != null && message.hasOwnProperty("outputResult")) { + var error = $root.google.cloud.retail.v2alpha.OutputResult.verify(message.outputResult); + if (error) + return "outputResult." + error; + } + return null; + }; + + /** + * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + */ + ExportUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + if (object.errorSamples) { + if (!Array.isArray(object.errorSamples)) + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); + message.errorSamples = []; + for (var i = 0; i < object.errorSamples.length; ++i) { + if (typeof object.errorSamples[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); + message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); + } + } + if (object.errorsConfig != null) { + if (typeof object.errorsConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); + } + if (object.outputResult != null) { + if (typeof object.outputResult !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.outputResult: object expected"); + message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.fromObject(object.outputResult); + } + return message; + }; + + /** + * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errorSamples = []; + if (options.defaults) { + object.errorsConfig = null; + object.outputResult = null; + } + if (message.errorSamples && message.errorSamples.length) { + object.errorSamples = []; + for (var j = 0; j < message.errorSamples.length; ++j) + object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); + } + if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) + object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.outputResult != null && message.hasOwnProperty("outputResult")) + object.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.toObject(message.outputResult, options); + return object; + }; + + /** + * Converts this ExportUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + ExportUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportUserEventsResponse; + })(); + + v2alpha.OutputResult = (function() { + + /** + * Properties of an OutputResult. + * @memberof google.cloud.retail.v2alpha + * @interface IOutputResult + * @property {Array.|null} [bigqueryResult] OutputResult bigqueryResult + */ + + /** + * Constructs a new OutputResult. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an OutputResult. + * @implements IOutputResult + * @constructor + * @param {google.cloud.retail.v2alpha.IOutputResult=} [properties] Properties to set + */ + function OutputResult(properties) { + this.bigqueryResult = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputResult bigqueryResult. + * @member {Array.} bigqueryResult + * @memberof google.cloud.retail.v2alpha.OutputResult + * @instance + */ + OutputResult.prototype.bigqueryResult = $util.emptyArray; + + /** + * Creates a new OutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {google.cloud.retail.v2alpha.IOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.OutputResult} OutputResult instance + */ + OutputResult.create = function create(properties) { + return new OutputResult(properties); + }; + + /** + * Encodes the specified OutputResult message. Does not implicitly {@link google.cloud.retail.v2alpha.OutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {google.cloud.retail.v2alpha.IOutputResult} message OutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigqueryResult != null && message.bigqueryResult.length) + for (var i = 0; i < message.bigqueryResult.length; ++i) + $root.google.cloud.retail.v2alpha.BigQueryOutputResult.encode(message.bigqueryResult[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.OutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {google.cloud.retail.v2alpha.IOutputResult} message OutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.OutputResult} OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.OutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.bigqueryResult && message.bigqueryResult.length)) + message.bigqueryResult = []; + message.bigqueryResult.push($root.google.cloud.retail.v2alpha.BigQueryOutputResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.OutputResult} OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bigqueryResult != null && message.hasOwnProperty("bigqueryResult")) { + if (!Array.isArray(message.bigqueryResult)) + return "bigqueryResult: array expected"; + for (var i = 0; i < message.bigqueryResult.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.BigQueryOutputResult.verify(message.bigqueryResult[i]); + if (error) + return "bigqueryResult." + error; + } + } + return null; + }; + + /** + * Creates an OutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.OutputResult} OutputResult + */ + OutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.OutputResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.OutputResult(); + if (object.bigqueryResult) { + if (!Array.isArray(object.bigqueryResult)) + throw TypeError(".google.cloud.retail.v2alpha.OutputResult.bigqueryResult: array expected"); + message.bigqueryResult = []; + for (var i = 0; i < object.bigqueryResult.length; ++i) { + if (typeof object.bigqueryResult[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.OutputResult.bigqueryResult: object expected"); + message.bigqueryResult[i] = $root.google.cloud.retail.v2alpha.BigQueryOutputResult.fromObject(object.bigqueryResult[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {google.cloud.retail.v2alpha.OutputResult} message OutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.bigqueryResult = []; + if (message.bigqueryResult && message.bigqueryResult.length) { + object.bigqueryResult = []; + for (var j = 0; j < message.bigqueryResult.length; ++j) + object.bigqueryResult[j] = $root.google.cloud.retail.v2alpha.BigQueryOutputResult.toObject(message.bigqueryResult[j], options); + } + return object; + }; + + /** + * Converts this OutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.OutputResult + * @instance + * @returns {Object.} JSON object + */ + OutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OutputResult; + })(); + + v2alpha.BigQueryOutputResult = (function() { + + /** + * Properties of a BigQueryOutputResult. + * @memberof google.cloud.retail.v2alpha + * @interface IBigQueryOutputResult + * @property {string|null} [datasetId] BigQueryOutputResult datasetId + * @property {string|null} [tableId] BigQueryOutputResult tableId + */ + + /** + * Constructs a new BigQueryOutputResult. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a BigQueryOutputResult. + * @implements IBigQueryOutputResult + * @constructor + * @param {google.cloud.retail.v2alpha.IBigQueryOutputResult=} [properties] Properties to set + */ + function BigQueryOutputResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQueryOutputResult datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @instance + */ + BigQueryOutputResult.prototype.datasetId = ""; + + /** + * BigQueryOutputResult tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @instance + */ + BigQueryOutputResult.prototype.tableId = ""; + + /** + * Creates a new BigQueryOutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2alpha.IBigQueryOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.BigQueryOutputResult} BigQueryOutputResult instance + */ + BigQueryOutputResult.create = function create(properties) { + return new BigQueryOutputResult(properties); + }; + + /** + * Encodes the specified BigQueryOutputResult message. Does not implicitly {@link google.cloud.retail.v2alpha.BigQueryOutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2alpha.IBigQueryOutputResult} message BigQueryOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + return writer; + }; + + /** + * Encodes the specified BigQueryOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.BigQueryOutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2alpha.IBigQueryOutputResult} message BigQueryOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.BigQueryOutputResult} BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.BigQueryOutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.BigQueryOutputResult} BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryOutputResult message. + * @function verify + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryOutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + return null; + }; + + /** + * Creates a BigQueryOutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.BigQueryOutputResult} BigQueryOutputResult + */ + BigQueryOutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.BigQueryOutputResult) + return object; + var message = new $root.google.cloud.retail.v2alpha.BigQueryOutputResult(); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + return message; + }; + + /** + * Creates a plain object from a BigQueryOutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2alpha.BigQueryOutputResult} message BigQueryOutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryOutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + return object; + }; + + /** + * Converts this BigQueryOutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @instance + * @returns {Object.} JSON object + */ + BigQueryOutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQueryOutputResult; + })(); + + v2alpha.Model = (function() { + + /** + * Properties of a Model. + * @memberof google.cloud.retail.v2alpha + * @interface IModel + * @property {google.cloud.retail.v2alpha.Model.IPageOptimizationConfig|null} [pageOptimizationConfig] Model pageOptimizationConfig + * @property {string|null} [name] Model name + * @property {string|null} [displayName] Model displayName + * @property {google.cloud.retail.v2alpha.Model.TrainingState|null} [trainingState] Model trainingState + * @property {google.cloud.retail.v2alpha.Model.ServingState|null} [servingState] Model servingState + * @property {google.protobuf.ITimestamp|null} [createTime] Model createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Model updateTime + * @property {string|null} [type] Model type + * @property {string|null} [optimizationObjective] Model optimizationObjective + * @property {google.cloud.retail.v2alpha.Model.PeriodicTuningState|null} [periodicTuningState] Model periodicTuningState + * @property {google.protobuf.ITimestamp|null} [lastTuneTime] Model lastTuneTime + * @property {string|null} [tuningOperation] Model tuningOperation + * @property {google.cloud.retail.v2alpha.Model.DataState|null} [dataState] Model dataState + * @property {google.cloud.retail.v2alpha.RecommendationsFilteringOption|null} [filteringOption] Model filteringOption + * @property {Array.|null} [servingConfigLists] Model servingConfigLists + */ + + /** + * Constructs a new Model. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a Model. + * @implements IModel + * @constructor + * @param {google.cloud.retail.v2alpha.IModel=} [properties] Properties to set + */ + function Model(properties) { + this.servingConfigLists = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Model pageOptimizationConfig. + * @member {google.cloud.retail.v2alpha.Model.IPageOptimizationConfig|null|undefined} pageOptimizationConfig + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.pageOptimizationConfig = null; + + /** + * Model name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.name = ""; + + /** + * Model displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.displayName = ""; + + /** + * Model trainingState. + * @member {google.cloud.retail.v2alpha.Model.TrainingState} trainingState + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.trainingState = 0; + + /** + * Model servingState. + * @member {google.cloud.retail.v2alpha.Model.ServingState} servingState + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.servingState = 0; + + /** + * Model createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.createTime = null; + + /** + * Model updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.updateTime = null; + + /** + * Model type. + * @member {string} type + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.type = ""; + + /** + * Model optimizationObjective. + * @member {string} optimizationObjective + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.optimizationObjective = ""; + + /** + * Model periodicTuningState. + * @member {google.cloud.retail.v2alpha.Model.PeriodicTuningState} periodicTuningState + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.periodicTuningState = 0; + + /** + * Model lastTuneTime. + * @member {google.protobuf.ITimestamp|null|undefined} lastTuneTime + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.lastTuneTime = null; + + /** + * Model tuningOperation. + * @member {string} tuningOperation + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.tuningOperation = ""; + + /** + * Model dataState. + * @member {google.cloud.retail.v2alpha.Model.DataState} dataState + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.dataState = 0; + + /** + * Model filteringOption. + * @member {google.cloud.retail.v2alpha.RecommendationsFilteringOption} filteringOption + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.filteringOption = 0; + + /** + * Model servingConfigLists. + * @member {Array.} servingConfigLists + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Model.prototype.servingConfigLists = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Model trainingConfig. + * @member {"pageOptimizationConfig"|undefined} trainingConfig + * @memberof google.cloud.retail.v2alpha.Model + * @instance + */ + Object.defineProperty(Model.prototype, "trainingConfig", { + get: $util.oneOfGetter($oneOfFields = ["pageOptimizationConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Model instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {google.cloud.retail.v2alpha.IModel=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Model} Model instance + */ + Model.create = function create(properties) { + return new Model(properties); + }; + + /** + * Encodes the specified Model message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {google.cloud.retail.v2alpha.IModel} message Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Model.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.trainingState != null && Object.hasOwnProperty.call(message, "trainingState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.trainingState); + if (message.servingState != null && Object.hasOwnProperty.call(message, "servingState")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.servingState); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.type); + if (message.optimizationObjective != null && Object.hasOwnProperty.call(message, "optimizationObjective")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.optimizationObjective); + if (message.periodicTuningState != null && Object.hasOwnProperty.call(message, "periodicTuningState")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.periodicTuningState); + if (message.lastTuneTime != null && Object.hasOwnProperty.call(message, "lastTuneTime")) + $root.google.protobuf.Timestamp.encode(message.lastTuneTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.tuningOperation != null && Object.hasOwnProperty.call(message, "tuningOperation")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.tuningOperation); + if (message.dataState != null && Object.hasOwnProperty.call(message, "dataState")) + writer.uint32(/* id 16, wireType 0 =*/128).int32(message.dataState); + if (message.pageOptimizationConfig != null && Object.hasOwnProperty.call(message, "pageOptimizationConfig")) + $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.encode(message.pageOptimizationConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.filteringOption != null && Object.hasOwnProperty.call(message, "filteringOption")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.filteringOption); + if (message.servingConfigLists != null && message.servingConfigLists.length) + for (var i = 0; i < message.servingConfigLists.length; ++i) + $root.google.cloud.retail.v2alpha.Model.ServingConfigList.encode(message.servingConfigLists[i], writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Model message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {google.cloud.retail.v2alpha.IModel} message Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Model.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Model message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Model} Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Model.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Model(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 17: + message.pageOptimizationConfig = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.decode(reader, reader.uint32()); + break; + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.trainingState = reader.int32(); + break; + case 4: + message.servingState = reader.int32(); + break; + case 5: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.type = reader.string(); + break; + case 8: + message.optimizationObjective = reader.string(); + break; + case 11: + message.periodicTuningState = reader.int32(); + break; + case 12: + message.lastTuneTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 15: + message.tuningOperation = reader.string(); + break; + case 16: + message.dataState = reader.int32(); + break; + case 18: + message.filteringOption = reader.int32(); + break; + case 19: + if (!(message.servingConfigLists && message.servingConfigLists.length)) + message.servingConfigLists = []; + message.servingConfigLists.push($root.google.cloud.retail.v2alpha.Model.ServingConfigList.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Model message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Model} Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Model.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Model message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Model.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.pageOptimizationConfig != null && message.hasOwnProperty("pageOptimizationConfig")) { + properties.trainingConfig = 1; + { + var error = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.verify(message.pageOptimizationConfig); + if (error) + return "pageOptimizationConfig." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.trainingState != null && message.hasOwnProperty("trainingState")) + switch (message.trainingState) { + default: + return "trainingState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.servingState != null && message.hasOwnProperty("servingState")) + switch (message.servingState) { + default: + return "servingState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.optimizationObjective != null && message.hasOwnProperty("optimizationObjective")) + if (!$util.isString(message.optimizationObjective)) + return "optimizationObjective: string expected"; + if (message.periodicTuningState != null && message.hasOwnProperty("periodicTuningState")) + switch (message.periodicTuningState) { + default: + return "periodicTuningState: enum value expected"; + case 0: + case 1: + case 3: + case 2: + break; + } + if (message.lastTuneTime != null && message.hasOwnProperty("lastTuneTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.lastTuneTime); + if (error) + return "lastTuneTime." + error; + } + if (message.tuningOperation != null && message.hasOwnProperty("tuningOperation")) + if (!$util.isString(message.tuningOperation)) + return "tuningOperation: string expected"; + if (message.dataState != null && message.hasOwnProperty("dataState")) + switch (message.dataState) { + default: + return "dataState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.filteringOption != null && message.hasOwnProperty("filteringOption")) + switch (message.filteringOption) { + default: + return "filteringOption: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.servingConfigLists != null && message.hasOwnProperty("servingConfigLists")) { + if (!Array.isArray(message.servingConfigLists)) + return "servingConfigLists: array expected"; + for (var i = 0; i < message.servingConfigLists.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Model.ServingConfigList.verify(message.servingConfigLists[i]); + if (error) + return "servingConfigLists." + error; + } + } + return null; + }; + + /** + * Creates a Model message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Model} Model + */ + Model.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Model) + return object; + var message = new $root.google.cloud.retail.v2alpha.Model(); + if (object.pageOptimizationConfig != null) { + if (typeof object.pageOptimizationConfig !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.pageOptimizationConfig: object expected"); + message.pageOptimizationConfig = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.fromObject(object.pageOptimizationConfig); + } + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.trainingState) { + case "TRAINING_STATE_UNSPECIFIED": + case 0: + message.trainingState = 0; + break; + case "PAUSED": + case 1: + message.trainingState = 1; + break; + case "TRAINING": + case 2: + message.trainingState = 2; + break; + } + switch (object.servingState) { + case "SERVING_STATE_UNSPECIFIED": + case 0: + message.servingState = 0; + break; + case "INACTIVE": + case 1: + message.servingState = 1; + break; + case "ACTIVE": + case 2: + message.servingState = 2; + break; + case "TUNED": + case 3: + message.servingState = 3; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.type != null) + message.type = String(object.type); + if (object.optimizationObjective != null) + message.optimizationObjective = String(object.optimizationObjective); + switch (object.periodicTuningState) { + case "PERIODIC_TUNING_STATE_UNSPECIFIED": + case 0: + message.periodicTuningState = 0; + break; + case "PERIODIC_TUNING_DISABLED": + case 1: + message.periodicTuningState = 1; + break; + case "ALL_TUNING_DISABLED": + case 3: + message.periodicTuningState = 3; + break; + case "PERIODIC_TUNING_ENABLED": + case 2: + message.periodicTuningState = 2; + break; + } + if (object.lastTuneTime != null) { + if (typeof object.lastTuneTime !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.lastTuneTime: object expected"); + message.lastTuneTime = $root.google.protobuf.Timestamp.fromObject(object.lastTuneTime); + } + if (object.tuningOperation != null) + message.tuningOperation = String(object.tuningOperation); + switch (object.dataState) { + case "DATA_STATE_UNSPECIFIED": + case 0: + message.dataState = 0; + break; + case "DATA_OK": + case 1: + message.dataState = 1; + break; + case "DATA_ERROR": + case 2: + message.dataState = 2; + break; + } + switch (object.filteringOption) { + case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": + case 0: + message.filteringOption = 0; + break; + case "RECOMMENDATIONS_FILTERING_DISABLED": + case 1: + message.filteringOption = 1; + break; + case "RECOMMENDATIONS_FILTERING_ENABLED": + case 3: + message.filteringOption = 3; + break; + } + if (object.servingConfigLists) { + if (!Array.isArray(object.servingConfigLists)) + throw TypeError(".google.cloud.retail.v2alpha.Model.servingConfigLists: array expected"); + message.servingConfigLists = []; + for (var i = 0; i < object.servingConfigLists.length; ++i) { + if (typeof object.servingConfigLists[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.servingConfigLists: object expected"); + message.servingConfigLists[i] = $root.google.cloud.retail.v2alpha.Model.ServingConfigList.fromObject(object.servingConfigLists[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Model message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {google.cloud.retail.v2alpha.Model} message Model + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Model.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigLists = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.trainingState = options.enums === String ? "TRAINING_STATE_UNSPECIFIED" : 0; + object.servingState = options.enums === String ? "SERVING_STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.updateTime = null; + object.type = ""; + object.optimizationObjective = ""; + object.periodicTuningState = options.enums === String ? "PERIODIC_TUNING_STATE_UNSPECIFIED" : 0; + object.lastTuneTime = null; + object.tuningOperation = ""; + object.dataState = options.enums === String ? "DATA_STATE_UNSPECIFIED" : 0; + object.filteringOption = options.enums === String ? "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.trainingState != null && message.hasOwnProperty("trainingState")) + object.trainingState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.TrainingState[message.trainingState] : message.trainingState; + if (message.servingState != null && message.hasOwnProperty("servingState")) + object.servingState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.ServingState[message.servingState] : message.servingState; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.optimizationObjective != null && message.hasOwnProperty("optimizationObjective")) + object.optimizationObjective = message.optimizationObjective; + if (message.periodicTuningState != null && message.hasOwnProperty("periodicTuningState")) + object.periodicTuningState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.PeriodicTuningState[message.periodicTuningState] : message.periodicTuningState; + if (message.lastTuneTime != null && message.hasOwnProperty("lastTuneTime")) + object.lastTuneTime = $root.google.protobuf.Timestamp.toObject(message.lastTuneTime, options); + if (message.tuningOperation != null && message.hasOwnProperty("tuningOperation")) + object.tuningOperation = message.tuningOperation; + if (message.dataState != null && message.hasOwnProperty("dataState")) + object.dataState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.DataState[message.dataState] : message.dataState; + if (message.pageOptimizationConfig != null && message.hasOwnProperty("pageOptimizationConfig")) { + object.pageOptimizationConfig = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.toObject(message.pageOptimizationConfig, options); + if (options.oneofs) + object.trainingConfig = "pageOptimizationConfig"; + } + if (message.filteringOption != null && message.hasOwnProperty("filteringOption")) + object.filteringOption = options.enums === String ? $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.filteringOption] : message.filteringOption; + if (message.servingConfigLists && message.servingConfigLists.length) { + object.servingConfigLists = []; + for (var j = 0; j < message.servingConfigLists.length; ++j) + object.servingConfigLists[j] = $root.google.cloud.retail.v2alpha.Model.ServingConfigList.toObject(message.servingConfigLists[j], options); + } + return object; + }; + + /** + * Converts this Model to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Model + * @instance + * @returns {Object.} JSON object + */ + Model.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Model.PageOptimizationConfig = (function() { + + /** + * Properties of a PageOptimizationConfig. + * @memberof google.cloud.retail.v2alpha.Model + * @interface IPageOptimizationConfig + * @property {string|null} [pageOptimizationEventType] PageOptimizationConfig pageOptimizationEventType + * @property {Array.|null} [panels] PageOptimizationConfig panels + * @property {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction|null} [restriction] PageOptimizationConfig restriction + */ + + /** + * Constructs a new PageOptimizationConfig. + * @memberof google.cloud.retail.v2alpha.Model + * @classdesc Represents a PageOptimizationConfig. + * @implements IPageOptimizationConfig + * @constructor + * @param {google.cloud.retail.v2alpha.Model.IPageOptimizationConfig=} [properties] Properties to set + */ + function PageOptimizationConfig(properties) { + this.panels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageOptimizationConfig pageOptimizationEventType. + * @member {string} pageOptimizationEventType + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @instance + */ + PageOptimizationConfig.prototype.pageOptimizationEventType = ""; + + /** + * PageOptimizationConfig panels. + * @member {Array.} panels + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @instance + */ + PageOptimizationConfig.prototype.panels = $util.emptyArray; + + /** + * PageOptimizationConfig restriction. + * @member {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction} restriction + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @instance + */ + PageOptimizationConfig.prototype.restriction = 0; + + /** + * Creates a new PageOptimizationConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {google.cloud.retail.v2alpha.Model.IPageOptimizationConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig} PageOptimizationConfig instance + */ + PageOptimizationConfig.create = function create(properties) { + return new PageOptimizationConfig(properties); + }; + + /** + * Encodes the specified PageOptimizationConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {google.cloud.retail.v2alpha.Model.IPageOptimizationConfig} message PageOptimizationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageOptimizationConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageOptimizationEventType != null && Object.hasOwnProperty.call(message, "pageOptimizationEventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.pageOptimizationEventType); + if (message.panels != null && message.panels.length) + for (var i = 0; i < message.panels.length; ++i) + $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.encode(message.panels[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restriction != null && Object.hasOwnProperty.call(message, "restriction")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.restriction); + return writer; + }; + + /** + * Encodes the specified PageOptimizationConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {google.cloud.retail.v2alpha.Model.IPageOptimizationConfig} message PageOptimizationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageOptimizationConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageOptimizationConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig} PageOptimizationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageOptimizationConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageOptimizationEventType = reader.string(); + break; + case 2: + if (!(message.panels && message.panels.length)) + message.panels = []; + message.panels.push($root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.decode(reader, reader.uint32())); + break; + case 3: + message.restriction = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageOptimizationConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig} PageOptimizationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageOptimizationConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageOptimizationConfig message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageOptimizationConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageOptimizationEventType != null && message.hasOwnProperty("pageOptimizationEventType")) + if (!$util.isString(message.pageOptimizationEventType)) + return "pageOptimizationEventType: string expected"; + if (message.panels != null && message.hasOwnProperty("panels")) { + if (!Array.isArray(message.panels)) + return "panels: array expected"; + for (var i = 0; i < message.panels.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.verify(message.panels[i]); + if (error) + return "panels." + error; + } + } + if (message.restriction != null && message.hasOwnProperty("restriction")) + switch (message.restriction) { + default: + return "restriction: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a PageOptimizationConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig} PageOptimizationConfig + */ + PageOptimizationConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig) + return object; + var message = new $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig(); + if (object.pageOptimizationEventType != null) + message.pageOptimizationEventType = String(object.pageOptimizationEventType); + if (object.panels) { + if (!Array.isArray(object.panels)) + throw TypeError(".google.cloud.retail.v2alpha.Model.PageOptimizationConfig.panels: array expected"); + message.panels = []; + for (var i = 0; i < object.panels.length; ++i) { + if (typeof object.panels[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.PageOptimizationConfig.panels: object expected"); + message.panels[i] = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.fromObject(object.panels[i]); + } + } + switch (object.restriction) { + case "RESTRICTION_UNSPECIFIED": + case 0: + message.restriction = 0; + break; + case "NO_RESTRICTION": + case 1: + message.restriction = 1; + break; + case "UNIQUE_SERVING_CONFIG_RESTRICTION": + case 2: + message.restriction = 2; + break; + case "UNIQUE_MODEL_RESTRICTION": + case 3: + message.restriction = 3; + break; + case "UNIQUE_MODEL_TYPE_RESTRICTION": + case 4: + message.restriction = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a PageOptimizationConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig} message PageOptimizationConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageOptimizationConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.panels = []; + if (options.defaults) { + object.pageOptimizationEventType = ""; + object.restriction = options.enums === String ? "RESTRICTION_UNSPECIFIED" : 0; + } + if (message.pageOptimizationEventType != null && message.hasOwnProperty("pageOptimizationEventType")) + object.pageOptimizationEventType = message.pageOptimizationEventType; + if (message.panels && message.panels.length) { + object.panels = []; + for (var j = 0; j < message.panels.length; ++j) + object.panels[j] = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.toObject(message.panels[j], options); + } + if (message.restriction != null && message.hasOwnProperty("restriction")) + object.restriction = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction[message.restriction] : message.restriction; + return object; + }; + + /** + * Converts this PageOptimizationConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @instance + * @returns {Object.} JSON object + */ + PageOptimizationConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PageOptimizationConfig.Candidate = (function() { + + /** + * Properties of a Candidate. + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @interface ICandidate + * @property {string|null} [servingConfigId] Candidate servingConfigId + */ + + /** + * Constructs a new Candidate. + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @classdesc Represents a Candidate. + * @implements ICandidate + * @constructor + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate=} [properties] Properties to set + */ + function Candidate(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Candidate servingConfigId. + * @member {string|null|undefined} servingConfigId + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @instance + */ + Candidate.prototype.servingConfigId = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Candidate candidate. + * @member {"servingConfigId"|undefined} candidate + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @instance + */ + Object.defineProperty(Candidate.prototype, "candidate", { + get: $util.oneOfGetter($oneOfFields = ["servingConfigId"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Candidate instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate} Candidate instance + */ + Candidate.create = function create(properties) { + return new Candidate(properties); + }; + + /** + * Encodes the specified Candidate message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate} message Candidate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Candidate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfigId != null && Object.hasOwnProperty.call(message, "servingConfigId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfigId); + return writer; + }; + + /** + * Encodes the specified Candidate message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate} message Candidate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Candidate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Candidate message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate} Candidate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Candidate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.servingConfigId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Candidate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate} Candidate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Candidate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Candidate message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Candidate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) { + properties.candidate = 1; + if (!$util.isString(message.servingConfigId)) + return "servingConfigId: string expected"; + } + return null; + }; + + /** + * Creates a Candidate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate} Candidate + */ + Candidate.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate) + return object; + var message = new $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate(); + if (object.servingConfigId != null) + message.servingConfigId = String(object.servingConfigId); + return message; + }; + + /** + * Creates a plain object from a Candidate message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate} message Candidate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Candidate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) { + object.servingConfigId = message.servingConfigId; + if (options.oneofs) + object.candidate = "servingConfigId"; + } + return object; + }; + + /** + * Converts this Candidate to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @instance + * @returns {Object.} JSON object + */ + Candidate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Candidate; + })(); + + PageOptimizationConfig.Panel = (function() { + + /** + * Properties of a Panel. + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @interface IPanel + * @property {string|null} [displayName] Panel displayName + * @property {Array.|null} [candidates] Panel candidates + * @property {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate|null} [defaultCandidate] Panel defaultCandidate + */ + + /** + * Constructs a new Panel. + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @classdesc Represents a Panel. + * @implements IPanel + * @constructor + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel=} [properties] Properties to set + */ + function Panel(properties) { + this.candidates = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Panel displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @instance + */ + Panel.prototype.displayName = ""; + + /** + * Panel candidates. + * @member {Array.} candidates + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @instance + */ + Panel.prototype.candidates = $util.emptyArray; + + /** + * Panel defaultCandidate. + * @member {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.ICandidate|null|undefined} defaultCandidate + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @instance + */ + Panel.prototype.defaultCandidate = null; + + /** + * Creates a new Panel instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel} Panel instance + */ + Panel.create = function create(properties) { + return new Panel(properties); + }; + + /** + * Encodes the specified Panel message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel} message Panel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Panel.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.candidates != null && message.candidates.length) + for (var i = 0; i < message.candidates.length; ++i) + $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.encode(message.candidates[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.defaultCandidate != null && Object.hasOwnProperty.call(message, "defaultCandidate")) + $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.encode(message.defaultCandidate, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Panel message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.IPanel} message Panel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Panel.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Panel message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel} Panel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Panel.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + if (!(message.candidates && message.candidates.length)) + message.candidates = []; + message.candidates.push($root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.decode(reader, reader.uint32())); + break; + case 3: + message.defaultCandidate = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Panel message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel} Panel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Panel.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Panel message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Panel.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.candidates != null && message.hasOwnProperty("candidates")) { + if (!Array.isArray(message.candidates)) + return "candidates: array expected"; + for (var i = 0; i < message.candidates.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.verify(message.candidates[i]); + if (error) + return "candidates." + error; + } + } + if (message.defaultCandidate != null && message.hasOwnProperty("defaultCandidate")) { + var error = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.verify(message.defaultCandidate); + if (error) + return "defaultCandidate." + error; + } + return null; + }; + + /** + * Creates a Panel message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel} Panel + */ + Panel.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel) + return object; + var message = new $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.candidates) { + if (!Array.isArray(object.candidates)) + throw TypeError(".google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.candidates: array expected"); + message.candidates = []; + for (var i = 0; i < object.candidates.length; ++i) { + if (typeof object.candidates[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.candidates: object expected"); + message.candidates[i] = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.fromObject(object.candidates[i]); + } + } + if (object.defaultCandidate != null) { + if (typeof object.defaultCandidate !== "object") + throw TypeError(".google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.defaultCandidate: object expected"); + message.defaultCandidate = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.fromObject(object.defaultCandidate); + } + return message; + }; + + /** + * Creates a plain object from a Panel message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel} message Panel + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Panel.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.candidates = []; + if (options.defaults) { + object.displayName = ""; + object.defaultCandidate = null; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.candidates && message.candidates.length) { + object.candidates = []; + for (var j = 0; j < message.candidates.length; ++j) + object.candidates[j] = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.toObject(message.candidates[j], options); + } + if (message.defaultCandidate != null && message.hasOwnProperty("defaultCandidate")) + object.defaultCandidate = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.toObject(message.defaultCandidate, options); + return object; + }; + + /** + * Converts this Panel to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @instance + * @returns {Object.} JSON object + */ + Panel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Panel; + })(); + + /** + * Restriction enum. + * @name google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction + * @enum {number} + * @property {number} RESTRICTION_UNSPECIFIED=0 RESTRICTION_UNSPECIFIED value + * @property {number} NO_RESTRICTION=1 NO_RESTRICTION value + * @property {number} UNIQUE_SERVING_CONFIG_RESTRICTION=2 UNIQUE_SERVING_CONFIG_RESTRICTION value + * @property {number} UNIQUE_MODEL_RESTRICTION=3 UNIQUE_MODEL_RESTRICTION value + * @property {number} UNIQUE_MODEL_TYPE_RESTRICTION=4 UNIQUE_MODEL_TYPE_RESTRICTION value + */ + PageOptimizationConfig.Restriction = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESTRICTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "NO_RESTRICTION"] = 1; + values[valuesById[2] = "UNIQUE_SERVING_CONFIG_RESTRICTION"] = 2; + values[valuesById[3] = "UNIQUE_MODEL_RESTRICTION"] = 3; + values[valuesById[4] = "UNIQUE_MODEL_TYPE_RESTRICTION"] = 4; + return values; + })(); + + return PageOptimizationConfig; + })(); + + Model.ServingConfigList = (function() { + + /** + * Properties of a ServingConfigList. + * @memberof google.cloud.retail.v2alpha.Model + * @interface IServingConfigList + * @property {Array.|null} [servingConfigIds] ServingConfigList servingConfigIds + */ + + /** + * Constructs a new ServingConfigList. + * @memberof google.cloud.retail.v2alpha.Model + * @classdesc Represents a ServingConfigList. + * @implements IServingConfigList + * @constructor + * @param {google.cloud.retail.v2alpha.Model.IServingConfigList=} [properties] Properties to set + */ + function ServingConfigList(properties) { + this.servingConfigIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServingConfigList servingConfigIds. + * @member {Array.} servingConfigIds + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @instance + */ + ServingConfigList.prototype.servingConfigIds = $util.emptyArray; + + /** + * Creates a new ServingConfigList instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2alpha.Model.IServingConfigList=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.Model.ServingConfigList} ServingConfigList instance + */ + ServingConfigList.create = function create(properties) { + return new ServingConfigList(properties); + }; + + /** + * Encodes the specified ServingConfigList message. Does not implicitly {@link google.cloud.retail.v2alpha.Model.ServingConfigList.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2alpha.Model.IServingConfigList} message ServingConfigList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfigList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfigIds != null && message.servingConfigIds.length) + for (var i = 0; i < message.servingConfigIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfigIds[i]); + return writer; + }; + + /** + * Encodes the specified ServingConfigList message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.Model.ServingConfigList.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2alpha.Model.IServingConfigList} message ServingConfigList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfigList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.Model.ServingConfigList} ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfigList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.Model.ServingConfigList(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.servingConfigIds && message.servingConfigIds.length)) + message.servingConfigIds = []; + message.servingConfigIds.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.Model.ServingConfigList} ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfigList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServingConfigList message. + * @function verify + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServingConfigList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfigIds != null && message.hasOwnProperty("servingConfigIds")) { + if (!Array.isArray(message.servingConfigIds)) + return "servingConfigIds: array expected"; + for (var i = 0; i < message.servingConfigIds.length; ++i) + if (!$util.isString(message.servingConfigIds[i])) + return "servingConfigIds: string[] expected"; + } + return null; + }; + + /** + * Creates a ServingConfigList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.Model.ServingConfigList} ServingConfigList + */ + ServingConfigList.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.Model.ServingConfigList) + return object; + var message = new $root.google.cloud.retail.v2alpha.Model.ServingConfigList(); + if (object.servingConfigIds) { + if (!Array.isArray(object.servingConfigIds)) + throw TypeError(".google.cloud.retail.v2alpha.Model.ServingConfigList.servingConfigIds: array expected"); + message.servingConfigIds = []; + for (var i = 0; i < object.servingConfigIds.length; ++i) + message.servingConfigIds[i] = String(object.servingConfigIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a ServingConfigList message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2alpha.Model.ServingConfigList} message ServingConfigList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServingConfigList.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigIds = []; + if (message.servingConfigIds && message.servingConfigIds.length) { + object.servingConfigIds = []; + for (var j = 0; j < message.servingConfigIds.length; ++j) + object.servingConfigIds[j] = message.servingConfigIds[j]; + } + return object; + }; + + /** + * Converts this ServingConfigList to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @instance + * @returns {Object.} JSON object + */ + ServingConfigList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServingConfigList; + })(); + + /** + * ServingState enum. + * @name google.cloud.retail.v2alpha.Model.ServingState + * @enum {number} + * @property {number} SERVING_STATE_UNSPECIFIED=0 SERVING_STATE_UNSPECIFIED value + * @property {number} INACTIVE=1 INACTIVE value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} TUNED=3 TUNED value + */ + Model.ServingState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVING_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INACTIVE"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "TUNED"] = 3; + return values; + })(); + + /** + * TrainingState enum. + * @name google.cloud.retail.v2alpha.Model.TrainingState + * @enum {number} + * @property {number} TRAINING_STATE_UNSPECIFIED=0 TRAINING_STATE_UNSPECIFIED value + * @property {number} PAUSED=1 PAUSED value + * @property {number} TRAINING=2 TRAINING value + */ + Model.TrainingState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TRAINING_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PAUSED"] = 1; + values[valuesById[2] = "TRAINING"] = 2; + return values; + })(); + + /** + * PeriodicTuningState enum. + * @name google.cloud.retail.v2alpha.Model.PeriodicTuningState + * @enum {number} + * @property {number} PERIODIC_TUNING_STATE_UNSPECIFIED=0 PERIODIC_TUNING_STATE_UNSPECIFIED value + * @property {number} PERIODIC_TUNING_DISABLED=1 PERIODIC_TUNING_DISABLED value + * @property {number} ALL_TUNING_DISABLED=3 ALL_TUNING_DISABLED value + * @property {number} PERIODIC_TUNING_ENABLED=2 PERIODIC_TUNING_ENABLED value + */ + Model.PeriodicTuningState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PERIODIC_TUNING_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PERIODIC_TUNING_DISABLED"] = 1; + values[valuesById[3] = "ALL_TUNING_DISABLED"] = 3; + values[valuesById[2] = "PERIODIC_TUNING_ENABLED"] = 2; + return values; + })(); + + /** + * DataState enum. + * @name google.cloud.retail.v2alpha.Model.DataState + * @enum {number} + * @property {number} DATA_STATE_UNSPECIFIED=0 DATA_STATE_UNSPECIFIED value + * @property {number} DATA_OK=1 DATA_OK value + * @property {number} DATA_ERROR=2 DATA_ERROR value + */ + Model.DataState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DATA_OK"] = 1; + values[valuesById[2] = "DATA_ERROR"] = 2; + return values; + })(); + + return Model; + })(); + + v2alpha.ModelService = (function() { + + /** + * Constructs a new ModelService service. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ModelService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ModelService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ModelService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ModelService; + + /** + * Creates new ModelService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2alpha.ModelService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ModelService} RPC service. Useful where requests and/or responses are streamed. + */ + ModelService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#createModel}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef CreateModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateModel. + * @function createModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateModelRequest} request CreateModelRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.CreateModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.createModel = function createModel(request, callback) { + return this.rpcCall(createModel, $root.google.cloud.retail.v2alpha.CreateModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateModel" }); + + /** + * Calls CreateModel. + * @function createModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.ICreateModelRequest} request CreateModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#pauseModel}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef PauseModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Model} [response] Model + */ + + /** + * Calls PauseModel. + * @function pauseModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IPauseModelRequest} request PauseModelRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.PauseModelCallback} callback Node-style callback called with the error, if any, and Model + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.pauseModel = function pauseModel(request, callback) { + return this.rpcCall(pauseModel, $root.google.cloud.retail.v2alpha.PauseModelRequest, $root.google.cloud.retail.v2alpha.Model, request, callback); + }, "name", { value: "PauseModel" }); + + /** + * Calls PauseModel. + * @function pauseModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IPauseModelRequest} request PauseModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#resumeModel}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef ResumeModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Model} [response] Model + */ + + /** + * Calls ResumeModel. + * @function resumeModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IResumeModelRequest} request ResumeModelRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.ResumeModelCallback} callback Node-style callback called with the error, if any, and Model + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.resumeModel = function resumeModel(request, callback) { + return this.rpcCall(resumeModel, $root.google.cloud.retail.v2alpha.ResumeModelRequest, $root.google.cloud.retail.v2alpha.Model, request, callback); + }, "name", { value: "ResumeModel" }); + + /** + * Calls ResumeModel. + * @function resumeModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IResumeModelRequest} request ResumeModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#deleteModel}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef DeleteModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteModel. + * @function deleteModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteModelRequest} request DeleteModelRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.DeleteModelCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.deleteModel = function deleteModel(request, callback) { + return this.rpcCall(deleteModel, $root.google.cloud.retail.v2alpha.DeleteModelRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteModel" }); + + /** + * Calls DeleteModel. + * @function deleteModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IDeleteModelRequest} request DeleteModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#listModels}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef ListModelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.ListModelsResponse} [response] ListModelsResponse + */ + + /** + * Calls ListModels. + * @function listModels + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IListModelsRequest} request ListModelsRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.ListModelsCallback} callback Node-style callback called with the error, if any, and ListModelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.listModels = function listModels(request, callback) { + return this.rpcCall(listModels, $root.google.cloud.retail.v2alpha.ListModelsRequest, $root.google.cloud.retail.v2alpha.ListModelsResponse, request, callback); + }, "name", { value: "ListModels" }); + + /** + * Calls ListModels. + * @function listModels + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IListModelsRequest} request ListModelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#updateModel}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef UpdateModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2alpha.Model} [response] Model + */ + + /** + * Calls UpdateModel. + * @function updateModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateModelRequest} request UpdateModelRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.UpdateModelCallback} callback Node-style callback called with the error, if any, and Model + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.updateModel = function updateModel(request, callback) { + return this.rpcCall(updateModel, $root.google.cloud.retail.v2alpha.UpdateModelRequest, $root.google.cloud.retail.v2alpha.Model, request, callback); + }, "name", { value: "UpdateModel" }); + + /** + * Calls UpdateModel. + * @function updateModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.IUpdateModelRequest} request UpdateModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#tuneModel}. + * @memberof google.cloud.retail.v2alpha.ModelService + * @typedef TuneModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls TuneModel. + * @function tuneModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.ITuneModelRequest} request TuneModelRequest message or plain object + * @param {google.cloud.retail.v2alpha.ModelService.TuneModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.tuneModel = function tuneModel(request, callback) { + return this.rpcCall(tuneModel, $root.google.cloud.retail.v2alpha.TuneModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "TuneModel" }); + + /** + * Calls TuneModel. + * @function tuneModel + * @memberof google.cloud.retail.v2alpha.ModelService + * @instance + * @param {google.cloud.retail.v2alpha.ITuneModelRequest} request TuneModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ModelService; + })(); + + v2alpha.CreateModelRequest = (function() { + + /** + * Properties of a CreateModelRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ICreateModelRequest + * @property {string|null} [parent] CreateModelRequest parent + * @property {google.cloud.retail.v2alpha.IModel|null} [model] CreateModelRequest model + * @property {boolean|null} [dryRun] CreateModelRequest dryRun + */ + + /** + * Constructs a new CreateModelRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a CreateModelRequest. + * @implements ICreateModelRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ICreateModelRequest=} [properties] Properties to set + */ + function CreateModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateModelRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @instance + */ + CreateModelRequest.prototype.parent = ""; + + /** + * CreateModelRequest model. + * @member {google.cloud.retail.v2alpha.IModel|null|undefined} model + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @instance + */ + CreateModelRequest.prototype.model = null; + + /** + * CreateModelRequest dryRun. + * @member {boolean} dryRun + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @instance + */ + CreateModelRequest.prototype.dryRun = false; + + /** + * Creates a new CreateModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateModelRequest} CreateModelRequest instance + */ + CreateModelRequest.create = function create(properties) { + return new CreateModelRequest(properties); + }; + + /** + * Encodes the specified CreateModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateModelRequest} message CreateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + $root.google.cloud.retail.v2alpha.Model.encode(message.model, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dryRun != null && Object.hasOwnProperty.call(message, "dryRun")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dryRun); + return writer; + }; + + /** + * Encodes the specified CreateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.ICreateModelRequest} message CreateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.CreateModelRequest} CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.model = $root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32()); + break; + case 3: + message.dryRun = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.CreateModelRequest} CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.model != null && message.hasOwnProperty("model")) { + var error = $root.google.cloud.retail.v2alpha.Model.verify(message.model); + if (error) + return "model." + error; + } + if (message.dryRun != null && message.hasOwnProperty("dryRun")) + if (typeof message.dryRun !== "boolean") + return "dryRun: boolean expected"; + return null; + }; + + /** + * Creates a CreateModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.CreateModelRequest} CreateModelRequest + */ + CreateModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateModelRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.CreateModelRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.model != null) { + if (typeof object.model !== "object") + throw TypeError(".google.cloud.retail.v2alpha.CreateModelRequest.model: object expected"); + message.model = $root.google.cloud.retail.v2alpha.Model.fromObject(object.model); + } + if (object.dryRun != null) + message.dryRun = Boolean(object.dryRun); + return message; + }; + + /** + * Creates a plain object from a CreateModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.CreateModelRequest} message CreateModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.model = null; + object.dryRun = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.model != null && message.hasOwnProperty("model")) + object.model = $root.google.cloud.retail.v2alpha.Model.toObject(message.model, options); + if (message.dryRun != null && message.hasOwnProperty("dryRun")) + object.dryRun = message.dryRun; + return object; + }; + + /** + * Converts this CreateModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @instance + * @returns {Object.} JSON object + */ + CreateModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateModelRequest; + })(); + + v2alpha.UpdateModelRequest = (function() { + + /** + * Properties of an UpdateModelRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IUpdateModelRequest + * @property {google.cloud.retail.v2alpha.IModel|null} [model] UpdateModelRequest model + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateModelRequest updateMask + */ + + /** + * Constructs a new UpdateModelRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents an UpdateModelRequest. + * @implements IUpdateModelRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IUpdateModelRequest=} [properties] Properties to set + */ + function UpdateModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateModelRequest model. + * @member {google.cloud.retail.v2alpha.IModel|null|undefined} model + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @instance + */ + UpdateModelRequest.prototype.model = null; + + /** + * UpdateModelRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @instance + */ + UpdateModelRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.UpdateModelRequest} UpdateModelRequest instance + */ + UpdateModelRequest.create = function create(properties) { + return new UpdateModelRequest(properties); + }; + + /** + * Encodes the specified UpdateModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateModelRequest} message UpdateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + $root.google.cloud.retail.v2alpha.Model.encode(message.model, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.UpdateModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IUpdateModelRequest} message UpdateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.UpdateModelRequest} UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.UpdateModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.model = $root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.UpdateModelRequest} UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) { + var error = $root.google.cloud.retail.v2alpha.Model.verify(message.model); + if (error) + return "model." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.UpdateModelRequest} UpdateModelRequest + */ + UpdateModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.UpdateModelRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.UpdateModelRequest(); + if (object.model != null) { + if (typeof object.model !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateModelRequest.model: object expected"); + message.model = $root.google.cloud.retail.v2alpha.Model.fromObject(object.model); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2alpha.UpdateModelRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2alpha.UpdateModelRequest} message UpdateModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.model = null; + object.updateMask = null; + } + if (message.model != null && message.hasOwnProperty("model")) + object.model = $root.google.cloud.retail.v2alpha.Model.toObject(message.model, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateModelRequest; + })(); + + v2alpha.PauseModelRequest = (function() { + + /** + * Properties of a PauseModelRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IPauseModelRequest + * @property {string|null} [name] PauseModelRequest name + */ + + /** + * Constructs a new PauseModelRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a PauseModelRequest. + * @implements IPauseModelRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IPauseModelRequest=} [properties] Properties to set + */ + function PauseModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PauseModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @instance + */ + PauseModelRequest.prototype.name = ""; + + /** + * Creates a new PauseModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IPauseModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.PauseModelRequest} PauseModelRequest instance + */ + PauseModelRequest.create = function create(properties) { + return new PauseModelRequest(properties); + }; + + /** + * Encodes the specified PauseModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.PauseModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IPauseModelRequest} message PauseModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PauseModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified PauseModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.PauseModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IPauseModelRequest} message PauseModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PauseModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.PauseModelRequest} PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PauseModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.PauseModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.PauseModelRequest} PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PauseModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PauseModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PauseModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a PauseModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.PauseModelRequest} PauseModelRequest + */ + PauseModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.PauseModelRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.PauseModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a PauseModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {google.cloud.retail.v2alpha.PauseModelRequest} message PauseModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PauseModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this PauseModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @instance + * @returns {Object.} JSON object + */ + PauseModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PauseModelRequest; + })(); + + v2alpha.ResumeModelRequest = (function() { + + /** + * Properties of a ResumeModelRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IResumeModelRequest + * @property {string|null} [name] ResumeModelRequest name + */ + + /** + * Constructs a new ResumeModelRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ResumeModelRequest. + * @implements IResumeModelRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IResumeModelRequest=} [properties] Properties to set + */ + function ResumeModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResumeModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @instance + */ + ResumeModelRequest.prototype.name = ""; + + /** + * Creates a new ResumeModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IResumeModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ResumeModelRequest} ResumeModelRequest instance + */ + ResumeModelRequest.create = function create(properties) { + return new ResumeModelRequest(properties); + }; + + /** + * Encodes the specified ResumeModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ResumeModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IResumeModelRequest} message ResumeModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResumeModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified ResumeModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ResumeModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IResumeModelRequest} message ResumeModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResumeModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ResumeModelRequest} ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResumeModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ResumeModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ResumeModelRequest} ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResumeModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResumeModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResumeModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a ResumeModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ResumeModelRequest} ResumeModelRequest + */ + ResumeModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ResumeModelRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ResumeModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a ResumeModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2alpha.ResumeModelRequest} message ResumeModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResumeModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ResumeModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @instance + * @returns {Object.} JSON object + */ + ResumeModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResumeModelRequest; + })(); + + v2alpha.ListModelsRequest = (function() { + + /** + * Properties of a ListModelsRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IListModelsRequest + * @property {string|null} [parent] ListModelsRequest parent + * @property {number|null} [pageSize] ListModelsRequest pageSize + * @property {string|null} [pageToken] ListModelsRequest pageToken + */ + + /** + * Constructs a new ListModelsRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListModelsRequest. + * @implements IListModelsRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IListModelsRequest=} [properties] Properties to set + */ + function ListModelsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListModelsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @instance + */ + ListModelsRequest.prototype.parent = ""; + + /** + * ListModelsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @instance + */ + ListModelsRequest.prototype.pageSize = 0; + + /** + * ListModelsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @instance + */ + ListModelsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListModelsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListModelsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListModelsRequest} ListModelsRequest instance + */ + ListModelsRequest.create = function create(properties) { + return new ListModelsRequest(properties); + }; + + /** + * Encodes the specified ListModelsRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListModelsRequest} message ListModelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListModelsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {google.cloud.retail.v2alpha.IListModelsRequest} message ListModelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListModelsRequest} ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListModelsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListModelsRequest} ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListModelsRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListModelsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListModelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListModelsRequest} ListModelsRequest + */ + ListModelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListModelsRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListModelsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListModelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {google.cloud.retail.v2alpha.ListModelsRequest} message ListModelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListModelsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListModelsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @instance + * @returns {Object.} JSON object + */ + ListModelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListModelsRequest; + })(); + + v2alpha.DeleteModelRequest = (function() { + + /** + * Properties of a DeleteModelRequest. + * @memberof google.cloud.retail.v2alpha + * @interface IDeleteModelRequest + * @property {string|null} [name] DeleteModelRequest name + */ + + /** + * Constructs a new DeleteModelRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a DeleteModelRequest. + * @implements IDeleteModelRequest + * @constructor + * @param {google.cloud.retail.v2alpha.IDeleteModelRequest=} [properties] Properties to set + */ + function DeleteModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @instance + */ + DeleteModelRequest.prototype.name = ""; + + /** + * Creates a new DeleteModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.DeleteModelRequest} DeleteModelRequest instance + */ + DeleteModelRequest.create = function create(properties) { + return new DeleteModelRequest(properties); + }; + + /** + * Encodes the specified DeleteModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteModelRequest} message DeleteModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.DeleteModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2alpha.IDeleteModelRequest} message DeleteModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.DeleteModelRequest} DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.DeleteModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.DeleteModelRequest} DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.DeleteModelRequest} DeleteModelRequest + */ + DeleteModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.DeleteModelRequest) + return object; + var message = new $root.google.cloud.retail.v2alpha.DeleteModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2alpha.DeleteModelRequest} message DeleteModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteModelRequest; + })(); + + v2alpha.ListModelsResponse = (function() { + + /** + * Properties of a ListModelsResponse. + * @memberof google.cloud.retail.v2alpha + * @interface IListModelsResponse + * @property {Array.|null} [models] ListModelsResponse models + * @property {string|null} [nextPageToken] ListModelsResponse nextPageToken + */ + + /** + * Constructs a new ListModelsResponse. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a ListModelsResponse. + * @implements IListModelsResponse + * @constructor + * @param {google.cloud.retail.v2alpha.IListModelsResponse=} [properties] Properties to set + */ + function ListModelsResponse(properties) { + this.models = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListModelsResponse models. + * @member {Array.} models + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @instance + */ + ListModelsResponse.prototype.models = $util.emptyArray; + + /** + * ListModelsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @instance + */ + ListModelsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListModelsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListModelsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.ListModelsResponse} ListModelsResponse instance + */ + ListModelsResponse.create = function create(properties) { + return new ListModelsResponse(properties); + }; + + /** + * Encodes the specified ListModelsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListModelsResponse} message ListModelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.models != null && message.models.length) + for (var i = 0; i < message.models.length; ++i) + $root.google.cloud.retail.v2alpha.Model.encode(message.models[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListModelsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ListModelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {google.cloud.retail.v2alpha.IListModelsResponse} message ListModelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2alpha.ListModelsResponse} ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ListModelsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.models && message.models.length)) + message.models = []; + message.models.push($root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2alpha.ListModelsResponse} ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListModelsResponse message. + * @function verify + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListModelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.models != null && message.hasOwnProperty("models")) { + if (!Array.isArray(message.models)) + return "models: array expected"; + for (var i = 0; i < message.models.length; ++i) { + var error = $root.google.cloud.retail.v2alpha.Model.verify(message.models[i]); + if (error) + return "models." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListModelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2alpha.ListModelsResponse} ListModelsResponse + */ + ListModelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.ListModelsResponse) + return object; + var message = new $root.google.cloud.retail.v2alpha.ListModelsResponse(); + if (object.models) { + if (!Array.isArray(object.models)) + throw TypeError(".google.cloud.retail.v2alpha.ListModelsResponse.models: array expected"); + message.models = []; + for (var i = 0; i < object.models.length; ++i) { + if (typeof object.models[i] !== "object") + throw TypeError(".google.cloud.retail.v2alpha.ListModelsResponse.models: object expected"); + message.models[i] = $root.google.cloud.retail.v2alpha.Model.fromObject(object.models[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListModelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {google.cloud.retail.v2alpha.ListModelsResponse} message ListModelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListModelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.models = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.models && message.models.length) { + object.models = []; + for (var j = 0; j < message.models.length; ++j) + object.models[j] = $root.google.cloud.retail.v2alpha.Model.toObject(message.models[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListModelsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @instance + * @returns {Object.} JSON object + */ + ListModelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListModelsResponse; + })(); + + v2alpha.TuneModelRequest = (function() { + + /** + * Properties of a TuneModelRequest. + * @memberof google.cloud.retail.v2alpha + * @interface ITuneModelRequest + * @property {string|null} [name] TuneModelRequest name + */ + + /** + * Constructs a new TuneModelRequest. + * @memberof google.cloud.retail.v2alpha + * @classdesc Represents a TuneModelRequest. + * @implements ITuneModelRequest + * @constructor + * @param {google.cloud.retail.v2alpha.ITuneModelRequest=} [properties] Properties to set + */ + function TuneModelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51165,89 +56560,75 @@ } /** - * ExportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig - * @instance - */ - ExportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ExportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * TuneModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @instance */ - Object.defineProperty(ExportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); + TuneModelRequest.prototype.name = ""; /** - * Creates a new ExportErrorsConfig instance using the specified properties. + * Creates a new TuneModelRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig instance + * @param {google.cloud.retail.v2alpha.ITuneModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.TuneModelRequest} TuneModelRequest instance */ - ExportErrorsConfig.create = function create(properties) { - return new ExportErrorsConfig(properties); + TuneModelRequest.create = function create(properties) { + return new TuneModelRequest(properties); }; /** - * Encodes the specified ExportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified TuneModelRequest message. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.ITuneModelRequest} message TuneModelRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encode = function encode(message, writer) { + TuneModelRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified ExportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportErrorsConfig.verify|verify} messages. + * Encodes the specified TuneModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static - * @param {google.cloud.retail.v2alpha.IExportErrorsConfig} message ExportErrorsConfig message or plain object to encode + * @param {google.cloud.retail.v2alpha.ITuneModelRequest} message TuneModelRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { + TuneModelRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer. + * Decodes a TuneModelRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.TuneModelRequest} TuneModelRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decode = function decode(reader, length) { + TuneModelRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.TuneModelRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsPrefix = reader.string(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -51258,112 +56639,107 @@ }; /** - * Decodes an ExportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a TuneModelRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.TuneModelRequest} TuneModelRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { + TuneModelRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportErrorsConfig message. + * Verifies a TuneModelRequest message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportErrorsConfig.verify = function verify(message) { + TuneModelRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates an ExportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a TuneModelRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportErrorsConfig} ExportErrorsConfig + * @returns {google.cloud.retail.v2alpha.TuneModelRequest} TuneModelRequest */ - ExportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportErrorsConfig) + TuneModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.TuneModelRequest) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); + var message = new $root.google.cloud.retail.v2alpha.TuneModelRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from an ExportErrorsConfig message. Also converts values to other types if specified. + * Creates a plain object from a TuneModelRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @static - * @param {google.cloud.retail.v2alpha.ExportErrorsConfig} message ExportErrorsConfig + * @param {google.cloud.retail.v2alpha.TuneModelRequest} message TuneModelRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportErrorsConfig.toObject = function toObject(message, options) { + TuneModelRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; - } + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this ExportErrorsConfig to JSON. + * Converts this TuneModelRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @memberof google.cloud.retail.v2alpha.TuneModelRequest * @instance * @returns {Object.} JSON object */ - ExportErrorsConfig.prototype.toJSON = function toJSON() { + TuneModelRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportErrorsConfig; + return TuneModelRequest; })(); - v2alpha.ExportMetadata = (function() { + v2alpha.CreateModelMetadata = (function() { /** - * Properties of an ExportMetadata. + * Properties of a CreateModelMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IExportMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] ExportMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ExportMetadata updateTime + * @interface ICreateModelMetadata + * @property {string|null} [model] CreateModelMetadata model */ /** - * Constructs a new ExportMetadata. + * Constructs a new CreateModelMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportMetadata. - * @implements IExportMetadata + * @classdesc Represents a CreateModelMetadata. + * @implements ICreateModelMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ICreateModelMetadata=} [properties] Properties to set */ - function ExportMetadata(properties) { + function CreateModelMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51371,88 +56747,75 @@ } /** - * ExportMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.retail.v2alpha.ExportMetadata - * @instance - */ - ExportMetadata.prototype.createTime = null; - - /** - * ExportMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * CreateModelMetadata model. + * @member {string} model + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @instance */ - ExportMetadata.prototype.updateTime = null; + CreateModelMetadata.prototype.model = ""; /** - * Creates a new ExportMetadata instance using the specified properties. + * Creates a new CreateModelMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata instance + * @param {google.cloud.retail.v2alpha.ICreateModelMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.CreateModelMetadata} CreateModelMetadata instance */ - ExportMetadata.create = function create(properties) { - return new ExportMetadata(properties); + CreateModelMetadata.create = function create(properties) { + return new CreateModelMetadata(properties); }; /** - * Encodes the specified ExportMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * Encodes the specified CreateModelMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICreateModelMetadata} message CreateModelMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encode = function encode(message, writer) { + CreateModelMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); return writer; }; /** - * Encodes the specified ExportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportMetadata.verify|verify} messages. + * Encodes the specified CreateModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.CreateModelMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static - * @param {google.cloud.retail.v2alpha.IExportMetadata} message ExportMetadata message or plain object to encode + * @param {google.cloud.retail.v2alpha.ICreateModelMetadata} message CreateModelMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportMetadata.encodeDelimited = function encodeDelimited(message, writer) { + CreateModelMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportMetadata message from the specified reader or buffer. + * Decodes a CreateModelMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.CreateModelMetadata} CreateModelMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decode = function decode(reader, length) { + CreateModelMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.CreateModelMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -51463,128 +56826,107 @@ }; /** - * Decodes an ExportMetadata message from the specified reader or buffer, length delimited. + * Decodes a CreateModelMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.CreateModelMetadata} CreateModelMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportMetadata.decodeDelimited = function decodeDelimited(reader) { + CreateModelMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportMetadata message. + * Verifies a CreateModelMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportMetadata.verify = function verify(message) { + CreateModelMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; - } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; return null; }; /** - * Creates an ExportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CreateModelMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportMetadata} ExportMetadata + * @returns {google.cloud.retail.v2alpha.CreateModelMetadata} CreateModelMetadata */ - ExportMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportMetadata) + CreateModelMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.CreateModelMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } + var message = new $root.google.cloud.retail.v2alpha.CreateModelMetadata(); + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from an ExportMetadata message. Also converts values to other types if specified. + * Creates a plain object from a CreateModelMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @static - * @param {google.cloud.retail.v2alpha.ExportMetadata} message ExportMetadata + * @param {google.cloud.retail.v2alpha.CreateModelMetadata} message CreateModelMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportMetadata.toObject = function toObject(message, options) { + CreateModelMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.createTime = null; - object.updateTime = null; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (options.defaults) + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; return object; }; /** - * Converts this ExportMetadata to JSON. + * Converts this CreateModelMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata * @instance * @returns {Object.} JSON object */ - ExportMetadata.prototype.toJSON = function toJSON() { + CreateModelMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportMetadata; + return CreateModelMetadata; })(); - v2alpha.ExportProductsResponse = (function() { + v2alpha.TuneModelMetadata = (function() { /** - * Properties of an ExportProductsResponse. + * Properties of a TuneModelMetadata. * @memberof google.cloud.retail.v2alpha - * @interface IExportProductsResponse - * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + * @interface ITuneModelMetadata + * @property {string|null} [model] TuneModelMetadata model */ /** - * Constructs a new ExportProductsResponse. + * Constructs a new TuneModelMetadata. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportProductsResponse. - * @implements IExportProductsResponse + * @classdesc Represents a TuneModelMetadata. + * @implements ITuneModelMetadata * @constructor - * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ITuneModelMetadata=} [properties] Properties to set */ - function ExportProductsResponse(properties) { - this.errorSamples = []; + function TuneModelMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51592,91 +56934,75 @@ } /** - * ExportProductsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse - * @instance - */ - ExportProductsResponse.prototype.errorSamples = $util.emptyArray; - - /** - * ExportProductsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * TuneModelMetadata model. + * @member {string} model + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @instance */ - ExportProductsResponse.prototype.errorsConfig = null; + TuneModelMetadata.prototype.model = ""; /** - * Creates a new ExportProductsResponse instance using the specified properties. + * Creates a new TuneModelMetadata instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse instance + * @param {google.cloud.retail.v2alpha.ITuneModelMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.TuneModelMetadata} TuneModelMetadata instance */ - ExportProductsResponse.create = function create(properties) { - return new ExportProductsResponse(properties); + TuneModelMetadata.create = function create(properties) { + return new TuneModelMetadata(properties); }; /** - * Encodes the specified ExportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * Encodes the specified TuneModelMetadata message. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ITuneModelMetadata} message TuneModelMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encode = function encode(message, writer) { + TuneModelMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); return writer; }; /** - * Encodes the specified ExportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportProductsResponse.verify|verify} messages. + * Encodes the specified TuneModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static - * @param {google.cloud.retail.v2alpha.IExportProductsResponse} message ExportProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ITuneModelMetadata} message TuneModelMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + TuneModelMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer. + * Decodes a TuneModelMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.TuneModelMetadata} TuneModelMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decode = function decode(reader, length) { + TuneModelMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.TuneModelMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -51687,140 +57013,106 @@ }; /** - * Decodes an ExportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a TuneModelMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.TuneModelMetadata} TuneModelMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportProductsResponse.decodeDelimited = function decodeDelimited(reader) { + TuneModelMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportProductsResponse message. + * Verifies a TuneModelMetadata message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportProductsResponse.verify = function verify(message) { + TuneModelMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; return null; }; /** - * Creates an ExportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a TuneModelMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportProductsResponse} ExportProductsResponse + * @returns {google.cloud.retail.v2alpha.TuneModelMetadata} TuneModelMetadata */ - ExportProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportProductsResponse) + TuneModelMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.TuneModelMetadata) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportProductsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportProductsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); - } + var message = new $root.google.cloud.retail.v2alpha.TuneModelMetadata(); + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from an ExportProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from a TuneModelMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @static - * @param {google.cloud.retail.v2alpha.ExportProductsResponse} message ExportProductsResponse + * @param {google.cloud.retail.v2alpha.TuneModelMetadata} message TuneModelMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportProductsResponse.toObject = function toObject(message, options) { + TuneModelMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; return object; }; /** - * Converts this ExportProductsResponse to JSON. + * Converts this TuneModelMetadata to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata * @instance * @returns {Object.} JSON object */ - ExportProductsResponse.prototype.toJSON = function toJSON() { + TuneModelMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportProductsResponse; + return TuneModelMetadata; })(); - v2alpha.ExportUserEventsResponse = (function() { + v2alpha.TuneModelResponse = (function() { /** - * Properties of an ExportUserEventsResponse. + * Properties of a TuneModelResponse. * @memberof google.cloud.retail.v2alpha - * @interface IExportUserEventsResponse - * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples - * @property {google.cloud.retail.v2alpha.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + * @interface ITuneModelResponse */ /** - * Constructs a new ExportUserEventsResponse. + * Constructs a new TuneModelResponse. * @memberof google.cloud.retail.v2alpha - * @classdesc Represents an ExportUserEventsResponse. - * @implements IExportUserEventsResponse + * @classdesc Represents a TuneModelResponse. + * @implements ITuneModelResponse * @constructor - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2alpha.ITuneModelResponse=} [properties] Properties to set */ - function ExportUserEventsResponse(properties) { - this.errorSamples = []; + function TuneModelResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -51828,92 +57120,63 @@ } /** - * ExportUserEventsResponse errorSamples. - * @member {Array.} errorSamples - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse - * @instance - */ - ExportUserEventsResponse.prototype.errorSamples = $util.emptyArray; - - /** - * ExportUserEventsResponse errorsConfig. - * @member {google.cloud.retail.v2alpha.IExportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse - * @instance - */ - ExportUserEventsResponse.prototype.errorsConfig = null; - - /** - * Creates a new ExportUserEventsResponse instance using the specified properties. + * Creates a new TuneModelResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse instance + * @param {google.cloud.retail.v2alpha.ITuneModelResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2alpha.TuneModelResponse} TuneModelResponse instance */ - ExportUserEventsResponse.create = function create(properties) { - return new ExportUserEventsResponse(properties); + TuneModelResponse.create = function create(properties) { + return new TuneModelResponse(properties); }; /** - * Encodes the specified ExportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified TuneModelResponse message. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ITuneModelResponse} message TuneModelResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encode = function encode(message, writer) { + TuneModelResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.errorSamples != null && message.errorSamples.length) - for (var i = 0; i < message.errorSamples.length; ++i) - $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2alpha.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ExportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.ExportUserEventsResponse.verify|verify} messages. + * Encodes the specified TuneModelResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2alpha.TuneModelResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static - * @param {google.cloud.retail.v2alpha.IExportUserEventsResponse} message ExportUserEventsResponse message or plain object to encode + * @param {google.cloud.retail.v2alpha.ITuneModelResponse} message TuneModelResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExportUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + TuneModelResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer. + * Decodes a TuneModelResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.TuneModelResponse} TuneModelResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decode = function decode(reader, length) { + TuneModelResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2alpha.TuneModelResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -51923,118 +57186,74 @@ }; /** - * Decodes an ExportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a TuneModelResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.TuneModelResponse} TuneModelResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExportUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + TuneModelResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ExportUserEventsResponse message. + * Verifies a TuneModelResponse message. * @function verify - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExportUserEventsResponse.verify = function verify(message) { + TuneModelResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.errorSamples != null && message.hasOwnProperty("errorSamples")) { - if (!Array.isArray(message.errorSamples)) - return "errorSamples: array expected"; - for (var i = 0; i < message.errorSamples.length; ++i) { - var error = $root.google.rpc.Status.verify(message.errorSamples[i]); - if (error) - return "errorSamples." + error; - } - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) { - var error = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.verify(message.errorsConfig); - if (error) - return "errorsConfig." + error; - } return null; }; /** - * Creates an ExportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a TuneModelResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2alpha.ExportUserEventsResponse} ExportUserEventsResponse + * @returns {google.cloud.retail.v2alpha.TuneModelResponse} TuneModelResponse */ - ExportUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2alpha.ExportUserEventsResponse) + TuneModelResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2alpha.TuneModelResponse) return object; - var message = new $root.google.cloud.retail.v2alpha.ExportUserEventsResponse(); - if (object.errorSamples) { - if (!Array.isArray(object.errorSamples)) - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: array expected"); - message.errorSamples = []; - for (var i = 0; i < object.errorSamples.length; ++i) { - if (typeof object.errorSamples[i] !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorSamples: object expected"); - message.errorSamples[i] = $root.google.rpc.Status.fromObject(object.errorSamples[i]); - } - } - if (object.errorsConfig != null) { - if (typeof object.errorsConfig !== "object") - throw TypeError(".google.cloud.retail.v2alpha.ExportUserEventsResponse.errorsConfig: object expected"); - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.fromObject(object.errorsConfig); - } - return message; + return new $root.google.cloud.retail.v2alpha.TuneModelResponse(); }; /** - * Creates a plain object from an ExportUserEventsResponse message. Also converts values to other types if specified. + * Creates a plain object from a TuneModelResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @static - * @param {google.cloud.retail.v2alpha.ExportUserEventsResponse} message ExportUserEventsResponse + * @param {google.cloud.retail.v2alpha.TuneModelResponse} message TuneModelResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExportUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.errorSamples = []; - if (options.defaults) - object.errorsConfig = null; - if (message.errorSamples && message.errorSamples.length) { - object.errorSamples = []; - for (var j = 0; j < message.errorSamples.length; ++j) - object.errorSamples[j] = $root.google.rpc.Status.toObject(message.errorSamples[j], options); - } - if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) - object.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.toObject(message.errorsConfig, options); - return object; + TuneModelResponse.toObject = function toObject() { + return {}; }; /** - * Converts this ExportUserEventsResponse to JSON. + * Converts this TuneModelResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @memberof google.cloud.retail.v2alpha.TuneModelResponse * @instance * @returns {Object.} JSON object */ - ExportUserEventsResponse.prototype.toJSON = function toJSON() { + TuneModelResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ExportUserEventsResponse; + return TuneModelResponse; })(); v2alpha.PredictionService = (function() { @@ -63559,6 +68778,7 @@ * @property {google.cloud.retail.v2beta.CatalogAttribute.IndexableOption|null} [indexableOption] CatalogAttribute indexableOption * @property {google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption|null} [dynamicFacetableOption] CatalogAttribute dynamicFacetableOption * @property {google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|null} [searchableOption] CatalogAttribute searchableOption + * @property {google.cloud.retail.v2beta.RecommendationsFilteringOption|null} [recommendationsFilteringOption] CatalogAttribute recommendationsFilteringOption */ /** @@ -63624,6 +68844,14 @@ */ CatalogAttribute.prototype.searchableOption = 0; + /** + * CatalogAttribute recommendationsFilteringOption. + * @member {google.cloud.retail.v2beta.RecommendationsFilteringOption} recommendationsFilteringOption + * @memberof google.cloud.retail.v2beta.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.recommendationsFilteringOption = 0; + /** * Creates a new CatalogAttribute instance using the specified properties. * @function create @@ -63656,6 +68884,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).int32(message.dynamicFacetableOption); if (message.searchableOption != null && Object.hasOwnProperty.call(message, "searchableOption")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.searchableOption); + if (message.recommendationsFilteringOption != null && Object.hasOwnProperty.call(message, "recommendationsFilteringOption")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.recommendationsFilteringOption); if (message.inUse != null && Object.hasOwnProperty.call(message, "inUse")) writer.uint32(/* id 9, wireType 0 =*/72).bool(message.inUse); if (message.type != null && Object.hasOwnProperty.call(message, "type")) @@ -63712,6 +68942,9 @@ case 7: message.searchableOption = reader.int32(); break; + case 8: + message.recommendationsFilteringOption = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -63789,6 +69022,15 @@ case 2: break; } + if (message.recommendationsFilteringOption != null && message.hasOwnProperty("recommendationsFilteringOption")) + switch (message.recommendationsFilteringOption) { + default: + return "recommendationsFilteringOption: enum value expected"; + case 0: + case 1: + case 3: + break; + } return null; }; @@ -63864,6 +69106,20 @@ message.searchableOption = 2; break; } + switch (object.recommendationsFilteringOption) { + case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": + case 0: + message.recommendationsFilteringOption = 0; + break; + case "RECOMMENDATIONS_FILTERING_DISABLED": + case 1: + message.recommendationsFilteringOption = 1; + break; + case "RECOMMENDATIONS_FILTERING_ENABLED": + case 3: + message.recommendationsFilteringOption = 3; + break; + } return message; }; @@ -63885,6 +69141,7 @@ object.indexableOption = options.enums === String ? "INDEXABLE_OPTION_UNSPECIFIED" : 0; object.dynamicFacetableOption = options.enums === String ? "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" : 0; object.searchableOption = options.enums === String ? "SEARCHABLE_OPTION_UNSPECIFIED" : 0; + object.recommendationsFilteringOption = options.enums === String ? "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" : 0; object.inUse = false; object.type = options.enums === String ? "UNKNOWN" : 0; } @@ -63896,6 +69153,8 @@ object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + if (message.recommendationsFilteringOption != null && message.hasOwnProperty("recommendationsFilteringOption")) + object.recommendationsFilteringOption = options.enums === String ? $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.recommendationsFilteringOption] : message.recommendationsFilteringOption; if (message.inUse != null && message.hasOwnProperty("inUse")) object.inUse = message.inUse; if (message.type != null && message.hasOwnProperty("type")) @@ -65508,6 +70767,22 @@ return values; })(); + /** + * RecommendationsFilteringOption enum. + * @name google.cloud.retail.v2beta.RecommendationsFilteringOption + * @enum {number} + * @property {number} RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED=0 RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED value + * @property {number} RECOMMENDATIONS_FILTERING_DISABLED=1 RECOMMENDATIONS_FILTERING_DISABLED value + * @property {number} RECOMMENDATIONS_FILTERING_ENABLED=3 RECOMMENDATIONS_FILTERING_ENABLED value + */ + v2beta.RecommendationsFilteringOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "RECOMMENDATIONS_FILTERING_DISABLED"] = 1; + values[valuesById[3] = "RECOMMENDATIONS_FILTERING_ENABLED"] = 3; + return values; + })(); + /** * SearchSolutionUseCase enum. * @name google.cloud.retail.v2beta.SearchSolutionUseCase @@ -83340,6 +88615,8 @@ * @property {Array.|null} [pageCategories] SearchRequest pageCategories * @property {google.cloud.retail.v2beta.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode * @property {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec + * @property {Object.|null} [labels] SearchRequest labels + * @property {google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec|null} [spellCorrectionSpec] SearchRequest spellCorrectionSpec */ /** @@ -83354,6 +88631,7 @@ this.facetSpecs = []; this.variantRollupKeys = []; this.pageCategories = []; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -83512,6 +88790,36 @@ */ SearchRequest.prototype.personalizationSpec = null; + /** + * SearchRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.labels = $util.emptyObject; + + /** + * SearchRequest spellCorrectionSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec|null|undefined} spellCorrectionSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + SearchRequest.prototype.spellCorrectionSpec = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SearchRequest _spellCorrectionSpec. + * @member {"spellCorrectionSpec"|undefined} _spellCorrectionSpec + * @memberof google.cloud.retail.v2beta.SearchRequest + * @instance + */ + Object.defineProperty(SearchRequest.prototype, "_spellCorrectionSpec", { + get: $util.oneOfGetter($oneOfFields = ["spellCorrectionSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -83577,6 +88885,11 @@ writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.spellCorrectionSpec != null && Object.hasOwnProperty.call(message, "spellCorrectionSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.encode(message.spellCorrectionSpec, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); return writer; }; @@ -83607,7 +88920,7 @@ SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -83674,6 +88987,31 @@ case 32: message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); break; + case 34: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 35: + message.spellCorrectionSpec = $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -83709,6 +89047,7 @@ SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.placement != null && message.hasOwnProperty("placement")) if (!$util.isString(message.placement)) return "placement: string expected"; @@ -83796,6 +89135,22 @@ if (error) return "personalizationSpec." + error; } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + properties._spellCorrectionSpec = 1; + { + var error = $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.verify(message.spellCorrectionSpec); + if (error) + return "spellCorrectionSpec." + error; + } + } return null; }; @@ -83894,6 +89249,18 @@ throw TypeError(".google.cloud.retail.v2beta.SearchRequest.personalizationSpec: object expected"); message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.spellCorrectionSpec != null) { + if (typeof object.spellCorrectionSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.SearchRequest.spellCorrectionSpec: object expected"); + message.spellCorrectionSpec = $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.fromObject(object.spellCorrectionSpec); + } return message; }; @@ -83915,6 +89282,8 @@ object.variantRollupKeys = []; object.pageCategories = []; } + if (options.objects || options.defaults) + object.labels = {}; if (options.defaults) { object.placement = ""; object.branch = ""; @@ -83980,6 +89349,17 @@ object.searchMode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + object.spellCorrectionSpec = $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.toObject(message.spellCorrectionSpec, options); + if (options.oneofs) + object._spellCorrectionSpec = "spellCorrectionSpec"; + } return object; }; @@ -84278,8 +89658,10 @@ * @property {Array.|null} [restrictedValues] FacetKey restrictedValues * @property {Array.|null} [prefixes] FacetKey prefixes * @property {Array.|null} [contains] FacetKey contains + * @property {boolean|null} [caseInsensitive] FacetKey caseInsensitive * @property {string|null} [orderBy] FacetKey orderBy * @property {string|null} [query] FacetKey query + * @property {boolean|null} [returnMinMax] FacetKey returnMinMax */ /** @@ -84341,6 +89723,14 @@ */ FacetKey.prototype.contains = $util.emptyArray; + /** + * FacetKey caseInsensitive. + * @member {boolean} caseInsensitive + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.caseInsensitive = false; + /** * FacetKey orderBy. * @member {string} orderBy @@ -84357,6 +89747,14 @@ */ FacetKey.prototype.query = ""; + /** + * FacetKey returnMinMax. + * @member {boolean} returnMinMax + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.returnMinMax = false; + /** * Creates a new FacetKey instance using the specified properties. * @function create @@ -84399,6 +89797,10 @@ if (message.contains != null && message.contains.length) for (var i = 0; i < message.contains.length; ++i) writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + if (message.caseInsensitive != null && Object.hasOwnProperty.call(message, "caseInsensitive")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.caseInsensitive); + if (message.returnMinMax != null && Object.hasOwnProperty.call(message, "returnMinMax")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.returnMinMax); return writer; }; @@ -84456,12 +89858,18 @@ message.contains = []; message.contains.push(reader.string()); break; + case 10: + message.caseInsensitive = reader.bool(); + break; case 4: message.orderBy = reader.string(); break; case 5: message.query = reader.string(); break; + case 11: + message.returnMinMax = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -84530,12 +89938,18 @@ if (!$util.isString(message.contains[i])) return "contains: string[] expected"; } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + if (typeof message.caseInsensitive !== "boolean") + return "caseInsensitive: boolean expected"; if (message.orderBy != null && message.hasOwnProperty("orderBy")) if (!$util.isString(message.orderBy)) return "orderBy: string expected"; if (message.query != null && message.hasOwnProperty("query")) if (!$util.isString(message.query)) return "query: string expected"; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + if (typeof message.returnMinMax !== "boolean") + return "returnMinMax: boolean expected"; return null; }; @@ -84584,10 +89998,14 @@ for (var i = 0; i < object.contains.length; ++i) message.contains[i] = String(object.contains[i]); } + if (object.caseInsensitive != null) + message.caseInsensitive = Boolean(object.caseInsensitive); if (object.orderBy != null) message.orderBy = String(object.orderBy); if (object.query != null) message.query = String(object.query); + if (object.returnMinMax != null) + message.returnMinMax = Boolean(object.returnMinMax); return message; }; @@ -84614,6 +90032,8 @@ object.key = ""; object.orderBy = ""; object.query = ""; + object.caseInsensitive = false; + object.returnMinMax = false; } if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; @@ -84641,6 +90061,10 @@ for (var j = 0; j < message.contains.length; ++j) object.contains[j] = message.contains[j]; } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + object.caseInsensitive = message.caseInsensitive; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + object.returnMinMax = message.returnMinMax; return object; }; @@ -85806,6 +91230,227 @@ return PersonalizationSpec; })(); + SearchRequest.SpellCorrectionSpec = (function() { + + /** + * Properties of a SpellCorrectionSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @interface ISpellCorrectionSpec + * @property {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode|null} [mode] SpellCorrectionSpec mode + */ + + /** + * Constructs a new SpellCorrectionSpec. + * @memberof google.cloud.retail.v2beta.SearchRequest + * @classdesc Represents a SpellCorrectionSpec. + * @implements ISpellCorrectionSpec + * @constructor + * @param {google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + */ + function SpellCorrectionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpellCorrectionSpec mode. + * @member {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode} mode + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @instance + */ + SpellCorrectionSpec.prototype.mode = 0; + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec instance + */ + SpellCorrectionSpec.create = function create(properties) { + return new SpellCorrectionSpec(properties); + }; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpellCorrectionSpec message. + * @function verify + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpellCorrectionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + */ + SpellCorrectionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec) + return object; + var message = new $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SUGGESTION_ONLY": + case 1: + message.mode = 1; + break; + case "AUTO": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} message SpellCorrectionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpellCorrectionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @instance + * @returns {Object.} JSON object + */ + SpellCorrectionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} SUGGESTION_ONLY=1 SUGGESTION_ONLY value + * @property {number} AUTO=2 AUTO value + */ + SpellCorrectionSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SUGGESTION_ONLY"] = 1; + values[valuesById[2] = "AUTO"] = 2; + return values; + })(); + + return SpellCorrectionSpec; + })(); + /** * SearchMode enum. * @name google.cloud.retail.v2beta.SearchRequest.SearchMode @@ -86920,6 +92565,8 @@ * @property {string|null} [value] FacetValue value * @property {google.cloud.retail.v2beta.IInterval|null} [interval] FacetValue interval * @property {number|Long|null} [count] FacetValue count + * @property {number|null} [minValue] FacetValue minValue + * @property {number|null} [maxValue] FacetValue maxValue */ /** @@ -86961,6 +92608,22 @@ */ FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * FacetValue minValue. + * @member {number} minValue + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.minValue = 0; + + /** + * FacetValue maxValue. + * @member {number} maxValue + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @instance + */ + FacetValue.prototype.maxValue = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -87005,6 +92668,10 @@ $root.google.cloud.retail.v2beta.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.count != null && Object.hasOwnProperty.call(message, "count")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.minValue); + if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.maxValue); return writer; }; @@ -87048,6 +92715,12 @@ case 3: message.count = reader.int64(); break; + case 5: + message.minValue = reader.double(); + break; + case 6: + message.maxValue = reader.double(); + break; default: reader.skipType(tag & 7); break; @@ -87102,6 +92775,12 @@ if (message.count != null && message.hasOwnProperty("count")) if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; + if (message.minValue != null && message.hasOwnProperty("minValue")) + if (typeof message.minValue !== "number") + return "minValue: number expected"; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + if (typeof message.maxValue !== "number") + return "maxValue: number expected"; return null; }; @@ -87133,6 +92812,10 @@ message.count = object.count; else if (typeof object.count === "object") message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.minValue != null) + message.minValue = Number(object.minValue); + if (object.maxValue != null) + message.maxValue = Number(object.maxValue); return message; }; @@ -87149,12 +92832,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.count = options.longs === String ? "0" : 0; + object.minValue = 0; + object.maxValue = 0; + } if (message.value != null && message.hasOwnProperty("value")) { object.value = message.value; if (options.oneofs) @@ -87170,6 +92856,10 @@ object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (message.minValue != null && message.hasOwnProperty("minValue")) + object.minValue = options.json && !isFinite(message.minValue) ? String(message.minValue) : message.minValue; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + object.maxValue = options.json && !isFinite(message.maxValue) ? String(message.maxValue) : message.maxValue; return object; }; @@ -89366,6 +95056,7 @@ * @interface IExportProductsResponse * @property {Array.|null} [errorSamples] ExportProductsResponse errorSamples * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportProductsResponse errorsConfig + * @property {google.cloud.retail.v2beta.IOutputResult|null} [outputResult] ExportProductsResponse outputResult */ /** @@ -89400,6 +95091,14 @@ */ ExportProductsResponse.prototype.errorsConfig = null; + /** + * ExportProductsResponse outputResult. + * @member {google.cloud.retail.v2beta.IOutputResult|null|undefined} outputResult + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @instance + */ + ExportProductsResponse.prototype.outputResult = null; + /** * Creates a new ExportProductsResponse instance using the specified properties. * @function create @@ -89429,6 +95128,8 @@ $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputResult != null && Object.hasOwnProperty.call(message, "outputResult")) + $root.google.cloud.retail.v2beta.OutputResult.encode(message.outputResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -89471,6 +95172,9 @@ case 2: message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); break; + case 3: + message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -89520,6 +95224,11 @@ if (error) return "errorsConfig." + error; } + if (message.outputResult != null && message.hasOwnProperty("outputResult")) { + var error = $root.google.cloud.retail.v2beta.OutputResult.verify(message.outputResult); + if (error) + return "outputResult." + error; + } return null; }; @@ -89550,6 +95259,11 @@ throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.errorsConfig: object expected"); message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); } + if (object.outputResult != null) { + if (typeof object.outputResult !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportProductsResponse.outputResult: object expected"); + message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.fromObject(object.outputResult); + } return message; }; @@ -89568,8 +95282,10 @@ var object = {}; if (options.arrays || options.defaults) object.errorSamples = []; - if (options.defaults) + if (options.defaults) { object.errorsConfig = null; + object.outputResult = null; + } if (message.errorSamples && message.errorSamples.length) { object.errorSamples = []; for (var j = 0; j < message.errorSamples.length; ++j) @@ -89577,6 +95293,8 @@ } if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.outputResult != null && message.hasOwnProperty("outputResult")) + object.outputResult = $root.google.cloud.retail.v2beta.OutputResult.toObject(message.outputResult, options); return object; }; @@ -89602,6 +95320,7 @@ * @interface IExportUserEventsResponse * @property {Array.|null} [errorSamples] ExportUserEventsResponse errorSamples * @property {google.cloud.retail.v2beta.IExportErrorsConfig|null} [errorsConfig] ExportUserEventsResponse errorsConfig + * @property {google.cloud.retail.v2beta.IOutputResult|null} [outputResult] ExportUserEventsResponse outputResult */ /** @@ -89636,6 +95355,14 @@ */ ExportUserEventsResponse.prototype.errorsConfig = null; + /** + * ExportUserEventsResponse outputResult. + * @member {google.cloud.retail.v2beta.IOutputResult|null|undefined} outputResult + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @instance + */ + ExportUserEventsResponse.prototype.outputResult = null; + /** * Creates a new ExportUserEventsResponse instance using the specified properties. * @function create @@ -89665,6 +95392,8 @@ $root.google.rpc.Status.encode(message.errorSamples[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) $root.google.cloud.retail.v2beta.ExportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputResult != null && Object.hasOwnProperty.call(message, "outputResult")) + $root.google.cloud.retail.v2beta.OutputResult.encode(message.outputResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -89707,6 +95436,9 @@ case 2: message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); break; + case 3: + message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -89756,6 +95488,11 @@ if (error) return "errorsConfig." + error; } + if (message.outputResult != null && message.hasOwnProperty("outputResult")) { + var error = $root.google.cloud.retail.v2beta.OutputResult.verify(message.outputResult); + if (error) + return "outputResult." + error; + } return null; }; @@ -89786,6 +95523,11 @@ throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.errorsConfig: object expected"); message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.fromObject(object.errorsConfig); } + if (object.outputResult != null) { + if (typeof object.outputResult !== "object") + throw TypeError(".google.cloud.retail.v2beta.ExportUserEventsResponse.outputResult: object expected"); + message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.fromObject(object.outputResult); + } return message; }; @@ -89804,8 +95546,10 @@ var object = {}; if (options.arrays || options.defaults) object.errorSamples = []; - if (options.defaults) + if (options.defaults) { object.errorsConfig = null; + object.outputResult = null; + } if (message.errorSamples && message.errorSamples.length) { object.errorSamples = []; for (var j = 0; j < message.errorSamples.length; ++j) @@ -89813,6 +95557,8 @@ } if (message.errorsConfig != null && message.hasOwnProperty("errorsConfig")) object.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.toObject(message.errorsConfig, options); + if (message.outputResult != null && message.hasOwnProperty("outputResult")) + object.outputResult = $root.google.cloud.retail.v2beta.OutputResult.toObject(message.outputResult, options); return object; }; @@ -89830,6 +95576,424 @@ return ExportUserEventsResponse; })(); + v2beta.OutputResult = (function() { + + /** + * Properties of an OutputResult. + * @memberof google.cloud.retail.v2beta + * @interface IOutputResult + * @property {Array.|null} [bigqueryResult] OutputResult bigqueryResult + */ + + /** + * Constructs a new OutputResult. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an OutputResult. + * @implements IOutputResult + * @constructor + * @param {google.cloud.retail.v2beta.IOutputResult=} [properties] Properties to set + */ + function OutputResult(properties) { + this.bigqueryResult = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputResult bigqueryResult. + * @member {Array.} bigqueryResult + * @memberof google.cloud.retail.v2beta.OutputResult + * @instance + */ + OutputResult.prototype.bigqueryResult = $util.emptyArray; + + /** + * Creates a new OutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {google.cloud.retail.v2beta.IOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.OutputResult} OutputResult instance + */ + OutputResult.create = function create(properties) { + return new OutputResult(properties); + }; + + /** + * Encodes the specified OutputResult message. Does not implicitly {@link google.cloud.retail.v2beta.OutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {google.cloud.retail.v2beta.IOutputResult} message OutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bigqueryResult != null && message.bigqueryResult.length) + for (var i = 0; i < message.bigqueryResult.length; ++i) + $root.google.cloud.retail.v2beta.BigQueryOutputResult.encode(message.bigqueryResult[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.OutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {google.cloud.retail.v2beta.IOutputResult} message OutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.OutputResult} OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.OutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.bigqueryResult && message.bigqueryResult.length)) + message.bigqueryResult = []; + message.bigqueryResult.push($root.google.cloud.retail.v2beta.BigQueryOutputResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.OutputResult} OutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bigqueryResult != null && message.hasOwnProperty("bigqueryResult")) { + if (!Array.isArray(message.bigqueryResult)) + return "bigqueryResult: array expected"; + for (var i = 0; i < message.bigqueryResult.length; ++i) { + var error = $root.google.cloud.retail.v2beta.BigQueryOutputResult.verify(message.bigqueryResult[i]); + if (error) + return "bigqueryResult." + error; + } + } + return null; + }; + + /** + * Creates an OutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.OutputResult} OutputResult + */ + OutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.OutputResult) + return object; + var message = new $root.google.cloud.retail.v2beta.OutputResult(); + if (object.bigqueryResult) { + if (!Array.isArray(object.bigqueryResult)) + throw TypeError(".google.cloud.retail.v2beta.OutputResult.bigqueryResult: array expected"); + message.bigqueryResult = []; + for (var i = 0; i < object.bigqueryResult.length; ++i) { + if (typeof object.bigqueryResult[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.OutputResult.bigqueryResult: object expected"); + message.bigqueryResult[i] = $root.google.cloud.retail.v2beta.BigQueryOutputResult.fromObject(object.bigqueryResult[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {google.cloud.retail.v2beta.OutputResult} message OutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.bigqueryResult = []; + if (message.bigqueryResult && message.bigqueryResult.length) { + object.bigqueryResult = []; + for (var j = 0; j < message.bigqueryResult.length; ++j) + object.bigqueryResult[j] = $root.google.cloud.retail.v2beta.BigQueryOutputResult.toObject(message.bigqueryResult[j], options); + } + return object; + }; + + /** + * Converts this OutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.OutputResult + * @instance + * @returns {Object.} JSON object + */ + OutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OutputResult; + })(); + + v2beta.BigQueryOutputResult = (function() { + + /** + * Properties of a BigQueryOutputResult. + * @memberof google.cloud.retail.v2beta + * @interface IBigQueryOutputResult + * @property {string|null} [datasetId] BigQueryOutputResult datasetId + * @property {string|null} [tableId] BigQueryOutputResult tableId + */ + + /** + * Constructs a new BigQueryOutputResult. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a BigQueryOutputResult. + * @implements IBigQueryOutputResult + * @constructor + * @param {google.cloud.retail.v2beta.IBigQueryOutputResult=} [properties] Properties to set + */ + function BigQueryOutputResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQueryOutputResult datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @instance + */ + BigQueryOutputResult.prototype.datasetId = ""; + + /** + * BigQueryOutputResult tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @instance + */ + BigQueryOutputResult.prototype.tableId = ""; + + /** + * Creates a new BigQueryOutputResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2beta.IBigQueryOutputResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.BigQueryOutputResult} BigQueryOutputResult instance + */ + BigQueryOutputResult.create = function create(properties) { + return new BigQueryOutputResult(properties); + }; + + /** + * Encodes the specified BigQueryOutputResult message. Does not implicitly {@link google.cloud.retail.v2beta.BigQueryOutputResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2beta.IBigQueryOutputResult} message BigQueryOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOutputResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + return writer; + }; + + /** + * Encodes the specified BigQueryOutputResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BigQueryOutputResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2beta.IBigQueryOutputResult} message BigQueryOutputResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOutputResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.BigQueryOutputResult} BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOutputResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BigQueryOutputResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.datasetId = reader.string(); + break; + case 2: + message.tableId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryOutputResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.BigQueryOutputResult} BigQueryOutputResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOutputResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryOutputResult message. + * @function verify + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryOutputResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + return null; + }; + + /** + * Creates a BigQueryOutputResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.BigQueryOutputResult} BigQueryOutputResult + */ + BigQueryOutputResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.BigQueryOutputResult) + return object; + var message = new $root.google.cloud.retail.v2beta.BigQueryOutputResult(); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + return message; + }; + + /** + * Creates a plain object from a BigQueryOutputResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {google.cloud.retail.v2beta.BigQueryOutputResult} message BigQueryOutputResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryOutputResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.datasetId = ""; + object.tableId = ""; + } + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + return object; + }; + + /** + * Converts this BigQueryOutputResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @instance + * @returns {Object.} JSON object + */ + BigQueryOutputResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQueryOutputResult; + })(); + v2beta.PredictionService = (function() { /** diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 9454ba85c9d..3c4bb5ba2e1 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -1347,13 +1347,19 @@ "responseType": "PredictResponse", "options": { "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "(google.api.http).additional_bindings.body": "*" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "body": "*" + } } } ] @@ -1382,7 +1388,10 @@ }, "pageToken": { "type": "string", - "id": 4 + "id": 4, + "options": { + "deprecated": true + } }, "filter": { "type": "string", @@ -2045,13 +2054,19 @@ "responseType": "SearchResponse", "options": { "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "(google.api.http).additional_bindings.body": "*" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "body": "*" + } } } ] @@ -2225,6 +2240,10 @@ "type": "string", "id": 9 }, + "caseInsensitive": { + "type": "bool", + "id": 10 + }, "orderBy": { "type": "string", "id": 4 @@ -2232,6 +2251,10 @@ "query": { "type": "string", "id": 5 + }, + "returnMinMax": { + "type": "bool", + "id": 11 } } } @@ -2467,6 +2490,14 @@ "count": { "type": "int64", "id": 3 + }, + "minValue": { + "type": "double", + "id": 5 + }, + "maxValue": { + "type": "double", + "id": 6 } } } @@ -2737,6 +2768,10 @@ "searchableOption": { "type": "SearchableOption", "id": 7 + }, + "recommendationsFilteringOption": { + "type": "RecommendationsFilteringOption", + "id": 8 } }, "nested": { @@ -2954,6 +2989,13 @@ "SOLUTION_TYPE_SEARCH": 2 } }, + "RecommendationsFilteringOption": { + "values": { + "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": 0, + "RECOMMENDATIONS_FILTERING_DISABLED": 1, + "RECOMMENDATIONS_FILTERING_ENABLED": 3 + } + }, "SearchSolutionUseCase": { "values": { "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": 0, @@ -3217,6 +3259,7 @@ "type": "bool", "id": 3, "options": { + "deprecated": true, "proto3_optional": true } }, @@ -3224,6 +3267,7 @@ "type": "bool", "id": 4, "options": { + "deprecated": true, "proto3_optional": true } } @@ -3541,6 +3585,10 @@ "notificationPubsubTopic": { "type": "string", "id": 7 + }, + "skipDefaultBranchProtection": { + "type": "bool", + "id": 8 } }, "nested": { @@ -4746,13 +4794,19 @@ "responseType": "SearchResponse", "options": { "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "(google.api.http).additional_bindings.body": "*" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "body": "*" + } } } ] @@ -4760,6 +4814,13 @@ } }, "SearchRequest": { + "oneofs": { + "_spellCorrectionSpec": { + "oneof": [ + "spellCorrectionSpec" + ] + } + }, "fields": { "placement": { "type": "string", @@ -4855,6 +4916,18 @@ "personalizationSpec": { "type": "PersonalizationSpec", "id": 32 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "spellCorrectionSpec": { + "type": "SpellCorrectionSpec", + "id": 35, + "options": { + "proto3_optional": true + } } }, "nested": { @@ -4911,6 +4984,10 @@ "type": "string", "id": 9 }, + "caseInsensitive": { + "type": "bool", + "id": 10 + }, "orderBy": { "type": "string", "id": 4 @@ -4918,6 +4995,10 @@ "query": { "type": "string", "id": 5 + }, + "returnMinMax": { + "type": "bool", + "id": 11 } } } @@ -5015,6 +5096,23 @@ } } }, + "SpellCorrectionSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "SUGGESTION_ONLY": 1, + "AUTO": 2 + } + } + } + }, "RelevanceThreshold": { "values": { "RELEVANCE_THRESHOLD_UNSPECIFIED": 0, @@ -5145,6 +5243,14 @@ "count": { "type": "int64", "id": 3 + }, + "minValue": { + "type": "double", + "id": 5 + }, + "maxValue": { + "type": "double", + "id": 6 } } } @@ -5164,43 +5270,591 @@ } } }, - "ControlService": { + "ControlService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateControl": { + "requestType": "CreateControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.http).body": "control", + "(google.api.method_signature)": "parent,control,control_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "body": "control" + } + }, + { + "(google.api.method_signature)": "parent,control,control_id" + } + ] + }, + "DeleteControl": { + "requestType": "DeleteControlRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateControl": { + "requestType": "UpdateControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).patch": "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.http).body": "control", + "(google.api.method_signature)": "control,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "body": "control" + } + }, + { + "(google.api.method_signature)": "control,update_mask" + } + ] + }, + "GetControl": { + "requestType": "GetControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListControls": { + "requestType": "ListControlsRequest", + "responseType": "ListControlsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "CreateControlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "control": { + "type": "Control", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "controlId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateControlRequest": { + "fields": { + "control": { + "type": "Control", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteControlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" + } + } + } + }, + "GetControlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" + } + } + } + }, + "ListControlsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListControlsResponse": { + "fields": { + "controls": { + "rule": "repeated", + "type": "Control", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ExportErrorsConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsPrefix" + ] + } + }, + "fields": { + "gcsPrefix": { + "type": "string", + "id": 1 + } + } + }, + "ExportMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "ExportProductsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + }, + "outputResult": { + "type": "OutputResult", + "id": 3 + } + } + }, + "ExportUserEventsResponse": { + "fields": { + "errorSamples": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "errorsConfig": { + "type": "ExportErrorsConfig", + "id": 2 + }, + "outputResult": { + "type": "OutputResult", + "id": 3 + } + } + }, + "OutputResult": { + "fields": { + "bigqueryResult": { + "rule": "repeated", + "type": "BigQueryOutputResult", + "id": 1 + } + } + }, + "BigQueryOutputResult": { + "fields": { + "datasetId": { + "type": "string", + "id": 1 + }, + "tableId": { + "type": "string", + "id": 2 + } + } + }, + "Model": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Model", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}" + }, + "oneofs": { + "trainingConfig": { + "oneof": [ + "pageOptimizationConfig" + ] + } + }, + "fields": { + "pageOptimizationConfig": { + "type": "PageOptimizationConfig", + "id": 17, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "trainingState": { + "type": "TrainingState", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "servingState": { + "type": "ServingState", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "optimizationObjective": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "periodicTuningState": { + "type": "PeriodicTuningState", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "lastTuneTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tuningOperation": { + "type": "string", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dataState": { + "type": "DataState", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "filteringOption": { + "type": "RecommendationsFilteringOption", + "id": 18, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "servingConfigLists": { + "rule": "repeated", + "type": "ServingConfigList", + "id": 19, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "PageOptimizationConfig": { + "fields": { + "pageOptimizationEventType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "panels": { + "rule": "repeated", + "type": "Panel", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "restriction": { + "type": "Restriction", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Candidate": { + "oneofs": { + "candidate": { + "oneof": [ + "servingConfigId" + ] + } + }, + "fields": { + "servingConfigId": { + "type": "string", + "id": 1 + } + } + }, + "Panel": { + "fields": { + "displayName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "candidates": { + "rule": "repeated", + "type": "Candidate", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "defaultCandidate": { + "type": "Candidate", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "Restriction": { + "values": { + "RESTRICTION_UNSPECIFIED": 0, + "NO_RESTRICTION": 1, + "UNIQUE_SERVING_CONFIG_RESTRICTION": 2, + "UNIQUE_MODEL_RESTRICTION": 3, + "UNIQUE_MODEL_TYPE_RESTRICTION": 4 + } + } + } + }, + "ServingConfigList": { + "fields": { + "servingConfigIds": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ServingState": { + "values": { + "SERVING_STATE_UNSPECIFIED": 0, + "INACTIVE": 1, + "ACTIVE": 2, + "TUNED": 3 + } + }, + "TrainingState": { + "values": { + "TRAINING_STATE_UNSPECIFIED": 0, + "PAUSED": 1, + "TRAINING": 2 + } + }, + "PeriodicTuningState": { + "values": { + "PERIODIC_TUNING_STATE_UNSPECIFIED": 0, + "PERIODIC_TUNING_DISABLED": 1, + "ALL_TUNING_DISABLED": 3, + "PERIODIC_TUNING_ENABLED": 2 + } + }, + "DataState": { + "values": { + "DATA_STATE_UNSPECIFIED": 0, + "DATA_OK": 1, + "DATA_ERROR": 2 + } + } + } + }, + "ModelService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "CreateControl": { - "requestType": "CreateControlRequest", - "responseType": "Control", + "CreateModel": { + "requestType": "CreateModelRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", - "(google.api.http).body": "control", - "(google.api.method_signature)": "parent,control,control_id" + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models", + "(google.api.http).body": "model", + "(google.api.method_signature)": "parent,model", + "(google.longrunning.operation_info).response_type": "Model", + "(google.longrunning.operation_info).metadata_type": "CreateModelMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", - "body": "control" + "post": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models", + "body": "model" } }, { - "(google.api.method_signature)": "parent,control,control_id" + "(google.api.method_signature)": "parent,model" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Model", + "metadata_type": "CreateModelMetadata" + } } ] }, - "DeleteControl": { - "requestType": "DeleteControlRequest", - "responseType": "google.protobuf.Empty", + "PauseModel": { + "requestType": "PauseModelRequest", + "responseType": "Model", "options": { - "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.http).post": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:pause", + "(google.api.http).body": "*", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + "post": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:pause", + "body": "*" } }, { @@ -5208,37 +5862,37 @@ } ] }, - "UpdateControl": { - "requestType": "UpdateControlRequest", - "responseType": "Control", + "ResumeModel": { + "requestType": "ResumeModelRequest", + "responseType": "Model", "options": { - "(google.api.http).patch": "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}", - "(google.api.http).body": "control", - "(google.api.method_signature)": "control,update_mask" + "(google.api.http).post": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:resume", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "patch": "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}", - "body": "control" + "post": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:resume", + "body": "*" } }, { - "(google.api.method_signature)": "control,update_mask" + "(google.api.method_signature)": "name" } ] }, - "GetControl": { - "requestType": "GetControlRequest", - "responseType": "Control", + "DeleteModel": { + "requestType": "DeleteModelRequest", + "responseType": "google.protobuf.Empty", "options": { - "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" + "delete": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}" } }, { @@ -5246,27 +5900,75 @@ } ] }, - "ListControls": { - "requestType": "ListControlsRequest", - "responseType": "ListControlsResponse", + "ListModels": { + "requestType": "ListModelsRequest", + "responseType": "ListModelsResponse", "options": { - "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models", "(google.api.method_signature)": "parent" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" + "get": "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" } }, { "(google.api.method_signature)": "parent" } ] + }, + "UpdateModel": { + "requestType": "UpdateModelRequest", + "responseType": "Model", + "options": { + "(google.api.http).patch": "/v2alpha/{model.name=projects/*/locations/*/catalogs/*/models/*}", + "(google.api.http).body": "model", + "(google.api.method_signature)": "model,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{model.name=projects/*/locations/*/catalogs/*/models/*}", + "body": "model" + } + }, + { + "(google.api.method_signature)": "model,update_mask" + } + ] + }, + "TuneModel": { + "requestType": "TuneModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:tune", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "TuneModelResponse", + "(google.longrunning.operation_info).metadata_type": "TuneModelMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:tune", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "TuneModelResponse", + "metadata_type": "TuneModelMetadata" + } + } + ] } } }, - "CreateControlRequest": { + "CreateModelRequest": { "fields": { "parent": { "type": "string", @@ -5276,26 +5978,26 @@ "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "control": { - "type": "Control", + "model": { + "type": "Model", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "controlId": { - "type": "string", + "dryRun": { + "type": "bool", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } } } }, - "UpdateControlRequest": { + "UpdateModelRequest": { "fields": { - "control": { - "type": "Control", + "model": { + "type": "Model", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" @@ -5303,35 +6005,37 @@ }, "updateMask": { "type": "google.protobuf.FieldMask", - "id": 2 + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, - "DeleteControlRequest": { + "PauseModelRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Control" + "(google.api.resource_reference).type": "retail.googleapis.com/Model" } } } }, - "GetControlRequest": { + "ResumeModelRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Control" + "(google.api.field_behavior)": "REQUIRED" } } } }, - "ListControlsRequest": { + "ListModelsRequest": { "fields": { "parent": { "type": "string", @@ -5354,21 +6058,26 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } - }, - "filter": { + } + } + }, + "DeleteModelRequest": { + "fields": { + "name": { "type": "string", - "id": 4, + "id": 1, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Model" } } } }, - "ListControlsResponse": { + "ListModelsResponse": { "fields": { - "controls": { + "models": { "rule": "repeated", - "type": "Control", + "type": "Model", "id": 1 }, "nextPageToken": { @@ -5377,58 +6086,36 @@ } } }, - "ExportErrorsConfig": { - "oneofs": { - "destination": { - "oneof": [ - "gcsPrefix" - ] - } - }, + "TuneModelRequest": { "fields": { - "gcsPrefix": { + "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Model" + } } } }, - "ExportMetadata": { + "CreateModelMetadata": { "fields": { - "createTime": { - "type": "google.protobuf.Timestamp", + "model": { + "type": "string", "id": 1 - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 2 } } }, - "ExportProductsResponse": { + "TuneModelMetadata": { "fields": { - "errorSamples": { - "rule": "repeated", - "type": "google.rpc.Status", + "model": { + "type": "string", "id": 1 - }, - "errorsConfig": { - "type": "ExportErrorsConfig", - "id": 2 } } }, - "ExportUserEventsResponse": { - "fields": { - "errorSamples": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 1 - }, - "errorsConfig": { - "type": "ExportErrorsConfig", - "id": 2 - } - } + "TuneModelResponse": { + "fields": {} }, "PredictionService": { "options": { @@ -5441,13 +6128,19 @@ "responseType": "PredictResponse", "options": { "(google.api.http).post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "(google.api.http).additional_bindings.body": "*" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "body": "*" + } } } ] @@ -5476,7 +6169,10 @@ }, "pageToken": { "type": "string", - "id": 4 + "id": 4, + "options": { + "deprecated": true + } }, "filter": { "type": "string", @@ -6194,7 +6890,8 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, "filter": { @@ -6848,6 +7545,10 @@ "searchableOption": { "type": "SearchableOption", "id": 7 + }, + "recommendationsFilteringOption": { + "type": "RecommendationsFilteringOption", + "id": 8 } }, "nested": { @@ -7065,6 +7766,13 @@ "SOLUTION_TYPE_SEARCH": 2 } }, + "RecommendationsFilteringOption": { + "values": { + "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": 0, + "RECOMMENDATIONS_FILTERING_DISABLED": 1, + "RECOMMENDATIONS_FILTERING_ENABLED": 3 + } + }, "SearchSolutionUseCase": { "values": { "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": 0, @@ -7328,6 +8036,7 @@ "type": "bool", "id": 3, "options": { + "deprecated": true, "proto3_optional": true } }, @@ -7335,6 +8044,7 @@ "type": "bool", "id": 4, "options": { + "deprecated": true, "proto3_optional": true } } @@ -8849,13 +9559,19 @@ "responseType": "SearchResponse", "options": { "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "(google.api.http).additional_bindings.body": "*" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "body": "*" + } } } ] @@ -8863,6 +9579,13 @@ } }, "SearchRequest": { + "oneofs": { + "_spellCorrectionSpec": { + "oneof": [ + "spellCorrectionSpec" + ] + } + }, "fields": { "placement": { "type": "string", @@ -8954,6 +9677,18 @@ "personalizationSpec": { "type": "PersonalizationSpec", "id": 32 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "spellCorrectionSpec": { + "type": "SpellCorrectionSpec", + "id": 35, + "options": { + "proto3_optional": true + } } }, "nested": { @@ -9010,6 +9745,10 @@ "type": "string", "id": 9 }, + "caseInsensitive": { + "type": "bool", + "id": 10 + }, "orderBy": { "type": "string", "id": 4 @@ -9017,6 +9756,10 @@ "query": { "type": "string", "id": 5 + }, + "returnMinMax": { + "type": "bool", + "id": 11 } } } @@ -9114,6 +9857,23 @@ } } }, + "SpellCorrectionSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "SUGGESTION_ONLY": 1, + "AUTO": 2 + } + } + } + }, "SearchMode": { "values": { "SEARCH_MODE_UNSPECIFIED": 0, @@ -9235,6 +9995,14 @@ "count": { "type": "int64", "id": 3 + }, + "minValue": { + "type": "double", + "id": 5 + }, + "maxValue": { + "type": "double", + "id": 6 } } } @@ -9504,6 +10272,10 @@ "errorsConfig": { "type": "ExportErrorsConfig", "id": 2 + }, + "outputResult": { + "type": "OutputResult", + "id": 3 } } }, @@ -9517,6 +10289,31 @@ "errorsConfig": { "type": "ExportErrorsConfig", "id": 2 + }, + "outputResult": { + "type": "OutputResult", + "id": 3 + } + } + }, + "OutputResult": { + "fields": { + "bigqueryResult": { + "rule": "repeated", + "type": "BigQueryOutputResult", + "id": 1 + } + } + }, + "BigQueryOutputResult": { + "fields": { + "datasetId": { + "type": "string", + "id": 1 + }, + "tableId": { + "type": "string", + "id": 2 } } }, @@ -9531,13 +10328,19 @@ "responseType": "PredictResponse", "options": { "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*" + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "(google.api.http).additional_bindings.body": "*" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "body": "*" + } } } ] @@ -10193,7 +10996,8 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, "filter": { diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index 51c1efcdbd8..7ae47a8bab8 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -46,6 +46,8 @@ function main(catalog, query) { */ // const visitorId = 'abc123' /** + * Note that this field applies for `user-data` dataset only. For requests + * with `cloud-retail` dataset, setting this field has no effect. * The language filters applied to the output suggestions. If set, it should * contain the language of the query. If not set, suggestions are returned * without considering language restrictions. This is the BCP-47 language diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index d2db6c72062..2f9d68f7a5d 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -27,13 +27,18 @@ function main(placement, userEvent) { */ /** * Required. Full resource name of the format: - * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} - * The ID of the Recommendations AI placement. Before you can request - * predictions from your model, you must create at least one placement for it. - * For more information, see Managing - * placements (https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). - * The full list of available placements can be seen at - * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` + * or + * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. + * We recommend using the `servingConfigs` resource. `placements` is a legacy + * resource. + * The ID of the Recommendations AI serving config or placement. + * Before you can request predictions from your model, you must create at + * least one serving config or placement for it. For more information, see + * Managing serving configurations + * (https://cloud.google.com/retail/docs/manage-configs). + * The full list of available serving configs can be seen at + * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs */ // const placement = 'abc123' /** @@ -53,14 +58,14 @@ function main(placement, userEvent) { */ // const userEvent = {} /** - * 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. + * Maximum number of results to return. 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. */ // const pageSize = 1234 /** - * The previous PredictResponse.next_page_token. + * This field is not used; leave it unset. */ // const pageToken = 'abc123' /** @@ -87,6 +92,12 @@ function main(placement, userEvent) { * receive empty results instead. * Note that the API will never return items with storageStatus of "EXPIRED" * or "DELETED" regardless of filter choices. + * If `filterSyntaxV2` is set to true under the `params` field, then + * attribute-based expressions are expected instead of the above described + * tag-based syntax. Examples: + * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + * * (availability: ANY("IN_STOCK")) AND + * (colors: ANY("Red") OR categories: ANY("Phones")) */ // const filter = 'abc123' /** @@ -120,6 +131,8 @@ function main(placement, userEvent) { * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives * request-level control and adjusts prediction results based on product * category. + * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + * field is interpreteted according to the new, attribute-based syntax. */ // const params = 1234 /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js index 79ea0522be9..7c34fa72cba 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js index 4f35c54e91c..769b498c9f2 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -34,8 +34,9 @@ function main(inventory) { * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * The updated inventory fields must be specified in * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask. - * If SetInventoryRequest.inventory.name is empty or invalid, an - * INVALID_ARGUMENT error is returned. + * If + * SetInventoryRequest.inventory.name google.cloud.retail.v2.Product.name + * is empty or invalid, an INVALID_ARGUMENT error is returned. * If the caller does not have permission to update the * Product google.cloud.retail.v2.Product named in * Product.name google.cloud.retail.v2.Product.name, regardless of whether @@ -53,22 +54,25 @@ function main(inventory) { * * Adds "fulfillment_info" in * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in SetInventoryRequest.inventory.fulfillment_info + * to update in + * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: * * Adds "fulfillment_info" in * SetInventoryRequest.set_mask google.cloud.retail.v2.SetInventoryRequest.set_mask * * Specifies only the desired fulfillment types to clear in - * SetInventoryRequest.inventory.fulfillment_info + * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * * Checks that only the desired fulfillment info types have empty - * SetInventoryRequest.inventory.fulfillment_info.place_ids + * SetInventoryRequest.inventory.fulfillment_info.place_ids google.cloud.retail.v2.FulfillmentInfo.place_ids * The last update time is recorded for the following inventory fields: * * Product.price_info google.cloud.retail.v2.Product.price_info * * Product.availability google.cloud.retail.v2.Product.availability * * Product.available_quantity google.cloud.retail.v2.Product.available_quantity * * Product.fulfillment_info google.cloud.retail.v2.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is - * needed, UpdateProduct should be invoked instead. + * needed, + * ProductService.UpdateProduct google.cloud.retail.v2.ProductService.UpdateProduct + * should be invoked instead. */ // const inventory = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 26118e14c07..0003287723c 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -26,7 +26,9 @@ function main(placement, visitorId) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the search engine placement, such as + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index d3ee61cd48a..825b74fd7d1 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -206,7 +206,7 @@ "segments": [ { "start": 25, - "end": 108, + "end": 110, "type": "FULL" } ], @@ -318,7 +318,7 @@ "segments": [ { "start": 25, - "end": 162, + "end": 175, "type": "FULL" } ], @@ -675,14 +675,14 @@ "regionTag": "retail_v2_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 116, + "end": 120, "type": "FULL" } ], @@ -727,14 +727,14 @@ "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 107, + "end": 108, "type": "FULL" } ], @@ -783,7 +783,7 @@ "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", @@ -839,7 +839,7 @@ "regionTag": "retail_v2_generated_ProductService_AddLocalInventories_async", "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", @@ -895,7 +895,7 @@ "regionTag": "retail_v2_generated_ProductService_RemoveLocalInventories_async", "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", @@ -954,7 +954,7 @@ "segments": [ { "start": 25, - "end": 280, + "end": 282, "type": "FULL" } ], diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js index 0a46b0bb0ff..3d89f273f7a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js @@ -27,7 +27,7 @@ function main(attributesConfig, catalogAttribute) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const attributesConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js index 8fe314bf03f..a1a7d124075 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js @@ -27,7 +27,7 @@ function main(name) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js index 81358df93aa..2e2aef6a7b5 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js @@ -27,7 +27,7 @@ function main(attributesConfig, key) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const attributesConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js index 2fdfc582a78..0dccc33e40e 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js @@ -27,7 +27,7 @@ function main(attributesConfig, catalogAttribute) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const attributesConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index 6f768b764ca..bbd71d4b413 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -46,6 +46,8 @@ function main(catalog, query) { */ // const visitorId = 'abc123' /** + * Note that this field applies for `user-data` dataset only. For requests + * with `cloud-retail` dataset, setting this field has no effect. * The language filters applied to the output suggestions. If set, it should * contain the language of the query. If not set, suggestions are returned * without considering language restrictions. This is the BCP-47 language @@ -74,9 +76,9 @@ function main(catalog, query) { * events. If leave empty, it will use the "user-data". * Current supported values: * * user-data - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * guidelines (https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). */ // const dataset = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js index bacd422aea4..6e7030ce2ef 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js @@ -27,7 +27,7 @@ function main(parent, control, controlId) { */ /** * Required. Full resource name of parent catalog. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js index 6afa1e03319..eb25534bae5 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js @@ -27,7 +27,7 @@ function main(name) { */ /** * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js index a0c4c927f9a..344db2f65b2 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js @@ -27,7 +27,7 @@ function main(name) { */ /** * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js index c09815fd97c..6912cc04294 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js @@ -27,7 +27,7 @@ function main(parent) { */ /** * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js new file mode 100644 index 00000000000..b513363d609 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js @@ -0,0 +1,70 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, model) { + // [START retail_v2alpha_generated_ModelService_CreateModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource under which to create the model. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Required. The payload of the Model to create. + */ + // const model = {} + /** + * Optional. Whether to run a dry_run to validate the request (without + * actually creating the model). + */ + // const dryRun = true + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callCreateModel() { + // Construct request + const request = { + parent, + model, + }; + + // Run request + const [operation] = await retailClient.createModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateModel(); + // [END retail_v2alpha_generated_ModelService_CreateModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js new file mode 100644 index 00000000000..8eca3223570 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js @@ -0,0 +1,60 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ModelService_DeleteModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Model to delete. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callDeleteModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteModel(request); + console.log(response); + } + + callDeleteModel(); + // [END retail_v2alpha_generated_ModelService_DeleteModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js new file mode 100644 index 00000000000..3228c3e9f52 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js @@ -0,0 +1,72 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2alpha_generated_ModelService_ListModels_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent for which to list models. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callListModels() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listModelsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListModels(); + // [END retail_v2alpha_generated_ModelService_ListModels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js new file mode 100644 index 00000000000..2975b700d42 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js @@ -0,0 +1,60 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ModelService_PauseModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the model to pause. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callPauseModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.pauseModel(request); + console.log(response); + } + + callPauseModel(); + // [END retail_v2alpha_generated_ModelService_PauseModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js new file mode 100644 index 00000000000..a2b23ab7a0f --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js @@ -0,0 +1,60 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ModelService_ResumeModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the model to resume. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callResumeModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.resumeModel(request); + console.log(response); + } + + callResumeModel(); + // [END retail_v2alpha_generated_ModelService_ResumeModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js new file mode 100644 index 00000000000..1ecddf45f69 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js @@ -0,0 +1,61 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2alpha_generated_ModelService_TuneModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the model to tune. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callTuneModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await retailClient.tuneModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTuneModel(); + // [END retail_v2alpha_generated_ModelService_TuneModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js new file mode 100644 index 00000000000..5bc5b8475fd --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(model) { + // [START retail_v2alpha_generated_ModelService_UpdateModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The body of the updated Model. + */ + // const model = {} + /** + * Optional. Indicates which fields in the provided 'model' to + * update. If not set, will by default update all fields. + */ + // const updateMask = {} + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2alpha; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callUpdateModel() { + // Construct request + const request = { + model, + }; + + // Run request + const response = await retailClient.updateModel(request); + console.log(response); + } + + callUpdateModel(); + // [END retail_v2alpha_generated_ModelService_UpdateModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js index f49c45f1105..71c0ae34341 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -27,13 +27,18 @@ function main(placement, userEvent) { */ /** * Required. Full resource name of the format: - * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} - * The ID of the Recommendations AI placement. Before you can request - * predictions from your model, you must create at least one placement for it. - * For more information, see Managing - * placements (https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). - * The full list of available placements can be seen at - * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` + * or + * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. + * We recommend using the `servingConfigs` resource. `placements` is a legacy + * resource. + * The ID of the Recommendations AI serving config or placement. + * Before you can request predictions from your model, you must create at + * least one serving config or placement for it. For more information, see + * Managing serving configurations + * (https://cloud.google.com/retail/docs/manage-configs). + * The full list of available serving configs can be seen at + * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs */ // const placement = 'abc123' /** @@ -41,6 +46,15 @@ function main(placement, userEvent) { * 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. + * Don't set + * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id or + * UserInfo.user_id google.cloud.retail.v2alpha.UserInfo.user_id to the + * same fixed ID for different users. If you are trying to receive + * non-personalized recommendations (not recommended; this can negatively + * impact model performance), instead set + * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id to + * a random unique ID and leave + * UserInfo.user_id google.cloud.retail.v2alpha.UserInfo.user_id unset. */ // const userEvent = {} /** @@ -51,7 +65,7 @@ function main(placement, userEvent) { */ // const pageSize = 1234 /** - * The previous PredictResponse.next_page_token. + * This field is not used for now; leave it unset. */ // const pageToken = 'abc123' /** @@ -78,6 +92,12 @@ function main(placement, userEvent) { * receive empty results instead. * Note that the API will never return items with storageStatus of "EXPIRED" * or "DELETED" regardless of filter choices. + * If `filterSyntaxV2` is set to true under the `params` field, then + * attribute-based expressions are expected instead of the above described + * tag-based syntax. Examples: + * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + * * (availability: ANY("IN_STOCK")) AND + * (colors: ANY("Red") OR categories: ANY("Phones")) */ // const filter = 'abc123' /** @@ -111,6 +131,8 @@ function main(placement, userEvent) { * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives * request-level control and adjusts prediction results based on product * category. + * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + * field is interpreteted according to the new, attribute-based syntax. */ // const params = 1234 /** @@ -118,7 +140,7 @@ function main(placement, userEvent) { * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js index c15b5aa04f9..0138666545e 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2alpha.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index 26a70a511a4..7eb5abd6fb8 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -52,16 +52,31 @@ function main(parent, inputConfig) { */ // const reconciliationMode = {} /** - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * ImportProductsRequest.parent google.cloud.retail.v2alpha.ImportProductsRequest.parent. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * Only supported when * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode * is set to `FULL`. */ // const notificationPubsubTopic = 'abc123' + /** + * If true, will perform the FULL import even if it would delete a large + * proportion of the products in the default branch, which could potentially + * cause outages if you have live predict/search traffic. + * Only supported when + * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode + * is set to `FULL`. + */ + // const skipDefaultBranchProtection = true // Imports the Retail library const {ProductServiceClient} = require('@google-cloud/retail').v2alpha; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js index 9543acded96..b028c23b516 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2alpha.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index 00d0437657a..69d300387cf 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -34,8 +34,9 @@ function main(inventory) { * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * The updated inventory fields must be specified in * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask. - * If SetInventoryRequest.inventory.name is empty or invalid, an - * INVALID_ARGUMENT error is returned. + * If + * SetInventoryRequest.inventory.name google.cloud.retail.v2alpha.Product.name + * is empty or invalid, an INVALID_ARGUMENT error is returned. * If the caller does not have permission to update the * Product google.cloud.retail.v2alpha.Product named in * Product.name google.cloud.retail.v2alpha.Product.name, regardless of @@ -53,22 +54,25 @@ function main(inventory) { * * Adds "fulfillment_info" in * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in SetInventoryRequest.inventory.fulfillment_info + * to update in + * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: * * Adds "fulfillment_info" in * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask * * Specifies only the desired fulfillment types to clear in - * SetInventoryRequest.inventory.fulfillment_info + * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * * Checks that only the desired fulfillment info types have empty - * SetInventoryRequest.inventory.fulfillment_info.place_ids + * SetInventoryRequest.inventory.fulfillment_info.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids * The last update time is recorded for the following inventory fields: * * Product.price_info google.cloud.retail.v2alpha.Product.price_info * * Product.availability google.cloud.retail.v2alpha.Product.availability * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is - * needed, UpdateProduct should be invoked instead. + * needed, + * ProductService.UpdateProduct google.cloud.retail.v2alpha.ProductService.UpdateProduct + * should be invoked instead. */ // const inventory = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js index db9b00e442a..c12933853a3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js @@ -43,6 +43,10 @@ function main(product) { * fields that are neither immutable nor output only) are updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. */ // const updateMask = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index 9c4c8b0daa5..2c2f990e139 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -26,8 +26,10 @@ function main(placement, visitorId) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -41,6 +43,10 @@ function main(placement, visitorId) { // const branch = 'abc123' /** * Raw search query. + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * filter google.cloud.retail.v2alpha.SearchRequest.filter and + * page_categories google.cloud.retail.v2alpha.SearchRequest.page_categories. */ // const query = 'abc123' /** @@ -129,10 +135,11 @@ function main(placement, visitorId) { * user guide (https://cloud.google.com/retail/docs/boosting). * Notice that if both * ServingConfig.boost_control_ids google.cloud.retail.v2alpha.ServingConfig.boost_control_ids - * and SearchRequest.boost_spec are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * SearchRequest.boost_spec google.cloud.retail.v2alpha.SearchRequest.boost_spec + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. */ // const boostSpec = {} /** @@ -175,7 +182,8 @@ function main(placement, visitorId) { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * Product.inventories.attributes map. + * Product.local_inventories.attributes google.cloud.retail.v2alpha.LocalInventory.attributes + * map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2alpha.Product.attributes map. * * pickupInStore.id, where id is any @@ -249,6 +257,29 @@ function main(placement, visitorId) { * The specification for personalization. */ // const personalizationSpec = {} + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + /** + * The spell correction specification that specifies the mode under + * which spell correction will take effect. + */ + // const spellCorrectionSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2alpha; diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js index 5a4982b7ffb..3c9aecf971b 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js @@ -27,7 +27,7 @@ function main(parent, servingConfig, servingConfigId) { */ /** * Required. Full resource name of parent. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index b58f3b170d4..a90411114f3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -510,7 +510,7 @@ "segments": [ { "start": 25, - "end": 109, + "end": 111, "type": "FULL" } ], @@ -835,6 +835,306 @@ } } }, + { + "regionTag": "retail_v2alpha_generated_ModelService_CreateModel_async", + "title": "CatalogService createModel Sample", + "origin": "API_DEFINITION", + "description": " Creates a new model.", + "canonical": true, + "file": "model_service.create_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.CreateModel", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": ".google.cloud.retail.v2alpha.Model" + }, + { + "name": "dry_run", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "CreateModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.CreateModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ModelService_PauseModel_async", + "title": "CatalogService pauseModel Sample", + "origin": "API_DEFINITION", + "description": " Pauses the training of an existing model.", + "canonical": true, + "file": "model_service.pause_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PauseModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.PauseModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Model", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "PauseModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.PauseModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ModelService_ResumeModel_async", + "title": "CatalogService resumeModel Sample", + "origin": "API_DEFINITION", + "description": " Resumes the training of an existing model.", + "canonical": true, + "file": "model_service.resume_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResumeModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.ResumeModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Model", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "ResumeModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.ResumeModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ModelService_DeleteModel_async", + "title": "CatalogService deleteModel Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing model.", + "canonical": true, + "file": "model_service.delete_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.DeleteModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "DeleteModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.DeleteModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ModelService_ListModels_async", + "title": "CatalogService listModels Sample", + "origin": "API_DEFINITION", + "description": " Lists all the models linked to this event store.", + "canonical": true, + "file": "model_service.list_models.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListModels", + "fullName": "google.cloud.retail.v2alpha.ModelService.ListModels", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2alpha.ListModelsResponse", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "ListModels", + "fullName": "google.cloud.retail.v2alpha.ModelService.ListModels", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ModelService_UpdateModel_async", + "title": "CatalogService updateModel Sample", + "origin": "API_DEFINITION", + "description": " Update of model metadata. Only fields that currently can be updated are: filtering_option, periodic_tuning_state. If other values are provided, this API method will ignore them.", + "canonical": true, + "file": "model_service.update_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.UpdateModel", + "async": true, + "parameters": [ + { + "name": "model", + "type": ".google.cloud.retail.v2alpha.Model" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2alpha.Model", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "UpdateModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.UpdateModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2alpha_generated_ModelService_TuneModel_async", + "title": "CatalogService tuneModel Sample", + "origin": "API_DEFINITION", + "description": " Tunes an existing model.", + "canonical": true, + "file": "model_service.tune_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TuneModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.TuneModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" + }, + "method": { + "shortName": "TuneModel", + "fullName": "google.cloud.retail.v2alpha.ModelService.TuneModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2alpha.ModelService" + } + } + } + }, { "regionTag": "retail_v2alpha_generated_PredictionService_Predict_async", "title": "CatalogService predict Sample", @@ -846,7 +1146,7 @@ "segments": [ { "start": 25, - "end": 153, + "end": 175, "type": "FULL" } ], @@ -1062,7 +1362,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 76, "type": "FULL" } ], @@ -1143,7 +1443,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_PurgeProducts_async", "title": "CatalogService purgeProducts Sample", "origin": "API_DEFINITION", - "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", + "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", "canonical": true, "file": "product_service.purge_products.js", "language": "JAVASCRIPT", @@ -1191,14 +1491,14 @@ "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", "title": "CatalogService importProducts Sample", "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.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.v2alpha.Product]s to be successfully updated.", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. Request processing may be synchronous. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2alpha.Product]s to be successfully updated.", "canonical": true, "file": "product_service.import_products.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 85, + "end": 100, "type": "FULL" } ], @@ -1234,6 +1534,10 @@ { "name": "notification_pubsub_topic", "type": "TYPE_STRING" + }, + { + "name": "skip_default_branch_protection", + "type": "TYPE_BOOL" } ], "resultType": ".google.longrunning.Operation", @@ -1255,14 +1559,14 @@ "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 116, + "end": 120, "type": "FULL" } ], @@ -1307,14 +1611,14 @@ "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 107, + "end": 108, "type": "FULL" } ], @@ -1363,14 +1667,14 @@ "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 103, + "end": 104, "type": "FULL" } ], @@ -1419,7 +1723,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", @@ -1475,7 +1779,7 @@ "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", @@ -1534,7 +1838,7 @@ "segments": [ { "start": 25, - "end": 273, + "end": 304, "type": "FULL" } ], @@ -1622,6 +1926,14 @@ { "name": "personalization_spec", "type": ".google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "spell_correction_spec", + "type": ".google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec" } ], "resultType": ".google.cloud.retail.v2alpha.SearchResponse", diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js index 553e710302f..47dc4c03f49 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js @@ -27,7 +27,7 @@ function main(attributesConfig, catalogAttribute) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const attributesConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js index b6c393bd9e7..3efc7660648 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js @@ -27,7 +27,7 @@ function main(name) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js index b6d4473a671..17518d6a10c 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js @@ -27,7 +27,7 @@ function main(attributesConfig, key) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const attributesConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js index 42548549680..985e2cc2282 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js @@ -27,7 +27,7 @@ function main(attributesConfig, catalogAttribute) { */ /** * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` */ // const attributesConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index 28957ff1dec..579619105d4 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -46,6 +46,8 @@ function main(catalog, query) { */ // const visitorId = 'abc123' /** + * Note that this field applies for `user-data` dataset only. For requests + * with `cloud-retail` dataset, setting this field has no effect. * The language filters applied to the output suggestions. If set, it should * contain the language of the query. If not set, suggestions are returned * without considering language restrictions. This is the BCP-47 language @@ -74,9 +76,9 @@ function main(catalog, query) { * events. If leave empty, it will use the "user-data". * Current supported values: * * user-data - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * guidelines (https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). */ // const dataset = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js index 670ed9d8a67..916ddf4b1a1 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js @@ -27,7 +27,7 @@ function main(parent, control, controlId) { */ /** * Required. Full resource name of parent catalog. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js index fa6173821d2..e77c5d0a730 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js @@ -27,7 +27,7 @@ function main(name) { */ /** * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js index dcc21c72055..135577e7a2a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js @@ -27,7 +27,7 @@ function main(name) { */ /** * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js index 5de3859ca7a..32dafdb39e5 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js @@ -27,7 +27,7 @@ function main(parent) { */ /** * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index 38b9394ccae..e85ebf4f124 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -27,13 +27,18 @@ function main(placement, userEvent) { */ /** * Required. Full resource name of the format: - * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} - * The ID of the Recommendations AI placement. Before you can request - * predictions from your model, you must create at least one placement for it. - * For more information, see Managing - * placements (https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). - * The full list of available placements can be seen at - * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` + * or + * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. + * We recommend using the `servingConfigs` resource. `placements` is a legacy + * resource. + * The ID of the Recommendations AI serving config or placement. + * Before you can request predictions from your model, you must create at + * least one serving config or placement for it. For more information, see + * Managing serving configurations + * (https://cloud.google.com/retail/docs/manage-configs). + * The full list of available serving configs can be seen at + * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs */ // const placement = 'abc123' /** @@ -41,6 +46,15 @@ function main(placement, userEvent) { * 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. + * Don't set + * UserEvent.visitor_id google.cloud.retail.v2beta.UserEvent.visitor_id or + * UserInfo.user_id google.cloud.retail.v2beta.UserInfo.user_id to the same + * fixed ID for different users. If you are trying to receive non-personalized + * recommendations (not recommended; this can negatively impact model + * performance), instead set + * UserEvent.visitor_id google.cloud.retail.v2beta.UserEvent.visitor_id to + * a random unique ID and leave + * UserInfo.user_id google.cloud.retail.v2beta.UserInfo.user_id unset. */ // const userEvent = {} /** @@ -51,7 +65,7 @@ function main(placement, userEvent) { */ // const pageSize = 1234 /** - * The previous PredictResponse.next_page_token. + * This field is not used for now; leave it unset. */ // const pageToken = 'abc123' /** @@ -78,6 +92,12 @@ function main(placement, userEvent) { * receive empty results instead. * Note that the API will never return items with storageStatus of "EXPIRED" * or "DELETED" regardless of filter choices. + * If `filterSyntaxV2` is set to true under the `params` field, then + * attribute-based expressions are expected instead of the above described + * tag-based syntax. Examples: + * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + * * (availability: ANY("IN_STOCK")) AND + * (colors: ANY("Red") OR categories: ANY("Phones")) */ // const filter = 'abc123' /** @@ -111,6 +131,8 @@ function main(placement, userEvent) { * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives * request-level control and adjusts prediction results based on product * category. + * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + * field is interpreteted according to the new, attribute-based syntax. */ // const params = 1234 /** @@ -118,7 +140,7 @@ function main(placement, userEvent) { * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js index f25e375ddc9..da14011cf26 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2beta.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index f7fe86da064..a6b6cab95ad 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -52,11 +52,17 @@ function main(parent, inputConfig) { */ // const reconciliationMode = {} /** - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * ImportProductsRequest.parent google.cloud.retail.v2beta.ImportProductsRequest.parent. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * Only supported when * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode * is set to `FULL`. diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js index 3163edcb7fa..f6346b05926 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2beta.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js index ac7ceefff47..454263cae2f 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -34,8 +34,9 @@ function main(inventory) { * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * The updated inventory fields must be specified in * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask. - * If SetInventoryRequest.inventory.name is empty or invalid, an - * INVALID_ARGUMENT error is returned. + * If + * SetInventoryRequest.inventory.name google.cloud.retail.v2beta.Product.name + * is empty or invalid, an INVALID_ARGUMENT error is returned. * If the caller does not have permission to update the * Product google.cloud.retail.v2beta.Product named in * Product.name google.cloud.retail.v2beta.Product.name, regardless of @@ -53,22 +54,25 @@ function main(inventory) { * * Adds "fulfillment_info" in * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in SetInventoryRequest.inventory.fulfillment_info + * to update in + * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: * * Adds "fulfillment_info" in * SetInventoryRequest.set_mask google.cloud.retail.v2beta.SetInventoryRequest.set_mask * * Specifies only the desired fulfillment types to clear in - * SetInventoryRequest.inventory.fulfillment_info + * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * * Checks that only the desired fulfillment info types have empty - * SetInventoryRequest.inventory.fulfillment_info.place_ids + * SetInventoryRequest.inventory.fulfillment_info.place_ids google.cloud.retail.v2beta.FulfillmentInfo.place_ids * The last update time is recorded for the following inventory fields: * * Product.price_info google.cloud.retail.v2beta.Product.price_info * * Product.availability google.cloud.retail.v2beta.Product.availability * * Product.available_quantity google.cloud.retail.v2beta.Product.available_quantity * * Product.fulfillment_info google.cloud.retail.v2beta.Product.fulfillment_info * If a full overwrite of inventory information while ignoring timestamps is - * needed, UpdateProduct should be invoked instead. + * needed, + * ProductService.UpdateProduct google.cloud.retail.v2beta.ProductService.UpdateProduct + * should be invoked instead. */ // const inventory = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js index ed319228b47..1337de86e3a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js @@ -43,6 +43,10 @@ function main(product) { * fields that are neither immutable nor output only) are updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. */ // const updateMask = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index 62f1df1e9be..64fcd971150 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -26,8 +26,10 @@ function main(placement, visitorId) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -41,6 +43,10 @@ function main(placement, visitorId) { // const branch = 'abc123' /** * Raw search query. + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * filter google.cloud.retail.v2beta.SearchRequest.filter and + * page_categories google.cloud.retail.v2beta.SearchRequest.page_categories. */ // const query = 'abc123' /** @@ -127,10 +133,11 @@ function main(placement, visitorId) { * user guide (https://cloud.google.com/retail/docs/boosting). * Notice that if both * ServingConfig.boost_control_ids google.cloud.retail.v2beta.ServingConfig.boost_control_ids - * and SearchRequest.boost_spec are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * SearchRequest.boost_spec google.cloud.retail.v2beta.SearchRequest.boost_spec + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. */ // const boostSpec = {} /** @@ -164,7 +171,8 @@ function main(placement, visitorId) { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * Product.inventories.attributes map. + * Product.local_inventories.attributes google.cloud.retail.v2beta.LocalInventory.attributes + * map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2beta.Product.attributes map. * * pickupInStore.id, where id is any @@ -229,6 +237,29 @@ function main(placement, visitorId) { * The specification for personalization. */ // const personalizationSpec = {} + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + /** + * The spell correction specification that specifies the mode under + * which spell correction will take effect. + */ + // const spellCorrectionSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2beta; diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js index fc8ba733c16..7cd44e74eb9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js @@ -27,7 +27,7 @@ function main(parent, servingConfig, servingConfigId) { */ /** * Required. Full resource name of parent. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 5dd4727274a..6241946aee8 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -510,7 +510,7 @@ "segments": [ { "start": 25, - "end": 109, + "end": 111, "type": "FULL" } ], @@ -846,7 +846,7 @@ "segments": [ { "start": 25, - "end": 153, + "end": 175, "type": "FULL" } ], @@ -1058,7 +1058,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 76, "type": "FULL" } ], @@ -1139,14 +1139,14 @@ "regionTag": "retail_v2beta_generated_ProductService_ImportProducts_async", "title": "CatalogService importProducts Sample", "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2beta.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.v2beta.Product]s to be successfully updated.", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2beta.Product]s. Request processing may be synchronous. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2beta.Product]s to be successfully updated.", "canonical": true, "file": "product_service.import_products.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 85, + "end": 91, "type": "FULL" } ], @@ -1203,14 +1203,14 @@ "regionTag": "retail_v2beta_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 116, + "end": 120, "type": "FULL" } ], @@ -1255,14 +1255,14 @@ "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 107, + "end": 108, "type": "FULL" } ], @@ -1311,14 +1311,14 @@ "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 103, + "end": 104, "type": "FULL" } ], @@ -1367,7 +1367,7 @@ "regionTag": "retail_v2beta_generated_ProductService_AddLocalInventories_async", "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", @@ -1423,7 +1423,7 @@ "regionTag": "retail_v2beta_generated_ProductService_RemoveLocalInventories_async", "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", @@ -1482,7 +1482,7 @@ "segments": [ { "start": 25, - "end": 253, + "end": 284, "type": "FULL" } ], @@ -1566,6 +1566,14 @@ { "name": "personalization_spec", "type": ".google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "spell_correction_spec", + "type": ".google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec" } ], "resultType": ".google.cloud.retail.v2beta.SearchResponse", diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index d32c514bc41..244bf337517 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class CatalogServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; catalogServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class CatalogServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -188,6 +194,44 @@ export class CatalogServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2.CatalogService', @@ -887,6 +931,263 @@ export class CatalogServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1135,6 +1436,8 @@ export class CatalogServiceClient { return this.catalogServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index 2839667e3d0..c9e701a1db9 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -25,6 +25,8 @@ import { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -63,6 +65,7 @@ export class CompletionServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; completionServiceStub?: Promise<{[name: string]: Function}>; @@ -142,6 +145,7 @@ export class CompletionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -383,6 +387,9 @@ export class CompletionServiceClient { * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {string[]} request.languageCodes + * Note that this field applies for `user-data` dataset only. For requests + * with `cloud-retail` dataset, setting this field has no effect. + * * The language filters applied to the output suggestions. If set, it should * contain the language of the query. If not set, suggestions are returned * without considering language restrictions. This is the BCP-47 language @@ -658,6 +665,263 @@ export class CompletionServiceClient { protos.google.cloud.retail.v2.ImportMetadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -803,6 +1067,7 @@ export class CompletionServiceClient { return this.completionServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 1107dccb567..ed9846755ff 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -18,7 +18,15 @@ /* global window */ import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -28,7 +36,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -53,7 +61,9 @@ export class PredictionServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; predictionServiceStub?: Promise<{[name: string]: Function}>; /** @@ -131,6 +141,7 @@ export class PredictionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -162,6 +173,44 @@ export class PredictionServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2.PredictionService', @@ -300,14 +349,19 @@ export class PredictionServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. Full resource name of the format: - * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} - * The ID of the Recommendations AI placement. Before you can request - * predictions from your model, you must create at least one placement for it. - * For more information, see [Managing - * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). - * - * The full list of available placements can be seen at - * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` + * or + * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. + * We recommend using the `servingConfigs` resource. `placements` is a legacy + * resource. + * The ID of the Recommendations AI serving config or placement. + * Before you can request predictions from your model, you must create at + * least one serving config or placement for it. For more information, see + * [Managing serving configurations] + * (https://cloud.google.com/retail/docs/manage-configs). + * + * The full list of available serving configs can be seen at + * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs * @param {google.cloud.retail.v2.UserEvent} request.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 @@ -324,12 +378,12 @@ export class PredictionServiceClient { * random unique ID and leave * {@link google.cloud.retail.v2.UserInfo.user_id|UserInfo.user_id} unset. * @param {number} request.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. + * Maximum number of results to return. 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. * @param {string} request.pageToken - * The previous PredictResponse.next_page_token. + * This field is not used; leave it unset. * @param {string} request.filter * Filter for restricting prediction results with a length limit of 5,000 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. @@ -360,6 +414,14 @@ export class PredictionServiceClient { * receive empty results instead. * Note that the API will never return items with storageStatus of "EXPIRED" * or "DELETED" regardless of filter choices. + * + * If `filterSyntaxV2` is set to true under the `params` field, then + * attribute-based expressions are expected instead of the above described + * tag-based syntax. Examples: + * + * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + * * (availability: ANY("IN_STOCK")) AND + * (colors: ANY("Red") OR categories: ANY("Phones")) * @param {boolean} request.validateOnly * Use validate only mode for this prediction query. If set to true, a * dummy model will be used that returns arbitrary products. @@ -391,6 +453,8 @@ export class PredictionServiceClient { * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives * request-level control and adjusts prediction results based on product * category. + * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + * field is interpreteted according to the new, attribute-based syntax. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -486,6 +550,263 @@ export class PredictionServiceClient { return this.innerApiCalls.predict(request, options, callback); } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -631,6 +952,8 @@ export class PredictionServiceClient { return this.predictionServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index b8f05a0da1a..c4f1aa02663 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -27,6 +27,8 @@ import { LROperation, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -65,6 +67,7 @@ export class ProductServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; productServiceStub?: Promise<{[name: string]: Function}>; @@ -144,6 +147,7 @@ export class ProductServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -1049,18 +1053,21 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, updates are not immediately manifested in the * {@link google.cloud.retail.v2.Product|Product} queried by - * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * When inventory is updated with - * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} and - * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct}, the - * specified inventory field value(s) will overwrite any existing value(s) + * {@link google.cloud.retail.v2.ProductService.CreateProduct|ProductService.CreateProduct} + * and + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct}, + * the specified inventory field value(s) will overwrite any existing value(s) * while ignoring the last update time for this field. Furthermore, the last * update time for the specified inventory fields will be overwritten to the * time of the - * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} or - * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2.ProductService.CreateProduct|ProductService.CreateProduct} + * or + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} * request. * * If no inventory fields are set in @@ -1072,10 +1079,10 @@ export class ProductServiceClient { * then any existing inventory information will be preserved. * * Pre-existing inventory information can only be updated with - * {@link google.cloud.retail.v2.ProductService.SetInventory|SetInventory}, + * {@link google.cloud.retail.v2.ProductService.SetInventory|ProductService.SetInventory}, * {@link google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, * and - * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. + * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1085,6 +1092,7 @@ export class ProductServiceClient { * @param {google.cloud.retail.v2.Product} request.inventory * Required. The inventory information to update. The allowable fields to * update are: + * * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} * * {@link google.cloud.retail.v2.Product.availability|Product.availability} * * {@link google.cloud.retail.v2.Product.available_quantity|Product.available_quantity} @@ -1092,8 +1100,9 @@ export class ProductServiceClient { * The updated inventory fields must be specified in * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. * - * If {@link |SetInventoryRequest.inventory.name} is empty or invalid, an - * INVALID_ARGUMENT error is returned. + * If + * {@link google.cloud.retail.v2.Product.name|SetInventoryRequest.inventory.name} + * is empty or invalid, an INVALID_ARGUMENT error is returned. * * If the caller does not have permission to update the * {@link google.cloud.retail.v2.Product|Product} named in @@ -1116,7 +1125,8 @@ export class ProductServiceClient { * * Adds "fulfillment_info" in * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in {@link |SetInventoryRequest.inventory.fulfillment_info} + * to update in + * {@link google.cloud.retail.v2.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: @@ -1124,9 +1134,9 @@ export class ProductServiceClient { * * Adds "fulfillment_info" in * {@link google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types to clear in - * {@link |SetInventoryRequest.inventory.fulfillment_info} + * {@link google.cloud.retail.v2.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * Checks that only the desired fulfillment info types have empty - * {@link |SetInventoryRequest.inventory.fulfillment_info.place_ids} + * {@link google.cloud.retail.v2.FulfillmentInfo.place_ids|SetInventoryRequest.inventory.fulfillment_info.place_ids} * * The last update time is recorded for the following inventory fields: * * {@link google.cloud.retail.v2.Product.price_info|Product.price_info} @@ -1135,7 +1145,9 @@ export class ProductServiceClient { * * {@link google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info} * * If a full overwrite of inventory information while ignoring timestamps is - * needed, {@link |UpdateProduct} should be invoked instead. + * needed, + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} + * should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided * {@link google.cloud.retail.v2.Product|Product} to update. @@ -1295,8 +1307,9 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, the added place IDs are not immediately manifested in the * {@link google.cloud.retail.v2.Product|Product} queried by - * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1330,7 +1343,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type}, such as @@ -1498,8 +1512,9 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, the removed place IDs are not immediately manifested in the * {@link google.cloud.retail.v2.Product|Product} queried by - * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1702,13 +1717,15 @@ export class ProductServiceClient { * and processed downstream. As a consequence, when a response is returned, * updates are not immediately manifested in the * {@link google.cloud.retail.v2.Product|Product} queried by - * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * Local inventory information can only be modified using this method. - * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} and - * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct} has no - * effect on local inventories. + * {@link google.cloud.retail.v2.ProductService.CreateProduct|ProductService.CreateProduct} + * and + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} + * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1892,13 +1909,15 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, removals are not immediately manifested in the * {@link google.cloud.retail.v2.Product|Product} queried by - * {@link google.cloud.retail.v2.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * Local inventory information can only be removed using this method. - * {@link google.cloud.retail.v2.ProductService.CreateProduct|CreateProduct} and - * {@link google.cloud.retail.v2.ProductService.UpdateProduct|UpdateProduct} has no - * effect on local inventories. + * {@link google.cloud.retail.v2.ProductService.CreateProduct|ProductService.CreateProduct} + * and + * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} + * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -2445,6 +2464,263 @@ export class ProductServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -2657,6 +2933,7 @@ export class ProductServiceClient { return this.productServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index d11787df88c..058ed7c082c 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -65,7 +68,9 @@ export class SearchServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; searchServiceStub?: Promise<{[name: string]: Function}>; /** @@ -143,6 +148,7 @@ export class SearchServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -188,6 +194,44 @@ export class SearchServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2.SearchService', @@ -329,7 +373,9 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. @@ -631,7 +677,9 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. @@ -889,7 +937,9 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. @@ -1140,6 +1190,263 @@ export class SearchServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1352,6 +1659,8 @@ export class SearchServiceClient { return this.searchServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 69ff6bed199..21df7dbdce4 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -25,6 +25,8 @@ import { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -60,6 +62,7 @@ export class UserEventServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; userEventServiceStub?: Promise<{[name: string]: Function}>; @@ -139,6 +142,7 @@ export class UserEventServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -1038,6 +1042,263 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2.RejoinUserEventsMetadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1183,6 +1444,7 @@ export class UserEventServiceClient { return this.userEventServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index eb6f3cd8990..a57e83249b7 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class CatalogServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; catalogServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class CatalogServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -181,6 +187,9 @@ export class CatalogServiceClient { locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -200,6 +209,44 @@ export class CatalogServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2alpha.CatalogService', @@ -911,7 +958,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.name * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1132,7 +1179,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.attributesConfig * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute * Required. The * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to add. @@ -1238,7 +1285,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.attributesConfig * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {string} request.key * Required. The attribute name key of the * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to remove. @@ -1350,7 +1397,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.attributesConfig * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute * Required. The updated * {@link google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}. @@ -1701,6 +1748,263 @@ export class CatalogServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -2034,6 +2338,68 @@ export class CatalogServiceClient { return this.pathTemplates.locationPathTemplate.match(locationName).location; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -2197,6 +2563,8 @@ export class CatalogServiceClient { return this.catalogServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index f4a2288b477..97b80ad9162 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -25,6 +25,8 @@ import { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -63,6 +65,7 @@ export class CompletionServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; completionServiceStub?: Promise<{[name: string]: Function}>; @@ -142,6 +145,7 @@ export class CompletionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -177,6 +181,9 @@ export class CompletionServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -395,6 +402,9 @@ export class CompletionServiceClient { * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {string[]} request.languageCodes + * Note that this field applies for `user-data` dataset only. For requests + * with `cloud-retail` dataset, setting this field has no effect. + * * The language filters applied to the output suggestions. If set, it should * contain the language of the query. If not set, suggestions are returned * without considering language restrictions. This is the BCP-47 language @@ -427,9 +437,9 @@ export class CompletionServiceClient { * * * user-data * - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). * @param {number} request.maxSuggestions * Completion max suggestions. If left unset or set to 0, then will fallback * to the configured value @@ -677,6 +687,263 @@ export class CompletionServiceClient { protos.google.cloud.retail.v2alpha.ImportMetadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -907,6 +1174,68 @@ export class CompletionServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -1070,6 +1399,7 @@ export class CompletionServiceClient { return this.completionServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts index b42b3b07685..6c5021768c9 100644 --- a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './control_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class ControlServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; controlServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class ControlServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -175,6 +181,9 @@ export class ControlServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -194,6 +203,44 @@ export class ControlServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2alpha.ControlService', @@ -341,7 +388,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. Full resource name of parent catalog. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {google.cloud.retail.v2alpha.Control} request.control * Required. The Control to create. * @param {string} request.controlId @@ -444,7 +491,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -640,7 +687,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -727,7 +774,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 50. Max allowed value is 1000. @@ -835,7 +882,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 50. Max allowed value is 1000. @@ -891,7 +938,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 50. Max allowed value is 1000. @@ -939,6 +986,263 @@ export class ControlServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1169,6 +1473,68 @@ export class ControlServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -1332,6 +1698,8 @@ export class ControlServiceClient { return this.controlServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/control_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json index aeabbe198a7..89ef22cebb6 100644 --- a/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2alpha/gapic_metadata.json @@ -235,6 +235,94 @@ } } }, + "ModelService": { + "clients": { + "grpc": { + "libraryClient": "ModelServiceClient", + "rpcs": { + "PauseModel": { + "methods": [ + "pauseModel" + ] + }, + "ResumeModel": { + "methods": [ + "resumeModel" + ] + }, + "DeleteModel": { + "methods": [ + "deleteModel" + ] + }, + "UpdateModel": { + "methods": [ + "updateModel" + ] + }, + "CreateModel": { + "methods": [ + "createModel" + ] + }, + "TuneModel": { + "methods": [ + "tuneModel" + ] + }, + "ListModels": { + "methods": [ + "listModels", + "listModelsStream", + "listModelsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ModelServiceClient", + "rpcs": { + "PauseModel": { + "methods": [ + "pauseModel" + ] + }, + "ResumeModel": { + "methods": [ + "resumeModel" + ] + }, + "DeleteModel": { + "methods": [ + "deleteModel" + ] + }, + "UpdateModel": { + "methods": [ + "updateModel" + ] + }, + "CreateModel": { + "methods": [ + "createModel" + ] + }, + "TuneModel": { + "methods": [ + "tuneModel" + ] + }, + "ListModels": { + "methods": [ + "listModels", + "listModelsStream", + "listModelsAsync" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { diff --git a/packages/google-cloud-retail/src/v2alpha/index.ts b/packages/google-cloud-retail/src/v2alpha/index.ts index a7e4f6ba79f..74f290ddf79 100644 --- a/packages/google-cloud-retail/src/v2alpha/index.ts +++ b/packages/google-cloud-retail/src/v2alpha/index.ts @@ -19,6 +19,7 @@ export {CatalogServiceClient} from './catalog_service_client'; export {CompletionServiceClient} from './completion_service_client'; export {ControlServiceClient} from './control_service_client'; +export {ModelServiceClient} from './model_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; export {SearchServiceClient} from './search_service_client'; diff --git a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts new file mode 100644 index 00000000000..2b4cbec924b --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts @@ -0,0 +1,1968 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/model_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './model_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for performing CRUD operations on models. + * Recommendation models contain all the metadata necessary to generate a set of + * models for the Predict() api. A model is queried + * indirectly via a ServingConfig, which associates a model with a + * given Placement (e.g. Frequently Bought Together on Home Page). + * + * This service allows customers to e.g.: + * + * * Initiate training of a model. + * * Pause training of an existing model. + * * List all the available models along with their metadata. + * * Control their tuning schedule. + * @class + * @memberof v2alpha + */ +export class ModelServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + modelServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ModelServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ModelServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listModels: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'models' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createModelResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.Model' + ) as gax.protobuf.Type; + const createModelMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.CreateModelMetadata' + ) as gax.protobuf.Type; + const tuneModelResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.TuneModelResponse' + ) as gax.protobuf.Type; + const tuneModelMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2alpha.TuneModelMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createModelResponse.decode.bind(createModelResponse), + createModelMetadata.decode.bind(createModelMetadata) + ), + tuneModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + tuneModelResponse.decode.bind(tuneModelResponse), + tuneModelMetadata.decode.bind(tuneModelMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2alpha.ModelService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.modelServiceStub) { + return this.modelServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2alpha.ModelService. + this.modelServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2alpha.ModelService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2alpha.ModelService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const modelServiceStubMethods = [ + 'createModel', + 'pauseModel', + 'resumeModel', + 'deleteModel', + 'listModels', + 'updateModel', + 'tuneModel', + ]; + for (const methodName of modelServiceStubMethods) { + const callPromise = this.modelServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.modelServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Pauses the training of an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the model to pause. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Model]{@link google.cloud.retail.v2alpha.Model}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.pause_model.js + * region_tag:retail_v2alpha_generated_ModelService_PauseModel_async + */ + pauseModel( + request?: protos.google.cloud.retail.v2alpha.IPauseModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IPauseModelRequest | undefined, + {} | undefined + ] + >; + pauseModel( + request: protos.google.cloud.retail.v2alpha.IPauseModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IPauseModelRequest | null | undefined, + {} | null | undefined + > + ): void; + pauseModel( + request: protos.google.cloud.retail.v2alpha.IPauseModelRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IPauseModelRequest | null | undefined, + {} | null | undefined + > + ): void; + pauseModel( + request?: protos.google.cloud.retail.v2alpha.IPauseModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IModel, + | protos.google.cloud.retail.v2alpha.IPauseModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IPauseModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IPauseModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.pauseModel(request, options, callback); + } + /** + * Resumes the training of an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the model to resume. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Model]{@link google.cloud.retail.v2alpha.Model}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.resume_model.js + * region_tag:retail_v2alpha_generated_ModelService_ResumeModel_async + */ + resumeModel( + request?: protos.google.cloud.retail.v2alpha.IResumeModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IResumeModelRequest | undefined, + {} | undefined + ] + >; + resumeModel( + request: protos.google.cloud.retail.v2alpha.IResumeModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IResumeModelRequest | null | undefined, + {} | null | undefined + > + ): void; + resumeModel( + request: protos.google.cloud.retail.v2alpha.IResumeModelRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IResumeModelRequest | null | undefined, + {} | null | undefined + > + ): void; + resumeModel( + request?: protos.google.cloud.retail.v2alpha.IResumeModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IModel, + | protos.google.cloud.retail.v2alpha.IResumeModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IResumeModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IResumeModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.resumeModel(request, options, callback); + } + /** + * Deletes an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the [Model] to delete. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.delete_model.js + * region_tag:retail_v2alpha_generated_ModelService_DeleteModel_async + */ + deleteModel( + request?: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteModelRequest | undefined, + {} | undefined + ] + >; + deleteModel( + request: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteModelRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteModel( + request: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteModelRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteModel( + request?: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2alpha.IDeleteModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2alpha.IDeleteModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteModel(request, options, callback); + } + /** + * Update of model metadata. Only fields that + * currently can be updated are: filtering_option, periodic_tuning_state. + * If other values are provided, this API method will ignore them. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2alpha.Model} request.model + * Required. The body of the updated [Model]. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Indicates which fields in the provided 'model' to + * update. If not set, will by default update all fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Model]{@link google.cloud.retail.v2alpha.Model}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.update_model.js + * region_tag:retail_v2alpha_generated_ModelService_UpdateModel_async + */ + updateModel( + request?: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IUpdateModelRequest | undefined, + {} | undefined + ] + >; + updateModel( + request: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IUpdateModelRequest | null | undefined, + {} | null | undefined + > + ): void; + updateModel( + request: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, + callback: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IUpdateModelRequest | null | undefined, + {} | null | undefined + > + ): void; + updateModel( + request?: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2alpha.IModel, + | protos.google.cloud.retail.v2alpha.IUpdateModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IUpdateModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.IUpdateModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'model.name': request.model!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateModel(request, options, callback); + } + + /** + * Creates a new model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource under which to create the model. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {google.cloud.retail.v2alpha.Model} request.model + * Required. The payload of the [Model] to create. + * @param {boolean} [request.dryRun] + * Optional. Whether to run a dry_run to validate the request (without + * actually creating the model). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.create_model.js + * region_tag:retail_v2alpha_generated_ModelService_CreateModel_async + */ + createModel( + request?: protos.google.cloud.retail.v2alpha.ICreateModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createModel( + request: protos.google.cloud.retail.v2alpha.ICreateModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createModel( + request: protos.google.cloud.retail.v2alpha.ICreateModelRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createModel( + request?: protos.google.cloud.retail.v2alpha.ICreateModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createModel(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.create_model.js + * region_tag:retail_v2alpha_generated_ModelService_CreateModel_async + */ + async checkCreateModelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.Model, + protos.google.cloud.retail.v2alpha.CreateModelMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createModel, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.Model, + protos.google.cloud.retail.v2alpha.CreateModelMetadata + >; + } + /** + * Tunes an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the model to tune. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.tune_model.js + * region_tag:retail_v2alpha_generated_ModelService_TuneModel_async + */ + tuneModel( + request?: protos.google.cloud.retail.v2alpha.ITuneModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + tuneModel( + request: protos.google.cloud.retail.v2alpha.ITuneModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + tuneModel( + request: protos.google.cloud.retail.v2alpha.ITuneModelRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + tuneModel( + request?: protos.google.cloud.retail.v2alpha.ITuneModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.tuneModel(request, options, callback); + } + /** + * Check the status of the long running operation returned by `tuneModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.tune_model.js + * region_tag:retail_v2alpha_generated_ModelService_TuneModel_async + */ + async checkTuneModelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2alpha.TuneModelResponse, + protos.google.cloud.retail.v2alpha.TuneModelMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.tuneModel, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2alpha.TuneModelResponse, + protos.google.cloud.retail.v2alpha.TuneModelMetadata + >; + } + /** + * Lists all the models linked to this event store. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for which to list models. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Model]{@link google.cloud.retail.v2alpha.Model}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listModelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listModels( + request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel[], + protos.google.cloud.retail.v2alpha.IListModelsRequest | null, + protos.google.cloud.retail.v2alpha.IListModelsResponse + ] + >; + listModels( + request: protos.google.cloud.retail.v2alpha.IListModelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListModelsRequest, + protos.google.cloud.retail.v2alpha.IListModelsResponse | null | undefined, + protos.google.cloud.retail.v2alpha.IModel + > + ): void; + listModels( + request: protos.google.cloud.retail.v2alpha.IListModelsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListModelsRequest, + protos.google.cloud.retail.v2alpha.IListModelsResponse | null | undefined, + protos.google.cloud.retail.v2alpha.IModel + > + ): void; + listModels( + request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2alpha.IListModelsRequest, + | protos.google.cloud.retail.v2alpha.IListModelsResponse + | null + | undefined, + protos.google.cloud.retail.v2alpha.IModel + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2alpha.IListModelsRequest, + protos.google.cloud.retail.v2alpha.IListModelsResponse | null | undefined, + protos.google.cloud.retail.v2alpha.IModel + > + ): Promise< + [ + protos.google.cloud.retail.v2alpha.IModel[], + protos.google.cloud.retail.v2alpha.IListModelsRequest | null, + protos.google.cloud.retail.v2alpha.IListModelsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listModels(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for which to list models. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Model]{@link google.cloud.retail.v2alpha.Model} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listModelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listModelsStream( + request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listModels.createStream( + this.innerApiCalls.listModels as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listModels`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for which to list models. + * Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Model]{@link google.cloud.retail.v2alpha.Model}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2alpha/model_service.list_models.js + * region_tag:retail_v2alpha_generated_ModelService_ListModels_async + */ + listModelsAsync( + request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listModels.asyncIterate( + this.innerApiCalls['listModels'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.modelServiceStub && !this._terminated) { + return this.modelServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/model_service_client_config.json b/packages/google-cloud-retail/src/v2alpha/model_service_client_config.json new file mode 100644 index 00000000000..282bed5605e --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/model_service_client_config.json @@ -0,0 +1,61 @@ +{ + "interfaces": { + "google.cloud.retail.v2alpha.ModelService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateModel": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "PauseModel": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ResumeModel": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteModel": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListModels": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateModel": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "TuneModel": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2alpha/model_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/model_service_proto_list.json new file mode 100644 index 00000000000..50adbaecf53 --- /dev/null +++ b/packages/google-cloud-retail/src/v2alpha/model_service_proto_list.json @@ -0,0 +1,22 @@ +[ + "../../protos/google/cloud/retail/v2alpha/catalog.proto", + "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", + "../../protos/google/cloud/retail/v2alpha/common.proto", + "../../protos/google/cloud/retail/v2alpha/completion_service.proto", + "../../protos/google/cloud/retail/v2alpha/control.proto", + "../../protos/google/cloud/retail/v2alpha/control_service.proto", + "../../protos/google/cloud/retail/v2alpha/export_config.proto", + "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", + "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", + "../../protos/google/cloud/retail/v2alpha/product.proto", + "../../protos/google/cloud/retail/v2alpha/product_service.proto", + "../../protos/google/cloud/retail/v2alpha/promotion.proto", + "../../protos/google/cloud/retail/v2alpha/purge_config.proto", + "../../protos/google/cloud/retail/v2alpha/search_service.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config.proto", + "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", + "../../protos/google/cloud/retail/v2alpha/user_event.proto", + "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index f7f8862dab8..05b791fec05 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -18,7 +18,15 @@ /* global window */ import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -28,7 +36,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -53,7 +61,9 @@ export class PredictionServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; predictionServiceStub?: Promise<{[name: string]: Function}>; /** @@ -131,6 +141,7 @@ export class PredictionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -166,6 +177,9 @@ export class PredictionServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -174,6 +188,44 @@ export class PredictionServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2alpha.PredictionService', @@ -312,26 +364,41 @@ export class PredictionServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. Full resource name of the format: - * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} - * The ID of the Recommendations AI placement. Before you can request - * predictions from your model, you must create at least one placement for it. - * For more information, see [Managing - * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). - * - * The full list of available placements can be seen at - * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` + * or + * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. + * We recommend using the `servingConfigs` resource. `placements` is a legacy + * resource. + * The ID of the Recommendations AI serving config or placement. + * Before you can request predictions from your model, you must create at + * least one serving config or placement for it. For more information, see + * [Managing serving configurations] + * (https://cloud.google.com/retail/docs/manage-configs). + * + * The full list of available serving configs can be seen at + * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs * @param {google.cloud.retail.v2alpha.UserEvent} request.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. + * + * Don't set + * {@link google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id} or + * {@link google.cloud.retail.v2alpha.UserInfo.user_id|UserInfo.user_id} to the + * same fixed ID for different users. If you are trying to receive + * non-personalized recommendations (not recommended; this can negatively + * impact model performance), instead set + * {@link google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id} to + * a random unique ID and leave + * {@link google.cloud.retail.v2alpha.UserInfo.user_id|UserInfo.user_id} unset. * @param {number} request.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. * @param {string} request.pageToken - * The previous PredictResponse.next_page_token. + * This field is not used for now; leave it unset. * @param {string} request.filter * Filter for restricting prediction results with a length limit of 5,000 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. @@ -362,6 +429,14 @@ export class PredictionServiceClient { * receive empty results instead. * Note that the API will never return items with storageStatus of "EXPIRED" * or "DELETED" regardless of filter choices. + * + * If `filterSyntaxV2` is set to true under the `params` field, then + * attribute-based expressions are expected instead of the above described + * tag-based syntax. Examples: + * + * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + * * (availability: ANY("IN_STOCK")) AND + * (colors: ANY("Red") OR categories: ANY("Phones")) * @param {boolean} request.validateOnly * Use validate only mode for this prediction query. If set to true, a * dummy model will be used that returns arbitrary products. @@ -393,13 +468,15 @@ export class PredictionServiceClient { * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives * request-level control and adjusts prediction results based on product * category. + * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + * field is interpreteted according to the new, attribute-based syntax. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and @@ -488,6 +565,263 @@ export class PredictionServiceClient { return this.innerApiCalls.predict(request, options, callback); } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -718,6 +1052,68 @@ export class PredictionServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -881,6 +1277,8 @@ export class PredictionServiceClient { return this.predictionServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 14a2f414dd9..21cd856ed07 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -27,6 +27,8 @@ import { LROperation, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -65,6 +67,7 @@ export class ProductServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; productServiceStub?: Promise<{[name: string]: Function}>; @@ -144,6 +147,7 @@ export class ProductServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -182,6 +186,9 @@ export class ProductServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -700,6 +707,11 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. * @param {boolean} request.allowMissing * If set to true, and the {@link google.cloud.retail.v2alpha.Product|Product} is * not found, a new {@link google.cloud.retail.v2alpha.Product|Product} will be @@ -910,8 +922,9 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2alpha.Product|Product}s, this operation could take * hours to complete. Before the operation completes, some * {@link google.cloud.retail.v2alpha.Product|Product}s may still be returned by - * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. * * Depending on the number of {@link google.cloud.retail.v2alpha.Product|Product}s, * this operation could take hours to complete. To get a sample of @@ -1103,7 +1116,7 @@ export class ProductServiceClient { /** * Bulk import of multiple {@link google.cloud.retail.v2alpha.Product|Product}s. * - * Request processing may be synchronous. No partial updating is supported. + * Request processing may be synchronous. * Non-existing items are created. * * Note that it is possible for a subset of the @@ -1131,11 +1144,26 @@ export class ProductServiceClient { * imported. Defaults to * {@link google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * {@link google.cloud.retail.v2alpha.ImportProductsRequest.parent|ImportProductsRequest.parent}. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. + * + * Only supported when + * {@link google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} + * is set to `FULL`. + * @param {boolean} request.skipDefaultBranchProtection + * If true, will perform the FULL import even if it would delete a large + * proportion of the products in the default branch, which could potentially + * cause outages if you have live predict/search traffic. * * Only supported when * {@link google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} @@ -1281,20 +1309,21 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, updates are not immediately manifested in the * {@link google.cloud.retail.v2alpha.Product|Product} queried by - * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. * * When inventory is updated with - * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} * and - * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct}, + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct}, * the specified inventory field value(s) will overwrite any existing value(s) * while ignoring the last update time for this field. Furthermore, the last * update time for the specified inventory fields will be overwritten to the * time of the - * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} * or - * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} * request. * * If no inventory fields are set in @@ -1306,10 +1335,10 @@ export class ProductServiceClient { * then any existing inventory information will be preserved. * * Pre-existing inventory information can only be updated with - * {@link google.cloud.retail.v2alpha.ProductService.SetInventory|SetInventory}, - * {@link google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * {@link google.cloud.retail.v2alpha.ProductService.SetInventory|ProductService.SetInventory}, + * {@link google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, * and - * {@link google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. + * {@link google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1319,6 +1348,7 @@ export class ProductServiceClient { * @param {google.cloud.retail.v2alpha.Product} request.inventory * Required. The inventory information to update. The allowable fields to * update are: + * * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} * * {@link google.cloud.retail.v2alpha.Product.availability|Product.availability} * * {@link google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} @@ -1326,8 +1356,9 @@ export class ProductServiceClient { * The updated inventory fields must be specified in * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. * - * If {@link |SetInventoryRequest.inventory.name} is empty or invalid, an - * INVALID_ARGUMENT error is returned. + * If + * {@link google.cloud.retail.v2alpha.Product.name|SetInventoryRequest.inventory.name} + * is empty or invalid, an INVALID_ARGUMENT error is returned. * * If the caller does not have permission to update the * {@link google.cloud.retail.v2alpha.Product|Product} named in @@ -1350,7 +1381,8 @@ export class ProductServiceClient { * * Adds "fulfillment_info" in * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in {@link |SetInventoryRequest.inventory.fulfillment_info} + * to update in + * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: @@ -1358,9 +1390,9 @@ export class ProductServiceClient { * * Adds "fulfillment_info" in * {@link google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types to clear in - * {@link |SetInventoryRequest.inventory.fulfillment_info} + * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * Checks that only the desired fulfillment info types have empty - * {@link |SetInventoryRequest.inventory.fulfillment_info.place_ids} + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|SetInventoryRequest.inventory.fulfillment_info.place_ids} * * The last update time is recorded for the following inventory fields: * * {@link google.cloud.retail.v2alpha.Product.price_info|Product.price_info} @@ -1369,7 +1401,9 @@ export class ProductServiceClient { * * {@link google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} * * If a full overwrite of inventory information while ignoring timestamps is - * needed, {@link |UpdateProduct} should be invoked instead. + * needed, + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} + * should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided * {@link google.cloud.retail.v2alpha.Product|Product} to update. @@ -1529,8 +1563,9 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, the added place IDs are not immediately manifested in the * {@link google.cloud.retail.v2alpha.Product|Product} queried by - * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1564,7 +1599,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}, such @@ -1732,8 +1768,9 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, the removed place IDs are not immediately manifested in the * {@link google.cloud.retail.v2alpha.Product|Product} queried by - * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1767,7 +1804,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2alpha.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}, @@ -1935,13 +1973,14 @@ export class ProductServiceClient { * and processed downstream. As a consequence, when a response is returned, * updates are not immediately manifested in the * {@link google.cloud.retail.v2alpha.Product|Product} queried by - * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. * * Local inventory information can only be modified using this method. - * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} * and - * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. @@ -2127,13 +2166,14 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, removals are not immediately manifested in the * {@link google.cloud.retail.v2alpha.Product|Product} queried by - * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. * * Local inventory information can only be removed using this method. - * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} * and - * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. @@ -2717,6 +2757,263 @@ export class ProductServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -3014,6 +3311,68 @@ export class ProductServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -3177,6 +3536,7 @@ export class ProductServiceClient { return this.productServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/product_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 2df05eab279..29bd94dd009 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -65,7 +68,9 @@ export class SearchServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; searchServiceStub?: Promise<{[name: string]: Function}>; /** @@ -143,6 +148,7 @@ export class SearchServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -181,6 +187,9 @@ export class SearchServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -200,6 +209,44 @@ export class SearchServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2alpha.SearchService', @@ -341,8 +388,10 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -353,6 +402,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2alpha.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -438,10 +492,11 @@ export class SearchServiceClient { * * Notice that if both * {@link google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and [SearchRequest.boost_spec] are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * {@link google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -482,7 +537,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -551,6 +607,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -636,8 +713,10 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -648,6 +727,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2alpha.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -733,10 +817,11 @@ export class SearchServiceClient { * * Notice that if both * {@link google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and [SearchRequest.boost_spec] are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * {@link google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -777,7 +862,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -846,6 +932,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -887,8 +994,10 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -899,6 +1008,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2alpha.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -984,10 +1098,11 @@ export class SearchServiceClient { * * Notice that if both * {@link google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and [SearchRequest.boost_spec] are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * {@link google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -1028,7 +1143,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -1097,6 +1213,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1131,6 +1268,263 @@ export class SearchServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1428,6 +1822,68 @@ export class SearchServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -1591,6 +2047,8 @@ export class SearchServiceClient { return this.searchServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/search_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts index 28b63d14db3..5a837f7657b 100644 --- a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './serving_config_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class ServingConfigServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; servingConfigServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class ServingConfigServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -175,6 +181,9 @@ export class ServingConfigServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -194,6 +203,44 @@ export class ServingConfigServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2alpha/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2alpha/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2alpha.ServingConfigService', @@ -346,7 +393,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. Full resource name of parent. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig * Required. The ServingConfig to create. * @param {string} request.servingConfigId @@ -1139,6 +1186,263 @@ export class ServingConfigServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1369,6 +1673,68 @@ export class ServingConfigServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -1532,6 +1898,8 @@ export class ServingConfigServiceClient { return this.servingConfigServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 6e0f61a6a78..bd6b6aae4d4 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -25,6 +25,8 @@ import { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -60,6 +62,7 @@ export class UserEventServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; userEventServiceStub?: Promise<{[name: string]: Function}>; @@ -139,6 +142,7 @@ export class UserEventServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -174,6 +178,9 @@ export class UserEventServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -1063,6 +1070,263 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2alpha.RejoinUserEventsMetadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1293,6 +1557,68 @@ export class UserEventServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * @@ -1456,6 +1782,7 @@ export class UserEventServiceClient { return this.userEventServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json index 3355857af31..50adbaecf53 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2alpha/control_service.proto", "../../protos/google/cloud/retail/v2alpha/export_config.proto", "../../protos/google/cloud/retail/v2alpha/import_config.proto", + "../../protos/google/cloud/retail/v2alpha/model.proto", + "../../protos/google/cloud/retail/v2alpha/model_service.proto", "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", "../../protos/google/cloud/retail/v2alpha/product.proto", "../../protos/google/cloud/retail/v2alpha/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index efc71e654d1..8c0c688f0d0 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class CatalogServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; catalogServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class CatalogServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -200,6 +206,44 @@ export class CatalogServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2beta.CatalogService', @@ -905,7 +949,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.name * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1120,7 +1164,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.attributesConfig * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {google.cloud.retail.v2beta.CatalogAttribute} request.catalogAttribute * Required. The * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to add. @@ -1220,7 +1264,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.attributesConfig * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {string} request.key * Required. The attribute name key of the * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} to remove. @@ -1332,7 +1376,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.attributesConfig * Required. Full AttributesConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` * @param {google.cloud.retail.v2beta.CatalogAttribute} request.catalogAttribute * Required. The updated * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute}. @@ -1683,6 +1727,263 @@ export class CatalogServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -2179,6 +2480,8 @@ export class CatalogServiceClient { return this.catalogServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 42a24bf8a57..a8d126d669d 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -25,6 +25,8 @@ import { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -63,6 +65,7 @@ export class CompletionServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; completionServiceStub?: Promise<{[name: string]: Function}>; @@ -142,6 +145,7 @@ export class CompletionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -395,6 +399,9 @@ export class CompletionServiceClient { * The field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {string[]} request.languageCodes + * Note that this field applies for `user-data` dataset only. For requests + * with `cloud-retail` dataset, setting this field has no effect. + * * The language filters applied to the output suggestions. If set, it should * contain the language of the query. If not set, suggestions are returned * without considering language restrictions. This is the BCP-47 language @@ -427,9 +434,9 @@ export class CompletionServiceClient { * * * user-data * - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). * @param {number} request.maxSuggestions * Completion max suggestions. If left unset or set to 0, then will fallback * to the configured value @@ -677,6 +684,263 @@ export class CompletionServiceClient { protos.google.cloud.retail.v2beta.ImportMetadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1070,6 +1334,7 @@ export class CompletionServiceClient { return this.completionServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client.ts b/packages/google-cloud-retail/src/v2beta/control_service_client.ts index 228aca8881e..4b0de7707e0 100644 --- a/packages/google-cloud-retail/src/v2beta/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/control_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './control_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class ControlServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; controlServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class ControlServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -194,6 +200,44 @@ export class ControlServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2beta.ControlService', @@ -341,7 +385,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. Full resource name of parent catalog. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {google.cloud.retail.v2beta.Control} request.control * Required. The Control to create. * @param {string} request.controlId @@ -444,7 +488,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -640,7 +684,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the Control to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -727,7 +771,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 50. Max allowed value is 1000. @@ -835,7 +879,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 50. Max allowed value is 1000. @@ -891,7 +935,7 @@ export class ControlServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 50. Max allowed value is 1000. @@ -939,6 +983,263 @@ export class ControlServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1332,6 +1633,8 @@ export class ControlServiceClient { return this.controlServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index cd68c2d564b..080e1704146 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -18,7 +18,15 @@ /* global window */ import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -28,7 +36,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -53,7 +61,9 @@ export class PredictionServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; predictionServiceStub?: Promise<{[name: string]: Function}>; /** @@ -131,6 +141,7 @@ export class PredictionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -174,6 +185,44 @@ export class PredictionServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2beta.PredictionService', @@ -312,26 +361,41 @@ export class PredictionServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. Full resource name of the format: - * {name=projects/* /locations/global/catalogs/default_catalog/placements/*} - * The ID of the Recommendations AI placement. Before you can request - * predictions from your model, you must create at least one placement for it. - * For more information, see [Managing - * placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements). - * - * The full list of available placements can be seen at - * https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements + * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` + * or + * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. + * We recommend using the `servingConfigs` resource. `placements` is a legacy + * resource. + * The ID of the Recommendations AI serving config or placement. + * Before you can request predictions from your model, you must create at + * least one serving config or placement for it. For more information, see + * [Managing serving configurations] + * (https://cloud.google.com/retail/docs/manage-configs). + * + * The full list of available serving configs can be seen at + * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs * @param {google.cloud.retail.v2beta.UserEvent} request.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. + * + * Don't set + * {@link google.cloud.retail.v2beta.UserEvent.visitor_id|UserEvent.visitor_id} or + * {@link google.cloud.retail.v2beta.UserInfo.user_id|UserInfo.user_id} to the same + * fixed ID for different users. If you are trying to receive non-personalized + * recommendations (not recommended; this can negatively impact model + * performance), instead set + * {@link google.cloud.retail.v2beta.UserEvent.visitor_id|UserEvent.visitor_id} to + * a random unique ID and leave + * {@link google.cloud.retail.v2beta.UserInfo.user_id|UserInfo.user_id} unset. * @param {number} request.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. * @param {string} request.pageToken - * The previous PredictResponse.next_page_token. + * This field is not used for now; leave it unset. * @param {string} request.filter * Filter for restricting prediction results with a length limit of 5,000 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. @@ -362,6 +426,14 @@ export class PredictionServiceClient { * receive empty results instead. * Note that the API will never return items with storageStatus of "EXPIRED" * or "DELETED" regardless of filter choices. + * + * If `filterSyntaxV2` is set to true under the `params` field, then + * attribute-based expressions are expected instead of the above described + * tag-based syntax. Examples: + * + * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + * * (availability: ANY("IN_STOCK")) AND + * (colors: ANY("Red") OR categories: ANY("Phones")) * @param {boolean} request.validateOnly * Use validate only mode for this prediction query. If set to true, a * dummy model will be used that returns arbitrary products. @@ -393,13 +465,15 @@ export class PredictionServiceClient { * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives * request-level control and adjusts prediction results based on product * category. + * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + * field is interpreteted according to the new, attribute-based syntax. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and @@ -488,6 +562,263 @@ export class PredictionServiceClient { return this.innerApiCalls.predict(request, options, callback); } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -881,6 +1212,8 @@ export class PredictionServiceClient { return this.predictionServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 42bce46a71e..1b8ffb6128e 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -27,6 +27,8 @@ import { LROperation, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -65,6 +67,7 @@ export class ProductServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; productServiceStub?: Promise<{[name: string]: Function}>; @@ -144,6 +147,7 @@ export class ProductServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -688,6 +692,11 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. * @param {boolean} request.allowMissing * If set to true, and the {@link google.cloud.retail.v2beta.Product|Product} is * not found, a new {@link google.cloud.retail.v2beta.Product|Product} will be @@ -892,7 +901,7 @@ export class ProductServiceClient { /** * Bulk import of multiple {@link google.cloud.retail.v2beta.Product|Product}s. * - * Request processing may be synchronous. No partial updating is supported. + * Request processing may be synchronous. * Non-existing items are created. * * Note that it is possible for a subset of the @@ -920,11 +929,18 @@ export class ProductServiceClient { * imported. Defaults to * {@link google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * {@link google.cloud.retail.v2beta.ImportProductsRequest.parent|ImportProductsRequest.parent}. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * * Only supported when * {@link google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} @@ -1070,19 +1086,21 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, updates are not immediately manifested in the * {@link google.cloud.retail.v2beta.Product|Product} queried by - * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * * When inventory is updated with - * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|ProductService.CreateProduct} * and - * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct}, + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct}, * the specified inventory field value(s) will overwrite any existing value(s) * while ignoring the last update time for this field. Furthermore, the last * update time for the specified inventory fields will be overwritten to the * time of the - * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} or - * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|ProductService.CreateProduct} + * or + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} * request. * * If no inventory fields are set in @@ -1094,10 +1112,10 @@ export class ProductServiceClient { * then any existing inventory information will be preserved. * * Pre-existing inventory information can only be updated with - * {@link google.cloud.retail.v2beta.ProductService.SetInventory|SetInventory}, - * {@link google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * {@link google.cloud.retail.v2beta.ProductService.SetInventory|ProductService.SetInventory}, + * {@link google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, * and - * {@link google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. + * {@link google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1107,6 +1125,7 @@ export class ProductServiceClient { * @param {google.cloud.retail.v2beta.Product} request.inventory * Required. The inventory information to update. The allowable fields to * update are: + * * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} * * {@link google.cloud.retail.v2beta.Product.availability|Product.availability} * * {@link google.cloud.retail.v2beta.Product.available_quantity|Product.available_quantity} @@ -1114,8 +1133,9 @@ export class ProductServiceClient { * The updated inventory fields must be specified in * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. * - * If {@link |SetInventoryRequest.inventory.name} is empty or invalid, an - * INVALID_ARGUMENT error is returned. + * If + * {@link google.cloud.retail.v2beta.Product.name|SetInventoryRequest.inventory.name} + * is empty or invalid, an INVALID_ARGUMENT error is returned. * * If the caller does not have permission to update the * {@link google.cloud.retail.v2beta.Product|Product} named in @@ -1138,7 +1158,8 @@ export class ProductServiceClient { * * Adds "fulfillment_info" in * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in {@link |SetInventoryRequest.inventory.fulfillment_info} + * to update in + * {@link google.cloud.retail.v2beta.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: @@ -1146,9 +1167,9 @@ export class ProductServiceClient { * * Adds "fulfillment_info" in * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types to clear in - * {@link |SetInventoryRequest.inventory.fulfillment_info} + * {@link google.cloud.retail.v2beta.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * Checks that only the desired fulfillment info types have empty - * {@link |SetInventoryRequest.inventory.fulfillment_info.place_ids} + * {@link google.cloud.retail.v2beta.FulfillmentInfo.place_ids|SetInventoryRequest.inventory.fulfillment_info.place_ids} * * The last update time is recorded for the following inventory fields: * * {@link google.cloud.retail.v2beta.Product.price_info|Product.price_info} @@ -1157,7 +1178,9 @@ export class ProductServiceClient { * * {@link google.cloud.retail.v2beta.Product.fulfillment_info|Product.fulfillment_info} * * If a full overwrite of inventory information while ignoring timestamps is - * needed, {@link |UpdateProduct} should be invoked instead. + * needed, + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} + * should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided * {@link google.cloud.retail.v2beta.Product|Product} to update. @@ -1317,8 +1340,9 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, the added place IDs are not immediately manifested in the * {@link google.cloud.retail.v2beta.Product|Product} queried by - * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1352,7 +1376,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2beta.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2beta.AddFulfillmentPlacesRequest.type|type}, such @@ -1520,8 +1545,9 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, the removed place IDs are not immediately manifested in the * {@link google.cloud.retail.v2beta.Product|Product} queried by - * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. @@ -1555,7 +1581,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2beta.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest.type|type}, @@ -1723,13 +1750,14 @@ export class ProductServiceClient { * and processed downstream. As a consequence, when a response is returned, * updates are not immediately manifested in the * {@link google.cloud.retail.v2beta.Product|Product} queried by - * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * * Local inventory information can only be modified using this method. - * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|ProductService.CreateProduct} * and - * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. @@ -1915,13 +1943,14 @@ export class ProductServiceClient { * enqueued and processed downstream. As a consequence, when a response is * returned, removals are not immediately manifested in the * {@link google.cloud.retail.v2beta.Product|Product} queried by - * {@link google.cloud.retail.v2beta.ProductService.GetProduct|GetProduct} or - * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ListProducts}. + * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct} + * or + * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * * Local inventory information can only be removed using this method. - * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|CreateProduct} + * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|ProductService.CreateProduct} * and - * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|UpdateProduct} + * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * * This feature is only available for users who have Retail Search enabled. @@ -2481,6 +2510,263 @@ export class ProductServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -2941,6 +3227,7 @@ export class ProductServiceClient { return this.productServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 9596b1dd21f..f66d32ca833 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -65,7 +68,9 @@ export class SearchServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; searchServiceStub?: Promise<{[name: string]: Function}>; /** @@ -143,6 +148,7 @@ export class SearchServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -200,6 +206,44 @@ export class SearchServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2beta.SearchService', @@ -341,8 +385,10 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -353,6 +399,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2beta.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2beta.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -436,10 +487,11 @@ export class SearchServiceClient { * * Notice that if both * {@link google.cloud.retail.v2beta.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and [SearchRequest.boost_spec] are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * {@link google.cloud.retail.v2beta.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -472,7 +524,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2beta.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -532,6 +585,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -617,8 +691,10 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -629,6 +705,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2beta.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2beta.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -712,10 +793,11 @@ export class SearchServiceClient { * * Notice that if both * {@link google.cloud.retail.v2beta.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and [SearchRequest.boost_spec] are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * {@link google.cloud.retail.v2beta.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -748,7 +830,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2beta.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -808,6 +891,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -849,8 +953,10 @@ export class SearchServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * Required. The resource name of the Retail Search serving config, such as + * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + * or the name of the legacy placement resource, such as + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -861,6 +967,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2beta.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2beta.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -944,10 +1055,11 @@ export class SearchServiceClient { * * Notice that if both * {@link google.cloud.retail.v2beta.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and [SearchRequest.boost_spec] are set, the boost conditions from both - * places are evaluated. If a search request matches multiple boost - * conditions, the final boost score is equal to the sum of the boost scores - * from all matched boost conditions. + * and + * {@link google.cloud.retail.v2beta.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -980,7 +1092,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2beta.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2beta.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -1040,6 +1153,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} @@ -1074,6 +1208,263 @@ export class SearchServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1534,6 +1925,8 @@ export class SearchServiceClient { return this.searchServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts index 4088623a24d..945bfec445d 100644 --- a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts @@ -23,8 +23,11 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; @@ -37,7 +40,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './serving_config_service_client_config.json'; - +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -62,7 +65,9 @@ export class ServingConfigServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; servingConfigServiceStub?: Promise<{[name: string]: Function}>; /** @@ -140,6 +145,7 @@ export class ServingConfigServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -194,6 +200,44 @@ export class ServingConfigServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.retail.v2beta.ServingConfigService', @@ -344,7 +388,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. Full resource name of parent. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {google.cloud.retail.v2beta.ServingConfig} request.servingConfig * Required. The ServingConfig to create. * @param {string} request.servingConfigId @@ -1119,6 +1163,263 @@ export class ServingConfigServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1512,6 +1813,8 @@ export class ServingConfigServiceClient { return this.servingConfigServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 040cd40e9ff..168b13c51a5 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -25,6 +25,8 @@ import { ClientOptions, GrpcClientOptions, LROperation, + LocationsClient, + LocationProtos, } from 'google-gax'; import * as protos from '../../protos/protos'; @@ -60,6 +62,7 @@ export class UserEventServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; userEventServiceStub?: Promise<{[name: string]: Function}>; @@ -139,6 +142,7 @@ export class UserEventServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -1063,6 +1067,263 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2beta.RejoinUserEventsMetadata >; } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -1456,6 +1717,7 @@ export class UserEventServiceClient { return this.userEventServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index 010241b8d23..a6b62537317 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -25,7 +25,12 @@ import * as catalogserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -868,6 +873,503 @@ describe('v2.CatalogServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('branch', () => { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 4980f39f899..67cc1b3a60c 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -25,7 +25,12 @@ import * as catalogserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -1795,6 +1800,503 @@ describe('v2alpha.CatalogServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -2196,6 +2698,82 @@ describe('v2alpha.CatalogServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 9ad1be17b7c..94e7f1c5959 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -25,7 +25,12 @@ import * as catalogserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -1795,6 +1800,503 @@ describe('v2beta.CatalogServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index 49773a5009c..590b92dc12d 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as completionserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +86,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2.CompletionServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -498,6 +526,503 @@ describe('v2.CompletionServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('catalog', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index c63c4064c1f..59bf9fbd55c 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as completionserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +86,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2alpha.CompletionServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -509,6 +537,519 @@ describe('v2alpha.CompletionServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -789,6 +1330,83 @@ describe('v2alpha.CompletionServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index f987631a969..d9a120566b0 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as completionserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +86,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2beta.CompletionServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -518,6 +546,535 @@ describe('v2beta.CompletionServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts index 516a0c0c65d..f075d493b48 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts @@ -25,7 +25,12 @@ import * as controlserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -1000,6 +1005,503 @@ describe('v2alpha.ControlServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -1276,6 +1778,82 @@ describe('v2alpha.ControlServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts index 2fb4e17b608..04e88b6e9ef 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts @@ -25,7 +25,12 @@ import * as controlserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -1000,6 +1005,503 @@ describe('v2beta.ControlServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts new file mode 100644 index 00000000000..1ae8b6e3867 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts @@ -0,0 +1,2435 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as modelserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.ModelServiceClient', () => { + it('has servicePath', () => { + const servicePath = + modelserviceModule.v2alpha.ModelServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + modelserviceModule.v2alpha.ModelServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = modelserviceModule.v2alpha.ModelServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.modelServiceStub, undefined); + await client.initialize(); + assert(client.modelServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.modelServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.modelServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('pauseModel', () => { + it('invokes pauseModel without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PauseModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Model() + ); + client.innerApiCalls.pauseModel = stubSimpleCall(expectedResponse); + const [response] = await client.pauseModel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.pauseModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes pauseModel without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PauseModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Model() + ); + client.innerApiCalls.pauseModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.pauseModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes pauseModel with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PauseModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.pauseModel(request), expectedError); + assert( + (client.innerApiCalls.pauseModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes pauseModel with closed client', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.PauseModelRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pauseModel(request), expectedError); + }); + }); + + describe('resumeModel', () => { + it('invokes resumeModel without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ResumeModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Model() + ); + client.innerApiCalls.resumeModel = stubSimpleCall(expectedResponse); + const [response] = await client.resumeModel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.resumeModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes resumeModel without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ResumeModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Model() + ); + client.innerApiCalls.resumeModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.resumeModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes resumeModel with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ResumeModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.resumeModel(request), expectedError); + assert( + (client.innerApiCalls.resumeModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes resumeModel with closed client', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ResumeModelRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resumeModel(request), expectedError); + }); + }); + + describe('deleteModel', () => { + it('invokes deleteModel without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); + const [response] = await client.deleteModel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteModel without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteModel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteModel with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteModel(request), expectedError); + assert( + (client.innerApiCalls.deleteModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteModel with closed client', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.DeleteModelRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteModel(request), expectedError); + }); + }); + + describe('updateModel', () => { + it('invokes updateModel without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateModelRequest() + ); + request.model = {}; + request.model.name = ''; + const expectedHeaderRequestParams = 'model.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Model() + ); + client.innerApiCalls.updateModel = stubSimpleCall(expectedResponse); + const [response] = await client.updateModel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateModel without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateModelRequest() + ); + request.model = {}; + request.model.name = ''; + const expectedHeaderRequestParams = 'model.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.Model() + ); + client.innerApiCalls.updateModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateModel with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateModelRequest() + ); + request.model = {}; + request.model.name = ''; + const expectedHeaderRequestParams = 'model.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateModel(request), expectedError); + assert( + (client.innerApiCalls.updateModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateModel with closed client', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.UpdateModelRequest() + ); + request.model = {}; + request.model.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateModel(request), expectedError); + }); + }); + + describe('createModel', () => { + it('invokes createModel without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateModelRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.createModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createModel without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateModelRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.IModel, + protos.google.cloud.retail.v2alpha.ICreateModelMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createModel with call error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateModelRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createModel(request), expectedError); + assert( + (client.innerApiCalls.createModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createModel with LRO error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.CreateModelRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createModel(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateModelProgress without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateModelProgress with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkCreateModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('tuneModel', () => { + it('invokes tuneModel without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.TuneModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.tuneModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.tuneModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.tuneModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes tuneModel without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.TuneModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.tuneModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.tuneModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2alpha.ITuneModelResponse, + protos.google.cloud.retail.v2alpha.ITuneModelMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.tuneModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes tuneModel with call error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.TuneModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.tuneModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.tuneModel(request), expectedError); + assert( + (client.innerApiCalls.tuneModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes tuneModel with LRO error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.TuneModelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.tuneModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.tuneModel(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.tuneModel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkTuneModelProgress without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkTuneModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTuneModelProgress with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkTuneModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listModels', () => { + it('invokes listModels without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + ]; + client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); + const [response] = await client.listModels(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listModels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listModels without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + ]; + client.innerApiCalls.listModels = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listModels( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2alpha.IModel[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listModels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listModels with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listModels = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listModels(request), expectedError); + assert( + (client.innerApiCalls.listModels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listModelsStream without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + ]; + client.descriptors.page.listModels.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Model[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Model) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listModels, request) + ); + assert.strictEqual( + (client.descriptors.page.listModels.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listModelsStream with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listModels.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2alpha.Model[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2alpha.Model) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listModels, request) + ); + assert.strictEqual( + (client.descriptors.page.listModels.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listModels without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), + ]; + client.descriptors.page.listModels.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2alpha.IModel[] = []; + const iterable = client.listModelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listModels with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2alpha.ListModelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listModelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2alpha.IModel[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 5bb6794c5b8..894ecb51a50 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as predictionserviceModule from '../src'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -49,6 +54,29 @@ function stubSimpleCallWithCallback( : sinon.stub().callsArgWith(2, null, response); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2.PredictionServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -269,6 +297,503 @@ describe('v2.PredictionServiceClient', () => { await assert.rejects(client.predict(request), expectedError); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('catalog', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index 5eef59184ba..ffb266f8571 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as predictionserviceModule from '../src'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -49,6 +54,29 @@ function stubSimpleCallWithCallback( : sinon.stub().callsArgWith(2, null, response); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2alpha.PredictionServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -274,6 +302,519 @@ describe('v2alpha.PredictionServiceClient', () => { await assert.rejects(client.predict(request), expectedError); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -554,6 +1095,83 @@ describe('v2alpha.PredictionServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index cfb1b96bb4c..12a9d7d1c5a 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as predictionserviceModule from '../src'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -49,6 +54,29 @@ function stubSimpleCallWithCallback( : sinon.stub().callsArgWith(2, null, response); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2beta.PredictionServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -277,6 +305,535 @@ describe('v2beta.PredictionServiceClient', () => { await assert.rejects(client.predict(request), expectedError); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 5ec737f973f..fe6ae181a66 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -25,7 +25,12 @@ import * as productserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -2197,6 +2202,503 @@ describe('v2.ProductServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('branch', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index 4bed145b7f7..cb414998c0b 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -25,7 +25,12 @@ import * as productserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -2397,6 +2402,503 @@ describe('v2alpha.ProductServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -2749,6 +3251,82 @@ describe('v2alpha.ProductServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 9c3fe63714f..7e321bb46b5 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -25,7 +25,12 @@ import * as productserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -2203,6 +2208,503 @@ describe('v2beta.ProductServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index dd4830b5759..9edecaa7474 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -25,7 +25,12 @@ import * as searchserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -517,6 +522,503 @@ describe('v2.SearchServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('branch', () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index da2b3f8839a..22de4b92a3c 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -25,7 +25,12 @@ import * as searchserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -519,6 +524,503 @@ describe('v2alpha.SearchServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -871,6 +1373,82 @@ describe('v2alpha.SearchServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index df54dc501ad..a5d7cc1a25c 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -25,7 +25,12 @@ import * as searchserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -519,6 +524,503 @@ describe('v2beta.SearchServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts index 8a7b441d8bc..cd9bd6c2715 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts @@ -25,7 +25,12 @@ import * as servingconfigserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -1320,6 +1325,519 @@ describe('v2alpha.ServingConfigServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -1600,6 +2118,83 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts index dbad34bbb43..9346d04c54b 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts @@ -25,7 +25,12 @@ import * as servingconfigserviceModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -1318,6 +1323,519 @@ describe('v2beta.ServingConfigServiceClient', () => { ); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index 2248cd5bec6..0a80fc013ee 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as usereventserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +86,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2.UserEventServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -1009,6 +1037,503 @@ describe('v2.UserEventServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('catalog', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index 100e656b92a..df6f0e43857 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as usereventserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +86,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2alpha.UserEventServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -1009,6 +1037,503 @@ describe('v2alpha.UserEventServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { @@ -1285,6 +1810,82 @@ describe('v2alpha.UserEventServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index 610c49176ae..3691c6a3139 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -23,7 +23,12 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as usereventserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +86,29 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v2beta.UserEventServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -1009,6 +1037,503 @@ describe('v2beta.UserEventServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('attributesConfig', () => { From 3c4690fb4db53cff1f49e16fdf00aabccca86239 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 00:14:18 +0000 Subject: [PATCH 091/103] fix: better support for fallback mode (#204) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 468790263 Source-Link: https://github.com/googleapis/googleapis/commit/873ab456273d105245df0fb82a6c17a814553b80 Source-Link: https://github.com/googleapis/googleapis-gen/commit/cb6f37aeff2a3472e40a7bbace8c67d75e24bee5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9 --- .../v2/catalog_service.get_default_branch.js | 3 + .../v2/catalog_service.list_catalogs.js | 3 + .../v2/catalog_service.set_default_branch.js | 3 + .../v2/catalog_service.update_catalog.js | 3 + .../v2/completion_service.complete_query.js | 3 + ...mpletion_service.import_completion_data.js | 3 + .../v2/prediction_service.predict.js | 3 + .../product_service.add_fulfillment_places.js | 3 + .../product_service.add_local_inventories.js | 3 + .../v2/product_service.create_product.js | 3 + .../v2/product_service.delete_product.js | 3 + .../v2/product_service.get_product.js | 3 + .../v2/product_service.import_products.js | 3 + .../v2/product_service.list_products.js | 3 + ...oduct_service.remove_fulfillment_places.js | 3 + ...roduct_service.remove_local_inventories.js | 3 + .../v2/product_service.set_inventory.js | 3 + .../v2/product_service.update_product.js | 3 + .../generated/v2/search_service.search.js | 3 + ...ippet_metadata.google.cloud.retail.v2.json | 48 ++--- .../user_event_service.collect_user_event.js | 3 + .../user_event_service.import_user_events.js | 3 + .../user_event_service.purge_user_events.js | 3 + .../user_event_service.rejoin_user_events.js | 3 + .../v2/user_event_service.write_user_event.js | 3 + .../catalog_service.add_catalog_attribute.js | 3 + .../catalog_service.get_attributes_config.js | 3 + .../catalog_service.get_completion_config.js | 3 + .../catalog_service.get_default_branch.js | 3 + .../v2alpha/catalog_service.list_catalogs.js | 3 + ...atalog_service.remove_catalog_attribute.js | 3 + ...talog_service.replace_catalog_attribute.js | 3 + .../catalog_service.set_default_branch.js | 3 + ...atalog_service.update_attributes_config.js | 3 + .../v2alpha/catalog_service.update_catalog.js | 3 + ...atalog_service.update_completion_config.js | 3 + .../completion_service.complete_query.js | 3 + ...mpletion_service.import_completion_data.js | 3 + .../v2alpha/control_service.create_control.js | 3 + .../v2alpha/control_service.delete_control.js | 3 + .../v2alpha/control_service.get_control.js | 3 + .../v2alpha/control_service.list_controls.js | 3 + .../v2alpha/control_service.update_control.js | 3 + .../v2alpha/model_service.create_model.js | 3 + .../v2alpha/model_service.delete_model.js | 3 + .../v2alpha/model_service.list_models.js | 3 + .../v2alpha/model_service.pause_model.js | 3 + .../v2alpha/model_service.resume_model.js | 3 + .../v2alpha/model_service.tune_model.js | 3 + .../v2alpha/model_service.update_model.js | 3 + .../v2alpha/prediction_service.predict.js | 3 + .../product_service.add_fulfillment_places.js | 3 + .../product_service.add_local_inventories.js | 3 + .../v2alpha/product_service.create_product.js | 3 + .../v2alpha/product_service.delete_product.js | 3 + .../v2alpha/product_service.get_product.js | 3 + .../product_service.import_products.js | 3 + .../v2alpha/product_service.list_products.js | 3 + .../v2alpha/product_service.purge_products.js | 3 + ...oduct_service.remove_fulfillment_places.js | 3 + ...roduct_service.remove_local_inventories.js | 3 + .../v2alpha/product_service.set_inventory.js | 3 + .../v2alpha/product_service.update_product.js | 3 + .../v2alpha/search_service.search.js | 3 + .../serving_config_service.add_control.js | 3 + ...ng_config_service.create_serving_config.js | 3 + ...ng_config_service.delete_serving_config.js | 3 + ...rving_config_service.get_serving_config.js | 3 + ...ing_config_service.list_serving_configs.js | 3 + .../serving_config_service.remove_control.js | 3 + ...ng_config_service.update_serving_config.js | 3 + ..._metadata.google.cloud.retail.v2alpha.json | 102 +++++----- .../user_event_service.collect_user_event.js | 3 + .../user_event_service.import_user_events.js | 3 + .../user_event_service.purge_user_events.js | 3 + .../user_event_service.rejoin_user_events.js | 3 + .../user_event_service.write_user_event.js | 3 + .../catalog_service.add_catalog_attribute.js | 3 + .../catalog_service.get_attributes_config.js | 3 + .../catalog_service.get_completion_config.js | 3 + .../catalog_service.get_default_branch.js | 3 + .../v2beta/catalog_service.list_catalogs.js | 3 + ...atalog_service.remove_catalog_attribute.js | 3 + ...talog_service.replace_catalog_attribute.js | 3 + .../catalog_service.set_default_branch.js | 3 + ...atalog_service.update_attributes_config.js | 3 + .../v2beta/catalog_service.update_catalog.js | 3 + ...atalog_service.update_completion_config.js | 3 + .../completion_service.complete_query.js | 3 + ...mpletion_service.import_completion_data.js | 3 + .../v2beta/control_service.create_control.js | 3 + .../v2beta/control_service.delete_control.js | 3 + .../v2beta/control_service.get_control.js | 3 + .../v2beta/control_service.list_controls.js | 3 + .../v2beta/control_service.update_control.js | 3 + .../v2beta/prediction_service.predict.js | 3 + .../product_service.add_fulfillment_places.js | 3 + .../product_service.add_local_inventories.js | 3 + .../v2beta/product_service.create_product.js | 3 + .../v2beta/product_service.delete_product.js | 3 + .../v2beta/product_service.get_product.js | 3 + .../v2beta/product_service.import_products.js | 3 + .../v2beta/product_service.list_products.js | 3 + ...oduct_service.remove_fulfillment_places.js | 3 + ...roduct_service.remove_local_inventories.js | 3 + .../v2beta/product_service.set_inventory.js | 3 + .../v2beta/product_service.update_product.js | 3 + .../generated/v2beta/search_service.search.js | 3 + .../serving_config_service.add_control.js | 3 + ...ng_config_service.create_serving_config.js | 3 + ...ng_config_service.delete_serving_config.js | 3 + ...rving_config_service.get_serving_config.js | 3 + ...ing_config_service.list_serving_configs.js | 3 + .../serving_config_service.remove_control.js | 3 + ...ng_config_service.update_serving_config.js | 3 + ...t_metadata.google.cloud.retail.v2beta.json | 86 ++++---- .../user_event_service.collect_user_event.js | 3 + .../user_event_service.import_user_events.js | 3 + .../user_event_service.purge_user_events.js | 3 + .../user_event_service.rejoin_user_events.js | 3 + .../user_event_service.write_user_event.js | 3 + .../src/v2/catalog_service_client.ts | 10 +- .../src/v2/completion_service_client.ts | 5 +- .../src/v2/prediction_service_client.ts | 5 +- .../src/v2/product_service_client.ts | 20 +- .../src/v2/search_service_client.ts | 10 +- .../src/v2/user_event_service_client.ts | 9 +- .../src/v2alpha/catalog_service_client.ts | 10 +- .../src/v2alpha/completion_service_client.ts | 5 +- .../src/v2alpha/control_service_client.ts | 10 +- .../src/v2alpha/model_service_client.ts | 12 +- .../src/v2alpha/prediction_service_client.ts | 5 +- .../src/v2alpha/product_service_client.ts | 22 +-- .../src/v2alpha/search_service_client.ts | 10 +- .../v2alpha/serving_config_service_client.ts | 10 +- .../src/v2alpha/user_event_service_client.ts | 9 +- .../src/v2beta/catalog_service_client.ts | 10 +- .../src/v2beta/completion_service_client.ts | 5 +- .../src/v2beta/control_service_client.ts | 10 +- .../src/v2beta/prediction_service_client.ts | 5 +- .../src/v2beta/product_service_client.ts | 20 +- .../src/v2beta/search_service_client.ts | 10 +- .../v2beta/serving_config_service_client.ts | 10 +- .../src/v2beta/user_event_service_client.ts | 9 +- .../test/gapic_catalog_service_v2.ts | 167 ++++++++-------- .../test/gapic_catalog_service_v2alpha.ts | 167 ++++++++-------- .../test/gapic_catalog_service_v2beta.ts | 167 ++++++++-------- .../test/gapic_completion_service_v2.ts | 160 +++++++-------- .../test/gapic_completion_service_v2alpha.ts | 168 ++++++++-------- .../test/gapic_completion_service_v2beta.ts | 171 ++++++++-------- .../test/gapic_control_service_v2alpha.ts | 167 ++++++++-------- .../test/gapic_control_service_v2beta.ts | 167 ++++++++-------- .../test/gapic_model_service_v2alpha.ts | 160 +++++++-------- .../test/gapic_prediction_service_v2.ts | 167 ++++++++-------- .../test/gapic_prediction_service_v2alpha.ts | 175 ++++++++-------- .../test/gapic_prediction_service_v2beta.ts | 178 +++++++++-------- .../test/gapic_product_service_v2.ts | 160 +++++++-------- .../test/gapic_product_service_v2alpha.ts | 160 +++++++-------- .../test/gapic_product_service_v2beta.ts | 160 +++++++-------- .../test/gapic_search_service_v2.ts | 165 ++++++++-------- .../test/gapic_search_service_v2alpha.ts | 167 ++++++++-------- .../test/gapic_search_service_v2beta.ts | 167 ++++++++-------- .../gapic_serving_config_service_v2alpha.ts | 187 +++++++++--------- .../gapic_serving_config_service_v2beta.ts | 187 +++++++++--------- .../test/gapic_user_event_service_v2.ts | 160 +++++++-------- .../test/gapic_user_event_service_v2alpha.ts | 161 +++++++-------- .../test/gapic_user_event_service_v2beta.ts | 160 +++++++-------- 167 files changed, 2529 insertions(+), 2140 deletions(-) diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js index fa840318989..e2634590549 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_default_branch.js @@ -23,6 +23,9 @@ function main() { // [START retail_v2_generated_CatalogService_GetDefaultBranch_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js index b5c79c5163a..98b2e88691b 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.list_catalogs.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2_generated_CatalogService_ListCatalogs_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js index f03f4c360a4..d5053ff3ada 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.set_default_branch.js @@ -23,6 +23,9 @@ function main() { // [START retail_v2_generated_CatalogService_SetDefaultBranch_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js index 33d552b5cae..e505ed815c7 100644 --- a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_catalog.js @@ -23,6 +23,9 @@ function main(catalog) { // [START retail_v2_generated_CatalogService_UpdateCatalog_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index 7ae47a8bab8..9182f5fbe72 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -23,6 +23,9 @@ function main(catalog, query) { // [START retail_v2_generated_CompletionService_CompleteQuery_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js index 4ccdcfe6c93..c20455d0c35 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2_generated_CompletionService_ImportCompletionData_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js index 2f9d68f7a5d..1bb9741aa90 100644 --- a/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2/prediction_service.predict.js @@ -23,6 +23,9 @@ function main(placement, userEvent) { // [START retail_v2_generated_PredictionService_Predict_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js index 7c34fa72cba..f962e98580f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_fulfillment_places.js @@ -23,6 +23,9 @@ function main(product, type, placeIds) { // [START retail_v2_generated_ProductService_AddFulfillmentPlaces_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js index f0598e366d4..1fbf3b4ad52 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.add_local_inventories.js @@ -23,6 +23,9 @@ function main(product, localInventories) { // [START retail_v2_generated_ProductService_AddLocalInventories_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js index e64ffbdfd60..d8d2771d946 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.create_product.js @@ -23,6 +23,9 @@ function main(parent, product, productId) { // [START retail_v2_generated_ProductService_CreateProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js index 7838dfa1b3b..1b3bea02a04 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.delete_product.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2_generated_ProductService_DeleteProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js index 007c35ea423..e6609f40742 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.get_product.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2_generated_ProductService_GetProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index 3de379978ca..7e1d37beace 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2_generated_ProductService_ImportProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js index 00b71a9aa23..fa4132865c5 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.list_products.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2_generated_ProductService_ListProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js index 8824fefaf54..1db3f6f4613 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -23,6 +23,9 @@ function main(product, type, placeIds) { // [START retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js index 6332ed05df9..e519f38f312 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.remove_local_inventories.js @@ -23,6 +23,9 @@ function main(product, placeIds) { // [START retail_v2_generated_ProductService_RemoveLocalInventories_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js index 769b498c9f2..9d03711851d 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.set_inventory.js @@ -23,6 +23,9 @@ function main(inventory) { // [START retail_v2_generated_ProductService_SetInventory_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js index 7c7a9f41859..fc6253a0b0e 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.update_product.js @@ -23,6 +23,9 @@ function main(product) { // [START retail_v2_generated_ProductService_UpdateProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 0003287723c..3dd41e919be 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -23,6 +23,9 @@ function main(placement, visitorId) { // [START retail_v2_generated_SearchService_Search_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 825b74fd7d1..e45d3a1b72f 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 75, + "end": 78, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 65, "type": "FULL" } ], @@ -114,7 +114,7 @@ "segments": [ { "start": 25, - "end": 73, + "end": 76, "type": "FULL" } ], @@ -166,7 +166,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -206,7 +206,7 @@ "segments": [ { "start": 25, - "end": 110, + "end": 113, "type": "FULL" } ], @@ -270,7 +270,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -318,7 +318,7 @@ "segments": [ { "start": 25, - "end": 175, + "end": 178, "type": "FULL" } ], @@ -386,7 +386,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 75, "type": "FULL" } ], @@ -434,7 +434,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -474,7 +474,7 @@ "segments": [ { "start": 25, - "end": 122, + "end": 125, "type": "FULL" } ], @@ -530,7 +530,7 @@ "segments": [ { "start": 25, - "end": 76, + "end": 79, "type": "FULL" } ], @@ -578,7 +578,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], @@ -618,7 +618,7 @@ "segments": [ { "start": 25, - "end": 91, + "end": 94, "type": "FULL" } ], @@ -682,7 +682,7 @@ "segments": [ { "start": 25, - "end": 120, + "end": 123, "type": "FULL" } ], @@ -734,7 +734,7 @@ "segments": [ { "start": 25, - "end": 108, + "end": 111, "type": "FULL" } ], @@ -790,7 +790,7 @@ "segments": [ { "start": 25, - "end": 104, + "end": 107, "type": "FULL" } ], @@ -846,7 +846,7 @@ "segments": [ { "start": 25, - "end": 91, + "end": 94, "type": "FULL" } ], @@ -902,7 +902,7 @@ "segments": [ { "start": 25, - "end": 77, + "end": 80, "type": "FULL" } ], @@ -954,7 +954,7 @@ "segments": [ { "start": 25, - "end": 282, + "end": 285, "type": "FULL" } ], @@ -1074,7 +1074,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -1118,7 +1118,7 @@ "segments": [ { "start": 25, - "end": 70, + "end": 73, "type": "FULL" } ], @@ -1170,7 +1170,7 @@ "segments": [ { "start": 25, - "end": 82, + "end": 85, "type": "FULL" } ], @@ -1218,7 +1218,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 64, "type": "FULL" } ], @@ -1266,7 +1266,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js index 40992711843..2763ab29838 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.collect_user_event.js @@ -23,6 +23,9 @@ function main(parent, userEvent) { // [START retail_v2_generated_UserEventService_CollectUserEvent_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js index fa18d38d26f..8c65771ff28 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.import_user_events.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2_generated_UserEventService_ImportUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js index 0a008d5d05b..72caf7921ac 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.purge_user_events.js @@ -23,6 +23,9 @@ function main(parent, filter) { // [START retail_v2_generated_UserEventService_PurgeUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js index 925f96b6700..4aa66d96e2a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.rejoin_user_events.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2_generated_UserEventService_RejoinUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js index 6df073a34b4..9ebb728d75a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2/user_event_service.write_user_event.js @@ -23,6 +23,9 @@ function main(parent, userEvent) { // [START retail_v2_generated_UserEventService_WriteUserEvent_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js index 3d89f273f7a..f0582986a6a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js @@ -23,6 +23,9 @@ function main(attributesConfig, catalogAttribute) { // [START retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js index a1a7d124075..f8da57b5bf3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js index b189f66ee58..637169fa3ed 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_completion_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js index 075a2b10f5a..8f199af6699 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.get_default_branch.js @@ -23,6 +23,9 @@ function main() { // [START retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js index 2bed2f3ff7b..6b87c0a6510 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.list_catalogs.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2alpha_generated_CatalogService_ListCatalogs_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js index 2e2aef6a7b5..b3be05fd6d8 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js @@ -23,6 +23,9 @@ function main(attributesConfig, key) { // [START retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js index 0dccc33e40e..d8dca41e410 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js @@ -23,6 +23,9 @@ function main(attributesConfig, catalogAttribute) { // [START retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js index 7fce54ef4f3..73d94d95574 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.set_default_branch.js @@ -23,6 +23,9 @@ function main() { // [START retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js index bf5828a2fa4..875915b830f 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js @@ -23,6 +23,9 @@ function main(attributesConfig) { // [START retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js index 81ee698f731..f7b87f6796d 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_catalog.js @@ -23,6 +23,9 @@ function main(catalog) { // [START retail_v2alpha_generated_CatalogService_UpdateCatalog_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js index 62e6eea357d..8d90945a302 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/catalog_service.update_completion_config.js @@ -23,6 +23,9 @@ function main(completionConfig) { // [START retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js index bbd71d4b413..e4d6046fac9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.complete_query.js @@ -23,6 +23,9 @@ function main(catalog, query) { // [START retail_v2alpha_generated_CompletionService_CompleteQuery_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js index b54422e5b1c..b95bc8a0898 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/completion_service.import_completion_data.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2alpha_generated_CompletionService_ImportCompletionData_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js index 6e7030ce2ef..ddf3a2f6881 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.create_control.js @@ -23,6 +23,9 @@ function main(parent, control, controlId) { // [START retail_v2alpha_generated_ControlService_CreateControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js index eb25534bae5..7c2c6c9cfbd 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.delete_control.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ControlService_DeleteControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js index 344db2f65b2..c359a57f9f9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.get_control.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ControlService_GetControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js index 6912cc04294..4a5f8a6c3c7 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.list_controls.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2alpha_generated_ControlService_ListControls_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js index 7f0e4c67230..b62bbcdaa00 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/control_service.update_control.js @@ -23,6 +23,9 @@ function main(control) { // [START retail_v2alpha_generated_ControlService_UpdateControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js index b513363d609..f301ddfe6d3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.create_model.js @@ -23,6 +23,9 @@ function main(parent, model) { // [START retail_v2alpha_generated_ModelService_CreateModel_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js index 8eca3223570..1339dd8f195 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.delete_model.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ModelService_DeleteModel_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js index 3228c3e9f52..93d15b65699 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.list_models.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2alpha_generated_ModelService_ListModels_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js index 2975b700d42..a8df9b88cd7 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.pause_model.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ModelService_PauseModel_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js index a2b23ab7a0f..efcf35842ab 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.resume_model.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ModelService_ResumeModel_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js index 1ecddf45f69..18b8af29a07 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.tune_model.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ModelService_TuneModel_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js index 5bc5b8475fd..c4f16d6834a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/model_service.update_model.js @@ -23,6 +23,9 @@ function main(model) { // [START retail_v2alpha_generated_ModelService_UpdateModel_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js index 71c0ae34341..0ccea81d7d4 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/prediction_service.predict.js @@ -23,6 +23,9 @@ function main(placement, userEvent) { // [START retail_v2alpha_generated_PredictionService_Predict_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js index 0138666545e..72f731f6084 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js @@ -23,6 +23,9 @@ function main(product, type, placeIds) { // [START retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js index 1a0bcb74263..db8d35e3906 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.add_local_inventories.js @@ -23,6 +23,9 @@ function main(product, localInventories) { // [START retail_v2alpha_generated_ProductService_AddLocalInventories_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js index d452aae491d..50e4380b0e9 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.create_product.js @@ -23,6 +23,9 @@ function main(parent, product, productId) { // [START retail_v2alpha_generated_ProductService_CreateProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js index 7470b33d5a5..ded21af6cae 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.delete_product.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ProductService_DeleteProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js index 5234024040c..3524a0497af 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.get_product.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ProductService_GetProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js index 7eb5abd6fb8..a781e33934f 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.import_products.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2alpha_generated_ProductService_ImportProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js index a9e1ed2f580..ee8629da502 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.list_products.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2alpha_generated_ProductService_ListProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js index 55d09aef102..1909f596edc 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.purge_products.js @@ -23,6 +23,9 @@ function main(parent, filter) { // [START retail_v2alpha_generated_ProductService_PurgeProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js index b028c23b516..f783b7db152 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js @@ -23,6 +23,9 @@ function main(product, type, placeIds) { // [START retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js index 903fe7388f7..2d1f636fd49 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.remove_local_inventories.js @@ -23,6 +23,9 @@ function main(product, placeIds) { // [START retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js index 69d300387cf..01b3a6f7319 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.set_inventory.js @@ -23,6 +23,9 @@ function main(inventory) { // [START retail_v2alpha_generated_ProductService_SetInventory_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js index c12933853a3..311422051f3 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/product_service.update_product.js @@ -23,6 +23,9 @@ function main(product) { // [START retail_v2alpha_generated_ProductService_UpdateProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js index 2c2f990e139..c48a0d38775 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/search_service.search.js @@ -23,6 +23,9 @@ function main(placement, visitorId) { // [START retail_v2alpha_generated_SearchService_Search_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js index 5145a2cb67f..0459af055f7 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.add_control.js @@ -23,6 +23,9 @@ function main(servingConfig, controlId) { // [START retail_v2alpha_generated_ServingConfigService_AddControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js index 3c9aecf971b..879de7d0688 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js @@ -23,6 +23,9 @@ function main(parent, servingConfig, servingConfigId) { // [START retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js index 4ca230b46bf..6163b84f498 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js index b88b3af38fa..dd73fc17198 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js index b79bfca1e4c..031adf60b4a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js index c1ea7176564..f256e5072b6 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.remove_control.js @@ -23,6 +23,9 @@ function main(servingConfig, controlId) { // [START retail_v2alpha_generated_ServingConfigService_RemoveControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js index 7f236fba4eb..bffcbad75bd 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js @@ -23,6 +23,9 @@ function main(servingConfig) { // [START retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index a90411114f3..134afe8d94a 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 75, + "end": 78, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 65, "type": "FULL" } ], @@ -114,7 +114,7 @@ "segments": [ { "start": 25, - "end": 73, + "end": 76, "type": "FULL" } ], @@ -166,7 +166,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -206,7 +206,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -246,7 +246,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 70, "type": "FULL" } ], @@ -290,7 +290,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -330,7 +330,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], @@ -374,7 +374,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -418,7 +418,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -462,7 +462,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -510,7 +510,7 @@ "segments": [ { "start": 25, - "end": 111, + "end": 114, "type": "FULL" } ], @@ -574,7 +574,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -622,7 +622,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -670,7 +670,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -710,7 +710,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -754,7 +754,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -794,7 +794,7 @@ "segments": [ { "start": 25, - "end": 71, + "end": 74, "type": "FULL" } ], @@ -846,7 +846,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 65, "type": "FULL" } ], @@ -894,7 +894,7 @@ "segments": [ { "start": 25, - "end": 52, + "end": 55, "type": "FULL" } ], @@ -934,7 +934,7 @@ "segments": [ { "start": 25, - "end": 52, + "end": 55, "type": "FULL" } ], @@ -974,7 +974,7 @@ "segments": [ { "start": 25, - "end": 52, + "end": 55, "type": "FULL" } ], @@ -1014,7 +1014,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -1062,7 +1062,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -1106,7 +1106,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 56, "type": "FULL" } ], @@ -1146,7 +1146,7 @@ "segments": [ { "start": 25, - "end": 175, + "end": 178, "type": "FULL" } ], @@ -1214,7 +1214,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 75, "type": "FULL" } ], @@ -1262,7 +1262,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -1302,7 +1302,7 @@ "segments": [ { "start": 25, - "end": 133, + "end": 136, "type": "FULL" } ], @@ -1362,7 +1362,7 @@ "segments": [ { "start": 25, - "end": 76, + "end": 79, "type": "FULL" } ], @@ -1410,7 +1410,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 70, "type": "FULL" } ], @@ -1450,7 +1450,7 @@ "segments": [ { "start": 25, - "end": 93, + "end": 96, "type": "FULL" } ], @@ -1498,7 +1498,7 @@ "segments": [ { "start": 25, - "end": 100, + "end": 103, "type": "FULL" } ], @@ -1566,7 +1566,7 @@ "segments": [ { "start": 25, - "end": 120, + "end": 123, "type": "FULL" } ], @@ -1618,7 +1618,7 @@ "segments": [ { "start": 25, - "end": 108, + "end": 111, "type": "FULL" } ], @@ -1674,7 +1674,7 @@ "segments": [ { "start": 25, - "end": 104, + "end": 107, "type": "FULL" } ], @@ -1730,7 +1730,7 @@ "segments": [ { "start": 25, - "end": 92, + "end": 95, "type": "FULL" } ], @@ -1786,7 +1786,7 @@ "segments": [ { "start": 25, - "end": 77, + "end": 80, "type": "FULL" } ], @@ -1838,7 +1838,7 @@ "segments": [ { "start": 25, - "end": 304, + "end": 307, "type": "FULL" } ], @@ -1962,7 +1962,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -2010,7 +2010,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -2050,7 +2050,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -2094,7 +2094,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -2134,7 +2134,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -2182,7 +2182,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -2226,7 +2226,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -2270,7 +2270,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -2314,7 +2314,7 @@ "segments": [ { "start": 25, - "end": 70, + "end": 73, "type": "FULL" } ], @@ -2366,7 +2366,7 @@ "segments": [ { "start": 25, - "end": 83, + "end": 86, "type": "FULL" } ], @@ -2414,7 +2414,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 64, "type": "FULL" } ], @@ -2462,7 +2462,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js index 2c259bbf953..e5f542a0c09 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.collect_user_event.js @@ -23,6 +23,9 @@ function main(parent, userEvent) { // [START retail_v2alpha_generated_UserEventService_CollectUserEvent_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js index 733e1b2f6a6..72ec1632a2e 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.import_user_events.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2alpha_generated_UserEventService_ImportUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js index 9d1d604c61f..a1468cfec63 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.purge_user_events.js @@ -23,6 +23,9 @@ function main(parent, filter) { // [START retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js index e72b2378c20..73257790d89 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js index 8742b9806bf..3286c8f3526 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2alpha/user_event_service.write_user_event.js @@ -23,6 +23,9 @@ function main(parent, userEvent) { // [START retail_v2alpha_generated_UserEventService_WriteUserEvent_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js index 47dc4c03f49..023955f9e77 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.add_catalog_attribute.js @@ -23,6 +23,9 @@ function main(attributesConfig, catalogAttribute) { // [START retail_v2beta_generated_CatalogService_AddCatalogAttribute_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js index 3efc7660648..3e9001c0dc2 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_attributes_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_CatalogService_GetAttributesConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js index 886e118a824..9dfa11507a3 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_CatalogService_GetCompletionConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js index 11ab8856dc8..ceb504cd271 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_default_branch.js @@ -23,6 +23,9 @@ function main() { // [START retail_v2beta_generated_CatalogService_GetDefaultBranch_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js index a72872cb6b1..5bbebe009f8 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.list_catalogs.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2beta_generated_CatalogService_ListCatalogs_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js index 17518d6a10c..751109b1d4e 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js @@ -23,6 +23,9 @@ function main(attributesConfig, key) { // [START retail_v2beta_generated_CatalogService_RemoveCatalogAttribute_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js index 985e2cc2282..0d522a7d700 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js @@ -23,6 +23,9 @@ function main(attributesConfig, catalogAttribute) { // [START retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js index 11f667df09c..a3c06eea85b 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.set_default_branch.js @@ -23,6 +23,9 @@ function main() { // [START retail_v2beta_generated_CatalogService_SetDefaultBranch_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js index dee9a094edf..572b44c767e 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_attributes_config.js @@ -23,6 +23,9 @@ function main(attributesConfig) { // [START retail_v2beta_generated_CatalogService_UpdateAttributesConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js index 3f75b996678..a47a3af0fab 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_catalog.js @@ -23,6 +23,9 @@ function main(catalog) { // [START retail_v2beta_generated_CatalogService_UpdateCatalog_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js index d3c451f3211..ec6fa936ea4 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.update_completion_config.js @@ -23,6 +23,9 @@ function main(completionConfig) { // [START retail_v2beta_generated_CatalogService_UpdateCompletionConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js index 579619105d4..78cc60aea4a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.complete_query.js @@ -23,6 +23,9 @@ function main(catalog, query) { // [START retail_v2beta_generated_CompletionService_CompleteQuery_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js index 046aa015223..3916cfa081d 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2beta_generated_CompletionService_ImportCompletionData_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js index 916ddf4b1a1..940db2aeaf3 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.create_control.js @@ -23,6 +23,9 @@ function main(parent, control, controlId) { // [START retail_v2beta_generated_ControlService_CreateControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js index e77c5d0a730..05e61ff3845 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.delete_control.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_ControlService_DeleteControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js index 135577e7a2a..f5b2332f33a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_ControlService_GetControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js index 32dafdb39e5..b353c4ba13b 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.list_controls.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2beta_generated_ControlService_ListControls_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js index 3bc73051e23..2cdb285471d 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.update_control.js @@ -23,6 +23,9 @@ function main(control) { // [START retail_v2beta_generated_ControlService_UpdateControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index e85ebf4f124..13ffa1c27bc 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -23,6 +23,9 @@ function main(placement, userEvent) { // [START retail_v2beta_generated_PredictionService_Predict_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js index da14011cf26..11595736757 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_fulfillment_places.js @@ -23,6 +23,9 @@ function main(product, type, placeIds) { // [START retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js index 827fb0fe8b9..7b39897b56e 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.add_local_inventories.js @@ -23,6 +23,9 @@ function main(product, localInventories) { // [START retail_v2beta_generated_ProductService_AddLocalInventories_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js index b6387d2e22f..b641964aef7 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.create_product.js @@ -23,6 +23,9 @@ function main(parent, product, productId) { // [START retail_v2beta_generated_ProductService_CreateProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js index 95f4548f553..169a645d190 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.delete_product.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_ProductService_DeleteProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js index d0520d7e9e5..7a0870dd0c6 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.get_product.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_ProductService_GetProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index a6b6cab95ad..8010bd30543 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2beta_generated_ProductService_ImportProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js index d4971483391..5a424c00a13 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.list_products.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2beta_generated_ProductService_ListProducts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js index f6346b05926..460a1a25f82 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_fulfillment_places.js @@ -23,6 +23,9 @@ function main(product, type, placeIds) { // [START retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js index a61bac1d185..bf094481db9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.remove_local_inventories.js @@ -23,6 +23,9 @@ function main(product, placeIds) { // [START retail_v2beta_generated_ProductService_RemoveLocalInventories_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js index 454263cae2f..5ce1fc6d5aa 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.set_inventory.js @@ -23,6 +23,9 @@ function main(inventory) { // [START retail_v2beta_generated_ProductService_SetInventory_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js index 1337de86e3a..8140d581d8a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.update_product.js @@ -23,6 +23,9 @@ function main(product) { // [START retail_v2beta_generated_ProductService_UpdateProduct_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index 64fcd971150..6d8ff0e3ae8 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -23,6 +23,9 @@ function main(placement, visitorId) { // [START retail_v2beta_generated_SearchService_Search_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js index 9086bb910bf..5396a381fae 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js @@ -23,6 +23,9 @@ function main(servingConfig, controlId) { // [START retail_v2beta_generated_ServingConfigService_AddControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js index 7cd44e74eb9..613db80c746 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.create_serving_config.js @@ -23,6 +23,9 @@ function main(parent, servingConfig, servingConfigId) { // [START retail_v2beta_generated_ServingConfigService_CreateServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js index c9202725c12..2002c69da77 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_ServingConfigService_DeleteServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js index be98fd45251..bf44e361fed 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js @@ -23,6 +23,9 @@ function main(name) { // [START retail_v2beta_generated_ServingConfigService_GetServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js index 7a517f3e12b..d22961b4540 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2beta_generated_ServingConfigService_ListServingConfigs_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js index 314b82f9e4c..5ec4d631475 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js @@ -23,6 +23,9 @@ function main(servingConfig, controlId) { // [START retail_v2beta_generated_ServingConfigService_RemoveControl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js index f948464a8a8..c39e2e42efa 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.update_serving_config.js @@ -23,6 +23,9 @@ function main(servingConfig) { // [START retail_v2beta_generated_ServingConfigService_UpdateServingConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 6241946aee8..4ab319f44a5 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 75, + "end": 78, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 65, "type": "FULL" } ], @@ -114,7 +114,7 @@ "segments": [ { "start": 25, - "end": 73, + "end": 76, "type": "FULL" } ], @@ -166,7 +166,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -206,7 +206,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -246,7 +246,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 70, "type": "FULL" } ], @@ -290,7 +290,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -330,7 +330,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], @@ -374,7 +374,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -418,7 +418,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -462,7 +462,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -510,7 +510,7 @@ "segments": [ { "start": 25, - "end": 111, + "end": 114, "type": "FULL" } ], @@ -574,7 +574,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -622,7 +622,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -670,7 +670,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -710,7 +710,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -754,7 +754,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -794,7 +794,7 @@ "segments": [ { "start": 25, - "end": 71, + "end": 74, "type": "FULL" } ], @@ -846,7 +846,7 @@ "segments": [ { "start": 25, - "end": 175, + "end": 178, "type": "FULL" } ], @@ -914,7 +914,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 75, "type": "FULL" } ], @@ -962,7 +962,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -1002,7 +1002,7 @@ "segments": [ { "start": 25, - "end": 124, + "end": 127, "type": "FULL" } ], @@ -1058,7 +1058,7 @@ "segments": [ { "start": 25, - "end": 76, + "end": 79, "type": "FULL" } ], @@ -1106,7 +1106,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 70, "type": "FULL" } ], @@ -1146,7 +1146,7 @@ "segments": [ { "start": 25, - "end": 91, + "end": 94, "type": "FULL" } ], @@ -1210,7 +1210,7 @@ "segments": [ { "start": 25, - "end": 120, + "end": 123, "type": "FULL" } ], @@ -1262,7 +1262,7 @@ "segments": [ { "start": 25, - "end": 108, + "end": 111, "type": "FULL" } ], @@ -1318,7 +1318,7 @@ "segments": [ { "start": 25, - "end": 104, + "end": 107, "type": "FULL" } ], @@ -1374,7 +1374,7 @@ "segments": [ { "start": 25, - "end": 92, + "end": 95, "type": "FULL" } ], @@ -1430,7 +1430,7 @@ "segments": [ { "start": 25, - "end": 77, + "end": 80, "type": "FULL" } ], @@ -1482,7 +1482,7 @@ "segments": [ { "start": 25, - "end": 284, + "end": 287, "type": "FULL" } ], @@ -1602,7 +1602,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -1650,7 +1650,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -1690,7 +1690,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -1734,7 +1734,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -1774,7 +1774,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -1822,7 +1822,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -1866,7 +1866,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -1910,7 +1910,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -1954,7 +1954,7 @@ "segments": [ { "start": 25, - "end": 70, + "end": 73, "type": "FULL" } ], @@ -2006,7 +2006,7 @@ "segments": [ { "start": 25, - "end": 83, + "end": 86, "type": "FULL" } ], @@ -2054,7 +2054,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 64, "type": "FULL" } ], @@ -2102,7 +2102,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js index 933ec59d13c..ad837df15dc 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.collect_user_event.js @@ -23,6 +23,9 @@ function main(parent, userEvent) { // [START retail_v2beta_generated_UserEventService_CollectUserEvent_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js index 842e14dd3f5..5e2d40e22c7 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.import_user_events.js @@ -23,6 +23,9 @@ function main(parent, inputConfig) { // [START retail_v2beta_generated_UserEventService_ImportUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js index 059d6944a45..7bd58e1d062 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.purge_user_events.js @@ -23,6 +23,9 @@ function main(parent, filter) { // [START retail_v2beta_generated_UserEventService_PurgeUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js index aebf64dcae9..45f8c89e8c9 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js @@ -23,6 +23,9 @@ function main(parent) { // [START retail_v2beta_generated_UserEventService_RejoinUserEvents_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js index da53a1423e0..9e2d4d93808 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.write_user_event.js @@ -23,6 +23,9 @@ function main(parent, userEvent) { // [START retail_v2beta_generated_UserEventService_WriteUserEvent_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 244bf337517..bb605c6d2a3 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -306,7 +305,8 @@ export class CatalogServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -861,7 +861,7 @@ export class CatalogServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( - this.innerApiCalls.listCatalogs as gax.GaxCall, + this.innerApiCalls.listCatalogs as GaxCall, request, callSettings ); @@ -927,7 +927,7 @@ export class CatalogServiceClient { this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index c9e701a1db9..eabd1c74f8f 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -299,7 +299,8 @@ export class CompletionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -658,7 +659,7 @@ export class CompletionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importCompletionData, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.ImportCompletionDataResponse, diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index ed9846755ff..1c6643737b1 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -36,7 +36,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -280,7 +280,8 @@ export class PredictionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index c4f1aa02663..6e9d68e8378 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -32,7 +32,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -390,7 +389,8 @@ export class ProductServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1035,7 +1035,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importProducts, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.ImportProductsResponse, @@ -1290,7 +1290,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.setInventory, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.SetInventoryResponse, @@ -1495,7 +1495,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.addFulfillmentPlaces, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.AddFulfillmentPlacesResponse, @@ -1699,7 +1699,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.removeFulfillmentPlaces, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse, @@ -1893,7 +1893,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.addLocalInventories, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.AddLocalInventoriesResponse, @@ -2073,7 +2073,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.removeLocalInventories, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.RemoveLocalInventoriesResponse, @@ -2345,7 +2345,7 @@ export class ProductServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as gax.GaxCall, + this.innerApiCalls.listProducts as GaxCall, request, callSettings ); @@ -2460,7 +2460,7 @@ export class ProductServiceClient { this.initialize(); return this.descriptors.page.listProducts.asyncIterate( this.innerApiCalls['listProducts'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 058ed7c082c..83c19b0ec52 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -301,7 +300,8 @@ export class SearchServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -924,7 +924,7 @@ export class SearchServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.createStream( - this.innerApiCalls.search as gax.GaxCall, + this.innerApiCalls.search as GaxCall, request, callSettings ); @@ -1186,7 +1186,7 @@ export class SearchServiceClient { this.initialize(); return this.descriptors.page.search.asyncIterate( this.innerApiCalls['search'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 21df7dbdce4..04a8bafc24e 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -321,7 +321,8 @@ export class UserEventServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -737,7 +738,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.purgeUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.PurgeUserEventsResponse, @@ -885,7 +886,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.ImportUserEventsResponse, @@ -1035,7 +1036,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.rejoinUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2.RejoinUserEventsResponse, diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index a57e83249b7..a4f3f690424 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -328,7 +327,8 @@ export class CatalogServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1678,7 +1678,7 @@ export class CatalogServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( - this.innerApiCalls.listCatalogs as gax.GaxCall, + this.innerApiCalls.listCatalogs as GaxCall, request, callSettings ); @@ -1744,7 +1744,7 @@ export class CatalogServiceClient { this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 97b80ad9162..c5ae96988f4 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -314,7 +314,8 @@ export class CompletionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -680,7 +681,7 @@ export class CompletionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importCompletionData, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.ImportCompletionDataResponse, diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts index 6c5021768c9..115d3099ab1 100644 --- a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './control_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -316,7 +315,8 @@ export class ControlServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -924,7 +924,7 @@ export class ControlServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listControls.createStream( - this.innerApiCalls.listControls as gax.GaxCall, + this.innerApiCalls.listControls as GaxCall, request, callSettings ); @@ -982,7 +982,7 @@ export class ControlServiceClient { this.initialize(); return this.descriptors.page.listControls.asyncIterate( this.innerApiCalls['listControls'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts index 2b4cbec924b..0fd3257016d 100644 --- a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts @@ -32,7 +32,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -356,7 +355,8 @@ export class ModelServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -906,7 +906,7 @@ export class ModelServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createModel, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.Model, @@ -1045,7 +1045,7 @@ export class ModelServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.tuneModel, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.TuneModelResponse, @@ -1191,7 +1191,7 @@ export class ModelServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listModels.createStream( - this.innerApiCalls.listModels as gax.GaxCall, + this.innerApiCalls.listModels as GaxCall, request, callSettings ); @@ -1243,7 +1243,7 @@ export class ModelServiceClient { this.initialize(); return this.descriptors.page.listModels.asyncIterate( this.innerApiCalls['listModels'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 05b791fec05..c2ebe0be460 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -36,7 +36,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -295,7 +295,8 @@ export class PredictionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 21cd856ed07..3e8adbe24f8 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -32,7 +32,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -417,7 +416,8 @@ export class ProductServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1106,7 +1106,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.purgeProducts, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.PurgeProductsResponse, @@ -1291,7 +1291,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importProducts, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.ImportProductsResponse, @@ -1546,7 +1546,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.setInventory, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.SetInventoryResponse, @@ -1751,7 +1751,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.addFulfillmentPlaces, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse, @@ -1955,7 +1955,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.removeFulfillmentPlaces, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse, @@ -2150,7 +2150,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.addLocalInventories, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.AddLocalInventoriesResponse, @@ -2330,7 +2330,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.removeLocalInventories, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse, @@ -2628,7 +2628,7 @@ export class ProductServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as gax.GaxCall, + this.innerApiCalls.listProducts as GaxCall, request, callSettings ); @@ -2753,7 +2753,7 @@ export class ProductServiceClient { this.initialize(); return this.descriptors.page.listProducts.asyncIterate( this.innerApiCalls['listProducts'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index 29bd94dd009..d83fe6d0618 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -316,7 +315,8 @@ export class SearchServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -981,7 +981,7 @@ export class SearchServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.createStream( - this.innerApiCalls.search as gax.GaxCall, + this.innerApiCalls.search as GaxCall, request, callSettings ); @@ -1264,7 +1264,7 @@ export class SearchServiceClient { this.initialize(); return this.descriptors.page.search.asyncIterate( this.innerApiCalls['search'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts index 5a837f7657b..67dfe6090db 100644 --- a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './serving_config_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -319,7 +318,8 @@ export class ServingConfigServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1130,7 +1130,7 @@ export class ServingConfigServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServingConfigs.createStream( - this.innerApiCalls.listServingConfigs as gax.GaxCall, + this.innerApiCalls.listServingConfigs as GaxCall, request, callSettings ); @@ -1182,7 +1182,7 @@ export class ServingConfigServiceClient { this.initialize(); return this.descriptors.page.listServingConfigs.asyncIterate( this.innerApiCalls['listServingConfigs'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index bd6b6aae4d4..7f4c4b28421 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -336,7 +336,8 @@ export class UserEventServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -765,7 +766,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.purgeUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.PurgeUserEventsResponse, @@ -913,7 +914,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.ImportUserEventsResponse, @@ -1063,7 +1064,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.rejoinUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2alpha.RejoinUserEventsResponse, diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 8c0c688f0d0..adc959b94c3 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -325,7 +324,8 @@ export class CatalogServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1657,7 +1657,7 @@ export class CatalogServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCatalogs.createStream( - this.innerApiCalls.listCatalogs as gax.GaxCall, + this.innerApiCalls.listCatalogs as GaxCall, request, callSettings ); @@ -1723,7 +1723,7 @@ export class CatalogServiceClient { this.initialize(); return this.descriptors.page.listCatalogs.asyncIterate( this.innerApiCalls['listCatalogs'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index a8d126d669d..cafa859e713 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -311,7 +311,8 @@ export class CompletionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -677,7 +678,7 @@ export class CompletionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importCompletionData, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.ImportCompletionDataResponse, diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client.ts b/packages/google-cloud-retail/src/v2beta/control_service_client.ts index 4b0de7707e0..fb446de3637 100644 --- a/packages/google-cloud-retail/src/v2beta/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/control_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './control_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -313,7 +312,8 @@ export class ControlServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -921,7 +921,7 @@ export class ControlServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listControls.createStream( - this.innerApiCalls.listControls as gax.GaxCall, + this.innerApiCalls.listControls as GaxCall, request, callSettings ); @@ -979,7 +979,7 @@ export class ControlServiceClient { this.initialize(); return this.descriptors.page.listControls.asyncIterate( this.innerApiCalls['listControls'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 080e1704146..87b62347115 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -36,7 +36,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -292,7 +292,8 @@ export class PredictionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 1b8ffb6128e..af22deb4419 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -32,7 +32,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -402,7 +401,8 @@ export class ProductServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1068,7 +1068,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importProducts, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.ImportProductsResponse, @@ -1323,7 +1323,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.setInventory, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.SetInventoryResponse, @@ -1528,7 +1528,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.addFulfillmentPlaces, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.AddFulfillmentPlacesResponse, @@ -1732,7 +1732,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.removeFulfillmentPlaces, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse, @@ -1927,7 +1927,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.addLocalInventories, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.AddLocalInventoriesResponse, @@ -2107,7 +2107,7 @@ export class ProductServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.removeLocalInventories, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.RemoveLocalInventoriesResponse, @@ -2389,7 +2389,7 @@ export class ProductServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as gax.GaxCall, + this.innerApiCalls.listProducts as GaxCall, request, callSettings ); @@ -2506,7 +2506,7 @@ export class ProductServiceClient { this.initialize(); return this.descriptors.page.listProducts.asyncIterate( this.innerApiCalls['listProducts'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index f66d32ca833..4aa4ec66f98 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -313,7 +312,8 @@ export class SearchServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -940,7 +940,7 @@ export class SearchServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.search.createStream( - this.innerApiCalls.search as gax.GaxCall, + this.innerApiCalls.search as GaxCall, request, callSettings ); @@ -1204,7 +1204,7 @@ export class SearchServiceClient { this.initialize(); return this.descriptors.page.search.asyncIterate( this.innerApiCalls['search'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts index 945bfec445d..6a8350d1d1f 100644 --- a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts @@ -31,7 +31,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -40,7 +39,7 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './serving_config_service_client_config.json'; -import {operationsProtos} from 'google-gax'; + const version = require('../../../package.json').version; /** @@ -315,7 +314,8 @@ export class ServingConfigServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1107,7 +1107,7 @@ export class ServingConfigServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServingConfigs.createStream( - this.innerApiCalls.listServingConfigs as gax.GaxCall, + this.innerApiCalls.listServingConfigs as GaxCall, request, callSettings ); @@ -1159,7 +1159,7 @@ export class ServingConfigServiceClient { this.initialize(); return this.descriptors.page.listServingConfigs.asyncIterate( this.innerApiCalls['listServingConfigs'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 168b13c51a5..b3dc54bcd81 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -333,7 +333,8 @@ export class UserEventServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -762,7 +763,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.purgeUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.PurgeUserEventsResponse, @@ -910,7 +911,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.importUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.ImportUserEventsResponse, @@ -1060,7 +1061,7 @@ export class UserEventServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.rejoinUserEvents, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.retail.v2beta.RejoinUserEventsResponse, diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index a6b62537317..ed06b81df69 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -25,12 +25,7 @@ import * as catalogserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2.CatalogServiceClient', () => { - it('has servicePath', () => { - const servicePath = - catalogserviceModule.v2.CatalogServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - catalogserviceModule.v2.CatalogServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = catalogserviceModule.v2.CatalogServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new catalogserviceModule.v2.CatalogServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + catalogserviceModule.v2.CatalogServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new catalogserviceModule.v2.CatalogServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + catalogserviceModule.v2.CatalogServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new catalogserviceModule.v2.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = catalogserviceModule.v2.CatalogServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.catalogServiceStub, undefined); - await client.initialize(); - assert(client.catalogServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new catalogserviceModule.v2.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new catalogserviceModule.v2.CatalogServiceClient(); + assert(client); }); - client.initialize(); - assert(client.catalogServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new catalogserviceModule.v2.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + await client.initialize(); + assert(client.catalogServiceStub); }); - assert.strictEqual(client.catalogServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.catalogServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('updateCatalog', () => { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 67cc1b3a60c..de93c616425 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -25,12 +25,7 @@ import * as catalogserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2alpha.CatalogServiceClient', () => { - it('has servicePath', () => { - const servicePath = - catalogserviceModule.v2alpha.CatalogServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - catalogserviceModule.v2alpha.CatalogServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = catalogserviceModule.v2alpha.CatalogServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + catalogserviceModule.v2alpha.CatalogServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + catalogserviceModule.v2alpha.CatalogServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - fallback: true, + it('has port', () => { + const port = catalogserviceModule.v2alpha.CatalogServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); + assert(client); }); - assert.strictEqual(client.catalogServiceStub, undefined); - await client.initialize(); - assert(client.catalogServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.catalogServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + await client.initialize(); + assert(client.catalogServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.catalogServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.catalogServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('updateCatalog', () => { diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 94e7f1c5959..9d58e8ec64c 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -25,12 +25,7 @@ import * as catalogserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2beta.CatalogServiceClient', () => { - it('has servicePath', () => { - const servicePath = - catalogserviceModule.v2beta.CatalogServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - catalogserviceModule.v2beta.CatalogServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = catalogserviceModule.v2beta.CatalogServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + catalogserviceModule.v2beta.CatalogServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new catalogserviceModule.v2beta.CatalogServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + catalogserviceModule.v2beta.CatalogServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new catalogserviceModule.v2beta.CatalogServiceClient({ - fallback: true, + it('has port', () => { + const port = catalogserviceModule.v2beta.CatalogServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new catalogserviceModule.v2beta.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient(); + assert(client); }); - assert.strictEqual(client.catalogServiceStub, undefined); - await client.initialize(); - assert(client.catalogServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new catalogserviceModule.v2beta.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.catalogServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + await client.initialize(); + assert(client.catalogServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new catalogserviceModule.v2beta.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.catalogServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.catalogServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.catalogServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2beta.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2beta.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('updateCatalog', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index 590b92dc12d..c026572998b 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -110,101 +110,103 @@ function stubAsyncIterationCall( } describe('v2.CompletionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - completionserviceModule.v2.CompletionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - completionserviceModule.v2.CompletionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = completionserviceModule.v2.CompletionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new completionserviceModule.v2.CompletionServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + completionserviceModule.v2.CompletionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new completionserviceModule.v2.CompletionServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + completionserviceModule.v2.CompletionServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new completionserviceModule.v2.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = completionserviceModule.v2.CompletionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.completionServiceStub, undefined); - await client.initialize(); - assert(client.completionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new completionserviceModule.v2.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new completionserviceModule.v2.CompletionServiceClient(); + assert(client); }); - client.initialize(); - assert(client.completionServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new completionserviceModule.v2.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + await client.initialize(); + assert(client.completionServiceStub); }); - assert.strictEqual(client.completionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.completionServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('completeQuery', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index 59bf9fbd55c..8a206148e23 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -110,102 +110,110 @@ function stubAsyncIterationCall( } describe('v2alpha.CompletionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - completionserviceModule.v2alpha.CompletionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - completionserviceModule.v2alpha.CompletionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = completionserviceModule.v2alpha.CompletionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new completionserviceModule.v2alpha.CompletionServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + completionserviceModule.v2alpha.CompletionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + completionserviceModule.v2alpha.CompletionServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = completionserviceModule.v2alpha.CompletionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.completionServiceStub, undefined); - await client.initialize(); - assert(client.completionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient(); + assert(client); }); - client.initialize(); - assert(client.completionServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + await client.initialize(); + assert(client.completionServiceStub); }); - assert.strictEqual(client.completionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.completionServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.completionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new completionserviceModule.v2alpha.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('completeQuery', () => { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index d9a120566b0..f7dc6abce63 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -110,101 +110,116 @@ function stubAsyncIterationCall( } describe('v2beta.CompletionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - completionserviceModule.v2beta.CompletionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - completionserviceModule.v2beta.CompletionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = completionserviceModule.v2beta.CompletionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new completionserviceModule.v2beta.CompletionServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + completionserviceModule.v2beta.CompletionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new completionserviceModule.v2beta.CompletionServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + completionserviceModule.v2beta.CompletionServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new completionserviceModule.v2beta.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = completionserviceModule.v2beta.CompletionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.completionServiceStub, undefined); - await client.initialize(); - assert(client.completionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new completionserviceModule.v2beta.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = + new completionserviceModule.v2beta.CompletionServiceClient(); + assert(client); }); - client.initialize(); - assert(client.completionServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + fallback: true, + } + ); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new completionserviceModule.v2beta.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.completionServiceStub, undefined); + await client.initialize(); + assert(client.completionServiceStub); }); - assert.strictEqual(client.completionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.completionServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2beta.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.completionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2beta.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', } + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('completeQuery', () => { diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts index f075d493b48..ef1a3b83c11 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts @@ -25,12 +25,7 @@ import * as controlserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2alpha.ControlServiceClient', () => { - it('has servicePath', () => { - const servicePath = - controlserviceModule.v2alpha.ControlServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - controlserviceModule.v2alpha.ControlServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = controlserviceModule.v2alpha.ControlServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + controlserviceModule.v2alpha.ControlServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + controlserviceModule.v2alpha.ControlServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = controlserviceModule.v2alpha.ControlServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.controlServiceStub, undefined); - await client.initialize(); - assert(client.controlServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient(); + assert(client); }); - client.initialize(); - assert(client.controlServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + await client.initialize(); + assert(client.controlServiceStub); }); - assert.strictEqual(client.controlServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.controlServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2alpha.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createControl', () => { diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts index 04e88b6e9ef..5e4d27297ec 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts @@ -25,12 +25,7 @@ import * as controlserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2beta.ControlServiceClient', () => { - it('has servicePath', () => { - const servicePath = - controlserviceModule.v2beta.ControlServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - controlserviceModule.v2beta.ControlServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = controlserviceModule.v2beta.ControlServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new controlserviceModule.v2beta.ControlServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + controlserviceModule.v2beta.ControlServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new controlserviceModule.v2beta.ControlServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + controlserviceModule.v2beta.ControlServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new controlserviceModule.v2beta.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = controlserviceModule.v2beta.ControlServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.controlServiceStub, undefined); - await client.initialize(); - assert(client.controlServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new controlserviceModule.v2beta.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new controlserviceModule.v2beta.ControlServiceClient(); + assert(client); }); - client.initialize(); - assert(client.controlServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new controlserviceModule.v2beta.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + await client.initialize(); + assert(client.controlServiceStub); }); - assert.strictEqual(client.controlServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.controlServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2beta.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2beta.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createControl', () => { diff --git a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts index 1ae8b6e3867..8f6dca90e46 100644 --- a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts @@ -150,101 +150,103 @@ function stubAsyncIterationCall( } describe('v2alpha.ModelServiceClient', () => { - it('has servicePath', () => { - const servicePath = - modelserviceModule.v2alpha.ModelServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - modelserviceModule.v2alpha.ModelServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = modelserviceModule.v2alpha.ModelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + modelserviceModule.v2alpha.ModelServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + modelserviceModule.v2alpha.ModelServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - fallback: true, + it('has port', () => { + const port = modelserviceModule.v2alpha.ModelServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient(); + assert(client); }); - assert.strictEqual(client.modelServiceStub, undefined); - await client.initialize(); - assert(client.modelServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.modelServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.modelServiceStub, undefined); + await client.initialize(); + assert(client.modelServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.modelServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.modelServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.modelServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new modelserviceModule.v2alpha.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('pauseModel', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 894ecb51a50..466aee79dfd 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -23,12 +23,7 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as predictionserviceModule from '../src'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -78,101 +73,103 @@ function stubAsyncIterationCall( } describe('v2.PredictionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - predictionserviceModule.v2.PredictionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - predictionserviceModule.v2.PredictionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = predictionserviceModule.v2.PredictionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + predictionserviceModule.v2.PredictionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new predictionserviceModule.v2.PredictionServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + predictionserviceModule.v2.PredictionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new predictionserviceModule.v2.PredictionServiceClient({ - fallback: true, + it('has port', () => { + const port = predictionserviceModule.v2.PredictionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new predictionserviceModule.v2.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new predictionserviceModule.v2.PredictionServiceClient(); + assert(client); }); - assert.strictEqual(client.predictionServiceStub, undefined); - await client.initialize(); - assert(client.predictionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new predictionserviceModule.v2.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.predictionServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + await client.initialize(); + assert(client.predictionServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new predictionserviceModule.v2.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.predictionServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.predictionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('predict', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index ffb266f8571..26dc609c27a 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -23,12 +23,7 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as predictionserviceModule from '../src'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -78,102 +73,110 @@ function stubAsyncIterationCall( } describe('v2alpha.PredictionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - predictionserviceModule.v2alpha.PredictionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - predictionserviceModule.v2alpha.PredictionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = predictionserviceModule.v2alpha.PredictionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new predictionserviceModule.v2alpha.PredictionServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + predictionserviceModule.v2alpha.PredictionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + predictionserviceModule.v2alpha.PredictionServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = predictionserviceModule.v2alpha.PredictionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.predictionServiceStub, undefined); - await client.initialize(); - assert(client.predictionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient(); + assert(client); }); - client.initialize(); - assert(client.predictionServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + await client.initialize(); + assert(client.predictionServiceStub); }); - assert.strictEqual(client.predictionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.predictionServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.predictionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new predictionserviceModule.v2alpha.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('predict', () => { diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index 12a9d7d1c5a..7c0c245035d 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -23,12 +23,7 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as predictionserviceModule from '../src'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -78,101 +73,116 @@ function stubAsyncIterationCall( } describe('v2beta.PredictionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - predictionserviceModule.v2beta.PredictionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - predictionserviceModule.v2beta.PredictionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = predictionserviceModule.v2beta.PredictionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new predictionserviceModule.v2beta.PredictionServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + predictionserviceModule.v2beta.PredictionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new predictionserviceModule.v2beta.PredictionServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + predictionserviceModule.v2beta.PredictionServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new predictionserviceModule.v2beta.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = predictionserviceModule.v2beta.PredictionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.predictionServiceStub, undefined); - await client.initialize(); - assert(client.predictionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new predictionserviceModule.v2beta.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = + new predictionserviceModule.v2beta.PredictionServiceClient(); + assert(client); }); - client.initialize(); - assert(client.predictionServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + fallback: true, + } + ); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new predictionserviceModule.v2beta.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.predictionServiceStub, undefined); + await client.initialize(); + assert(client.predictionServiceStub); }); - assert.strictEqual(client.predictionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.predictionServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2beta.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.predictionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2beta.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', } + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('predict', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index fe6ae181a66..516a55e15b4 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -150,101 +150,103 @@ function stubAsyncIterationCall( } describe('v2.ProductServiceClient', () => { - it('has servicePath', () => { - const servicePath = - productserviceModule.v2.ProductServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - productserviceModule.v2.ProductServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = productserviceModule.v2.ProductServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + productserviceModule.v2.ProductServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new productserviceModule.v2.ProductServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + productserviceModule.v2.ProductServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new productserviceModule.v2.ProductServiceClient({ - fallback: true, + it('has port', () => { + const port = productserviceModule.v2.ProductServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new productserviceModule.v2.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new productserviceModule.v2.ProductServiceClient(); + assert(client); }); - assert.strictEqual(client.productServiceStub, undefined); - await client.initialize(); - assert(client.productServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new productserviceModule.v2.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new productserviceModule.v2.ProductServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.productServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + await client.initialize(); + assert(client.productServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new productserviceModule.v2.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.productServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.productServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createProduct', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index cb414998c0b..68b4016422a 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -150,101 +150,103 @@ function stubAsyncIterationCall( } describe('v2alpha.ProductServiceClient', () => { - it('has servicePath', () => { - const servicePath = - productserviceModule.v2alpha.ProductServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - productserviceModule.v2alpha.ProductServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = productserviceModule.v2alpha.ProductServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + productserviceModule.v2alpha.ProductServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + productserviceModule.v2alpha.ProductServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - fallback: true, + it('has port', () => { + const port = productserviceModule.v2alpha.ProductServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new productserviceModule.v2alpha.ProductServiceClient(); + assert(client); }); - assert.strictEqual(client.productServiceStub, undefined); - await client.initialize(); - assert(client.productServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.productServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + await client.initialize(); + assert(client.productServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.productServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.productServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2alpha.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createProduct', () => { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 7e321bb46b5..12021ec27e3 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -150,101 +150,103 @@ function stubAsyncIterationCall( } describe('v2beta.ProductServiceClient', () => { - it('has servicePath', () => { - const servicePath = - productserviceModule.v2beta.ProductServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - productserviceModule.v2beta.ProductServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = productserviceModule.v2beta.ProductServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + productserviceModule.v2beta.ProductServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new productserviceModule.v2beta.ProductServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + productserviceModule.v2beta.ProductServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new productserviceModule.v2beta.ProductServiceClient({ - fallback: true, + it('has port', () => { + const port = productserviceModule.v2beta.ProductServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new productserviceModule.v2beta.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new productserviceModule.v2beta.ProductServiceClient(); + assert(client); }); - assert.strictEqual(client.productServiceStub, undefined); - await client.initialize(); - assert(client.productServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new productserviceModule.v2beta.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.productServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + await client.initialize(); + assert(client.productServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new productserviceModule.v2beta.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.productServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.productServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.productServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2beta.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2beta.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createProduct', () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index 9edecaa7474..ae72356aa5e 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -25,12 +25,7 @@ import * as searchserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,99 +113,103 @@ function stubAsyncIterationCall( } describe('v2.SearchServiceClient', () => { - it('has servicePath', () => { - const servicePath = searchserviceModule.v2.SearchServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = searchserviceModule.v2.SearchServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = searchserviceModule.v2.SearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new searchserviceModule.v2.SearchServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + searchserviceModule.v2.SearchServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new searchserviceModule.v2.SearchServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + searchserviceModule.v2.SearchServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new searchserviceModule.v2.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = searchserviceModule.v2.SearchServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.searchServiceStub, undefined); - await client.initialize(); - assert(client.searchServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new searchserviceModule.v2.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new searchserviceModule.v2.SearchServiceClient(); + assert(client); }); - client.initialize(); - assert(client.searchServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new searchserviceModule.v2.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + await client.initialize(); + assert(client.searchServiceStub); }); - assert.strictEqual(client.searchServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.searchServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('search', () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index 22de4b92a3c..67c841bb4d8 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -25,12 +25,7 @@ import * as searchserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2alpha.SearchServiceClient', () => { - it('has servicePath', () => { - const servicePath = - searchserviceModule.v2alpha.SearchServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - searchserviceModule.v2alpha.SearchServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = searchserviceModule.v2alpha.SearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + searchserviceModule.v2alpha.SearchServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + searchserviceModule.v2alpha.SearchServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = searchserviceModule.v2alpha.SearchServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.searchServiceStub, undefined); - await client.initialize(); - assert(client.searchServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient(); + assert(client); }); - client.initialize(); - assert(client.searchServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + await client.initialize(); + assert(client.searchServiceStub); }); - assert.strictEqual(client.searchServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.searchServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2alpha.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('search', () => { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index a5d7cc1a25c..d6bbcd1f0ae 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -25,12 +25,7 @@ import * as searchserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,101 +113,103 @@ function stubAsyncIterationCall( } describe('v2beta.SearchServiceClient', () => { - it('has servicePath', () => { - const servicePath = - searchserviceModule.v2beta.SearchServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - searchserviceModule.v2beta.SearchServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = searchserviceModule.v2beta.SearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new searchserviceModule.v2beta.SearchServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + searchserviceModule.v2beta.SearchServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new searchserviceModule.v2beta.SearchServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + searchserviceModule.v2beta.SearchServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new searchserviceModule.v2beta.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = searchserviceModule.v2beta.SearchServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.searchServiceStub, undefined); - await client.initialize(); - assert(client.searchServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new searchserviceModule.v2beta.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new searchserviceModule.v2beta.SearchServiceClient(); + assert(client); }); - client.initialize(); - assert(client.searchServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new searchserviceModule.v2beta.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + await client.initialize(); + assert(client.searchServiceStub); }); - assert.strictEqual(client.searchServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.searchServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2beta.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.searchServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2beta.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('search', () => { diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts index cd9bd6c2715..ace7d68058c 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts @@ -25,12 +25,7 @@ import * as servingconfigserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,109 +113,113 @@ function stubAsyncIterationCall( } describe('v2alpha.ServingConfigServiceClient', () => { - it('has servicePath', () => { - const servicePath = - servingconfigserviceModule.v2alpha.ServingConfigServiceClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + servingconfigserviceModule.v2alpha.ServingConfigServiceClient + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - servingconfigserviceModule.v2alpha.ServingConfigServiceClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + servingconfigserviceModule.v2alpha.ServingConfigServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - servingconfigserviceModule.v2alpha.ServingConfigServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + servingconfigserviceModule.v2alpha.ServingConfigServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - await client.initialize(); - assert(client.servingConfigServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + await client.initialize(); + assert(client.servingConfigServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.servingConfigServiceStub); + client.close().then(() => { + done(); }); - client.initialize(); - assert(client.servingConfigServiceStub); - client.close().then(() => { - done(); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + client.close().then(() => { + done(); }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - client.close().then(() => { - done(); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createServingConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts index 9346d04c54b..c6e21e6c597 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts @@ -25,12 +25,7 @@ import * as servingconfigserviceModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - LROperation, - operationsProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -118,109 +113,113 @@ function stubAsyncIterationCall( } describe('v2beta.ServingConfigServiceClient', () => { - it('has servicePath', () => { - const servicePath = - servingconfigserviceModule.v2beta.ServingConfigServiceClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + servingconfigserviceModule.v2beta.ServingConfigServiceClient + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - servingconfigserviceModule.v2beta.ServingConfigServiceClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + servingconfigserviceModule.v2beta.ServingConfigServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - servingconfigserviceModule.v2beta.ServingConfigServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + servingconfigserviceModule.v2beta.ServingConfigServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - await client.initialize(); - assert(client.servingConfigServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + await client.initialize(); + assert(client.servingConfigServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.servingConfigServiceStub); + client.close().then(() => { + done(); }); - client.initialize(); - assert(client.servingConfigServiceStub); - client.close().then(() => { - done(); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + client.close().then(() => { + done(); }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - client.close().then(() => { - done(); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createServingConfig', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index 0a80fc013ee..c45a9686de5 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -110,101 +110,103 @@ function stubAsyncIterationCall( } describe('v2.UserEventServiceClient', () => { - it('has servicePath', () => { - const servicePath = - usereventserviceModule.v2.UserEventServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - usereventserviceModule.v2.UserEventServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = usereventserviceModule.v2.UserEventServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new usereventserviceModule.v2.UserEventServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + usereventserviceModule.v2.UserEventServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new usereventserviceModule.v2.UserEventServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + usereventserviceModule.v2.UserEventServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new usereventserviceModule.v2.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = usereventserviceModule.v2.UserEventServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.userEventServiceStub, undefined); - await client.initialize(); - assert(client.userEventServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new usereventserviceModule.v2.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new usereventserviceModule.v2.UserEventServiceClient(); + assert(client); }); - client.initialize(); - assert(client.userEventServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new usereventserviceModule.v2.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + await client.initialize(); + assert(client.userEventServiceStub); }); - assert.strictEqual(client.userEventServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.userEventServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('writeUserEvent', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index df6f0e43857..2ac9beaf1ac 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -110,101 +110,104 @@ function stubAsyncIterationCall( } describe('v2alpha.UserEventServiceClient', () => { - it('has servicePath', () => { - const servicePath = - usereventserviceModule.v2alpha.UserEventServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - usereventserviceModule.v2alpha.UserEventServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = usereventserviceModule.v2alpha.UserEventServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + usereventserviceModule.v2alpha.UserEventServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + usereventserviceModule.v2alpha.UserEventServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = usereventserviceModule.v2alpha.UserEventServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.userEventServiceStub, undefined); - await client.initialize(); - assert(client.userEventServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = + new usereventserviceModule.v2alpha.UserEventServiceClient(); + assert(client); }); - client.initialize(); - assert(client.userEventServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + await client.initialize(); + assert(client.userEventServiceStub); }); - assert.strictEqual(client.userEventServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.userEventServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('writeUserEvent', () => { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index 3691c6a3139..cc2e587c18e 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -110,101 +110,103 @@ function stubAsyncIterationCall( } describe('v2beta.UserEventServiceClient', () => { - it('has servicePath', () => { - const servicePath = - usereventserviceModule.v2beta.UserEventServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - usereventserviceModule.v2beta.UserEventServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = usereventserviceModule.v2beta.UserEventServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new usereventserviceModule.v2beta.UserEventServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + usereventserviceModule.v2beta.UserEventServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new usereventserviceModule.v2beta.UserEventServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + usereventserviceModule.v2beta.UserEventServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new usereventserviceModule.v2beta.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = usereventserviceModule.v2beta.UserEventServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.userEventServiceStub, undefined); - await client.initialize(); - assert(client.userEventServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new usereventserviceModule.v2beta.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient(); + assert(client); }); - client.initialize(); - assert(client.userEventServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new usereventserviceModule.v2beta.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + await client.initialize(); + assert(client.userEventServiceStub); }); - assert.strictEqual(client.userEventServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.userEventServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2beta.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.userEventServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2beta.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('writeUserEvent', () => { From 81f0ccf0e08e743e29489297c1574c66c5c69335 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 07:42:13 +0000 Subject: [PATCH 092/103] fix: change import long to require (#205) Source-Link: https://github.com/googleapis/synthtool/commit/d229a1258999f599a90a9b674a1c5541e00db588 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:74ab2b3c71ef27e6d8b69b1d0a0c9d31447777b79ac3cd4be82c265b45f37e5e --- .../google-cloud-retail/protos/protos.d.ts | 3384 ++- packages/google-cloud-retail/protos/protos.js | 19672 +++++++++++----- .../google-cloud-retail/protos/protos.json | 24 + 3 files changed, 17235 insertions(+), 5845 deletions(-) diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 6e14ff51795..a1d36016f69 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import * as Long from "long"; +import Long = require("long"); import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { @@ -120,6 +120,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductLevelConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Catalog. */ @@ -222,6 +229,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Catalog + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CatalogService */ @@ -304,28 +318,28 @@ export namespace google { namespace CatalogService { /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|listCatalogs}. * @param error Error, if any * @param [response] ListCatalogsResponse */ type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCatalog}. * @param error Error, if any * @param [response] Catalog */ type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|setDefaultBranch}. * @param error Error, if any * @param [response] Empty */ type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getDefaultBranch}. * @param error Error, if any * @param [response] GetDefaultBranchResponse */ @@ -432,6 +446,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCatalogsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListCatalogsResponse. */ @@ -528,6 +549,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCatalogsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateCatalogRequest. */ @@ -624,6 +652,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCatalogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultBranchRequest. */ @@ -732,6 +767,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultBranchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetDefaultBranchRequest. */ @@ -822,6 +864,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDefaultBranchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetDefaultBranchResponse. */ @@ -924,6 +973,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDefaultBranchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Audience. */ @@ -1020,6 +1076,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Audience + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ColorInfo. */ @@ -1116,6 +1179,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ColorInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CustomAttribute. */ @@ -1230,6 +1300,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomAttribute + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FulfillmentInfo. */ @@ -1326,6 +1403,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FulfillmentInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Image. */ @@ -1428,6 +1512,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Image + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Interval. */ @@ -1542,6 +1633,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Interval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PriceInfo. */ @@ -1668,6 +1766,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PriceInfo { @@ -1766,6 +1871,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -1869,6 +1981,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Rating + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserInfo. */ @@ -1977,6 +2096,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a LocalInventory. */ @@ -2085,6 +2211,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocalInventory + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CompletionService */ @@ -2139,14 +2272,14 @@ export namespace google { namespace CompletionService { /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. + * Callback as used by {@link google.cloud.retail.v2.CompletionService|completeQuery}. * @param error Error, if any * @param [response] CompleteQueryResponse */ type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompleteQueryResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2.CompletionService|importCompletionData}. * @param error Error, if any * @param [response] Operation */ @@ -2277,6 +2410,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompleteQueryResponse. */ @@ -2379,6 +2519,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CompleteQueryResponse { @@ -2477,6 +2624,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RecentSearchResult. */ @@ -2567,6 +2721,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RecentSearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -2664,6 +2825,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BigQuerySource. */ @@ -2787,6 +2955,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductInlineSource. */ @@ -2877,6 +3052,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventInlineSource. */ @@ -2967,6 +3149,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportErrorsConfig. */ @@ -3060,6 +3249,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportProductsRequest. */ @@ -3186,6 +3382,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ImportProductsRequest { @@ -3298,6 +3501,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportCompletionDataRequest. */ @@ -3400,6 +3610,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductInputConfig. */ @@ -3505,6 +3722,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventInputConfig. */ @@ -3610,6 +3834,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionDataInputConfig. */ @@ -3703,6 +3934,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDataInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportMetadata. */ @@ -3823,6 +4061,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportProductsResponse. */ @@ -3919,6 +4164,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportUserEventsResponse. */ @@ -4021,6 +4273,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventImportSummary. */ @@ -4117,6 +4376,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventImportSummary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportCompletionDataResponse. */ @@ -4207,6 +4473,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Product. */ @@ -4492,6 +4765,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Product + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Product { @@ -4602,6 +4882,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Promotion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEvent. */ @@ -4806,6 +5093,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductDetail. */ @@ -4902,6 +5196,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionDetail. */ @@ -5004,6 +5305,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurchaseTransaction. */ @@ -5118,6 +5426,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurchaseTransaction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a PredictionService */ @@ -5158,7 +5473,7 @@ export namespace google { namespace PredictionService { /** - * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2.PredictionService|predict}. * @param error Error, if any * @param [response] PredictResponse */ @@ -5295,6 +5610,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PredictResponse. */ @@ -5403,6 +5725,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PredictResponse { @@ -5501,6 +5830,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -5682,77 +6018,77 @@ export namespace google { namespace ProductService { /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|createProduct}. * @param error Error, if any * @param [response] Product */ type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|getProduct}. * @param error Error, if any * @param [response] Product */ type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#listProducts}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|listProducts}. * @param error Error, if any * @param [response] ListProductsResponse */ type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListProductsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|updateProduct}. * @param error Error, if any * @param [response] Product */ type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|deleteProduct}. * @param error Error, if any * @param [response] Empty */ type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|importProducts}. * @param error Error, if any * @param [response] Operation */ type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#setInventory}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|setInventory}. * @param error Error, if any * @param [response] Operation */ type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#addFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|addFulfillmentPlaces}. * @param error Error, if any * @param [response] Operation */ type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#removeFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|removeFulfillmentPlaces}. * @param error Error, if any * @param [response] Operation */ type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#addLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|addLocalInventories}. * @param error Error, if any * @param [response] Operation */ type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#removeLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|removeLocalInventories}. * @param error Error, if any * @param [response] Operation */ @@ -5859,6 +6195,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProductRequest. */ @@ -5949,6 +6292,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateProductRequest. */ @@ -6051,6 +6401,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProductRequest. */ @@ -6141,6 +6498,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProductsRequest. */ @@ -6255,6 +6619,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProductsResponse. */ @@ -6351,6 +6722,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryRequest. */ @@ -6459,6 +6837,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryMetadata. */ @@ -6543,6 +6928,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryResponse. */ @@ -6627,6 +7019,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesRequest. */ @@ -6741,6 +7140,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesMetadata. */ @@ -6825,6 +7231,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesResponse. */ @@ -6909,6 +7322,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesRequest. */ @@ -7023,6 +7443,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesMetadata. */ @@ -7107,6 +7534,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesResponse. */ @@ -7191,6 +7625,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesRequest. */ @@ -7299,6 +7740,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesMetadata. */ @@ -7383,6 +7831,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesResponse. */ @@ -7467,6 +7922,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesRequest. */ @@ -7581,6 +8043,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesMetadata. */ @@ -7665,6 +8134,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesResponse. */ @@ -7749,6 +8225,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeMetadata. */ @@ -7833,6 +8316,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeUserEventsRequest. */ @@ -7935,6 +8425,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeUserEventsResponse. */ @@ -8025,6 +8522,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a SearchService */ @@ -8065,7 +8569,7 @@ export namespace google { namespace SearchService { /** - * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. + * Callback as used by {@link google.cloud.retail.v2.SearchService|search}. * @param error Error, if any * @param [response] SearchResponse */ @@ -8283,6 +8787,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SearchRequest { @@ -8393,6 +8904,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FacetSpec { @@ -8533,6 +9051,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -8624,6 +9149,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DynamicFacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DynamicFacetSpec { @@ -8733,6 +9265,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BoostSpec { @@ -8831,6 +9370,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConditionBoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -8928,6 +9474,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace QueryExpansionSpec { @@ -9028,6 +9581,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PersonalizationSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PersonalizationSpec { @@ -9128,6 +9688,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpellCorrectionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SpellCorrectionSpec { @@ -9290,6 +9857,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SearchResponse { @@ -9406,6 +9980,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Facet. */ @@ -9508,6 +10089,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Facet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Facet { @@ -9627,6 +10215,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -9724,6 +10319,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -9821,35 +10423,35 @@ export namespace google { namespace UserEventService { /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|writeUserEvent}. * @param error Error, if any * @param [response] UserEvent */ type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2.UserEvent) => void; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|collectUserEvent}. * @param error Error, if any * @param [response] HttpBody */ type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|purgeUserEvents}. * @param error Error, if any * @param [response] Operation */ type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|importUserEvents}. * @param error Error, if any * @param [response] Operation */ type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|rejoinUserEvents}. * @param error Error, if any * @param [response] Operation */ @@ -9950,6 +10552,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteUserEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CollectUserEventRequest. */ @@ -10058,6 +10667,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CollectUserEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RejoinUserEventsRequest. */ @@ -10154,6 +10770,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace RejoinUserEventsRequest { @@ -10254,6 +10877,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RejoinUserEventsMetadata. */ @@ -10338,6 +10968,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -10438,6 +11075,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductLevelConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CatalogAttribute. */ @@ -10564,6 +11208,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CatalogAttribute + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CatalogAttribute { @@ -10697,6 +11348,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AttributesConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionConfig. */ @@ -10847,6 +11505,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MerchantCenterLink. */ @@ -10961,6 +11626,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MerchantCenterLink + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MerchantCenterLinkingConfig. */ @@ -11051,6 +11723,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MerchantCenterLinkingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Catalog. */ @@ -11159,6 +11838,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Catalog + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** AttributeConfigLevel enum. */ @@ -11283,6 +11969,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Condition + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Condition { @@ -11381,6 +12074,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryTerm + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TimeRange. */ @@ -11477,6 +12177,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -11619,6 +12326,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Rule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Rule { @@ -11717,6 +12431,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoostAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FilterAction. */ @@ -11807,6 +12528,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FilterAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RedirectAction. */ @@ -11897,6 +12625,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RedirectAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TwowaySynonymsAction. */ @@ -11987,6 +12722,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TwowaySynonymsAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OnewaySynonymsAction. */ @@ -12089,6 +12831,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OnewaySynonymsAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DoNotAssociateAction. */ @@ -12191,6 +12940,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoNotAssociateAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReplacementAction. */ @@ -12293,6 +13049,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplacementAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an IgnoreAction. */ @@ -12383,6 +13146,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IgnoreAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -12480,6 +13250,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Audience + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ColorInfo. */ @@ -12576,6 +13353,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ColorInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CustomAttribute. */ @@ -12690,6 +13474,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomAttribute + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FulfillmentInfo. */ @@ -12786,6 +13577,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FulfillmentInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Image. */ @@ -12888,6 +13686,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Image + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Interval. */ @@ -13002,6 +13807,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Interval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PriceInfo. */ @@ -13128,6 +13940,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PriceInfo { @@ -13226,6 +14045,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -13329,6 +14155,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Rating + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserInfo. */ @@ -13437,6 +14270,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a LocalInventory. */ @@ -13545,6 +14385,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocalInventory + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsSource. */ @@ -13641,6 +14488,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BigQuerySource. */ @@ -13764,6 +14618,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductInlineSource. */ @@ -13854,6 +14715,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventInlineSource. */ @@ -13944,6 +14812,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportErrorsConfig. */ @@ -14037,6 +14912,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportProductsRequest. */ @@ -14169,6 +15051,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ImportProductsRequest { @@ -14281,6 +15170,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportCompletionDataRequest. */ @@ -14383,6 +15279,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductInputConfig. */ @@ -14488,6 +15391,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventInputConfig. */ @@ -14593,6 +15503,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionDataInputConfig. */ @@ -14686,6 +15603,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDataInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportMetadata. */ @@ -14806,6 +15730,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportProductsResponse. */ @@ -14902,6 +15833,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportUserEventsResponse. */ @@ -15004,6 +15942,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventImportSummary. */ @@ -15100,6 +16045,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventImportSummary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportCompletionDataResponse. */ @@ -15190,6 +16142,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Product. */ @@ -15475,6 +16434,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Product + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Product { @@ -15585,6 +16551,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Promotion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEvent. */ @@ -15789,6 +16762,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductDetail. */ @@ -15885,6 +16865,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionDetail. */ @@ -15987,6 +16974,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurchaseTransaction. */ @@ -16101,6 +17095,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurchaseTransaction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CatalogService */ @@ -16281,77 +17282,77 @@ export namespace google { namespace CatalogService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|listCatalogs}. * @param error Error, if any * @param [response] ListCatalogsResponse */ type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListCatalogsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|updateCatalog}. * @param error Error, if any * @param [response] Catalog */ type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Catalog) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|setDefaultBranch}. * @param error Error, if any * @param [response] Empty */ type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|getDefaultBranch}. * @param error Error, if any * @param [response] GetDefaultBranchResponse */ type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.GetDefaultBranchResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|getCompletionConfig}. * @param error Error, if any * @param [response] CompletionConfig */ type GetCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompletionConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|updateCompletionConfig}. * @param error Error, if any * @param [response] CompletionConfig */ type UpdateCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompletionConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|getAttributesConfig}. * @param error Error, if any * @param [response] AttributesConfig */ type GetAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|updateAttributesConfig}. * @param error Error, if any * @param [response] AttributesConfig */ type UpdateAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#addCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|addCatalogAttribute}. * @param error Error, if any * @param [response] AttributesConfig */ type AddCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#removeCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|removeCatalogAttribute}. * @param error Error, if any * @param [response] AttributesConfig */ type RemoveCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#replaceCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|replaceCatalogAttribute}. * @param error Error, if any * @param [response] AttributesConfig */ @@ -16458,6 +17459,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCatalogsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListCatalogsResponse. */ @@ -16554,6 +17562,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCatalogsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateCatalogRequest. */ @@ -16650,6 +17665,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCatalogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultBranchRequest. */ @@ -16758,6 +17780,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultBranchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetDefaultBranchRequest. */ @@ -16848,6 +17877,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDefaultBranchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetDefaultBranchResponse. */ @@ -16950,6 +17986,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDefaultBranchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetCompletionConfigRequest. */ @@ -17040,6 +18083,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetCompletionConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateCompletionConfigRequest. */ @@ -17136,6 +18186,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCompletionConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetAttributesConfigRequest. */ @@ -17226,6 +18283,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAttributesConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateAttributesConfigRequest. */ @@ -17322,6 +18386,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateAttributesConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddCatalogAttributeRequest. */ @@ -17418,6 +18489,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddCatalogAttributeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveCatalogAttributeRequest. */ @@ -17514,6 +18592,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveCatalogAttributeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReplaceCatalogAttributeRequest. */ @@ -17616,6 +18701,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplaceCatalogAttributeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CompletionService */ @@ -17670,14 +18762,14 @@ export namespace google { namespace CompletionService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService|completeQuery}. * @param error Error, if any * @param [response] CompleteQueryResponse */ type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.CompleteQueryResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService|importCompletionData}. * @param error Error, if any * @param [response] Operation */ @@ -17808,6 +18900,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompleteQueryResponse. */ @@ -17910,6 +19009,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CompleteQueryResponse { @@ -18008,6 +19114,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RecentSearchResult. */ @@ -18098,6 +19211,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RecentSearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -18228,6 +19348,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Control + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a SearchService */ @@ -18268,7 +19395,7 @@ export namespace google { namespace SearchService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService|search}. * @param error Error, if any * @param [response] SearchResponse */ @@ -18492,6 +19619,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SearchRequest { @@ -18602,6 +19736,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FacetSpec { @@ -18742,6 +19883,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -18833,6 +19981,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DynamicFacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DynamicFacetSpec { @@ -18942,6 +20097,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BoostSpec { @@ -19040,6 +20202,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConditionBoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -19137,6 +20306,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace QueryExpansionSpec { @@ -19237,6 +20413,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PersonalizationSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PersonalizationSpec { @@ -19337,6 +20520,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpellCorrectionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SpellCorrectionSpec { @@ -19508,6 +20698,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SearchResponse { @@ -19624,6 +20821,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Facet. */ @@ -19726,6 +20930,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Facet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Facet { @@ -19845,6 +21056,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -19942,6 +21160,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -20039,35 +21264,35 @@ export namespace google { namespace ControlService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#createControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|createControl}. * @param error Error, if any * @param [response] Control */ type CreateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Control) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#deleteControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|deleteControl}. * @param error Error, if any * @param [response] Empty */ type DeleteControlCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#updateControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|updateControl}. * @param error Error, if any * @param [response] Control */ type UpdateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Control) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#getControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|getControl}. * @param error Error, if any * @param [response] Control */ type GetControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Control) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#listControls}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|listControls}. * @param error Error, if any * @param [response] ListControlsResponse */ @@ -20174,6 +21399,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateControlRequest. */ @@ -20270,6 +21502,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteControlRequest. */ @@ -20360,6 +21599,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetControlRequest. */ @@ -20450,6 +21696,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListControlsRequest. */ @@ -20558,6 +21811,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListControlsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListControlsResponse. */ @@ -20654,6 +21914,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListControlsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportErrorsConfig. */ @@ -20747,6 +22014,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportMetadata. */ @@ -20843,6 +22117,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportProductsResponse. */ @@ -20945,6 +22226,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportUserEventsResponse. */ @@ -21047,6 +22335,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OutputResult. */ @@ -21137,6 +22432,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BigQueryOutputResult. */ @@ -21233,6 +22535,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQueryOutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Model. */ @@ -21410,6 +22719,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Model + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Model { @@ -21514,6 +22830,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PageOptimizationConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PageOptimizationConfig { @@ -21609,6 +22932,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Candidate + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Panel. */ @@ -21711,6 +23041,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Panel + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Restriction enum. */ @@ -21811,6 +23148,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServingConfigList + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** ServingState enum. */ @@ -21966,49 +23310,49 @@ export namespace google { namespace ModelService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#createModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|createModel}. * @param error Error, if any * @param [response] Operation */ type CreateModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#pauseModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|pauseModel}. * @param error Error, if any * @param [response] Model */ type PauseModelCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Model) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#resumeModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|resumeModel}. * @param error Error, if any * @param [response] Model */ type ResumeModelCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Model) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#deleteModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|deleteModel}. * @param error Error, if any * @param [response] Empty */ type DeleteModelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#listModels}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|listModels}. * @param error Error, if any * @param [response] ListModelsResponse */ type ListModelsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListModelsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#updateModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|updateModel}. * @param error Error, if any * @param [response] Model */ type UpdateModelCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Model) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#tuneModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|tuneModel}. * @param error Error, if any * @param [response] Operation */ @@ -22115,6 +23459,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateModelRequest. */ @@ -22211,6 +23562,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PauseModelRequest. */ @@ -22301,6 +23659,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PauseModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ResumeModelRequest. */ @@ -22391,6 +23756,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResumeModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListModelsRequest. */ @@ -22493,6 +23865,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListModelsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteModelRequest. */ @@ -22583,6 +23962,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListModelsResponse. */ @@ -22679,6 +24065,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListModelsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TuneModelRequest. */ @@ -22769,6 +24162,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TuneModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateModelMetadata. */ @@ -22859,6 +24259,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateModelMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TuneModelMetadata. */ @@ -22949,6 +24356,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TuneModelMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TuneModelResponse. */ @@ -23033,6 +24447,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TuneModelResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a PredictionService */ @@ -23073,7 +24494,7 @@ export namespace google { namespace PredictionService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService|predict}. * @param error Error, if any * @param [response] PredictResponse */ @@ -23210,6 +24631,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PredictResponse. */ @@ -23318,6 +24746,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PredictResponse { @@ -23416,6 +24851,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -23611,84 +25053,84 @@ export namespace google { namespace ProductService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|createProduct}. * @param error Error, if any * @param [response] Product */ type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|getProduct}. * @param error Error, if any * @param [response] Product */ type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|listProducts}. * @param error Error, if any * @param [response] ListProductsResponse */ type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListProductsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|updateProduct}. * @param error Error, if any * @param [response] Product */ type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|deleteProduct}. * @param error Error, if any * @param [response] Empty */ type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#purgeProducts}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|purgeProducts}. * @param error Error, if any * @param [response] Operation */ type PurgeProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|importProducts}. * @param error Error, if any * @param [response] Operation */ type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|setInventory}. * @param error Error, if any * @param [response] Operation */ type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|addFulfillmentPlaces}. * @param error Error, if any * @param [response] Operation */ type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|removeFulfillmentPlaces}. * @param error Error, if any * @param [response] Operation */ type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|addLocalInventories}. * @param error Error, if any * @param [response] Operation */ type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|removeLocalInventories}. * @param error Error, if any * @param [response] Operation */ @@ -23795,6 +25237,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProductRequest. */ @@ -23885,6 +25334,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateProductRequest. */ @@ -23987,6 +25443,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProductRequest. */ @@ -24077,6 +25540,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProductsRequest. */ @@ -24197,6 +25667,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProductsResponse. */ @@ -24299,6 +25776,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryRequest. */ @@ -24407,6 +25891,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryMetadata. */ @@ -24491,6 +25982,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryResponse. */ @@ -24575,6 +26073,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesRequest. */ @@ -24689,6 +26194,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesMetadata. */ @@ -24773,6 +26285,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesResponse. */ @@ -24857,6 +26376,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesRequest. */ @@ -24971,6 +26497,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesMetadata. */ @@ -25055,6 +26588,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesResponse. */ @@ -25139,6 +26679,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesRequest. */ @@ -25247,6 +26794,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesMetadata. */ @@ -25331,6 +26885,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesResponse. */ @@ -25415,6 +26976,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesRequest. */ @@ -25529,6 +27097,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesMetadata. */ @@ -25613,6 +27188,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesResponse. */ @@ -25697,6 +27279,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeMetadata. */ @@ -25781,6 +27370,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeProductsMetadata. */ @@ -25889,6 +27485,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeProductsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeProductsRequest. */ @@ -25991,6 +27594,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeProductsResponse. */ @@ -26087,6 +27697,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeUserEventsRequest. */ @@ -26189,6 +27806,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeUserEventsResponse. */ @@ -26279,6 +27903,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServingConfig. */ @@ -26465,6 +28096,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a ServingConfigService */ @@ -26589,49 +28227,49 @@ export namespace google { namespace ServingConfigService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#createServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|createServingConfig}. * @param error Error, if any * @param [response] ServingConfig */ type CreateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#deleteServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|deleteServingConfig}. * @param error Error, if any * @param [response] Empty */ type DeleteServingConfigCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#updateServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|updateServingConfig}. * @param error Error, if any * @param [response] ServingConfig */ type UpdateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#getServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|getServingConfig}. * @param error Error, if any * @param [response] ServingConfig */ type GetServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#listServingConfigs}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|listServingConfigs}. * @param error Error, if any * @param [response] ListServingConfigsResponse */ type ListServingConfigsCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ListServingConfigsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#addControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|addControl}. * @param error Error, if any * @param [response] ServingConfig */ type AddControlCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#removeControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|removeControl}. * @param error Error, if any * @param [response] ServingConfig */ @@ -26738,6 +28376,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateServingConfigRequest. */ @@ -26834,6 +28479,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteServingConfigRequest. */ @@ -26924,6 +28576,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetServingConfigRequest. */ @@ -27014,6 +28673,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListServingConfigsRequest. */ @@ -27116,6 +28782,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServingConfigsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListServingConfigsResponse. */ @@ -27212,6 +28885,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServingConfigsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddControlRequest. */ @@ -27308,6 +28988,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveControlRequest. */ @@ -27404,6 +29091,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a UserEventService */ @@ -27500,35 +29194,35 @@ export namespace google { namespace UserEventService { /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|writeUserEvent}. * @param error Error, if any * @param [response] UserEvent */ type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2alpha.UserEvent) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|collectUserEvent}. * @param error Error, if any * @param [response] HttpBody */ type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|purgeUserEvents}. * @param error Error, if any * @param [response] Operation */ type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|importUserEvents}. * @param error Error, if any * @param [response] Operation */ type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|rejoinUserEvents}. * @param error Error, if any * @param [response] Operation */ @@ -27629,6 +29323,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteUserEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CollectUserEventRequest. */ @@ -27737,6 +29438,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CollectUserEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RejoinUserEventsRequest. */ @@ -27833,6 +29541,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace RejoinUserEventsRequest { @@ -27933,6 +29648,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RejoinUserEventsMetadata. */ @@ -28017,6 +29739,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -28117,6 +29846,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductLevelConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CatalogAttribute. */ @@ -28243,6 +29979,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CatalogAttribute + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CatalogAttribute { @@ -28376,6 +30119,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AttributesConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionConfig. */ @@ -28526,6 +30276,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MerchantCenterLink. */ @@ -28640,6 +30397,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MerchantCenterLink + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MerchantCenterLinkingConfig. */ @@ -28730,6 +30494,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MerchantCenterLinkingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Catalog. */ @@ -28838,6 +30609,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Catalog + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** AttributeConfigLevel enum. */ @@ -28962,6 +30740,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Condition + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Condition { @@ -29060,6 +30845,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryTerm + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TimeRange. */ @@ -29156,6 +30948,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -29298,6 +31097,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Rule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Rule { @@ -29396,6 +31202,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoostAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FilterAction. */ @@ -29486,6 +31299,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FilterAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RedirectAction. */ @@ -29576,6 +31396,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RedirectAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TwowaySynonymsAction. */ @@ -29666,6 +31493,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TwowaySynonymsAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OnewaySynonymsAction. */ @@ -29768,6 +31602,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OnewaySynonymsAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DoNotAssociateAction. */ @@ -29870,6 +31711,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoNotAssociateAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReplacementAction. */ @@ -29972,6 +31820,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplacementAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an IgnoreAction. */ @@ -30062,6 +31917,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IgnoreAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -30159,6 +32021,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Audience + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ColorInfo. */ @@ -30255,6 +32124,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ColorInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CustomAttribute. */ @@ -30369,6 +32245,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomAttribute + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FulfillmentInfo. */ @@ -30465,6 +32348,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FulfillmentInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Image. */ @@ -30567,6 +32457,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Image + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Interval. */ @@ -30681,6 +32578,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Interval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PriceInfo. */ @@ -30807,6 +32711,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PriceInfo { @@ -30905,6 +32816,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -31008,6 +32926,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Rating + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserInfo. */ @@ -31116,6 +33041,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a LocalInventory. */ @@ -31224,6 +33156,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocalInventory + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GcsSource. */ @@ -31320,6 +33259,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BigQuerySource. */ @@ -31443,6 +33389,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductInlineSource. */ @@ -31533,6 +33486,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventInlineSource. */ @@ -31623,6 +33583,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportErrorsConfig. */ @@ -31716,6 +33683,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportProductsRequest. */ @@ -31842,6 +33816,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ImportProductsRequest { @@ -31954,6 +33935,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportCompletionDataRequest. */ @@ -32056,6 +34044,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductInputConfig. */ @@ -32161,6 +34156,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventInputConfig. */ @@ -32266,6 +34268,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionDataInputConfig. */ @@ -32359,6 +34368,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDataInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportMetadata. */ @@ -32479,6 +34495,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportProductsResponse. */ @@ -32575,6 +34598,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportUserEventsResponse. */ @@ -32677,6 +34707,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEventImportSummary. */ @@ -32773,6 +34810,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventImportSummary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ImportCompletionDataResponse. */ @@ -32863,6 +34907,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Product. */ @@ -33148,6 +35199,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Product + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Product { @@ -33258,6 +35316,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Promotion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UserEvent. */ @@ -33462,6 +35527,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProductDetail. */ @@ -33558,6 +35630,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompletionDetail. */ @@ -33660,6 +35739,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurchaseTransaction. */ @@ -33774,6 +35860,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurchaseTransaction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CatalogService */ @@ -33954,77 +36047,77 @@ export namespace google { namespace CatalogService { /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|listCatalogs}. * @param error Error, if any * @param [response] ListCatalogsResponse */ type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListCatalogsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|updateCatalog}. * @param error Error, if any * @param [response] Catalog */ type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Catalog) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|setDefaultBranch}. * @param error Error, if any * @param [response] Empty */ type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|getDefaultBranch}. * @param error Error, if any * @param [response] GetDefaultBranchResponse */ type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.GetDefaultBranchResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|getCompletionConfig}. * @param error Error, if any * @param [response] CompletionConfig */ type GetCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompletionConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|updateCompletionConfig}. * @param error Error, if any * @param [response] CompletionConfig */ type UpdateCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompletionConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|getAttributesConfig}. * @param error Error, if any * @param [response] AttributesConfig */ type GetAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|updateAttributesConfig}. * @param error Error, if any * @param [response] AttributesConfig */ type UpdateAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#addCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|addCatalogAttribute}. * @param error Error, if any * @param [response] AttributesConfig */ type AddCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#removeCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|removeCatalogAttribute}. * @param error Error, if any * @param [response] AttributesConfig */ type RemoveCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#replaceCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|replaceCatalogAttribute}. * @param error Error, if any * @param [response] AttributesConfig */ @@ -34131,6 +36224,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCatalogsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListCatalogsResponse. */ @@ -34227,6 +36327,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCatalogsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateCatalogRequest. */ @@ -34323,6 +36430,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCatalogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetDefaultBranchRequest. */ @@ -34431,6 +36545,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetDefaultBranchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetDefaultBranchRequest. */ @@ -34521,6 +36642,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDefaultBranchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetDefaultBranchResponse. */ @@ -34623,6 +36751,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDefaultBranchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetCompletionConfigRequest. */ @@ -34713,6 +36848,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetCompletionConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateCompletionConfigRequest. */ @@ -34809,6 +36951,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCompletionConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetAttributesConfigRequest. */ @@ -34899,6 +37048,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAttributesConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateAttributesConfigRequest. */ @@ -34995,6 +37151,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateAttributesConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddCatalogAttributeRequest. */ @@ -35091,6 +37254,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddCatalogAttributeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveCatalogAttributeRequest. */ @@ -35187,6 +37357,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveCatalogAttributeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReplaceCatalogAttributeRequest. */ @@ -35289,6 +37466,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplaceCatalogAttributeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CompletionService */ @@ -35343,14 +37527,14 @@ export namespace google { namespace CompletionService { /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService|completeQuery}. * @param error Error, if any * @param [response] CompleteQueryResponse */ type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.CompleteQueryResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService|importCompletionData}. * @param error Error, if any * @param [response] Operation */ @@ -35481,6 +37665,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteQueryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CompleteQueryResponse. */ @@ -35583,6 +37774,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteQueryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CompleteQueryResponse { @@ -35681,6 +37879,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RecentSearchResult. */ @@ -35771,6 +37976,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RecentSearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -35895,6 +38107,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Control + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a SearchService */ @@ -35935,7 +38154,7 @@ export namespace google { namespace SearchService { /** - * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. + * Callback as used by {@link google.cloud.retail.v2beta.SearchService|search}. * @param error Error, if any * @param [response] SearchResponse */ @@ -36153,6 +38372,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SearchRequest { @@ -36263,6 +38489,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FacetSpec { @@ -36403,6 +38636,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -36494,6 +38734,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DynamicFacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DynamicFacetSpec { @@ -36603,6 +38850,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BoostSpec { @@ -36701,6 +38955,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConditionBoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -36798,6 +39059,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace QueryExpansionSpec { @@ -36898,6 +39166,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PersonalizationSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PersonalizationSpec { @@ -36998,6 +39273,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpellCorrectionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SpellCorrectionSpec { @@ -37160,6 +39442,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SearchResponse { @@ -37276,6 +39565,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Facet. */ @@ -37378,6 +39674,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Facet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Facet { @@ -37497,6 +39800,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -37594,6 +39904,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -37691,35 +40008,35 @@ export namespace google { namespace ControlService { /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#createControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|createControl}. * @param error Error, if any * @param [response] Control */ type CreateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Control) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#deleteControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|deleteControl}. * @param error Error, if any * @param [response] Empty */ type DeleteControlCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#updateControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|updateControl}. * @param error Error, if any * @param [response] Control */ type UpdateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Control) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#getControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|getControl}. * @param error Error, if any * @param [response] Control */ type GetControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Control) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#listControls}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|listControls}. * @param error Error, if any * @param [response] ListControlsResponse */ @@ -37826,6 +40143,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateControlRequest. */ @@ -37922,6 +40246,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteControlRequest. */ @@ -38012,6 +40343,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetControlRequest. */ @@ -38102,6 +40440,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListControlsRequest. */ @@ -38210,6 +40555,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListControlsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListControlsResponse. */ @@ -38306,6 +40658,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListControlsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportErrorsConfig. */ @@ -38399,6 +40758,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportMetadata. */ @@ -38495,6 +40861,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportProductsResponse. */ @@ -38597,6 +40970,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an ExportUserEventsResponse. */ @@ -38699,6 +41079,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OutputResult. */ @@ -38789,6 +41176,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BigQueryOutputResult. */ @@ -38885,6 +41279,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQueryOutputResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a PredictionService */ @@ -38925,7 +41326,7 @@ export namespace google { namespace PredictionService { /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService|predict}. * @param error Error, if any * @param [response] PredictResponse */ @@ -39062,6 +41463,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PredictResponse. */ @@ -39170,6 +41578,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PredictResponse { @@ -39268,6 +41683,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PredictionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -39449,77 +41871,77 @@ export namespace google { namespace ProductService { /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|createProduct}. * @param error Error, if any * @param [response] Product */ type CreateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|getProduct}. * @param error Error, if any * @param [response] Product */ type GetProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|listProducts}. * @param error Error, if any * @param [response] ListProductsResponse */ type ListProductsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListProductsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|updateProduct}. * @param error Error, if any * @param [response] Product */ type UpdateProductCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Product) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|deleteProduct}. * @param error Error, if any * @param [response] Empty */ type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|importProducts}. * @param error Error, if any * @param [response] Operation */ type ImportProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|setInventory}. * @param error Error, if any * @param [response] Operation */ type SetInventoryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|addFulfillmentPlaces}. * @param error Error, if any * @param [response] Operation */ type AddFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|removeFulfillmentPlaces}. * @param error Error, if any * @param [response] Operation */ type RemoveFulfillmentPlacesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|addLocalInventories}. * @param error Error, if any * @param [response] Operation */ type AddLocalInventoriesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|removeLocalInventories}. * @param error Error, if any * @param [response] Operation */ @@ -39626,6 +42048,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProductRequest. */ @@ -39716,6 +42145,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateProductRequest. */ @@ -39818,6 +42254,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteProductRequest. */ @@ -39908,6 +42351,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteProductRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProductsRequest. */ @@ -40022,6 +42472,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProductsResponse. */ @@ -40118,6 +42575,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryRequest. */ @@ -40226,6 +42690,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryMetadata. */ @@ -40310,6 +42781,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SetInventoryResponse. */ @@ -40394,6 +42872,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetInventoryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesRequest. */ @@ -40508,6 +42993,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesMetadata. */ @@ -40592,6 +43084,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddFulfillmentPlacesResponse. */ @@ -40676,6 +43175,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesRequest. */ @@ -40790,6 +43296,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesMetadata. */ @@ -40874,6 +43387,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddLocalInventoriesResponse. */ @@ -40958,6 +43478,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddLocalInventoriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesRequest. */ @@ -41066,6 +43593,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesMetadata. */ @@ -41150,6 +43684,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveLocalInventoriesResponse. */ @@ -41234,6 +43775,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesRequest. */ @@ -41348,6 +43896,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesMetadata. */ @@ -41432,6 +43987,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveFulfillmentPlacesResponse. */ @@ -41516,6 +44078,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeMetadata. */ @@ -41600,6 +44169,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeUserEventsRequest. */ @@ -41702,6 +44278,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PurgeUserEventsResponse. */ @@ -41792,6 +44375,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServingConfig. */ @@ -41978,6 +44568,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a ServingConfigService */ @@ -42102,49 +44699,49 @@ export namespace google { namespace ServingConfigService { /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#createServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|createServingConfig}. * @param error Error, if any * @param [response] ServingConfig */ type CreateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#deleteServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|deleteServingConfig}. * @param error Error, if any * @param [response] Empty */ type DeleteServingConfigCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#updateServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|updateServingConfig}. * @param error Error, if any * @param [response] ServingConfig */ type UpdateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#getServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|getServingConfig}. * @param error Error, if any * @param [response] ServingConfig */ type GetServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#listServingConfigs}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|listServingConfigs}. * @param error Error, if any * @param [response] ListServingConfigsResponse */ type ListServingConfigsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListServingConfigsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#addControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|addControl}. * @param error Error, if any * @param [response] ServingConfig */ type AddControlCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ServingConfig) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#removeControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|removeControl}. * @param error Error, if any * @param [response] ServingConfig */ @@ -42251,6 +44848,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateServingConfigRequest. */ @@ -42347,6 +44951,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteServingConfigRequest. */ @@ -42437,6 +45048,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetServingConfigRequest. */ @@ -42527,6 +45145,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListServingConfigsRequest. */ @@ -42629,6 +45254,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServingConfigsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListServingConfigsResponse. */ @@ -42725,6 +45357,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServingConfigsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an AddControlRequest. */ @@ -42821,6 +45460,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AddControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RemoveControlRequest. */ @@ -42917,6 +45563,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RemoveControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a UserEventService */ @@ -43013,35 +45666,35 @@ export namespace google { namespace UserEventService { /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#writeUserEvent}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|writeUserEvent}. * @param error Error, if any * @param [response] UserEvent */ type WriteUserEventCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.UserEvent) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#collectUserEvent}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|collectUserEvent}. * @param error Error, if any * @param [response] HttpBody */ type CollectUserEventCallback = (error: (Error|null), response?: google.api.HttpBody) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#purgeUserEvents}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|purgeUserEvents}. * @param error Error, if any * @param [response] Operation */ type PurgeUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#importUserEvents}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|importUserEvents}. * @param error Error, if any * @param [response] Operation */ type ImportUserEventsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#rejoinUserEvents}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|rejoinUserEvents}. * @param error Error, if any * @param [response] Operation */ @@ -43142,6 +45795,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WriteUserEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CollectUserEventRequest. */ @@ -43250,6 +45910,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CollectUserEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RejoinUserEventsRequest. */ @@ -43346,6 +46013,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace RejoinUserEventsRequest { @@ -43446,6 +46120,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RejoinUserEventsMetadata. */ @@ -43530,6 +46211,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RejoinUserEventsMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } @@ -43674,6 +46362,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ResourceDescriptor { @@ -43786,6 +46481,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Http. */ @@ -43882,6 +46584,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HttpRule. */ @@ -44029,6 +46738,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CustomHttpPattern. */ @@ -44125,6 +46841,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HttpBody. */ @@ -44227,6 +46950,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpBody + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -44321,6 +47051,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FileDescriptorProto. */ @@ -44361,6 +47098,9 @@ export namespace google { /** FileDescriptorProto syntax */ syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (string|null); } /** Represents a FileDescriptorProto. */ @@ -44408,6 +47148,9 @@ export namespace google { /** FileDescriptorProto syntax. */ public syntax: string; + /** FileDescriptorProto edition. */ + public edition: string; + /** * Creates a new FileDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -44477,6 +47220,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DescriptorProto. */ @@ -44621,6 +47371,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DescriptorProto { @@ -44725,6 +47482,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReservedRange. */ @@ -44821,6 +47585,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -44912,6 +47683,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldDescriptorProto. */ @@ -45062,6 +47840,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FieldDescriptorProto { @@ -45190,6 +47975,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumDescriptorProto. */ @@ -45304,6 +48096,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EnumDescriptorProto { @@ -45402,6 +48201,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -45505,6 +48311,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceDescriptorProto. */ @@ -45607,6 +48420,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MethodDescriptorProto. */ @@ -45727,6 +48547,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FileOptions. */ @@ -45940,6 +48767,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FileOptions { @@ -46067,6 +48901,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldOptions. */ @@ -46084,6 +48925,9 @@ export namespace google { /** FieldOptions lazy */ lazy?: (boolean|null); + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + /** FieldOptions deprecated */ deprecated?: (boolean|null); @@ -46121,6 +48965,9 @@ export namespace google { /** FieldOptions lazy. */ public lazy: boolean; + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + /** FieldOptions deprecated. */ public deprecated: boolean; @@ -46199,6 +49046,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FieldOptions { @@ -46306,6 +49160,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumOptions. */ @@ -46408,6 +49269,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumValueOptions. */ @@ -46504,6 +49372,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceOptions. */ @@ -46606,6 +49481,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MethodOptions. */ @@ -46717,6 +49599,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace MethodOptions { @@ -46853,6 +49742,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace UninterpretedOption { @@ -46951,6 +49847,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -47042,6 +49945,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SourceCodeInfo { @@ -47158,6 +50068,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -47249,6 +50166,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace GeneratedCodeInfo { @@ -47267,6 +50191,9 @@ export namespace google { /** Annotation end */ end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); } /** Represents an Annotation. */ @@ -47290,6 +50217,9 @@ export namespace google { /** Annotation end. */ public end: number; + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + /** * Creates a new Annotation instance using the specified properties. * @param [properties] Properties to set @@ -47359,6 +50289,23 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } } } @@ -47444,6 +50391,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldMask. */ @@ -47534,6 +50488,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Timestamp. */ @@ -47630,6 +50591,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Duration. */ @@ -47726,6 +50694,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DoubleValue. */ @@ -47816,6 +50791,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoubleValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FloatValue. */ @@ -47906,6 +50888,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FloatValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Int64Value. */ @@ -47996,6 +50985,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UInt64Value. */ @@ -48086,6 +51082,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Int32Value. */ @@ -48176,6 +51179,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a UInt32Value. */ @@ -48266,6 +51276,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BoolValue. */ @@ -48356,6 +51373,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoolValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a StringValue. */ @@ -48446,6 +51470,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StringValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BytesValue. */ @@ -48536,6 +51567,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BytesValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Any. */ @@ -48632,6 +51670,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Struct. */ @@ -48722,6 +51767,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Struct + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Value. */ @@ -48845,6 +51897,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** NullValue enum. */ @@ -48940,6 +51999,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -49046,6 +52112,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -49152,6 +52225,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Date + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -49252,35 +52332,35 @@ export namespace google { namespace Operations { /** - * Callback as used by {@link google.longrunning.Operations#listOperations}. + * Callback as used by {@link google.longrunning.Operations|listOperations}. * @param error Error, if any * @param [response] ListOperationsResponse */ type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; /** - * Callback as used by {@link google.longrunning.Operations#getOperation}. + * Callback as used by {@link google.longrunning.Operations|getOperation}. * @param error Error, if any * @param [response] Operation */ type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. * @param error Error, if any * @param [response] Empty */ type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. * @param error Error, if any * @param [response] Empty */ type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * Callback as used by {@link google.longrunning.Operations|waitOperation}. * @param error Error, if any * @param [response] Operation */ @@ -49402,6 +52482,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetOperationRequest. */ @@ -49492,6 +52579,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListOperationsRequest. */ @@ -49600,6 +52694,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListOperationsResponse. */ @@ -49696,6 +52797,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CancelOperationRequest. */ @@ -49786,6 +52894,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CancelOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteOperationRequest. */ @@ -49876,6 +52991,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a WaitOperationRequest. */ @@ -49972,6 +53094,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WaitOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OperationInfo. */ @@ -50068,6 +53197,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 47e004eb750..ce4a62ea9b2 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -169,12 +169,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ingestionProductType = reader.string(); - break; - case 2: - message.merchantCenterProductIdField = reader.string(); - break; + case 1: { + message.ingestionProductType = reader.string(); + break; + } + case 2: { + message.merchantCenterProductIdField = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -273,6 +275,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductLevelConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ProductLevelConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductLevelConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ProductLevelConfig"; + }; + return ProductLevelConfig; })(); @@ -390,15 +407,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 4: { + message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -510,6 +530,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Catalog + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Catalog + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Catalog.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Catalog"; + }; + return Catalog; })(); @@ -546,7 +581,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#listCatalogs}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|listCatalogs}. * @memberof google.cloud.retail.v2.CatalogService * @typedef ListCatalogsCallback * @type {function} @@ -579,7 +614,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#updateCatalog}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCatalog}. * @memberof google.cloud.retail.v2.CatalogService * @typedef UpdateCatalogCallback * @type {function} @@ -612,7 +647,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#setDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|setDefaultBranch}. * @memberof google.cloud.retail.v2.CatalogService * @typedef SetDefaultBranchCallback * @type {function} @@ -645,7 +680,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService#getDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getDefaultBranch}. * @memberof google.cloud.retail.v2.CatalogService * @typedef GetDefaultBranchCallback * @type {function} @@ -794,15 +829,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -909,6 +947,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListCatalogsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCatalogsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListCatalogsRequest"; + }; + return ListCatalogsRequest; })(); @@ -1017,14 +1070,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1140,6 +1195,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListCatalogsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCatalogsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListCatalogsResponse"; + }; + return ListCatalogsResponse; })(); @@ -1246,12 +1316,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -1360,6 +1432,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateCatalogRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCatalogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateCatalogRequest"; + }; + return UpdateCatalogRequest; })(); @@ -1488,18 +1575,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - message.note = reader.string(); - break; - case 4: - message.force = reader.bool(); - break; + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.branchId = reader.string(); + break; + } + case 3: { + message.note = reader.string(); + break; + } + case 4: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -1614,6 +1705,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultBranchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetDefaultBranchRequest"; + }; + return SetDefaultBranchRequest; })(); @@ -1709,9 +1815,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; + case 1: { + message.catalog = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1801,6 +1908,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetDefaultBranchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GetDefaultBranchRequest"; + }; + return GetDefaultBranchRequest; })(); @@ -1918,15 +2040,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.branch = reader.string(); - break; - case 2: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.note = reader.string(); - break; + case 1: { + message.branch = reader.string(); + break; + } + case 2: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.note = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2038,6 +2163,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetDefaultBranchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDefaultBranchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GetDefaultBranchResponse"; + }; + return GetDefaultBranchResponse; })(); @@ -2148,16 +2288,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); - break; - case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); - break; + case 1: { + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); + break; + } + case 2: { + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -2280,6 +2422,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Audience + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Audience.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Audience"; + }; + return Audience; })(); @@ -2390,16 +2547,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); - break; + case 1: { + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); + break; + } + case 2: { + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -2522,6 +2681,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ColorInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ColorInfo"; + }; + return ColorInfo; })(); @@ -2682,27 +2856,31 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + case 2: { + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); - break; + break; + } + case 3: { + message.searchable = reader.bool(); + break; + } + case 4: { + message.indexable = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -2850,6 +3028,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CustomAttribute + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CustomAttribute"; + }; + return CustomAttribute; })(); @@ -2958,14 +3151,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -3076,6 +3271,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FulfillmentInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FulfillmentInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.FulfillmentInfo"; + }; + return FulfillmentInfo; })(); @@ -3193,15 +3403,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.height = reader.int32(); + break; + } + case 3: { + message.width = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -3308,6 +3521,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Image + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Image + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Image"; + }; + return Image; })(); @@ -3461,18 +3689,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.minimum = reader.double(); - break; - case 2: - message.exclusiveMinimum = reader.double(); - break; - case 3: - message.maximum = reader.double(); - break; - case 4: - message.exclusiveMaximum = reader.double(); - break; + case 1: { + message.minimum = reader.double(); + break; + } + case 2: { + message.exclusiveMinimum = reader.double(); + break; + } + case 3: { + message.maximum = reader.double(); + break; + } + case 4: { + message.exclusiveMaximum = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -3606,6 +3838,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Interval + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Interval + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Interval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Interval"; + }; + return Interval; })(); @@ -3767,27 +4014,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.currencyCode = reader.string(); - break; - case 2: - message.price = reader.float(); - break; - case 3: - message.originalPrice = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.decode(reader, reader.uint32()); - break; + case 1: { + message.currencyCode = reader.string(); + break; + } + case 2: { + message.price = reader.float(); + break; + } + case 3: { + message.originalPrice = reader.float(); + break; + } + case 4: { + message.cost = reader.float(); + break; + } + case 5: { + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.priceRange = $root.google.cloud.retail.v2.PriceInfo.PriceRange.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -3941,6 +4195,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PriceInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PriceInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PriceInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PriceInfo"; + }; + PriceInfo.PriceRange = (function() { /** @@ -4044,12 +4313,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); - break; - case 2: - message.originalPrice = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); - break; + case 1: { + message.price = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + } + case 2: { + message.originalPrice = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4158,6 +4429,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PriceRange + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PriceInfo.PriceRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PriceRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PriceInfo.PriceRange"; + }; + return PriceRange; })(); @@ -4283,22 +4569,25 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ratingCount = reader.int32(); - break; - case 2: - message.averageRating = reader.float(); - break; - case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.ratingCount = reader.int32(); + break; + } + case 2: { + message.averageRating = reader.float(); + break; + } + case 3: { + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else message.ratingHistogram.push(reader.int32()); - } else - message.ratingHistogram.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -4418,6 +4707,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Rating + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rating + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Rating.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rating"; + }; + return Rating; })(); @@ -4546,18 +4850,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userId = reader.string(); - break; - case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); - break; + case 1: { + message.userId = reader.string(); + break; + } + case 2: { + message.ipAddress = reader.string(); + break; + } + case 3: { + message.userAgent = reader.string(); + break; + } + case 4: { + message.directUserRequest = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -4672,6 +4980,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UserInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UserInfo"; + }; + return UserInfo; })(); @@ -4806,39 +5129,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placeId = reader.string(); - break; - case 2: - message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); - break; - case 3: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placeId = reader.string(); + break; + } + case 2: { + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); + break; + } + case 3: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 4: { + if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) + message.fulfillmentTypes = []; + message.fulfillmentTypes.push(reader.string()); + break; } - message.attributes[key] = value; - break; - case 4: - if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) - message.fulfillmentTypes = []; - message.fulfillmentTypes.push(reader.string()); - break; default: reader.skipType(tag & 7); break; @@ -4991,6 +5318,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for LocalInventory + * @function getTypeUrl + * @memberof google.cloud.retail.v2.LocalInventory + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocalInventory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.LocalInventory"; + }; + return LocalInventory; })(); @@ -5027,7 +5369,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#completeQuery}. + * Callback as used by {@link google.cloud.retail.v2.CompletionService|completeQuery}. * @memberof google.cloud.retail.v2.CompletionService * @typedef CompleteQueryCallback * @type {function} @@ -5060,7 +5402,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2.CompletionService|importCompletionData}. * @memberof google.cloud.retail.v2.CompletionService * @typedef ImportCompletionDataCallback * @type {function} @@ -5255,29 +5597,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.query = reader.string(); - break; - case 7: - message.visitorId = reader.string(); - break; - case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - case 4: - message.deviceType = reader.string(); - break; - case 6: - message.dataset = reader.string(); - break; - case 5: - message.maxSuggestions = reader.int32(); - break; + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.query = reader.string(); + break; + } + case 7: { + message.visitorId = reader.string(); + break; + } + case 3: { + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + } + case 4: { + message.deviceType = reader.string(); + break; + } + case 6: { + message.dataset = reader.string(); + break; + } + case 5: { + message.maxSuggestions = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -5429,6 +5778,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompleteQueryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryRequest"; + }; + return CompleteQueryRequest; })(); @@ -5550,19 +5914,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); - break; - case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -5704,6 +6071,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompleteQueryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse"; + }; + CompleteQueryResponse.CompletionResult = (function() { /** @@ -5811,31 +6193,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.suggestion = reader.string(); + break; + } + case 2: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; } - message.attributes[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -5953,6 +6337,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"; + }; + return CompletionResult; })(); @@ -6048,9 +6447,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; + case 1: { + message.recentSearch = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6140,6 +6540,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RecentSearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RecentSearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"; + }; + return RecentSearchResult; })(); @@ -6251,14 +6666,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); - break; - case 2: - message.dataSchema = reader.string(); - break; + case 1: { + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + } + case 2: { + message.dataSchema = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6369,6 +6786,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GcsSource"; + }; + return GcsSource; })(); @@ -6533,24 +6965,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 5: - message.projectId = reader.string(); - break; - case 1: - message.datasetId = reader.string(); - break; - case 2: - message.tableId = reader.string(); - break; - case 3: - message.gcsStagingDir = reader.string(); - break; - case 4: - message.dataSchema = reader.string(); - break; + case 6: { + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + } + case 5: { + message.projectId = reader.string(); + break; + } + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableId = reader.string(); + break; + } + case 3: { + message.gcsStagingDir = reader.string(); + break; + } + case 4: { + message.dataSchema = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6692,6 +7130,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BigQuerySource + * @function getTypeUrl + * @memberof google.cloud.retail.v2.BigQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.BigQuerySource"; + }; + return BigQuerySource; })(); @@ -6789,11 +7242,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -6900,6 +7354,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductInlineSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ProductInlineSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ProductInlineSource"; + }; + return ProductInlineSource; })(); @@ -6997,11 +7466,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -7108,6 +7578,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventInlineSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UserEventInlineSource"; + }; + return UserEventInlineSource; })(); @@ -7217,9 +7702,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; + case 1: { + message.gcsPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7313,6 +7799,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportErrorsConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportErrorsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportErrorsConfig"; + }; + return ImportErrorsConfig; })(); @@ -7474,27 +7975,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.reconciliationMode = reader.int32(); - break; - case 7: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 6: { + message.requestId = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.reconciliationMode = reader.int32(); + break; + } + case 7: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7666,6 +8174,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportProductsRequest"; + }; + /** * ReconciliationMode enum. * @name google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode @@ -7799,15 +8322,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2.UserEventInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -7924,6 +8450,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportUserEventsRequest"; + }; + return ImportUserEventsRequest; })(); @@ -8041,15 +8582,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -8161,6 +8705,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportCompletionDataRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportCompletionDataRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCompletionDataRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportCompletionDataRequest"; + }; + return ImportCompletionDataRequest; })(); @@ -8292,15 +8851,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.productInlineSource = $root.google.cloud.retail.v2.ProductInlineSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -8440,6 +9002,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ProductInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ProductInputConfig"; + }; + return ProductInputConfig; })(); @@ -8571,15 +9148,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.userEventInlineSource = $root.google.cloud.retail.v2.UserEventInlineSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.retail.v2.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -8719,6 +9299,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UserEventInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UserEventInputConfig"; + }; + return UserEventInputConfig; })(); @@ -8828,9 +9423,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.bigQuerySource = $root.google.cloud.retail.v2.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -8930,6 +9526,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionDataInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompletionDataInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionDataInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompletionDataInputConfig"; + }; + return CompletionDataInputConfig; })(); @@ -9080,24 +9691,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.successCount = reader.int64(); + break; + } + case 4: { + message.failureCount = reader.int64(); + break; + } + case 5: { + message.requestId = reader.string(); + break; + } + case 6: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -9266,6 +9883,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportMetadata"; + }; + return ImportMetadata; })(); @@ -9374,14 +10006,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -9502,6 +10136,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportProductsResponse"; + }; + return ImportProductsResponse; })(); @@ -9621,17 +10270,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.importSummary = $root.google.cloud.retail.v2.UserEventImportSummary.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -9766,6 +10418,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportUserEventsResponse"; + }; + return ImportUserEventsResponse; })(); @@ -9872,12 +10539,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.joinedEventsCount = reader.int64(); - break; - case 2: - message.unjoinedEventsCount = reader.int64(); - break; + case 1: { + message.joinedEventsCount = reader.int64(); + break; + } + case 2: { + message.unjoinedEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -10004,6 +10673,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventImportSummary + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UserEventImportSummary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventImportSummary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UserEventImportSummary"; + }; + return UserEventImportSummary; })(); @@ -10101,11 +10785,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -10212,6 +10897,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportCompletionDataResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ImportCompletionDataResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCompletionDataResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ImportCompletionDataResponse"; + }; + return ImportCompletionDataResponse; })(); @@ -10701,148 +11401,181 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 16: - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 17: - message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.id = reader.string(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 5: - if (!(message.collectionMemberIds && message.collectionMemberIds.length)) - message.collectionMemberIds = []; - message.collectionMemberIds.push(reader.string()); - break; - case 6: - message.gtin = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 9: - if (!(message.brands && message.brands.length)) - message.brands = []; - message.brands.push(reader.string()); - break; - case 10: - message.description = reader.string(); - break; - case 11: - message.languageCode = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 16: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 17: { + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.id = reader.string(); + break; + } + case 3: { + message.type = reader.int32(); + break; + } + case 4: { + message.primaryProductId = reader.string(); + break; + } + case 5: { + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + } + case 6: { + message.gtin = reader.string(); + break; + } + case 7: { + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + } + case 8: { + message.title = reader.string(); + break; + } + case 9: { + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + } + case 10: { + message.description = reader.string(); + break; + } + case 11: { + message.languageCode = reader.string(); + break; + } + case 12: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 13: { + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + } + case 14: { + message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); + break; + } + case 15: { + message.rating = $root.google.cloud.retail.v2.Rating.decode(reader, reader.uint32()); + break; + } + case 18: { + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 19: { + message.availability = reader.int32(); + break; + } + case 20: { + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 21: { + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2.FulfillmentInfo.decode(reader, reader.uint32())); + break; + } + case 22: { + message.uri = reader.string(); + break; + } + case 23: { + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2.Image.decode(reader, reader.uint32())); + break; + } + case 24: { + message.audience = $root.google.cloud.retail.v2.Audience.decode(reader, reader.uint32()); + break; + } + case 25: { + message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.decode(reader, reader.uint32()); + break; + } + case 26: { + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + } + case 27: { + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + } + case 28: { + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + } + case 29: { + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + } + case 34: { + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2.Promotion.decode(reader, reader.uint32())); + break; + } + case 33: { + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 30: { + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 31: { + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + break; } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2.PriceInfo.decode(reader, reader.uint32()); - break; - case 15: - message.rating = $root.google.cloud.retail.v2.Rating.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 21: - if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) - message.fulfillmentInfo = []; - message.fulfillmentInfo.push($root.google.cloud.retail.v2.FulfillmentInfo.decode(reader, reader.uint32())); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2.Image.decode(reader, reader.uint32())); - break; - case 24: - message.audience = $root.google.cloud.retail.v2.Audience.decode(reader, reader.uint32()); - break; - case 25: - message.colorInfo = $root.google.cloud.retail.v2.ColorInfo.decode(reader, reader.uint32()); - break; - case 26: - if (!(message.sizes && message.sizes.length)) - message.sizes = []; - message.sizes.push(reader.string()); - break; - case 27: - if (!(message.materials && message.materials.length)) - message.materials = []; - message.materials.push(reader.string()); - break; - case 28: - if (!(message.patterns && message.patterns.length)) - message.patterns = []; - message.patterns.push(reader.string()); - break; - case 29: - if (!(message.conditions && message.conditions.length)) - message.conditions = []; - message.conditions.push(reader.string()); - break; - case 34: - if (!(message.promotions && message.promotions.length)) - message.promotions = []; - message.promotions.push($root.google.cloud.retail.v2.Promotion.decode(reader, reader.uint32())); - break; - case 33: - message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 30: - message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 31: - if (!(message.variants && message.variants.length)) - message.variants = []; - message.variants.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -11489,6 +12222,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Product + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Product + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Product.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Product"; + }; + /** * Type enum. * @name google.cloud.retail.v2.Product.Type @@ -11622,9 +12370,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.promotionId = reader.string(); - break; + case 1: { + message.promotionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -11714,6 +12463,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Promotion + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Promotion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Promotion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Promotion"; + }; + return Promotion; })(); @@ -12028,91 +12792,111 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.eventType = reader.string(); - break; - case 2: - message.visitorId = reader.string(); - break; - case 21: - message.sessionId = reader.string(); - break; - case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2.ProductDetail.decode(reader, reader.uint32())); - break; - case 22: - message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.decode(reader, reader.uint32()); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.eventType = reader.string(); + break; + } + case 2: { + message.visitorId = reader.string(); + break; + } + case 21: { + message.sessionId = reader.string(); + break; + } + case 3: { + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + } + case 5: { + message.attributionToken = reader.string(); + break; + } + case 6: { + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2.ProductDetail.decode(reader, reader.uint32())); + break; + } + case 22: { + message.completionDetail = $root.google.cloud.retail.v2.CompletionDetail.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 8: { + message.cartId = reader.string(); + break; + } + case 9: { + message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.decode(reader, reader.uint32()); + break; + } + case 10: { + message.searchQuery = reader.string(); + break; + } + case 16: { + message.filter = reader.string(); + break; + } + case 17: { + message.orderBy = reader.string(); + break; + } + case 18: { + message.offset = reader.int32(); + break; + } + case 11: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 12: { + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); + break; + } + case 13: { + message.uri = reader.string(); + break; + } + case 14: { + message.referrerUri = reader.string(); + break; + } + case 15: { + message.pageViewId = reader.string(); + break; } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 16: - message.filter = reader.string(); - break; - case 17: - message.orderBy = reader.string(); - break; - case 18: - message.offset = reader.int32(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -12438,6 +13222,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEvent + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UserEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UserEvent"; + }; + return UserEvent; })(); @@ -12544,12 +13343,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; + case 1: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12658,6 +13459,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductDetail + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ProductDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ProductDetail"; + }; + return ProductDetail; })(); @@ -12775,15 +13591,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.completionAttributionToken = reader.string(); - break; - case 2: - message.selectedSuggestion = reader.string(); - break; - case 3: - message.selectedPosition = reader.int32(); - break; + case 1: { + message.completionAttributionToken = reader.string(); + break; + } + case 2: { + message.selectedSuggestion = reader.string(); + break; + } + case 3: { + message.selectedPosition = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -12890,6 +13709,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionDetail + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompletionDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompletionDetail"; + }; + return CompletionDetail; })(); @@ -13029,21 +13863,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.revenue = reader.float(); - break; - case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.revenue = reader.float(); + break; + } + case 3: { + message.tax = reader.float(); + break; + } + case 4: { + message.cost = reader.float(); + break; + } + case 5: { + message.currencyCode = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -13166,6 +14005,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurchaseTransaction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurchaseTransaction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurchaseTransaction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurchaseTransaction"; + }; + return PurchaseTransaction; })(); @@ -13202,7 +14056,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2.PredictionService|predict}. * @memberof google.cloud.retail.v2.PredictionService * @typedef PredictCallback * @type {function} @@ -13412,68 +14266,76 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); - break; - case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.validateOnly = reader.bool(); + break; + } + case 7: { + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.params[key] = value; + break; } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; } - message.labels[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -13659,6 +14521,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PredictRequest"; + }; + return PredictRequest; })(); @@ -13791,22 +14668,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); - break; - case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); - break; + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + } + case 4: { + message.validateOnly = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -13952,6 +14833,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PredictResponse"; + }; + PredictResponse.PredictionResult = (function() { /** @@ -14059,31 +14955,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.metadata[key] = value; + break; } - message.metadata[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -14201,6 +15099,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PredictResponse.PredictionResult"; + }; + return PredictionResult; })(); @@ -14240,7 +15153,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#createProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|createProduct}. * @memberof google.cloud.retail.v2.ProductService * @typedef CreateProductCallback * @type {function} @@ -14273,7 +15186,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#getProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|getProduct}. * @memberof google.cloud.retail.v2.ProductService * @typedef GetProductCallback * @type {function} @@ -14306,7 +15219,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#listProducts}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|listProducts}. * @memberof google.cloud.retail.v2.ProductService * @typedef ListProductsCallback * @type {function} @@ -14339,7 +15252,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#updateProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|updateProduct}. * @memberof google.cloud.retail.v2.ProductService * @typedef UpdateProductCallback * @type {function} @@ -14372,7 +15285,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#deleteProduct}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|deleteProduct}. * @memberof google.cloud.retail.v2.ProductService * @typedef DeleteProductCallback * @type {function} @@ -14405,7 +15318,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#importProducts}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|importProducts}. * @memberof google.cloud.retail.v2.ProductService * @typedef ImportProductsCallback * @type {function} @@ -14438,7 +15351,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#setInventory}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|setInventory}. * @memberof google.cloud.retail.v2.ProductService * @typedef SetInventoryCallback * @type {function} @@ -14471,7 +15384,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#addFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|addFulfillmentPlaces}. * @memberof google.cloud.retail.v2.ProductService * @typedef AddFulfillmentPlacesCallback * @type {function} @@ -14504,7 +15417,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#removeFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|removeFulfillmentPlaces}. * @memberof google.cloud.retail.v2.ProductService * @typedef RemoveFulfillmentPlacesCallback * @type {function} @@ -14537,7 +15450,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#addLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|addLocalInventories}. * @memberof google.cloud.retail.v2.ProductService * @typedef AddLocalInventoriesCallback * @type {function} @@ -14570,7 +15483,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.ProductService#removeLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2.ProductService|removeLocalInventories}. * @memberof google.cloud.retail.v2.ProductService * @typedef RemoveLocalInventoriesCallback * @type {function} @@ -14719,15 +15632,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 3: - message.productId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.productId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -14839,6 +15755,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CreateProductRequest"; + }; + return CreateProductRequest; })(); @@ -14934,9 +15865,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -15026,6 +15958,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GetProductRequest"; + }; + return GetProductRequest; })(); @@ -15143,15 +16090,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -15268,6 +16218,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateProductRequest"; + }; + return UpdateProductRequest; })(); @@ -15363,9 +16328,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -15455,6 +16421,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.DeleteProductRequest"; + }; + return DeleteProductRequest; })(); @@ -15594,21 +16575,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -15736,6 +16722,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListProductsRequest"; + }; + return ListProductsRequest; })(); @@ -15844,14 +16845,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -15967,6 +16970,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListProductsResponse"; + }; + return ListProductsResponse; })(); @@ -16095,18 +17113,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inventory = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 2: - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.allowMissing = reader.bool(); - break; + case 1: { + message.inventory = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -16236,6 +17258,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryRequest"; + }; + return SetInventoryRequest; })(); @@ -16396,6 +17433,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryMetadata"; + }; + return SetInventoryMetadata; })(); @@ -16556,6 +17608,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryResponse"; + }; + return SetInventoryResponse; })(); @@ -16697,23 +17764,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -16854,6 +17926,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesRequest"; + }; + return AddFulfillmentPlacesRequest; })(); @@ -17014,6 +18101,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"; + }; + return AddFulfillmentPlacesMetadata; })(); @@ -17174,6 +18276,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesResponse"; + }; + return AddFulfillmentPlacesResponse; })(); @@ -17315,23 +18432,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.localInventories && message.localInventories.length)) - message.localInventories = []; - message.localInventories.push($root.google.cloud.retail.v2.LocalInventory.decode(reader, reader.uint32())); - break; - case 4: - message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2.LocalInventory.decode(reader, reader.uint32())); + break; + } + case 4: { + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -17482,6 +18604,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesRequest"; + }; + return AddLocalInventoriesRequest; })(); @@ -17642,6 +18779,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesMetadata"; + }; + return AddLocalInventoriesMetadata; })(); @@ -17802,6 +18954,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesResponse"; + }; + return AddLocalInventoriesResponse; })(); @@ -17932,20 +19099,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 5: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 5: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -18078,6 +19249,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesRequest"; + }; + return RemoveLocalInventoriesRequest; })(); @@ -18238,6 +19424,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"; + }; + return RemoveLocalInventoriesMetadata; })(); @@ -18398,6 +19599,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesResponse"; + }; + return RemoveLocalInventoriesResponse; })(); @@ -18539,23 +19755,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -18696,6 +19917,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"; + }; + return RemoveFulfillmentPlacesRequest; })(); @@ -18856,6 +20092,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"; + }; + return RemoveFulfillmentPlacesMetadata; })(); @@ -19016,6 +20267,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"; + }; + return RemoveFulfillmentPlacesResponse; })(); @@ -19176,6 +20442,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurgeMetadata"; + }; + return PurgeMetadata; })(); @@ -19293,15 +20574,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; - case 3: - message.force = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -19408,6 +20692,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurgeUserEventsRequest"; + }; + return PurgeUserEventsRequest; })(); @@ -19503,9 +20802,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; + case 1: { + message.purgedEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -19609,6 +20909,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurgeUserEventsResponse"; + }; + return PurgeUserEventsResponse; })(); @@ -19645,7 +20960,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2.SearchService#search}. + * Callback as used by {@link google.cloud.retail.v2.SearchService|search}. * @memberof google.cloud.retail.v2.SearchService * @typedef SearchCallback * @type {function} @@ -20014,94 +21329,115 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); - break; - case 4: - message.visitorId = reader.string(); - break; - case 5: - message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: - message.filter = reader.string(); - break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 31: - message.searchMode = reader.int32(); - break; - case 32: - message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); - break; - case 34: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.branch = reader.string(); + break; + } + case 3: { + message.query = reader.string(); + break; + } + case 4: { + message.visitorId = reader.string(); + break; + } + case 5: { + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); + break; + } + case 7: { + message.pageSize = reader.int32(); + break; + } + case 8: { + message.pageToken = reader.string(); + break; + } + case 9: { + message.offset = reader.int32(); + break; + } + case 10: { + message.filter = reader.string(); + break; + } + case 28: { + message.canonicalFilter = reader.string(); + break; + } + case 11: { + message.orderBy = reader.string(); + break; + } + case 12: { + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + } + case 21: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 13: { + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + } + case 14: { + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + } + case 17: { + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + } + case 23: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 31: { + message.searchMode = reader.int32(); + break; + } + case 32: { + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + } + case 34: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + } + case 35: { + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; } - message.labels[key] = value; - break; - case 35: - message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -20464,6 +21800,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest"; + }; + SearchRequest.FacetSpec = (function() { /** @@ -20591,20 +21942,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; + case 1: { + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + } + case 2: { + message.limit = reader.int32(); + break; + } + case 3: { + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + } + case 4: { + message.enableDynamicPosition = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -20737,6 +22092,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.FacetSpec"; + }; + FacetSpec.FacetKey = (function() { /** @@ -20925,41 +22295,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 10: - message.caseInsensitive = reader.bool(); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - case 11: - message.returnMinMax = reader.bool(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + } + case 8: { + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + } + case 9: { + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + } + case 10: { + message.caseInsensitive = reader.bool(); + break; + } + case 4: { + message.orderBy = reader.string(); + break; + } + case 5: { + message.query = reader.string(); + break; + } + case 11: { + message.returnMinMax = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -21169,6 +22548,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetKey + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"; + }; + return FacetKey; })(); @@ -21267,9 +22661,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -21377,6 +22772,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DynamicFacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DynamicFacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode @@ -21515,14 +22925,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - case 2: - message.skipBoostSpecValidation = reader.bool(); - break; + case 1: { + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } + case 2: { + message.skipBoostSpecValidation = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -21642,6 +23054,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.BoostSpec"; + }; + BoostSpec.ConditionBoostSpec = (function() { /** @@ -21745,12 +23172,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; + case 1: { + message.condition = reader.string(); + break; + } + case 2: { + message.boost = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -21849,6 +23278,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ConditionBoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConditionBoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"; + }; + return ConditionBoostSpec; })(); @@ -21958,12 +23402,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; + case 1: { + message.condition = reader.int32(); + break; + } + case 2: { + message.pinUnexpandedResults = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -22080,6 +23526,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryExpansionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"; + }; + /** * Condition enum. * @name google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition @@ -22191,9 +23652,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -22301,6 +23763,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PersonalizationSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersonalizationSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode @@ -22412,9 +23889,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -22522,6 +24000,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SpellCorrectionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpellCorrectionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode @@ -22759,44 +24252,54 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); - break; - case 3: - message.totalSize = reader.int32(); - break; - case 4: - message.correctedQuery = reader.string(); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); - break; - case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - case 10: - message.redirectUri = reader.string(); - break; - case 12: - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); - break; - case 14: - if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) - message.invalidConditionBoostSpecs = []; - message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + case 4: { + message.correctedQuery = reader.string(); + break; + } + case 5: { + message.attributionToken = reader.string(); + break; + } + case 6: { + message.nextPageToken = reader.string(); + break; + } + case 7: { + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + } + case 10: { + message.redirectUri = reader.string(); + break; + } + case 12: { + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; + } + case 14: { + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -23029,6 +24532,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse"; + }; + SearchResponse.SearchResult = (function() { /** @@ -23173,59 +24691,64 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - case 3: - message.matchingVariantCount = reader.int32(); - break; - case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.matchingVariantCount = reader.int32(); + break; + } + case 4: { + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.matchingVariantFields[key] = value; + break; } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 5: { + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.variantRollupValues[key] = value; + break; } - message.variantRollupValues[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -23392,6 +24915,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.SearchResult"; + }; + return SearchResult; })(); @@ -23511,17 +25049,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + } + case 3: { + message.dynamicFacet = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -23646,6 +25187,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Facet + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Facet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.Facet"; + }; + Facet.FacetValue = (function() { /** @@ -23796,21 +25352,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); - break; - case 3: - message.count = reader.int64(); - break; - case 5: - message.minValue = reader.double(); - break; - case 6: - message.maxValue = reader.double(); - break; + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); + break; + } + case 3: { + message.count = reader.int64(); + break; + } + case 5: { + message.minValue = reader.double(); + break; + } + case 6: { + message.maxValue = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -23964,6 +25525,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetValue + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"; + }; + return FacetValue; })(); @@ -24073,12 +25649,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); - break; + case 1: { + message.expandedQuery = reader.bool(); + break; + } + case 2: { + message.pinnedResultCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -24191,6 +25769,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryExpansionInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"; + }; + return QueryExpansionInfo; })(); @@ -24230,7 +25823,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#writeUserEvent}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|writeUserEvent}. * @memberof google.cloud.retail.v2.UserEventService * @typedef WriteUserEventCallback * @type {function} @@ -24263,7 +25856,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#collectUserEvent}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|collectUserEvent}. * @memberof google.cloud.retail.v2.UserEventService * @typedef CollectUserEventCallback * @type {function} @@ -24296,7 +25889,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#purgeUserEvents}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|purgeUserEvents}. * @memberof google.cloud.retail.v2.UserEventService * @typedef PurgeUserEventsCallback * @type {function} @@ -24329,7 +25922,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#importUserEvents}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|importUserEvents}. * @memberof google.cloud.retail.v2.UserEventService * @typedef ImportUserEventsCallback * @type {function} @@ -24362,7 +25955,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2.UserEventService#rejoinUserEvents}. + * Callback as used by {@link google.cloud.retail.v2.UserEventService|rejoinUserEvents}. * @memberof google.cloud.retail.v2.UserEventService * @typedef RejoinUserEventsCallback * @type {function} @@ -24500,12 +26093,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -24609,6 +26204,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WriteUserEventRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.WriteUserEventRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteUserEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.WriteUserEventRequest"; + }; + return WriteUserEventRequest; })(); @@ -24737,18 +26347,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEvent = reader.string(); + break; + } + case 3: { + message.uri = reader.string(); + break; + } + case 4: { + message.ets = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -24877,6 +26491,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CollectUserEventRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CollectUserEventRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CollectUserEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CollectUserEventRequest"; + }; + return CollectUserEventRequest; })(); @@ -24983,12 +26612,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEventRejoinScope = reader.int32(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEventRejoinScope = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -25105,6 +26736,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RejoinUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RejoinUserEventsRequest"; + }; + /** * UserEventRejoinScope enum. * @name google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope @@ -25216,9 +26862,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.rejoinedUserEventsCount = reader.int64(); - break; + case 1: { + message.rejoinedUserEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -25322,6 +26969,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RejoinUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RejoinUserEventsResponse"; + }; + return RejoinUserEventsResponse; })(); @@ -25482,6 +27144,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RejoinUserEventsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RejoinUserEventsMetadata"; + }; + return RejoinUserEventsMetadata; })(); @@ -25600,12 +27277,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ingestionProductType = reader.string(); - break; - case 2: - message.merchantCenterProductIdField = reader.string(); - break; + case 1: { + message.ingestionProductType = reader.string(); + break; + } + case 2: { + message.merchantCenterProductIdField = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -25704,6 +27383,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductLevelConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ProductLevelConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductLevelConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ProductLevelConfig"; + }; + return ProductLevelConfig; })(); @@ -25865,27 +27559,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 9: - message.inUse = reader.bool(); - break; - case 10: - message.type = reader.int32(); - break; - case 5: - message.indexableOption = reader.int32(); - break; - case 6: - message.dynamicFacetableOption = reader.int32(); - break; - case 7: - message.searchableOption = reader.int32(); - break; - case 8: - message.recommendationsFilteringOption = reader.int32(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 9: { + message.inUse = reader.bool(); + break; + } + case 10: { + message.type = reader.int32(); + break; + } + case 5: { + message.indexableOption = reader.int32(); + break; + } + case 6: { + message.dynamicFacetableOption = reader.int32(); + break; + } + case 7: { + message.searchableOption = reader.int32(); + break; + } + case 8: { + message.recommendationsFilteringOption = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -26114,6 +27815,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CatalogAttribute + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CatalogAttribute + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CatalogAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CatalogAttribute"; + }; + /** * AttributeType enum. * @name google.cloud.retail.v2alpha.CatalogAttribute.AttributeType @@ -26299,34 +28015,37 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (message.catalogAttributes === $util.emptyObject) - message.catalogAttributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (message.catalogAttributes === $util.emptyObject) + message.catalogAttributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.catalogAttributes[key] = value; + break; + } + case 3: { + message.attributeConfigLevel = reader.int32(); + break; } - message.catalogAttributes[key] = value; - break; - case 3: - message.attributeConfigLevel = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -26471,6 +28190,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AttributesConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AttributesConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AttributesConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AttributesConfig"; + }; + return AttributesConfig; })(); @@ -26676,39 +28410,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.matchingOrder = reader.string(); - break; - case 3: - message.maxSuggestions = reader.int32(); - break; - case 4: - message.minPrefixLength = reader.int32(); - break; - case 11: - message.autoLearning = reader.bool(); - break; - case 5: - message.suggestionsInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 6: - message.lastSuggestionsImportOperation = reader.string(); - break; - case 7: - message.denylistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 8: - message.lastDenylistImportOperation = reader.string(); - break; - case 9: - message.allowlistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 10: - message.lastAllowlistImportOperation = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.matchingOrder = reader.string(); + break; + } + case 3: { + message.maxSuggestions = reader.int32(); + break; + } + case 4: { + message.minPrefixLength = reader.int32(); + break; + } + case 11: { + message.autoLearning = reader.bool(); + break; + } + case 5: { + message.suggestionsInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.lastSuggestionsImportOperation = reader.string(); + break; + } + case 7: { + message.denylistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.lastDenylistImportOperation = reader.string(); + break; + } + case 9: { + message.allowlistInputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.lastAllowlistImportOperation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -26894,6 +28639,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompletionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompletionConfig"; + }; + return CompletionConfig; })(); @@ -27035,23 +28795,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.merchantCenterAccountId = reader.int64(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - if (!(message.destinations && message.destinations.length)) - message.destinations = []; - message.destinations.push(reader.string()); - break; - case 4: - message.regionCode = reader.string(); - break; - case 5: - message.languageCode = reader.string(); - break; + case 1: { + message.merchantCenterAccountId = reader.int64(); + break; + } + case 2: { + message.branchId = reader.string(); + break; + } + case 3: { + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + message.destinations.push(reader.string()); + break; + } + case 4: { + message.regionCode = reader.string(); + break; + } + case 5: { + message.languageCode = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -27201,6 +28966,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MerchantCenterLink + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.MerchantCenterLink + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MerchantCenterLink.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.MerchantCenterLink"; + }; + return MerchantCenterLink; })(); @@ -27298,11 +29078,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.links && message.links.length)) - message.links = []; - message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.cloud.retail.v2alpha.MerchantCenterLink.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -27409,6 +29190,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MerchantCenterLinkingConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.MerchantCenterLinkingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MerchantCenterLinkingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.MerchantCenterLinkingConfig"; + }; + return MerchantCenterLinkingConfig; })(); @@ -27537,18 +29333,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); - break; - case 6: - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 4: { + message.productLevelConfig = $root.google.cloud.retail.v2alpha.ProductLevelConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2alpha.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -27673,6 +29473,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Catalog + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Catalog + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Catalog.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Catalog"; + }; + return Catalog; })(); @@ -27847,16 +29662,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.activeTimeRange && message.activeTimeRange.length)) - message.activeTimeRange = []; - message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2alpha.Condition.QueryTerm.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2alpha.Condition.TimeRange.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -27989,6 +29806,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Condition + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Condition + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Condition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Condition"; + }; + Condition.QueryTerm = (function() { /** @@ -28092,12 +29924,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.fullMatch = reader.bool(); - break; + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.fullMatch = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -28196,6 +30030,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryTerm + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Condition.QueryTerm + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTerm.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Condition.QueryTerm"; + }; + return QueryTerm; })(); @@ -28302,12 +30151,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -28416,6 +30267,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TimeRange + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Condition.TimeRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Condition.TimeRange"; + }; + return TimeRange; })(); @@ -28616,33 +30482,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); - break; - case 3: - message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); - break; - case 6: - message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); - break; - case 7: - message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); - break; - case 8: - message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); - break; - case 9: - message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); - break; - case 10: - message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); - break; - case 11: - message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); - break; - case 1: - message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); - break; + case 2: { + message.boostAction = $root.google.cloud.retail.v2alpha.Rule.BoostAction.decode(reader, reader.uint32()); + break; + } + case 3: { + message.redirectAction = $root.google.cloud.retail.v2alpha.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + } + case 6: { + message.onewaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + } + case 7: { + message.doNotAssociateAction = $root.google.cloud.retail.v2alpha.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + } + case 8: { + message.replacementAction = $root.google.cloud.retail.v2alpha.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + } + case 9: { + message.ignoreAction = $root.google.cloud.retail.v2alpha.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + } + case 10: { + message.filterAction = $root.google.cloud.retail.v2alpha.Rule.FilterAction.decode(reader, reader.uint32()); + break; + } + case 11: { + message.twowaySynonymsAction = $root.google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + } + case 1: { + message.condition = $root.google.cloud.retail.v2alpha.Condition.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -28896,6 +30771,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Rule + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Rule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule"; + }; + Rule.BoostAction = (function() { /** @@ -28999,12 +30889,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.boost = reader.float(); - break; - case 2: - message.productsFilter = reader.string(); - break; + case 1: { + message.boost = reader.float(); + break; + } + case 2: { + message.productsFilter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -29103,6 +30995,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoostAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.BoostAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.BoostAction"; + }; + return BoostAction; })(); @@ -29198,9 +31105,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.filter = reader.string(); - break; + case 1: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -29290,6 +31198,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FilterAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.FilterAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FilterAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.FilterAction"; + }; + return FilterAction; })(); @@ -29385,9 +31308,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.redirectUri = reader.string(); - break; + case 1: { + message.redirectUri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -29477,6 +31401,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RedirectAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.RedirectAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RedirectAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.RedirectAction"; + }; + return RedirectAction; })(); @@ -29574,11 +31513,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; + case 1: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -29680,6 +31620,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TwowaySynonymsAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TwowaySynonymsAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.TwowaySynonymsAction"; + }; + return TwowaySynonymsAction; })(); @@ -29803,21 +31758,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 4: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - case 2: - if (!(message.onewayTerms && message.onewayTerms.length)) - message.onewayTerms = []; - message.onewayTerms.push(reader.string()); - break; + case 3: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 4: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + case 2: { + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -29960,6 +31918,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OnewaySynonymsAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OnewaySynonymsAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.OnewaySynonymsAction"; + }; + return OnewaySynonymsAction; })(); @@ -30083,21 +32056,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) - message.doNotAssociateTerms = []; - message.doNotAssociateTerms.push(reader.string()); - break; - case 1: - if (!(message.terms && message.terms.length)) - message.terms = []; - message.terms.push(reader.string()); - break; + case 2: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 3: { + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + } + case 1: { + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -30240,6 +32216,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DoNotAssociateAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.DoNotAssociateAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoNotAssociateAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.DoNotAssociateAction"; + }; + return DoNotAssociateAction; })(); @@ -30359,17 +32350,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - message.replacementTerm = reader.string(); - break; - case 1: - message.term = reader.string(); - break; + case 2: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 3: { + message.replacementTerm = reader.string(); + break; + } + case 1: { + message.term = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -30489,6 +32483,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReplacementAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.ReplacementAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplacementAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.ReplacementAction"; + }; + return ReplacementAction; })(); @@ -30586,11 +32595,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.ignoreTerms && message.ignoreTerms.length)) - message.ignoreTerms = []; - message.ignoreTerms.push(reader.string()); - break; + case 1: { + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -30692,6 +32702,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for IgnoreAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rule.IgnoreAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IgnoreAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rule.IgnoreAction"; + }; + return IgnoreAction; })(); @@ -30805,16 +32830,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); - break; - case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); - break; + case 1: { + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); + break; + } + case 2: { + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -30937,6 +32964,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Audience + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Audience + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Audience.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Audience"; + }; + return Audience; })(); @@ -31047,16 +33089,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); - break; + case 1: { + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); + break; + } + case 2: { + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -31179,6 +33223,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ColorInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ColorInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ColorInfo"; + }; + return ColorInfo; })(); @@ -31339,27 +33398,31 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + case 2: { + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); - break; + break; + } + case 3: { + message.searchable = reader.bool(); + break; + } + case 4: { + message.indexable = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -31507,6 +33570,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CustomAttribute + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CustomAttribute + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CustomAttribute"; + }; + return CustomAttribute; })(); @@ -31615,14 +33693,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -31733,6 +33813,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FulfillmentInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.FulfillmentInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FulfillmentInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.FulfillmentInfo"; + }; + return FulfillmentInfo; })(); @@ -31850,15 +33945,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.height = reader.int32(); + break; + } + case 3: { + message.width = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -31965,6 +34063,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Image + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Image + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Image"; + }; + return Image; })(); @@ -32118,18 +34231,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.minimum = reader.double(); - break; - case 2: - message.exclusiveMinimum = reader.double(); - break; - case 3: - message.maximum = reader.double(); - break; - case 4: - message.exclusiveMaximum = reader.double(); - break; + case 1: { + message.minimum = reader.double(); + break; + } + case 2: { + message.exclusiveMinimum = reader.double(); + break; + } + case 3: { + message.maximum = reader.double(); + break; + } + case 4: { + message.exclusiveMaximum = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -32263,6 +34380,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Interval + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Interval + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Interval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Interval"; + }; + return Interval; })(); @@ -32424,27 +34556,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.currencyCode = reader.string(); - break; - case 2: - message.price = reader.float(); - break; - case 3: - message.originalPrice = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); - break; + case 1: { + message.currencyCode = reader.string(); + break; + } + case 2: { + message.price = reader.float(); + break; + } + case 3: { + message.originalPrice = reader.float(); + break; + } + case 4: { + message.cost = reader.float(); + break; + } + case 5: { + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.priceRange = $root.google.cloud.retail.v2alpha.PriceInfo.PriceRange.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -32598,6 +34737,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PriceInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PriceInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PriceInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PriceInfo"; + }; + PriceInfo.PriceRange = (function() { /** @@ -32701,12 +34855,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; - case 2: - message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; + case 1: { + message.price = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + } + case 2: { + message.originalPrice = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -32815,6 +34971,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PriceRange + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PriceInfo.PriceRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PriceRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PriceInfo.PriceRange"; + }; + return PriceRange; })(); @@ -32940,22 +35111,25 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ratingCount = reader.int32(); - break; - case 2: - message.averageRating = reader.float(); - break; - case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.ratingCount = reader.int32(); + break; + } + case 2: { + message.averageRating = reader.float(); + break; + } + case 3: { + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else message.ratingHistogram.push(reader.int32()); - } else - message.ratingHistogram.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -33075,6 +35249,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Rating + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Rating + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Rating.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Rating"; + }; + return Rating; })(); @@ -33203,18 +35392,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userId = reader.string(); - break; - case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); - break; + case 1: { + message.userId = reader.string(); + break; + } + case 2: { + message.ipAddress = reader.string(); + break; + } + case 3: { + message.userAgent = reader.string(); + break; + } + case 4: { + message.directUserRequest = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -33329,6 +35522,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UserInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UserInfo"; + }; + return UserInfo; })(); @@ -33463,39 +35671,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placeId = reader.string(); - break; - case 2: - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); - break; - case 3: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placeId = reader.string(); + break; + } + case 2: { + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + } + case 3: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 4: { + if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) + message.fulfillmentTypes = []; + message.fulfillmentTypes.push(reader.string()); + break; } - message.attributes[key] = value; - break; - case 4: - if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) - message.fulfillmentTypes = []; - message.fulfillmentTypes.push(reader.string()); - break; default: reader.skipType(tag & 7); break; @@ -33648,6 +35860,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for LocalInventory + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.LocalInventory + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocalInventory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.LocalInventory"; + }; + return LocalInventory; })(); @@ -33756,14 +35983,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); - break; - case 2: - message.dataSchema = reader.string(); - break; + case 1: { + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + } + case 2: { + message.dataSchema = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -33874,6 +36103,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GcsSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GcsSource"; + }; + return GcsSource; })(); @@ -34038,24 +36282,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 5: - message.projectId = reader.string(); - break; - case 1: - message.datasetId = reader.string(); - break; - case 2: - message.tableId = reader.string(); - break; - case 3: - message.gcsStagingDir = reader.string(); - break; - case 4: - message.dataSchema = reader.string(); - break; + case 6: { + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + } + case 5: { + message.projectId = reader.string(); + break; + } + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableId = reader.string(); + break; + } + case 3: { + message.gcsStagingDir = reader.string(); + break; + } + case 4: { + message.dataSchema = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -34197,6 +36447,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BigQuerySource + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.BigQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.BigQuerySource"; + }; + return BigQuerySource; })(); @@ -34294,11 +36559,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -34405,6 +36671,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductInlineSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ProductInlineSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ProductInlineSource"; + }; + return ProductInlineSource; })(); @@ -34502,11 +36783,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -34613,6 +36895,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventInlineSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UserEventInlineSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UserEventInlineSource"; + }; + return UserEventInlineSource; })(); @@ -34722,9 +37019,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; + case 1: { + message.gcsPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -34818,6 +37116,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportErrorsConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportErrorsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportErrorsConfig"; + }; + return ImportErrorsConfig; })(); @@ -34990,30 +37303,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.reconciliationMode = reader.int32(); - break; - case 7: - message.notificationPubsubTopic = reader.string(); - break; - case 8: - message.skipDefaultBranchProtection = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 6: { + message.requestId = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2alpha.ProductInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.reconciliationMode = reader.int32(); + break; + } + case 7: { + message.notificationPubsubTopic = reader.string(); + break; + } + case 8: { + message.skipDefaultBranchProtection = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -35193,6 +37514,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportProductsRequest"; + }; + /** * ReconciliationMode enum. * @name google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode @@ -35326,15 +37662,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2alpha.UserEventInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -35451,6 +37790,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportUserEventsRequest"; + }; + return ImportUserEventsRequest; })(); @@ -35568,15 +37922,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2alpha.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -35688,6 +38045,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportCompletionDataRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCompletionDataRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportCompletionDataRequest"; + }; + return ImportCompletionDataRequest; })(); @@ -35819,15 +38191,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.productInlineSource = $root.google.cloud.retail.v2alpha.ProductInlineSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -35967,6 +38342,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ProductInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ProductInputConfig"; + }; + return ProductInputConfig; })(); @@ -36098,15 +38488,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.userEventInlineSource = $root.google.cloud.retail.v2alpha.UserEventInlineSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.retail.v2alpha.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -36246,6 +38639,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UserEventInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UserEventInputConfig"; + }; + return UserEventInputConfig; })(); @@ -36355,9 +38763,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.bigQuerySource = $root.google.cloud.retail.v2alpha.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -36457,6 +38866,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionDataInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompletionDataInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionDataInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompletionDataInputConfig"; + }; + return CompletionDataInputConfig; })(); @@ -36607,24 +39031,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.successCount = reader.int64(); + break; + } + case 4: { + message.failureCount = reader.int64(); + break; + } + case 5: { + message.requestId = reader.string(); + break; + } + case 6: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -36793,6 +39223,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportMetadata"; + }; + return ImportMetadata; })(); @@ -36901,14 +39346,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -37029,6 +39476,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportProductsResponse"; + }; + return ImportProductsResponse; })(); @@ -37148,17 +39610,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2alpha.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.importSummary = $root.google.cloud.retail.v2alpha.UserEventImportSummary.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -37293,6 +39758,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportUserEventsResponse"; + }; + return ImportUserEventsResponse; })(); @@ -37399,12 +39879,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.joinedEventsCount = reader.int64(); - break; - case 2: - message.unjoinedEventsCount = reader.int64(); - break; + case 1: { + message.joinedEventsCount = reader.int64(); + break; + } + case 2: { + message.unjoinedEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -37531,6 +40013,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventImportSummary + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UserEventImportSummary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventImportSummary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UserEventImportSummary"; + }; + return UserEventImportSummary; })(); @@ -37628,11 +40125,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -37739,6 +40237,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportCompletionDataResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ImportCompletionDataResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCompletionDataResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ImportCompletionDataResponse"; + }; + return ImportCompletionDataResponse; })(); @@ -38228,148 +40741,181 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 16: - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 17: - message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.id = reader.string(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 5: - if (!(message.collectionMemberIds && message.collectionMemberIds.length)) - message.collectionMemberIds = []; - message.collectionMemberIds.push(reader.string()); - break; - case 6: - message.gtin = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 9: - if (!(message.brands && message.brands.length)) - message.brands = []; - message.brands.push(reader.string()); - break; - case 10: - message.description = reader.string(); - break; - case 11: - message.languageCode = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 16: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 17: { + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.id = reader.string(); + break; + } + case 3: { + message.type = reader.int32(); + break; + } + case 4: { + message.primaryProductId = reader.string(); + break; + } + case 5: { + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + } + case 6: { + message.gtin = reader.string(); + break; + } + case 7: { + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + } + case 8: { + message.title = reader.string(); + break; + } + case 9: { + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + } + case 10: { + message.description = reader.string(); + break; + } + case 11: { + message.languageCode = reader.string(); + break; + } + case 12: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 13: { + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + } + case 14: { + message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); + break; + } + case 15: { + message.rating = $root.google.cloud.retail.v2alpha.Rating.decode(reader, reader.uint32()); + break; + } + case 18: { + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 19: { + message.availability = reader.int32(); + break; + } + case 20: { + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 21: { + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2alpha.FulfillmentInfo.decode(reader, reader.uint32())); + break; + } + case 22: { + message.uri = reader.string(); + break; + } + case 23: { + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); + break; + } + case 24: { + message.audience = $root.google.cloud.retail.v2alpha.Audience.decode(reader, reader.uint32()); + break; + } + case 25: { + message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.decode(reader, reader.uint32()); + break; + } + case 26: { + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + } + case 27: { + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + } + case 28: { + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + } + case 29: { + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + } + case 34: { + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2alpha.Promotion.decode(reader, reader.uint32())); + break; + } + case 33: { + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 30: { + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 31: { + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + break; } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2alpha.PriceInfo.decode(reader, reader.uint32()); - break; - case 15: - message.rating = $root.google.cloud.retail.v2alpha.Rating.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 21: - if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) - message.fulfillmentInfo = []; - message.fulfillmentInfo.push($root.google.cloud.retail.v2alpha.FulfillmentInfo.decode(reader, reader.uint32())); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2alpha.Image.decode(reader, reader.uint32())); - break; - case 24: - message.audience = $root.google.cloud.retail.v2alpha.Audience.decode(reader, reader.uint32()); - break; - case 25: - message.colorInfo = $root.google.cloud.retail.v2alpha.ColorInfo.decode(reader, reader.uint32()); - break; - case 26: - if (!(message.sizes && message.sizes.length)) - message.sizes = []; - message.sizes.push(reader.string()); - break; - case 27: - if (!(message.materials && message.materials.length)) - message.materials = []; - message.materials.push(reader.string()); - break; - case 28: - if (!(message.patterns && message.patterns.length)) - message.patterns = []; - message.patterns.push(reader.string()); - break; - case 29: - if (!(message.conditions && message.conditions.length)) - message.conditions = []; - message.conditions.push(reader.string()); - break; - case 34: - if (!(message.promotions && message.promotions.length)) - message.promotions = []; - message.promotions.push($root.google.cloud.retail.v2alpha.Promotion.decode(reader, reader.uint32())); - break; - case 33: - message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 30: - message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 31: - if (!(message.variants && message.variants.length)) - message.variants = []; - message.variants.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -39016,6 +41562,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Product + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Product + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Product.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Product"; + }; + /** * Type enum. * @name google.cloud.retail.v2alpha.Product.Type @@ -39149,9 +41710,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.promotionId = reader.string(); - break; + case 1: { + message.promotionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -39241,6 +41803,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Promotion + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Promotion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Promotion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Promotion"; + }; + return Promotion; })(); @@ -39555,91 +42132,111 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.eventType = reader.string(); - break; - case 2: - message.visitorId = reader.string(); - break; - case 21: - message.sessionId = reader.string(); - break; - case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); - break; - case 22: - message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.decode(reader, reader.uint32()); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.eventType = reader.string(); + break; + } + case 2: { + message.visitorId = reader.string(); + break; + } + case 21: { + message.sessionId = reader.string(); + break; + } + case 3: { + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + } + case 5: { + message.attributionToken = reader.string(); + break; + } + case 6: { + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2alpha.ProductDetail.decode(reader, reader.uint32())); + break; + } + case 22: { + message.completionDetail = $root.google.cloud.retail.v2alpha.CompletionDetail.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 8: { + message.cartId = reader.string(); + break; + } + case 9: { + message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); + break; + } + case 10: { + message.searchQuery = reader.string(); + break; + } + case 16: { + message.filter = reader.string(); + break; + } + case 17: { + message.orderBy = reader.string(); + break; + } + case 18: { + message.offset = reader.int32(); + break; + } + case 11: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 12: { + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + } + case 13: { + message.uri = reader.string(); + break; + } + case 14: { + message.referrerUri = reader.string(); + break; + } + case 15: { + message.pageViewId = reader.string(); + break; } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2alpha.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 16: - message.filter = reader.string(); - break; - case 17: - message.orderBy = reader.string(); - break; - case 18: - message.offset = reader.int32(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -39965,6 +42562,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEvent + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UserEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UserEvent"; + }; + return UserEvent; })(); @@ -40071,12 +42683,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; + case 1: { + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -40185,6 +42799,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductDetail + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ProductDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ProductDetail"; + }; + return ProductDetail; })(); @@ -40302,15 +42931,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.completionAttributionToken = reader.string(); - break; - case 2: - message.selectedSuggestion = reader.string(); - break; - case 3: - message.selectedPosition = reader.int32(); - break; + case 1: { + message.completionAttributionToken = reader.string(); + break; + } + case 2: { + message.selectedSuggestion = reader.string(); + break; + } + case 3: { + message.selectedPosition = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -40417,6 +43049,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionDetail + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompletionDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompletionDetail"; + }; + return CompletionDetail; })(); @@ -40556,21 +43203,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.revenue = reader.float(); - break; - case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.revenue = reader.float(); + break; + } + case 3: { + message.tax = reader.float(); + break; + } + case 4: { + message.cost = reader.float(); + break; + } + case 5: { + message.currencyCode = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -40693,6 +43345,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurchaseTransaction + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurchaseTransaction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurchaseTransaction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurchaseTransaction"; + }; + return PurchaseTransaction; })(); @@ -40729,7 +43396,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#listCatalogs}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|listCatalogs}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef ListCatalogsCallback * @type {function} @@ -40762,7 +43429,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCatalog}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|updateCatalog}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef UpdateCatalogCallback * @type {function} @@ -40795,7 +43462,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#setDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|setDefaultBranch}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef SetDefaultBranchCallback * @type {function} @@ -40828,7 +43495,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|getDefaultBranch}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef GetDefaultBranchCallback * @type {function} @@ -40861,7 +43528,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|getCompletionConfig}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef GetCompletionConfigCallback * @type {function} @@ -40894,7 +43561,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|updateCompletionConfig}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef UpdateCompletionConfigCallback * @type {function} @@ -40927,7 +43594,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#getAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|getAttributesConfig}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef GetAttributesConfigCallback * @type {function} @@ -40960,7 +43627,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#updateAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|updateAttributesConfig}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef UpdateAttributesConfigCallback * @type {function} @@ -40993,7 +43660,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#addCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|addCatalogAttribute}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef AddCatalogAttributeCallback * @type {function} @@ -41026,7 +43693,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#removeCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|removeCatalogAttribute}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef RemoveCatalogAttributeCallback * @type {function} @@ -41059,7 +43726,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService#replaceCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2alpha.CatalogService|replaceCatalogAttribute}. * @memberof google.cloud.retail.v2alpha.CatalogService * @typedef ReplaceCatalogAttributeCallback * @type {function} @@ -41208,15 +43875,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -41323,6 +43993,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListCatalogsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListCatalogsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCatalogsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListCatalogsRequest"; + }; + return ListCatalogsRequest; })(); @@ -41431,14 +44116,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -41554,6 +44241,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListCatalogsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListCatalogsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCatalogsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListCatalogsResponse"; + }; + return ListCatalogsResponse; })(); @@ -41660,12 +44362,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.catalog = $root.google.cloud.retail.v2alpha.Catalog.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -41774,6 +44478,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateCatalogRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateCatalogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCatalogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateCatalogRequest"; + }; + return UpdateCatalogRequest; })(); @@ -41902,18 +44621,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - message.note = reader.string(); - break; - case 4: - message.force = reader.bool(); - break; + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.branchId = reader.string(); + break; + } + case 3: { + message.note = reader.string(); + break; + } + case 4: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -42028,6 +44751,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultBranchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SetDefaultBranchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SetDefaultBranchRequest"; + }; + return SetDefaultBranchRequest; })(); @@ -42123,9 +44861,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; + case 1: { + message.catalog = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -42215,6 +44954,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetDefaultBranchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetDefaultBranchRequest"; + }; + return GetDefaultBranchRequest; })(); @@ -42332,15 +45086,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.branch = reader.string(); - break; - case 2: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.note = reader.string(); - break; + case 1: { + message.branch = reader.string(); + break; + } + case 2: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.note = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -42452,6 +45209,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetDefaultBranchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetDefaultBranchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDefaultBranchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetDefaultBranchResponse"; + }; + return GetDefaultBranchResponse; })(); @@ -42547,9 +45319,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -42639,6 +45412,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetCompletionConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetCompletionConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetCompletionConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetCompletionConfigRequest"; + }; + return GetCompletionConfigRequest; })(); @@ -42745,12 +45533,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.completionConfig = $root.google.cloud.retail.v2alpha.CompletionConfig.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.completionConfig = $root.google.cloud.retail.v2alpha.CompletionConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -42859,6 +45649,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateCompletionConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateCompletionConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCompletionConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateCompletionConfigRequest"; + }; + return UpdateCompletionConfigRequest; })(); @@ -42954,9 +45759,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -43046,6 +45852,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetAttributesConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetAttributesConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAttributesConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetAttributesConfigRequest"; + }; + return GetAttributesConfigRequest; })(); @@ -43152,12 +45973,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = $root.google.cloud.retail.v2alpha.AttributesConfig.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.attributesConfig = $root.google.cloud.retail.v2alpha.AttributesConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -43266,6 +46089,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateAttributesConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateAttributesConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateAttributesConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateAttributesConfigRequest"; + }; + return UpdateAttributesConfigRequest; })(); @@ -43372,12 +46210,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = reader.string(); - break; - case 2: - message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); - break; + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -43481,6 +46321,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddCatalogAttributeRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddCatalogAttributeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddCatalogAttributeRequest"; + }; + return AddCatalogAttributeRequest; })(); @@ -43587,12 +46442,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = reader.string(); - break; - case 2: - message.key = reader.string(); - break; + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.key = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -43691,6 +46548,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveCatalogAttributeRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest"; + }; + return RemoveCatalogAttributeRequest; })(); @@ -43808,15 +46680,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = reader.string(); - break; - case 2: - message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); - break; - case 3: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.catalogAttribute = $root.google.cloud.retail.v2alpha.CatalogAttribute.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -43933,6 +46808,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReplaceCatalogAttributeRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplaceCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest"; + }; + return ReplaceCatalogAttributeRequest; })(); @@ -43969,7 +46859,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#completeQuery}. + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService|completeQuery}. * @memberof google.cloud.retail.v2alpha.CompletionService * @typedef CompleteQueryCallback * @type {function} @@ -44002,7 +46892,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2alpha.CompletionService|importCompletionData}. * @memberof google.cloud.retail.v2alpha.CompletionService * @typedef ImportCompletionDataCallback * @type {function} @@ -44197,29 +47087,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.query = reader.string(); - break; - case 7: - message.visitorId = reader.string(); - break; - case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - case 4: - message.deviceType = reader.string(); - break; - case 6: - message.dataset = reader.string(); - break; - case 5: - message.maxSuggestions = reader.int32(); - break; + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.query = reader.string(); + break; + } + case 7: { + message.visitorId = reader.string(); + break; + } + case 3: { + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + } + case 4: { + message.deviceType = reader.string(); + break; + } + case 6: { + message.dataset = reader.string(); + break; + } + case 5: { + message.maxSuggestions = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -44371,6 +47268,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompleteQueryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompleteQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompleteQueryRequest"; + }; + return CompleteQueryRequest; })(); @@ -44492,19 +47404,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); - break; - case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -44646,6 +47561,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompleteQueryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompleteQueryResponse"; + }; + CompleteQueryResponse.CompletionResult = (function() { /** @@ -44753,31 +47683,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.suggestion = reader.string(); + break; + } + case 2: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2alpha.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; } - message.attributes[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -44895,6 +47827,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult"; + }; + return CompletionResult; })(); @@ -44990,9 +47937,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; + case 1: { + message.recentSearch = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -45082,6 +48030,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RecentSearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RecentSearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CompleteQueryResponse.RecentSearchResult"; + }; + return RecentSearchResult; })(); @@ -45272,43 +48235,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - message.facetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32()); - break; - case 4: - message.rule = $root.google.cloud.retail.v2alpha.Rule.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 5: - if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) - message.associatedServingConfigIds = []; - message.associatedServingConfigIds.push(reader.string()); - break; - case 6: - if (!(message.solutionTypes && message.solutionTypes.length)) - message.solutionTypes = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 3: { + message.facetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32()); + break; + } + case 4: { + message.rule = $root.google.cloud.retail.v2alpha.Rule.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 5: { + if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) + message.associatedServingConfigIds = []; + message.associatedServingConfigIds.push(reader.string()); + break; + } + case 6: { + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else message.solutionTypes.push(reader.int32()); - } else - message.solutionTypes.push(reader.int32()); - break; - case 7: - if (!(message.searchSolutionUseCase && message.searchSolutionUseCase.length)) - message.searchSolutionUseCase = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 7: { + if (!(message.searchSolutionUseCase && message.searchSolutionUseCase.length)) + message.searchSolutionUseCase = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.searchSolutionUseCase.push(reader.int32()); + } else message.searchSolutionUseCase.push(reader.int32()); - } else - message.searchSolutionUseCase.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -45548,6 +48518,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Control + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Control + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Control.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Control"; + }; + return Control; })(); @@ -45584,7 +48569,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.SearchService#search}. + * Callback as used by {@link google.cloud.retail.v2alpha.SearchService|search}. * @memberof google.cloud.retail.v2alpha.SearchService * @typedef SearchCallback * @type {function} @@ -45964,97 +48949,119 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); - break; - case 4: - message.visitorId = reader.string(); - break; - case 5: - message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: - message.filter = reader.string(); - break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 15: - message.relevanceThreshold = reader.int32(); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 31: - message.searchMode = reader.int32(); - break; - case 32: - message.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); - break; - case 34: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.branch = reader.string(); + break; + } + case 3: { + message.query = reader.string(); + break; + } + case 4: { + message.visitorId = reader.string(); + break; + } + case 5: { + message.userInfo = $root.google.cloud.retail.v2alpha.UserInfo.decode(reader, reader.uint32()); + break; + } + case 7: { + message.pageSize = reader.int32(); + break; + } + case 8: { + message.pageToken = reader.string(); + break; + } + case 9: { + message.offset = reader.int32(); + break; + } + case 10: { + message.filter = reader.string(); + break; + } + case 28: { + message.canonicalFilter = reader.string(); + break; + } + case 11: { + message.orderBy = reader.string(); + break; + } + case 12: { + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + } + case 21: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 13: { + message.boostSpec = $root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + } + case 14: { + message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + } + case 15: { + message.relevanceThreshold = reader.int32(); + break; + } + case 17: { + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + } + case 23: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 31: { + message.searchMode = reader.int32(); + break; + } + case 32: { + message.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + } + case 34: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + } + case 35: { + message.spellCorrectionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; } - message.labels[key] = value; - break; - case 35: - message.spellCorrectionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -46453,6 +49460,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest"; + }; + SearchRequest.FacetSpec = (function() { /** @@ -46580,20 +49602,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; + case 1: { + message.facetKey = $root.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + } + case 2: { + message.limit = reader.int32(); + break; + } + case 3: { + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + } + case 4: { + message.enableDynamicPosition = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -46726,6 +49752,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.FacetSpec"; + }; + FacetSpec.FacetKey = (function() { /** @@ -46914,41 +49955,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 10: - message.caseInsensitive = reader.bool(); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - case 11: - message.returnMinMax = reader.bool(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + } + case 8: { + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + } + case 9: { + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + } + case 10: { + message.caseInsensitive = reader.bool(); + break; + } + case 4: { + message.orderBy = reader.string(); + break; + } + case 5: { + message.query = reader.string(); + break; + } + case 11: { + message.returnMinMax = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -47158,6 +50208,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetKey + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey"; + }; + return FacetKey; })(); @@ -47256,9 +50321,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -47366,6 +50432,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DynamicFacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DynamicFacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode @@ -47504,14 +50585,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - case 2: - message.skipBoostSpecValidation = reader.bool(); - break; + case 1: { + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } + case 2: { + message.skipBoostSpecValidation = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -47631,6 +50714,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.BoostSpec"; + }; + BoostSpec.ConditionBoostSpec = (function() { /** @@ -47734,12 +50832,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; + case 1: { + message.condition = reader.string(); + break; + } + case 2: { + message.boost = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -47838,6 +50938,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ConditionBoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConditionBoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec"; + }; + return ConditionBoostSpec; })(); @@ -47947,12 +51062,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; + case 1: { + message.condition = reader.int32(); + break; + } + case 2: { + message.pinUnexpandedResults = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -48069,6 +51186,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryExpansionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec"; + }; + /** * Condition enum. * @name google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition @@ -48180,9 +51312,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -48290,6 +51423,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PersonalizationSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersonalizationSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode @@ -48401,9 +51549,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -48511,6 +51660,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SpellCorrectionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpellCorrectionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode @@ -48768,44 +51932,54 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); - break; - case 3: - message.totalSize = reader.int32(); - break; - case 4: - message.correctedQuery = reader.string(); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); - break; - case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - case 10: - message.redirectUri = reader.string(); - break; - case 12: - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); - break; - case 14: - if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) - message.invalidConditionBoostSpecs = []; - message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + case 4: { + message.correctedQuery = reader.string(); + break; + } + case 5: { + message.attributionToken = reader.string(); + break; + } + case 6: { + message.nextPageToken = reader.string(); + break; + } + case 7: { + message.queryExpansionInfo = $root.google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + } + case 10: { + message.redirectUri = reader.string(); + break; + } + case 12: { + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; + } + case 14: { + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2alpha.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -49038,6 +52212,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchResponse"; + }; + SearchResponse.SearchResult = (function() { /** @@ -49182,59 +52371,64 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 3: - message.matchingVariantCount = reader.int32(); - break; - case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.matchingVariantCount = reader.int32(); + break; + } + case 4: { + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.matchingVariantFields[key] = value; + break; } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 5: { + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.variantRollupValues[key] = value; + break; } - message.variantRollupValues[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -49401,6 +52595,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchResponse.SearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchResponse.SearchResult"; + }; + return SearchResult; })(); @@ -49520,17 +52729,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + } + case 3: { + message.dynamicFacet = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -49655,6 +52867,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Facet + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Facet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchResponse.Facet"; + }; + Facet.FacetValue = (function() { /** @@ -49805,21 +53032,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); - break; - case 3: - message.count = reader.int64(); - break; - case 5: - message.minValue = reader.double(); - break; - case 6: - message.maxValue = reader.double(); - break; + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.interval = $root.google.cloud.retail.v2alpha.Interval.decode(reader, reader.uint32()); + break; + } + case 3: { + message.count = reader.int64(); + break; + } + case 5: { + message.minValue = reader.double(); + break; + } + case 6: { + message.maxValue = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -49973,6 +53205,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetValue + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue"; + }; + return FacetValue; })(); @@ -50082,12 +53329,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); - break; + case 1: { + message.expandedQuery = reader.bool(); + break; + } + case 2: { + message.pinnedResultCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -50200,6 +53449,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryExpansionInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SearchResponse.QueryExpansionInfo"; + }; + return QueryExpansionInfo; })(); @@ -50239,7 +53503,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#createControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|createControl}. * @memberof google.cloud.retail.v2alpha.ControlService * @typedef CreateControlCallback * @type {function} @@ -50272,7 +53536,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#deleteControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|deleteControl}. * @memberof google.cloud.retail.v2alpha.ControlService * @typedef DeleteControlCallback * @type {function} @@ -50305,7 +53569,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#updateControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|updateControl}. * @memberof google.cloud.retail.v2alpha.ControlService * @typedef UpdateControlCallback * @type {function} @@ -50338,7 +53602,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#getControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|getControl}. * @memberof google.cloud.retail.v2alpha.ControlService * @typedef GetControlCallback * @type {function} @@ -50371,7 +53635,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ControlService#listControls}. + * Callback as used by {@link google.cloud.retail.v2alpha.ControlService|listControls}. * @memberof google.cloud.retail.v2alpha.ControlService * @typedef ListControlsCallback * @type {function} @@ -50520,15 +53784,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.control = $root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32()); - break; - case 3: - message.controlId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.control = $root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32()); + break; + } + case 3: { + message.controlId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -50640,6 +53907,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CreateControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CreateControlRequest"; + }; + return CreateControlRequest; })(); @@ -50746,12 +54028,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.control = $root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.control = $root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -50860,6 +54144,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateControlRequest"; + }; + return UpdateControlRequest; })(); @@ -50955,9 +54254,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -51047,6 +54347,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.DeleteControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.DeleteControlRequest"; + }; + return DeleteControlRequest; })(); @@ -51142,9 +54457,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -51234,6 +54550,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetControlRequest"; + }; + return GetControlRequest; })(); @@ -51362,18 +54693,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -51488,6 +54823,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListControlsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListControlsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListControlsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListControlsRequest"; + }; + return ListControlsRequest; })(); @@ -51596,14 +54946,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.controls && message.controls.length)) - message.controls = []; - message.controls.push($root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.controls && message.controls.length)) + message.controls = []; + message.controls.push($root.google.cloud.retail.v2alpha.Control.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -51719,6 +55071,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListControlsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListControlsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListControlsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListControlsResponse"; + }; + return ListControlsResponse; })(); @@ -51828,9 +55195,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; + case 1: { + message.gcsPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -51924,6 +55292,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportErrorsConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ExportErrorsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ExportErrorsConfig"; + }; + return ExportErrorsConfig; })(); @@ -52030,12 +55413,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -52144,6 +55529,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ExportMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ExportMetadata"; + }; + return ExportMetadata; })(); @@ -52263,17 +55663,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -52408,6 +55811,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ExportProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ExportProductsResponse"; + }; + return ExportProductsResponse; })(); @@ -52527,17 +55945,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2alpha.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputResult = $root.google.cloud.retail.v2alpha.OutputResult.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -52672,6 +56093,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ExportUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ExportUserEventsResponse"; + }; + return ExportUserEventsResponse; })(); @@ -52769,11 +56205,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.bigqueryResult && message.bigqueryResult.length)) - message.bigqueryResult = []; - message.bigqueryResult.push($root.google.cloud.retail.v2alpha.BigQueryOutputResult.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.bigqueryResult && message.bigqueryResult.length)) + message.bigqueryResult = []; + message.bigqueryResult.push($root.google.cloud.retail.v2alpha.BigQueryOutputResult.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -52880,6 +56317,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.OutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.OutputResult"; + }; + return OutputResult; })(); @@ -52986,12 +56438,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.datasetId = reader.string(); - break; - case 2: - message.tableId = reader.string(); - break; + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -53090,6 +56544,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BigQueryOutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.BigQueryOutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQueryOutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.BigQueryOutputResult"; + }; + return BigQueryOutputResult; })(); @@ -53355,53 +56824,68 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 17: - message.pageOptimizationConfig = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 3: - message.trainingState = reader.int32(); - break; - case 4: - message.servingState = reader.int32(); - break; - case 5: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.type = reader.string(); - break; - case 8: - message.optimizationObjective = reader.string(); - break; - case 11: - message.periodicTuningState = reader.int32(); - break; - case 12: - message.lastTuneTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 15: - message.tuningOperation = reader.string(); - break; - case 16: - message.dataState = reader.int32(); - break; - case 18: - message.filteringOption = reader.int32(); - break; - case 19: - if (!(message.servingConfigLists && message.servingConfigLists.length)) - message.servingConfigLists = []; - message.servingConfigLists.push($root.google.cloud.retail.v2alpha.Model.ServingConfigList.decode(reader, reader.uint32())); - break; + case 17: { + message.pageOptimizationConfig = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.trainingState = reader.int32(); + break; + } + case 4: { + message.servingState = reader.int32(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.type = reader.string(); + break; + } + case 8: { + message.optimizationObjective = reader.string(); + break; + } + case 11: { + message.periodicTuningState = reader.int32(); + break; + } + case 12: { + message.lastTuneTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 15: { + message.tuningOperation = reader.string(); + break; + } + case 16: { + message.dataState = reader.int32(); + break; + } + case 18: { + message.filteringOption = reader.int32(); + break; + } + case 19: { + if (!(message.servingConfigLists && message.servingConfigLists.length)) + message.servingConfigLists = []; + message.servingConfigLists.push($root.google.cloud.retail.v2alpha.Model.ServingConfigList.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -53748,6 +57232,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Model + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Model + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Model.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Model"; + }; + Model.PageOptimizationConfig = (function() { /** @@ -53864,17 +57363,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageOptimizationEventType = reader.string(); - break; - case 2: - if (!(message.panels && message.panels.length)) - message.panels = []; - message.panels.push($root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.decode(reader, reader.uint32())); - break; - case 3: - message.restriction = reader.int32(); - break; + case 1: { + message.pageOptimizationEventType = reader.string(); + break; + } + case 2: { + if (!(message.panels && message.panels.length)) + message.panels = []; + message.panels.push($root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.decode(reader, reader.uint32())); + break; + } + case 3: { + message.restriction = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -54027,6 +57529,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PageOptimizationConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PageOptimizationConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Model.PageOptimizationConfig"; + }; + PageOptimizationConfig.Candidate = (function() { /** @@ -54133,9 +57650,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfigId = reader.string(); - break; + case 1: { + message.servingConfigId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -54229,6 +57747,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Candidate + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Candidate.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate"; + }; + return Candidate; })(); @@ -54348,17 +57881,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.displayName = reader.string(); - break; - case 2: - if (!(message.candidates && message.candidates.length)) - message.candidates = []; - message.candidates.push($root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.decode(reader, reader.uint32())); - break; - case 3: - message.defaultCandidate = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.decode(reader, reader.uint32()); - break; + case 1: { + message.displayName = reader.string(); + break; + } + case 2: { + if (!(message.candidates && message.candidates.length)) + message.candidates = []; + message.candidates.push($root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.decode(reader, reader.uint32())); + break; + } + case 3: { + message.defaultCandidate = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Candidate.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -54488,6 +58024,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Panel + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Panel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel"; + }; + return Panel; })(); @@ -54608,11 +58159,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.servingConfigIds && message.servingConfigIds.length)) - message.servingConfigIds = []; - message.servingConfigIds.push(reader.string()); - break; + case 1: { + if (!(message.servingConfigIds && message.servingConfigIds.length)) + message.servingConfigIds = []; + message.servingConfigIds.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -54714,6 +58266,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServingConfigList + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.Model.ServingConfigList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServingConfigList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.Model.ServingConfigList"; + }; + return ServingConfigList; })(); @@ -54821,7 +58388,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#createModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|createModel}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef CreateModelCallback * @type {function} @@ -54854,7 +58421,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#pauseModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|pauseModel}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef PauseModelCallback * @type {function} @@ -54887,7 +58454,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#resumeModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|resumeModel}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef ResumeModelCallback * @type {function} @@ -54920,7 +58487,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#deleteModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|deleteModel}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef DeleteModelCallback * @type {function} @@ -54953,7 +58520,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#listModels}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|listModels}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef ListModelsCallback * @type {function} @@ -54986,7 +58553,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#updateModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|updateModel}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef UpdateModelCallback * @type {function} @@ -55019,7 +58586,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ModelService#tuneModel}. + * Callback as used by {@link google.cloud.retail.v2alpha.ModelService|tuneModel}. * @memberof google.cloud.retail.v2alpha.ModelService * @typedef TuneModelCallback * @type {function} @@ -55168,15 +58735,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.model = $root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32()); - break; - case 3: - message.dryRun = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.model = $root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32()); + break; + } + case 3: { + message.dryRun = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -55288,6 +58858,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CreateModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CreateModelRequest"; + }; + return CreateModelRequest; })(); @@ -55394,12 +58979,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.model = $root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.model = $root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -55508,6 +59095,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateModelRequest"; + }; + return UpdateModelRequest; })(); @@ -55603,9 +59205,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -55695,6 +59298,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PauseModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PauseModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PauseModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PauseModelRequest"; + }; + return PauseModelRequest; })(); @@ -55790,9 +59408,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -55882,6 +59501,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResumeModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ResumeModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResumeModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ResumeModelRequest"; + }; + return ResumeModelRequest; })(); @@ -55999,15 +59633,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -56114,6 +59751,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListModelsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListModelsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListModelsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListModelsRequest"; + }; + return ListModelsRequest; })(); @@ -56209,9 +59861,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -56301,6 +59954,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.DeleteModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.DeleteModelRequest"; + }; + return DeleteModelRequest; })(); @@ -56409,14 +60077,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.models && message.models.length)) - message.models = []; - message.models.push($root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.models && message.models.length)) + message.models = []; + message.models.push($root.google.cloud.retail.v2alpha.Model.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -56532,6 +60202,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListModelsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListModelsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListModelsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListModelsResponse"; + }; + return ListModelsResponse; })(); @@ -56627,9 +60312,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -56719,6 +60405,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TuneModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.TuneModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TuneModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.TuneModelRequest"; + }; + return TuneModelRequest; })(); @@ -56814,9 +60515,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.model = reader.string(); - break; + case 1: { + message.model = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -56906,6 +60608,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateModelMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CreateModelMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateModelMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CreateModelMetadata"; + }; + return CreateModelMetadata; })(); @@ -57001,9 +60718,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.model = reader.string(); - break; + case 1: { + message.model = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -57093,6 +60811,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TuneModelMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.TuneModelMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TuneModelMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.TuneModelMetadata"; + }; + return TuneModelMetadata; })(); @@ -57253,6 +60986,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TuneModelResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.TuneModelResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TuneModelResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.TuneModelResponse"; + }; + return TuneModelResponse; })(); @@ -57289,7 +61037,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2alpha.PredictionService|predict}. * @memberof google.cloud.retail.v2alpha.PredictionService * @typedef PredictCallback * @type {function} @@ -57499,68 +61247,76 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); - break; - case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.validateOnly = reader.bool(); + break; + } + case 7: { + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.params[key] = value; + break; } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; } - message.labels[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -57746,6 +61502,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PredictRequest"; + }; + return PredictRequest; })(); @@ -57878,22 +61649,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); - break; - case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); - break; + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2alpha.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + } + case 4: { + message.validateOnly = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -58039,6 +61814,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PredictResponse"; + }; + PredictResponse.PredictionResult = (function() { /** @@ -58146,31 +61936,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.metadata[key] = value; + break; } - message.metadata[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -58288,6 +62080,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PredictResponse.PredictionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PredictResponse.PredictionResult"; + }; + return PredictionResult; })(); @@ -58327,7 +62134,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#createProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|createProduct}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef CreateProductCallback * @type {function} @@ -58360,7 +62167,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#getProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|getProduct}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef GetProductCallback * @type {function} @@ -58393,7 +62200,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#listProducts}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|listProducts}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef ListProductsCallback * @type {function} @@ -58426,7 +62233,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#updateProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|updateProduct}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef UpdateProductCallback * @type {function} @@ -58459,7 +62266,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#deleteProduct}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|deleteProduct}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef DeleteProductCallback * @type {function} @@ -58492,7 +62299,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#purgeProducts}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|purgeProducts}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef PurgeProductsCallback * @type {function} @@ -58525,7 +62332,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#importProducts}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|importProducts}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef ImportProductsCallback * @type {function} @@ -58558,7 +62365,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#setInventory}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|setInventory}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef SetInventoryCallback * @type {function} @@ -58591,7 +62398,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|addFulfillmentPlaces}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef AddFulfillmentPlacesCallback * @type {function} @@ -58624,7 +62431,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|removeFulfillmentPlaces}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef RemoveFulfillmentPlacesCallback * @type {function} @@ -58657,7 +62464,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#addLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|addLocalInventories}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef AddLocalInventoriesCallback * @type {function} @@ -58690,7 +62497,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ProductService#removeLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2alpha.ProductService|removeLocalInventories}. * @memberof google.cloud.retail.v2alpha.ProductService * @typedef RemoveLocalInventoriesCallback * @type {function} @@ -58839,15 +62646,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 3: - message.productId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.productId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -58959,6 +62769,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CreateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CreateProductRequest"; + }; + return CreateProductRequest; })(); @@ -59054,9 +62879,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -59146,6 +62972,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetProductRequest"; + }; + return GetProductRequest; })(); @@ -59263,15 +63104,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -59388,6 +63232,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateProductRequest"; + }; + return UpdateProductRequest; })(); @@ -59483,9 +63342,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -59575,6 +63435,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.DeleteProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.DeleteProductRequest"; + }; + return DeleteProductRequest; })(); @@ -59725,24 +63600,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 6: - message.requireTotalSize = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 6: { + message.requireTotalSize = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -59878,6 +63759,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListProductsRequest"; + }; + return ListProductsRequest; })(); @@ -59997,17 +63893,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - message.totalSize = reader.int32(); - break; + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -60132,6 +64031,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListProductsResponse"; + }; + return ListProductsResponse; })(); @@ -60260,18 +64174,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); - break; - case 2: - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.allowMissing = reader.bool(); - break; + case 1: { + message.inventory = $root.google.cloud.retail.v2alpha.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -60401,6 +64319,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SetInventoryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SetInventoryRequest"; + }; + return SetInventoryRequest; })(); @@ -60561,6 +64494,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SetInventoryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SetInventoryMetadata"; + }; + return SetInventoryMetadata; })(); @@ -60721,6 +64669,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.SetInventoryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.SetInventoryResponse"; + }; + return SetInventoryResponse; })(); @@ -60862,23 +64825,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -61019,6 +64987,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest"; + }; + return AddFulfillmentPlacesRequest; })(); @@ -61179,6 +65162,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata"; + }; + return AddFulfillmentPlacesMetadata; })(); @@ -61339,6 +65337,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse"; + }; + return AddFulfillmentPlacesResponse; })(); @@ -61480,23 +65493,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.localInventories && message.localInventories.length)) - message.localInventories = []; - message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); - break; - case 4: - message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2alpha.LocalInventory.decode(reader, reader.uint32())); + break; + } + case 4: { + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -61647,6 +65665,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddLocalInventoriesRequest"; + }; + return AddLocalInventoriesRequest; })(); @@ -61807,6 +65840,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddLocalInventoriesMetadata"; + }; + return AddLocalInventoriesMetadata; })(); @@ -61967,6 +66015,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddLocalInventoriesResponse"; + }; + return AddLocalInventoriesResponse; })(); @@ -62097,20 +66160,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 5: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 5: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -62243,6 +66310,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest"; + }; + return RemoveLocalInventoriesRequest; })(); @@ -62403,6 +66485,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata"; + }; + return RemoveLocalInventoriesMetadata; })(); @@ -62563,6 +66660,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse"; + }; + return RemoveLocalInventoriesResponse; })(); @@ -62704,23 +66816,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -62861,6 +66978,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest"; + }; + return RemoveFulfillmentPlacesRequest; })(); @@ -63021,6 +67153,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata"; + }; + return RemoveFulfillmentPlacesMetadata; })(); @@ -63181,6 +67328,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse"; + }; + return RemoveFulfillmentPlacesResponse; })(); @@ -63341,6 +67503,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurgeMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurgeMetadata"; + }; + return PurgeMetadata; })(); @@ -63469,18 +67646,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.successCount = reader.int64(); + break; + } + case 4: { + message.failureCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -63633,6 +67814,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeProductsMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurgeProductsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeProductsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurgeProductsMetadata"; + }; + return PurgeProductsMetadata; })(); @@ -63750,15 +67946,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; - case 3: - message.force = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -63865,6 +68064,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurgeProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurgeProductsRequest"; + }; + return PurgeProductsRequest; })(); @@ -63973,14 +68187,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgeCount = reader.int64(); - break; - case 2: - if (!(message.purgeSample && message.purgeSample.length)) - message.purgeSample = []; - message.purgeSample.push(reader.string()); - break; + case 1: { + message.purgeCount = reader.int64(); + break; + } + case 2: { + if (!(message.purgeSample && message.purgeSample.length)) + message.purgeSample = []; + message.purgeSample.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -64105,6 +68321,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurgeProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurgeProductsResponse"; + }; + return PurgeProductsResponse; })(); @@ -64222,15 +68453,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; - case 3: - message.force = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -64337,6 +68571,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurgeUserEventsRequest"; + }; + return PurgeUserEventsRequest; })(); @@ -64432,9 +68681,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; + case 1: { + message.purgedEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -64538,6 +68788,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.PurgeUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.PurgeUserEventsResponse"; + }; + return PurgeUserEventsResponse; })(); @@ -64832,82 +69097,99 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 3: - message.modelId = reader.string(); - break; - case 4: - message.priceRerankingLevel = reader.string(); - break; - case 5: - if (!(message.facetControlIds && message.facetControlIds.length)) - message.facetControlIds = []; - message.facetControlIds.push(reader.string()); - break; - case 6: - message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 7: - if (!(message.boostControlIds && message.boostControlIds.length)) - message.boostControlIds = []; - message.boostControlIds.push(reader.string()); - break; - case 9: - if (!(message.filterControlIds && message.filterControlIds.length)) - message.filterControlIds = []; - message.filterControlIds.push(reader.string()); - break; - case 10: - if (!(message.redirectControlIds && message.redirectControlIds.length)) - message.redirectControlIds = []; - message.redirectControlIds.push(reader.string()); - break; - case 18: - if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) - message.twowaySynonymsControlIds = []; - message.twowaySynonymsControlIds.push(reader.string()); - break; - case 12: - if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) - message.onewaySynonymsControlIds = []; - message.onewaySynonymsControlIds.push(reader.string()); - break; - case 13: - if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) - message.doNotAssociateControlIds = []; - message.doNotAssociateControlIds.push(reader.string()); - break; - case 14: - if (!(message.replacementControlIds && message.replacementControlIds.length)) - message.replacementControlIds = []; - message.replacementControlIds.push(reader.string()); - break; - case 15: - if (!(message.ignoreControlIds && message.ignoreControlIds.length)) - message.ignoreControlIds = []; - message.ignoreControlIds.push(reader.string()); - break; - case 8: - message.diversityLevel = reader.string(); - break; - case 16: - message.enableCategoryFilterLevel = reader.string(); - break; - case 19: - if (!(message.solutionTypes && message.solutionTypes.length)) - message.solutionTypes = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.modelId = reader.string(); + break; + } + case 4: { + message.priceRerankingLevel = reader.string(); + break; + } + case 5: { + if (!(message.facetControlIds && message.facetControlIds.length)) + message.facetControlIds = []; + message.facetControlIds.push(reader.string()); + break; + } + case 6: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.boostControlIds && message.boostControlIds.length)) + message.boostControlIds = []; + message.boostControlIds.push(reader.string()); + break; + } + case 9: { + if (!(message.filterControlIds && message.filterControlIds.length)) + message.filterControlIds = []; + message.filterControlIds.push(reader.string()); + break; + } + case 10: { + if (!(message.redirectControlIds && message.redirectControlIds.length)) + message.redirectControlIds = []; + message.redirectControlIds.push(reader.string()); + break; + } + case 18: { + if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) + message.twowaySynonymsControlIds = []; + message.twowaySynonymsControlIds.push(reader.string()); + break; + } + case 12: { + if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) + message.onewaySynonymsControlIds = []; + message.onewaySynonymsControlIds.push(reader.string()); + break; + } + case 13: { + if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) + message.doNotAssociateControlIds = []; + message.doNotAssociateControlIds.push(reader.string()); + break; + } + case 14: { + if (!(message.replacementControlIds && message.replacementControlIds.length)) + message.replacementControlIds = []; + message.replacementControlIds.push(reader.string()); + break; + } + case 15: { + if (!(message.ignoreControlIds && message.ignoreControlIds.length)) + message.ignoreControlIds = []; + message.ignoreControlIds.push(reader.string()); + break; + } + case 8: { + message.diversityLevel = reader.string(); + break; + } + case 16: { + message.enableCategoryFilterLevel = reader.string(); + break; + } + case 19: { + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else message.solutionTypes.push(reader.int32()); - } else - message.solutionTypes.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -65273,6 +69555,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServingConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ServingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ServingConfig"; + }; + return ServingConfig; })(); @@ -65309,7 +69606,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#createServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|createServingConfig}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef CreateServingConfigCallback * @type {function} @@ -65342,7 +69639,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#deleteServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|deleteServingConfig}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef DeleteServingConfigCallback * @type {function} @@ -65375,7 +69672,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#updateServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|updateServingConfig}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef UpdateServingConfigCallback * @type {function} @@ -65408,7 +69705,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#getServingConfig}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|getServingConfig}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef GetServingConfigCallback * @type {function} @@ -65441,7 +69738,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#listServingConfigs}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|listServingConfigs}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef ListServingConfigsCallback * @type {function} @@ -65474,7 +69771,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#addControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|addControl}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef AddControlCallback * @type {function} @@ -65507,7 +69804,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService#removeControl}. + * Callback as used by {@link google.cloud.retail.v2alpha.ServingConfigService|removeControl}. * @memberof google.cloud.retail.v2alpha.ServingConfigService * @typedef RemoveControlCallback * @type {function} @@ -65656,15 +69953,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32()); - break; - case 3: - message.servingConfigId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.servingConfigId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -65776,6 +70076,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CreateServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CreateServingConfigRequest"; + }; + return CreateServingConfigRequest; })(); @@ -65882,12 +70197,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.servingConfig = $root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -65996,6 +70313,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.UpdateServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.UpdateServingConfigRequest"; + }; + return UpdateServingConfigRequest; })(); @@ -66091,9 +70423,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -66183,6 +70516,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.DeleteServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.DeleteServingConfigRequest"; + }; + return DeleteServingConfigRequest; })(); @@ -66278,9 +70626,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -66370,6 +70719,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.GetServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.GetServingConfigRequest"; + }; + return GetServingConfigRequest; })(); @@ -66487,15 +70851,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -66602,6 +70969,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListServingConfigsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListServingConfigsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServingConfigsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListServingConfigsRequest"; + }; + return ListServingConfigsRequest; })(); @@ -66710,14 +71092,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.servingConfigs && message.servingConfigs.length)) - message.servingConfigs = []; - message.servingConfigs.push($root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.servingConfigs && message.servingConfigs.length)) + message.servingConfigs = []; + message.servingConfigs.push($root.google.cloud.retail.v2alpha.ServingConfig.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -66833,6 +71217,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListServingConfigsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.ListServingConfigsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServingConfigsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.ListServingConfigsResponse"; + }; + return ListServingConfigsResponse; })(); @@ -66939,12 +71338,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfig = reader.string(); - break; - case 2: - message.controlId = reader.string(); - break; + case 1: { + message.servingConfig = reader.string(); + break; + } + case 2: { + message.controlId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -67043,6 +71444,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.AddControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.AddControlRequest"; + }; + return AddControlRequest; })(); @@ -67149,12 +71565,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfig = reader.string(); - break; - case 2: - message.controlId = reader.string(); - break; + case 1: { + message.servingConfig = reader.string(); + break; + } + case 2: { + message.controlId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -67253,6 +71671,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RemoveControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RemoveControlRequest"; + }; + return RemoveControlRequest; })(); @@ -67289,7 +71722,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#writeUserEvent}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|writeUserEvent}. * @memberof google.cloud.retail.v2alpha.UserEventService * @typedef WriteUserEventCallback * @type {function} @@ -67322,7 +71755,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#collectUserEvent}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|collectUserEvent}. * @memberof google.cloud.retail.v2alpha.UserEventService * @typedef CollectUserEventCallback * @type {function} @@ -67355,7 +71788,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#purgeUserEvents}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|purgeUserEvents}. * @memberof google.cloud.retail.v2alpha.UserEventService * @typedef PurgeUserEventsCallback * @type {function} @@ -67388,7 +71821,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#importUserEvents}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|importUserEvents}. * @memberof google.cloud.retail.v2alpha.UserEventService * @typedef ImportUserEventsCallback * @type {function} @@ -67421,7 +71854,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService#rejoinUserEvents}. + * Callback as used by {@link google.cloud.retail.v2alpha.UserEventService|rejoinUserEvents}. * @memberof google.cloud.retail.v2alpha.UserEventService * @typedef RejoinUserEventsCallback * @type {function} @@ -67559,12 +71992,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2alpha.UserEvent.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -67668,6 +72103,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WriteUserEventRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.WriteUserEventRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteUserEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.WriteUserEventRequest"; + }; + return WriteUserEventRequest; })(); @@ -67796,18 +72246,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEvent = reader.string(); + break; + } + case 3: { + message.uri = reader.string(); + break; + } + case 4: { + message.ets = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -67936,6 +72390,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CollectUserEventRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.CollectUserEventRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CollectUserEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.CollectUserEventRequest"; + }; + return CollectUserEventRequest; })(); @@ -68042,12 +72511,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEventRejoinScope = reader.int32(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEventRejoinScope = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -68164,6 +72635,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RejoinUserEventsRequest"; + }; + /** * UserEventRejoinScope enum. * @name google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope @@ -68275,9 +72761,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.rejoinedUserEventsCount = reader.int64(); - break; + case 1: { + message.rejoinedUserEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -68381,6 +72868,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RejoinUserEventsResponse"; + }; + return RejoinUserEventsResponse; })(); @@ -68541,6 +73043,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2alpha.RejoinUserEventsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2alpha.RejoinUserEventsMetadata"; + }; + return RejoinUserEventsMetadata; })(); @@ -68659,12 +73176,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ingestionProductType = reader.string(); - break; - case 2: - message.merchantCenterProductIdField = reader.string(); - break; + case 1: { + message.ingestionProductType = reader.string(); + break; + } + case 2: { + message.merchantCenterProductIdField = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -68763,6 +73282,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductLevelConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ProductLevelConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductLevelConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ProductLevelConfig"; + }; + return ProductLevelConfig; })(); @@ -68924,27 +73458,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 9: - message.inUse = reader.bool(); - break; - case 10: - message.type = reader.int32(); - break; - case 5: - message.indexableOption = reader.int32(); - break; - case 6: - message.dynamicFacetableOption = reader.int32(); - break; - case 7: - message.searchableOption = reader.int32(); - break; - case 8: - message.recommendationsFilteringOption = reader.int32(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 9: { + message.inUse = reader.bool(); + break; + } + case 10: { + message.type = reader.int32(); + break; + } + case 5: { + message.indexableOption = reader.int32(); + break; + } + case 6: { + message.dynamicFacetableOption = reader.int32(); + break; + } + case 7: { + message.searchableOption = reader.int32(); + break; + } + case 8: { + message.recommendationsFilteringOption = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -69173,6 +73714,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CatalogAttribute + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CatalogAttribute + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CatalogAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CatalogAttribute"; + }; + /** * AttributeType enum. * @name google.cloud.retail.v2beta.CatalogAttribute.AttributeType @@ -69358,34 +73914,37 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (message.catalogAttributes === $util.emptyObject) - message.catalogAttributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (message.catalogAttributes === $util.emptyObject) + message.catalogAttributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.catalogAttributes[key] = value; + break; + } + case 3: { + message.attributeConfigLevel = reader.int32(); + break; } - message.catalogAttributes[key] = value; - break; - case 3: - message.attributeConfigLevel = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -69530,6 +74089,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AttributesConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AttributesConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AttributesConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AttributesConfig"; + }; + return AttributesConfig; })(); @@ -69735,39 +74309,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.matchingOrder = reader.string(); - break; - case 3: - message.maxSuggestions = reader.int32(); - break; - case 4: - message.minPrefixLength = reader.int32(); - break; - case 11: - message.autoLearning = reader.bool(); - break; - case 5: - message.suggestionsInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 6: - message.lastSuggestionsImportOperation = reader.string(); - break; - case 7: - message.denylistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 8: - message.lastDenylistImportOperation = reader.string(); - break; - case 9: - message.allowlistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 10: - message.lastAllowlistImportOperation = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.matchingOrder = reader.string(); + break; + } + case 3: { + message.maxSuggestions = reader.int32(); + break; + } + case 4: { + message.minPrefixLength = reader.int32(); + break; + } + case 11: { + message.autoLearning = reader.bool(); + break; + } + case 5: { + message.suggestionsInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.lastSuggestionsImportOperation = reader.string(); + break; + } + case 7: { + message.denylistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.lastDenylistImportOperation = reader.string(); + break; + } + case 9: { + message.allowlistInputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.lastAllowlistImportOperation = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -69953,6 +74538,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompletionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompletionConfig"; + }; + return CompletionConfig; })(); @@ -70094,23 +74694,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.merchantCenterAccountId = reader.int64(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - if (!(message.destinations && message.destinations.length)) - message.destinations = []; - message.destinations.push(reader.string()); - break; - case 4: - message.regionCode = reader.string(); - break; - case 5: - message.languageCode = reader.string(); - break; + case 1: { + message.merchantCenterAccountId = reader.int64(); + break; + } + case 2: { + message.branchId = reader.string(); + break; + } + case 3: { + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + message.destinations.push(reader.string()); + break; + } + case 4: { + message.regionCode = reader.string(); + break; + } + case 5: { + message.languageCode = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -70260,6 +74865,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MerchantCenterLink + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.MerchantCenterLink + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MerchantCenterLink.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.MerchantCenterLink"; + }; + return MerchantCenterLink; })(); @@ -70357,11 +74977,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.links && message.links.length)) - message.links = []; - message.links.push($root.google.cloud.retail.v2beta.MerchantCenterLink.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.cloud.retail.v2beta.MerchantCenterLink.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -70468,6 +75089,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MerchantCenterLinkingConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.MerchantCenterLinkingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MerchantCenterLinkingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.MerchantCenterLinkingConfig"; + }; + return MerchantCenterLinkingConfig; })(); @@ -70596,18 +75232,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 4: - message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); - break; - case 6: - message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 4: { + message.productLevelConfig = $root.google.cloud.retail.v2beta.ProductLevelConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.merchantCenterLinkingConfig = $root.google.cloud.retail.v2beta.MerchantCenterLinkingConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -70732,6 +75372,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Catalog + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Catalog + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Catalog.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Catalog"; + }; + return Catalog; })(); @@ -70906,16 +75561,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push($root.google.cloud.retail.v2beta.Condition.QueryTerm.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.activeTimeRange && message.activeTimeRange.length)) - message.activeTimeRange = []; - message.activeTimeRange.push($root.google.cloud.retail.v2beta.Condition.TimeRange.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2beta.Condition.QueryTerm.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2beta.Condition.TimeRange.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -71048,6 +75705,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Condition + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Condition + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Condition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Condition"; + }; + Condition.QueryTerm = (function() { /** @@ -71151,12 +75823,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.fullMatch = reader.bool(); - break; + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.fullMatch = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -71255,6 +75929,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryTerm + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Condition.QueryTerm + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTerm.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Condition.QueryTerm"; + }; + return QueryTerm; })(); @@ -71361,12 +76050,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -71475,6 +76166,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TimeRange + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Condition.TimeRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Condition.TimeRange"; + }; + return TimeRange; })(); @@ -71675,33 +76381,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.decode(reader, reader.uint32()); - break; - case 3: - message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.decode(reader, reader.uint32()); - break; - case 6: - message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); - break; - case 7: - message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); - break; - case 8: - message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.decode(reader, reader.uint32()); - break; - case 9: - message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.decode(reader, reader.uint32()); - break; - case 10: - message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.decode(reader, reader.uint32()); - break; - case 11: - message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); - break; - case 1: - message.condition = $root.google.cloud.retail.v2beta.Condition.decode(reader, reader.uint32()); - break; + case 2: { + message.boostAction = $root.google.cloud.retail.v2beta.Rule.BoostAction.decode(reader, reader.uint32()); + break; + } + case 3: { + message.redirectAction = $root.google.cloud.retail.v2beta.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + } + case 6: { + message.onewaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + } + case 7: { + message.doNotAssociateAction = $root.google.cloud.retail.v2beta.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + } + case 8: { + message.replacementAction = $root.google.cloud.retail.v2beta.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + } + case 9: { + message.ignoreAction = $root.google.cloud.retail.v2beta.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + } + case 10: { + message.filterAction = $root.google.cloud.retail.v2beta.Rule.FilterAction.decode(reader, reader.uint32()); + break; + } + case 11: { + message.twowaySynonymsAction = $root.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + } + case 1: { + message.condition = $root.google.cloud.retail.v2beta.Condition.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -71955,6 +76670,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Rule + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Rule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule"; + }; + Rule.BoostAction = (function() { /** @@ -72058,12 +76788,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.boost = reader.float(); - break; - case 2: - message.productsFilter = reader.string(); - break; + case 1: { + message.boost = reader.float(); + break; + } + case 2: { + message.productsFilter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -72162,6 +76894,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoostAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.BoostAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.BoostAction"; + }; + return BoostAction; })(); @@ -72257,9 +77004,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.filter = reader.string(); - break; + case 1: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -72349,6 +77097,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FilterAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.FilterAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FilterAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.FilterAction"; + }; + return FilterAction; })(); @@ -72444,9 +77207,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.redirectUri = reader.string(); - break; + case 1: { + message.redirectUri = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -72536,6 +77300,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RedirectAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.RedirectAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RedirectAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.RedirectAction"; + }; + return RedirectAction; })(); @@ -72633,11 +77412,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; + case 1: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -72739,6 +77519,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TwowaySynonymsAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.TwowaySynonymsAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TwowaySynonymsAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.TwowaySynonymsAction"; + }; + return TwowaySynonymsAction; })(); @@ -72862,21 +77657,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 4: - if (!(message.synonyms && message.synonyms.length)) - message.synonyms = []; - message.synonyms.push(reader.string()); - break; - case 2: - if (!(message.onewayTerms && message.onewayTerms.length)) - message.onewayTerms = []; - message.onewayTerms.push(reader.string()); - break; + case 3: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 4: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + case 2: { + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -73019,6 +77817,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OnewaySynonymsAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.OnewaySynonymsAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OnewaySynonymsAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.OnewaySynonymsAction"; + }; + return OnewaySynonymsAction; })(); @@ -73142,21 +77955,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) - message.doNotAssociateTerms = []; - message.doNotAssociateTerms.push(reader.string()); - break; - case 1: - if (!(message.terms && message.terms.length)) - message.terms = []; - message.terms.push(reader.string()); - break; + case 2: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 3: { + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + } + case 1: { + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -73299,6 +78115,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DoNotAssociateAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.DoNotAssociateAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoNotAssociateAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.DoNotAssociateAction"; + }; + return DoNotAssociateAction; })(); @@ -73418,17 +78249,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.queryTerms && message.queryTerms.length)) - message.queryTerms = []; - message.queryTerms.push(reader.string()); - break; - case 3: - message.replacementTerm = reader.string(); - break; - case 1: - message.term = reader.string(); - break; + case 2: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 3: { + message.replacementTerm = reader.string(); + break; + } + case 1: { + message.term = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -73548,6 +78382,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReplacementAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.ReplacementAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplacementAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.ReplacementAction"; + }; + return ReplacementAction; })(); @@ -73645,11 +78494,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.ignoreTerms && message.ignoreTerms.length)) - message.ignoreTerms = []; - message.ignoreTerms.push(reader.string()); - break; + case 1: { + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -73751,6 +78601,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for IgnoreAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rule.IgnoreAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IgnoreAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rule.IgnoreAction"; + }; + return IgnoreAction; })(); @@ -73864,16 +78729,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); - break; - case 2: - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); - break; + case 1: { + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); + break; + } + case 2: { + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -73996,6 +78863,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Audience + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Audience + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Audience.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Audience"; + }; + return Audience; })(); @@ -74106,16 +78988,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - case 2: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); - break; + case 1: { + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); + break; + } + case 2: { + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -74238,6 +79122,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ColorInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ColorInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ColorInfo"; + }; + return ColorInfo; })(); @@ -74398,27 +79297,31 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - case 2: - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + case 2: { + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - case 3: - message.searchable = reader.bool(); - break; - case 4: - message.indexable = reader.bool(); - break; + break; + } + case 3: { + message.searchable = reader.bool(); + break; + } + case 4: { + message.indexable = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -74566,6 +79469,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CustomAttribute + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CustomAttribute + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CustomAttribute"; + }; + return CustomAttribute; })(); @@ -74674,14 +79592,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -74792,6 +79712,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FulfillmentInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.FulfillmentInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FulfillmentInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.FulfillmentInfo"; + }; + return FulfillmentInfo; })(); @@ -74909,15 +79844,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; - case 2: - message.height = reader.int32(); - break; - case 3: - message.width = reader.int32(); - break; + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.height = reader.int32(); + break; + } + case 3: { + message.width = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -75024,6 +79962,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Image + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Image + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Image"; + }; + return Image; })(); @@ -75177,18 +80130,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.minimum = reader.double(); - break; - case 2: - message.exclusiveMinimum = reader.double(); - break; - case 3: - message.maximum = reader.double(); - break; - case 4: - message.exclusiveMaximum = reader.double(); - break; + case 1: { + message.minimum = reader.double(); + break; + } + case 2: { + message.exclusiveMinimum = reader.double(); + break; + } + case 3: { + message.maximum = reader.double(); + break; + } + case 4: { + message.exclusiveMaximum = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -75322,6 +80279,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Interval + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Interval + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Interval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Interval"; + }; + return Interval; })(); @@ -75483,27 +80455,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.currencyCode = reader.string(); - break; - case 2: - message.price = reader.float(); - break; - case 3: - message.originalPrice = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.decode(reader, reader.uint32()); - break; + case 1: { + message.currencyCode = reader.string(); + break; + } + case 2: { + message.price = reader.float(); + break; + } + case 3: { + message.originalPrice = reader.float(); + break; + } + case 4: { + message.cost = reader.float(); + break; + } + case 5: { + message.priceEffectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.priceExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.priceRange = $root.google.cloud.retail.v2beta.PriceInfo.PriceRange.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -75657,6 +80636,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PriceInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PriceInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PriceInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PriceInfo"; + }; + PriceInfo.PriceRange = (function() { /** @@ -75760,12 +80754,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.price = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); - break; - case 2: - message.originalPrice = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); - break; + case 1: { + message.price = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + } + case 2: { + message.originalPrice = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -75874,6 +80870,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PriceRange + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PriceInfo.PriceRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PriceRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PriceInfo.PriceRange"; + }; + return PriceRange; })(); @@ -75999,22 +81010,25 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ratingCount = reader.int32(); - break; - case 2: - message.averageRating = reader.float(); - break; - case 3: - if (!(message.ratingHistogram && message.ratingHistogram.length)) - message.ratingHistogram = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.ratingCount = reader.int32(); + break; + } + case 2: { + message.averageRating = reader.float(); + break; + } + case 3: { + if (!(message.ratingHistogram && message.ratingHistogram.length)) + message.ratingHistogram = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ratingHistogram.push(reader.int32()); + } else message.ratingHistogram.push(reader.int32()); - } else - message.ratingHistogram.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -76134,6 +81148,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Rating + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Rating + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Rating.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Rating"; + }; + return Rating; })(); @@ -76262,18 +81291,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userId = reader.string(); - break; - case 2: - message.ipAddress = reader.string(); - break; - case 3: - message.userAgent = reader.string(); - break; - case 4: - message.directUserRequest = reader.bool(); - break; + case 1: { + message.userId = reader.string(); + break; + } + case 2: { + message.ipAddress = reader.string(); + break; + } + case 3: { + message.userAgent = reader.string(); + break; + } + case 4: { + message.directUserRequest = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -76388,6 +81421,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UserInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UserInfo"; + }; + return UserInfo; })(); @@ -76522,39 +81570,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placeId = reader.string(); - break; - case 2: - message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); - break; - case 3: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placeId = reader.string(); + break; + } + case 2: { + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); + break; + } + case 3: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 4: { + if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) + message.fulfillmentTypes = []; + message.fulfillmentTypes.push(reader.string()); + break; } - message.attributes[key] = value; - break; - case 4: - if (!(message.fulfillmentTypes && message.fulfillmentTypes.length)) - message.fulfillmentTypes = []; - message.fulfillmentTypes.push(reader.string()); - break; default: reader.skipType(tag & 7); break; @@ -76707,6 +81759,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for LocalInventory + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.LocalInventory + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocalInventory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.LocalInventory"; + }; + return LocalInventory; })(); @@ -76815,14 +81882,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); - break; - case 2: - message.dataSchema = reader.string(); - break; + case 1: { + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + } + case 2: { + message.dataSchema = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -76933,6 +82002,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GcsSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GcsSource"; + }; + return GcsSource; })(); @@ -77097,24 +82181,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - case 5: - message.projectId = reader.string(); - break; - case 1: - message.datasetId = reader.string(); - break; - case 2: - message.tableId = reader.string(); - break; - case 3: - message.gcsStagingDir = reader.string(); - break; - case 4: - message.dataSchema = reader.string(); - break; + case 6: { + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + } + case 5: { + message.projectId = reader.string(); + break; + } + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableId = reader.string(); + break; + } + case 3: { + message.gcsStagingDir = reader.string(); + break; + } + case 4: { + message.dataSchema = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -77256,6 +82346,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BigQuerySource + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.BigQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.BigQuerySource"; + }; + return BigQuerySource; })(); @@ -77353,11 +82458,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -77464,6 +82570,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductInlineSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ProductInlineSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ProductInlineSource"; + }; + return ProductInlineSource; })(); @@ -77561,11 +82682,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -77672,6 +82794,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventInlineSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UserEventInlineSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UserEventInlineSource"; + }; + return UserEventInlineSource; })(); @@ -77781,9 +82918,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; + case 1: { + message.gcsPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -77877,6 +83015,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportErrorsConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportErrorsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportErrorsConfig"; + }; + return ImportErrorsConfig; })(); @@ -78038,27 +83191,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 6: - message.requestId = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 4: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.reconciliationMode = reader.int32(); - break; - case 7: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 6: { + message.requestId = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2beta.ProductInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.reconciliationMode = reader.int32(); + break; + } + case 7: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -78230,6 +83390,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportProductsRequest"; + }; + /** * ReconciliationMode enum. * @name google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode @@ -78363,15 +83538,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2beta.UserEventInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -78488,6 +83666,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportUserEventsRequest"; + }; + return ImportUserEventsRequest; })(); @@ -78605,15 +83798,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); - break; - case 3: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2beta.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -78725,6 +83921,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportCompletionDataRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportCompletionDataRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCompletionDataRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportCompletionDataRequest"; + }; + return ImportCompletionDataRequest; })(); @@ -78856,15 +84067,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.productInlineSource = $root.google.cloud.retail.v2beta.ProductInlineSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -79004,6 +84218,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ProductInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ProductInputConfig"; + }; + return ProductInputConfig; })(); @@ -79135,15 +84364,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); - break; - case 2: - message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.userEventInlineSource = $root.google.cloud.retail.v2beta.UserEventInlineSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.retail.v2beta.GcsSource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -79283,6 +84515,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UserEventInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UserEventInputConfig"; + }; + return UserEventInputConfig; })(); @@ -79392,9 +84639,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); - break; + case 1: { + message.bigQuerySource = $root.google.cloud.retail.v2beta.BigQuerySource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -79494,6 +84742,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionDataInputConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompletionDataInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionDataInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompletionDataInputConfig"; + }; + return CompletionDataInputConfig; })(); @@ -79644,24 +84907,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.successCount = reader.int64(); - break; - case 4: - message.failureCount = reader.int64(); - break; - case 5: - message.requestId = reader.string(); - break; - case 6: - message.notificationPubsubTopic = reader.string(); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.successCount = reader.int64(); + break; + } + case 4: { + message.failureCount = reader.int64(); + break; + } + case 5: { + message.requestId = reader.string(); + break; + } + case 6: { + message.notificationPubsubTopic = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -79830,6 +85099,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportMetadata"; + }; + return ImportMetadata; })(); @@ -79938,14 +85222,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -80066,6 +85352,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportProductsResponse"; + }; + return ImportProductsResponse; })(); @@ -80185,17 +85486,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2beta.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.importSummary = $root.google.cloud.retail.v2beta.UserEventImportSummary.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -80330,6 +85634,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportUserEventsResponse"; + }; + return ImportUserEventsResponse; })(); @@ -80436,12 +85755,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.joinedEventsCount = reader.int64(); - break; - case 2: - message.unjoinedEventsCount = reader.int64(); - break; + case 1: { + message.joinedEventsCount = reader.int64(); + break; + } + case 2: { + message.unjoinedEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -80568,6 +85889,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEventImportSummary + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UserEventImportSummary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEventImportSummary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UserEventImportSummary"; + }; + return UserEventImportSummary; })(); @@ -80665,11 +86001,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -80776,6 +86113,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ImportCompletionDataResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ImportCompletionDataResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCompletionDataResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ImportCompletionDataResponse"; + }; + return ImportCompletionDataResponse; })(); @@ -81265,148 +86617,181 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 16: - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 17: - message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.id = reader.string(); - break; - case 3: - message.type = reader.int32(); - break; - case 4: - message.primaryProductId = reader.string(); - break; - case 5: - if (!(message.collectionMemberIds && message.collectionMemberIds.length)) - message.collectionMemberIds = []; - message.collectionMemberIds.push(reader.string()); - break; - case 6: - message.gtin = reader.string(); - break; - case 7: - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push(reader.string()); - break; - case 8: - message.title = reader.string(); - break; - case 9: - if (!(message.brands && message.brands.length)) - message.brands = []; - message.brands.push(reader.string()); - break; - case 10: - message.description = reader.string(); - break; - case 11: - message.languageCode = reader.string(); - break; - case 12: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 16: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 17: { + message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.id = reader.string(); + break; + } + case 3: { + message.type = reader.int32(); + break; + } + case 4: { + message.primaryProductId = reader.string(); + break; + } + case 5: { + if (!(message.collectionMemberIds && message.collectionMemberIds.length)) + message.collectionMemberIds = []; + message.collectionMemberIds.push(reader.string()); + break; + } + case 6: { + message.gtin = reader.string(); + break; + } + case 7: { + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push(reader.string()); + break; + } + case 8: { + message.title = reader.string(); + break; + } + case 9: { + if (!(message.brands && message.brands.length)) + message.brands = []; + message.brands.push(reader.string()); + break; + } + case 10: { + message.description = reader.string(); + break; + } + case 11: { + message.languageCode = reader.string(); + break; + } + case 12: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 13: { + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + } + case 14: { + message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); + break; + } + case 15: { + message.rating = $root.google.cloud.retail.v2beta.Rating.decode(reader, reader.uint32()); + break; + } + case 18: { + message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 19: { + message.availability = reader.int32(); + break; + } + case 20: { + message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 21: { + if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) + message.fulfillmentInfo = []; + message.fulfillmentInfo.push($root.google.cloud.retail.v2beta.FulfillmentInfo.decode(reader, reader.uint32())); + break; + } + case 22: { + message.uri = reader.string(); + break; + } + case 23: { + if (!(message.images && message.images.length)) + message.images = []; + message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); + break; + } + case 24: { + message.audience = $root.google.cloud.retail.v2beta.Audience.decode(reader, reader.uint32()); + break; + } + case 25: { + message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.decode(reader, reader.uint32()); + break; + } + case 26: { + if (!(message.sizes && message.sizes.length)) + message.sizes = []; + message.sizes.push(reader.string()); + break; + } + case 27: { + if (!(message.materials && message.materials.length)) + message.materials = []; + message.materials.push(reader.string()); + break; + } + case 28: { + if (!(message.patterns && message.patterns.length)) + message.patterns = []; + message.patterns.push(reader.string()); + break; + } + case 29: { + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push(reader.string()); + break; + } + case 34: { + if (!(message.promotions && message.promotions.length)) + message.promotions = []; + message.promotions.push($root.google.cloud.retail.v2beta.Promotion.decode(reader, reader.uint32())); + break; + } + case 33: { + message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 30: { + message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 31: { + if (!(message.variants && message.variants.length)) + message.variants = []; + message.variants.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; } - message.attributes[key] = value; - break; - case 13: - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - case 14: - message.priceInfo = $root.google.cloud.retail.v2beta.PriceInfo.decode(reader, reader.uint32()); - break; - case 15: - message.rating = $root.google.cloud.retail.v2beta.Rating.decode(reader, reader.uint32()); - break; - case 18: - message.availableTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 19: - message.availability = reader.int32(); - break; - case 20: - message.availableQuantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - case 21: - if (!(message.fulfillmentInfo && message.fulfillmentInfo.length)) - message.fulfillmentInfo = []; - message.fulfillmentInfo.push($root.google.cloud.retail.v2beta.FulfillmentInfo.decode(reader, reader.uint32())); - break; - case 22: - message.uri = reader.string(); - break; - case 23: - if (!(message.images && message.images.length)) - message.images = []; - message.images.push($root.google.cloud.retail.v2beta.Image.decode(reader, reader.uint32())); - break; - case 24: - message.audience = $root.google.cloud.retail.v2beta.Audience.decode(reader, reader.uint32()); - break; - case 25: - message.colorInfo = $root.google.cloud.retail.v2beta.ColorInfo.decode(reader, reader.uint32()); - break; - case 26: - if (!(message.sizes && message.sizes.length)) - message.sizes = []; - message.sizes.push(reader.string()); - break; - case 27: - if (!(message.materials && message.materials.length)) - message.materials = []; - message.materials.push(reader.string()); - break; - case 28: - if (!(message.patterns && message.patterns.length)) - message.patterns = []; - message.patterns.push(reader.string()); - break; - case 29: - if (!(message.conditions && message.conditions.length)) - message.conditions = []; - message.conditions.push(reader.string()); - break; - case 34: - if (!(message.promotions && message.promotions.length)) - message.promotions = []; - message.promotions.push($root.google.cloud.retail.v2beta.Promotion.decode(reader, reader.uint32())); - break; - case 33: - message.publishTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 30: - message.retrievableFields = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 31: - if (!(message.variants && message.variants.length)) - message.variants = []; - message.variants.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -82053,6 +87438,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Product + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Product + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Product.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Product"; + }; + /** * Type enum. * @name google.cloud.retail.v2beta.Product.Type @@ -82186,9 +87586,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.promotionId = reader.string(); - break; + case 1: { + message.promotionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -82278,6 +87679,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Promotion + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Promotion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Promotion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Promotion"; + }; + return Promotion; })(); @@ -82592,91 +88008,111 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.eventType = reader.string(); - break; - case 2: - message.visitorId = reader.string(); - break; - case 21: - message.sessionId = reader.string(); - break; - case 3: - message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.experimentIds && message.experimentIds.length)) - message.experimentIds = []; - message.experimentIds.push(reader.string()); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - if (!(message.productDetails && message.productDetails.length)) - message.productDetails = []; - message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); - break; - case 22: - message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.decode(reader, reader.uint32()); - break; - case 7: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.eventType = reader.string(); + break; + } + case 2: { + message.visitorId = reader.string(); + break; + } + case 21: { + message.sessionId = reader.string(); + break; + } + case 3: { + message.eventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.experimentIds && message.experimentIds.length)) + message.experimentIds = []; + message.experimentIds.push(reader.string()); + break; + } + case 5: { + message.attributionToken = reader.string(); + break; + } + case 6: { + if (!(message.productDetails && message.productDetails.length)) + message.productDetails = []; + message.productDetails.push($root.google.cloud.retail.v2beta.ProductDetail.decode(reader, reader.uint32())); + break; + } + case 22: { + message.completionDetail = $root.google.cloud.retail.v2beta.CompletionDetail.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; + } + case 8: { + message.cartId = reader.string(); + break; + } + case 9: { + message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); + break; + } + case 10: { + message.searchQuery = reader.string(); + break; + } + case 16: { + message.filter = reader.string(); + break; + } + case 17: { + message.orderBy = reader.string(); + break; + } + case 18: { + message.offset = reader.int32(); + break; + } + case 11: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 12: { + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + } + case 13: { + message.uri = reader.string(); + break; + } + case 14: { + message.referrerUri = reader.string(); + break; + } + case 15: { + message.pageViewId = reader.string(); + break; } - message.attributes[key] = value; - break; - case 8: - message.cartId = reader.string(); - break; - case 9: - message.purchaseTransaction = $root.google.cloud.retail.v2beta.PurchaseTransaction.decode(reader, reader.uint32()); - break; - case 10: - message.searchQuery = reader.string(); - break; - case 16: - message.filter = reader.string(); - break; - case 17: - message.orderBy = reader.string(); - break; - case 18: - message.offset = reader.int32(); - break; - case 11: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 12: - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); - break; - case 13: - message.uri = reader.string(); - break; - case 14: - message.referrerUri = reader.string(); - break; - case 15: - message.pageViewId = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -83002,6 +88438,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UserEvent + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UserEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UserEvent"; + }; + return UserEvent; })(); @@ -83108,12 +88559,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 2: - message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; + case 1: { + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.quantity = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -83222,6 +88675,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProductDetail + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ProductDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProductDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ProductDetail"; + }; + return ProductDetail; })(); @@ -83339,15 +88807,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.completionAttributionToken = reader.string(); - break; - case 2: - message.selectedSuggestion = reader.string(); - break; - case 3: - message.selectedPosition = reader.int32(); - break; + case 1: { + message.completionAttributionToken = reader.string(); + break; + } + case 2: { + message.selectedSuggestion = reader.string(); + break; + } + case 3: { + message.selectedPosition = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -83454,6 +88925,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionDetail + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompletionDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompletionDetail"; + }; + return CompletionDetail; })(); @@ -83593,21 +89079,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.revenue = reader.float(); - break; - case 3: - message.tax = reader.float(); - break; - case 4: - message.cost = reader.float(); - break; - case 5: - message.currencyCode = reader.string(); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.revenue = reader.float(); + break; + } + case 3: { + message.tax = reader.float(); + break; + } + case 4: { + message.cost = reader.float(); + break; + } + case 5: { + message.currencyCode = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -83730,6 +89221,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurchaseTransaction + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PurchaseTransaction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurchaseTransaction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PurchaseTransaction"; + }; + return PurchaseTransaction; })(); @@ -83766,7 +89272,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#listCatalogs}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|listCatalogs}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef ListCatalogsCallback * @type {function} @@ -83799,7 +89305,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCatalog}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|updateCatalog}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef UpdateCatalogCallback * @type {function} @@ -83832,7 +89338,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#setDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|setDefaultBranch}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef SetDefaultBranchCallback * @type {function} @@ -83865,7 +89371,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getDefaultBranch}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|getDefaultBranch}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef GetDefaultBranchCallback * @type {function} @@ -83898,7 +89404,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|getCompletionConfig}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef GetCompletionConfigCallback * @type {function} @@ -83931,7 +89437,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateCompletionConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|updateCompletionConfig}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef UpdateCompletionConfigCallback * @type {function} @@ -83964,7 +89470,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#getAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|getAttributesConfig}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef GetAttributesConfigCallback * @type {function} @@ -83997,7 +89503,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#updateAttributesConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|updateAttributesConfig}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef UpdateAttributesConfigCallback * @type {function} @@ -84030,7 +89536,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#addCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|addCatalogAttribute}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef AddCatalogAttributeCallback * @type {function} @@ -84063,7 +89569,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#removeCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|removeCatalogAttribute}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef RemoveCatalogAttributeCallback * @type {function} @@ -84096,7 +89602,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CatalogService#replaceCatalogAttribute}. + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|replaceCatalogAttribute}. * @memberof google.cloud.retail.v2beta.CatalogService * @typedef ReplaceCatalogAttributeCallback * @type {function} @@ -84245,15 +89751,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -84360,6 +89869,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListCatalogsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListCatalogsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCatalogsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListCatalogsRequest"; + }; + return ListCatalogsRequest; })(); @@ -84468,14 +89992,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -84591,6 +90117,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListCatalogsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListCatalogsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCatalogsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListCatalogsResponse"; + }; + return ListCatalogsResponse; })(); @@ -84697,12 +90238,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.catalog = $root.google.cloud.retail.v2beta.Catalog.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -84811,6 +90354,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateCatalogRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateCatalogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCatalogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateCatalogRequest"; + }; + return UpdateCatalogRequest; })(); @@ -84939,18 +90497,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.branchId = reader.string(); - break; - case 3: - message.note = reader.string(); - break; - case 4: - message.force = reader.bool(); - break; + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.branchId = reader.string(); + break; + } + case 3: { + message.note = reader.string(); + break; + } + case 4: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -85065,6 +90627,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetDefaultBranchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SetDefaultBranchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SetDefaultBranchRequest"; + }; + return SetDefaultBranchRequest; })(); @@ -85160,9 +90737,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; + case 1: { + message.catalog = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -85252,6 +90830,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetDefaultBranchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetDefaultBranchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetDefaultBranchRequest"; + }; + return GetDefaultBranchRequest; })(); @@ -85369,15 +90962,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.branch = reader.string(); - break; - case 2: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.note = reader.string(); - break; + case 1: { + message.branch = reader.string(); + break; + } + case 2: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.note = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -85489,6 +91085,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetDefaultBranchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetDefaultBranchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDefaultBranchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetDefaultBranchResponse"; + }; + return GetDefaultBranchResponse; })(); @@ -85584,9 +91195,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -85676,6 +91288,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetCompletionConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetCompletionConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetCompletionConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetCompletionConfigRequest"; + }; + return GetCompletionConfigRequest; })(); @@ -85782,12 +91409,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.completionConfig = $root.google.cloud.retail.v2beta.CompletionConfig.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.completionConfig = $root.google.cloud.retail.v2beta.CompletionConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -85896,6 +91525,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateCompletionConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateCompletionConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCompletionConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateCompletionConfigRequest"; + }; + return UpdateCompletionConfigRequest; })(); @@ -85991,9 +91635,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -86083,6 +91728,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetAttributesConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetAttributesConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAttributesConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetAttributesConfigRequest"; + }; + return GetAttributesConfigRequest; })(); @@ -86189,12 +91849,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = $root.google.cloud.retail.v2beta.AttributesConfig.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.attributesConfig = $root.google.cloud.retail.v2beta.AttributesConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -86303,6 +91965,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateAttributesConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateAttributesConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateAttributesConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateAttributesConfigRequest"; + }; + return UpdateAttributesConfigRequest; })(); @@ -86409,12 +92086,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = reader.string(); - break; - case 2: - message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); - break; + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -86518,6 +92197,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddCatalogAttributeRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddCatalogAttributeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddCatalogAttributeRequest"; + }; + return AddCatalogAttributeRequest; })(); @@ -86624,12 +92318,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = reader.string(); - break; - case 2: - message.key = reader.string(); - break; + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.key = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -86728,6 +92424,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveCatalogAttributeRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveCatalogAttributeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveCatalogAttributeRequest"; + }; + return RemoveCatalogAttributeRequest; })(); @@ -86845,15 +92556,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attributesConfig = reader.string(); - break; - case 2: - message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); - break; - case 3: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.catalogAttribute = $root.google.cloud.retail.v2beta.CatalogAttribute.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -86970,6 +92684,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReplaceCatalogAttributeRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplaceCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest"; + }; + return ReplaceCatalogAttributeRequest; })(); @@ -87006,7 +92735,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#completeQuery}. + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService|completeQuery}. * @memberof google.cloud.retail.v2beta.CompletionService * @typedef CompleteQueryCallback * @type {function} @@ -87039,7 +92768,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.CompletionService#importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2beta.CompletionService|importCompletionData}. * @memberof google.cloud.retail.v2beta.CompletionService * @typedef ImportCompletionDataCallback * @type {function} @@ -87234,29 +92963,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.catalog = reader.string(); - break; - case 2: - message.query = reader.string(); - break; - case 7: - message.visitorId = reader.string(); - break; - case 3: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - case 4: - message.deviceType = reader.string(); - break; - case 6: - message.dataset = reader.string(); - break; - case 5: - message.maxSuggestions = reader.int32(); - break; + case 1: { + message.catalog = reader.string(); + break; + } + case 2: { + message.query = reader.string(); + break; + } + case 7: { + message.visitorId = reader.string(); + break; + } + case 3: { + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + } + case 4: { + message.deviceType = reader.string(); + break; + } + case 6: { + message.dataset = reader.string(); + break; + } + case 5: { + message.maxSuggestions = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -87408,6 +93144,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompleteQueryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompleteQueryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompleteQueryRequest"; + }; + return CompleteQueryRequest; })(); @@ -87529,19 +93280,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); - break; - case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -87683,6 +93437,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompleteQueryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompleteQueryResponse"; + }; + CompleteQueryResponse.CompletionResult = (function() { /** @@ -87790,31 +93559,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.suggestion = reader.string(); - break; - case 2: - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.suggestion = reader.string(); + break; + } + case 2: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2beta.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.attributes[key] = value; + break; } - message.attributes[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -87932,6 +93703,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CompletionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompleteQueryResponse.CompletionResult"; + }; + return CompletionResult; })(); @@ -88027,9 +93813,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.recentSearch = reader.string(); - break; + case 1: { + message.recentSearch = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -88119,6 +93906,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RecentSearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RecentSearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CompleteQueryResponse.RecentSearchResult"; + }; + return RecentSearchResult; })(); @@ -88293,33 +94095,39 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - message.facetSpec = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32()); - break; - case 4: - message.rule = $root.google.cloud.retail.v2beta.Rule.decode(reader, reader.uint32()); - break; - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 5: - if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) - message.associatedServingConfigIds = []; - message.associatedServingConfigIds.push(reader.string()); - break; - case 6: - if (!(message.solutionTypes && message.solutionTypes.length)) - message.solutionTypes = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 3: { + message.facetSpec = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32()); + break; + } + case 4: { + message.rule = $root.google.cloud.retail.v2beta.Rule.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 5: { + if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) + message.associatedServingConfigIds = []; + message.associatedServingConfigIds.push(reader.string()); + break; + } + case 6: { + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else message.solutionTypes.push(reader.int32()); - } else - message.solutionTypes.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -88519,6 +94327,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Control + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Control + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Control.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Control"; + }; + return Control; })(); @@ -88555,7 +94378,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.SearchService#search}. + * Callback as used by {@link google.cloud.retail.v2beta.SearchService|search}. * @memberof google.cloud.retail.v2beta.SearchService * @typedef SearchCallback * @type {function} @@ -88924,94 +94747,115 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.branch = reader.string(); - break; - case 3: - message.query = reader.string(); - break; - case 4: - message.visitorId = reader.string(); - break; - case 5: - message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); - break; - case 7: - message.pageSize = reader.int32(); - break; - case 8: - message.pageToken = reader.string(); - break; - case 9: - message.offset = reader.int32(); - break; - case 10: - message.filter = reader.string(); - break; - case 28: - message.canonicalFilter = reader.string(); - break; - case 11: - message.orderBy = reader.string(); - break; - case 12: - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - case 21: - message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 13: - message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.decode(reader, reader.uint32()); - break; - case 14: - message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - case 17: - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - case 23: - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - case 31: - message.searchMode = reader.int32(); - break; - case 32: - message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); - break; - case 34: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.branch = reader.string(); + break; + } + case 3: { + message.query = reader.string(); + break; + } + case 4: { + message.visitorId = reader.string(); + break; + } + case 5: { + message.userInfo = $root.google.cloud.retail.v2beta.UserInfo.decode(reader, reader.uint32()); + break; + } + case 7: { + message.pageSize = reader.int32(); + break; + } + case 8: { + message.pageToken = reader.string(); + break; + } + case 9: { + message.offset = reader.int32(); + break; + } + case 10: { + message.filter = reader.string(); + break; + } + case 28: { + message.canonicalFilter = reader.string(); + break; + } + case 11: { + message.orderBy = reader.string(); + break; + } + case 12: { + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + } + case 21: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 13: { + message.boostSpec = $root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + } + case 14: { + message.queryExpansionSpec = $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + } + case 17: { + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + } + case 23: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 31: { + message.searchMode = reader.int32(); + break; + } + case 32: { + message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + } + case 34: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + } + case 35: { + message.spellCorrectionSpec = $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; } - message.labels[key] = value; - break; - case 35: - message.spellCorrectionSpec = $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -89374,6 +95218,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest"; + }; + SearchRequest.FacetSpec = (function() { /** @@ -89501,20 +95360,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); - break; - case 2: - message.limit = reader.int32(); - break; - case 3: - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - case 4: - message.enableDynamicPosition = reader.bool(); - break; + case 1: { + message.facetKey = $root.google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + } + case 2: { + message.limit = reader.int32(); + break; + } + case 3: { + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + } + case 4: { + message.enableDynamicPosition = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -89647,6 +95510,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.FacetSpec"; + }; + FacetSpec.FacetKey = (function() { /** @@ -89835,41 +95713,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - case 8: - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - case 9: - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - case 10: - message.caseInsensitive = reader.bool(); - break; - case 4: - message.orderBy = reader.string(); - break; - case 5: - message.query = reader.string(); - break; - case 11: - message.returnMinMax = reader.bool(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + } + case 8: { + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + } + case 9: { + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + } + case 10: { + message.caseInsensitive = reader.bool(); + break; + } + case 4: { + message.orderBy = reader.string(); + break; + } + case 5: { + message.query = reader.string(); + break; + } + case 11: { + message.returnMinMax = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -90079,6 +95966,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetKey + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey"; + }; + return FacetKey; })(); @@ -90177,9 +96079,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -90287,6 +96190,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DynamicFacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DynamicFacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode @@ -90425,14 +96343,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - case 2: - message.skipBoostSpecValidation = reader.bool(); - break; + case 1: { + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } + case 2: { + message.skipBoostSpecValidation = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -90552,6 +96472,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.BoostSpec"; + }; + BoostSpec.ConditionBoostSpec = (function() { /** @@ -90655,12 +96590,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.condition = reader.string(); - break; - case 2: - message.boost = reader.float(); - break; + case 1: { + message.condition = reader.string(); + break; + } + case 2: { + message.boost = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -90759,6 +96696,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ConditionBoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConditionBoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec"; + }; + return ConditionBoostSpec; })(); @@ -90868,12 +96820,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.condition = reader.int32(); - break; - case 2: - message.pinUnexpandedResults = reader.bool(); - break; + case 1: { + message.condition = reader.int32(); + break; + } + case 2: { + message.pinUnexpandedResults = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -90990,6 +96944,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryExpansionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec"; + }; + /** * Condition enum. * @name google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition @@ -91101,9 +97070,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -91211,6 +97181,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PersonalizationSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersonalizationSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode @@ -91322,9 +97307,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; + case 1: { + message.mode = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -91432,6 +97418,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SpellCorrectionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpellCorrectionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec"; + }; + /** * Mode enum. * @name google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode @@ -91669,44 +97670,54 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2beta.SearchResponse.SearchResult.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.decode(reader, reader.uint32())); - break; - case 3: - message.totalSize = reader.int32(); - break; - case 4: - message.correctedQuery = reader.string(); - break; - case 5: - message.attributionToken = reader.string(); - break; - case 6: - message.nextPageToken = reader.string(); - break; - case 7: - message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - case 10: - message.redirectUri = reader.string(); - break; - case 12: - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); - break; - case 14: - if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) - message.invalidConditionBoostSpecs = []; - message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.SearchResponse.SearchResult.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.decode(reader, reader.uint32())); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + case 4: { + message.correctedQuery = reader.string(); + break; + } + case 5: { + message.attributionToken = reader.string(); + break; + } + case 6: { + message.nextPageToken = reader.string(); + break; + } + case 7: { + message.queryExpansionInfo = $root.google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); + break; + } + case 10: { + message.redirectUri = reader.string(); + break; + } + case 12: { + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); + break; + } + case 14: { + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2beta.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -91939,6 +97950,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchResponse"; + }; + SearchResponse.SearchResult = (function() { /** @@ -92083,59 +98109,64 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 3: - message.matchingVariantCount = reader.int32(); - break; - case 4: - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.matchingVariantCount = reader.int32(); + break; + } + case 4: { + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.matchingVariantFields[key] = value; + break; } - message.matchingVariantFields[key] = value; - break; - case 5: - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 5: { + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.variantRollupValues[key] = value; + break; } - message.variantRollupValues[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -92302,6 +98333,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchResponse.SearchResult"; + }; + return SearchResult; })(); @@ -92421,17 +98467,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - case 3: - message.dynamicFacet = reader.bool(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); + break; + } + case 3: { + message.dynamicFacet = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -92556,6 +98605,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Facet + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Facet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchResponse.Facet"; + }; + Facet.FacetValue = (function() { /** @@ -92706,21 +98770,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; - case 2: - message.interval = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); - break; - case 3: - message.count = reader.int64(); - break; - case 5: - message.minValue = reader.double(); - break; - case 6: - message.maxValue = reader.double(); - break; + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.interval = $root.google.cloud.retail.v2beta.Interval.decode(reader, reader.uint32()); + break; + } + case 3: { + message.count = reader.int64(); + break; + } + case 5: { + message.minValue = reader.double(); + break; + } + case 6: { + message.maxValue = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -92874,6 +98943,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FacetValue + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchResponse.Facet.FacetValue"; + }; + return FacetValue; })(); @@ -92983,12 +99067,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.expandedQuery = reader.bool(); - break; - case 2: - message.pinnedResultCount = reader.int64(); - break; + case 1: { + message.expandedQuery = reader.bool(); + break; + } + case 2: { + message.pinnedResultCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -93101,6 +99187,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for QueryExpansionInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SearchResponse.QueryExpansionInfo"; + }; + return QueryExpansionInfo; })(); @@ -93140,7 +99241,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#createControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|createControl}. * @memberof google.cloud.retail.v2beta.ControlService * @typedef CreateControlCallback * @type {function} @@ -93173,7 +99274,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#deleteControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|deleteControl}. * @memberof google.cloud.retail.v2beta.ControlService * @typedef DeleteControlCallback * @type {function} @@ -93206,7 +99307,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#updateControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|updateControl}. * @memberof google.cloud.retail.v2beta.ControlService * @typedef UpdateControlCallback * @type {function} @@ -93239,7 +99340,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#getControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|getControl}. * @memberof google.cloud.retail.v2beta.ControlService * @typedef GetControlCallback * @type {function} @@ -93272,7 +99373,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ControlService#listControls}. + * Callback as used by {@link google.cloud.retail.v2beta.ControlService|listControls}. * @memberof google.cloud.retail.v2beta.ControlService * @typedef ListControlsCallback * @type {function} @@ -93421,15 +99522,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.control = $root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32()); - break; - case 3: - message.controlId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.control = $root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32()); + break; + } + case 3: { + message.controlId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -93541,6 +99645,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CreateControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CreateControlRequest"; + }; + return CreateControlRequest; })(); @@ -93647,12 +99766,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.control = $root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.control = $root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -93761,6 +99882,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateControlRequest"; + }; + return UpdateControlRequest; })(); @@ -93856,9 +99992,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -93948,6 +100085,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.DeleteControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.DeleteControlRequest"; + }; + return DeleteControlRequest; })(); @@ -94043,9 +100195,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -94135,6 +100288,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetControlRequest"; + }; + return GetControlRequest; })(); @@ -94263,18 +100431,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -94389,6 +100561,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListControlsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListControlsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListControlsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListControlsRequest"; + }; + return ListControlsRequest; })(); @@ -94497,14 +100684,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.controls && message.controls.length)) - message.controls = []; - message.controls.push($root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.controls && message.controls.length)) + message.controls = []; + message.controls.push($root.google.cloud.retail.v2beta.Control.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -94620,6 +100809,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListControlsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListControlsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListControlsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListControlsResponse"; + }; + return ListControlsResponse; })(); @@ -94729,9 +100933,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.gcsPrefix = reader.string(); - break; + case 1: { + message.gcsPrefix = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -94825,6 +101030,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportErrorsConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ExportErrorsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ExportErrorsConfig"; + }; + return ExportErrorsConfig; })(); @@ -94931,12 +101151,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -95045,6 +101267,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ExportMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ExportMetadata"; + }; + return ExportMetadata; })(); @@ -95164,17 +101401,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -95309,6 +101549,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ExportProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ExportProductsResponse"; + }; + return ExportProductsResponse; })(); @@ -95428,17 +101683,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.errorSamples && message.errorSamples.length)) - message.errorSamples = []; - message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - case 2: - message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); - break; - case 3: - message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.decode(reader, reader.uint32()); - break; + case 1: { + if (!(message.errorSamples && message.errorSamples.length)) + message.errorSamples = []; + message.errorSamples.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorsConfig = $root.google.cloud.retail.v2beta.ExportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.outputResult = $root.google.cloud.retail.v2beta.OutputResult.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -95573,6 +101831,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExportUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ExportUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ExportUserEventsResponse"; + }; + return ExportUserEventsResponse; })(); @@ -95670,11 +101943,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.bigqueryResult && message.bigqueryResult.length)) - message.bigqueryResult = []; - message.bigqueryResult.push($root.google.cloud.retail.v2beta.BigQueryOutputResult.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.bigqueryResult && message.bigqueryResult.length)) + message.bigqueryResult = []; + message.bigqueryResult.push($root.google.cloud.retail.v2beta.BigQueryOutputResult.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -95781,6 +102055,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.OutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.OutputResult"; + }; + return OutputResult; })(); @@ -95887,12 +102176,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.datasetId = reader.string(); - break; - case 2: - message.tableId = reader.string(); - break; + case 1: { + message.datasetId = reader.string(); + break; + } + case 2: { + message.tableId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -95991,6 +102282,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BigQueryOutputResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.BigQueryOutputResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQueryOutputResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.BigQueryOutputResult"; + }; + return BigQueryOutputResult; })(); @@ -96027,7 +102333,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService#predict}. + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService|predict}. * @memberof google.cloud.retail.v2beta.PredictionService * @typedef PredictCallback * @type {function} @@ -96237,68 +102543,76 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.placement = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); - break; - case 3: - message.pageSize = reader.int32(); - break; - case 4: - message.pageToken = reader.string(); - break; - case 5: - message.filter = reader.string(); - break; - case 6: - message.validateOnly = reader.bool(); - break; - case 7: - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.validateOnly = reader.bool(); + break; + } + case 7: { + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.params[key] = value; + break; } - message.params[key] = value; - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; } - message.labels[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -96484,6 +102798,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PredictRequest"; + }; + return PredictRequest; })(); @@ -96616,22 +102945,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); - break; - case 2: - message.attributionToken = reader.string(); - break; - case 3: - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - case 4: - message.validateOnly = reader.bool(); - break; + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2beta.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + } + case 4: { + message.validateOnly = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -96777,6 +103110,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PredictResponse"; + }; + PredictResponse.PredictionResult = (function() { /** @@ -96884,31 +103232,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.id = reader.string(); + break; + } + case 2: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.metadata[key] = value; + break; } - message.metadata[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -97026,6 +103376,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PredictionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PredictResponse.PredictionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PredictResponse.PredictionResult"; + }; + return PredictionResult; })(); @@ -97065,7 +103430,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#createProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|createProduct}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef CreateProductCallback * @type {function} @@ -97098,7 +103463,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#getProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|getProduct}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef GetProductCallback * @type {function} @@ -97131,7 +103496,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#listProducts}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|listProducts}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef ListProductsCallback * @type {function} @@ -97164,7 +103529,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#updateProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|updateProduct}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef UpdateProductCallback * @type {function} @@ -97197,7 +103562,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#deleteProduct}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|deleteProduct}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef DeleteProductCallback * @type {function} @@ -97230,7 +103595,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#importProducts}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|importProducts}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef ImportProductsCallback * @type {function} @@ -97263,7 +103628,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#setInventory}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|setInventory}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef SetInventoryCallback * @type {function} @@ -97296,7 +103661,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|addFulfillmentPlaces}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef AddFulfillmentPlacesCallback * @type {function} @@ -97329,7 +103694,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeFulfillmentPlaces}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|removeFulfillmentPlaces}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef RemoveFulfillmentPlacesCallback * @type {function} @@ -97362,7 +103727,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#addLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|addLocalInventories}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef AddLocalInventoriesCallback * @type {function} @@ -97395,7 +103760,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ProductService#removeLocalInventories}. + * Callback as used by {@link google.cloud.retail.v2beta.ProductService|removeLocalInventories}. * @memberof google.cloud.retail.v2beta.ProductService * @typedef RemoveLocalInventoriesCallback * @type {function} @@ -97544,15 +103909,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 3: - message.productId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.productId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -97664,6 +104032,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CreateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CreateProductRequest"; + }; + return CreateProductRequest; })(); @@ -97759,9 +104142,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -97851,6 +104235,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetProductRequest"; + }; + return GetProductRequest; })(); @@ -97968,15 +104367,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -98093,6 +104495,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateProductRequest"; + }; + return UpdateProductRequest; })(); @@ -98188,9 +104605,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -98280,6 +104698,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.DeleteProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.DeleteProductRequest"; + }; + return DeleteProductRequest; })(); @@ -98419,21 +104852,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -98561,6 +104999,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListProductsRequest"; + }; + return ListProductsRequest; })(); @@ -98669,14 +105122,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -98792,6 +105247,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListProductsResponse"; + }; + return ListProductsResponse; })(); @@ -98920,18 +105390,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inventory = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); - break; - case 2: - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 3: - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.allowMissing = reader.bool(); - break; + case 1: { + message.inventory = $root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -99061,6 +105535,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SetInventoryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SetInventoryRequest"; + }; + return SetInventoryRequest; })(); @@ -99221,6 +105710,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SetInventoryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SetInventoryMetadata"; + }; + return SetInventoryMetadata; })(); @@ -99381,6 +105885,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetInventoryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.SetInventoryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.SetInventoryResponse"; + }; + return SetInventoryResponse; })(); @@ -99522,23 +106041,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -99679,6 +106203,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddFulfillmentPlacesRequest"; + }; + return AddFulfillmentPlacesRequest; })(); @@ -99839,6 +106378,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata"; + }; + return AddFulfillmentPlacesMetadata; })(); @@ -99999,6 +106553,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddFulfillmentPlacesResponse"; + }; + return AddFulfillmentPlacesResponse; })(); @@ -100140,23 +106709,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.localInventories && message.localInventories.length)) - message.localInventories = []; - message.localInventories.push($root.google.cloud.retail.v2beta.LocalInventory.decode(reader, reader.uint32())); - break; - case 4: - message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - case 5: - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2beta.LocalInventory.decode(reader, reader.uint32())); + break; + } + case 4: { + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -100307,6 +106881,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddLocalInventoriesRequest"; + }; + return AddLocalInventoriesRequest; })(); @@ -100467,6 +107056,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddLocalInventoriesMetadata"; + }; + return AddLocalInventoriesMetadata; })(); @@ -100627,6 +107231,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddLocalInventoriesResponse"; + }; + return AddLocalInventoriesResponse; })(); @@ -100757,20 +107376,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 5: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 5: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -100903,6 +107526,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveLocalInventoriesRequest"; + }; + return RemoveLocalInventoriesRequest; })(); @@ -101063,6 +107701,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata"; + }; + return RemoveLocalInventoriesMetadata; })(); @@ -101223,6 +107876,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveLocalInventoriesResponse"; + }; + return RemoveLocalInventoriesResponse; })(); @@ -101364,23 +108032,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.product = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - case 4: - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.allowMissing = reader.bool(); - break; + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -101521,6 +108194,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest"; + }; + return RemoveFulfillmentPlacesRequest; })(); @@ -101681,6 +108369,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata"; + }; + return RemoveFulfillmentPlacesMetadata; })(); @@ -101841,6 +108544,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveFulfillmentPlacesResponse"; + }; + return RemoveFulfillmentPlacesResponse; })(); @@ -102001,6 +108719,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PurgeMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PurgeMetadata"; + }; + return PurgeMetadata; })(); @@ -102118,15 +108851,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; - case 3: - message.force = reader.bool(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -102233,6 +108969,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PurgeUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PurgeUserEventsRequest"; + }; + return PurgeUserEventsRequest; })(); @@ -102328,9 +109079,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.purgedEventsCount = reader.int64(); - break; + case 1: { + message.purgedEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -102434,6 +109186,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PurgeUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PurgeUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PurgeUserEventsResponse"; + }; + return PurgeUserEventsResponse; })(); @@ -102728,82 +109495,99 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 3: - message.modelId = reader.string(); - break; - case 4: - message.priceRerankingLevel = reader.string(); - break; - case 5: - if (!(message.facetControlIds && message.facetControlIds.length)) - message.facetControlIds = []; - message.facetControlIds.push(reader.string()); - break; - case 6: - message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - case 7: - if (!(message.boostControlIds && message.boostControlIds.length)) - message.boostControlIds = []; - message.boostControlIds.push(reader.string()); - break; - case 9: - if (!(message.filterControlIds && message.filterControlIds.length)) - message.filterControlIds = []; - message.filterControlIds.push(reader.string()); - break; - case 10: - if (!(message.redirectControlIds && message.redirectControlIds.length)) - message.redirectControlIds = []; - message.redirectControlIds.push(reader.string()); - break; - case 18: - if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) - message.twowaySynonymsControlIds = []; - message.twowaySynonymsControlIds.push(reader.string()); - break; - case 12: - if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) - message.onewaySynonymsControlIds = []; - message.onewaySynonymsControlIds.push(reader.string()); - break; - case 13: - if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) - message.doNotAssociateControlIds = []; - message.doNotAssociateControlIds.push(reader.string()); - break; - case 14: - if (!(message.replacementControlIds && message.replacementControlIds.length)) - message.replacementControlIds = []; - message.replacementControlIds.push(reader.string()); - break; - case 15: - if (!(message.ignoreControlIds && message.ignoreControlIds.length)) - message.ignoreControlIds = []; - message.ignoreControlIds.push(reader.string()); - break; - case 8: - message.diversityLevel = reader.string(); - break; - case 16: - message.enableCategoryFilterLevel = reader.string(); - break; - case 19: - if (!(message.solutionTypes && message.solutionTypes.length)) - message.solutionTypes = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.modelId = reader.string(); + break; + } + case 4: { + message.priceRerankingLevel = reader.string(); + break; + } + case 5: { + if (!(message.facetControlIds && message.facetControlIds.length)) + message.facetControlIds = []; + message.facetControlIds.push(reader.string()); + break; + } + case 6: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.boostControlIds && message.boostControlIds.length)) + message.boostControlIds = []; + message.boostControlIds.push(reader.string()); + break; + } + case 9: { + if (!(message.filterControlIds && message.filterControlIds.length)) + message.filterControlIds = []; + message.filterControlIds.push(reader.string()); + break; + } + case 10: { + if (!(message.redirectControlIds && message.redirectControlIds.length)) + message.redirectControlIds = []; + message.redirectControlIds.push(reader.string()); + break; + } + case 18: { + if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) + message.twowaySynonymsControlIds = []; + message.twowaySynonymsControlIds.push(reader.string()); + break; + } + case 12: { + if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) + message.onewaySynonymsControlIds = []; + message.onewaySynonymsControlIds.push(reader.string()); + break; + } + case 13: { + if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) + message.doNotAssociateControlIds = []; + message.doNotAssociateControlIds.push(reader.string()); + break; + } + case 14: { + if (!(message.replacementControlIds && message.replacementControlIds.length)) + message.replacementControlIds = []; + message.replacementControlIds.push(reader.string()); + break; + } + case 15: { + if (!(message.ignoreControlIds && message.ignoreControlIds.length)) + message.ignoreControlIds = []; + message.ignoreControlIds.push(reader.string()); + break; + } + case 8: { + message.diversityLevel = reader.string(); + break; + } + case 16: { + message.enableCategoryFilterLevel = reader.string(); + break; + } + case 19: { + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else message.solutionTypes.push(reader.int32()); - } else - message.solutionTypes.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -103169,6 +109953,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServingConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ServingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ServingConfig"; + }; + return ServingConfig; })(); @@ -103205,7 +110004,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#createServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|createServingConfig}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef CreateServingConfigCallback * @type {function} @@ -103238,7 +110037,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#deleteServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|deleteServingConfig}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef DeleteServingConfigCallback * @type {function} @@ -103271,7 +110070,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#updateServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|updateServingConfig}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef UpdateServingConfigCallback * @type {function} @@ -103304,7 +110103,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#getServingConfig}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|getServingConfig}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef GetServingConfigCallback * @type {function} @@ -103337,7 +110136,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#listServingConfigs}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|listServingConfigs}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef ListServingConfigsCallback * @type {function} @@ -103370,7 +110169,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#addControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|addControl}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef AddControlCallback * @type {function} @@ -103403,7 +110202,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService#removeControl}. + * Callback as used by {@link google.cloud.retail.v2beta.ServingConfigService|removeControl}. * @memberof google.cloud.retail.v2beta.ServingConfigService * @typedef RemoveControlCallback * @type {function} @@ -103552,15 +110351,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32()); - break; - case 3: - message.servingConfigId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.servingConfigId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -103672,6 +110474,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CreateServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CreateServingConfigRequest"; + }; + return CreateServingConfigRequest; })(); @@ -103778,12 +110595,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.servingConfig = $root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -103892,6 +110711,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateServingConfigRequest"; + }; + return UpdateServingConfigRequest; })(); @@ -103987,9 +110821,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -104079,6 +110914,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.DeleteServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.DeleteServingConfigRequest"; + }; + return DeleteServingConfigRequest; })(); @@ -104174,9 +111024,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -104266,6 +111117,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.GetServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.GetServingConfigRequest"; + }; + return GetServingConfigRequest; })(); @@ -104383,15 +111249,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -104498,6 +111367,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListServingConfigsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListServingConfigsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServingConfigsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListServingConfigsRequest"; + }; + return ListServingConfigsRequest; })(); @@ -104606,14 +111490,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.servingConfigs && message.servingConfigs.length)) - message.servingConfigs = []; - message.servingConfigs.push($root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.servingConfigs && message.servingConfigs.length)) + message.servingConfigs = []; + message.servingConfigs.push($root.google.cloud.retail.v2beta.ServingConfig.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -104729,6 +111615,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListServingConfigsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListServingConfigsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServingConfigsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListServingConfigsResponse"; + }; + return ListServingConfigsResponse; })(); @@ -104835,12 +111736,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfig = reader.string(); - break; - case 2: - message.controlId = reader.string(); - break; + case 1: { + message.servingConfig = reader.string(); + break; + } + case 2: { + message.controlId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -104939,6 +111842,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AddControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.AddControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.AddControlRequest"; + }; + return AddControlRequest; })(); @@ -105045,12 +111963,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.servingConfig = reader.string(); - break; - case 2: - message.controlId = reader.string(); - break; + case 1: { + message.servingConfig = reader.string(); + break; + } + case 2: { + message.controlId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -105149,6 +112069,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RemoveControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RemoveControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RemoveControlRequest"; + }; + return RemoveControlRequest; })(); @@ -105185,7 +112120,7 @@ }; /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#writeUserEvent}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|writeUserEvent}. * @memberof google.cloud.retail.v2beta.UserEventService * @typedef WriteUserEventCallback * @type {function} @@ -105218,7 +112153,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#collectUserEvent}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|collectUserEvent}. * @memberof google.cloud.retail.v2beta.UserEventService * @typedef CollectUserEventCallback * @type {function} @@ -105251,7 +112186,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#purgeUserEvents}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|purgeUserEvents}. * @memberof google.cloud.retail.v2beta.UserEventService * @typedef PurgeUserEventsCallback * @type {function} @@ -105284,7 +112219,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#importUserEvents}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|importUserEvents}. * @memberof google.cloud.retail.v2beta.UserEventService * @typedef ImportUserEventsCallback * @type {function} @@ -105317,7 +112252,7 @@ */ /** - * Callback as used by {@link google.cloud.retail.v2beta.UserEventService#rejoinUserEvents}. + * Callback as used by {@link google.cloud.retail.v2beta.UserEventService|rejoinUserEvents}. * @memberof google.cloud.retail.v2beta.UserEventService * @typedef RejoinUserEventsCallback * @type {function} @@ -105455,12 +112390,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -105564,6 +112501,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WriteUserEventRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.WriteUserEventRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteUserEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.WriteUserEventRequest"; + }; + return WriteUserEventRequest; })(); @@ -105692,18 +112644,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEvent = reader.string(); - break; - case 3: - message.uri = reader.string(); - break; - case 4: - message.ets = reader.int64(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEvent = reader.string(); + break; + } + case 3: { + message.uri = reader.string(); + break; + } + case 4: { + message.ets = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -105832,6 +112788,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CollectUserEventRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CollectUserEventRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CollectUserEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CollectUserEventRequest"; + }; + return CollectUserEventRequest; })(); @@ -105938,12 +112909,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.userEventRejoinScope = reader.int32(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.userEventRejoinScope = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -106060,6 +113033,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RejoinUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RejoinUserEventsRequest"; + }; + /** * UserEventRejoinScope enum. * @name google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope @@ -106171,9 +113159,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.rejoinedUserEventsCount = reader.int64(); - break; + case 1: { + message.rejoinedUserEventsCount = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -106277,6 +113266,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RejoinUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RejoinUserEventsResponse"; + }; + return RejoinUserEventsResponse; })(); @@ -106437,6 +113441,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RejoinUserEventsMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.RejoinUserEventsMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RejoinUserEventsMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.RejoinUserEventsMetadata"; + }; + return RejoinUserEventsMetadata; })(); @@ -106649,36 +113668,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - case 3: - message.nameField = reader.string(); - break; - case 4: - message.history = reader.int32(); - break; - case 5: - message.plural = reader.string(); - break; - case 6: - message.singular = reader.string(); - break; - case 10: - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -106876,6 +113902,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + /** * History enum. * @name google.api.ResourceDescriptor.History @@ -107012,12 +114053,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - message.childType = reader.string(); - break; + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -107116,6 +114159,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + return ResourceReference; })(); @@ -107224,14 +114282,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - case 2: - message.fullyDecodeReservedExpansion = reader.bool(); - break; + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -107347,6 +114407,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + return Http; })(); @@ -107557,38 +114632,48 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.selector = reader.string(); - break; - case 2: - message.get = reader.string(); - break; - case 3: - message.put = reader.string(); - break; - case 4: - message.post = reader.string(); - break; - case 5: - message["delete"] = reader.string(); - break; - case 6: - message.patch = reader.string(); - break; - case 8: - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 7: - message.body = reader.string(); - break; - case 12: - message.responseBody = reader.string(); - break; - case 11: - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -107810,6 +114895,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + return HttpRule; })(); @@ -107916,12 +115016,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.kind = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -108020,6 +115122,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + return CustomHttpPattern; })(); @@ -108139,17 +115256,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.contentType = reader.string(); - break; - case 2: - message.data = reader.bytes(); - break; - case 3: - if (!(message.extensions && message.extensions.length)) - message.extensions = []; - message.extensions.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; + case 1: { + message.contentType = reader.string(); + break; + } + case 2: { + message.data = reader.bytes(); + break; + } + case 3: { + if (!(message.extensions && message.extensions.length)) + message.extensions = []; + message.extensions.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -108220,7 +115340,7 @@ if (object.data != null) if (typeof object.data === "string") $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) + else if (object.data.length >= 0) message.data = object.data; if (object.extensions) { if (!Array.isArray(object.extensions)) @@ -108283,6 +115403,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HttpBody + * @function getTypeUrl + * @memberof google.api.HttpBody + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpBody"; + }; + return HttpBody; })(); @@ -108392,11 +115527,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -108503,6 +115639,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + return FileDescriptorSet; })(); @@ -108524,6 +115675,7 @@ * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {string|null} [edition] FileDescriptorProto edition */ /** @@ -108644,6 +115796,14 @@ */ FileDescriptorProto.prototype.syntax = ""; + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + /** * Creates a new FileDescriptorProto instance using the specified properties. * @function create @@ -108699,6 +115859,8 @@ writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); return writer; }; @@ -108733,66 +115895,82 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message["package"] = reader.string(); - break; - case 3: - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - case 10: - if (!(message.publicDependency && message.publicDependency.length)) - message.publicDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else message.publicDependency.push(reader.int32()); - } else - message.publicDependency.push(reader.int32()); - break; - case 11: - if (!(message.weakDependency && message.weakDependency.length)) - message.weakDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else message.weakDependency.push(reader.int32()); - } else - message.weakDependency.push(reader.int32()); - break; - case 4: - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 8: - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - case 9: - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - case 12: - message.syntax = reader.string(); - break; + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 13: { + message.edition = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -108904,6 +116082,9 @@ if (message.syntax != null && message.hasOwnProperty("syntax")) if (!$util.isString(message.syntax)) return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: string expected"; return null; }; @@ -108996,6 +116177,8 @@ } if (object.syntax != null) message.syntax = String(object.syntax); + if (object.edition != null) + message.edition = String(object.edition); return message; }; @@ -109027,6 +116210,7 @@ object.options = null; object.sourceCodeInfo = null; object.syntax = ""; + object.edition = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -109073,6 +116257,8 @@ } if (message.syntax != null && message.hasOwnProperty("syntax")) object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; return object; }; @@ -109087,6 +116273,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + return FileDescriptorProto; })(); @@ -109297,52 +116498,62 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.nestedType && message.nestedType.length)) - message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.extensionRange && message.extensionRange.length)) - message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.oneofDecl && message.oneofDecl.length)) - message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -109643,6 +116854,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + DescriptorProto.ExtensionRange = (function() { /** @@ -109757,15 +116983,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -109877,6 +117106,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + return ExtensionRange; })(); @@ -109983,12 +117227,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -110087,6 +117333,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + return ReservedRange; })(); @@ -110187,11 +117448,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -110298,6 +117560,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + return ExtensionRangeOptions; })(); @@ -110503,39 +117780,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 3: - message.number = reader.int32(); - break; - case 4: - message.label = reader.int32(); - break; - case 5: - message.type = reader.int32(); - break; - case 6: - message.typeName = reader.string(); - break; - case 2: - message.extendee = reader.string(); - break; - case 7: - message.defaultValue = reader.string(); - break; - case 9: - message.oneofIndex = reader.int32(); - break; - case 10: - message.jsonName = reader.string(); - break; - case 8: - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); - break; - case 17: - message.proto3Optional = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -110822,6 +118110,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + /** * Type enum. * @name google.protobuf.FieldDescriptorProto.Type @@ -110990,12 +118293,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -111099,6 +118404,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + return OneofDescriptorProto; })(); @@ -111244,27 +118564,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -111440,6 +118765,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + EnumDescriptorProto.EnumReservedRange = (function() { /** @@ -111543,12 +118883,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -111647,6 +118989,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + return EnumReservedRange; })(); @@ -111767,15 +119124,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.number = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -111887,6 +119247,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + return EnumValueDescriptorProto; })(); @@ -112006,17 +119381,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -112146,6 +119524,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + return ServiceDescriptorProto; })(); @@ -112296,24 +119689,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.inputType = reader.string(); - break; - case 3: - message.outputType = reader.string(); - break; - case 4: - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); - break; - case 5: - message.clientStreaming = reader.bool(); - break; - case 6: - message.serverStreaming = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -112449,6 +119848,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + return MethodDescriptorProto; })(); @@ -112779,76 +120193,98 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.javaPackage = reader.string(); - break; - case 8: - message.javaOuterClassname = reader.string(); - break; - case 10: - message.javaMultipleFiles = reader.bool(); - break; - case 20: - message.javaGenerateEqualsAndHash = reader.bool(); - break; - case 27: - message.javaStringCheckUtf8 = reader.bool(); - break; - case 9: - message.optimizeFor = reader.int32(); - break; - case 11: - message.goPackage = reader.string(); - break; - case 16: - message.ccGenericServices = reader.bool(); - break; - case 17: - message.javaGenericServices = reader.bool(); - break; - case 18: - message.pyGenericServices = reader.bool(); - break; - case 42: - message.phpGenericServices = reader.bool(); - break; - case 23: - message.deprecated = reader.bool(); - break; - case 31: - message.ccEnableArenas = reader.bool(); - break; - case 36: - message.objcClassPrefix = reader.string(); - break; - case 37: - message.csharpNamespace = reader.string(); - break; - case 39: - message.swiftPrefix = reader.string(); - break; - case 40: - message.phpClassPrefix = reader.string(); - break; - case 41: - message.phpNamespace = reader.string(); - break; - case 44: - message.phpMetadataNamespace = reader.string(); - break; - case 45: - message.rubyPackage = reader.string(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1053: - if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) - message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); - break; + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 42: { + message.phpGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -113161,6 +120597,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + /** * OptimizeMode enum. * @name google.protobuf.FileOptions.OptimizeMode @@ -113329,26 +120780,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.messageSetWireFormat = reader.bool(); - break; - case 2: - message.noStandardDescriptorAccessor = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 7: - message.mapEntry = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1053: - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); - break; + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -113502,6 +120959,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + return MessageOptions; })(); @@ -113515,6 +120987,7 @@ * @property {boolean|null} [packed] FieldOptions packed * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy * @property {boolean|null} [deprecated] FieldOptions deprecated * @property {boolean|null} [weak] FieldOptions weak * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption @@ -113571,6 +121044,14 @@ */ FieldOptions.prototype.lazy = false; + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + /** * FieldOptions deprecated. * @member {boolean} deprecated @@ -113647,6 +121128,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -113692,42 +121175,55 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ctype = reader.int32(); - break; - case 2: - message.packed = reader.bool(); - break; - case 6: - message.jstype = reader.int32(); - break; - case 5: - message.lazy = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 10: - message.weak = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1052: - if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) - message[".google.api.fieldBehavior"] = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else message[".google.api.fieldBehavior"].push(reader.int32()); - } else - message[".google.api.fieldBehavior"].push(reader.int32()); - break; - case 1055: - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); - break; + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -113787,6 +121283,9 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) if (typeof message.lazy !== "boolean") return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; @@ -113872,6 +121371,8 @@ } if (object.lazy != null) message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.weak != null) @@ -113959,6 +121460,7 @@ object.lazy = false; object.jstype = options.enums === String ? "JS_NORMAL" : 0; object.weak = false; + object.unverifiedLazy = false; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -113973,6 +121475,8 @@ object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -113999,6 +121503,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + /** * CType enum. * @name google.protobuf.FieldOptions.CType @@ -114128,11 +121647,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -114239,6 +121759,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + return OneofOptions; })(); @@ -114358,17 +121893,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.allowAlias = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -114493,6 +122031,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + return EnumOptions; })(); @@ -114601,14 +122154,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 1: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -114724,6 +122279,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + return EnumValueOptions; })(); @@ -114854,20 +122424,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1049: - message[".google.api.defaultHost"] = reader.string(); - break; - case 1050: - message[".google.api.oauthScopes"] = reader.string(); - break; + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -115000,6 +122574,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + return ServiceOptions; })(); @@ -115154,28 +122743,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 34: - message.idempotencyLevel = reader.int32(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 72295728: - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); - break; - case 1051: - if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) - message[".google.api.methodSignature"] = []; - message[".google.api.methodSignature"].push(reader.string()); - break; - case 1049: - message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); - break; + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + case 1049: { + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -115365,6 +122960,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + /** * IdempotencyLevel enum. * @name google.protobuf.MethodOptions.IdempotencyLevel @@ -115544,29 +123154,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - case 3: - message.identifierValue = reader.string(); - break; - case 4: - message.positiveIntValue = reader.uint64(); - break; - case 5: - message.negativeIntValue = reader.int64(); - break; - case 6: - message.doubleValue = reader.double(); - break; - case 7: - message.stringValue = reader.bytes(); - break; - case 8: - message.aggregateValue = reader.string(); - break; + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -115679,7 +123296,7 @@ if (object.stringValue != null) if (typeof object.stringValue === "string") $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); - else if (object.stringValue.length) + else if (object.stringValue.length >= 0) message.stringValue = object.stringValue; if (object.aggregateValue != null) message.aggregateValue = String(object.aggregateValue); @@ -115760,6 +123377,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + UninterpretedOption.NamePart = (function() { /** @@ -115861,12 +123493,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.namePart = reader.string(); - break; - case 2: - message.isExtension = reader.bool(); - break; + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -115967,6 +123601,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + return NamePart; })(); @@ -116067,11 +123716,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -116178,6 +123828,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + SourceCodeInfo.Location = (function() { /** @@ -116326,37 +123991,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - case 3: - message.leadingComments = reader.string(); - break; - case 4: - message.trailingComments = reader.string(); - break; - case 6: - if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) - message.leadingDetachedComments = []; - message.leadingDetachedComments.push(reader.string()); - break; + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -116517,6 +124187,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + return Location; })(); @@ -116617,11 +124302,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -116728,6 +124414,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + GeneratedCodeInfo.Annotation = (function() { /** @@ -116738,6 +124439,7 @@ * @property {string|null} [sourceFile] Annotation sourceFile * @property {number|null} [begin] Annotation begin * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic */ /** @@ -116788,6 +124490,14 @@ */ Annotation.prototype.end = 0; + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + /** * Creates a new Annotation instance using the specified properties. * @function create @@ -116824,6 +124534,8 @@ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); return writer; }; @@ -116858,25 +124570,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - message.sourceFile = reader.string(); - break; - case 3: - message.begin = reader.int32(); - break; - case 4: - message.end = reader.int32(); - break; + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -116928,6 +124648,15 @@ if (message.end != null && message.hasOwnProperty("end")) if (!$util.isInteger(message.end)) return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -116956,6 +124685,20 @@ message.begin = object.begin | 0; if (object.end != null) message.end = object.end | 0; + switch (object.semantic) { + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } return message; }; @@ -116978,6 +124721,7 @@ object.sourceFile = ""; object.begin = 0; object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; } if (message.path && message.path.length) { object.path = []; @@ -116990,6 +124734,8 @@ object.begin = message.begin; if (message.end != null && message.hasOwnProperty("end")) object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -117004,6 +124750,37 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; + + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); + return Annotation; })(); @@ -117167,6 +124944,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + return Empty; })(); @@ -117264,11 +125056,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -117370,6 +125163,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + return FieldMask; })(); @@ -117476,12 +125284,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -117594,6 +125404,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + return Timestamp; })(); @@ -117700,12 +125525,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -117818,6 +125645,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Duration + * @function getTypeUrl + * @memberof google.protobuf.Duration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Duration"; + }; + return Duration; })(); @@ -117913,9 +125755,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.double(); - break; + case 1: { + message.value = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -118005,6 +125848,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DoubleValue + * @function getTypeUrl + * @memberof google.protobuf.DoubleValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DoubleValue"; + }; + return DoubleValue; })(); @@ -118100,9 +125958,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.float(); - break; + case 1: { + message.value = reader.float(); + break; + } default: reader.skipType(tag & 7); break; @@ -118192,6 +126051,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FloatValue + * @function getTypeUrl + * @memberof google.protobuf.FloatValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FloatValue"; + }; + return FloatValue; })(); @@ -118287,9 +126161,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.int64(); - break; + case 1: { + message.value = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -118393,6 +126268,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Int64Value + * @function getTypeUrl + * @memberof google.protobuf.Int64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int64Value"; + }; + return Int64Value; })(); @@ -118488,9 +126378,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.uint64(); - break; + case 1: { + message.value = reader.uint64(); + break; + } default: reader.skipType(tag & 7); break; @@ -118594,6 +126485,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UInt64Value + * @function getTypeUrl + * @memberof google.protobuf.UInt64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt64Value"; + }; + return UInt64Value; })(); @@ -118689,9 +126595,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.int32(); - break; + case 1: { + message.value = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -118781,6 +126688,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Int32Value + * @function getTypeUrl + * @memberof google.protobuf.Int32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int32Value"; + }; + return Int32Value; })(); @@ -118876,9 +126798,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.uint32(); - break; + case 1: { + message.value = reader.uint32(); + break; + } default: reader.skipType(tag & 7); break; @@ -118968,6 +126891,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UInt32Value + * @function getTypeUrl + * @memberof google.protobuf.UInt32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt32Value"; + }; + return UInt32Value; })(); @@ -119063,9 +127001,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.bool(); - break; + case 1: { + message.value = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -119155,6 +127094,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BoolValue + * @function getTypeUrl + * @memberof google.protobuf.BoolValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BoolValue"; + }; + return BoolValue; })(); @@ -119250,9 +127204,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.string(); - break; + case 1: { + message.value = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -119342,6 +127297,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StringValue + * @function getTypeUrl + * @memberof google.protobuf.StringValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.StringValue"; + }; + return StringValue; })(); @@ -119437,9 +127407,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.value = reader.bytes(); - break; + case 1: { + message.value = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -119496,7 +127467,7 @@ if (object.value != null) if (typeof object.value === "string") $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) + else if (object.value.length >= 0) message.value = object.value; return message; }; @@ -119538,6 +127509,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BytesValue + * @function getTypeUrl + * @memberof google.protobuf.BytesValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BytesValue"; + }; + return BytesValue; })(); @@ -119644,12 +127630,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type_url = reader.string(); - break; - case 2: - message.value = reader.bytes(); - break; + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -119711,7 +127699,7 @@ if (object.value != null) if (typeof object.value === "string") $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) + else if (object.value.length >= 0) message.value = object.value; return message; }; @@ -119757,6 +127745,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + return Any; })(); @@ -119856,28 +127859,29 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (message.fields === $util.emptyObject) - message.fields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.fields[key] = value; + break; } - message.fields[key] = value; - break; default: reader.skipType(tag & 7); break; @@ -119986,6 +127990,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Struct + * @function getTypeUrl + * @memberof google.protobuf.Struct + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Struct"; + }; + return Struct; })(); @@ -120150,24 +128169,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.nullValue = reader.int32(); - break; - case 2: - message.numberValue = reader.double(); - break; - case 3: - message.stringValue = reader.string(); - break; - case 4: - message.boolValue = reader.bool(); - break; - case 5: - message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); - break; - case 6: - message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); - break; + case 1: { + message.nullValue = reader.int32(); + break; + } + case 2: { + message.numberValue = reader.double(); + break; + } + case 3: { + message.stringValue = reader.string(); + break; + } + case 4: { + message.boolValue = reader.bool(); + break; + } + case 5: { + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 6: { + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -120351,6 +128376,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.protobuf.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Value"; + }; + return Value; })(); @@ -120460,11 +128500,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -120571,6 +128612,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListValue + * @function getTypeUrl + * @memberof google.protobuf.ListValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ListValue"; + }; + return ListValue; })(); @@ -120702,17 +128758,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.code = reader.int32(); - break; - case 2: - message.message = reader.string(); - break; - case 3: - if (!(message.details && message.details.length)) - message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -120837,6 +128896,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + return Status; })(); @@ -120966,15 +129040,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.year = reader.int32(); - break; - case 2: - message.month = reader.int32(); - break; - case 3: - message.day = reader.int32(); - break; + case 1: { + message.year = reader.int32(); + break; + } + case 2: { + message.month = reader.int32(); + break; + } + case 3: { + message.day = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -121081,6 +129158,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Date + * @function getTypeUrl + * @memberof google.type.Date + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Date.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Date"; + }; + return Date; })(); @@ -121129,7 +129221,7 @@ }; /** - * Callback as used by {@link google.longrunning.Operations#listOperations}. + * Callback as used by {@link google.longrunning.Operations|listOperations}. * @memberof google.longrunning.Operations * @typedef ListOperationsCallback * @type {function} @@ -121162,7 +129254,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#getOperation}. + * Callback as used by {@link google.longrunning.Operations|getOperation}. * @memberof google.longrunning.Operations * @typedef GetOperationCallback * @type {function} @@ -121195,7 +129287,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. * @memberof google.longrunning.Operations * @typedef DeleteOperationCallback * @type {function} @@ -121228,7 +129320,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. * @memberof google.longrunning.Operations * @typedef CancelOperationCallback * @type {function} @@ -121261,7 +129353,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * Callback as used by {@link google.longrunning.Operations|waitOperation}. * @memberof google.longrunning.Operations * @typedef WaitOperationCallback * @type {function} @@ -121446,21 +129538,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.done = reader.bool(); - break; - case 4: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 5: - message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.done = reader.bool(); + break; + } + case 4: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -121611,6 +129708,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.longrunning.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.Operation"; + }; + return Operation; })(); @@ -121706,9 +129818,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -121798,6 +129911,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.GetOperationRequest"; + }; + return GetOperationRequest; })(); @@ -121926,18 +130054,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.name = reader.string(); - break; - case 1: - message.filter = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 4: { + message.name = reader.string(); + break; + } + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -122052,6 +130184,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListOperationsRequest + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsRequest"; + }; + return ListOperationsRequest; })(); @@ -122160,14 +130307,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.operations && message.operations.length)) - message.operations = []; - message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -122283,6 +130432,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListOperationsResponse + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsResponse"; + }; + return ListOperationsResponse; })(); @@ -122378,9 +130542,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -122470,6 +130635,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CancelOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CancelOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.CancelOperationRequest"; + }; + return CancelOperationRequest; })(); @@ -122565,9 +130745,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -122657,6 +130838,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.DeleteOperationRequest"; + }; + return DeleteOperationRequest; })(); @@ -122763,12 +130959,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -122872,6 +131070,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WaitOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WaitOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.WaitOperationRequest"; + }; + return WaitOperationRequest; })(); @@ -122978,12 +131191,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.responseType = reader.string(); - break; - case 2: - message.metadataType = reader.string(); - break; + case 1: { + message.responseType = reader.string(); + break; + } + case 2: { + message.metadataType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -123082,6 +131297,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationInfo + * @function getTypeUrl + * @memberof google.longrunning.OperationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.OperationInfo"; + }; + return OperationInfo; })(); diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 3c4bb5ba2e1..1e557e9079b 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -11904,6 +11904,10 @@ "syntax": { "type": "string", "id": 12 + }, + "edition": { + "type": "string", + "id": 13 } } }, @@ -12432,6 +12436,13 @@ "default": false } }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, "deprecated": { "type": "bool", "id": 3, @@ -12724,6 +12735,19 @@ "end": { "type": "int32", "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } } } } From 210b752029a5280b6083040bc212a9e676473354 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 27 Aug 2022 05:04:26 +0000 Subject: [PATCH 093/103] fix: do not import the whole google-gax from proto JS (#1553) (#208) fix: use google-gax v3.3.0 Source-Link: https://github.com/googleapis/synthtool/commit/c73d112a11a1f1a93efa67c50495c19aa3a88910 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:b15a6f06cc06dcffa11e1bebdf1a74b6775a134aac24a0f86f51ddf728eb373e --- packages/google-cloud-retail/package.json | 2 +- packages/google-cloud-retail/protos/protos.d.ts | 2 +- packages/google-cloud-retail/protos/protos.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 4e71696b6cf..801300cddd3 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,7 +42,7 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^3.0.1" + "google-gax": "^3.3.0" }, "devDependencies": { "@types/mocha": "^9.0.0", diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index a1d36016f69..6988d8a3c23 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import Long = require("long"); -import {protobuf as $protobuf} from "google-gax"; +import type {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index ce4a62ea9b2..dc13da7fd3d 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("google-gax").protobufMinimal); + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); })(this, function($protobuf) { "use strict"; From 8d0bdbc0003107002d0689147676627742c5769d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 21:00:24 +0000 Subject: [PATCH 094/103] fix: allow passing gax instance to client constructor (#206) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 470911839 Source-Link: https://github.com/googleapis/googleapis/commit/352756699ebc5b2144c252867c265ea44448712e Source-Link: https://github.com/googleapis/googleapis-gen/commit/f16a1d224f00a630ea43d6a9a1a31f566f45cdea Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE2YTFkMjI0ZjAwYTYzMGVhNDNkNmE5YTFhMzFmNTY2ZjQ1Y2RlYSJ9 feat: accept google-gax instance as a parameter Please see the documentation of the client constructor for details. PiperOrigin-RevId: 470332808 Source-Link: https://github.com/googleapis/googleapis/commit/d4a23675457cd8f0b44080e0594ec72de1291b89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e97a1ac204ead4fe7341f91e72db7c6ac6016341 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk3YTFhYzIwNGVhZDRmZTczNDFmOTFlNzJkYjdjNmFjNjAxNjM0MSJ9 feat: release Control and ServingConfig serivces to v2 version feat: release AttributesConfig APIs to v2 version feat: release CompletionConfig APIs to v2 version feat: add local inventories info to the Product resource docs: Improved documentation for Fullfillment and Inventory API in ProductService docs: minor documentation format and typo fixes PiperOrigin-RevId: 469399525 Source-Link: https://github.com/googleapis/googleapis/commit/e9bcb6c5e65a3cd7ffd5f8d5908436e20cfcfbd9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/14169c645e64175b441d599cdb500c17f96441b2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTQxNjljNjQ1ZTY0MTc1YjQ0MWQ1OTljZGI1MDBjMTdmOTY0NDFiMiJ9 --- .../google/cloud/retail/v2/catalog.proto | 240 + .../cloud/retail/v2/catalog_service.proto | 230 + .../google/cloud/retail/v2/common.proto | 285 +- .../cloud/retail/v2/completion_service.proto | 3 +- .../google/cloud/retail/v2/control.proto | 93 + .../cloud/retail/v2/control_service.proto | 185 + .../cloud/retail/v2/import_config.proto | 55 +- .../google/cloud/retail/v2/product.proto | 9 +- .../cloud/retail/v2/product_service.proto | 35 + .../cloud/retail/v2/search_service.proto | 31 +- .../cloud/retail/v2/serving_config.proto | 248 + .../retail/v2/serving_config_service.proto | 240 + .../cloud/retail/v2/user_event_service.proto | 4 +- .../google-cloud-retail/protos/protos.d.ts | 13399 ++++-- packages/google-cloud-retail/protos/protos.js | 35737 ++++++++++------ .../google-cloud-retail/protos/protos.json | 3832 +- .../catalog_service.add_catalog_attribute.js | 68 + .../catalog_service.get_attributes_config.js | 62 + .../catalog_service.get_completion_config.js | 62 + ...atalog_service.remove_catalog_attribute.js | 68 + ...talog_service.replace_catalog_attribute.js | 76 + ...atalog_service.update_attributes_config.js | 70 + ...atalog_service.update_completion_config.js | 78 + .../v2/completion_service.complete_query.js | 3 +- ...mpletion_service.import_completion_data.js | 4 +- .../v2/control_service.create_control.js | 75 + .../v2/control_service.delete_control.js | 62 + .../v2/control_service.get_control.js | 62 + .../v2/control_service.list_controls.js | 82 + .../v2/control_service.update_control.js | 69 + .../v2/product_service.import_products.js | 18 +- .../generated/v2/search_service.search.js | 12 +- .../v2/serving_config_service.add_control.js | 68 + ...ng_config_service.create_serving_config.js | 75 + ...ng_config_service.delete_serving_config.js | 62 + ...rving_config_service.get_serving_config.js | 62 + ...ing_config_service.list_serving_configs.js | 75 + .../serving_config_service.remove_control.js | 68 + ...ng_config_service.update_serving_config.js | 69 + ...ippet_metadata.google.cloud.retail.v2.json | 912 +- .../src/v2/catalog_service_client.ts | 1206 +- .../src/v2/catalog_service_client_config.json | 35 + .../src/v2/catalog_service_proto_list.json | 4 + .../src/v2/completion_service_client.ts | 311 +- .../src/v2/completion_service_proto_list.json | 4 + .../src/v2/control_service_client.ts | 1633 + .../src/v2/control_service_client_config.json | 46 + .../src/v2/control_service_proto_list.json | 19 + .../src/v2/gapic_metadata.json | 226 + packages/google-cloud-retail/src/v2/index.ts | 2 + .../src/v2/prediction_service_client.ts | 293 +- .../src/v2/prediction_service_proto_list.json | 4 + .../src/v2/product_service_client.ts | 426 +- .../src/v2/product_service_proto_list.json | 4 + .../src/v2/search_service_client.ts | 337 +- .../src/v2/search_service_proto_list.json | 4 + .../src/v2/serving_config_service_client.ts | 1824 + .../serving_config_service_client_config.json | 54 + .../v2/serving_config_service_proto_list.json | 19 + .../src/v2/user_event_service_client.ts | 332 +- .../src/v2/user_event_service_proto_list.json | 4 + .../src/v2alpha/catalog_service_client.ts | 60 +- .../src/v2alpha/completion_service_client.ts | 44 +- .../src/v2alpha/control_service_client.ts | 46 +- .../src/v2alpha/model_service_client.ts | 68 +- .../src/v2alpha/prediction_service_client.ts | 33 +- .../src/v2alpha/product_service_client.ts | 125 +- .../src/v2alpha/search_service_client.ts | 38 +- .../v2alpha/serving_config_service_client.ts | 50 +- .../src/v2alpha/user_event_service_client.ts | 68 +- .../src/v2beta/catalog_service_client.ts | 58 +- .../src/v2beta/completion_service_client.ts | 44 +- .../src/v2beta/control_service_client.ts | 46 +- .../src/v2beta/prediction_service_client.ts | 33 +- .../src/v2beta/product_service_client.ts | 114 +- .../src/v2beta/search_service_client.ts | 38 +- .../v2beta/serving_config_service_client.ts | 50 +- .../src/v2beta/user_event_service_client.ts | 68 +- .../test/gapic_catalog_service_v2.ts | 1207 + .../test/gapic_completion_service_v2.ts | 286 + .../test/gapic_control_service_v2.ts | 1936 + .../test/gapic_prediction_service_v2.ts | 286 + .../test/gapic_product_service_v2.ts | 286 + .../test/gapic_search_service_v2.ts | 286 + .../test/gapic_serving_config_service_v2.ts | 2281 + .../test/gapic_user_event_service_v2.ts | 286 + 86 files changed, 53016 insertions(+), 18496 deletions(-) create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/control.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/control_service.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config_service.proto create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.get_attributes_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.get_completion_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.remove_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.replace_catalog_attribute.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.update_attributes_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/catalog_service.update_completion_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/control_service.create_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/control_service.delete_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/control_service.get_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/control_service.list_controls.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/control_service.update_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.add_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.create_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.delete_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.get_serving_config.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.list_serving_configs.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.remove_control.js create mode 100644 packages/google-cloud-retail/samples/generated/v2/serving_config_service.update_serving_config.js create mode 100644 packages/google-cloud-retail/src/v2/control_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/control_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/control_service_proto_list.json create mode 100644 packages/google-cloud-retail/src/v2/serving_config_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2/serving_config_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json create mode 100644 packages/google-cloud-retail/test/gapic_control_service_v2.ts create mode 100644 packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto index 119afaf3697..0e1b85f6af0 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog.proto @@ -18,6 +18,8 @@ package google.cloud.retail.v2; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.proto"; +import "google/cloud/retail/v2/import_config.proto"; option csharp_namespace = "Google.Cloud.Retail.V2"; option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail"; @@ -82,6 +84,244 @@ message ProductLevelConfig { string merchant_center_product_id_field = 2; } +// Catalog level attribute config for an attribute. For example, if customers +// want to enable/disable facet for a specific attribute. +message CatalogAttribute { + // The type of an attribute. + enum AttributeType { + // The type of the attribute is unknown. + // + // Used when type cannot be derived from attribute that is not + // [in_use][google.cloud.retail.v2.CatalogAttribute.in_use]. + UNKNOWN = 0; + + // Textual attribute. + TEXTUAL = 1; + + // Numerical attribute. + NUMERICAL = 2; + } + + // The status of the indexable option of a catalog attribute. + enum IndexableOption { + // Value used when unset. Defaults to + // [INDEXABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED]. + INDEXABLE_OPTION_UNSPECIFIED = 0; + + // Indexable option enabled for an attribute. + INDEXABLE_ENABLED = 1; + + // Indexable option disabled for an attribute. + INDEXABLE_DISABLED = 2; + } + + // The status of the dynamic facetable option of a catalog attribute. + enum DynamicFacetableOption { + // Value used when unset. Defaults to + // [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED]. + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; + + // Dynamic facetable option enabled for an attribute. + DYNAMIC_FACETABLE_ENABLED = 1; + + // Dynamic facetable option disabled for an attribute. + DYNAMIC_FACETABLE_DISABLED = 2; + } + + // The status of the searchable option of a catalog attribute. + enum SearchableOption { + // Value used when unset. Defaults to + // [SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED]. + SEARCHABLE_OPTION_UNSPECIFIED = 0; + + // Searchable option enabled for an attribute. + SEARCHABLE_ENABLED = 1; + + // Searchable option disabled for an attribute. + SEARCHABLE_DISABLED = 2; + } + + // Required. Attribute name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + // To be indexable, the attribute name can contain only alpha-numeric + // characters and underscores. For example, an attribute named + // `attributes.abc_xyz` can be indexed, but an attribute named + // `attributes.abc-xyz` cannot be indexed. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Indicates whether this attribute has been used by any + // products. `True` if at least one [Product][google.cloud.retail.v2.Product] + // is using this attribute in + // [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise, + // this field is `False`. + // + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be + // pre-loaded by using + // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute], + // [CatalogService.ImportCatalogAttributes][], or + // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig] + // APIs. This field is `False` for pre-loaded + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s. + // + // Only pre-loaded + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are + // neither in use by products nor predefined can be deleted. + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are + // either in use by products or are predefined cannot be deleted; however, + // their configuration properties will reset to default values upon removal + // request. + // + // After catalog changes, it takes about 10 minutes for this field to update. + bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of this attribute. This is derived from the attribute + // in [Product.attributes][google.cloud.retail.v2.Product.attributes]. + AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values + // are indexed so that it can be filtered, faceted, or boosted in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + IndexableOption indexable_option = 5; + + // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic + // facet. Could only be DYNAMIC_FACETABLE_DISABLED if + // [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option] + // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. + DynamicFacetableOption dynamic_facetable_option = 6; + + // When + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values + // are searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. + // + // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values + // will not be searchable by text queries in + // [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as + // there are no text values associated to numerical attributes. + SearchableOption searchable_option = 7; +} + +// Catalog level attribute config. +message AttributesConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/AttributesConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }; + + // Required. Immutable. The fully qualified resource name of the attribute + // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Enable attribute(s) config at catalog level. + // For example, indexable, dynamic_facetable, or searchable for each + // attribute. + // + // The key is catalog attribute's name. + // For example: `color`, `brands`, `attributes.custom_attribute`, such as + // `attributes.xyz`. + // + // The maximum number of catalog attributes allowed in a request is 1000. + map catalog_attributes = 2; + + // Output only. The + // [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used + // for this catalog. + AttributeConfigLevel attribute_config_level = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Catalog level autocomplete config for customers to customize autocomplete +// feature's settings. +message CompletionConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/CompletionConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }; + + // Required. Immutable. Fully qualified name + // `projects/*/locations/*/catalogs/*/completionConfig` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Specifies the matching order for autocomplete suggestions, e.g., a query + // consisting of 'sh' with 'out-of-order' specified would suggest "women's + // shoes", whereas a query of 'red s' with 'exact-prefix' specified would + // suggest "red shoes". Currently supported values: + // + // * 'out-of-order' + // * 'exact-prefix' + // + // Default value: 'exact-prefix'. + string matching_order = 2; + + // The maximum number of autocomplete suggestions returned per term. Default + // value is 20. If left unset or set to 0, then will fallback to default + // value. + // + // Value range is 1 to 20. + int32 max_suggestions = 3; + + // The minimum number of characters needed to be typed in order to get + // suggestions. Default value is 2. If left unset or set to 0, then will + // fallback to default value. + // + // Value range is 1 to 20. + int32 min_prefix_length = 4; + + // If set to true, the auto learning function is enabled. Auto learning uses + // user data to generate suggestions using ML techniques. Default value is + // false. Only after enabling auto learning can users use `cloud-retail` + // data in + // [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest]. + bool auto_learning = 11; + + // Output only. The source data for the latest import of the autocomplete + // suggestion phrases. + CompletionDataInputConfig suggestions_input_config = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest suggestion terms + // list import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_suggestions_import_operation = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The source data for the latest import of the autocomplete + // denylist phrases. + CompletionDataInputConfig denylist_input_config = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest denylist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_denylist_import_operation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The source data for the latest import of the autocomplete + // allowlist phrases. + CompletionDataInputConfig allowlist_input_config = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the LRO corresponding to the latest allowlist import. + // + // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to + // retrieve the latest state of the Long Running Operation. + string last_allowlist_import_operation = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + // The catalog configuration. message Catalog { option (google.api.resource) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto index ec7a23a8d66..4d667d1f9e3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/catalog_service.proto @@ -110,6 +110,95 @@ service CatalogService { }; option (google.api.method_signature) = "catalog"; } + + // Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + rpc GetCompletionConfig(GetCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. + rpc UpdateCompletionConfig(UpdateCompletionConfigRequest) + returns (CompletionConfig) { + option (google.api.http) = { + patch: "/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}" + body: "completion_config" + }; + option (google.api.method_signature) = "completion_config,update_mask"; + } + + // Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + rpc GetAttributesConfig(GetAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + // + // The catalog attributes in the request will be updated in the catalog, or + // inserted if they do not exist. Existing catalog attributes not included in + // the request will remain unchanged. Attributes that are assigned to + // products, but do not exist at the catalog level, are always included in the + // response. The product attribute is assigned default values for missing + // catalog attribute fields, e.g., searchable and dynamic facetable options. + rpc UpdateAttributesConfig(UpdateAttributesConfigRequest) + returns (AttributesConfig) { + option (google.api.http) = { + patch: "/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}" + body: "attributes_config" + }; + option (google.api.method_signature) = "attributes_config,update_mask"; + } + + // Adds the specified + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add + // already exists, an ALREADY_EXISTS error is returned. + rpc AddCatalogAttribute(AddCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute" + body: "*" + }; + } + + // Removes the specified + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + // + // If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to + // remove does not exist, a NOT_FOUND error is returned. + rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute" + body: "*" + }; + } + + // Replaces the specified + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the + // catalog attribute with the same + // [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. + // + // If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to + // replace does not exist, a NOT_FOUND error is returned. + rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest) + returns (AttributesConfig) { + option (google.api.http) = { + post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute" + body: "*" + }; + } } // Request for @@ -244,3 +333,144 @@ message GetDefaultBranchResponse { // field, when this branch was set as default. string note = 3; } + +// Request for +// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig] +// method. +message GetCompletionConfigRequest { + // Required. Full CompletionConfig resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/CompletionConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig] +// method. +message UpdateCompletionConfigRequest { + // Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig] + // to update. + // + // If the caller does not have permission to update the + // [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a + // PERMISSION_DENIED error is returned. + // + // If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to + // update does not exist, a NOT_FOUND error is returned. + CompletionConfig completion_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The + // following are the only supported fields: + // + // * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order] + // * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions] + // * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length] + // * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig] +// method. +message GetAttributesConfigRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; +} + +// Request for +// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig] +// method. +message UpdateAttributesConfigRequest { + // Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig] + // to update. + AttributesConfig attributes_config = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The + // following is the only supported field: + // + // * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for +// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute] +// method. +message AddCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] + // to add. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute] +// method. +message RemoveCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The attribute name key of the + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove. + string key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for +// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute] +// method. +message ReplaceCatalogAttributeRequest { + // Required. Full AttributesConfig resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The updated + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]. + CatalogAttribute catalog_attribute = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The + // following are NOT supported: + // + // * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto index 57b054bca81..9864ee7d64f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/common.proto @@ -28,6 +28,283 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2"; option ruby_package = "Google::Cloud::Retail::V2"; +// At which level we offer configuration for attributes. +enum AttributeConfigLevel { + // Value used when unset. In this case, server behavior defaults to + // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; + + // At this level, we honor the attribute configurations set in + // [Product.attributes][google.cloud.retail.v2.Product.attributes]. + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; + + // At this level, we honor the attribute configurations set in + // [CatalogConfig.attribute_configs][]. + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; +} + +// The type of solution. +enum SolutionType { + // Default value. + SOLUTION_TYPE_UNSPECIFIED = 0; + + // Used for Recommendations AI. + SOLUTION_TYPE_RECOMMENDATION = 1; + + // Used for Retail Search. + SOLUTION_TYPE_SEARCH = 2; +} + +// The use case of Cloud Retail Search. +enum SearchSolutionUseCase { + // The value when it's unspecified. In this case, server behavior defaults to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]. + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; + + // Search use case. Expects the traffic has a non-empty + // [query][google.cloud.retail.v2.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_SEARCH = 1; + + // Browse use case. Expects the traffic has an empty + // [query][google.cloud.retail.v2.SearchRequest.query]. + SEARCH_SOLUTION_USE_CASE_BROWSE = 2; +} + +// Metadata that is used to define a condition that triggers an action. +// A valid condition must specify at least one of 'query_terms' or +// 'products_filter'. If multiple fields are specified, the condition is met if +// all the fields are satisfied e.g. if a set of query terms and product_filter +// are set, then only items matching the product_filter for requests with a +// query matching the query terms wil get boosted. +message Condition { + // Query terms that we want to match on. + message QueryTerm { + // The value of the term to match on. + // Value cannot be empty. + // Value can have at most 3 terms if specified as a partial match. Each + // space separated string is considered as one term. + // Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not + // allowed for partial match. + string value = 1; + + // Whether this is supposed to be a full or partial match. + bool full_match = 2; + } + + // Used for time-dependent conditions. + // Example: Want to have rule applied for week long sale. + message TimeRange { + // Start of time range. Range is inclusive. + google.protobuf.Timestamp start_time = 1; + + // End of time range. Range is inclusive. + google.protobuf.Timestamp end_time = 2; + } + + // A list (up to 10 entries) of terms to match the query on. If not + // specified, match all queries. + // If many query terms are specified, the condition + // is matched if any of the terms is a match (i.e. using the OR operator). + repeated QueryTerm query_terms = 1; + + // Range of time(s) specifying when Condition is active. + // Condition true if any time range matches. + repeated TimeRange active_time_range = 3; +} + +// A rule is a condition-action pair +// * A condition defines when a rule is to be triggered. +// * An action specifies what occurs on that trigger. +// Currently rules only work for [controls][google.cloud.retail.v2.Control] with +// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]. +message Rule { + // A boost action to apply to results matching condition specified above. + message BoostAction { + // Strength of the condition boost, which must be in [-1, 1]. Negative + // boost means demotion. Default is 0.0. + // + // Setting to 1.0 gives the item a big promotion. However, it does not + // necessarily mean that the boosted item will be the top result at all + // times, nor that other items will be excluded. Results could still be + // shown even when none of them matches the condition. And results that + // are significantly more relevant to the search query can still trump + // your heavily favored but irrelevant items. + // + // Setting to -1.0 gives the item a big demotion. However, results that + // are deeply relevant might still be shown. The item will have an + // upstream battle to get a fairly high ranking, but it is not blocked out + // completely. + // + // Setting to 0.0 means no boost applied. The boosting condition is + // ignored. + float boost = 1; + + // The filter can have a max size of 5000 characters. + // An expression which specifies which products to apply an action to. + // The syntax and supported fields are the same as a filter expression. See + // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for + // detail syntax and limitations. + // + // Examples: + // + // * To boost products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string products_filter = 2; + } + + // * Rule Condition: + // - No + // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] + // provided is a global match. + // - 1 or more + // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] + // provided are combined with OR operator. + // * Action Input: The request query and filter that are applied to the + // retrieved products, in addition to any filters already provided with the + // SearchRequest. The AND operator is used to combine the query's existing + // filters with the filter rule(s). NOTE: May result in 0 results when + // filters conflict. + // * Action Result: Filters the returned objects to be ONLY those that passed + // the filter. + message FilterAction { + // A filter to apply on the matching condition results. Supported features: + // + // * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set. + // * Filter syntax is identical to + // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See + // more + // details at the Retail Search + // [user guide](/retail/search/docs/filter-and-order#filter). + // * To filter products with product ID "product_1" or "product_2", and + // color + // "Red" or "Blue":
+ // *(id: ANY("product_1", "product_2"))
* + // *AND
* + // *(colorFamilies: ANY("Red", "Blue"))
* + string filter = 1; + } + + // Redirects a shopper to a specific page. + // + // * Rule Condition: + // - Must specify + // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]. + // * Action Input: Request Query + // * Action Result: Redirects shopper to provided uri. + message RedirectAction { + // URL must have length equal or less than 2000 characters. + string redirect_uri = 1; + } + + // Creates a set of terms that will be treated as synonyms of each other. + // Example: synonyms of "sneakers" and "shoes". + // * "sneakers" will use a synonym of "shoes". + // * "shoes" will use a synonym of "sneakers". + message TwowaySynonymsAction { + // Defines a set of synonyms. + // Can specify up to 100 synonyms. + // Must specify at least 2 synonyms. + repeated string synonyms = 1; + } + + // Maps a set of terms to a set of synonyms. + // Set of synonyms will be treated as synonyms of each query term only. + // `query_terms` will not be treated as synonyms of each other. + // Example: "sneakers" will use a synonym of "shoes". + // "shoes" will not use a synonym of "sneakers". + message OnewaySynonymsAction { + // Terms from the search query. + // Will treat synonyms as their synonyms. + // Not themselves synonyms of the synonyms. + // Can specify up to 100 terms. + repeated string query_terms = 3; + + // Defines a set of synonyms. + // Cannot contain duplicates. + // Can specify up to 100 synonyms. + repeated string synonyms = 4; + + // Will be [deprecated = true] post migration; + repeated string oneway_terms = 2; + } + + // Prevents `query_term` from being associated with specified terms during + // search. + // Example: Don't associate "gShoe" and "cheap". + message DoNotAssociateAction { + // Terms from the search query. + // Will not consider do_not_associate_terms for search if in search query. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Cannot contain duplicates or the query term. + // Can specify up to 100 terms. + repeated string do_not_associate_terms = 3; + + // Will be [deprecated = true] post migration; + repeated string terms = 1; + } + + // Replaces a term in the query. Multiple replacement candidates can be + // specified. All `query_terms` will be replaced with the replacement term. + // Example: Replace "gShoe" with "google shoe". + message ReplacementAction { + // Terms from the search query. + // Will be replaced by replacement term. + // Can specify up to 100 terms. + repeated string query_terms = 2; + + // Term that will be used for replacement. + string replacement_term = 3; + + // Will be [deprecated = true] post migration; + string term = 1; + } + + // Prevents a term in the query from being used in search. + // Example: Don't search for "shoddy". + message IgnoreAction { + // Terms to ignore in the search query. + repeated string ignore_terms = 1; + } + + // An action must be provided. + oneof action { + // A boost action. + BoostAction boost_action = 2; + + // Redirects a shopper to a specific page. + RedirectAction redirect_action = 3; + + // Treats specific term as a synonym with a group of terms. + // Group of terms will not be treated as synonyms with the specific term. + OnewaySynonymsAction oneway_synonyms_action = 6; + + // Prevents term from being associated with other terms. + DoNotAssociateAction do_not_associate_action = 7; + + // Replaces specific terms in the query. + ReplacementAction replacement_action = 8; + + // Ignores specific terms from query during search. + IgnoreAction ignore_action = 9; + + // Filters results. + FilterAction filter_action = 10; + + // Treats a set of terms as synonyms of one another. + TwowaySynonymsAction twoway_synonyms_action = 11; + } + + // Required. The condition that triggers the rule. + // If the condition is empty, the rule will always apply. + Condition condition = 1 [(google.api.field_behavior) = REQUIRED]; +} + // An intended audience of the [Product][google.cloud.retail.v2.Product] for // whom it's sold. message Audience { @@ -116,8 +393,8 @@ message CustomAttribute { repeated double numbers = 2; // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level // attribute configuration, see [Configuration // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). @@ -131,8 +408,8 @@ message CustomAttribute { optional bool searchable = 3 [deprecated = true]; // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level] + // of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level // attribute configuration, see [Configuration // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto index 14cb26d760f..af0fac87e79 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/completion_service.proto @@ -142,7 +142,8 @@ message CompleteQueryRequest { string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback - // to the configured value [CompletionConfig.max_suggestions][]. + // to the configured value + // [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. // // The maximum allowed max suggestions is 20. If it is set higher, it will be // capped by 20. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/control.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/control.proto new file mode 100644 index 00000000000..5558e44dd8c --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/control.proto @@ -0,0 +1,93 @@ +// Copyright 2021 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/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.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 = "ControlProto"; +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 dynamic metadata that can be linked to a +// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or +// recommendation results at serving time. +message Control { + option (google.api.resource) = { + type: "retail.googleapis.com/Control" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }; + + // The behavior/type of the control + // + // A behavior/type must be specified on creation. Type cannot be changed once + // specified (e.g. A Rule control will always be a Rule control.). An + // INVALID_ARGUMENT will be returned if either condition is violated. + oneof control { + // A rule control - a condition-action pair. + // Enacts a set action when the condition is triggered. + // For example: Boost "gShoe" when query full matches "Running Shoes". + Rule rule = 4; + } + + // Immutable. Fully qualified name + // `projects/*/locations/global/catalogs/*/controls/*` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable control display name. Used in Retail UI. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is thrown. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. List of [serving + // configuration][google.cloud.retail.v2.ServingConfig] ids that are + // associated with this control in the same + // [Catalog][google.cloud.retail.v2.Catalog]. + // + // Note the association is managed via the + // [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output + // only denormalized view. + repeated string associated_serving_config_ids = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The solution types that the control is used for. + // Currently we support setting only one type of solution at creation time. + // + // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. + // If no solution type is provided at creation time, will default to + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated SolutionType solution_types = 6 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Specifies the use case for the control. + // Affects what condition fields can be set. + // Only settable by search controls. + // Will default to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH] + // if not specified. Currently only allow one search_solution_use_case per + // control. + repeated SearchSolutionUseCase search_solution_use_case = 7; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/control_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/control_service.proto new file mode 100644 index 00000000000..24e8c1c4464 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/control_service.proto @@ -0,0 +1,185 @@ +// Copyright 2021 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/control.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 = "ControlServiceProto"; +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 modifying Control. +service ControlService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Control. + // + // If the [Control][google.cloud.retail.v2.Control] to create already exists, + // an ALREADY_EXISTS error is returned. + rpc CreateControl(CreateControlRequest) returns (Control) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/controls" + body: "control" + }; + option (google.api.method_signature) = "parent,control,control_id"; + } + + // Deletes a Control. + // + // If the [Control][google.cloud.retail.v2.Control] to delete does not exist, + // a NOT_FOUND error is returned. + rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a Control. + // + // [Control][google.cloud.retail.v2.Control] cannot be set to a different + // oneof field, if so an INVALID_ARGUMENT is returned. If the + // [Control][google.cloud.retail.v2.Control] to update does not exist, a + // NOT_FOUND error is returned. + rpc UpdateControl(UpdateControlRequest) returns (Control) { + option (google.api.http) = { + patch: "/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}" + body: "control" + }; + option (google.api.method_signature) = "control,update_mask"; + } + + // Gets a Control. + rpc GetControl(GetControlRequest) returns (Control) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all Controls by their parent + // [Catalog][google.cloud.retail.v2.Catalog]. + rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/catalogs/*}/controls" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for CreateControl method. +message CreateControlRequest { + // Required. Full resource name of parent catalog. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The Control to create. + Control control = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the Control, which will become the final + // component of the Control's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string control_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateControl method. +message UpdateControlRequest { + // Required. The Control to update. + Control control = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [Control][google.cloud.retail.v2.Control] to update. The following are NOT + // supported: + // + // * [Control.name][google.cloud.retail.v2.Control.name] + // + // If not set or empty, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteControl method. +message DeleteControlRequest { + // Required. The resource name of the Control to delete. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for GetControl method. +message GetControlRequest { + // Required. The resource name of the Control to get. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } + ]; +} + +// Request for ListControls method. +message ListControlsRequest { + // Required. The catalog resource name. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 50. Max allowed value is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListControls` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter to apply on the list results. Supported features: + // + // * List all the products under the parent branch if + // [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset. + // * List controls that are used in a single ServingConfig: + // 'serving_config = "boosted_home_page_cvr"' + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListControls method. +message ListControlsResponse { + // All the Controls for a given catalog. + repeated Control controls = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto index cadec119405..23b06369206 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/import_config.proto @@ -35,7 +35,6 @@ 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, @@ -66,11 +65,13 @@ message GcsSource { // // Supported values for control imports: // - // * 'control' (default): One JSON [Control][] per line. + // * `control` (default): One JSON [Control][google.cloud.retail.v2.Control] + // per line. // // Supported values for catalog attribute imports: // - // * 'catalog_attribute' (default): One CSV [CatalogAttribute][] per line. + // * `catalog_attribute` (default): One CSV + // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line. string data_schema = 2; } @@ -81,9 +82,8 @@ message BigQuerySource { oneof partition { // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. + // Only supported in + // [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. google.type.Date partition_date = 6; } @@ -122,8 +122,7 @@ message BigQuerySource { // * `user_event_ga360`: // The schema is available here: // https://support.google.com/analytics/answer/3437719. - // * `user_event_ga4`: This feature is in private preview. Please contact the - // support team for importing Google Analytics 4 events. + // * `user_event_ga4`: // The schema is available here: // https://support.google.com/analytics/answer/7029846. // @@ -154,7 +153,7 @@ message ImportErrorsConfig { // Required. Errors destination. oneof destination { // Google Cloud Storage prefix for import errors. This must be an empty, - // existing Cloud Storage directory. Import errors will be written to + // existing Cloud Storage directory. Import errors are written to // sharded files in this directory, one per line, as a JSON-encoded // `google.rpc.Status` message. string gcs_prefix = 1; @@ -174,15 +173,6 @@ message ImportProductsRequest { // Calculates diff and replaces the entire product dataset. Existing // products may be deleted if they are not present in the source location. - // - // Can only be set while using - // [BigQuerySource][google.cloud.retail.v2.BigQuerySource]. And the BigQuery - // dataset must be created in the data location "us (multiple regions in - // United States)", otherwise a PERMISSION_DENIED error is thrown. - // - // Add the IAM permission "BigQuery Data Viewer" for - // cloud-retail-customer-data-access@system.gserviceaccount.com before - // using this feature otherwise an error is thrown. FULL = 2; } @@ -205,8 +195,8 @@ message ImportProductsRequest { // 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. + // Indicates which fields in the provided imported `products` to update. If + // not set, all fields are updated. google.protobuf.FieldMask update_mask = 4; // The mode of reconciliation between existing products and the products to be @@ -215,21 +205,16 @@ message ImportProductsRequest { ReconciliationMode reconciliation_mode = 5; // Full Pub/Sub topic name for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has // to be within the same project as // [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent]. - // Make sure that both - // `cloud-retail-customer-data-access@system.gserviceaccount.com` and - // `service-@gcp-sa-retail.iam.gserviceaccount.com` - // have the `pubsub.topics.publish` IAM permission on the topic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. + // Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + // `pubsub.topics.publish` IAM permission on the topic. string notification_pubsub_topic = 7; } @@ -265,8 +250,8 @@ message ImportCompletionDataRequest { [(google.api.field_behavior) = REQUIRED]; // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. string notification_pubsub_topic = 3; @@ -326,7 +311,7 @@ message CompletionDataInputConfig { } } -// Metadata related to the progress of the Import operation. This will be +// Metadata related to the progress of the Import operation. This is // returned by the google.longrunning.Operation.metadata field. message ImportMetadata { // Operation create time. @@ -346,8 +331,8 @@ message ImportMetadata { string request_id = 5 [deprecated = true]; // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. string notification_pubsub_topic = 6; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto index 43443295317..fe5d212cf07 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product.proto @@ -194,7 +194,7 @@ message Product { // Non-existent product ids are allowed. // The [type][google.cloud.retail.v2.Product.type] of the members must be // either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or - // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise and + // [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an // INVALID_ARGUMENT error is thrown. Should not set it for other types. A // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is // return. @@ -555,4 +555,11 @@ message Product { // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]. // Do not set this field in API requests. repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A list of local inventories specific to different places. + // + // This is only available for users who have Retail Search enabled, and it can + // be managed by [AddLocalInventories][] and [RemoveLocalInventories][] APIs. + repeated LocalInventory local_inventories = 35 + [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto index e278d81e331..5ca2cb32696 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/product_service.proto @@ -146,6 +146,13 @@ service ProductService { // and // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { @@ -173,6 +180,13 @@ service ProductService { // or // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) @@ -201,6 +215,13 @@ service ProductService { // or // [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) @@ -236,6 +257,13 @@ service ProductService { // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] // has no effect on local inventories. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc AddLocalInventories(AddLocalInventoriesRequest) @@ -269,6 +297,13 @@ service ProductService { // [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] // has no effect on local inventories. // + // The returned [Operation][]s will be obsolete after 1 day, and + // [GetOperation][] API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the [Operation][]s associated with the + // stale updates will not be marked as [done][Operation.done] until being + // obsolete. + // // This feature is only available for users who have Retail Search enabled. // Please enable Retail Search on Cloud Console before using this feature. rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto index 4e666281700..32de76da6f3 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/search_service.proto @@ -394,7 +394,8 @@ message SearchRequest { // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; - // Let CRS decide whether to use personalization. + // Let CRS decide whether to use personalization based on quality of user + // event data. AUTO = 1; // Disable personalization. @@ -578,7 +579,9 @@ message SearchRequest { // Boost specification to boost certain products. See more details at this // [user guide](https://cloud.google.com/retail/docs/boosting). // - // Notice that if both [ServingConfig.boost_control_ids][] and + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids] + // and // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] // are set, the boost conditions from both places are evaluated. If a search // request matches multiple boost conditions, the final boost score is equal @@ -681,6 +684,15 @@ message SearchRequest { SearchMode search_mode = 31; // The specification for personalization. + // + // Notice that if both + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec] + // and + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // are set. + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // will override + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]. PersonalizationSpec personalization_spec = 32; // The labels applied to a resource must meet the following requirements: @@ -782,6 +794,21 @@ message SearchResponse { // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; + + // Specifies previous events related to this product for this user based on + // [UserEvent][google.cloud.retail.v2.UserEvent] with same + // [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id] + // or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id]. + // + // This is set only when + // [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode] + // is + // [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]. + // + // Possible values: + // + // * `purchased`: Indicates that this product has been purchased before. + repeated string personal_labels = 7; } // A facet result. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config.proto new file mode 100644 index 00000000000..45f317d63b8 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config.proto @@ -0,0 +1,248 @@ +// Copyright 2021 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/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2/common.proto"; +import "google/cloud/retail/v2/search_service.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 = "ServingConfigProto"; +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 metadata that is used to generate serving time results (e.g. +// search results or recommendation predictions). +message ServingConfig { + option (google.api.resource) = { + type: "retail.googleapis.com/ServingConfig" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" + }; + + // Immutable. Fully qualified name + // `projects/*/locations/global/catalogs/*/servingConfig/*` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. The human readable serving config display name. Used in Retail + // UI. + // + // 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]; + + // The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog] + // to use at serving time. Currently only RecommendationModels are supported: + // https://cloud.google.com/retail/recommendations-ai/docs/create-models + // Can be changed but only to a compatible model (e.g. + // others-you-may-like CTR to others-you-may-like CVR). + // + // Required when + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string model_id = 3; + + // How much price ranking we want in serving results. + // Price reranking causes product items with a similar + // recommendation probability to be ordered by price, with the + // highest-priced items first. This setting could result in a decrease in + // click-through and conversion rates. + // Allowed values are: + // + // * 'no-price-reranking' + // * 'low-price-raranking' + // * 'medium-price-reranking' + // * 'high-price-reranking' + // + // If not specified, we choose default based on model type. Default value: + // 'no-price-reranking'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string price_reranking_level = 4; + + // Facet specifications for faceted search. If empty, no facets are returned. + // The ids refer to the ids of [Control][google.cloud.retail.v2.Control] + // resources with only the Facet control set. These controls are assumed to be + // in the same [Catalog][google.cloud.retail.v2.Catalog] as the + // [ServingConfig][google.cloud.retail.v2.ServingConfig]. + // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + // is returned. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string facet_control_ids = 5; + + // The specification for dynamically generated facets. Notice that only + // textual facets can be dynamically generated. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; + + // Condition boost specifications. If a product matches multiple conditions + // in the specifications, boost scores from these specifications are all + // applied and combined in a non-linear way. Maximum number of + // specifications is 100. + // + // Notice that if both + // [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids] + // and + // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string boost_control_ids = 7; + + // Condition filter specifications. If a product matches multiple conditions + // in the specifications, filters from these specifications are all + // applied and combined via the AND operator. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string filter_control_ids = 9; + + // Condition redirect specifications. Only the first triggered redirect action + // is applied, even if multiple apply. Maximum number of specifications is + // 1000. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string redirect_control_ids = 10; + + // Condition synonyms specifications. If multiple syonyms conditions match, + // all matching synonyms control in the list will execute. Order of controls + // in the list will not matter. Maximum number of specifications is + // 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string twoway_synonyms_control_ids = 18; + + // Condition oneway synonyms specifications. If multiple oneway synonyms + // conditions match, all matching oneway synonyms controls in the list will + // execute. Order of controls in the list will not matter. Maximum number of + // specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string oneway_synonyms_control_ids = 12; + + // Condition do not associate specifications. If multiple do not associate + // conditions match, all matching do not associate controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string do_not_associate_control_ids = 13; + + // Condition replacement specifications. + // - Applied according to the order in the list. + // - A previously replaced term can not be re-replaced. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string replacement_control_ids = 14; + + // Condition ignore specifications. If multiple ignore + // conditions match, all matching ignore controls in the list will + // execute. + // - Order does not matter. + // - Maximum number of specifications is 100. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + repeated string ignore_control_ids = 15; + + // How much diversity to use in recommendation model results e.g. + // 'medium-diversity' or 'high-diversity'. Currently supported values: + // + // * 'no-diversity' + // * 'low-diversity' + // * 'medium-diversity' + // * 'high-diversity' + // * 'auto-diversity' + // + // If not specified, we choose default based on recommendation model + // type. Default value: 'no-diversity'. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string diversity_level = 8; + + // Whether to add additional category filters on the 'similar-items' model. + // If not specified, we enable it by default. + // Allowed values are: + // + // * 'no-category-match': No additional filtering of original results from + // the model and the customer's filters. + // * 'relaxed-category-match': Only keep results with categories that match + // at least one item categories in the PredictRequests's context item. + // * If customer also sends filters in the PredictRequest, then the results + // will satisfy both conditions (user given and category match). + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. + string enable_category_filter_level = 16; + + // The specification for personalization spec. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + // + // Notice that if both + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec] + // and + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // are set. + // [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec] + // will override + // [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]. + SearchRequest.PersonalizationSpec personalization_spec = 21; + + // Required. Immutable. Specifies the solution types that a serving config can + // be associated with. Currently we support setting only one type of solution. + repeated SolutionType solution_types = 19 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config_service.proto new file mode 100644 index 00000000000..a4cabe26ba2 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/serving_config_service.proto @@ -0,0 +1,240 @@ +// Copyright 2021 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/serving_config.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 = "ServingConfigServiceProto"; +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 modifying ServingConfig. +service ServingConfigService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a ServingConfig. + // + // A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are + // allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a + // FAILED_PRECONDITION error is returned. + rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + body: "serving_config" + }; + option (google.api.method_signature) = + "parent,serving_config,serving_config_id"; + } + + // Deletes a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc DeleteServingConfig(DeleteServingConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a ServingConfig. + rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + patch: "/v2/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + body: "serving_config" + }; + option (google.api.method_signature) = "serving_config,update_mask"; + } + + // Gets a ServingConfig. + // + // Returns a NotFound error if the ServingConfig does not exist. + rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all ServingConfigs linked to this catalog. + rpc ListServingConfigs(ListServingConfigsRequest) + returns (ListServingConfigsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Enables a Control on the specified ServingConfig. + // The control is added in the last position of the list of controls + // it belongs to (e.g. if it's a facet spec control it will be applied + // in the last position of servingConfig.facetSpecIds) + // Returns a ALREADY_EXISTS error if the control has already been applied. + // Returns a FAILED_PRECONDITION error if the addition could exceed maximum + // number of control allowed for that type of control. + rpc AddControl(AddControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } + + // Disables a Control on the specified ServingConfig. + // The control is removed from the ServingConfig. + // Returns a NOT_FOUND error if the Control is not enabled for the + // ServingConfig. + rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { + option (google.api.http) = { + post: "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" + body: "*" + }; + option (google.api.method_signature) = "serving_config"; + } +} + +// Request for CreateServingConfig method. +message CreateServingConfigRequest { + // Required. Full resource name of parent. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The ServingConfig to create. + ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the ServingConfig, which will become the final + // component of the ServingConfig's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-_/. + string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateServingConfig method. +message UpdateServingConfigRequest { + // Required. The ServingConfig to update. + ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates which fields in the provided + // [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The + // following are NOT supported: + // + // * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name] + // + // If not set, all supported fields are updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for DeleteServingConfig method. +message DeleteServingConfigRequest { + // Required. The resource name of the ServingConfig to delete. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for GetServingConfig method. +message GetServingConfigRequest { + // Required. The resource name of the ServingConfig to get. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; +} + +// Request for ListServingConfigs method. +message ListServingConfigsRequest { + // Required. The catalog resource name. Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 100. If a value greater than 100 is provided, at most 100 results are + // returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListServingConfigs` call. + // Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListServingConfigs method. +message ListServingConfigsResponse { + // All the ServingConfigs for a given catalog. + repeated ServingConfig serving_configs = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} + +// Request for AddControl method. +message AddControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config - if id is not found a NOT_FOUND error is returned. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for RemoveControl method. +message RemoveControlRequest { + // Required. The source ServingConfig resource name . Format: + // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + string serving_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/ServingConfig" + } + ]; + + // Required. The id of the control to apply. Assumed to be in the same catalog + // as the serving config. + string control_id = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto index 1b0c190df16..9a917bc6c6c 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2/user_event_service.proto @@ -79,9 +79,9 @@ service UserEventService { // 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 + // `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. + // `Operation.metadata` is of type `ImportMetadata`. rpc ImportUserEvents(ImportUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 6988d8a3c23..27ef12657a8 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -129,2102 +129,5794 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a Catalog. */ - interface ICatalog { + /** Properties of a CatalogAttribute. */ + interface ICatalogAttribute { - /** Catalog name */ - name?: (string|null); + /** CatalogAttribute key */ + key?: (string|null); - /** Catalog displayName */ - displayName?: (string|null); + /** CatalogAttribute inUse */ + inUse?: (boolean|null); - /** Catalog productLevelConfig */ - productLevelConfig?: (google.cloud.retail.v2.IProductLevelConfig|null); + /** CatalogAttribute type */ + type?: (google.cloud.retail.v2.CatalogAttribute.AttributeType|keyof typeof google.cloud.retail.v2.CatalogAttribute.AttributeType|null); + + /** CatalogAttribute indexableOption */ + indexableOption?: (google.cloud.retail.v2.CatalogAttribute.IndexableOption|keyof typeof google.cloud.retail.v2.CatalogAttribute.IndexableOption|null); + + /** CatalogAttribute dynamicFacetableOption */ + dynamicFacetableOption?: (google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption|keyof typeof google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption|null); + + /** CatalogAttribute searchableOption */ + searchableOption?: (google.cloud.retail.v2.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2.CatalogAttribute.SearchableOption|null); } - /** Represents a Catalog. */ - class Catalog implements ICatalog { + /** Represents a CatalogAttribute. */ + class CatalogAttribute implements ICatalogAttribute { /** - * Constructs a new Catalog. + * Constructs a new CatalogAttribute. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICatalog); + constructor(properties?: google.cloud.retail.v2.ICatalogAttribute); - /** Catalog name. */ - public name: string; + /** CatalogAttribute key. */ + public key: string; - /** Catalog displayName. */ - public displayName: string; + /** CatalogAttribute inUse. */ + public inUse: boolean; - /** Catalog productLevelConfig. */ - public productLevelConfig?: (google.cloud.retail.v2.IProductLevelConfig|null); + /** CatalogAttribute type. */ + public type: (google.cloud.retail.v2.CatalogAttribute.AttributeType|keyof typeof google.cloud.retail.v2.CatalogAttribute.AttributeType); + + /** CatalogAttribute indexableOption. */ + public indexableOption: (google.cloud.retail.v2.CatalogAttribute.IndexableOption|keyof typeof google.cloud.retail.v2.CatalogAttribute.IndexableOption); + + /** CatalogAttribute dynamicFacetableOption. */ + public dynamicFacetableOption: (google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption|keyof typeof google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption); + + /** CatalogAttribute searchableOption. */ + public searchableOption: (google.cloud.retail.v2.CatalogAttribute.SearchableOption|keyof typeof google.cloud.retail.v2.CatalogAttribute.SearchableOption); /** - * Creates a new Catalog instance using the specified properties. + * Creates a new CatalogAttribute instance using the specified properties. * @param [properties] Properties to set - * @returns Catalog instance + * @returns CatalogAttribute instance */ - public static create(properties?: google.cloud.retail.v2.ICatalog): google.cloud.retail.v2.Catalog; + public static create(properties?: google.cloud.retail.v2.ICatalogAttribute): google.cloud.retail.v2.CatalogAttribute; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified CatalogAttribute message. Does not implicitly {@link google.cloud.retail.v2.CatalogAttribute.verify|verify} messages. + * @param message CatalogAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICatalogAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. - * @param message Catalog message or plain object to encode + * Encodes the specified CatalogAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CatalogAttribute.verify|verify} messages. + * @param message CatalogAttribute message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICatalogAttribute, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a CatalogAttribute message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Catalog + * @returns CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Catalog; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CatalogAttribute; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a CatalogAttribute message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Catalog + * @returns CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Catalog; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CatalogAttribute; /** - * Verifies a Catalog message. + * Verifies a CatalogAttribute message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a CatalogAttribute message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Catalog + * @returns CatalogAttribute */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Catalog; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CatalogAttribute; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. - * @param message Catalog + * Creates a plain object from a CatalogAttribute message. Also converts values to other types if specified. + * @param message CatalogAttribute * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CatalogAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Catalog to JSON. + * Converts this CatalogAttribute to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Catalog + * Gets the default type url for CatalogAttribute * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Represents a CatalogService */ - class CatalogService extends $protobuf.rpc.Service { + namespace CatalogAttribute { - /** - * Constructs a new CatalogService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** AttributeType enum. */ + enum AttributeType { + UNKNOWN = 0, + TEXTUAL = 1, + NUMERICAL = 2 + } - /** - * Creates new CatalogService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; + /** IndexableOption enum. */ + enum IndexableOption { + INDEXABLE_OPTION_UNSPECIFIED = 0, + INDEXABLE_ENABLED = 1, + INDEXABLE_DISABLED = 2 + } - /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse - */ - public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; + /** DynamicFacetableOption enum. */ + enum DynamicFacetableOption { + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0, + DYNAMIC_FACETABLE_ENABLED = 1, + DYNAMIC_FACETABLE_DISABLED = 2 + } + + /** SearchableOption enum. */ + enum SearchableOption { + SEARCHABLE_OPTION_UNSPECIFIED = 0, + SEARCHABLE_ENABLED = 1, + SEARCHABLE_DISABLED = 2 + } + } + + /** Properties of an AttributesConfig. */ + interface IAttributesConfig { + + /** AttributesConfig name */ + name?: (string|null); + + /** AttributesConfig catalogAttributes */ + catalogAttributes?: ({ [k: string]: google.cloud.retail.v2.ICatalogAttribute }|null); + + /** AttributesConfig attributeConfigLevel */ + attributeConfigLevel?: (google.cloud.retail.v2.AttributeConfigLevel|keyof typeof google.cloud.retail.v2.AttributeConfigLevel|null); + } + + /** Represents an AttributesConfig. */ + class AttributesConfig implements IAttributesConfig { /** - * Calls ListCatalogs. - * @param request ListCatalogsRequest message or plain object - * @returns Promise + * Constructs a new AttributesConfig. + * @param [properties] Properties to set */ - public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; + constructor(properties?: google.cloud.retail.v2.IAttributesConfig); + + /** AttributesConfig name. */ + public name: string; + + /** AttributesConfig catalogAttributes. */ + public catalogAttributes: { [k: string]: google.cloud.retail.v2.ICatalogAttribute }; + + /** AttributesConfig attributeConfigLevel. */ + public attributeConfigLevel: (google.cloud.retail.v2.AttributeConfigLevel|keyof typeof google.cloud.retail.v2.AttributeConfigLevel); /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Catalog + * Creates a new AttributesConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AttributesConfig instance */ - public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; + public static create(properties?: google.cloud.retail.v2.IAttributesConfig): google.cloud.retail.v2.AttributesConfig; /** - * Calls UpdateCatalog. - * @param request UpdateCatalogRequest message or plain object - * @returns Promise + * Encodes the specified AttributesConfig message. Does not implicitly {@link google.cloud.retail.v2.AttributesConfig.verify|verify} messages. + * @param message AttributesConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; + public static encode(message: google.cloud.retail.v2.IAttributesConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty + * Encodes the specified AttributesConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AttributesConfig.verify|verify} messages. + * @param message AttributesConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback): void; + public static encodeDelimited(message: google.cloud.retail.v2.IAttributesConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls SetDefaultBranch. - * @param request SetDefaultBranchRequest message or plain object - * @returns Promise + * Decodes an AttributesConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AttributesConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest): Promise; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AttributesConfig; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * Decodes an AttributesConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AttributesConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback): void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AttributesConfig; /** - * Calls GetDefaultBranch. - * @param request GetDefaultBranchRequest message or plain object - * @returns Promise + * Verifies an AttributesConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest): Promise; - } - - namespace CatalogService { + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|listCatalogs}. - * @param error Error, if any - * @param [response] ListCatalogsResponse + * Creates an AttributesConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AttributesConfig */ - type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AttributesConfig; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCatalog}. - * @param error Error, if any - * @param [response] Catalog + * Creates a plain object from an AttributesConfig message. Also converts values to other types if specified. + * @param message AttributesConfig + * @param [options] Conversion options + * @returns Plain object */ - type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; + public static toObject(message: google.cloud.retail.v2.AttributesConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|setDefaultBranch}. - * @param error Error, if any - * @param [response] Empty + * Converts this AttributesConfig to JSON. + * @returns JSON object */ - type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + public toJSON(): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|getDefaultBranch}. - * @param error Error, if any - * @param [response] GetDefaultBranchResponse + * Gets the default type url for AttributesConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url */ - type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2.GetDefaultBranchResponse) => void; + public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ListCatalogsRequest. */ - interface IListCatalogsRequest { + /** Properties of a CompletionConfig. */ + interface ICompletionConfig { - /** ListCatalogsRequest parent */ - parent?: (string|null); + /** CompletionConfig name */ + name?: (string|null); - /** ListCatalogsRequest pageSize */ - pageSize?: (number|null); + /** CompletionConfig matchingOrder */ + matchingOrder?: (string|null); - /** ListCatalogsRequest pageToken */ - pageToken?: (string|null); + /** CompletionConfig maxSuggestions */ + maxSuggestions?: (number|null); + + /** CompletionConfig minPrefixLength */ + minPrefixLength?: (number|null); + + /** CompletionConfig autoLearning */ + autoLearning?: (boolean|null); + + /** CompletionConfig suggestionsInputConfig */ + suggestionsInputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** CompletionConfig lastSuggestionsImportOperation */ + lastSuggestionsImportOperation?: (string|null); + + /** CompletionConfig denylistInputConfig */ + denylistInputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** CompletionConfig lastDenylistImportOperation */ + lastDenylistImportOperation?: (string|null); + + /** CompletionConfig allowlistInputConfig */ + allowlistInputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** CompletionConfig lastAllowlistImportOperation */ + lastAllowlistImportOperation?: (string|null); } - /** Represents a ListCatalogsRequest. */ - class ListCatalogsRequest implements IListCatalogsRequest { + /** Represents a CompletionConfig. */ + class CompletionConfig implements ICompletionConfig { /** - * Constructs a new ListCatalogsRequest. + * Constructs a new CompletionConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); + constructor(properties?: google.cloud.retail.v2.ICompletionConfig); - /** ListCatalogsRequest parent. */ - public parent: string; + /** CompletionConfig name. */ + public name: string; - /** ListCatalogsRequest pageSize. */ - public pageSize: number; + /** CompletionConfig matchingOrder. */ + public matchingOrder: string; - /** ListCatalogsRequest pageToken. */ - public pageToken: string; + /** CompletionConfig maxSuggestions. */ + public maxSuggestions: number; + + /** CompletionConfig minPrefixLength. */ + public minPrefixLength: number; + + /** CompletionConfig autoLearning. */ + public autoLearning: boolean; + + /** CompletionConfig suggestionsInputConfig. */ + public suggestionsInputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** CompletionConfig lastSuggestionsImportOperation. */ + public lastSuggestionsImportOperation: string; + + /** CompletionConfig denylistInputConfig. */ + public denylistInputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** CompletionConfig lastDenylistImportOperation. */ + public lastDenylistImportOperation: string; + + /** CompletionConfig allowlistInputConfig. */ + public allowlistInputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** CompletionConfig lastAllowlistImportOperation. */ + public lastAllowlistImportOperation: string; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new CompletionConfig instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsRequest instance + * @returns CompletionConfig instance */ - public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; + public static create(properties?: google.cloud.retail.v2.ICompletionConfig): google.cloud.retail.v2.CompletionConfig; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified CompletionConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionConfig.verify|verify} messages. + * @param message CompletionConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompletionConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. - * @param message ListCatalogsRequest message or plain object to encode + * Encodes the specified CompletionConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionConfig.verify|verify} messages. + * @param message CompletionConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes a CompletionConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsRequest + * @returns CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionConfig; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes a CompletionConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsRequest + * @returns CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionConfig; /** - * Verifies a ListCatalogsRequest message. + * Verifies a CompletionConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsRequest + * @returns CompletionConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionConfig; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. - * @param message ListCatalogsRequest + * Creates a plain object from a CompletionConfig message. Also converts values to other types if specified. + * @param message CompletionConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompletionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this CompletionConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ListCatalogsRequest + * Gets the default type url for CompletionConfig * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ListCatalogsResponse. */ - interface IListCatalogsResponse { + /** Properties of a Catalog. */ + interface ICatalog { - /** ListCatalogsResponse catalogs */ - catalogs?: (google.cloud.retail.v2.ICatalog[]|null); + /** Catalog name */ + name?: (string|null); - /** ListCatalogsResponse nextPageToken */ - nextPageToken?: (string|null); + /** Catalog displayName */ + displayName?: (string|null); + + /** Catalog productLevelConfig */ + productLevelConfig?: (google.cloud.retail.v2.IProductLevelConfig|null); } - /** Represents a ListCatalogsResponse. */ - class ListCatalogsResponse implements IListCatalogsResponse { + /** Represents a Catalog. */ + class Catalog implements ICatalog { /** - * Constructs a new ListCatalogsResponse. + * Constructs a new Catalog. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); + constructor(properties?: google.cloud.retail.v2.ICatalog); - /** ListCatalogsResponse catalogs. */ - public catalogs: google.cloud.retail.v2.ICatalog[]; + /** Catalog name. */ + public name: string; - /** ListCatalogsResponse nextPageToken. */ - public nextPageToken: string; + /** Catalog displayName. */ + public displayName: string; + + /** Catalog productLevelConfig. */ + public productLevelConfig?: (google.cloud.retail.v2.IProductLevelConfig|null); /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * Creates a new Catalog instance using the specified properties. * @param [properties] Properties to set - * @returns ListCatalogsResponse instance + * @returns Catalog instance */ - public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; + public static create(properties?: google.cloud.retail.v2.ICatalog): google.cloud.retail.v2.Catalog; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. - * @param message ListCatalogsResponse message or plain object to encode + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * @param message Catalog message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICatalog, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListCatalogsResponse + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Catalog; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListCatalogsResponse + * @returns Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Catalog; /** - * Verifies a ListCatalogsResponse message. + * Verifies a Catalog message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListCatalogsResponse + * @returns Catalog */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Catalog; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. - * @param message ListCatalogsResponse + * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * @param message Catalog * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Catalog, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this Catalog to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ListCatalogsResponse + * Gets the default type url for Catalog * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an UpdateCatalogRequest. */ - interface IUpdateCatalogRequest { + /** AttributeConfigLevel enum. */ + enum AttributeConfigLevel { + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0, + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1, + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2 + } - /** UpdateCatalogRequest catalog */ - catalog?: (google.cloud.retail.v2.ICatalog|null); + /** SolutionType enum. */ + enum SolutionType { + SOLUTION_TYPE_UNSPECIFIED = 0, + SOLUTION_TYPE_RECOMMENDATION = 1, + SOLUTION_TYPE_SEARCH = 2 + } - /** UpdateCatalogRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** SearchSolutionUseCase enum. */ + enum SearchSolutionUseCase { + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0, + SEARCH_SOLUTION_USE_CASE_SEARCH = 1, + SEARCH_SOLUTION_USE_CASE_BROWSE = 2 } - /** Represents an UpdateCatalogRequest. */ - class UpdateCatalogRequest implements IUpdateCatalogRequest { + /** Properties of a Condition. */ + interface ICondition { + + /** Condition queryTerms */ + queryTerms?: (google.cloud.retail.v2.Condition.IQueryTerm[]|null); + + /** Condition activeTimeRange */ + activeTimeRange?: (google.cloud.retail.v2.Condition.ITimeRange[]|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new Condition. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); + constructor(properties?: google.cloud.retail.v2.ICondition); - /** UpdateCatalogRequest catalog. */ - public catalog?: (google.cloud.retail.v2.ICatalog|null); + /** Condition queryTerms. */ + public queryTerms: google.cloud.retail.v2.Condition.IQueryTerm[]; - /** UpdateCatalogRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** Condition activeTimeRange. */ + public activeTimeRange: google.cloud.retail.v2.Condition.ITimeRange[]; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Creates a new Condition instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateCatalogRequest instance + * @returns Condition instance */ - public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; + public static create(properties?: google.cloud.retail.v2.ICondition): google.cloud.retail.v2.Condition; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. - * @param message UpdateCatalogRequest message or plain object to encode + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a Condition message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateCatalogRequest + * @returns Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Condition; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a Condition message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateCatalogRequest + * @returns Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Condition; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a Condition message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Condition message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateCatalogRequest + * @returns Condition */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Condition; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. - * @param message UpdateCatalogRequest + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this Condition to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for UpdateCatalogRequest + * Gets the default type url for Condition * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a SetDefaultBranchRequest. */ - interface ISetDefaultBranchRequest { - - /** SetDefaultBranchRequest catalog */ - catalog?: (string|null); + namespace Condition { - /** SetDefaultBranchRequest branchId */ - branchId?: (string|null); + /** Properties of a QueryTerm. */ + interface IQueryTerm { - /** SetDefaultBranchRequest note */ - note?: (string|null); + /** QueryTerm value */ + value?: (string|null); - /** SetDefaultBranchRequest force */ - force?: (boolean|null); - } + /** QueryTerm fullMatch */ + fullMatch?: (boolean|null); + } - /** Represents a SetDefaultBranchRequest. */ - class SetDefaultBranchRequest implements ISetDefaultBranchRequest { + /** Represents a QueryTerm. */ + class QueryTerm implements IQueryTerm { - /** - * Constructs a new SetDefaultBranchRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest); + /** + * Constructs a new QueryTerm. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Condition.IQueryTerm); - /** SetDefaultBranchRequest catalog. */ - public catalog: string; + /** QueryTerm value. */ + public value: string; - /** SetDefaultBranchRequest branchId. */ - public branchId: string; + /** QueryTerm fullMatch. */ + public fullMatch: boolean; - /** SetDefaultBranchRequest note. */ - public note: string; + /** + * Creates a new QueryTerm instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTerm instance + */ + public static create(properties?: google.cloud.retail.v2.Condition.IQueryTerm): google.cloud.retail.v2.Condition.QueryTerm; - /** SetDefaultBranchRequest force. */ - public force: boolean; + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SetDefaultBranchRequest instance - */ - public static create(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest): google.cloud.retail.v2.SetDefaultBranchRequest; + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Condition.QueryTerm.verify|verify} messages. + * @param message QueryTerm message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Condition.IQueryTerm, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Condition.QueryTerm; - /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. - * @param message SetDefaultBranchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Condition.QueryTerm; - /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetDefaultBranchRequest; + /** + * Verifies a QueryTerm message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetDefaultBranchRequest; + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTerm + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Condition.QueryTerm; - /** - * Verifies a SetDefaultBranchRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @param message QueryTerm + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Condition.QueryTerm, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SetDefaultBranchRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetDefaultBranchRequest; + /** + * Converts this QueryTerm to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message SetDefaultBranchRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Gets the default type url for QueryTerm + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Converts this SetDefaultBranchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** Properties of a TimeRange. */ + interface ITimeRange { - /** - * Gets the default type url for SetDefaultBranchRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** TimeRange startTime */ + startTime?: (google.protobuf.ITimestamp|null); - /** Properties of a GetDefaultBranchRequest. */ - interface IGetDefaultBranchRequest { + /** TimeRange endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } - /** GetDefaultBranchRequest catalog */ - catalog?: (string|null); - } + /** Represents a TimeRange. */ + class TimeRange implements ITimeRange { - /** Represents a GetDefaultBranchRequest. */ - class GetDefaultBranchRequest implements IGetDefaultBranchRequest { + /** + * Constructs a new TimeRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Condition.ITimeRange); - /** - * Constructs a new GetDefaultBranchRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest); + /** TimeRange startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); - /** GetDefaultBranchRequest catalog. */ - public catalog: string; + /** TimeRange endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); - /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetDefaultBranchRequest instance - */ - public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest): google.cloud.retail.v2.GetDefaultBranchRequest; + /** + * Creates a new TimeRange instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeRange instance + */ + public static create(properties?: google.cloud.retail.v2.Condition.ITimeRange): google.cloud.retail.v2.Condition.TimeRange; - /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. - * @param message GetDefaultBranchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Condition.TimeRange.verify|verify} messages. + * @param message TimeRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Condition.ITimeRange, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchRequest; + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Condition.TimeRange; - /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchRequest; + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Condition.TimeRange; - /** - * Verifies a GetDefaultBranchRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a TimeRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetDefaultBranchRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchRequest; + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Condition.TimeRange; - /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. - * @param message GetDefaultBranchRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @param message TimeRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Condition.TimeRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this GetDefaultBranchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Converts this TimeRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Gets the default type url for GetDefaultBranchRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; + /** + * Gets the default type url for TimeRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } - /** Properties of a GetDefaultBranchResponse. */ - interface IGetDefaultBranchResponse { + /** Properties of a Rule. */ + interface IRule { - /** GetDefaultBranchResponse branch */ - branch?: (string|null); + /** Rule boostAction */ + boostAction?: (google.cloud.retail.v2.Rule.IBoostAction|null); - /** GetDefaultBranchResponse setTime */ - setTime?: (google.protobuf.ITimestamp|null); + /** Rule redirectAction */ + redirectAction?: (google.cloud.retail.v2.Rule.IRedirectAction|null); - /** GetDefaultBranchResponse note */ - note?: (string|null); + /** Rule onewaySynonymsAction */ + onewaySynonymsAction?: (google.cloud.retail.v2.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction */ + doNotAssociateAction?: (google.cloud.retail.v2.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction */ + replacementAction?: (google.cloud.retail.v2.Rule.IReplacementAction|null); + + /** Rule ignoreAction */ + ignoreAction?: (google.cloud.retail.v2.Rule.IIgnoreAction|null); + + /** Rule filterAction */ + filterAction?: (google.cloud.retail.v2.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction */ + twowaySynonymsAction?: (google.cloud.retail.v2.Rule.ITwowaySynonymsAction|null); + + /** Rule condition */ + condition?: (google.cloud.retail.v2.ICondition|null); } - /** Represents a GetDefaultBranchResponse. */ - class GetDefaultBranchResponse implements IGetDefaultBranchResponse { + /** Represents a Rule. */ + class Rule implements IRule { /** - * Constructs a new GetDefaultBranchResponse. + * Constructs a new Rule. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse); + constructor(properties?: google.cloud.retail.v2.IRule); - /** GetDefaultBranchResponse branch. */ - public branch: string; + /** Rule boostAction. */ + public boostAction?: (google.cloud.retail.v2.Rule.IBoostAction|null); - /** GetDefaultBranchResponse setTime. */ - public setTime?: (google.protobuf.ITimestamp|null); + /** Rule redirectAction. */ + public redirectAction?: (google.cloud.retail.v2.Rule.IRedirectAction|null); - /** GetDefaultBranchResponse note. */ - public note: string; + /** Rule onewaySynonymsAction. */ + public onewaySynonymsAction?: (google.cloud.retail.v2.Rule.IOnewaySynonymsAction|null); + + /** Rule doNotAssociateAction. */ + public doNotAssociateAction?: (google.cloud.retail.v2.Rule.IDoNotAssociateAction|null); + + /** Rule replacementAction. */ + public replacementAction?: (google.cloud.retail.v2.Rule.IReplacementAction|null); + + /** Rule ignoreAction. */ + public ignoreAction?: (google.cloud.retail.v2.Rule.IIgnoreAction|null); + + /** Rule filterAction. */ + public filterAction?: (google.cloud.retail.v2.Rule.IFilterAction|null); + + /** Rule twowaySynonymsAction. */ + public twowaySynonymsAction?: (google.cloud.retail.v2.Rule.ITwowaySynonymsAction|null); + + /** Rule condition. */ + public condition?: (google.cloud.retail.v2.ICondition|null); + + /** Rule action. */ + public action?: ("boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"); /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. + * Creates a new Rule instance using the specified properties. * @param [properties] Properties to set - * @returns GetDefaultBranchResponse instance + * @returns Rule instance */ - public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse): google.cloud.retail.v2.GetDefaultBranchResponse; + public static create(properties?: google.cloud.retail.v2.IRule): google.cloud.retail.v2.Rule; /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRule, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. - * @param message GetDefaultBranchResponse message or plain object to encode + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.verify|verify} messages. + * @param message Rule message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRule, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. + * Decodes a Rule message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetDefaultBranchResponse + * @returns Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule; /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. + * Decodes a Rule message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetDefaultBranchResponse + * @returns Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule; /** - * Verifies a GetDefaultBranchResponse message. + * Verifies a Rule message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a Rule message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetDefaultBranchResponse + * @returns Rule */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule; /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. - * @param message GetDefaultBranchResponse + * Creates a plain object from a Rule message. Also converts values to other types if specified. + * @param message Rule * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Rule, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetDefaultBranchResponse to JSON. + * Converts this Rule to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for GetDefaultBranchResponse + * Gets the default type url for Rule * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an Audience. */ - interface IAudience { - - /** Audience genders */ - genders?: (string[]|null); + namespace Rule { - /** Audience ageGroups */ - ageGroups?: (string[]|null); - } + /** Properties of a BoostAction. */ + interface IBoostAction { - /** Represents an Audience. */ - class Audience implements IAudience { + /** BoostAction boost */ + boost?: (number|null); - /** - * Constructs a new Audience. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IAudience); + /** BoostAction productsFilter */ + productsFilter?: (string|null); + } - /** Audience genders. */ - public genders: string[]; + /** Represents a BoostAction. */ + class BoostAction implements IBoostAction { - /** Audience ageGroups. */ - public ageGroups: string[]; + /** + * Constructs a new BoostAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IBoostAction); - /** - * Creates a new Audience instance using the specified properties. - * @param [properties] Properties to set - * @returns Audience instance - */ - public static create(properties?: google.cloud.retail.v2.IAudience): google.cloud.retail.v2.Audience; + /** BoostAction boost. */ + public boost: number; - /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + /** BoostAction productsFilter. */ + public productsFilter: string; - /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. - * @param message Audience message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Creates a new BoostAction instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IBoostAction): google.cloud.retail.v2.Rule.BoostAction; - /** - * Decodes an Audience message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Audience - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Audience; + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; - /** + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.BoostAction.verify|verify} messages. + * @param message BoostAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IBoostAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.BoostAction; + + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.BoostAction; + + /** + * Verifies a BoostAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.BoostAction; + + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @param message BoostAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.BoostAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoostAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoostAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FilterAction. */ + interface IFilterAction { + + /** FilterAction filter */ + filter?: (string|null); + } + + /** Represents a FilterAction. */ + class FilterAction implements IFilterAction { + + /** + * Constructs a new FilterAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IFilterAction); + + /** FilterAction filter. */ + public filter: string; + + /** + * Creates a new FilterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns FilterAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IFilterAction): google.cloud.retail.v2.Rule.FilterAction; + + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.FilterAction.verify|verify} messages. + * @param message FilterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IFilterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.FilterAction; + + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.FilterAction; + + /** + * Verifies a FilterAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FilterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.FilterAction; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @param message FilterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.FilterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FilterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FilterAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RedirectAction. */ + interface IRedirectAction { + + /** RedirectAction redirectUri */ + redirectUri?: (string|null); + } + + /** Represents a RedirectAction. */ + class RedirectAction implements IRedirectAction { + + /** + * Constructs a new RedirectAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IRedirectAction); + + /** RedirectAction redirectUri. */ + public redirectUri: string; + + /** + * Creates a new RedirectAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RedirectAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IRedirectAction): google.cloud.retail.v2.Rule.RedirectAction; + + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.RedirectAction.verify|verify} messages. + * @param message RedirectAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IRedirectAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.RedirectAction; + + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.RedirectAction; + + /** + * Verifies a RedirectAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RedirectAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.RedirectAction; + + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @param message RedirectAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.RedirectAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RedirectAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RedirectAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TwowaySynonymsAction. */ + interface ITwowaySynonymsAction { + + /** TwowaySynonymsAction synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a TwowaySynonymsAction. */ + class TwowaySynonymsAction implements ITwowaySynonymsAction { + + /** + * Constructs a new TwowaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.ITwowaySynonymsAction); + + /** TwowaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns TwowaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.ITwowaySynonymsAction): google.cloud.retail.v2.Rule.TwowaySynonymsAction; + + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.TwowaySynonymsAction.verify|verify} messages. + * @param message TwowaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.ITwowaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.TwowaySynonymsAction; + + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.TwowaySynonymsAction; + + /** + * Verifies a TwowaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TwowaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.TwowaySynonymsAction; + + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @param message TwowaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.TwowaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TwowaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TwowaySynonymsAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OnewaySynonymsAction. */ + interface IOnewaySynonymsAction { + + /** OnewaySynonymsAction queryTerms */ + queryTerms?: (string[]|null); + + /** OnewaySynonymsAction synonyms */ + synonyms?: (string[]|null); + + /** OnewaySynonymsAction onewayTerms */ + onewayTerms?: (string[]|null); + } + + /** Represents an OnewaySynonymsAction. */ + class OnewaySynonymsAction implements IOnewaySynonymsAction { + + /** + * Constructs a new OnewaySynonymsAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IOnewaySynonymsAction); + + /** OnewaySynonymsAction queryTerms. */ + public queryTerms: string[]; + + /** OnewaySynonymsAction synonyms. */ + public synonyms: string[]; + + /** OnewaySynonymsAction onewayTerms. */ + public onewayTerms: string[]; + + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OnewaySynonymsAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IOnewaySynonymsAction): google.cloud.retail.v2.Rule.OnewaySynonymsAction; + + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.OnewaySynonymsAction.verify|verify} messages. + * @param message OnewaySynonymsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IOnewaySynonymsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.OnewaySynonymsAction; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.OnewaySynonymsAction; + + /** + * Verifies an OnewaySynonymsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnewaySynonymsAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.OnewaySynonymsAction; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @param message OnewaySynonymsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.OnewaySynonymsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OnewaySynonymsAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DoNotAssociateAction. */ + interface IDoNotAssociateAction { + + /** DoNotAssociateAction queryTerms */ + queryTerms?: (string[]|null); + + /** DoNotAssociateAction doNotAssociateTerms */ + doNotAssociateTerms?: (string[]|null); + + /** DoNotAssociateAction terms */ + terms?: (string[]|null); + } + + /** Represents a DoNotAssociateAction. */ + class DoNotAssociateAction implements IDoNotAssociateAction { + + /** + * Constructs a new DoNotAssociateAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IDoNotAssociateAction); + + /** DoNotAssociateAction queryTerms. */ + public queryTerms: string[]; + + /** DoNotAssociateAction doNotAssociateTerms. */ + public doNotAssociateTerms: string[]; + + /** DoNotAssociateAction terms. */ + public terms: string[]; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DoNotAssociateAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IDoNotAssociateAction): google.cloud.retail.v2.Rule.DoNotAssociateAction; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.DoNotAssociateAction.verify|verify} messages. + * @param message DoNotAssociateAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IDoNotAssociateAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.DoNotAssociateAction; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.DoNotAssociateAction; + + /** + * Verifies a DoNotAssociateAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoNotAssociateAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.DoNotAssociateAction; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @param message DoNotAssociateAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.DoNotAssociateAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoNotAssociateAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReplacementAction. */ + interface IReplacementAction { + + /** ReplacementAction queryTerms */ + queryTerms?: (string[]|null); + + /** ReplacementAction replacementTerm */ + replacementTerm?: (string|null); + + /** ReplacementAction term */ + term?: (string|null); + } + + /** Represents a ReplacementAction. */ + class ReplacementAction implements IReplacementAction { + + /** + * Constructs a new ReplacementAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IReplacementAction); + + /** ReplacementAction queryTerms. */ + public queryTerms: string[]; + + /** ReplacementAction replacementTerm. */ + public replacementTerm: string; + + /** ReplacementAction term. */ + public term: string; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplacementAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IReplacementAction): google.cloud.retail.v2.Rule.ReplacementAction; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.ReplacementAction.verify|verify} messages. + * @param message ReplacementAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IReplacementAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.ReplacementAction; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.ReplacementAction; + + /** + * Verifies a ReplacementAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplacementAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.ReplacementAction; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @param message ReplacementAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.ReplacementAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplacementAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplacementAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an IgnoreAction. */ + interface IIgnoreAction { + + /** IgnoreAction ignoreTerms */ + ignoreTerms?: (string[]|null); + } + + /** Represents an IgnoreAction. */ + class IgnoreAction implements IIgnoreAction { + + /** + * Constructs a new IgnoreAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.Rule.IIgnoreAction); + + /** IgnoreAction ignoreTerms. */ + public ignoreTerms: string[]; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @param [properties] Properties to set + * @returns IgnoreAction instance + */ + public static create(properties?: google.cloud.retail.v2.Rule.IIgnoreAction): google.cloud.retail.v2.Rule.IgnoreAction; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.IgnoreAction.verify|verify} messages. + * @param message IgnoreAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.Rule.IIgnoreAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rule.IgnoreAction; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rule.IgnoreAction; + + /** + * Verifies an IgnoreAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IgnoreAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rule.IgnoreAction; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @param message IgnoreAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rule.IgnoreAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IgnoreAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IgnoreAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an Audience. */ + interface IAudience { + + /** Audience genders */ + genders?: (string[]|null); + + /** Audience ageGroups */ + ageGroups?: (string[]|null); + } + + /** Represents an Audience. */ + class Audience implements IAudience { + + /** + * Constructs a new Audience. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IAudience); + + /** Audience genders. */ + public genders: string[]; + + /** Audience ageGroups. */ + public ageGroups: string[]; + + /** + * Creates a new Audience instance using the specified properties. + * @param [properties] Properties to set + * @returns Audience instance + */ + public static create(properties?: google.cloud.retail.v2.IAudience): google.cloud.retail.v2.Audience; + + /** + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. + * @param message Audience message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IAudience, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Audience message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Audience; + + /** * Decodes an Audience message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Audience + * @returns Audience + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Audience; + + /** + * Verifies an Audience message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Audience + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Audience; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @param message Audience + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Audience to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Audience + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ColorInfo. */ + interface IColorInfo { + + /** ColorInfo colorFamilies */ + colorFamilies?: (string[]|null); + + /** ColorInfo colors */ + colors?: (string[]|null); + } + + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { + + /** + * Constructs a new ColorInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IColorInfo); + + /** ColorInfo colorFamilies. */ + public colorFamilies: string[]; + + /** ColorInfo colors. */ + public colors: string[]; + + /** + * Creates a new ColorInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ColorInfo instance + */ + public static create(properties?: google.cloud.retail.v2.IColorInfo): google.cloud.retail.v2.ColorInfo; + + /** + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ColorInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ColorInfo; + + /** + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ColorInfo; + + /** + * Verifies a ColorInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ColorInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ColorInfo; + + /** + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ColorInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ColorInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomAttribute. */ + interface ICustomAttribute { + + /** CustomAttribute text */ + text?: (string[]|null); + + /** CustomAttribute numbers */ + numbers?: (number[]|null); + + /** CustomAttribute searchable */ + searchable?: (boolean|null); + + /** CustomAttribute indexable */ + indexable?: (boolean|null); + } + + /** Represents a CustomAttribute. */ + class CustomAttribute implements ICustomAttribute { + + /** + * Constructs a new CustomAttribute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICustomAttribute); + + /** CustomAttribute text. */ + public text: string[]; + + /** CustomAttribute numbers. */ + public numbers: number[]; + + /** CustomAttribute searchable. */ + public searchable?: (boolean|null); + + /** CustomAttribute indexable. */ + public indexable?: (boolean|null); + + /** CustomAttribute _searchable. */ + public _searchable?: "searchable"; + + /** CustomAttribute _indexable. */ + public _indexable?: "indexable"; + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomAttribute instance + */ + public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @param message CustomAttribute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; + + /** + * Verifies a CustomAttribute message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomAttribute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @param message CustomAttribute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomAttribute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomAttribute + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { + + /** FulfillmentInfo type */ + type?: (string|null); + + /** FulfillmentInfo placeIds */ + placeIds?: (string[]|null); + } + + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { + + /** + * Constructs a new FulfillmentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IFulfillmentInfo); + + /** FulfillmentInfo type. */ + public type: string; + + /** FulfillmentInfo placeIds. */ + public placeIds: string[]; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillmentInfo instance + */ + public static create(properties?: google.cloud.retail.v2.IFulfillmentInfo): google.cloud.retail.v2.FulfillmentInfo; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.FulfillmentInfo; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.FulfillmentInfo; + + /** + * Verifies a FulfillmentInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillmentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.FulfillmentInfo; + + /** + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillmentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FulfillmentInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Image. */ + interface IImage { + + /** Image uri */ + uri?: (string|null); + + /** Image height */ + height?: (number|null); + + /** Image width */ + width?: (number|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImage); + + /** Image uri. */ + public uri: string; + + /** Image height. */ + public height: number; + + /** Image width. */ + public width: number; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.retail.v2.IImage): google.cloud.retail.v2.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. + * @param message Image message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Image message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Image; + + /** + * Decodes an Image message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Image + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Image; + + /** + * Verifies an Image message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Image + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Image; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Image to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Image + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Interval. */ + interface IInterval { + + /** Interval minimum */ + minimum?: (number|null); + + /** Interval exclusiveMinimum */ + exclusiveMinimum?: (number|null); + + /** Interval maximum */ + maximum?: (number|null); + + /** Interval exclusiveMaximum */ + exclusiveMaximum?: (number|null); + } + + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IInterval); + + /** Interval minimum. */ + public minimum?: (number|null); + + /** Interval exclusiveMinimum. */ + public exclusiveMinimum?: (number|null); + + /** Interval maximum. */ + public maximum?: (number|null); + + /** Interval exclusiveMaximum. */ + public exclusiveMaximum?: (number|null); + + /** Interval min. */ + public min?: ("minimum"|"exclusiveMinimum"); + + /** Interval max. */ + public max?: ("maximum"|"exclusiveMaximum"); + + /** + * Creates a new Interval instance using the specified properties. + * @param [properties] Properties to set + * @returns Interval instance + */ + public static create(properties?: google.cloud.retail.v2.IInterval): google.cloud.retail.v2.Interval; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Interval; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Interval; + + /** + * Verifies an Interval message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Interval + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Interval; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Interval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Interval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PriceInfo. */ + interface IPriceInfo { + + /** PriceInfo currencyCode */ + currencyCode?: (string|null); + + /** PriceInfo price */ + price?: (number|null); + + /** PriceInfo originalPrice */ + originalPrice?: (number|null); + + /** PriceInfo cost */ + cost?: (number|null); + + /** PriceInfo priceEffectiveTime */ + priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime */ + priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange */ + priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + } + + /** Represents a PriceInfo. */ + class PriceInfo implements IPriceInfo { + + /** + * Constructs a new PriceInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPriceInfo); + + /** PriceInfo currencyCode. */ + public currencyCode: string; + + /** PriceInfo price. */ + public price: number; + + /** PriceInfo originalPrice. */ + public originalPrice: number; + + /** PriceInfo cost. */ + public cost: number; + + /** PriceInfo priceEffectiveTime. */ + public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceExpireTime. */ + public priceExpireTime?: (google.protobuf.ITimestamp|null); + + /** PriceInfo priceRange. */ + public priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + + /** + * Creates a new PriceInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceInfo instance + */ + public static create(properties?: google.cloud.retail.v2.IPriceInfo): google.cloud.retail.v2.PriceInfo; + + /** + * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. + * @param message PriceInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo; + + /** + * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo; + + /** + * Verifies a PriceInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo; + + /** + * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. + * @param message PriceInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PriceInfo { + + /** Properties of a PriceRange. */ + interface IPriceRange { + + /** PriceRange price */ + price?: (google.cloud.retail.v2.IInterval|null); + + /** PriceRange originalPrice */ + originalPrice?: (google.cloud.retail.v2.IInterval|null); + } + + /** Represents a PriceRange. */ + class PriceRange implements IPriceRange { + + /** + * Constructs a new PriceRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange); + + /** PriceRange price. */ + public price?: (google.cloud.retail.v2.IInterval|null); + + /** PriceRange originalPrice. */ + public originalPrice?: (google.cloud.retail.v2.IInterval|null); + + /** + * Creates a new PriceRange instance using the specified properties. + * @param [properties] Properties to set + * @returns PriceRange instance + */ + public static create(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. + * @param message PriceRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PriceRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Decodes a PriceRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PriceRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Verifies a PriceRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PriceRange + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo.PriceRange; + + /** + * Creates a plain object from a PriceRange message. Also converts values to other types if specified. + * @param message PriceRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PriceRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PriceRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Rating. */ + interface IRating { + + /** Rating ratingCount */ + ratingCount?: (number|null); + + /** Rating averageRating */ + averageRating?: (number|null); + + /** Rating ratingHistogram */ + ratingHistogram?: (number[]|null); + } + + /** Represents a Rating. */ + class Rating implements IRating { + + /** + * Constructs a new Rating. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRating); + + /** Rating ratingCount. */ + public ratingCount: number; + + /** Rating averageRating. */ + public averageRating: number; + + /** Rating ratingHistogram. */ + public ratingHistogram: number[]; + + /** + * Creates a new Rating instance using the specified properties. + * @param [properties] Properties to set + * @returns Rating instance + */ + public static create(properties?: google.cloud.retail.v2.IRating): google.cloud.retail.v2.Rating; + + /** + * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. + * @param message Rating message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Rating message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rating; + + /** + * Decodes a Rating message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Rating + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rating; + + /** + * Verifies a Rating message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Rating + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rating; + + /** + * Creates a plain object from a Rating message. Also converts values to other types if specified. + * @param message Rating + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Rating to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Rating + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UserInfo. */ + interface IUserInfo { + + /** UserInfo userId */ + userId?: (string|null); + + /** UserInfo ipAddress */ + ipAddress?: (string|null); + + /** UserInfo userAgent */ + userAgent?: (string|null); + + /** UserInfo directUserRequest */ + directUserRequest?: (boolean|null); + } + + /** Represents a UserInfo. */ + class UserInfo implements IUserInfo { + + /** + * Constructs a new UserInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserInfo); + + /** UserInfo userId. */ + public userId: string; + + /** UserInfo ipAddress. */ + public ipAddress: string; + + /** UserInfo userAgent. */ + public userAgent: string; + + /** UserInfo directUserRequest. */ + public directUserRequest: boolean; + + /** + * Creates a new UserInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UserInfo instance + */ + public static create(properties?: google.cloud.retail.v2.IUserInfo): google.cloud.retail.v2.UserInfo; + + /** + * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. + * @param message UserInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserInfo; + + /** + * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserInfo; + + /** + * Verifies a UserInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserInfo; + + /** + * Creates a plain object from a UserInfo message. Also converts values to other types if specified. + * @param message UserInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LocalInventory. */ + interface ILocalInventory { + + /** LocalInventory placeId */ + placeId?: (string|null); + + /** LocalInventory priceInfo */ + priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** LocalInventory attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** LocalInventory fulfillmentTypes */ + fulfillmentTypes?: (string[]|null); + } + + /** Represents a LocalInventory. */ + class LocalInventory implements ILocalInventory { + + /** + * Constructs a new LocalInventory. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ILocalInventory); + + /** LocalInventory placeId. */ + public placeId: string; + + /** LocalInventory priceInfo. */ + public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** LocalInventory attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** LocalInventory fulfillmentTypes. */ + public fulfillmentTypes: string[]; + + /** + * Creates a new LocalInventory instance using the specified properties. + * @param [properties] Properties to set + * @returns LocalInventory instance + */ + public static create(properties?: google.cloud.retail.v2.ILocalInventory): google.cloud.retail.v2.LocalInventory; + + /** + * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. + * @param message LocalInventory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocalInventory message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.LocalInventory; + + /** + * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocalInventory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.LocalInventory; + + /** + * Verifies a LocalInventory message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocalInventory + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.LocalInventory; + + /** + * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. + * @param message LocalInventory + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocalInventory to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocalInventory + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GcsSource. */ + interface IGcsSource { + + /** GcsSource inputUris */ + inputUris?: (string[]|null); + + /** GcsSource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IGcsSource); + + /** GcsSource inputUris. */ + public inputUris: string[]; + + /** GcsSource dataSchema. */ + public dataSchema: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; + + /** + * Verifies a GcsSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BigQuerySource. */ + interface IBigQuerySource { + + /** BigQuerySource partitionDate */ + partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId */ + projectId?: (string|null); + + /** BigQuerySource datasetId */ + datasetId?: (string|null); + + /** BigQuerySource tableId */ + tableId?: (string|null); + + /** BigQuerySource gcsStagingDir */ + gcsStagingDir?: (string|null); + + /** BigQuerySource dataSchema */ + dataSchema?: (string|null); + } + + /** Represents a BigQuerySource. */ + class BigQuerySource implements IBigQuerySource { + + /** + * Constructs a new BigQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IBigQuerySource); + + /** BigQuerySource partitionDate. */ + public partitionDate?: (google.type.IDate|null); + + /** BigQuerySource projectId. */ + public projectId: string; + + /** BigQuerySource datasetId. */ + public datasetId: string; + + /** BigQuerySource tableId. */ + public tableId: string; + + /** BigQuerySource gcsStagingDir. */ + public gcsStagingDir: string; + + /** BigQuerySource dataSchema. */ + public dataSchema: string; + + /** BigQuerySource partition. */ + public partition?: "partitionDate"; + + /** + * Creates a new BigQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns BigQuerySource instance + */ + public static create(properties?: google.cloud.retail.v2.IBigQuerySource): google.cloud.retail.v2.BigQuerySource; + + /** + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * @param message BigQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.BigQuerySource; + + /** + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BigQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.BigQuerySource; + + /** + * Verifies a BigQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BigQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.BigQuerySource; + + /** + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * @param message BigQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BigQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BigQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ProductInlineSource. */ + interface IProductInlineSource { + + /** ProductInlineSource products */ + products?: (google.cloud.retail.v2.IProduct[]|null); + } + + /** Represents a ProductInlineSource. */ + class ProductInlineSource implements IProductInlineSource { + + /** + * Constructs a new ProductInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductInlineSource); + + /** ProductInlineSource products. */ + public products: google.cloud.retail.v2.IProduct[]; + + /** + * Creates a new ProductInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2.IProductInlineSource): google.cloud.retail.v2.ProductInlineSource; + + /** + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * @param message ProductInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInlineSource; + + /** + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInlineSource; + + /** + * Verifies a ProductInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInlineSource; + + /** + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. + * @param message ProductInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProductInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UserEventInlineSource. */ + interface IUserEventInlineSource { + + /** UserEventInlineSource userEvents */ + userEvents?: (google.cloud.retail.v2.IUserEvent[]|null); + } + + /** Represents a UserEventInlineSource. */ + class UserEventInlineSource implements IUserEventInlineSource { + + /** + * Constructs a new UserEventInlineSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUserEventInlineSource); + + /** UserEventInlineSource userEvents. */ + public userEvents: google.cloud.retail.v2.IUserEvent[]; + + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInlineSource instance + */ + public static create(properties?: google.cloud.retail.v2.IUserEventInlineSource): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @param message UserEventInlineSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInlineSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Verifies a UserEventInlineSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInlineSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInlineSource; + + /** + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. + * @param message UserEventInlineSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInlineSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInlineSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportErrorsConfig. */ + interface IImportErrorsConfig { + + /** ImportErrorsConfig gcsPrefix */ + gcsPrefix?: (string|null); + } + + /** Represents an ImportErrorsConfig. */ + class ImportErrorsConfig implements IImportErrorsConfig { + + /** + * Constructs a new ImportErrorsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportErrorsConfig); + + /** ImportErrorsConfig gcsPrefix. */ + public gcsPrefix?: (string|null); + + /** ImportErrorsConfig destination. */ + public destination?: "gcsPrefix"; + + /** + * Creates a new ImportErrorsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportErrorsConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IImportErrorsConfig): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. + * @param message ImportErrorsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportErrorsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Verifies an ImportErrorsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportErrorsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportErrorsConfig; + + /** + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. + * @param message ImportErrorsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportErrorsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportErrorsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportProductsRequest. */ + interface IImportProductsRequest { + + /** ImportProductsRequest parent */ + parent?: (string|null); + + /** ImportProductsRequest requestId */ + requestId?: (string|null); + + /** ImportProductsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode */ + reconciliationMode?: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null); + + /** ImportProductsRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportProductsRequest. */ + class ImportProductsRequest implements IImportProductsRequest { + + /** + * Constructs a new ImportProductsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportProductsRequest); + + /** ImportProductsRequest parent. */ + public parent: string; + + /** ImportProductsRequest requestId. */ + public requestId: string; + + /** ImportProductsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + + /** ImportProductsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportProductsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** ImportProductsRequest reconciliationMode. */ + public reconciliationMode: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode); + + /** ImportProductsRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportProductsRequest): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. + * @param message ImportProductsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Verifies an ImportProductsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsRequest; + + /** + * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. + * @param message ImportProductsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ImportProductsRequest { + + /** ReconciliationMode enum. */ + enum ReconciliationMode { + RECONCILIATION_MODE_UNSPECIFIED = 0, + INCREMENTAL = 1, + FULL = 2 + } + } + + /** Properties of an ImportUserEventsRequest. */ + interface IImportUserEventsRequest { + + /** ImportUserEventsRequest parent */ + parent?: (string|null); + + /** ImportUserEventsRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + } + + /** Represents an ImportUserEventsRequest. */ + class ImportUserEventsRequest implements IImportUserEventsRequest { + + /** + * Constructs a new ImportUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportUserEventsRequest); + + /** ImportUserEventsRequest parent. */ + public parent: string; + + /** ImportUserEventsRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + + /** ImportUserEventsRequest errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** + * Creates a new ImportUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportUserEventsRequest): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. + * @param message ImportUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Verifies an ImportUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsRequest; + + /** + * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. + * @param message ImportUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportCompletionDataRequest. */ + interface IImportCompletionDataRequest { + + /** ImportCompletionDataRequest parent */ + parent?: (string|null); + + /** ImportCompletionDataRequest inputConfig */ + inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportCompletionDataRequest. */ + class ImportCompletionDataRequest implements IImportCompletionDataRequest { + + /** + * Constructs a new ImportCompletionDataRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportCompletionDataRequest); + + /** ImportCompletionDataRequest parent. */ + public parent: string; + + /** ImportCompletionDataRequest inputConfig. */ + public inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + + /** ImportCompletionDataRequest notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportCompletionDataRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCompletionDataRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IImportCompletionDataRequest): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. + * @param message ImportCompletionDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCompletionDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Verifies an ImportCompletionDataRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCompletionDataRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataRequest; + + /** + * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. + * @param message ImportCompletionDataRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCompletionDataRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCompletionDataRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ProductInputConfig. */ + interface IProductInputConfig { + + /** ProductInputConfig productInlineSource */ + productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + + /** ProductInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** ProductInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + } + + /** Represents a ProductInputConfig. */ + class ProductInputConfig implements IProductInputConfig { + + /** + * Constructs a new ProductInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IProductInputConfig); + + /** ProductInputConfig productInlineSource. */ + public productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + + /** ProductInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** ProductInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + + /** ProductInputConfig source. */ + public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new ProductInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IProductInputConfig): google.cloud.retail.v2.ProductInputConfig; + + /** + * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. + * @param message ProductInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Audience; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInputConfig; /** - * Verifies an Audience message. + * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInputConfig; + + /** + * Verifies a ProductInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Audience + * @returns ProductInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Audience; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInputConfig; /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @param message Audience + * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. + * @param message ProductInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Audience, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Audience to JSON. + * Converts this ProductInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Audience + * Gets the default type url for ProductInputConfig * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ColorInfo. */ - interface IColorInfo { + /** Properties of a UserEventInputConfig. */ + interface IUserEventInputConfig { - /** ColorInfo colorFamilies */ - colorFamilies?: (string[]|null); + /** UserEventInputConfig userEventInlineSource */ + userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); - /** ColorInfo colors */ - colors?: (string[]|null); + /** UserEventInputConfig gcsSource */ + gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); } - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { + /** Represents a UserEventInputConfig. */ + class UserEventInputConfig implements IUserEventInputConfig { /** - * Constructs a new ColorInfo. + * Constructs a new UserEventInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IColorInfo); + constructor(properties?: google.cloud.retail.v2.IUserEventInputConfig); - /** ColorInfo colorFamilies. */ - public colorFamilies: string[]; + /** UserEventInputConfig userEventInlineSource. */ + public userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); - /** ColorInfo colors. */ - public colors: string[]; + /** UserEventInputConfig gcsSource. */ + public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + + /** UserEventInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + + /** UserEventInputConfig source. */ + public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + + /** + * Creates a new UserEventInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns UserEventInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IUserEventInputConfig): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. + * @param message UserEventInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserEventInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Verifies a UserEventInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserEventInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInputConfig; + + /** + * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. + * @param message UserEventInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserEventInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserEventInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompletionDataInputConfig. */ + interface ICompletionDataInputConfig { + + /** CompletionDataInputConfig bigQuerySource */ + bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + } + + /** Represents a CompletionDataInputConfig. */ + class CompletionDataInputConfig implements ICompletionDataInputConfig { + + /** + * Constructs a new CompletionDataInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICompletionDataInputConfig); + + /** CompletionDataInputConfig bigQuerySource. */ + public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + + /** CompletionDataInputConfig source. */ + public source?: "bigQuerySource"; + + /** + * Creates a new CompletionDataInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionDataInputConfig instance + */ + public static create(properties?: google.cloud.retail.v2.ICompletionDataInputConfig): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. + * @param message CompletionDataInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionDataInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Verifies a CompletionDataInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionDataInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDataInputConfig; + + /** + * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. + * @param message CompletionDataInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionDataInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionDataInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportMetadata. */ + interface IImportMetadata { + + /** ImportMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount */ + successCount?: (number|Long|string|null); + + /** ImportMetadata failureCount */ + failureCount?: (number|Long|string|null); + + /** ImportMetadata requestId */ + requestId?: (string|null); + + /** ImportMetadata notificationPubsubTopic */ + notificationPubsubTopic?: (string|null); + } + + /** Represents an ImportMetadata. */ + class ImportMetadata implements IImportMetadata { + + /** + * Constructs a new ImportMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportMetadata); + + /** ImportMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ImportMetadata successCount. */ + public successCount: (number|Long|string); + + /** ImportMetadata failureCount. */ + public failureCount: (number|Long|string); + + /** ImportMetadata requestId. */ + public requestId: string; + + /** ImportMetadata notificationPubsubTopic. */ + public notificationPubsubTopic: string; + + /** + * Creates a new ImportMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IImportMetadata): google.cloud.retail.v2.ImportMetadata; + + /** + * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. + * @param message ImportMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportMetadata; + + /** + * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportMetadata; + + /** + * Verifies an ImportMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportMetadata; + + /** + * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. + * @param message ImportMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportProductsResponse. */ + interface IImportProductsResponse { + + /** ImportProductsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportProductsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + } + + /** Represents an ImportProductsResponse. */ + class ImportProductsResponse implements IImportProductsResponse { + + /** + * Constructs a new ImportProductsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportProductsResponse); + + /** ImportProductsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportProductsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** + * Creates a new ImportProductsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportProductsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IImportProductsResponse): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. + * @param message ImportProductsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Verifies an ImportProductsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportProductsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsResponse; + + /** + * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. + * @param message ImportProductsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportProductsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportProductsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportUserEventsResponse. */ + interface IImportUserEventsResponse { + + /** ImportUserEventsResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); + + /** ImportUserEventsResponse errorsConfig */ + errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary */ + importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + } + + /** Represents an ImportUserEventsResponse. */ + class ImportUserEventsResponse implements IImportUserEventsResponse { + + /** + * Constructs a new ImportUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IImportUserEventsResponse); + + /** ImportUserEventsResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; + + /** ImportUserEventsResponse errorsConfig. */ + public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + + /** ImportUserEventsResponse importSummary. */ + public importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new ImportUserEventsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ColorInfo instance + * @returns ImportUserEventsResponse instance */ - public static create(properties?: google.cloud.retail.v2.IColorInfo): google.cloud.retail.v2.ColorInfo; + public static create(properties?: google.cloud.retail.v2.IImportUserEventsResponse): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. + * @param message ImportUserEventsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ColorInfo + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ColorInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ColorInfo + * @returns ImportUserEventsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ColorInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Verifies a ColorInfo message. + * Verifies an ImportUserEventsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ColorInfo + * @returns ImportUserEventsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ColorInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsResponse; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @param message ColorInfo + * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. + * @param message ImportUserEventsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ColorInfo to JSON. + * Converts this ImportUserEventsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ColorInfo + * Gets the default type url for ImportUserEventsResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a CustomAttribute. */ - interface ICustomAttribute { - - /** CustomAttribute text */ - text?: (string[]|null); - - /** CustomAttribute numbers */ - numbers?: (number[]|null); + /** Properties of a UserEventImportSummary. */ + interface IUserEventImportSummary { - /** CustomAttribute searchable */ - searchable?: (boolean|null); + /** UserEventImportSummary joinedEventsCount */ + joinedEventsCount?: (number|Long|string|null); - /** CustomAttribute indexable */ - indexable?: (boolean|null); + /** UserEventImportSummary unjoinedEventsCount */ + unjoinedEventsCount?: (number|Long|string|null); } - /** Represents a CustomAttribute. */ - class CustomAttribute implements ICustomAttribute { + /** Represents a UserEventImportSummary. */ + class UserEventImportSummary implements IUserEventImportSummary { /** - * Constructs a new CustomAttribute. + * Constructs a new UserEventImportSummary. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICustomAttribute); - - /** CustomAttribute text. */ - public text: string[]; - - /** CustomAttribute numbers. */ - public numbers: number[]; - - /** CustomAttribute searchable. */ - public searchable?: (boolean|null); - - /** CustomAttribute indexable. */ - public indexable?: (boolean|null); + constructor(properties?: google.cloud.retail.v2.IUserEventImportSummary); - /** CustomAttribute _searchable. */ - public _searchable?: "searchable"; + /** UserEventImportSummary joinedEventsCount. */ + public joinedEventsCount: (number|Long|string); - /** CustomAttribute _indexable. */ - public _indexable?: "indexable"; + /** UserEventImportSummary unjoinedEventsCount. */ + public unjoinedEventsCount: (number|Long|string); /** - * Creates a new CustomAttribute instance using the specified properties. + * Creates a new UserEventImportSummary instance using the specified properties. * @param [properties] Properties to set - * @returns CustomAttribute instance + * @returns UserEventImportSummary instance */ - public static create(properties?: google.cloud.retail.v2.ICustomAttribute): google.cloud.retail.v2.CustomAttribute; + public static create(properties?: google.cloud.retail.v2.IUserEventImportSummary): google.cloud.retail.v2.UserEventImportSummary; /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @param message CustomAttribute message or plain object to encode + * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. + * @param message UserEventImportSummary message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICustomAttribute, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CustomAttribute message from the specified reader or buffer. + * Decodes a UserEventImportSummary message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CustomAttribute + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CustomAttribute; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventImportSummary; /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CustomAttribute + * @returns UserEventImportSummary * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CustomAttribute; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventImportSummary; /** - * Verifies a CustomAttribute message. + * Verifies a UserEventImportSummary message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CustomAttribute + * @returns UserEventImportSummary */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CustomAttribute; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventImportSummary; /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @param message CustomAttribute + * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. + * @param message UserEventImportSummary * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CustomAttribute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CustomAttribute to JSON. + * Converts this UserEventImportSummary to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for CustomAttribute + * Gets the default type url for UserEventImportSummary * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a FulfillmentInfo. */ - interface IFulfillmentInfo { - - /** FulfillmentInfo type */ - type?: (string|null); + /** Properties of an ImportCompletionDataResponse. */ + interface IImportCompletionDataResponse { - /** FulfillmentInfo placeIds */ - placeIds?: (string[]|null); + /** ImportCompletionDataResponse errorSamples */ + errorSamples?: (google.rpc.IStatus[]|null); } - /** Represents a FulfillmentInfo. */ - class FulfillmentInfo implements IFulfillmentInfo { + /** Represents an ImportCompletionDataResponse. */ + class ImportCompletionDataResponse implements IImportCompletionDataResponse { /** - * Constructs a new FulfillmentInfo. + * Constructs a new ImportCompletionDataResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IFulfillmentInfo); - - /** FulfillmentInfo type. */ - public type: string; + constructor(properties?: google.cloud.retail.v2.IImportCompletionDataResponse); - /** FulfillmentInfo placeIds. */ - public placeIds: string[]; + /** ImportCompletionDataResponse errorSamples. */ + public errorSamples: google.rpc.IStatus[]; /** - * Creates a new FulfillmentInfo instance using the specified properties. + * Creates a new ImportCompletionDataResponse instance using the specified properties. * @param [properties] Properties to set - * @returns FulfillmentInfo instance + * @returns ImportCompletionDataResponse instance */ - public static create(properties?: google.cloud.retail.v2.IFulfillmentInfo): google.cloud.retail.v2.FulfillmentInfo; + public static create(properties?: google.cloud.retail.v2.IImportCompletionDataResponse): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. - * @param message FulfillmentInfo message or plain object to encode + * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. + * @param message ImportCompletionDataResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FulfillmentInfo + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.FulfillmentInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FulfillmentInfo + * @returns ImportCompletionDataResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.FulfillmentInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Verifies a FulfillmentInfo message. + * Verifies an ImportCompletionDataResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FulfillmentInfo + * @returns ImportCompletionDataResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.FulfillmentInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataResponse; /** - * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. - * @param message FulfillmentInfo + * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. + * @param message ImportCompletionDataResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FulfillmentInfo to JSON. + * Converts this ImportCompletionDataResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for FulfillmentInfo + * Gets the default type url for ImportCompletionDataResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an Image. */ - interface IImage { + /** Properties of a Product. */ + interface IProduct { - /** Image uri */ + /** Product expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + + /** Product ttl */ + ttl?: (google.protobuf.IDuration|null); + + /** Product name */ + name?: (string|null); + + /** Product id */ + id?: (string|null); + + /** Product type */ + type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); + + /** Product primaryProductId */ + primaryProductId?: (string|null); + + /** Product collectionMemberIds */ + collectionMemberIds?: (string[]|null); + + /** Product gtin */ + gtin?: (string|null); + + /** Product categories */ + categories?: (string[]|null); + + /** Product title */ + title?: (string|null); + + /** Product brands */ + brands?: (string[]|null); + + /** Product description */ + description?: (string|null); + + /** Product languageCode */ + languageCode?: (string|null); + + /** Product attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** Product tags */ + tags?: (string[]|null); + + /** Product priceInfo */ + priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** Product rating */ + rating?: (google.cloud.retail.v2.IRating|null); + + /** Product availableTime */ + availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability */ + availability?: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability|null); + + /** Product availableQuantity */ + availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.retail.v2.IFulfillmentInfo[]|null); + + /** Product uri */ uri?: (string|null); - /** Image height */ - height?: (number|null); + /** Product images */ + images?: (google.cloud.retail.v2.IImage[]|null); - /** Image width */ - width?: (number|null); + /** Product audience */ + audience?: (google.cloud.retail.v2.IAudience|null); + + /** Product colorInfo */ + colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + + /** Product sizes */ + sizes?: (string[]|null); + + /** Product materials */ + materials?: (string[]|null); + + /** Product patterns */ + patterns?: (string[]|null); + + /** Product conditions */ + conditions?: (string[]|null); + + /** Product promotions */ + promotions?: (google.cloud.retail.v2.IPromotion[]|null); + + /** Product publishTime */ + publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields */ + retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants */ + variants?: (google.cloud.retail.v2.IProduct[]|null); + + /** Product localInventories */ + localInventories?: (google.cloud.retail.v2.ILocalInventory[]|null); } - /** Represents an Image. */ - class Image implements IImage { + /** Represents a Product. */ + class Product implements IProduct { /** - * Constructs a new Image. + * Constructs a new Product. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImage); + constructor(properties?: google.cloud.retail.v2.IProduct); - /** Image uri. */ + /** Product expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** Product ttl. */ + public ttl?: (google.protobuf.IDuration|null); + + /** Product name. */ + public name: string; + + /** Product id. */ + public id: string; + + /** Product type. */ + public type: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type); + + /** Product primaryProductId. */ + public primaryProductId: string; + + /** Product collectionMemberIds. */ + public collectionMemberIds: string[]; + + /** Product gtin. */ + public gtin: string; + + /** Product categories. */ + public categories: string[]; + + /** Product title. */ + public title: string; + + /** Product brands. */ + public brands: string[]; + + /** Product description. */ + public description: string; + + /** Product languageCode. */ + public languageCode: string; + + /** Product attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** Product tags. */ + public tags: string[]; + + /** Product priceInfo. */ + public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + + /** Product rating. */ + public rating?: (google.cloud.retail.v2.IRating|null); + + /** Product availableTime. */ + public availableTime?: (google.protobuf.ITimestamp|null); + + /** Product availability. */ + public availability: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability); + + /** Product availableQuantity. */ + public availableQuantity?: (google.protobuf.IInt32Value|null); + + /** Product fulfillmentInfo. */ + public fulfillmentInfo: google.cloud.retail.v2.IFulfillmentInfo[]; + + /** Product uri. */ public uri: string; - /** Image height. */ - public height: number; + /** Product images. */ + public images: google.cloud.retail.v2.IImage[]; - /** Image width. */ - public width: number; + /** Product audience. */ + public audience?: (google.cloud.retail.v2.IAudience|null); + + /** Product colorInfo. */ + public colorInfo?: (google.cloud.retail.v2.IColorInfo|null); + + /** Product sizes. */ + public sizes: string[]; + + /** Product materials. */ + public materials: string[]; + + /** Product patterns. */ + public patterns: string[]; + + /** Product conditions. */ + public conditions: string[]; + + /** Product promotions. */ + public promotions: google.cloud.retail.v2.IPromotion[]; + + /** Product publishTime. */ + public publishTime?: (google.protobuf.ITimestamp|null); + + /** Product retrievableFields. */ + public retrievableFields?: (google.protobuf.IFieldMask|null); + + /** Product variants. */ + public variants: google.cloud.retail.v2.IProduct[]; + + /** Product localInventories. */ + public localInventories: google.cloud.retail.v2.ILocalInventory[]; + + /** Product expiration. */ + public expiration?: ("expireTime"|"ttl"); /** - * Creates a new Image instance using the specified properties. + * Creates a new Product instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns Product instance */ - public static create(properties?: google.cloud.retail.v2.IImage): google.cloud.retail.v2.Image; + public static create(properties?: google.cloud.retail.v2.IProduct): google.cloud.retail.v2.Product; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. + * @param message Product message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a Product message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Product; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a Product message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns Product * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Product; /** - * Verifies an Image message. + * Verifies a Product message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a Product message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns Product */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Product; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this Product to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Image + * Gets the default type url for Product * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an Interval. */ - interface IInterval { + namespace Product { - /** Interval minimum */ - minimum?: (number|null); + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + VARIANT = 2, + COLLECTION = 3 + } - /** Interval exclusiveMinimum */ - exclusiveMinimum?: (number|null); + /** Availability enum. */ + enum Availability { + AVAILABILITY_UNSPECIFIED = 0, + IN_STOCK = 1, + OUT_OF_STOCK = 2, + PREORDER = 3, + BACKORDER = 4 + } + } - /** Interval maximum */ - maximum?: (number|null); + /** Properties of a Promotion. */ + interface IPromotion { - /** Interval exclusiveMaximum */ - exclusiveMaximum?: (number|null); + /** Promotion promotionId */ + promotionId?: (string|null); } - /** Represents an Interval. */ - class Interval implements IInterval { + /** Represents a Promotion. */ + class Promotion implements IPromotion { /** - * Constructs a new Interval. + * Constructs a new Promotion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IInterval); - - /** Interval minimum. */ - public minimum?: (number|null); - - /** Interval exclusiveMinimum. */ - public exclusiveMinimum?: (number|null); - - /** Interval maximum. */ - public maximum?: (number|null); - - /** Interval exclusiveMaximum. */ - public exclusiveMaximum?: (number|null); - - /** Interval min. */ - public min?: ("minimum"|"exclusiveMinimum"); + constructor(properties?: google.cloud.retail.v2.IPromotion); - /** Interval max. */ - public max?: ("maximum"|"exclusiveMaximum"); + /** Promotion promotionId. */ + public promotionId: string; /** - * Creates a new Interval instance using the specified properties. + * Creates a new Promotion instance using the specified properties. * @param [properties] Properties to set - * @returns Interval instance + * @returns Promotion instance */ - public static create(properties?: google.cloud.retail.v2.IInterval): google.cloud.retail.v2.Interval; + public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; /** - * Encodes the specified Interval message. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode + * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. + * @param message Promotion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Interval message from the specified reader or buffer. + * Decodes a Promotion message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Interval + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Interval; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; /** - * Decodes an Interval message from the specified reader or buffer, length delimited. + * Decodes a Promotion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Interval + * @returns Promotion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Interval; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; /** - * Verifies an Interval message. + * Verifies a Promotion message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * Creates a Promotion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Interval + * @returns Promotion */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Interval; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @param message Interval + * Creates a plain object from a Promotion message. Also converts values to other types if specified. + * @param message Promotion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Interval to JSON. + * Converts this Promotion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Interval + * Gets the default type url for Promotion * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a PriceInfo. */ - interface IPriceInfo { + /** Properties of a UserEvent. */ + interface IUserEvent { - /** PriceInfo currencyCode */ - currencyCode?: (string|null); + /** UserEvent eventType */ + eventType?: (string|null); - /** PriceInfo price */ - price?: (number|null); + /** UserEvent visitorId */ + visitorId?: (string|null); - /** PriceInfo originalPrice */ - originalPrice?: (number|null); + /** UserEvent sessionId */ + sessionId?: (string|null); - /** PriceInfo cost */ - cost?: (number|null); + /** UserEvent eventTime */ + eventTime?: (google.protobuf.ITimestamp|null); - /** PriceInfo priceEffectiveTime */ - priceEffectiveTime?: (google.protobuf.ITimestamp|null); + /** UserEvent experimentIds */ + experimentIds?: (string[]|null); - /** PriceInfo priceExpireTime */ - priceExpireTime?: (google.protobuf.ITimestamp|null); + /** UserEvent attributionToken */ + attributionToken?: (string|null); - /** PriceInfo priceRange */ - priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + /** UserEvent productDetails */ + productDetails?: (google.cloud.retail.v2.IProductDetail[]|null); + + /** UserEvent completionDetail */ + completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); + + /** UserEvent attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + + /** UserEvent cartId */ + cartId?: (string|null); + + /** UserEvent purchaseTransaction */ + purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); + + /** UserEvent searchQuery */ + searchQuery?: (string|null); + + /** UserEvent filter */ + filter?: (string|null); + + /** UserEvent orderBy */ + orderBy?: (string|null); + + /** UserEvent offset */ + offset?: (number|null); + + /** UserEvent pageCategories */ + pageCategories?: (string[]|null); + + /** UserEvent userInfo */ + userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** UserEvent uri */ + uri?: (string|null); + + /** UserEvent referrerUri */ + referrerUri?: (string|null); + + /** UserEvent pageViewId */ + pageViewId?: (string|null); } - /** Represents a PriceInfo. */ - class PriceInfo implements IPriceInfo { + /** Represents a UserEvent. */ + class UserEvent implements IUserEvent { /** - * Constructs a new PriceInfo. + * Constructs a new UserEvent. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPriceInfo); + constructor(properties?: google.cloud.retail.v2.IUserEvent); - /** PriceInfo currencyCode. */ - public currencyCode: string; + /** UserEvent eventType. */ + public eventType: string; - /** PriceInfo price. */ - public price: number; + /** UserEvent visitorId. */ + public visitorId: string; - /** PriceInfo originalPrice. */ - public originalPrice: number; + /** UserEvent sessionId. */ + public sessionId: string; - /** PriceInfo cost. */ - public cost: number; + /** UserEvent eventTime. */ + public eventTime?: (google.protobuf.ITimestamp|null); - /** PriceInfo priceEffectiveTime. */ - public priceEffectiveTime?: (google.protobuf.ITimestamp|null); + /** UserEvent experimentIds. */ + public experimentIds: string[]; - /** PriceInfo priceExpireTime. */ - public priceExpireTime?: (google.protobuf.ITimestamp|null); + /** UserEvent attributionToken. */ + public attributionToken: string; - /** PriceInfo priceRange. */ - public priceRange?: (google.cloud.retail.v2.PriceInfo.IPriceRange|null); + /** UserEvent productDetails. */ + public productDetails: google.cloud.retail.v2.IProductDetail[]; + + /** UserEvent completionDetail. */ + public completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); + + /** UserEvent attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** UserEvent cartId. */ + public cartId: string; + + /** UserEvent purchaseTransaction. */ + public purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); + + /** UserEvent searchQuery. */ + public searchQuery: string; + + /** UserEvent filter. */ + public filter: string; + + /** UserEvent orderBy. */ + public orderBy: string; + + /** UserEvent offset. */ + public offset: number; + + /** UserEvent pageCategories. */ + public pageCategories: string[]; + + /** UserEvent userInfo. */ + public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** UserEvent uri. */ + public uri: string; + + /** UserEvent referrerUri. */ + public referrerUri: string; + + /** UserEvent pageViewId. */ + public pageViewId: string; /** - * Creates a new PriceInfo instance using the specified properties. + * Creates a new UserEvent instance using the specified properties. * @param [properties] Properties to set - * @returns PriceInfo instance + * @returns UserEvent instance */ - public static create(properties?: google.cloud.retail.v2.IPriceInfo): google.cloud.retail.v2.PriceInfo; + public static create(properties?: google.cloud.retail.v2.IUserEvent): google.cloud.retail.v2.UserEvent; /** - * Encodes the specified PriceInfo message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PriceInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.verify|verify} messages. - * @param message PriceInfo message or plain object to encode + * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. + * @param message UserEvent message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPriceInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PriceInfo message from the specified reader or buffer. + * Decodes a UserEvent message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PriceInfo + * @returns UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEvent; /** - * Decodes a PriceInfo message from the specified reader or buffer, length delimited. + * Decodes a UserEvent message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PriceInfo + * @returns UserEvent * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEvent; /** - * Verifies a PriceInfo message. + * Verifies a UserEvent message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PriceInfo message from a plain object. Also converts values to their respective internal types. + * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PriceInfo + * @returns UserEvent */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEvent; /** - * Creates a plain object from a PriceInfo message. Also converts values to other types if specified. - * @param message PriceInfo + * Creates a plain object from a UserEvent message. Also converts values to other types if specified. + * @param message UserEvent * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PriceInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PriceInfo to JSON. + * Converts this UserEvent to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for PriceInfo + * Gets the default type url for UserEvent * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace PriceInfo { - - /** Properties of a PriceRange. */ - interface IPriceRange { - - /** PriceRange price */ - price?: (google.cloud.retail.v2.IInterval|null); - - /** PriceRange originalPrice */ - originalPrice?: (google.cloud.retail.v2.IInterval|null); - } - - /** Represents a PriceRange. */ - class PriceRange implements IPriceRange { - - /** - * Constructs a new PriceRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange); - - /** PriceRange price. */ - public price?: (google.cloud.retail.v2.IInterval|null); - - /** PriceRange originalPrice. */ - public originalPrice?: (google.cloud.retail.v2.IInterval|null); - - /** - * Creates a new PriceRange instance using the specified properties. - * @param [properties] Properties to set - * @returns PriceRange instance - */ - public static create(properties?: google.cloud.retail.v2.PriceInfo.IPriceRange): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Encodes the specified PriceRange message. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PriceRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PriceInfo.PriceRange.verify|verify} messages. - * @param message PriceRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.PriceInfo.IPriceRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PriceRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Decodes a PriceRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PriceRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Verifies a PriceRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PriceRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PriceRange - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PriceInfo.PriceRange; - - /** - * Creates a plain object from a PriceRange message. Also converts values to other types if specified. - * @param message PriceRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.PriceInfo.PriceRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PriceRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PriceRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Rating. */ - interface IRating { - - /** Rating ratingCount */ - ratingCount?: (number|null); + /** Properties of a ProductDetail. */ + interface IProductDetail { - /** Rating averageRating */ - averageRating?: (number|null); + /** ProductDetail product */ + product?: (google.cloud.retail.v2.IProduct|null); - /** Rating ratingHistogram */ - ratingHistogram?: (number[]|null); + /** ProductDetail quantity */ + quantity?: (google.protobuf.IInt32Value|null); } - /** Represents a Rating. */ - class Rating implements IRating { + /** Represents a ProductDetail. */ + class ProductDetail implements IProductDetail { /** - * Constructs a new Rating. + * Constructs a new ProductDetail. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IRating); - - /** Rating ratingCount. */ - public ratingCount: number; + constructor(properties?: google.cloud.retail.v2.IProductDetail); - /** Rating averageRating. */ - public averageRating: number; + /** ProductDetail product. */ + public product?: (google.cloud.retail.v2.IProduct|null); - /** Rating ratingHistogram. */ - public ratingHistogram: number[]; + /** ProductDetail quantity. */ + public quantity?: (google.protobuf.IInt32Value|null); /** - * Creates a new Rating instance using the specified properties. + * Creates a new ProductDetail instance using the specified properties. * @param [properties] Properties to set - * @returns Rating instance + * @returns ProductDetail instance */ - public static create(properties?: google.cloud.retail.v2.IRating): google.cloud.retail.v2.Rating; + public static create(properties?: google.cloud.retail.v2.IProductDetail): google.cloud.retail.v2.ProductDetail; /** - * Encodes the specified Rating message. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Rating message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rating.verify|verify} messages. - * @param message Rating message or plain object to encode + * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. + * @param message ProductDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IRating, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Rating message from the specified reader or buffer. + * Decodes a ProductDetail message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Rating + * @returns ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Rating; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductDetail; /** - * Decodes a Rating message from the specified reader or buffer, length delimited. + * Decodes a ProductDetail message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Rating + * @returns ProductDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Rating; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductDetail; /** - * Verifies a Rating message. + * Verifies a ProductDetail message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Rating message from a plain object. Also converts values to their respective internal types. + * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Rating + * @returns ProductDetail */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Rating; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductDetail; /** - * Creates a plain object from a Rating message. Also converts values to other types if specified. - * @param message Rating + * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. + * @param message ProductDetail * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Rating, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Rating to JSON. + * Converts this ProductDetail to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Rating + * Gets the default type url for ProductDetail * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a UserInfo. */ - interface IUserInfo { - - /** UserInfo userId */ - userId?: (string|null); + /** Properties of a CompletionDetail. */ + interface ICompletionDetail { - /** UserInfo ipAddress */ - ipAddress?: (string|null); + /** CompletionDetail completionAttributionToken */ + completionAttributionToken?: (string|null); - /** UserInfo userAgent */ - userAgent?: (string|null); + /** CompletionDetail selectedSuggestion */ + selectedSuggestion?: (string|null); - /** UserInfo directUserRequest */ - directUserRequest?: (boolean|null); + /** CompletionDetail selectedPosition */ + selectedPosition?: (number|null); } - /** Represents a UserInfo. */ - class UserInfo implements IUserInfo { + /** Represents a CompletionDetail. */ + class CompletionDetail implements ICompletionDetail { /** - * Constructs a new UserInfo. + * Constructs a new CompletionDetail. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserInfo); - - /** UserInfo userId. */ - public userId: string; + constructor(properties?: google.cloud.retail.v2.ICompletionDetail); - /** UserInfo ipAddress. */ - public ipAddress: string; + /** CompletionDetail completionAttributionToken. */ + public completionAttributionToken: string; - /** UserInfo userAgent. */ - public userAgent: string; + /** CompletionDetail selectedSuggestion. */ + public selectedSuggestion: string; - /** UserInfo directUserRequest. */ - public directUserRequest: boolean; + /** CompletionDetail selectedPosition. */ + public selectedPosition: number; /** - * Creates a new UserInfo instance using the specified properties. + * Creates a new CompletionDetail instance using the specified properties. * @param [properties] Properties to set - * @returns UserInfo instance + * @returns CompletionDetail instance */ - public static create(properties?: google.cloud.retail.v2.IUserInfo): google.cloud.retail.v2.UserInfo; + public static create(properties?: google.cloud.retail.v2.ICompletionDetail): google.cloud.retail.v2.CompletionDetail; /** - * Encodes the specified UserInfo message. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserInfo.verify|verify} messages. - * @param message UserInfo message or plain object to encode + * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. + * @param message CompletionDetail message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserInfo message from the specified reader or buffer. + * Decodes a CompletionDetail message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserInfo + * @returns CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDetail; /** - * Decodes a UserInfo message from the specified reader or buffer, length delimited. + * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserInfo + * @returns CompletionDetail * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDetail; /** - * Verifies a UserInfo message. + * Verifies a CompletionDetail message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserInfo message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserInfo + * @returns CompletionDetail */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDetail; /** - * Creates a plain object from a UserInfo message. Also converts values to other types if specified. - * @param message UserInfo + * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. + * @param message CompletionDetail * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserInfo to JSON. + * Converts this CompletionDetail to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for UserInfo + * Gets the default type url for CompletionDetail * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a LocalInventory. */ - interface ILocalInventory { + /** Properties of a PurchaseTransaction. */ + interface IPurchaseTransaction { - /** LocalInventory placeId */ - placeId?: (string|null); + /** PurchaseTransaction id */ + id?: (string|null); - /** LocalInventory priceInfo */ - priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + /** PurchaseTransaction revenue */ + revenue?: (number|null); - /** LocalInventory attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + /** PurchaseTransaction tax */ + tax?: (number|null); - /** LocalInventory fulfillmentTypes */ - fulfillmentTypes?: (string[]|null); + /** PurchaseTransaction cost */ + cost?: (number|null); + + /** PurchaseTransaction currencyCode */ + currencyCode?: (string|null); } - /** Represents a LocalInventory. */ - class LocalInventory implements ILocalInventory { + /** Represents a PurchaseTransaction. */ + class PurchaseTransaction implements IPurchaseTransaction { /** - * Constructs a new LocalInventory. + * Constructs a new PurchaseTransaction. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ILocalInventory); + constructor(properties?: google.cloud.retail.v2.IPurchaseTransaction); - /** LocalInventory placeId. */ - public placeId: string; + /** PurchaseTransaction id. */ + public id: string; - /** LocalInventory priceInfo. */ - public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); + /** PurchaseTransaction revenue. */ + public revenue: number; - /** LocalInventory attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + /** PurchaseTransaction tax. */ + public tax: number; - /** LocalInventory fulfillmentTypes. */ - public fulfillmentTypes: string[]; + /** PurchaseTransaction cost. */ + public cost: number; + + /** PurchaseTransaction currencyCode. */ + public currencyCode: string; /** - * Creates a new LocalInventory instance using the specified properties. + * Creates a new PurchaseTransaction instance using the specified properties. * @param [properties] Properties to set - * @returns LocalInventory instance + * @returns PurchaseTransaction instance */ - public static create(properties?: google.cloud.retail.v2.ILocalInventory): google.cloud.retail.v2.LocalInventory; + public static create(properties?: google.cloud.retail.v2.IPurchaseTransaction): google.cloud.retail.v2.PurchaseTransaction; /** - * Encodes the specified LocalInventory message. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. - * @param message LocalInventory message or plain object to encode + * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified LocalInventory message, length delimited. Does not implicitly {@link google.cloud.retail.v2.LocalInventory.verify|verify} messages. - * @param message LocalInventory message or plain object to encode + * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. + * @param message PurchaseTransaction message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ILocalInventory, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a LocalInventory message from the specified reader or buffer. + * Decodes a PurchaseTransaction message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns LocalInventory + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.LocalInventory; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurchaseTransaction; /** - * Decodes a LocalInventory message from the specified reader or buffer, length delimited. + * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns LocalInventory + * @returns PurchaseTransaction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.LocalInventory; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurchaseTransaction; /** - * Verifies a LocalInventory message. + * Verifies a PurchaseTransaction message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a LocalInventory message from a plain object. Also converts values to their respective internal types. + * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns LocalInventory + * @returns PurchaseTransaction */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.LocalInventory; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurchaseTransaction; /** - * Creates a plain object from a LocalInventory message. Also converts values to other types if specified. - * @param message LocalInventory + * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. + * @param message PurchaseTransaction * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.LocalInventory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this LocalInventory to JSON. + * Converts this PurchaseTransaction to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for LocalInventory + * Gets the default type url for PurchaseTransaction * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Represents a CompletionService */ - class CompletionService extends $protobuf.rpc.Service { + /** Represents a CatalogService */ + class CatalogService extends $protobuf.rpc.Service { /** - * Constructs a new CompletionService service. + * Constructs a new CatalogService service. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited @@ -2232,3203 +5924,2988 @@ export namespace google { constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates new CompletionService service using the specified rpc implementation. + * Creates new CatalogService service using the specified rpc implementation. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CatalogService; /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object - * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCatalogsResponse */ - public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest, callback: google.cloud.retail.v2.CompletionService.CompleteQueryCallback): void; + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest, callback: google.cloud.retail.v2.CatalogService.ListCatalogsCallback): void; /** - * Calls CompleteQuery. - * @param request CompleteQueryRequest message or plain object + * Calls ListCatalogs. + * @param request ListCatalogsRequest message or plain object * @returns Promise */ - public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest): Promise; + public listCatalogs(request: google.cloud.retail.v2.IListCatalogsRequest): Promise; /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Catalog */ - public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest, callback: google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback): void; + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCatalogCallback): void; /** - * Calls ImportCompletionData. - * @param request ImportCompletionDataRequest message or plain object + * Calls UpdateCatalog. + * @param request UpdateCatalogRequest message or plain object * @returns Promise */ - public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest): Promise; + public updateCatalog(request: google.cloud.retail.v2.IUpdateCatalogRequest): Promise; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback): void; + + /** + * Calls SetDefaultBranch. + * @param request SetDefaultBranchRequest message or plain object + * @returns Promise + */ + public setDefaultBranch(request: google.cloud.retail.v2.ISetDefaultBranchRequest): Promise; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + */ + public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest, callback: google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback): void; + + /** + * Calls GetDefaultBranch. + * @param request GetDefaultBranchRequest message or plain object + * @returns Promise + */ + public getDefaultBranch(request: google.cloud.retail.v2.IGetDefaultBranchRequest): Promise; + + /** + * Calls GetCompletionConfig. + * @param request GetCompletionConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompletionConfig + */ + public getCompletionConfig(request: google.cloud.retail.v2.IGetCompletionConfigRequest, callback: google.cloud.retail.v2.CatalogService.GetCompletionConfigCallback): void; + + /** + * Calls GetCompletionConfig. + * @param request GetCompletionConfigRequest message or plain object + * @returns Promise + */ + public getCompletionConfig(request: google.cloud.retail.v2.IGetCompletionConfigRequest): Promise; + + /** + * Calls UpdateCompletionConfig. + * @param request UpdateCompletionConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompletionConfig + */ + public updateCompletionConfig(request: google.cloud.retail.v2.IUpdateCompletionConfigRequest, callback: google.cloud.retail.v2.CatalogService.UpdateCompletionConfigCallback): void; + + /** + * Calls UpdateCompletionConfig. + * @param request UpdateCompletionConfigRequest message or plain object + * @returns Promise + */ + public updateCompletionConfig(request: google.cloud.retail.v2.IUpdateCompletionConfigRequest): Promise; + + /** + * Calls GetAttributesConfig. + * @param request GetAttributesConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public getAttributesConfig(request: google.cloud.retail.v2.IGetAttributesConfigRequest, callback: google.cloud.retail.v2.CatalogService.GetAttributesConfigCallback): void; + + /** + * Calls GetAttributesConfig. + * @param request GetAttributesConfigRequest message or plain object + * @returns Promise + */ + public getAttributesConfig(request: google.cloud.retail.v2.IGetAttributesConfigRequest): Promise; + + /** + * Calls UpdateAttributesConfig. + * @param request UpdateAttributesConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public updateAttributesConfig(request: google.cloud.retail.v2.IUpdateAttributesConfigRequest, callback: google.cloud.retail.v2.CatalogService.UpdateAttributesConfigCallback): void; + + /** + * Calls UpdateAttributesConfig. + * @param request UpdateAttributesConfigRequest message or plain object + * @returns Promise + */ + public updateAttributesConfig(request: google.cloud.retail.v2.IUpdateAttributesConfigRequest): Promise; + + /** + * Calls AddCatalogAttribute. + * @param request AddCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public addCatalogAttribute(request: google.cloud.retail.v2.IAddCatalogAttributeRequest, callback: google.cloud.retail.v2.CatalogService.AddCatalogAttributeCallback): void; + + /** + * Calls AddCatalogAttribute. + * @param request AddCatalogAttributeRequest message or plain object + * @returns Promise + */ + public addCatalogAttribute(request: google.cloud.retail.v2.IAddCatalogAttributeRequest): Promise; + + /** + * Calls RemoveCatalogAttribute. + * @param request RemoveCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public removeCatalogAttribute(request: google.cloud.retail.v2.IRemoveCatalogAttributeRequest, callback: google.cloud.retail.v2.CatalogService.RemoveCatalogAttributeCallback): void; + + /** + * Calls RemoveCatalogAttribute. + * @param request RemoveCatalogAttributeRequest message or plain object + * @returns Promise + */ + public removeCatalogAttribute(request: google.cloud.retail.v2.IRemoveCatalogAttributeRequest): Promise; + + /** + * Calls ReplaceCatalogAttribute. + * @param request ReplaceCatalogAttributeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AttributesConfig + */ + public replaceCatalogAttribute(request: google.cloud.retail.v2.IReplaceCatalogAttributeRequest, callback: google.cloud.retail.v2.CatalogService.ReplaceCatalogAttributeCallback): void; + + /** + * Calls ReplaceCatalogAttribute. + * @param request ReplaceCatalogAttributeRequest message or plain object + * @returns Promise + */ + public replaceCatalogAttribute(request: google.cloud.retail.v2.IReplaceCatalogAttributeRequest): Promise; } - namespace CompletionService { + namespace CatalogService { /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService|completeQuery}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|listCatalogs}. * @param error Error, if any - * @param [response] CompleteQueryResponse + * @param [response] ListCatalogsResponse */ - type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompleteQueryResponse) => void; + type ListCatalogsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListCatalogsResponse) => void; /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService|importCompletionData}. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCatalog}. * @param error Error, if any - * @param [response] Operation + * @param [response] Catalog */ - type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a CompleteQueryRequest. */ - interface ICompleteQueryRequest { + type UpdateCatalogCallback = (error: (Error|null), response?: google.cloud.retail.v2.Catalog) => void; - /** CompleteQueryRequest catalog */ - catalog?: (string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|setDefaultBranch}. + * @param error Error, if any + * @param [response] Empty + */ + type SetDefaultBranchCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - /** CompleteQueryRequest query */ - query?: (string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getDefaultBranch}. + * @param error Error, if any + * @param [response] GetDefaultBranchResponse + */ + type GetDefaultBranchCallback = (error: (Error|null), response?: google.cloud.retail.v2.GetDefaultBranchResponse) => void; - /** CompleteQueryRequest visitorId */ - visitorId?: (string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getCompletionConfig}. + * @param error Error, if any + * @param [response] CompletionConfig + */ + type GetCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompletionConfig) => void; - /** CompleteQueryRequest languageCodes */ - languageCodes?: (string[]|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCompletionConfig}. + * @param error Error, if any + * @param [response] CompletionConfig + */ + type UpdateCompletionConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompletionConfig) => void; - /** CompleteQueryRequest deviceType */ - deviceType?: (string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getAttributesConfig}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type GetAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.AttributesConfig) => void; - /** CompleteQueryRequest dataset */ - dataset?: (string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateAttributesConfig}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type UpdateAttributesConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.AttributesConfig) => void; - /** CompleteQueryRequest maxSuggestions */ - maxSuggestions?: (number|null); - } + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|addCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type AddCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2.AttributesConfig) => void; - /** Represents a CompleteQueryRequest. */ - class CompleteQueryRequest implements ICompleteQueryRequest { + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|removeCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig + */ + type RemoveCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2.AttributesConfig) => void; /** - * Constructs a new CompleteQueryRequest. - * @param [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2.CatalogService|replaceCatalogAttribute}. + * @param error Error, if any + * @param [response] AttributesConfig */ - constructor(properties?: google.cloud.retail.v2.ICompleteQueryRequest); + type ReplaceCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2.AttributesConfig) => void; + } - /** CompleteQueryRequest catalog. */ - public catalog: string; + /** Properties of a ListCatalogsRequest. */ + interface IListCatalogsRequest { - /** CompleteQueryRequest query. */ - public query: string; + /** ListCatalogsRequest parent */ + parent?: (string|null); - /** CompleteQueryRequest visitorId. */ - public visitorId: string; + /** ListCatalogsRequest pageSize */ + pageSize?: (number|null); - /** CompleteQueryRequest languageCodes. */ - public languageCodes: string[]; + /** ListCatalogsRequest pageToken */ + pageToken?: (string|null); + } - /** CompleteQueryRequest deviceType. */ - public deviceType: string; + /** Represents a ListCatalogsRequest. */ + class ListCatalogsRequest implements IListCatalogsRequest { - /** CompleteQueryRequest dataset. */ - public dataset: string; + /** + * Constructs a new ListCatalogsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IListCatalogsRequest); - /** CompleteQueryRequest maxSuggestions. */ - public maxSuggestions: number; + /** ListCatalogsRequest parent. */ + public parent: string; + + /** ListCatalogsRequest pageSize. */ + public pageSize: number; + + /** ListCatalogsRequest pageToken. */ + public pageToken: string; /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new ListCatalogsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryRequest instance + * @returns ListCatalogsRequest instance */ - public static create(properties?: google.cloud.retail.v2.ICompleteQueryRequest): google.cloud.retail.v2.CompleteQueryRequest; + public static create(properties?: google.cloud.retail.v2.IListCatalogsRequest): google.cloud.retail.v2.ListCatalogsRequest; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. - * @param message CompleteQueryRequest message or plain object to encode + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * @param message ListCatalogsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryRequest + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsRequest; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryRequest + * @returns ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsRequest; /** - * Verifies a CompleteQueryRequest message. + * Verifies a ListCatalogsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryRequest + * @returns ListCatalogsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsRequest; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. - * @param message CompleteQueryRequest + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * @param message ListCatalogsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListCatalogsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this ListCatalogsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for CompleteQueryRequest + * Gets the default type url for ListCatalogsRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a CompleteQueryResponse. */ - interface ICompleteQueryResponse { - - /** CompleteQueryResponse completionResults */ - completionResults?: (google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]|null); + /** Properties of a ListCatalogsResponse. */ + interface IListCatalogsResponse { - /** CompleteQueryResponse attributionToken */ - attributionToken?: (string|null); + /** ListCatalogsResponse catalogs */ + catalogs?: (google.cloud.retail.v2.ICatalog[]|null); - /** CompleteQueryResponse recentSearchResults */ - recentSearchResults?: (google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]|null); + /** ListCatalogsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a CompleteQueryResponse. */ - class CompleteQueryResponse implements ICompleteQueryResponse { + /** Represents a ListCatalogsResponse. */ + class ListCatalogsResponse implements IListCatalogsResponse { /** - * Constructs a new CompleteQueryResponse. + * Constructs a new ListCatalogsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompleteQueryResponse); - - /** CompleteQueryResponse completionResults. */ - public completionResults: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]; + constructor(properties?: google.cloud.retail.v2.IListCatalogsResponse); - /** CompleteQueryResponse attributionToken. */ - public attributionToken: string; + /** ListCatalogsResponse catalogs. */ + public catalogs: google.cloud.retail.v2.ICatalog[]; - /** CompleteQueryResponse recentSearchResults. */ - public recentSearchResults: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]; + /** ListCatalogsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns CompleteQueryResponse instance + * @returns ListCatalogsResponse instance */ - public static create(properties?: google.cloud.retail.v2.ICompleteQueryResponse): google.cloud.retail.v2.CompleteQueryResponse; + public static create(properties?: google.cloud.retail.v2.IListCatalogsResponse): google.cloud.retail.v2.ListCatalogsResponse; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. - * @param message CompleteQueryResponse message or plain object to encode + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * @param message ListCatalogsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListCatalogsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompleteQueryResponse + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListCatalogsResponse; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompleteQueryResponse + * @returns ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListCatalogsResponse; /** - * Verifies a CompleteQueryResponse message. + * Verifies a ListCatalogsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompleteQueryResponse + * @returns ListCatalogsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListCatalogsResponse; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. - * @param message CompleteQueryResponse + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * @param message ListCatalogsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListCatalogsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this ListCatalogsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for CompleteQueryResponse + * Gets the default type url for ListCatalogsResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace CompleteQueryResponse { - - /** Properties of a CompletionResult. */ - interface ICompletionResult { - - /** CompletionResult suggestion */ - suggestion?: (string|null); - - /** CompletionResult attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); - } - - /** Represents a CompletionResult. */ - class CompletionResult implements ICompletionResult { - - /** - * Constructs a new CompletionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult); - - /** CompletionResult suggestion. */ - public suggestion: string; - - /** CompletionResult attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - - /** - * Creates a new CompletionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns CompletionResult instance - */ - public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @param message CompletionResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Verifies a CompletionResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CompletionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @param message CompletionResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CompletionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CompletionResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RecentSearchResult. */ - interface IRecentSearchResult { - - /** RecentSearchResult recentSearch */ - recentSearch?: (string|null); - } - - /** Represents a RecentSearchResult. */ - class RecentSearchResult implements IRecentSearchResult { - - /** - * Constructs a new RecentSearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult); - - /** RecentSearchResult recentSearch. */ - public recentSearch: string; - - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns RecentSearchResult instance - */ - public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @param message RecentSearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Verifies a RecentSearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RecentSearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; - - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @param message RecentSearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RecentSearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RecentSearchResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a GcsSource. */ - interface IGcsSource { + /** Properties of an UpdateCatalogRequest. */ + interface IUpdateCatalogRequest { - /** GcsSource inputUris */ - inputUris?: (string[]|null); + /** UpdateCatalogRequest catalog */ + catalog?: (google.cloud.retail.v2.ICatalog|null); - /** GcsSource dataSchema */ - dataSchema?: (string|null); + /** UpdateCatalogRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents an UpdateCatalogRequest. */ + class UpdateCatalogRequest implements IUpdateCatalogRequest { /** - * Constructs a new GcsSource. + * Constructs a new UpdateCatalogRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IGcsSource); + constructor(properties?: google.cloud.retail.v2.IUpdateCatalogRequest); - /** GcsSource inputUris. */ - public inputUris: string[]; + /** UpdateCatalogRequest catalog. */ + public catalog?: (google.cloud.retail.v2.ICatalog|null); - /** GcsSource dataSchema. */ - public dataSchema: string; + /** UpdateCatalogRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns UpdateCatalogRequest instance */ - public static create(properties?: google.cloud.retail.v2.IGcsSource): google.cloud.retail.v2.GcsSource; + public static create(properties?: google.cloud.retail.v2.IUpdateCatalogRequest): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * @param message UpdateCatalogRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCatalogRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Verifies a GcsSource message. + * Verifies an UpdateCatalogRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns UpdateCatalogRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCatalogRequest; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * @param message UpdateCatalogRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UpdateCatalogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this UpdateCatalogRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for GcsSource + * Gets the default type url for UpdateCatalogRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a BigQuerySource. */ - interface IBigQuerySource { - - /** BigQuerySource partitionDate */ - partitionDate?: (google.type.IDate|null); - - /** BigQuerySource projectId */ - projectId?: (string|null); + /** Properties of a SetDefaultBranchRequest. */ + interface ISetDefaultBranchRequest { - /** BigQuerySource datasetId */ - datasetId?: (string|null); + /** SetDefaultBranchRequest catalog */ + catalog?: (string|null); - /** BigQuerySource tableId */ - tableId?: (string|null); + /** SetDefaultBranchRequest branchId */ + branchId?: (string|null); - /** BigQuerySource gcsStagingDir */ - gcsStagingDir?: (string|null); + /** SetDefaultBranchRequest note */ + note?: (string|null); - /** BigQuerySource dataSchema */ - dataSchema?: (string|null); + /** SetDefaultBranchRequest force */ + force?: (boolean|null); } - /** Represents a BigQuerySource. */ - class BigQuerySource implements IBigQuerySource { + /** Represents a SetDefaultBranchRequest. */ + class SetDefaultBranchRequest implements ISetDefaultBranchRequest { /** - * Constructs a new BigQuerySource. + * Constructs a new SetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IBigQuerySource); - - /** BigQuerySource partitionDate. */ - public partitionDate?: (google.type.IDate|null); - - /** BigQuerySource projectId. */ - public projectId: string; - - /** BigQuerySource datasetId. */ - public datasetId: string; + constructor(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest); - /** BigQuerySource tableId. */ - public tableId: string; + /** SetDefaultBranchRequest catalog. */ + public catalog: string; - /** BigQuerySource gcsStagingDir. */ - public gcsStagingDir: string; + /** SetDefaultBranchRequest branchId. */ + public branchId: string; - /** BigQuerySource dataSchema. */ - public dataSchema: string; + /** SetDefaultBranchRequest note. */ + public note: string; - /** BigQuerySource partition. */ - public partition?: "partitionDate"; + /** SetDefaultBranchRequest force. */ + public force: boolean; /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns BigQuerySource instance + * @returns SetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2.IBigQuerySource): google.cloud.retail.v2.BigQuerySource; + public static create(properties?: google.cloud.retail.v2.ISetDefaultBranchRequest): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. - * @param message BigQuerySource message or plain object to encode + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * @param message SetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IBigQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BigQuerySource + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.BigQuerySource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BigQuerySource + * @returns SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.BigQuerySource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Verifies a BigQuerySource message. + * Verifies a SetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BigQuerySource + * @returns SetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.BigQuerySource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SetDefaultBranchRequest; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. - * @param message BigQuerySource + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message SetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.BigQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BigQuerySource to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for BigQuerySource + * Gets the default type url for SetDefaultBranchRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ProductInlineSource. */ - interface IProductInlineSource { + /** Properties of a GetDefaultBranchRequest. */ + interface IGetDefaultBranchRequest { - /** ProductInlineSource products */ - products?: (google.cloud.retail.v2.IProduct[]|null); + /** GetDefaultBranchRequest catalog */ + catalog?: (string|null); } - /** Represents a ProductInlineSource. */ - class ProductInlineSource implements IProductInlineSource { + /** Represents a GetDefaultBranchRequest. */ + class GetDefaultBranchRequest implements IGetDefaultBranchRequest { /** - * Constructs a new ProductInlineSource. + * Constructs a new GetDefaultBranchRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProductInlineSource); + constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest); - /** ProductInlineSource products. */ - public products: google.cloud.retail.v2.IProduct[]; + /** GetDefaultBranchRequest catalog. */ + public catalog: string; /** - * Creates a new ProductInlineSource instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInlineSource instance + * @returns GetDefaultBranchRequest instance */ - public static create(properties?: google.cloud.retail.v2.IProductInlineSource): google.cloud.retail.v2.ProductInlineSource; + public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchRequest): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. - * @param message ProductInlineSource message or plain object to encode + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * @param message GetDefaultBranchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProductInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInlineSource + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInlineSource + * @returns GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Verifies a ProductInlineSource message. + * Verifies a GetDefaultBranchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInlineSource + * @returns GetDefaultBranchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchRequest; /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @param message ProductInlineSource + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * @param message GetDefaultBranchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ProductInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetDefaultBranchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInlineSource to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ProductInlineSource + * Gets the default type url for GetDefaultBranchRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a UserEventInlineSource. */ - interface IUserEventInlineSource { + /** Properties of a GetDefaultBranchResponse. */ + interface IGetDefaultBranchResponse { - /** UserEventInlineSource userEvents */ - userEvents?: (google.cloud.retail.v2.IUserEvent[]|null); + /** GetDefaultBranchResponse branch */ + branch?: (string|null); + + /** GetDefaultBranchResponse setTime */ + setTime?: (google.protobuf.ITimestamp|null); + + /** GetDefaultBranchResponse note */ + note?: (string|null); } - /** Represents a UserEventInlineSource. */ - class UserEventInlineSource implements IUserEventInlineSource { + /** Represents a GetDefaultBranchResponse. */ + class GetDefaultBranchResponse implements IGetDefaultBranchResponse { /** - * Constructs a new UserEventInlineSource. + * Constructs a new GetDefaultBranchResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEventInlineSource); + constructor(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse); - /** UserEventInlineSource userEvents. */ - public userEvents: google.cloud.retail.v2.IUserEvent[]; + /** GetDefaultBranchResponse branch. */ + public branch: string; + + /** GetDefaultBranchResponse setTime. */ + public setTime?: (google.protobuf.ITimestamp|null); + + /** GetDefaultBranchResponse note. */ + public note: string; /** - * Creates a new UserEventInlineSource instance using the specified properties. + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInlineSource instance + * @returns GetDefaultBranchResponse instance */ - public static create(properties?: google.cloud.retail.v2.IUserEventInlineSource): google.cloud.retail.v2.UserEventInlineSource; + public static create(properties?: google.cloud.retail.v2.IGetDefaultBranchResponse): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. - * @param message UserEventInlineSource message or plain object to encode + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. + * @param message GetDefaultBranchResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInlineSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetDefaultBranchResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInlineSource + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInlineSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInlineSource + * @returns GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInlineSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Verifies a UserEventInlineSource message. + * Verifies a GetDefaultBranchResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInlineSource + * @returns GetDefaultBranchResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInlineSource; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetDefaultBranchResponse; /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @param message UserEventInlineSource + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. + * @param message GetDefaultBranchResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEventInlineSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetDefaultBranchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInlineSource to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for UserEventInlineSource + * Gets the default type url for GetDefaultBranchResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an ImportErrorsConfig. */ - interface IImportErrorsConfig { + /** Properties of a GetCompletionConfigRequest. */ + interface IGetCompletionConfigRequest { - /** ImportErrorsConfig gcsPrefix */ - gcsPrefix?: (string|null); + /** GetCompletionConfigRequest name */ + name?: (string|null); } - /** Represents an ImportErrorsConfig. */ - class ImportErrorsConfig implements IImportErrorsConfig { + /** Represents a GetCompletionConfigRequest. */ + class GetCompletionConfigRequest implements IGetCompletionConfigRequest { /** - * Constructs a new ImportErrorsConfig. + * Constructs a new GetCompletionConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportErrorsConfig); - - /** ImportErrorsConfig gcsPrefix. */ - public gcsPrefix?: (string|null); + constructor(properties?: google.cloud.retail.v2.IGetCompletionConfigRequest); - /** ImportErrorsConfig destination. */ - public destination?: "gcsPrefix"; + /** GetCompletionConfigRequest name. */ + public name: string; /** - * Creates a new ImportErrorsConfig instance using the specified properties. + * Creates a new GetCompletionConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportErrorsConfig instance + * @returns GetCompletionConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportErrorsConfig): google.cloud.retail.v2.ImportErrorsConfig; + public static create(properties?: google.cloud.retail.v2.IGetCompletionConfigRequest): google.cloud.retail.v2.GetCompletionConfigRequest; /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified GetCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.GetCompletionConfigRequest.verify|verify} messages. + * @param message GetCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. - * @param message ImportErrorsConfig message or plain object to encode + * Encodes the specified GetCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetCompletionConfigRequest.verify|verify} messages. + * @param message GetCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportErrorsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportErrorsConfig + * @returns GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportErrorsConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetCompletionConfigRequest; /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportErrorsConfig + * @returns GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportErrorsConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetCompletionConfigRequest; /** - * Verifies an ImportErrorsConfig message. + * Verifies a GetCompletionConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a GetCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportErrorsConfig + * @returns GetCompletionConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportErrorsConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetCompletionConfigRequest; /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @param message ImportErrorsConfig + * Creates a plain object from a GetCompletionConfigRequest message. Also converts values to other types if specified. + * @param message GetCompletionConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportErrorsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetCompletionConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportErrorsConfig to JSON. + * Converts this GetCompletionConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportErrorsConfig + * Gets the default type url for GetCompletionConfigRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an ImportProductsRequest. */ - interface IImportProductsRequest { - - /** ImportProductsRequest parent */ - parent?: (string|null); - - /** ImportProductsRequest requestId */ - requestId?: (string|null); - - /** ImportProductsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); + /** Properties of an UpdateCompletionConfigRequest. */ + interface IUpdateCompletionConfigRequest { - /** ImportProductsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** UpdateCompletionConfigRequest completionConfig */ + completionConfig?: (google.cloud.retail.v2.ICompletionConfig|null); - /** ImportProductsRequest updateMask */ + /** UpdateCompletionConfigRequest updateMask */ updateMask?: (google.protobuf.IFieldMask|null); - - /** ImportProductsRequest reconciliationMode */ - reconciliationMode?: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null); - - /** ImportProductsRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); } - /** Represents an ImportProductsRequest. */ - class ImportProductsRequest implements IImportProductsRequest { + /** Represents an UpdateCompletionConfigRequest. */ + class UpdateCompletionConfigRequest implements IUpdateCompletionConfigRequest { /** - * Constructs a new ImportProductsRequest. + * Constructs a new UpdateCompletionConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportProductsRequest); - - /** ImportProductsRequest parent. */ - public parent: string; - - /** ImportProductsRequest requestId. */ - public requestId: string; + constructor(properties?: google.cloud.retail.v2.IUpdateCompletionConfigRequest); - /** ImportProductsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2.IProductInputConfig|null); - - /** ImportProductsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** UpdateCompletionConfigRequest completionConfig. */ + public completionConfig?: (google.cloud.retail.v2.ICompletionConfig|null); - /** ImportProductsRequest updateMask. */ + /** UpdateCompletionConfigRequest updateMask. */ public updateMask?: (google.protobuf.IFieldMask|null); - /** ImportProductsRequest reconciliationMode. */ - public reconciliationMode: (google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|keyof typeof google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode); - - /** ImportProductsRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; - /** - * Creates a new ImportProductsRequest instance using the specified properties. + * Creates a new UpdateCompletionConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsRequest instance + * @returns UpdateCompletionConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportProductsRequest): google.cloud.retail.v2.ImportProductsRequest; + public static create(properties?: google.cloud.retail.v2.IUpdateCompletionConfigRequest): google.cloud.retail.v2.UpdateCompletionConfigRequest; /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified UpdateCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCompletionConfigRequest.verify|verify} messages. + * @param message UpdateCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUpdateCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @param message ImportProductsRequest message or plain object to encode + * Encodes the specified UpdateCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCompletionConfigRequest.verify|verify} messages. + * @param message UpdateCompletionConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateCompletionConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsRequest + * @returns UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateCompletionConfigRequest; /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsRequest + * @returns UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateCompletionConfigRequest; /** - * Verifies an ImportProductsRequest message. + * Verifies an UpdateCompletionConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsRequest + * @returns UpdateCompletionConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateCompletionConfigRequest; /** - * Creates a plain object from an ImportProductsRequest message. Also converts values to other types if specified. - * @param message ImportProductsRequest + * Creates a plain object from an UpdateCompletionConfigRequest message. Also converts values to other types if specified. + * @param message UpdateCompletionConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UpdateCompletionConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsRequest to JSON. + * Converts this UpdateCompletionConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportProductsRequest + * Gets the default type url for UpdateCompletionConfigRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace ImportProductsRequest { - - /** ReconciliationMode enum. */ - enum ReconciliationMode { - RECONCILIATION_MODE_UNSPECIFIED = 0, - INCREMENTAL = 1, - FULL = 2 - } - } - - /** Properties of an ImportUserEventsRequest. */ - interface IImportUserEventsRequest { - - /** ImportUserEventsRequest parent */ - parent?: (string|null); - - /** ImportUserEventsRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); + /** Properties of a GetAttributesConfigRequest. */ + interface IGetAttributesConfigRequest { - /** ImportUserEventsRequest errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** GetAttributesConfigRequest name */ + name?: (string|null); } - /** Represents an ImportUserEventsRequest. */ - class ImportUserEventsRequest implements IImportUserEventsRequest { + /** Represents a GetAttributesConfigRequest. */ + class GetAttributesConfigRequest implements IGetAttributesConfigRequest { /** - * Constructs a new ImportUserEventsRequest. + * Constructs a new GetAttributesConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportUserEventsRequest); + constructor(properties?: google.cloud.retail.v2.IGetAttributesConfigRequest); - /** ImportUserEventsRequest parent. */ - public parent: string; - - /** ImportUserEventsRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2.IUserEventInputConfig|null); - - /** ImportUserEventsRequest errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** GetAttributesConfigRequest name. */ + public name: string; /** - * Creates a new ImportUserEventsRequest instance using the specified properties. + * Creates a new GetAttributesConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsRequest instance + * @returns GetAttributesConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportUserEventsRequest): google.cloud.retail.v2.ImportUserEventsRequest; + public static create(properties?: google.cloud.retail.v2.IGetAttributesConfigRequest): google.cloud.retail.v2.GetAttributesConfigRequest; /** - * Encodes the specified ImportUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified GetAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.GetAttributesConfigRequest.verify|verify} messages. + * @param message GetAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsRequest.verify|verify} messages. - * @param message ImportUserEventsRequest message or plain object to encode + * Encodes the specified GetAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetAttributesConfigRequest.verify|verify} messages. + * @param message GetAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsRequest + * @returns GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetAttributesConfigRequest; /** - * Decodes an ImportUserEventsRequest message from the specified reader or buffer, length delimited. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsRequest + * @returns GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetAttributesConfigRequest; /** - * Verifies an ImportUserEventsRequest message. + * Verifies a GetAttributesConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsRequest + * @returns GetAttributesConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetAttributesConfigRequest; /** - * Creates a plain object from an ImportUserEventsRequest message. Also converts values to other types if specified. - * @param message ImportUserEventsRequest + * Creates a plain object from a GetAttributesConfigRequest message. Also converts values to other types if specified. + * @param message GetAttributesConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetAttributesConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsRequest to JSON. + * Converts this GetAttributesConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportUserEventsRequest + * Gets the default type url for GetAttributesConfigRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an ImportCompletionDataRequest. */ - interface IImportCompletionDataRequest { - - /** ImportCompletionDataRequest parent */ - parent?: (string|null); + /** Properties of an UpdateAttributesConfigRequest. */ + interface IUpdateAttributesConfigRequest { - /** ImportCompletionDataRequest inputConfig */ - inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + /** UpdateAttributesConfigRequest attributesConfig */ + attributesConfig?: (google.cloud.retail.v2.IAttributesConfig|null); - /** ImportCompletionDataRequest notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** UpdateAttributesConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents an ImportCompletionDataRequest. */ - class ImportCompletionDataRequest implements IImportCompletionDataRequest { + /** Represents an UpdateAttributesConfigRequest. */ + class UpdateAttributesConfigRequest implements IUpdateAttributesConfigRequest { /** - * Constructs a new ImportCompletionDataRequest. + * Constructs a new UpdateAttributesConfigRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportCompletionDataRequest); - - /** ImportCompletionDataRequest parent. */ - public parent: string; + constructor(properties?: google.cloud.retail.v2.IUpdateAttributesConfigRequest); - /** ImportCompletionDataRequest inputConfig. */ - public inputConfig?: (google.cloud.retail.v2.ICompletionDataInputConfig|null); + /** UpdateAttributesConfigRequest attributesConfig. */ + public attributesConfig?: (google.cloud.retail.v2.IAttributesConfig|null); - /** ImportCompletionDataRequest notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** UpdateAttributesConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new ImportCompletionDataRequest instance using the specified properties. + * Creates a new UpdateAttributesConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportCompletionDataRequest instance + * @returns UpdateAttributesConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportCompletionDataRequest): google.cloud.retail.v2.ImportCompletionDataRequest; + public static create(properties?: google.cloud.retail.v2.IUpdateAttributesConfigRequest): google.cloud.retail.v2.UpdateAttributesConfigRequest; /** - * Encodes the specified ImportCompletionDataRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified UpdateAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateAttributesConfigRequest.verify|verify} messages. + * @param message UpdateAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUpdateAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportCompletionDataRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataRequest.verify|verify} messages. - * @param message ImportCompletionDataRequest message or plain object to encode + * Encodes the specified UpdateAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateAttributesConfigRequest.verify|verify} messages. + * @param message UpdateAttributesConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateAttributesConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportCompletionDataRequest + * @returns UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateAttributesConfigRequest; /** - * Decodes an ImportCompletionDataRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataRequest + * @returns UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateAttributesConfigRequest; /** - * Verifies an ImportCompletionDataRequest message. + * Verifies an UpdateAttributesConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportCompletionDataRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportCompletionDataRequest + * @returns UpdateAttributesConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateAttributesConfigRequest; /** - * Creates a plain object from an ImportCompletionDataRequest message. Also converts values to other types if specified. - * @param message ImportCompletionDataRequest + * Creates a plain object from an UpdateAttributesConfigRequest message. Also converts values to other types if specified. + * @param message UpdateAttributesConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportCompletionDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UpdateAttributesConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportCompletionDataRequest to JSON. + * Converts this UpdateAttributesConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportCompletionDataRequest + * Gets the default type url for UpdateAttributesConfigRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ProductInputConfig. */ - interface IProductInputConfig { - - /** ProductInputConfig productInlineSource */ - productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); + /** Properties of an AddCatalogAttributeRequest. */ + interface IAddCatalogAttributeRequest { - /** ProductInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + /** AddCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); - /** ProductInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** AddCatalogAttributeRequest catalogAttribute */ + catalogAttribute?: (google.cloud.retail.v2.ICatalogAttribute|null); } - /** Represents a ProductInputConfig. */ - class ProductInputConfig implements IProductInputConfig { + /** Represents an AddCatalogAttributeRequest. */ + class AddCatalogAttributeRequest implements IAddCatalogAttributeRequest { /** - * Constructs a new ProductInputConfig. + * Constructs a new AddCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProductInputConfig); - - /** ProductInputConfig productInlineSource. */ - public productInlineSource?: (google.cloud.retail.v2.IProductInlineSource|null); - - /** ProductInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + constructor(properties?: google.cloud.retail.v2.IAddCatalogAttributeRequest); - /** ProductInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** AddCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** ProductInputConfig source. */ - public source?: ("productInlineSource"|"gcsSource"|"bigQuerySource"); + /** AddCatalogAttributeRequest catalogAttribute. */ + public catalogAttribute?: (google.cloud.retail.v2.ICatalogAttribute|null); /** - * Creates a new ProductInputConfig instance using the specified properties. + * Creates a new AddCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductInputConfig instance + * @returns AddCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2.IProductInputConfig): google.cloud.retail.v2.ProductInputConfig; + public static create(properties?: google.cloud.retail.v2.IAddCatalogAttributeRequest): google.cloud.retail.v2.AddCatalogAttributeRequest; /** - * Encodes the specified ProductInputConfig message. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified AddCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2.AddCatalogAttributeRequest.verify|verify} messages. + * @param message AddCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IAddCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInputConfig.verify|verify} messages. - * @param message ProductInputConfig message or plain object to encode + * Encodes the specified AddCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddCatalogAttributeRequest.verify|verify} messages. + * @param message AddCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProductInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IAddCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductInputConfig message from the specified reader or buffer. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductInputConfig + * @returns AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddCatalogAttributeRequest; /** - * Decodes a ProductInputConfig message from the specified reader or buffer, length delimited. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductInputConfig + * @returns AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddCatalogAttributeRequest; /** - * Verifies a ProductInputConfig message. + * Verifies an AddCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AddCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductInputConfig + * @returns AddCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddCatalogAttributeRequest; /** - * Creates a plain object from a ProductInputConfig message. Also converts values to other types if specified. - * @param message ProductInputConfig + * Creates a plain object from an AddCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message AddCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ProductInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.AddCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductInputConfig to JSON. + * Converts this AddCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ProductInputConfig + * Gets the default type url for AddCatalogAttributeRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a UserEventInputConfig. */ - interface IUserEventInputConfig { - - /** UserEventInputConfig userEventInlineSource */ - userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); + /** Properties of a RemoveCatalogAttributeRequest. */ + interface IRemoveCatalogAttributeRequest { - /** UserEventInputConfig gcsSource */ - gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + /** RemoveCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); - /** UserEventInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** RemoveCatalogAttributeRequest key */ + key?: (string|null); } - /** Represents a UserEventInputConfig. */ - class UserEventInputConfig implements IUserEventInputConfig { + /** Represents a RemoveCatalogAttributeRequest. */ + class RemoveCatalogAttributeRequest implements IRemoveCatalogAttributeRequest { /** - * Constructs a new UserEventInputConfig. + * Constructs a new RemoveCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEventInputConfig); - - /** UserEventInputConfig userEventInlineSource. */ - public userEventInlineSource?: (google.cloud.retail.v2.IUserEventInlineSource|null); - - /** UserEventInputConfig gcsSource. */ - public gcsSource?: (google.cloud.retail.v2.IGcsSource|null); + constructor(properties?: google.cloud.retail.v2.IRemoveCatalogAttributeRequest); - /** UserEventInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** RemoveCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** UserEventInputConfig source. */ - public source?: ("userEventInlineSource"|"gcsSource"|"bigQuerySource"); + /** RemoveCatalogAttributeRequest key. */ + public key: string; /** - * Creates a new UserEventInputConfig instance using the specified properties. + * Creates a new RemoveCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEventInputConfig instance + * @returns RemoveCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2.IUserEventInputConfig): google.cloud.retail.v2.UserEventInputConfig; + public static create(properties?: google.cloud.retail.v2.IRemoveCatalogAttributeRequest): google.cloud.retail.v2.RemoveCatalogAttributeRequest; /** - * Encodes the specified UserEventInputConfig message. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified RemoveCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveCatalogAttributeRequest.verify|verify} messages. + * @param message RemoveCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IRemoveCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEventInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInputConfig.verify|verify} messages. - * @param message UserEventInputConfig message or plain object to encode + * Encodes the specified RemoveCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveCatalogAttributeRequest.verify|verify} messages. + * @param message RemoveCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEventInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEventInputConfig + * @returns RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveCatalogAttributeRequest; /** - * Decodes a UserEventInputConfig message from the specified reader or buffer, length delimited. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEventInputConfig + * @returns RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveCatalogAttributeRequest; /** - * Verifies a UserEventInputConfig message. + * Verifies a RemoveCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEventInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEventInputConfig + * @returns RemoveCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveCatalogAttributeRequest; /** - * Creates a plain object from a UserEventInputConfig message. Also converts values to other types if specified. - * @param message UserEventInputConfig + * Creates a plain object from a RemoveCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message RemoveCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEventInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.RemoveCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEventInputConfig to JSON. + * Converts this RemoveCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for UserEventInputConfig + * Gets the default type url for RemoveCatalogAttributeRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a CompletionDataInputConfig. */ - interface ICompletionDataInputConfig { + /** Properties of a ReplaceCatalogAttributeRequest. */ + interface IReplaceCatalogAttributeRequest { - /** CompletionDataInputConfig bigQuerySource */ - bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** ReplaceCatalogAttributeRequest attributesConfig */ + attributesConfig?: (string|null); + + /** ReplaceCatalogAttributeRequest catalogAttribute */ + catalogAttribute?: (google.cloud.retail.v2.ICatalogAttribute|null); + + /** ReplaceCatalogAttributeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a CompletionDataInputConfig. */ - class CompletionDataInputConfig implements ICompletionDataInputConfig { + /** Represents a ReplaceCatalogAttributeRequest. */ + class ReplaceCatalogAttributeRequest implements IReplaceCatalogAttributeRequest { /** - * Constructs a new CompletionDataInputConfig. + * Constructs a new ReplaceCatalogAttributeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompletionDataInputConfig); + constructor(properties?: google.cloud.retail.v2.IReplaceCatalogAttributeRequest); + + /** ReplaceCatalogAttributeRequest attributesConfig. */ + public attributesConfig: string; - /** CompletionDataInputConfig bigQuerySource. */ - public bigQuerySource?: (google.cloud.retail.v2.IBigQuerySource|null); + /** ReplaceCatalogAttributeRequest catalogAttribute. */ + public catalogAttribute?: (google.cloud.retail.v2.ICatalogAttribute|null); - /** CompletionDataInputConfig source. */ - public source?: "bigQuerySource"; + /** ReplaceCatalogAttributeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new CompletionDataInputConfig instance using the specified properties. + * Creates a new ReplaceCatalogAttributeRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDataInputConfig instance + * @returns ReplaceCatalogAttributeRequest instance */ - public static create(properties?: google.cloud.retail.v2.ICompletionDataInputConfig): google.cloud.retail.v2.CompletionDataInputConfig; + public static create(properties?: google.cloud.retail.v2.IReplaceCatalogAttributeRequest): google.cloud.retail.v2.ReplaceCatalogAttributeRequest; /** - * Encodes the specified CompletionDataInputConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode + * Encodes the specified ReplaceCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @param message ReplaceCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IReplaceCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDataInputConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDataInputConfig.verify|verify} messages. - * @param message CompletionDataInputConfig message or plain object to encode + * Encodes the specified ReplaceCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ReplaceCatalogAttributeRequest.verify|verify} messages. + * @param message ReplaceCatalogAttributeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDataInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IReplaceCatalogAttributeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDataInputConfig + * @returns ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDataInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ReplaceCatalogAttributeRequest; /** - * Decodes a CompletionDataInputConfig message from the specified reader or buffer, length delimited. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDataInputConfig + * @returns ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDataInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ReplaceCatalogAttributeRequest; /** - * Verifies a CompletionDataInputConfig message. + * Verifies a ReplaceCatalogAttributeRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDataInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a ReplaceCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDataInputConfig + * @returns ReplaceCatalogAttributeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDataInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ReplaceCatalogAttributeRequest; /** - * Creates a plain object from a CompletionDataInputConfig message. Also converts values to other types if specified. - * @param message CompletionDataInputConfig + * Creates a plain object from a ReplaceCatalogAttributeRequest message. Also converts values to other types if specified. + * @param message ReplaceCatalogAttributeRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompletionDataInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ReplaceCatalogAttributeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDataInputConfig to JSON. + * Converts this ReplaceCatalogAttributeRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for CompletionDataInputConfig + * Gets the default type url for ReplaceCatalogAttributeRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an ImportMetadata. */ - interface IImportMetadata { + /** Represents a CompletionService */ + class CompletionService extends $protobuf.rpc.Service { - /** ImportMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** + * Constructs a new CompletionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** ImportMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** + * Creates new CompletionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CompletionService; - /** ImportMetadata successCount */ - successCount?: (number|Long|string|null); + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompleteQueryResponse + */ + public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest, callback: google.cloud.retail.v2.CompletionService.CompleteQueryCallback): void; - /** ImportMetadata failureCount */ - failureCount?: (number|Long|string|null); + /** + * Calls CompleteQuery. + * @param request CompleteQueryRequest message or plain object + * @returns Promise + */ + public completeQuery(request: google.cloud.retail.v2.ICompleteQueryRequest): Promise; - /** ImportMetadata requestId */ - requestId?: (string|null); + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest, callback: google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback): void; - /** ImportMetadata notificationPubsubTopic */ - notificationPubsubTopic?: (string|null); + /** + * Calls ImportCompletionData. + * @param request ImportCompletionDataRequest message or plain object + * @returns Promise + */ + public importCompletionData(request: google.cloud.retail.v2.IImportCompletionDataRequest): Promise; } - /** Represents an ImportMetadata. */ - class ImportMetadata implements IImportMetadata { + namespace CompletionService { /** - * Constructs a new ImportMetadata. + * Callback as used by {@link google.cloud.retail.v2.CompletionService|completeQuery}. + * @param error Error, if any + * @param [response] CompleteQueryResponse + */ + type CompleteQueryCallback = (error: (Error|null), response?: google.cloud.retail.v2.CompleteQueryResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2.CompletionService|importCompletionData}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCompletionDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CompleteQueryRequest. */ + interface ICompleteQueryRequest { + + /** CompleteQueryRequest catalog */ + catalog?: (string|null); + + /** CompleteQueryRequest query */ + query?: (string|null); + + /** CompleteQueryRequest visitorId */ + visitorId?: (string|null); + + /** CompleteQueryRequest languageCodes */ + languageCodes?: (string[]|null); + + /** CompleteQueryRequest deviceType */ + deviceType?: (string|null); + + /** CompleteQueryRequest dataset */ + dataset?: (string|null); + + /** CompleteQueryRequest maxSuggestions */ + maxSuggestions?: (number|null); + } + + /** Represents a CompleteQueryRequest. */ + class CompleteQueryRequest implements ICompleteQueryRequest { + + /** + * Constructs a new CompleteQueryRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportMetadata); + constructor(properties?: google.cloud.retail.v2.ICompleteQueryRequest); - /** ImportMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** CompleteQueryRequest catalog. */ + public catalog: string; - /** ImportMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** CompleteQueryRequest query. */ + public query: string; - /** ImportMetadata successCount. */ - public successCount: (number|Long|string); + /** CompleteQueryRequest visitorId. */ + public visitorId: string; - /** ImportMetadata failureCount. */ - public failureCount: (number|Long|string); + /** CompleteQueryRequest languageCodes. */ + public languageCodes: string[]; - /** ImportMetadata requestId. */ - public requestId: string; + /** CompleteQueryRequest deviceType. */ + public deviceType: string; - /** ImportMetadata notificationPubsubTopic. */ - public notificationPubsubTopic: string; + /** CompleteQueryRequest dataset. */ + public dataset: string; + + /** CompleteQueryRequest maxSuggestions. */ + public maxSuggestions: number; /** - * Creates a new ImportMetadata instance using the specified properties. + * Creates a new CompleteQueryRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ImportMetadata instance + * @returns CompleteQueryRequest instance */ - public static create(properties?: google.cloud.retail.v2.IImportMetadata): google.cloud.retail.v2.ImportMetadata; + public static create(properties?: google.cloud.retail.v2.ICompleteQueryRequest): google.cloud.retail.v2.CompleteQueryRequest; /** - * Encodes the specified ImportMetadata message. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportMetadata.verify|verify} messages. - * @param message ImportMetadata message or plain object to encode + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * @param message CompleteQueryRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportMetadata message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportMetadata + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryRequest; /** - * Decodes an ImportMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportMetadata + * @returns CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryRequest; /** - * Verifies an ImportMetadata message. + * Verifies a CompleteQueryRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportMetadata + * @returns CompleteQueryRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryRequest; /** - * Creates a plain object from an ImportMetadata message. Also converts values to other types if specified. - * @param message ImportMetadata + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * @param message CompleteQueryRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompleteQueryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportMetadata to JSON. + * Converts this CompleteQueryRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportMetadata + * Gets the default type url for CompleteQueryRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an ImportProductsResponse. */ - interface IImportProductsResponse { + /** Properties of a CompleteQueryResponse. */ + interface ICompleteQueryResponse { - /** ImportProductsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** CompleteQueryResponse completionResults */ + completionResults?: (google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]|null); - /** ImportProductsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** CompleteQueryResponse attributionToken */ + attributionToken?: (string|null); + + /** CompleteQueryResponse recentSearchResults */ + recentSearchResults?: (google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]|null); } - /** Represents an ImportProductsResponse. */ - class ImportProductsResponse implements IImportProductsResponse { + /** Represents a CompleteQueryResponse. */ + class CompleteQueryResponse implements ICompleteQueryResponse { /** - * Constructs a new ImportProductsResponse. + * Constructs a new CompleteQueryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportProductsResponse); + constructor(properties?: google.cloud.retail.v2.ICompleteQueryResponse); - /** ImportProductsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** CompleteQueryResponse completionResults. */ + public completionResults: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult[]; - /** ImportProductsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** CompleteQueryResponse attributionToken. */ + public attributionToken: string; + + /** CompleteQueryResponse recentSearchResults. */ + public recentSearchResults: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult[]; /** - * Creates a new ImportProductsResponse instance using the specified properties. + * Creates a new CompleteQueryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ImportProductsResponse instance + * @returns CompleteQueryResponse instance */ - public static create(properties?: google.cloud.retail.v2.IImportProductsResponse): google.cloud.retail.v2.ImportProductsResponse; + public static create(properties?: google.cloud.retail.v2.ICompleteQueryResponse): google.cloud.retail.v2.CompleteQueryResponse; /** - * Encodes the specified ImportProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsResponse.verify|verify} messages. - * @param message ImportProductsResponse message or plain object to encode + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * @param message CompleteQueryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICompleteQueryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportProductsResponse + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportProductsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse; /** - * Decodes an ImportProductsResponse message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportProductsResponse + * @returns CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportProductsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse; /** - * Verifies an ImportProductsResponse message. + * Verifies a CompleteQueryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportProductsResponse + * @returns CompleteQueryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportProductsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse; /** - * Creates a plain object from an ImportProductsResponse message. Also converts values to other types if specified. - * @param message ImportProductsResponse + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * @param message CompleteQueryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportProductsResponse to JSON. + * Converts this CompleteQueryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportProductsResponse + * Gets the default type url for CompleteQueryResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an ImportUserEventsResponse. */ - interface IImportUserEventsResponse { + namespace CompleteQueryResponse { + + /** Properties of a CompletionResult. */ + interface ICompletionResult { + + /** CompletionResult suggestion */ + suggestion?: (string|null); + + /** CompletionResult attributes */ + attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); + } + + /** Represents a CompletionResult. */ + class CompletionResult implements ICompletionResult { + + /** + * Constructs a new CompletionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult); + + /** CompletionResult suggestion. */ + public suggestion: string; + + /** CompletionResult attributes. */ + public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns CompletionResult instance + */ + public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @param message CompletionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Verifies a CompletionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompletionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.CompletionResult; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @param message CompletionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.CompletionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompletionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompletionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RecentSearchResult. */ + interface IRecentSearchResult { + + /** RecentSearchResult recentSearch */ + recentSearch?: (string|null); + } + + /** Represents a RecentSearchResult. */ + class RecentSearchResult implements IRecentSearchResult { + + /** + * Constructs a new RecentSearchResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult); + + /** RecentSearchResult recentSearch. */ + public recentSearch: string; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentSearchResult instance + */ + public static create(properties?: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @param message RecentSearchResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Verifies a RecentSearchResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentSearchResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @param message RecentSearchResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentSearchResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RecentSearchResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Control. */ + interface IControl { - /** ImportUserEventsResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); + /** Control rule */ + rule?: (google.cloud.retail.v2.IRule|null); - /** ImportUserEventsResponse errorsConfig */ - errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** Control name */ + name?: (string|null); - /** ImportUserEventsResponse importSummary */ - importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + /** Control displayName */ + displayName?: (string|null); + + /** Control associatedServingConfigIds */ + associatedServingConfigIds?: (string[]|null); + + /** Control solutionTypes */ + solutionTypes?: (google.cloud.retail.v2.SolutionType[]|null); + + /** Control searchSolutionUseCase */ + searchSolutionUseCase?: (google.cloud.retail.v2.SearchSolutionUseCase[]|null); } - /** Represents an ImportUserEventsResponse. */ - class ImportUserEventsResponse implements IImportUserEventsResponse { + /** Represents a Control. */ + class Control implements IControl { /** - * Constructs a new ImportUserEventsResponse. + * Constructs a new Control. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IImportUserEventsResponse); + constructor(properties?: google.cloud.retail.v2.IControl); - /** ImportUserEventsResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + /** Control rule. */ + public rule?: (google.cloud.retail.v2.IRule|null); - /** ImportUserEventsResponse errorsConfig. */ - public errorsConfig?: (google.cloud.retail.v2.IImportErrorsConfig|null); + /** Control name. */ + public name: string; - /** ImportUserEventsResponse importSummary. */ - public importSummary?: (google.cloud.retail.v2.IUserEventImportSummary|null); + /** Control displayName. */ + public displayName: string; + + /** Control associatedServingConfigIds. */ + public associatedServingConfigIds: string[]; + + /** Control solutionTypes. */ + public solutionTypes: google.cloud.retail.v2.SolutionType[]; + + /** Control searchSolutionUseCase. */ + public searchSolutionUseCase: google.cloud.retail.v2.SearchSolutionUseCase[]; + + /** Control control. */ + public control?: "rule"; /** - * Creates a new ImportUserEventsResponse instance using the specified properties. + * Creates a new Control instance using the specified properties. * @param [properties] Properties to set - * @returns ImportUserEventsResponse instance + * @returns Control instance */ - public static create(properties?: google.cloud.retail.v2.IImportUserEventsResponse): google.cloud.retail.v2.ImportUserEventsResponse; + public static create(properties?: google.cloud.retail.v2.IControl): google.cloud.retail.v2.Control; /** - * Encodes the specified ImportUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode + * Encodes the specified Control message. Does not implicitly {@link google.cloud.retail.v2.Control.verify|verify} messages. + * @param message Control message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IControl, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImportUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportUserEventsResponse.verify|verify} messages. - * @param message ImportUserEventsResponse message or plain object to encode + * Encodes the specified Control message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Control.verify|verify} messages. + * @param message Control message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IControl, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer. + * Decodes a Control message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImportUserEventsResponse + * @returns Control * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportUserEventsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Control; /** - * Decodes an ImportUserEventsResponse message from the specified reader or buffer, length delimited. + * Decodes a Control message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImportUserEventsResponse + * @returns Control * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportUserEventsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Control; /** - * Verifies an ImportUserEventsResponse message. + * Verifies a Control message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImportUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a Control message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImportUserEventsResponse + * @returns Control */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportUserEventsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Control; /** - * Creates a plain object from an ImportUserEventsResponse message. Also converts values to other types if specified. - * @param message ImportUserEventsResponse + * Creates a plain object from a Control message. Also converts values to other types if specified. + * @param message Control * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ImportUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.Control, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImportUserEventsResponse to JSON. + * Converts this Control to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ImportUserEventsResponse + * Gets the default type url for Control * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a UserEventImportSummary. */ - interface IUserEventImportSummary { - - /** UserEventImportSummary joinedEventsCount */ - joinedEventsCount?: (number|Long|string|null); - - /** UserEventImportSummary unjoinedEventsCount */ - unjoinedEventsCount?: (number|Long|string|null); - } - - /** Represents a UserEventImportSummary. */ - class UserEventImportSummary implements IUserEventImportSummary { - - /** - * Constructs a new UserEventImportSummary. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IUserEventImportSummary); - - /** UserEventImportSummary joinedEventsCount. */ - public joinedEventsCount: (number|Long|string); - - /** UserEventImportSummary unjoinedEventsCount. */ - public unjoinedEventsCount: (number|Long|string); - - /** - * Creates a new UserEventImportSummary instance using the specified properties. - * @param [properties] Properties to set - * @returns UserEventImportSummary instance - */ - public static create(properties?: google.cloud.retail.v2.IUserEventImportSummary): google.cloud.retail.v2.UserEventImportSummary; - - /** - * Encodes the specified UserEventImportSummary message. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UserEventImportSummary message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventImportSummary.verify|verify} messages. - * @param message UserEventImportSummary message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEventImportSummary, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a ControlService */ + class ControlService extends $protobuf.rpc.Service { /** - * Decodes a UserEventImportSummary message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UserEventImportSummary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Constructs a new ControlService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEventImportSummary; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Decodes a UserEventImportSummary message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UserEventImportSummary - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Creates new ControlService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEventImportSummary; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ControlService; /** - * Verifies a UserEventImportSummary message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls CreateControl. + * @param request CreateControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control */ - public static verify(message: { [k: string]: any }): (string|null); + public createControl(request: google.cloud.retail.v2.ICreateControlRequest, callback: google.cloud.retail.v2.ControlService.CreateControlCallback): void; /** - * Creates a UserEventImportSummary message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UserEventImportSummary + * Calls CreateControl. + * @param request CreateControlRequest message or plain object + * @returns Promise */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEventImportSummary; + public createControl(request: google.cloud.retail.v2.ICreateControlRequest): Promise; /** - * Creates a plain object from a UserEventImportSummary message. Also converts values to other types if specified. - * @param message UserEventImportSummary - * @param [options] Conversion options - * @returns Plain object + * Calls DeleteControl. + * @param request DeleteControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty */ - public static toObject(message: google.cloud.retail.v2.UserEventImportSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public deleteControl(request: google.cloud.retail.v2.IDeleteControlRequest, callback: google.cloud.retail.v2.ControlService.DeleteControlCallback): void; /** - * Converts this UserEventImportSummary to JSON. - * @returns JSON object + * Calls DeleteControl. + * @param request DeleteControlRequest message or plain object + * @returns Promise */ - public toJSON(): { [k: string]: any }; + public deleteControl(request: google.cloud.retail.v2.IDeleteControlRequest): Promise; /** - * Gets the default type url for UserEventImportSummary - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url + * Calls UpdateControl. + * @param request UpdateControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportCompletionDataResponse. */ - interface IImportCompletionDataResponse { - - /** ImportCompletionDataResponse errorSamples */ - errorSamples?: (google.rpc.IStatus[]|null); - } - - /** Represents an ImportCompletionDataResponse. */ - class ImportCompletionDataResponse implements IImportCompletionDataResponse { + public updateControl(request: google.cloud.retail.v2.IUpdateControlRequest, callback: google.cloud.retail.v2.ControlService.UpdateControlCallback): void; /** - * Constructs a new ImportCompletionDataResponse. - * @param [properties] Properties to set + * Calls UpdateControl. + * @param request UpdateControlRequest message or plain object + * @returns Promise */ - constructor(properties?: google.cloud.retail.v2.IImportCompletionDataResponse); - - /** ImportCompletionDataResponse errorSamples. */ - public errorSamples: google.rpc.IStatus[]; + public updateControl(request: google.cloud.retail.v2.IUpdateControlRequest): Promise; /** - * Creates a new ImportCompletionDataResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportCompletionDataResponse instance + * Calls GetControl. + * @param request GetControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Control */ - public static create(properties?: google.cloud.retail.v2.IImportCompletionDataResponse): google.cloud.retail.v2.ImportCompletionDataResponse; + public getControl(request: google.cloud.retail.v2.IGetControlRequest, callback: google.cloud.retail.v2.ControlService.GetControlCallback): void; /** - * Encodes the specified ImportCompletionDataResponse message. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls GetControl. + * @param request GetControlRequest message or plain object + * @returns Promise */ - public static encode(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public getControl(request: google.cloud.retail.v2.IGetControlRequest): Promise; /** - * Encodes the specified ImportCompletionDataResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportCompletionDataResponse.verify|verify} messages. - * @param message ImportCompletionDataResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls ListControls. + * @param request ListControlsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListControlsResponse */ - public static encodeDelimited(message: google.cloud.retail.v2.IImportCompletionDataResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public listControls(request: google.cloud.retail.v2.IListControlsRequest, callback: google.cloud.retail.v2.ControlService.ListControlsCallback): void; /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportCompletionDataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ListControls. + * @param request ListControlsRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ImportCompletionDataResponse; + public listControls(request: google.cloud.retail.v2.IListControlsRequest): Promise; + } - /** - * Decodes an ImportCompletionDataResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportCompletionDataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ImportCompletionDataResponse; + namespace ControlService { /** - * Verifies an ImportCompletionDataResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.retail.v2.ControlService|createControl}. + * @param error Error, if any + * @param [response] Control */ - public static verify(message: { [k: string]: any }): (string|null); + type CreateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2.Control) => void; /** - * Creates an ImportCompletionDataResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportCompletionDataResponse + * Callback as used by {@link google.cloud.retail.v2.ControlService|deleteControl}. + * @param error Error, if any + * @param [response] Empty */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ImportCompletionDataResponse; + type DeleteControlCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Creates a plain object from an ImportCompletionDataResponse message. Also converts values to other types if specified. - * @param message ImportCompletionDataResponse - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.retail.v2.ControlService|updateControl}. + * @param error Error, if any + * @param [response] Control */ - public static toObject(message: google.cloud.retail.v2.ImportCompletionDataResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type UpdateControlCallback = (error: (Error|null), response?: google.cloud.retail.v2.Control) => void; /** - * Converts this ImportCompletionDataResponse to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.retail.v2.ControlService|getControl}. + * @param error Error, if any + * @param [response] Control */ - public toJSON(): { [k: string]: any }; + type GetControlCallback = (error: (Error|null), response?: google.cloud.retail.v2.Control) => void; /** - * Gets the default type url for ImportCompletionDataResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url + * Callback as used by {@link google.cloud.retail.v2.ControlService|listControls}. + * @param error Error, if any + * @param [response] ListControlsResponse */ - public static getTypeUrl(typeUrlPrefix?: string): string; + type ListControlsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListControlsResponse) => void; } - /** Properties of a Product. */ - interface IProduct { - - /** Product expireTime */ - expireTime?: (google.protobuf.ITimestamp|null); - - /** Product ttl */ - ttl?: (google.protobuf.IDuration|null); - - /** Product name */ - name?: (string|null); - - /** Product id */ - id?: (string|null); - - /** Product type */ - type?: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type|null); - - /** Product primaryProductId */ - primaryProductId?: (string|null); - - /** Product collectionMemberIds */ - collectionMemberIds?: (string[]|null); - - /** Product gtin */ - gtin?: (string|null); - - /** Product categories */ - categories?: (string[]|null); - - /** Product title */ - title?: (string|null); - - /** Product brands */ - brands?: (string[]|null); - - /** Product description */ - description?: (string|null); - - /** Product languageCode */ - languageCode?: (string|null); - - /** Product attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); - - /** Product tags */ - tags?: (string[]|null); - - /** Product priceInfo */ - priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); - - /** Product rating */ - rating?: (google.cloud.retail.v2.IRating|null); - - /** Product availableTime */ - availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability */ - availability?: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability|null); - - /** Product availableQuantity */ - availableQuantity?: (google.protobuf.IInt32Value|null); - - /** Product fulfillmentInfo */ - fulfillmentInfo?: (google.cloud.retail.v2.IFulfillmentInfo[]|null); - - /** Product uri */ - uri?: (string|null); - - /** Product images */ - images?: (google.cloud.retail.v2.IImage[]|null); - - /** Product audience */ - audience?: (google.cloud.retail.v2.IAudience|null); - - /** Product colorInfo */ - colorInfo?: (google.cloud.retail.v2.IColorInfo|null); - - /** Product sizes */ - sizes?: (string[]|null); - - /** Product materials */ - materials?: (string[]|null); - - /** Product patterns */ - patterns?: (string[]|null); - - /** Product conditions */ - conditions?: (string[]|null); - - /** Product promotions */ - promotions?: (google.cloud.retail.v2.IPromotion[]|null); + /** Properties of a CreateControlRequest. */ + interface ICreateControlRequest { - /** Product publishTime */ - publishTime?: (google.protobuf.ITimestamp|null); + /** CreateControlRequest parent */ + parent?: (string|null); - /** Product retrievableFields */ - retrievableFields?: (google.protobuf.IFieldMask|null); + /** CreateControlRequest control */ + control?: (google.cloud.retail.v2.IControl|null); - /** Product variants */ - variants?: (google.cloud.retail.v2.IProduct[]|null); + /** CreateControlRequest controlId */ + controlId?: (string|null); } - /** Represents a Product. */ - class Product implements IProduct { + /** Represents a CreateControlRequest. */ + class CreateControlRequest implements ICreateControlRequest { /** - * Constructs a new Product. + * Constructs a new CreateControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProduct); - - /** Product expireTime. */ - public expireTime?: (google.protobuf.ITimestamp|null); - - /** Product ttl. */ - public ttl?: (google.protobuf.IDuration|null); - - /** Product name. */ - public name: string; - - /** Product id. */ - public id: string; - - /** Product type. */ - public type: (google.cloud.retail.v2.Product.Type|keyof typeof google.cloud.retail.v2.Product.Type); - - /** Product primaryProductId. */ - public primaryProductId: string; - - /** Product collectionMemberIds. */ - public collectionMemberIds: string[]; - - /** Product gtin. */ - public gtin: string; - - /** Product categories. */ - public categories: string[]; - - /** Product title. */ - public title: string; - - /** Product brands. */ - public brands: string[]; - - /** Product description. */ - public description: string; - - /** Product languageCode. */ - public languageCode: string; - - /** Product attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - - /** Product tags. */ - public tags: string[]; + constructor(properties?: google.cloud.retail.v2.ICreateControlRequest); - /** Product priceInfo. */ - public priceInfo?: (google.cloud.retail.v2.IPriceInfo|null); - - /** Product rating. */ - public rating?: (google.cloud.retail.v2.IRating|null); - - /** Product availableTime. */ - public availableTime?: (google.protobuf.ITimestamp|null); - - /** Product availability. */ - public availability: (google.cloud.retail.v2.Product.Availability|keyof typeof google.cloud.retail.v2.Product.Availability); - - /** Product availableQuantity. */ - public availableQuantity?: (google.protobuf.IInt32Value|null); - - /** Product fulfillmentInfo. */ - public fulfillmentInfo: google.cloud.retail.v2.IFulfillmentInfo[]; - - /** Product uri. */ - public uri: string; - - /** Product images. */ - public images: google.cloud.retail.v2.IImage[]; - - /** Product audience. */ - public audience?: (google.cloud.retail.v2.IAudience|null); - - /** Product colorInfo. */ - public colorInfo?: (google.cloud.retail.v2.IColorInfo|null); - - /** Product sizes. */ - public sizes: string[]; - - /** Product materials. */ - public materials: string[]; - - /** Product patterns. */ - public patterns: string[]; - - /** Product conditions. */ - public conditions: string[]; - - /** Product promotions. */ - public promotions: google.cloud.retail.v2.IPromotion[]; - - /** Product publishTime. */ - public publishTime?: (google.protobuf.ITimestamp|null); - - /** Product retrievableFields. */ - public retrievableFields?: (google.protobuf.IFieldMask|null); + /** CreateControlRequest parent. */ + public parent: string; - /** Product variants. */ - public variants: google.cloud.retail.v2.IProduct[]; + /** CreateControlRequest control. */ + public control?: (google.cloud.retail.v2.IControl|null); - /** Product expiration. */ - public expiration?: ("expireTime"|"ttl"); + /** CreateControlRequest controlId. */ + public controlId: string; /** - * Creates a new Product instance using the specified properties. + * Creates a new CreateControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Product instance + * @returns CreateControlRequest instance */ - public static create(properties?: google.cloud.retail.v2.IProduct): google.cloud.retail.v2.Product; + public static create(properties?: google.cloud.retail.v2.ICreateControlRequest): google.cloud.retail.v2.CreateControlRequest; /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. - * @param message Product message or plain object to encode + * Encodes the specified CreateControlRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateControlRequest.verify|verify} messages. + * @param message CreateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ICreateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Product.verify|verify} messages. - * @param message Product message or plain object to encode + * Encodes the specified CreateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateControlRequest.verify|verify} messages. + * @param message CreateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ICreateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Product message from the specified reader or buffer. + * Decodes a CreateControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Product + * @returns CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Product; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CreateControlRequest; /** - * Decodes a Product message from the specified reader or buffer, length delimited. + * Decodes a CreateControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Product + * @returns CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Product; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CreateControlRequest; /** - * Verifies a Product message. + * Verifies a CreateControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. + * Creates a CreateControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Product + * @returns CreateControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Product; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CreateControlRequest; /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product + * Creates a plain object from a CreateControlRequest message. Also converts values to other types if specified. + * @param message CreateControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.CreateControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Product to JSON. + * Converts this CreateControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Product + * Gets the default type url for CreateControlRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace Product { - - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - VARIANT = 2, - COLLECTION = 3 - } - - /** Availability enum. */ - enum Availability { - AVAILABILITY_UNSPECIFIED = 0, - IN_STOCK = 1, - OUT_OF_STOCK = 2, - PREORDER = 3, - BACKORDER = 4 - } - } + /** Properties of an UpdateControlRequest. */ + interface IUpdateControlRequest { - /** Properties of a Promotion. */ - interface IPromotion { + /** UpdateControlRequest control */ + control?: (google.cloud.retail.v2.IControl|null); - /** Promotion promotionId */ - promotionId?: (string|null); + /** UpdateControlRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } - /** Represents a Promotion. */ - class Promotion implements IPromotion { + /** Represents an UpdateControlRequest. */ + class UpdateControlRequest implements IUpdateControlRequest { /** - * Constructs a new Promotion. + * Constructs a new UpdateControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPromotion); + constructor(properties?: google.cloud.retail.v2.IUpdateControlRequest); - /** Promotion promotionId. */ - public promotionId: string; + /** UpdateControlRequest control. */ + public control?: (google.cloud.retail.v2.IControl|null); + + /** UpdateControlRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); /** - * Creates a new Promotion instance using the specified properties. + * Creates a new UpdateControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Promotion instance + * @returns UpdateControlRequest instance */ - public static create(properties?: google.cloud.retail.v2.IPromotion): google.cloud.retail.v2.Promotion; + public static create(properties?: google.cloud.retail.v2.IUpdateControlRequest): google.cloud.retail.v2.UpdateControlRequest; /** - * Encodes the specified Promotion message. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified UpdateControlRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateControlRequest.verify|verify} messages. + * @param message UpdateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IUpdateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Promotion message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Promotion.verify|verify} messages. - * @param message Promotion message or plain object to encode + * Encodes the specified UpdateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateControlRequest.verify|verify} messages. + * @param message UpdateControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPromotion, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Promotion message from the specified reader or buffer. + * Decodes an UpdateControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Promotion + * @returns UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.Promotion; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateControlRequest; /** - * Decodes a Promotion message from the specified reader or buffer, length delimited. + * Decodes an UpdateControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Promotion + * @returns UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.Promotion; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateControlRequest; /** - * Verifies a Promotion message. + * Verifies an UpdateControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Promotion message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Promotion + * @returns UpdateControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.Promotion; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateControlRequest; /** - * Creates a plain object from a Promotion message. Also converts values to other types if specified. - * @param message Promotion + * Creates a plain object from an UpdateControlRequest message. Also converts values to other types if specified. + * @param message UpdateControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.Promotion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.UpdateControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Promotion to JSON. + * Converts this UpdateControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Promotion + * Gets the default type url for UpdateControlRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a UserEvent. */ - interface IUserEvent { - - /** UserEvent eventType */ - eventType?: (string|null); - - /** UserEvent visitorId */ - visitorId?: (string|null); - - /** UserEvent sessionId */ - sessionId?: (string|null); - - /** UserEvent eventTime */ - eventTime?: (google.protobuf.ITimestamp|null); - - /** UserEvent experimentIds */ - experimentIds?: (string[]|null); - - /** UserEvent attributionToken */ - attributionToken?: (string|null); - - /** UserEvent productDetails */ - productDetails?: (google.cloud.retail.v2.IProductDetail[]|null); - - /** UserEvent completionDetail */ - completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); - - /** UserEvent attributes */ - attributes?: ({ [k: string]: google.cloud.retail.v2.ICustomAttribute }|null); - - /** UserEvent cartId */ - cartId?: (string|null); - - /** UserEvent purchaseTransaction */ - purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); - - /** UserEvent searchQuery */ - searchQuery?: (string|null); - - /** UserEvent filter */ - filter?: (string|null); - - /** UserEvent orderBy */ - orderBy?: (string|null); - - /** UserEvent offset */ - offset?: (number|null); - - /** UserEvent pageCategories */ - pageCategories?: (string[]|null); - - /** UserEvent userInfo */ - userInfo?: (google.cloud.retail.v2.IUserInfo|null); - - /** UserEvent uri */ - uri?: (string|null); - - /** UserEvent referrerUri */ - referrerUri?: (string|null); + /** Properties of a DeleteControlRequest. */ + interface IDeleteControlRequest { - /** UserEvent pageViewId */ - pageViewId?: (string|null); + /** DeleteControlRequest name */ + name?: (string|null); } - /** Represents a UserEvent. */ - class UserEvent implements IUserEvent { + /** Represents a DeleteControlRequest. */ + class DeleteControlRequest implements IDeleteControlRequest { /** - * Constructs a new UserEvent. + * Constructs a new DeleteControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IUserEvent); - - /** UserEvent eventType. */ - public eventType: string; - - /** UserEvent visitorId. */ - public visitorId: string; + constructor(properties?: google.cloud.retail.v2.IDeleteControlRequest); - /** UserEvent sessionId. */ - public sessionId: string; - - /** UserEvent eventTime. */ - public eventTime?: (google.protobuf.ITimestamp|null); - - /** UserEvent experimentIds. */ - public experimentIds: string[]; - - /** UserEvent attributionToken. */ - public attributionToken: string; - - /** UserEvent productDetails. */ - public productDetails: google.cloud.retail.v2.IProductDetail[]; - - /** UserEvent completionDetail. */ - public completionDetail?: (google.cloud.retail.v2.ICompletionDetail|null); - - /** UserEvent attributes. */ - public attributes: { [k: string]: google.cloud.retail.v2.ICustomAttribute }; - - /** UserEvent cartId. */ - public cartId: string; - - /** UserEvent purchaseTransaction. */ - public purchaseTransaction?: (google.cloud.retail.v2.IPurchaseTransaction|null); - - /** UserEvent searchQuery. */ - public searchQuery: string; - - /** UserEvent filter. */ - public filter: string; - - /** UserEvent orderBy. */ - public orderBy: string; - - /** UserEvent offset. */ - public offset: number; - - /** UserEvent pageCategories. */ - public pageCategories: string[]; - - /** UserEvent userInfo. */ - public userInfo?: (google.cloud.retail.v2.IUserInfo|null); - - /** UserEvent uri. */ - public uri: string; - - /** UserEvent referrerUri. */ - public referrerUri: string; - - /** UserEvent pageViewId. */ - public pageViewId: string; + /** DeleteControlRequest name. */ + public name: string; /** - * Creates a new UserEvent instance using the specified properties. + * Creates a new DeleteControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UserEvent instance + * @returns DeleteControlRequest instance */ - public static create(properties?: google.cloud.retail.v2.IUserEvent): google.cloud.retail.v2.UserEvent; + public static create(properties?: google.cloud.retail.v2.IDeleteControlRequest): google.cloud.retail.v2.DeleteControlRequest; /** - * Encodes the specified UserEvent message. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified DeleteControlRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteControlRequest.verify|verify} messages. + * @param message DeleteControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IDeleteControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UserEvent message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEvent.verify|verify} messages. - * @param message UserEvent message or plain object to encode + * Encodes the specified DeleteControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteControlRequest.verify|verify} messages. + * @param message DeleteControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IUserEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IDeleteControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a UserEvent message from the specified reader or buffer. + * Decodes a DeleteControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UserEvent + * @returns DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UserEvent; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.DeleteControlRequest; /** - * Decodes a UserEvent message from the specified reader or buffer, length delimited. + * Decodes a DeleteControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UserEvent + * @returns DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UserEvent; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.DeleteControlRequest; /** - * Verifies a UserEvent message. + * Verifies a DeleteControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a UserEvent message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UserEvent + * @returns DeleteControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UserEvent; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.DeleteControlRequest; /** - * Creates a plain object from a UserEvent message. Also converts values to other types if specified. - * @param message UserEvent + * Creates a plain object from a DeleteControlRequest message. Also converts values to other types if specified. + * @param message DeleteControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.UserEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.DeleteControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UserEvent to JSON. + * Converts this DeleteControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for UserEvent + * Gets the default type url for DeleteControlRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ProductDetail. */ - interface IProductDetail { - - /** ProductDetail product */ - product?: (google.cloud.retail.v2.IProduct|null); + /** Properties of a GetControlRequest. */ + interface IGetControlRequest { - /** ProductDetail quantity */ - quantity?: (google.protobuf.IInt32Value|null); + /** GetControlRequest name */ + name?: (string|null); } - /** Represents a ProductDetail. */ - class ProductDetail implements IProductDetail { + /** Represents a GetControlRequest. */ + class GetControlRequest implements IGetControlRequest { /** - * Constructs a new ProductDetail. + * Constructs a new GetControlRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IProductDetail); + constructor(properties?: google.cloud.retail.v2.IGetControlRequest); - /** ProductDetail product. */ - public product?: (google.cloud.retail.v2.IProduct|null); - - /** ProductDetail quantity. */ - public quantity?: (google.protobuf.IInt32Value|null); + /** GetControlRequest name. */ + public name: string; /** - * Creates a new ProductDetail instance using the specified properties. + * Creates a new GetControlRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ProductDetail instance + * @returns GetControlRequest instance */ - public static create(properties?: google.cloud.retail.v2.IProductDetail): google.cloud.retail.v2.ProductDetail; + public static create(properties?: google.cloud.retail.v2.IGetControlRequest): google.cloud.retail.v2.GetControlRequest; /** - * Encodes the specified ProductDetail message. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified GetControlRequest message. Does not implicitly {@link google.cloud.retail.v2.GetControlRequest.verify|verify} messages. + * @param message GetControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IGetControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ProductDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductDetail.verify|verify} messages. - * @param message ProductDetail message or plain object to encode + * Encodes the specified GetControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetControlRequest.verify|verify} messages. + * @param message GetControlRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IProductDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IGetControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProductDetail message from the specified reader or buffer. + * Decodes a GetControlRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ProductDetail + * @returns GetControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ProductDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetControlRequest; /** - * Decodes a ProductDetail message from the specified reader or buffer, length delimited. + * Decodes a GetControlRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProductDetail + * @returns GetControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ProductDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetControlRequest; /** - * Verifies a ProductDetail message. + * Verifies a GetControlRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ProductDetail message from a plain object. Also converts values to their respective internal types. + * Creates a GetControlRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProductDetail + * @returns GetControlRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ProductDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetControlRequest; /** - * Creates a plain object from a ProductDetail message. Also converts values to other types if specified. - * @param message ProductDetail + * Creates a plain object from a GetControlRequest message. Also converts values to other types if specified. + * @param message GetControlRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.ProductDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.GetControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProductDetail to JSON. + * Converts this GetControlRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ProductDetail + * Gets the default type url for GetControlRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a CompletionDetail. */ - interface ICompletionDetail { + /** Properties of a ListControlsRequest. */ + interface IListControlsRequest { - /** CompletionDetail completionAttributionToken */ - completionAttributionToken?: (string|null); + /** ListControlsRequest parent */ + parent?: (string|null); - /** CompletionDetail selectedSuggestion */ - selectedSuggestion?: (string|null); + /** ListControlsRequest pageSize */ + pageSize?: (number|null); - /** CompletionDetail selectedPosition */ - selectedPosition?: (number|null); + /** ListControlsRequest pageToken */ + pageToken?: (string|null); + + /** ListControlsRequest filter */ + filter?: (string|null); } - /** Represents a CompletionDetail. */ - class CompletionDetail implements ICompletionDetail { + /** Represents a ListControlsRequest. */ + class ListControlsRequest implements IListControlsRequest { /** - * Constructs a new CompletionDetail. + * Constructs a new ListControlsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.ICompletionDetail); + constructor(properties?: google.cloud.retail.v2.IListControlsRequest); - /** CompletionDetail completionAttributionToken. */ - public completionAttributionToken: string; + /** ListControlsRequest parent. */ + public parent: string; - /** CompletionDetail selectedSuggestion. */ - public selectedSuggestion: string; + /** ListControlsRequest pageSize. */ + public pageSize: number; - /** CompletionDetail selectedPosition. */ - public selectedPosition: number; + /** ListControlsRequest pageToken. */ + public pageToken: string; + + /** ListControlsRequest filter. */ + public filter: string; /** - * Creates a new CompletionDetail instance using the specified properties. + * Creates a new ListControlsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns CompletionDetail instance + * @returns ListControlsRequest instance */ - public static create(properties?: google.cloud.retail.v2.ICompletionDetail): google.cloud.retail.v2.CompletionDetail; + public static create(properties?: google.cloud.retail.v2.IListControlsRequest): google.cloud.retail.v2.ListControlsRequest; /** - * Encodes the specified CompletionDetail message. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified ListControlsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListControlsRequest.verify|verify} messages. + * @param message ListControlsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListControlsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CompletionDetail message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionDetail.verify|verify} messages. - * @param message CompletionDetail message or plain object to encode + * Encodes the specified ListControlsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListControlsRequest.verify|verify} messages. + * @param message ListControlsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ICompletionDetail, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListControlsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CompletionDetail message from the specified reader or buffer. + * Decodes a ListControlsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CompletionDetail + * @returns ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CompletionDetail; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListControlsRequest; /** - * Decodes a CompletionDetail message from the specified reader or buffer, length delimited. + * Decodes a ListControlsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CompletionDetail + * @returns ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CompletionDetail; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListControlsRequest; /** - * Verifies a CompletionDetail message. + * Verifies a ListControlsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CompletionDetail message from a plain object. Also converts values to their respective internal types. + * Creates a ListControlsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CompletionDetail + * @returns ListControlsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CompletionDetail; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListControlsRequest; /** - * Creates a plain object from a CompletionDetail message. Also converts values to other types if specified. - * @param message CompletionDetail + * Creates a plain object from a ListControlsRequest message. Also converts values to other types if specified. + * @param message ListControlsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.CompletionDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListControlsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CompletionDetail to JSON. + * Converts this ListControlsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for CompletionDetail + * Gets the default type url for ListControlsRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a PurchaseTransaction. */ - interface IPurchaseTransaction { - - /** PurchaseTransaction id */ - id?: (string|null); - - /** PurchaseTransaction revenue */ - revenue?: (number|null); - - /** PurchaseTransaction tax */ - tax?: (number|null); + /** Properties of a ListControlsResponse. */ + interface IListControlsResponse { - /** PurchaseTransaction cost */ - cost?: (number|null); + /** ListControlsResponse controls */ + controls?: (google.cloud.retail.v2.IControl[]|null); - /** PurchaseTransaction currencyCode */ - currencyCode?: (string|null); + /** ListControlsResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a PurchaseTransaction. */ - class PurchaseTransaction implements IPurchaseTransaction { + /** Represents a ListControlsResponse. */ + class ListControlsResponse implements IListControlsResponse { /** - * Constructs a new PurchaseTransaction. + * Constructs a new ListControlsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.IPurchaseTransaction); - - /** PurchaseTransaction id. */ - public id: string; - - /** PurchaseTransaction revenue. */ - public revenue: number; - - /** PurchaseTransaction tax. */ - public tax: number; + constructor(properties?: google.cloud.retail.v2.IListControlsResponse); - /** PurchaseTransaction cost. */ - public cost: number; + /** ListControlsResponse controls. */ + public controls: google.cloud.retail.v2.IControl[]; - /** PurchaseTransaction currencyCode. */ - public currencyCode: string; + /** ListControlsResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new PurchaseTransaction instance using the specified properties. + * Creates a new ListControlsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns PurchaseTransaction instance + * @returns ListControlsResponse instance */ - public static create(properties?: google.cloud.retail.v2.IPurchaseTransaction): google.cloud.retail.v2.PurchaseTransaction; + public static create(properties?: google.cloud.retail.v2.IListControlsResponse): google.cloud.retail.v2.ListControlsResponse; /** - * Encodes the specified PurchaseTransaction message. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified ListControlsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListControlsResponse.verify|verify} messages. + * @param message ListControlsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IListControlsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurchaseTransaction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurchaseTransaction.verify|verify} messages. - * @param message PurchaseTransaction message or plain object to encode + * Encodes the specified ListControlsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListControlsResponse.verify|verify} messages. + * @param message ListControlsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurchaseTransaction, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IListControlsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer. + * Decodes a ListControlsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurchaseTransaction + * @returns ListControlsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurchaseTransaction; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListControlsResponse; /** - * Decodes a PurchaseTransaction message from the specified reader or buffer, length delimited. + * Decodes a ListControlsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurchaseTransaction + * @returns ListControlsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurchaseTransaction; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListControlsResponse; /** - * Verifies a PurchaseTransaction message. + * Verifies a ListControlsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurchaseTransaction message from a plain object. Also converts values to their respective internal types. + * Creates a ListControlsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurchaseTransaction + * @returns ListControlsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurchaseTransaction; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListControlsResponse; /** - * Creates a plain object from a PurchaseTransaction message. Also converts values to other types if specified. - * @param message PurchaseTransaction + * Creates a plain object from a ListControlsResponse message. Also converts values to other types if specified. + * @param message ListControlsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurchaseTransaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.ListControlsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurchaseTransaction to JSON. + * Converts this ListControlsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for PurchaseTransaction + * Gets the default type url for ListControlsResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -8234,1145 +11711,1996 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a PurgeMetadata. */ - interface IPurgeMetadata { - } + /** Properties of a PurgeMetadata. */ + interface IPurgeMetadata { + } + + /** Represents a PurgeMetadata. */ + class PurgeMetadata implements IPurgeMetadata { + + /** + * Constructs a new PurgeMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeMetadata instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @param message PurgeMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; + + /** + * Verifies a PurgeMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @param message PurgeMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PurgeUserEventsRequest. */ + interface IPurgeUserEventsRequest { + + /** PurgeUserEventsRequest parent */ + parent?: (string|null); + + /** PurgeUserEventsRequest filter */ + filter?: (string|null); + + /** PurgeUserEventsRequest force */ + force?: (boolean|null); + } + + /** Represents a PurgeUserEventsRequest. */ + class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + + /** + * Constructs a new PurgeUserEventsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); + + /** PurgeUserEventsRequest parent. */ + public parent: string; + + /** PurgeUserEventsRequest filter. */ + public filter: string; + + /** PurgeUserEventsRequest force. */ + public force: boolean; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @param message PurgeUserEventsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Verifies a PurgeUserEventsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @param message PurgeUserEventsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PurgeUserEventsResponse. */ + interface IPurgeUserEventsResponse { + + /** PurgeUserEventsResponse purgedEventsCount */ + purgedEventsCount?: (number|Long|string|null); + } + + /** Represents a PurgeUserEventsResponse. */ + class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + + /** + * Constructs a new PurgeUserEventsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); + + /** PurgeUserEventsResponse purgedEventsCount. */ + public purgedEventsCount: (number|Long|string); + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PurgeUserEventsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @param message PurgeUserEventsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Verifies a PurgeUserEventsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PurgeUserEventsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @param message PurgeUserEventsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PurgeUserEventsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SearchService */ + class SearchService extends $protobuf.rpc.Service { + + /** + * Constructs a new SearchService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SearchService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchResponse + */ + public search(request: google.cloud.retail.v2.ISearchRequest, callback: google.cloud.retail.v2.SearchService.SearchCallback): void; + + /** + * Calls Search. + * @param request SearchRequest message or plain object + * @returns Promise + */ + public search(request: google.cloud.retail.v2.ISearchRequest): Promise; + } + + namespace SearchService { + + /** + * Callback as used by {@link google.cloud.retail.v2.SearchService|search}. + * @param error Error, if any + * @param [response] SearchResponse + */ + type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2.SearchResponse) => void; + } + + /** Properties of a SearchRequest. */ + interface ISearchRequest { + + /** SearchRequest placement */ + placement?: (string|null); + + /** SearchRequest branch */ + branch?: (string|null); + + /** SearchRequest query */ + query?: (string|null); + + /** SearchRequest visitorId */ + visitorId?: (string|null); + + /** SearchRequest userInfo */ + userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** SearchRequest pageSize */ + pageSize?: (number|null); + + /** SearchRequest pageToken */ + pageToken?: (string|null); + + /** SearchRequest offset */ + offset?: (number|null); + + /** SearchRequest filter */ + filter?: (string|null); + + /** SearchRequest canonicalFilter */ + canonicalFilter?: (string|null); + + /** SearchRequest orderBy */ + orderBy?: (string|null); + + /** SearchRequest facetSpecs */ + facetSpecs?: (google.cloud.retail.v2.SearchRequest.IFacetSpec[]|null); + + /** SearchRequest dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec */ + boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec */ + queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys */ + variantRollupKeys?: (string[]|null); + + /** SearchRequest pageCategories */ + pageCategories?: (string[]|null); + + /** SearchRequest searchMode */ + searchMode?: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode|null); + + /** SearchRequest personalizationSpec */ + personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** SearchRequest labels */ + labels?: ({ [k: string]: string }|null); + + /** SearchRequest spellCorrectionSpec */ + spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); + } + + /** Represents a SearchRequest. */ + class SearchRequest implements ISearchRequest { + + /** + * Constructs a new SearchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ISearchRequest); + + /** SearchRequest placement. */ + public placement: string; + + /** SearchRequest branch. */ + public branch: string; + + /** SearchRequest query. */ + public query: string; + + /** SearchRequest visitorId. */ + public visitorId: string; + + /** SearchRequest userInfo. */ + public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + + /** SearchRequest pageSize. */ + public pageSize: number; + + /** SearchRequest pageToken. */ + public pageToken: string; + + /** SearchRequest offset. */ + public offset: number; + + /** SearchRequest filter. */ + public filter: string; + + /** SearchRequest canonicalFilter. */ + public canonicalFilter: string; + + /** SearchRequest orderBy. */ + public orderBy: string; + + /** SearchRequest facetSpecs. */ + public facetSpecs: google.cloud.retail.v2.SearchRequest.IFacetSpec[]; + + /** SearchRequest dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** SearchRequest boostSpec. */ + public boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + + /** SearchRequest queryExpansionSpec. */ + public queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + + /** SearchRequest variantRollupKeys. */ + public variantRollupKeys: string[]; + + /** SearchRequest pageCategories. */ + public pageCategories: string[]; + + /** SearchRequest searchMode. */ + public searchMode: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode); + + /** SearchRequest personalizationSpec. */ + public personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** SearchRequest labels. */ + public labels: { [k: string]: string }; - /** Represents a PurgeMetadata. */ - class PurgeMetadata implements IPurgeMetadata { + /** SearchRequest spellCorrectionSpec. */ + public spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); - /** - * Constructs a new PurgeMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IPurgeMetadata); + /** SearchRequest _spellCorrectionSpec. */ + public _spellCorrectionSpec?: "spellCorrectionSpec"; /** - * Creates a new PurgeMetadata instance using the specified properties. + * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set - * @returns PurgeMetadata instance + * @returns SearchRequest instance */ - public static create(properties?: google.cloud.retail.v2.IPurgeMetadata): google.cloud.retail.v2.PurgeMetadata; + public static create(properties?: google.cloud.retail.v2.ISearchRequest): google.cloud.retail.v2.SearchRequest; /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @param message PurgeMetadata message or plain object to encode + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @param message SearchRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a PurgeMetadata message from the specified reader or buffer. + * Decodes a SearchRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns PurgeMetadata + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest; /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns PurgeMetadata + * @returns SearchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest; /** - * Verifies a PurgeMetadata message. + * Verifies a SearchRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns PurgeMetadata + * @returns SearchRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest; /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @param message PurgeMetadata + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @param message SearchRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.PurgeMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this PurgeMetadata to JSON. + * Converts this SearchRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for PurgeMetadata + * Gets the default type url for SearchRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a PurgeUserEventsRequest. */ - interface IPurgeUserEventsRequest { + namespace SearchRequest { - /** PurgeUserEventsRequest parent */ - parent?: (string|null); + /** Properties of a FacetSpec. */ + interface IFacetSpec { - /** PurgeUserEventsRequest filter */ - filter?: (string|null); + /** FacetSpec facetKey */ + facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); - /** PurgeUserEventsRequest force */ - force?: (boolean|null); - } + /** FacetSpec limit */ + limit?: (number|null); - /** Represents a PurgeUserEventsRequest. */ - class PurgeUserEventsRequest implements IPurgeUserEventsRequest { + /** FacetSpec excludedFilterKeys */ + excludedFilterKeys?: (string[]|null); - /** - * Constructs a new PurgeUserEventsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest); + /** FacetSpec enableDynamicPosition */ + enableDynamicPosition?: (boolean|null); + } - /** PurgeUserEventsRequest parent. */ - public parent: string; + /** Represents a FacetSpec. */ + class FacetSpec implements IFacetSpec { - /** PurgeUserEventsRequest filter. */ - public filter: string; + /** + * Constructs a new FacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec); - /** PurgeUserEventsRequest force. */ - public force: boolean; + /** FacetSpec facetKey. */ + public facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); - /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeUserEventsRequest instance - */ - public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsRequest): google.cloud.retail.v2.PurgeUserEventsRequest; + /** FacetSpec limit. */ + public limit: number; - /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetSpec excludedFilterKeys. */ + public excludedFilterKeys: string[]; - /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @param message PurgeUserEventsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetSpec enableDynamicPosition. */ + public enableDynamicPosition: boolean; - /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsRequest; + /** + * Creates a new FacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsRequest; + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a PurgeUserEventsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @param message FacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeUserEventsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsRequest; + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @param message PurgeUserEventsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.PurgeUserEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** - * Converts this PurgeUserEventsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Verifies a FacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Gets the default type url for PurgeUserEventsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec; - /** Properties of a PurgeUserEventsResponse. */ - interface IPurgeUserEventsResponse { + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @param message FacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** PurgeUserEventsResponse purgedEventsCount */ - purgedEventsCount?: (number|Long|string|null); - } + /** + * Converts this FacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** Represents a PurgeUserEventsResponse. */ - class PurgeUserEventsResponse implements IPurgeUserEventsResponse { + /** + * Gets the default type url for FacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Constructs a new PurgeUserEventsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse); + namespace FacetSpec { - /** PurgeUserEventsResponse purgedEventsCount. */ - public purgedEventsCount: (number|Long|string); + /** Properties of a FacetKey. */ + interface IFacetKey { - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeUserEventsResponse instance - */ - public static create(properties?: google.cloud.retail.v2.IPurgeUserEventsResponse): google.cloud.retail.v2.PurgeUserEventsResponse; + /** FacetKey key */ + key?: (string|null); - /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetKey intervals */ + intervals?: (google.cloud.retail.v2.IInterval[]|null); - /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @param message PurgeUserEventsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.IPurgeUserEventsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + /** FacetKey restrictedValues */ + restrictedValues?: (string[]|null); + + /** FacetKey prefixes */ + prefixes?: (string[]|null); + + /** FacetKey contains */ + contains?: (string[]|null); + + /** FacetKey caseInsensitive */ + caseInsensitive?: (boolean|null); + + /** FacetKey orderBy */ + orderBy?: (string|null); + + /** FacetKey query */ + query?: (string|null); + + /** FacetKey returnMinMax */ + returnMinMax?: (boolean|null); + } + + /** Represents a FacetKey. */ + class FacetKey implements IFacetKey { + + /** + * Constructs a new FacetKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey); + + /** FacetKey key. */ + public key: string; + + /** FacetKey intervals. */ + public intervals: google.cloud.retail.v2.IInterval[]; + + /** FacetKey restrictedValues. */ + public restrictedValues: string[]; + + /** FacetKey prefixes. */ + public prefixes: string[]; + + /** FacetKey contains. */ + public contains: string[]; + + /** FacetKey caseInsensitive. */ + public caseInsensitive: boolean; + + /** FacetKey orderBy. */ + public orderBy: string; + + /** FacetKey query. */ + public query: string; + + /** FacetKey returnMinMax. */ + public returnMinMax: boolean; + + /** + * Creates a new FacetKey instance using the specified properties. + * @param [properties] Properties to set + * @returns FacetKey instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @param message FacetKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Verifies a FacetKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FacetKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @param message FacetKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FacetKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FacetKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a DynamicFacetSpec. */ + interface IDynamicFacetSpec { + + /** DynamicFacetSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null); + } + + /** Represents a DynamicFacetSpec. */ + class DynamicFacetSpec implements IDynamicFacetSpec { + + /** + * Constructs a new DynamicFacetSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec); + + /** DynamicFacetSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode); + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns DynamicFacetSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @param message DynamicFacetSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Verifies a DynamicFacetSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DynamicFacetSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @param message DynamicFacetSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.PurgeUserEventsResponse; + /** + * Gets the default type url for DynamicFacetSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.PurgeUserEventsResponse; + namespace DynamicFacetSpec { - /** - * Verifies a PurgeUserEventsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + DISABLED = 1, + ENABLED = 2 + } + } - /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeUserEventsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.PurgeUserEventsResponse; + /** Properties of a BoostSpec. */ + interface IBoostSpec { - /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @param message PurgeUserEventsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.PurgeUserEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** BoostSpec conditionBoostSpecs */ + conditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); - /** - * Converts this PurgeUserEventsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** BoostSpec skipBoostSpecValidation */ + skipBoostSpecValidation?: (boolean|null); + } - /** - * Gets the default type url for PurgeUserEventsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** Represents a BoostSpec. */ + class BoostSpec implements IBoostSpec { - /** Represents a SearchService */ - class SearchService extends $protobuf.rpc.Service { + /** + * Constructs a new BoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec); - /** - * Constructs a new SearchService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** BoostSpec conditionBoostSpecs. */ + public conditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; - /** - * Creates new SearchService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SearchService; + /** BoostSpec skipBoostSpecValidation. */ + public skipBoostSpecValidation?: (boolean|null); - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SearchResponse - */ - public search(request: google.cloud.retail.v2.ISearchRequest, callback: google.cloud.retail.v2.SearchService.SearchCallback): void; + /** BoostSpec _skipBoostSpecValidation. */ + public _skipBoostSpecValidation?: "skipBoostSpecValidation"; - /** - * Calls Search. - * @param request SearchRequest message or plain object - * @returns Promise - */ - public search(request: google.cloud.retail.v2.ISearchRequest): Promise; - } + /** + * Creates a new BoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns BoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec; - namespace SearchService { + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Callback as used by {@link google.cloud.retail.v2.SearchService|search}. - * @param error Error, if any - * @param [response] SearchResponse - */ - type SearchCallback = (error: (Error|null), response?: google.cloud.retail.v2.SearchResponse) => void; - } + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @param message BoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a SearchRequest. */ - interface ISearchRequest { + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** SearchRequest placement */ - placement?: (string|null); + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** SearchRequest branch */ - branch?: (string|null); + /** + * Verifies a BoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchRequest query */ - query?: (string|null); + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec; - /** SearchRequest visitorId */ - visitorId?: (string|null); + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @param message BoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchRequest userInfo */ - userInfo?: (google.cloud.retail.v2.IUserInfo|null); + /** + * Converts this BoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** SearchRequest pageSize */ - pageSize?: (number|null); + /** + * Gets the default type url for BoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** SearchRequest pageToken */ - pageToken?: (string|null); + namespace BoostSpec { - /** SearchRequest offset */ - offset?: (number|null); + /** Properties of a ConditionBoostSpec. */ + interface IConditionBoostSpec { - /** SearchRequest filter */ - filter?: (string|null); + /** ConditionBoostSpec condition */ + condition?: (string|null); - /** SearchRequest canonicalFilter */ - canonicalFilter?: (string|null); + /** ConditionBoostSpec boost */ + boost?: (number|null); + } - /** SearchRequest orderBy */ - orderBy?: (string|null); + /** Represents a ConditionBoostSpec. */ + class ConditionBoostSpec implements IConditionBoostSpec { - /** SearchRequest facetSpecs */ - facetSpecs?: (google.cloud.retail.v2.SearchRequest.IFacetSpec[]|null); + /** + * Constructs a new ConditionBoostSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec); - /** SearchRequest dynamicFacetSpec */ - dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + /** ConditionBoostSpec condition. */ + public condition: string; - /** SearchRequest boostSpec */ - boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + /** ConditionBoostSpec boost. */ + public boost: number; - /** SearchRequest queryExpansionSpec */ - queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionBoostSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; - /** SearchRequest variantRollupKeys */ - variantRollupKeys?: (string[]|null); + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchRequest pageCategories */ - pageCategories?: (string[]|null); + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @param message ConditionBoostSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchRequest searchMode */ - searchMode?: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode|null); + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; - /** SearchRequest personalizationSpec */ - personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; - /** SearchRequest labels */ - labels?: ({ [k: string]: string }|null); + /** + * Verifies a ConditionBoostSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchRequest spellCorrectionSpec */ - spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); - } + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionBoostSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; - /** Represents a SearchRequest. */ - class SearchRequest implements ISearchRequest { + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @param message ConditionBoostSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Constructs a new SearchRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.ISearchRequest); + /** + * Converts this ConditionBoostSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** SearchRequest placement. */ - public placement: string; + /** + * Gets the default type url for ConditionBoostSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } - /** SearchRequest branch. */ - public branch: string; + /** Properties of a QueryExpansionSpec. */ + interface IQueryExpansionSpec { - /** SearchRequest query. */ - public query: string; + /** QueryExpansionSpec condition */ + condition?: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null); - /** SearchRequest visitorId. */ - public visitorId: string; + /** QueryExpansionSpec pinUnexpandedResults */ + pinUnexpandedResults?: (boolean|null); + } - /** SearchRequest userInfo. */ - public userInfo?: (google.cloud.retail.v2.IUserInfo|null); + /** Represents a QueryExpansionSpec. */ + class QueryExpansionSpec implements IQueryExpansionSpec { - /** SearchRequest pageSize. */ - public pageSize: number; + /** + * Constructs a new QueryExpansionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec); - /** SearchRequest pageToken. */ - public pageToken: string; + /** QueryExpansionSpec condition. */ + public condition: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition); - /** SearchRequest offset. */ - public offset: number; + /** QueryExpansionSpec pinUnexpandedResults. */ + public pinUnexpandedResults: boolean; - /** SearchRequest filter. */ - public filter: string; + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryExpansionSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; - /** SearchRequest canonicalFilter. */ - public canonicalFilter: string; + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchRequest orderBy. */ - public orderBy: string; + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @param message QueryExpansionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchRequest facetSpecs. */ - public facetSpecs: google.cloud.retail.v2.SearchRequest.IFacetSpec[]; + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; - /** SearchRequest dynamicFacetSpec. */ - public dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; - /** SearchRequest boostSpec. */ - public boostSpec?: (google.cloud.retail.v2.SearchRequest.IBoostSpec|null); + /** + * Verifies a QueryExpansionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchRequest queryExpansionSpec. */ - public queryExpansionSpec?: (google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null); + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; - /** SearchRequest variantRollupKeys. */ - public variantRollupKeys: string[]; + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @param message QueryExpansionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchRequest pageCategories. */ - public pageCategories: string[]; + /** + * Converts this QueryExpansionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** SearchRequest searchMode. */ - public searchMode: (google.cloud.retail.v2.SearchRequest.SearchMode|keyof typeof google.cloud.retail.v2.SearchRequest.SearchMode); + /** + * Gets the default type url for QueryExpansionSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** SearchRequest personalizationSpec. */ - public personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + namespace QueryExpansionSpec { - /** SearchRequest labels. */ - public labels: { [k: string]: string }; + /** Condition enum. */ + enum Condition { + CONDITION_UNSPECIFIED = 0, + DISABLED = 1, + AUTO = 3 + } + } - /** SearchRequest spellCorrectionSpec. */ - public spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); + /** Properties of a PersonalizationSpec. */ + interface IPersonalizationSpec { - /** SearchRequest _spellCorrectionSpec. */ - public _spellCorrectionSpec?: "spellCorrectionSpec"; + /** PersonalizationSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|null); + } - /** - * Creates a new SearchRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SearchRequest instance - */ - public static create(properties?: google.cloud.retail.v2.ISearchRequest): google.cloud.retail.v2.SearchRequest; + /** Represents a PersonalizationSpec. */ + class PersonalizationSpec implements IPersonalizationSpec { - /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new PersonalizationSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec); - /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. - * @param message SearchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.ISearchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + /** PersonalizationSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode); + + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns PersonalizationSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; - /** - * Decodes a SearchRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SearchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest; + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SearchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest; + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @param message PersonalizationSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Verifies a SearchRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; - /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SearchRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest; + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; - /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. - * @param message SearchRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Verifies a PersonalizationSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Converts this SearchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PersonalizationSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; - /** - * Gets the default type url for SearchRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @param message PersonalizationSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.PersonalizationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; - namespace SearchRequest { + /** + * Converts this PersonalizationSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** Properties of a FacetSpec. */ - interface IFacetSpec { + /** + * Gets the default type url for PersonalizationSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** FacetSpec facetKey */ - facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); + namespace PersonalizationSpec { - /** FacetSpec limit */ - limit?: (number|null); + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + AUTO = 1, + DISABLED = 2 + } + } - /** FacetSpec excludedFilterKeys */ - excludedFilterKeys?: (string[]|null); + /** Properties of a SpellCorrectionSpec. */ + interface ISpellCorrectionSpec { - /** FacetSpec enableDynamicPosition */ - enableDynamicPosition?: (boolean|null); + /** SpellCorrectionSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null); } - /** Represents a FacetSpec. */ - class FacetSpec implements IFacetSpec { + /** Represents a SpellCorrectionSpec. */ + class SpellCorrectionSpec implements ISpellCorrectionSpec { /** - * Constructs a new FacetSpec. + * Constructs a new SpellCorrectionSpec. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec); - - /** FacetSpec facetKey. */ - public facetKey?: (google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null); - - /** FacetSpec limit. */ - public limit: number; - - /** FacetSpec excludedFilterKeys. */ - public excludedFilterKeys: string[]; + constructor(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec); - /** FacetSpec enableDynamicPosition. */ - public enableDynamicPosition: boolean; + /** SpellCorrectionSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode); /** - * Creates a new FacetSpec instance using the specified properties. + * Creates a new SpellCorrectionSpec instance using the specified properties. * @param [properties] Properties to set - * @returns FacetSpec instance + * @returns SpellCorrectionSpec instance */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IFacetSpec): google.cloud.retail.v2.SearchRequest.FacetSpec; + public static create(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. - * @param message FacetSpec message or plain object to encode + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FacetSpec message from the specified reader or buffer. + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FacetSpec + * @returns SpellCorrectionSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FacetSpec + * @returns SpellCorrectionSpec * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; /** - * Verifies a FacetSpec message. + * Verifies a SpellCorrectionSpec message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FacetSpec + * @returns SpellCorrectionSpec */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. - * @param message FacetSpec + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @param message SpellCorrectionSpec * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FacetSpec to JSON. + * Converts this SpellCorrectionSpec to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for FacetSpec + * Gets the default type url for SpellCorrectionSpec * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace FacetSpec { + namespace SpellCorrectionSpec { - /** Properties of a FacetKey. */ - interface IFacetKey { + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + SUGGESTION_ONLY = 1, + AUTO = 2 + } + } - /** FacetKey key */ - key?: (string|null); + /** SearchMode enum. */ + enum SearchMode { + SEARCH_MODE_UNSPECIFIED = 0, + PRODUCT_SEARCH_ONLY = 1, + FACETED_SEARCH_ONLY = 2 + } + } - /** FacetKey intervals */ - intervals?: (google.cloud.retail.v2.IInterval[]|null); + /** Properties of a SearchResponse. */ + interface ISearchResponse { - /** FacetKey restrictedValues */ - restrictedValues?: (string[]|null); + /** SearchResponse results */ + results?: (google.cloud.retail.v2.SearchResponse.ISearchResult[]|null); - /** FacetKey prefixes */ - prefixes?: (string[]|null); + /** SearchResponse facets */ + facets?: (google.cloud.retail.v2.SearchResponse.IFacet[]|null); - /** FacetKey contains */ - contains?: (string[]|null); + /** SearchResponse totalSize */ + totalSize?: (number|null); - /** FacetKey caseInsensitive */ - caseInsensitive?: (boolean|null); + /** SearchResponse correctedQuery */ + correctedQuery?: (string|null); - /** FacetKey orderBy */ - orderBy?: (string|null); + /** SearchResponse attributionToken */ + attributionToken?: (string|null); - /** FacetKey query */ - query?: (string|null); + /** SearchResponse nextPageToken */ + nextPageToken?: (string|null); - /** FacetKey returnMinMax */ - returnMinMax?: (boolean|null); - } + /** SearchResponse queryExpansionInfo */ + queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); - /** Represents a FacetKey. */ - class FacetKey implements IFacetKey { + /** SearchResponse redirectUri */ + redirectUri?: (string|null); - /** - * Constructs a new FacetKey. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey); + /** SearchResponse appliedControls */ + appliedControls?: (string[]|null); - /** FacetKey key. */ - public key: string; + /** SearchResponse invalidConditionBoostSpecs */ + invalidConditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + } - /** FacetKey intervals. */ - public intervals: google.cloud.retail.v2.IInterval[]; + /** Represents a SearchResponse. */ + class SearchResponse implements ISearchResponse { - /** FacetKey restrictedValues. */ - public restrictedValues: string[]; + /** + * Constructs a new SearchResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ISearchResponse); - /** FacetKey prefixes. */ - public prefixes: string[]; + /** SearchResponse results. */ + public results: google.cloud.retail.v2.SearchResponse.ISearchResult[]; - /** FacetKey contains. */ - public contains: string[]; + /** SearchResponse facets. */ + public facets: google.cloud.retail.v2.SearchResponse.IFacet[]; - /** FacetKey caseInsensitive. */ - public caseInsensitive: boolean; + /** SearchResponse totalSize. */ + public totalSize: number; - /** FacetKey orderBy. */ - public orderBy: string; + /** SearchResponse correctedQuery. */ + public correctedQuery: string; - /** FacetKey query. */ - public query: string; + /** SearchResponse attributionToken. */ + public attributionToken: string; - /** FacetKey returnMinMax. */ - public returnMinMax: boolean; + /** SearchResponse nextPageToken. */ + public nextPageToken: string; - /** - * Creates a new FacetKey instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetKey instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** SearchResponse queryExpansionInfo. */ + public queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); - /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchResponse redirectUri. */ + public redirectUri: string; - /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. - * @param message FacetKey message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey, writer?: $protobuf.Writer): $protobuf.Writer; + /** SearchResponse appliedControls. */ + public appliedControls: string[]; - /** - * Decodes a FacetKey message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** SearchResponse invalidConditionBoostSpecs. */ + public invalidConditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; - /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** + * Creates a new SearchResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchResponse instance + */ + public static create(properties?: google.cloud.retail.v2.ISearchResponse): google.cloud.retail.v2.SearchResponse; - /** - * Verifies a FacetKey message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetKey - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey; + /** + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * @param message SearchResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. - * @param message FacetKey - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a SearchResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse; - /** - * Converts this FacetKey to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse; - /** - * Gets the default type url for FacetKey - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } + /** + * Verifies a SearchResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Properties of a DynamicFacetSpec. */ - interface IDynamicFacetSpec { + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse; - /** DynamicFacetSpec mode */ - mode?: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null); + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @param message SearchResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SearchResponse { + + /** Properties of a SearchResult. */ + interface ISearchResult { + + /** SearchResult id */ + id?: (string|null); + + /** SearchResult product */ + product?: (google.cloud.retail.v2.IProduct|null); + + /** SearchResult matchingVariantCount */ + matchingVariantCount?: (number|null); + + /** SearchResult matchingVariantFields */ + matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + + /** SearchResult variantRollupValues */ + variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + + /** SearchResult personalLabels */ + personalLabels?: (string[]|null); } - /** Represents a DynamicFacetSpec. */ - class DynamicFacetSpec implements IDynamicFacetSpec { + /** Represents a SearchResult. */ + class SearchResult implements ISearchResult { /** - * Constructs a new DynamicFacetSpec. + * Constructs a new SearchResult. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec); + constructor(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult); - /** DynamicFacetSpec mode. */ - public mode: (google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode); + /** SearchResult id. */ + public id: string; + + /** SearchResult product. */ + public product?: (google.cloud.retail.v2.IProduct|null); + + /** SearchResult matchingVariantCount. */ + public matchingVariantCount: number; + + /** SearchResult matchingVariantFields. */ + public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + + /** SearchResult variantRollupValues. */ + public variantRollupValues: { [k: string]: google.protobuf.IValue }; + + /** SearchResult personalLabels. */ + public personalLabels: string[]; /** - * Creates a new DynamicFacetSpec instance using the specified properties. + * Creates a new SearchResult instance using the specified properties. * @param [properties] Properties to set - * @returns DynamicFacetSpec instance + * @returns SearchResult instance */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + public static create(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult): google.cloud.retail.v2.SearchResponse.SearchResult; /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. - * @param message DynamicFacetSpec message or plain object to encode + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @param message SearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * Decodes a SearchResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DynamicFacetSpec + * @returns SearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.SearchResult; /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * Decodes a SearchResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DynamicFacetSpec + * @returns SearchResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.SearchResult; /** - * Verifies a DynamicFacetSpec message. + * Verifies a SearchResult message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DynamicFacetSpec + * @returns SearchResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.DynamicFacetSpec; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.SearchResult; /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. - * @param message DynamicFacetSpec + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @param message SearchResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.DynamicFacetSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DynamicFacetSpec to JSON. + * Converts this SearchResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for DynamicFacetSpec + * Gets the default type url for SearchResult * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace DynamicFacetSpec { - - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - DISABLED = 1, - ENABLED = 2 - } - } + /** Properties of a Facet. */ + interface IFacet { - /** Properties of a BoostSpec. */ - interface IBoostSpec { + /** Facet key */ + key?: (string|null); - /** BoostSpec conditionBoostSpecs */ - conditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); + /** Facet values */ + values?: (google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]|null); - /** BoostSpec skipBoostSpecValidation */ - skipBoostSpecValidation?: (boolean|null); + /** Facet dynamicFacet */ + dynamicFacet?: (boolean|null); } - /** Represents a BoostSpec. */ - class BoostSpec implements IBoostSpec { + /** Represents a Facet. */ + class Facet implements IFacet { /** - * Constructs a new BoostSpec. + * Constructs a new Facet. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec); + constructor(properties?: google.cloud.retail.v2.SearchResponse.IFacet); - /** BoostSpec conditionBoostSpecs. */ - public conditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; + /** Facet key. */ + public key: string; - /** BoostSpec skipBoostSpecValidation. */ - public skipBoostSpecValidation?: (boolean|null); + /** Facet values. */ + public values: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]; - /** BoostSpec _skipBoostSpecValidation. */ - public _skipBoostSpecValidation?: "skipBoostSpecValidation"; + /** Facet dynamicFacet. */ + public dynamicFacet: boolean; /** - * Creates a new BoostSpec instance using the specified properties. + * Creates a new Facet instance using the specified properties. * @param [properties] Properties to set - * @returns BoostSpec instance + * @returns Facet instance */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static create(properties?: google.cloud.retail.v2.SearchResponse.IFacet): google.cloud.retail.v2.SearchResponse.Facet; /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @param message BoostSpec message or plain object to encode + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. + * @param message Facet message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BoostSpec message from the specified reader or buffer. + * Decodes a Facet message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BoostSpec + * @returns Facet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet; /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * Decodes a Facet message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BoostSpec + * @returns Facet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet; /** - * Verifies a BoostSpec message. + * Verifies a Facet message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * Creates a Facet message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BoostSpec + * @returns Facet */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet; /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @param message BoostSpec + * Creates a plain object from a Facet message. Also converts values to other types if specified. + * @param message Facet * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BoostSpec to JSON. + * Converts this Facet to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for BoostSpec + * Gets the default type url for Facet * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace BoostSpec { + namespace Facet { - /** Properties of a ConditionBoostSpec. */ - interface IConditionBoostSpec { + /** Properties of a FacetValue. */ + interface IFacetValue { - /** ConditionBoostSpec condition */ - condition?: (string|null); + /** FacetValue value */ + value?: (string|null); - /** ConditionBoostSpec boost */ - boost?: (number|null); + /** FacetValue interval */ + interval?: (google.cloud.retail.v2.IInterval|null); + + /** FacetValue count */ + count?: (number|Long|string|null); + + /** FacetValue minValue */ + minValue?: (number|null); + + /** FacetValue maxValue */ + maxValue?: (number|null); } - /** Represents a ConditionBoostSpec. */ - class ConditionBoostSpec implements IConditionBoostSpec { + /** Represents a FacetValue. */ + class FacetValue implements IFacetValue { /** - * Constructs a new ConditionBoostSpec. + * Constructs a new FacetValue. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec); + constructor(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue); - /** ConditionBoostSpec condition. */ - public condition: string; + /** FacetValue value. */ + public value?: (string|null); - /** ConditionBoostSpec boost. */ - public boost: number; + /** FacetValue interval. */ + public interval?: (google.cloud.retail.v2.IInterval|null); + + /** FacetValue count. */ + public count: (number|Long|string); + + /** FacetValue minValue. */ + public minValue: number; + + /** FacetValue maxValue. */ + public maxValue: number; + + /** FacetValue facetValue. */ + public facetValue?: ("value"|"interval"); /** - * Creates a new ConditionBoostSpec instance using the specified properties. + * Creates a new FacetValue instance using the specified properties. * @param [properties] Properties to set - * @returns ConditionBoostSpec instance + * @returns FacetValue instance */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + public static create(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @param message ConditionBoostSpec message or plain object to encode + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. + * @param message FacetValue message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * Decodes a FacetValue message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ConditionBoostSpec + * @returns FacetValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * Decodes a FacetValue message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ConditionBoostSpec + * @returns FacetValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; /** - * Verifies a ConditionBoostSpec message. + * Verifies a FacetValue message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ConditionBoostSpec + * @returns FacetValue */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @param message ConditionBoostSpec + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. + * @param message FacetValue * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ConditionBoostSpec to JSON. + * Converts this FacetValue to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ConditionBoostSpec + * Gets the default type url for FacetValue * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -9380,953 +13708,1302 @@ export namespace google { } } - /** Properties of a QueryExpansionSpec. */ - interface IQueryExpansionSpec { + /** Properties of a QueryExpansionInfo. */ + interface IQueryExpansionInfo { - /** QueryExpansionSpec condition */ - condition?: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null); + /** QueryExpansionInfo expandedQuery */ + expandedQuery?: (boolean|null); - /** QueryExpansionSpec pinUnexpandedResults */ - pinUnexpandedResults?: (boolean|null); + /** QueryExpansionInfo pinnedResultCount */ + pinnedResultCount?: (number|Long|string|null); } - /** Represents a QueryExpansionSpec. */ - class QueryExpansionSpec implements IQueryExpansionSpec { + /** Represents a QueryExpansionInfo. */ + class QueryExpansionInfo implements IQueryExpansionInfo { /** - * Constructs a new QueryExpansionSpec. + * Constructs a new QueryExpansionInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec); + constructor(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo); - /** QueryExpansionSpec condition. */ - public condition: (google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|keyof typeof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition); + /** QueryExpansionInfo expandedQuery. */ + public expandedQuery: boolean; - /** QueryExpansionSpec pinUnexpandedResults. */ - public pinUnexpandedResults: boolean; + /** QueryExpansionInfo pinnedResultCount. */ + public pinnedResultCount: (number|Long|string); /** - * Creates a new QueryExpansionSpec instance using the specified properties. + * Creates a new QueryExpansionInfo instance using the specified properties. * @param [properties] Properties to set - * @returns QueryExpansionSpec instance + * @returns QueryExpansionInfo instance */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + public static create(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @param message QueryExpansionSpec message or plain object to encode + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. + * @param message QueryExpansionInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * Decodes a QueryExpansionInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns QueryExpansionSpec + * @returns QueryExpansionInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryExpansionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Verifies a QueryExpansionInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryExpansionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + + /** + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. + * @param message QueryExpansionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryExpansionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryExpansionInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ServingConfig. */ + interface IServingConfig { + + /** ServingConfig name */ + name?: (string|null); + + /** ServingConfig displayName */ + displayName?: (string|null); + + /** ServingConfig modelId */ + modelId?: (string|null); + + /** ServingConfig priceRerankingLevel */ + priceRerankingLevel?: (string|null); + + /** ServingConfig facetControlIds */ + facetControlIds?: (string[]|null); + + /** ServingConfig dynamicFacetSpec */ + dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** ServingConfig boostControlIds */ + boostControlIds?: (string[]|null); + + /** ServingConfig filterControlIds */ + filterControlIds?: (string[]|null); + + /** ServingConfig redirectControlIds */ + redirectControlIds?: (string[]|null); + + /** ServingConfig twowaySynonymsControlIds */ + twowaySynonymsControlIds?: (string[]|null); + + /** ServingConfig onewaySynonymsControlIds */ + onewaySynonymsControlIds?: (string[]|null); + + /** ServingConfig doNotAssociateControlIds */ + doNotAssociateControlIds?: (string[]|null); + + /** ServingConfig replacementControlIds */ + replacementControlIds?: (string[]|null); + + /** ServingConfig ignoreControlIds */ + ignoreControlIds?: (string[]|null); + + /** ServingConfig diversityLevel */ + diversityLevel?: (string|null); + + /** ServingConfig enableCategoryFilterLevel */ + enableCategoryFilterLevel?: (string|null); + + /** ServingConfig personalizationSpec */ + personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** ServingConfig solutionTypes */ + solutionTypes?: (google.cloud.retail.v2.SolutionType[]|null); + } + + /** Represents a ServingConfig. */ + class ServingConfig implements IServingConfig { + + /** + * Constructs a new ServingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IServingConfig); + + /** ServingConfig name. */ + public name: string; + + /** ServingConfig displayName. */ + public displayName: string; + + /** ServingConfig modelId. */ + public modelId: string; + + /** ServingConfig priceRerankingLevel. */ + public priceRerankingLevel: string; + + /** ServingConfig facetControlIds. */ + public facetControlIds: string[]; + + /** ServingConfig dynamicFacetSpec. */ + public dynamicFacetSpec?: (google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null); + + /** ServingConfig boostControlIds. */ + public boostControlIds: string[]; + + /** ServingConfig filterControlIds. */ + public filterControlIds: string[]; + + /** ServingConfig redirectControlIds. */ + public redirectControlIds: string[]; + + /** ServingConfig twowaySynonymsControlIds. */ + public twowaySynonymsControlIds: string[]; + + /** ServingConfig onewaySynonymsControlIds. */ + public onewaySynonymsControlIds: string[]; + + /** ServingConfig doNotAssociateControlIds. */ + public doNotAssociateControlIds: string[]; + + /** ServingConfig replacementControlIds. */ + public replacementControlIds: string[]; + + /** ServingConfig ignoreControlIds. */ + public ignoreControlIds: string[]; + + /** ServingConfig diversityLevel. */ + public diversityLevel: string; + + /** ServingConfig enableCategoryFilterLevel. */ + public enableCategoryFilterLevel: string; + + /** ServingConfig personalizationSpec. */ + public personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** ServingConfig solutionTypes. */ + public solutionTypes: google.cloud.retail.v2.SolutionType[]; + + /** + * Creates a new ServingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServingConfig instance + */ + public static create(properties?: google.cloud.retail.v2.IServingConfig): google.cloud.retail.v2.ServingConfig; + + /** + * Encodes the specified ServingConfig message. Does not implicitly {@link google.cloud.retail.v2.ServingConfig.verify|verify} messages. + * @param message ServingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IServingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ServingConfig.verify|verify} messages. + * @param message ServingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IServingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ServingConfig; + + /** + * Decodes a ServingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ServingConfig; + + /** + * Verifies a ServingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ServingConfig; + + /** + * Creates a plain object from a ServingConfig message. Also converts values to other types if specified. + * @param message ServingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ServingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + /** Represents a ServingConfigService */ + class ServingConfigService extends $protobuf.rpc.Service { - /** - * Verifies a QueryExpansionSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Constructs a new ServingConfigService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.QueryExpansionSpec; + /** + * Creates new ServingConfigService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ServingConfigService; - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @param message QueryExpansionSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.QueryExpansionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Calls CreateServingConfig. + * @param request CreateServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public createServingConfig(request: google.cloud.retail.v2.ICreateServingConfigRequest, callback: google.cloud.retail.v2.ServingConfigService.CreateServingConfigCallback): void; - /** - * Converts this QueryExpansionSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Calls CreateServingConfig. + * @param request CreateServingConfigRequest message or plain object + * @returns Promise + */ + public createServingConfig(request: google.cloud.retail.v2.ICreateServingConfigRequest): Promise; - /** - * Gets the default type url for QueryExpansionSpec - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Calls DeleteServingConfig. + * @param request DeleteServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteServingConfig(request: google.cloud.retail.v2.IDeleteServingConfigRequest, callback: google.cloud.retail.v2.ServingConfigService.DeleteServingConfigCallback): void; - namespace QueryExpansionSpec { + /** + * Calls DeleteServingConfig. + * @param request DeleteServingConfigRequest message or plain object + * @returns Promise + */ + public deleteServingConfig(request: google.cloud.retail.v2.IDeleteServingConfigRequest): Promise; - /** Condition enum. */ - enum Condition { - CONDITION_UNSPECIFIED = 0, - DISABLED = 1, - AUTO = 3 - } - } + /** + * Calls UpdateServingConfig. + * @param request UpdateServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public updateServingConfig(request: google.cloud.retail.v2.IUpdateServingConfigRequest, callback: google.cloud.retail.v2.ServingConfigService.UpdateServingConfigCallback): void; - /** Properties of a PersonalizationSpec. */ - interface IPersonalizationSpec { + /** + * Calls UpdateServingConfig. + * @param request UpdateServingConfigRequest message or plain object + * @returns Promise + */ + public updateServingConfig(request: google.cloud.retail.v2.IUpdateServingConfigRequest): Promise; - /** PersonalizationSpec mode */ - mode?: (google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|null); - } + /** + * Calls GetServingConfig. + * @param request GetServingConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public getServingConfig(request: google.cloud.retail.v2.IGetServingConfigRequest, callback: google.cloud.retail.v2.ServingConfigService.GetServingConfigCallback): void; - /** Represents a PersonalizationSpec. */ - class PersonalizationSpec implements IPersonalizationSpec { + /** + * Calls GetServingConfig. + * @param request GetServingConfigRequest message or plain object + * @returns Promise + */ + public getServingConfig(request: google.cloud.retail.v2.IGetServingConfigRequest): Promise; - /** - * Constructs a new PersonalizationSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec); + /** + * Calls ListServingConfigs. + * @param request ListServingConfigsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListServingConfigsResponse + */ + public listServingConfigs(request: google.cloud.retail.v2.IListServingConfigsRequest, callback: google.cloud.retail.v2.ServingConfigService.ListServingConfigsCallback): void; - /** PersonalizationSpec mode. */ - public mode: (google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode); + /** + * Calls ListServingConfigs. + * @param request ListServingConfigsRequest message or plain object + * @returns Promise + */ + public listServingConfigs(request: google.cloud.retail.v2.IListServingConfigsRequest): Promise; - /** - * Creates a new PersonalizationSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns PersonalizationSpec instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + /** + * Calls AddControl. + * @param request AddControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public addControl(request: google.cloud.retail.v2.IAddControlRequest, callback: google.cloud.retail.v2.ServingConfigService.AddControlCallback): void; - /** - * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. - * @param message PersonalizationSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Calls AddControl. + * @param request AddControlRequest message or plain object + * @returns Promise + */ + public addControl(request: google.cloud.retail.v2.IAddControlRequest): Promise; - /** - * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. - * @param message PersonalizationSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.IPersonalizationSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Calls RemoveControl. + * @param request RemoveControlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServingConfig + */ + public removeControl(request: google.cloud.retail.v2.IRemoveControlRequest, callback: google.cloud.retail.v2.ServingConfigService.RemoveControlCallback): void; - /** - * Decodes a PersonalizationSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PersonalizationSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + /** + * Calls RemoveControl. + * @param request RemoveControlRequest message or plain object + * @returns Promise + */ + public removeControl(request: google.cloud.retail.v2.IRemoveControlRequest): Promise; + } - /** - * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PersonalizationSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + namespace ServingConfigService { - /** - * Verifies a PersonalizationSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|createServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type CreateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.ServingConfig) => void; - /** - * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PersonalizationSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.PersonalizationSpec; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|deleteServingConfig}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteServingConfigCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - /** - * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. - * @param message PersonalizationSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.PersonalizationSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|updateServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type UpdateServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.ServingConfig) => void; - /** - * Converts this PersonalizationSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|getServingConfig}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type GetServingConfigCallback = (error: (Error|null), response?: google.cloud.retail.v2.ServingConfig) => void; - /** - * Gets the default type url for PersonalizationSpec - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|listServingConfigs}. + * @param error Error, if any + * @param [response] ListServingConfigsResponse + */ + type ListServingConfigsCallback = (error: (Error|null), response?: google.cloud.retail.v2.ListServingConfigsResponse) => void; - namespace PersonalizationSpec { + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|addControl}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type AddControlCallback = (error: (Error|null), response?: google.cloud.retail.v2.ServingConfig) => void; - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - AUTO = 1, - DISABLED = 2 - } - } + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|removeControl}. + * @param error Error, if any + * @param [response] ServingConfig + */ + type RemoveControlCallback = (error: (Error|null), response?: google.cloud.retail.v2.ServingConfig) => void; + } - /** Properties of a SpellCorrectionSpec. */ - interface ISpellCorrectionSpec { + /** Properties of a CreateServingConfigRequest. */ + interface ICreateServingConfigRequest { - /** SpellCorrectionSpec mode */ - mode?: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null); - } + /** CreateServingConfigRequest parent */ + parent?: (string|null); - /** Represents a SpellCorrectionSpec. */ - class SpellCorrectionSpec implements ISpellCorrectionSpec { + /** CreateServingConfigRequest servingConfig */ + servingConfig?: (google.cloud.retail.v2.IServingConfig|null); - /** - * Constructs a new SpellCorrectionSpec. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec); + /** CreateServingConfigRequest servingConfigId */ + servingConfigId?: (string|null); + } - /** SpellCorrectionSpec mode. */ - public mode: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode); + /** Represents a CreateServingConfigRequest. */ + class CreateServingConfigRequest implements ICreateServingConfigRequest { - /** - * Creates a new SpellCorrectionSpec instance using the specified properties. - * @param [properties] Properties to set - * @returns SpellCorrectionSpec instance - */ - public static create(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + /** + * Constructs a new CreateServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.ICreateServingConfigRequest); - /** - * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. - * @param message SpellCorrectionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** CreateServingConfigRequest parent. */ + public parent: string; - /** - * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. - * @param message SpellCorrectionSpec message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + /** CreateServingConfigRequest servingConfig. */ + public servingConfig?: (google.cloud.retail.v2.IServingConfig|null); - /** - * Decodes a SpellCorrectionSpec message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SpellCorrectionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + /** CreateServingConfigRequest servingConfigId. */ + public servingConfigId: string; - /** - * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SpellCorrectionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + /** + * Creates a new CreateServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2.ICreateServingConfigRequest): google.cloud.retail.v2.CreateServingConfigRequest; - /** - * Verifies a SpellCorrectionSpec message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Encodes the specified CreateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateServingConfigRequest.verify|verify} messages. + * @param message CreateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.ICreateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SpellCorrectionSpec - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + /** + * Encodes the specified CreateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateServingConfigRequest.verify|verify} messages. + * @param message CreateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.ICreateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. - * @param message SpellCorrectionSpec - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.CreateServingConfigRequest; - /** - * Converts this SpellCorrectionSpec to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.CreateServingConfigRequest; - /** - * Gets the default type url for SpellCorrectionSpec - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Verifies a CreateServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - namespace SpellCorrectionSpec { + /** + * Creates a CreateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.CreateServingConfigRequest; - /** Mode enum. */ - enum Mode { - MODE_UNSPECIFIED = 0, - SUGGESTION_ONLY = 1, - AUTO = 2 - } - } + /** + * Creates a plain object from a CreateServingConfigRequest message. Also converts values to other types if specified. + * @param message CreateServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.CreateServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchMode enum. */ - enum SearchMode { - SEARCH_MODE_UNSPECIFIED = 0, - PRODUCT_SEARCH_ONLY = 1, - FACETED_SEARCH_ONLY = 2 - } + /** + * Converts this CreateServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a SearchResponse. */ - interface ISearchResponse { + /** Properties of an UpdateServingConfigRequest. */ + interface IUpdateServingConfigRequest { - /** SearchResponse results */ - results?: (google.cloud.retail.v2.SearchResponse.ISearchResult[]|null); + /** UpdateServingConfigRequest servingConfig */ + servingConfig?: (google.cloud.retail.v2.IServingConfig|null); - /** SearchResponse facets */ - facets?: (google.cloud.retail.v2.SearchResponse.IFacet[]|null); + /** UpdateServingConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } - /** SearchResponse totalSize */ - totalSize?: (number|null); + /** Represents an UpdateServingConfigRequest. */ + class UpdateServingConfigRequest implements IUpdateServingConfigRequest { - /** SearchResponse correctedQuery */ - correctedQuery?: (string|null); + /** + * Constructs a new UpdateServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IUpdateServingConfigRequest); - /** SearchResponse attributionToken */ - attributionToken?: (string|null); + /** UpdateServingConfigRequest servingConfig. */ + public servingConfig?: (google.cloud.retail.v2.IServingConfig|null); - /** SearchResponse nextPageToken */ - nextPageToken?: (string|null); + /** UpdateServingConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); - /** SearchResponse queryExpansionInfo */ - queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + /** + * Creates a new UpdateServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IUpdateServingConfigRequest): google.cloud.retail.v2.UpdateServingConfigRequest; - /** SearchResponse redirectUri */ - redirectUri?: (string|null); + /** + * Encodes the specified UpdateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateServingConfigRequest.verify|verify} messages. + * @param message UpdateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IUpdateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchResponse appliedControls */ - appliedControls?: (string[]|null); + /** + * Encodes the specified UpdateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateServingConfigRequest.verify|verify} messages. + * @param message UpdateServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IUpdateServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** SearchResponse invalidConditionBoostSpecs */ - invalidConditionBoostSpecs?: (google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]|null); - } + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.UpdateServingConfigRequest; - /** Represents a SearchResponse. */ - class SearchResponse implements ISearchResponse { + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.UpdateServingConfigRequest; + + /** + * Verifies an UpdateServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.UpdateServingConfigRequest; /** - * Constructs a new SearchResponse. - * @param [properties] Properties to set + * Creates a plain object from an UpdateServingConfigRequest message. Also converts values to other types if specified. + * @param message UpdateServingConfigRequest + * @param [options] Conversion options + * @returns Plain object */ - constructor(properties?: google.cloud.retail.v2.ISearchResponse); - - /** SearchResponse results. */ - public results: google.cloud.retail.v2.SearchResponse.ISearchResult[]; - - /** SearchResponse facets. */ - public facets: google.cloud.retail.v2.SearchResponse.IFacet[]; - - /** SearchResponse totalSize. */ - public totalSize: number; + public static toObject(message: google.cloud.retail.v2.UpdateServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResponse correctedQuery. */ - public correctedQuery: string; + /** + * Converts this UpdateServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** SearchResponse attributionToken. */ - public attributionToken: string; + /** + * Gets the default type url for UpdateServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** SearchResponse nextPageToken. */ - public nextPageToken: string; + /** Properties of a DeleteServingConfigRequest. */ + interface IDeleteServingConfigRequest { - /** SearchResponse queryExpansionInfo. */ - public queryExpansionInfo?: (google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null); + /** DeleteServingConfigRequest name */ + name?: (string|null); + } - /** SearchResponse redirectUri. */ - public redirectUri: string; + /** Represents a DeleteServingConfigRequest. */ + class DeleteServingConfigRequest implements IDeleteServingConfigRequest { - /** SearchResponse appliedControls. */ - public appliedControls: string[]; + /** + * Constructs a new DeleteServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IDeleteServingConfigRequest); - /** SearchResponse invalidConditionBoostSpecs. */ - public invalidConditionBoostSpecs: google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec[]; + /** DeleteServingConfigRequest name. */ + public name: string; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new DeleteServingConfigRequest instance using the specified properties. * @param [properties] Properties to set - * @returns SearchResponse instance + * @returns DeleteServingConfigRequest instance */ - public static create(properties?: google.cloud.retail.v2.ISearchResponse): google.cloud.retail.v2.SearchResponse; + public static create(properties?: google.cloud.retail.v2.IDeleteServingConfigRequest): google.cloud.retail.v2.DeleteServingConfigRequest; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified DeleteServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteServingConfigRequest.verify|verify} messages. + * @param message DeleteServingConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.retail.v2.IDeleteServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. - * @param message SearchResponse message or plain object to encode + * Encodes the specified DeleteServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteServingConfigRequest.verify|verify} messages. + * @param message DeleteServingConfigRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.retail.v2.ISearchResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.retail.v2.IDeleteServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SearchResponse + * @returns DeleteServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.DeleteServingConfigRequest; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SearchResponse + * @returns DeleteServingConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.DeleteServingConfigRequest; /** - * Verifies a SearchResponse message. + * Verifies a DeleteServingConfigRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteServingConfigRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SearchResponse + * @returns DeleteServingConfigRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.DeleteServingConfigRequest; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. - * @param message SearchResponse + * Creates a plain object from a DeleteServingConfigRequest message. Also converts values to other types if specified. + * @param message DeleteServingConfigRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.retail.v2.SearchResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.retail.v2.DeleteServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SearchResponse to JSON. + * Converts this DeleteServingConfigRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for SearchResponse + * Gets the default type url for DeleteServingConfigRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace SearchResponse { + /** Properties of a GetServingConfigRequest. */ + interface IGetServingConfigRequest { - /** Properties of a SearchResult. */ - interface ISearchResult { + /** GetServingConfigRequest name */ + name?: (string|null); + } - /** SearchResult id */ - id?: (string|null); + /** Represents a GetServingConfigRequest. */ + class GetServingConfigRequest implements IGetServingConfigRequest { - /** SearchResult product */ - product?: (google.cloud.retail.v2.IProduct|null); + /** + * Constructs a new GetServingConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IGetServingConfigRequest); - /** SearchResult matchingVariantCount */ - matchingVariantCount?: (number|null); + /** GetServingConfigRequest name. */ + public name: string; - /** SearchResult matchingVariantFields */ - matchingVariantFields?: ({ [k: string]: google.protobuf.IFieldMask }|null); + /** + * Creates a new GetServingConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetServingConfigRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IGetServingConfigRequest): google.cloud.retail.v2.GetServingConfigRequest; - /** SearchResult variantRollupValues */ - variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); - } + /** + * Encodes the specified GetServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.GetServingConfigRequest.verify|verify} messages. + * @param message GetServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IGetServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Represents a SearchResult. */ - class SearchResult implements ISearchResult { + /** + * Encodes the specified GetServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetServingConfigRequest.verify|verify} messages. + * @param message GetServingConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IGetServingConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Constructs a new SearchResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult); + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.GetServingConfigRequest; - /** SearchResult id. */ - public id: string; + /** + * Decodes a GetServingConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.GetServingConfigRequest; - /** SearchResult product. */ - public product?: (google.cloud.retail.v2.IProduct|null); + /** + * Verifies a GetServingConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** SearchResult matchingVariantCount. */ - public matchingVariantCount: number; + /** + * Creates a GetServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetServingConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.GetServingConfigRequest; - /** SearchResult matchingVariantFields. */ - public matchingVariantFields: { [k: string]: google.protobuf.IFieldMask }; + /** + * Creates a plain object from a GetServingConfigRequest message. Also converts values to other types if specified. + * @param message GetServingConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.GetServingConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** SearchResult variantRollupValues. */ - public variantRollupValues: { [k: string]: google.protobuf.IValue }; + /** + * Converts this GetServingConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Creates a new SearchResult instance using the specified properties. - * @param [properties] Properties to set - * @returns SearchResult instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.ISearchResult): google.cloud.retail.v2.SearchResponse.SearchResult; + /** + * Gets the default type url for GetServingConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of a ListServingConfigsRequest. */ + interface IListServingConfigsRequest { - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. - * @param message SearchResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.ISearchResult, writer?: $protobuf.Writer): $protobuf.Writer; + /** ListServingConfigsRequest parent */ + parent?: (string|null); - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.SearchResult; + /** ListServingConfigsRequest pageSize */ + pageSize?: (number|null); - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.SearchResult; + /** ListServingConfigsRequest pageToken */ + pageToken?: (string|null); + } - /** - * Verifies a SearchResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Represents a ListServingConfigsRequest. */ + class ListServingConfigsRequest implements IListServingConfigsRequest { - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SearchResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.SearchResult; + /** + * Constructs a new ListServingConfigsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IListServingConfigsRequest); - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @param message SearchResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.SearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ListServingConfigsRequest parent. */ + public parent: string; - /** - * Converts this SearchResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** ListServingConfigsRequest pageSize. */ + public pageSize: number; - /** - * Gets the default type url for SearchResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** ListServingConfigsRequest pageToken. */ + public pageToken: string; - /** Properties of a Facet. */ - interface IFacet { + /** + * Creates a new ListServingConfigsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServingConfigsRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IListServingConfigsRequest): google.cloud.retail.v2.ListServingConfigsRequest; - /** Facet key */ - key?: (string|null); + /** + * Encodes the specified ListServingConfigsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsRequest.verify|verify} messages. + * @param message ListServingConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IListServingConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Facet values */ - values?: (google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]|null); + /** + * Encodes the specified ListServingConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsRequest.verify|verify} messages. + * @param message ListServingConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IListServingConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Facet dynamicFacet */ - dynamicFacet?: (boolean|null); - } + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListServingConfigsRequest; - /** Represents a Facet. */ - class Facet implements IFacet { + /** + * Decodes a ListServingConfigsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServingConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListServingConfigsRequest; - /** - * Constructs a new Facet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.IFacet); + /** + * Verifies a ListServingConfigsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** Facet key. */ - public key: string; + /** + * Creates a ListServingConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServingConfigsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListServingConfigsRequest; - /** Facet values. */ - public values: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue[]; + /** + * Creates a plain object from a ListServingConfigsRequest message. Also converts values to other types if specified. + * @param message ListServingConfigsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ListServingConfigsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** Facet dynamicFacet. */ - public dynamicFacet: boolean; + /** + * Converts this ListServingConfigsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Creates a new Facet instance using the specified properties. - * @param [properties] Properties to set - * @returns Facet instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.IFacet): google.cloud.retail.v2.SearchResponse.Facet; + /** + * Gets the default type url for ListServingConfigsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** Properties of a ListServingConfigsResponse. */ + interface IListServingConfigsResponse { - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @param message Facet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IFacet, writer?: $protobuf.Writer): $protobuf.Writer; + /** ListServingConfigsResponse servingConfigs */ + servingConfigs?: (google.cloud.retail.v2.IServingConfig[]|null); - /** - * Decodes a Facet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet; + /** ListServingConfigsResponse nextPageToken */ + nextPageToken?: (string|null); + } - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet; + /** Represents a ListServingConfigsResponse. */ + class ListServingConfigsResponse implements IListServingConfigsResponse { - /** - * Verifies a Facet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Constructs a new ListServingConfigsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IListServingConfigsResponse); - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Facet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet; + /** ListServingConfigsResponse servingConfigs. */ + public servingConfigs: google.cloud.retail.v2.IServingConfig[]; - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @param message Facet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** ListServingConfigsResponse nextPageToken. */ + public nextPageToken: string; - /** - * Converts this Facet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Creates a new ListServingConfigsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServingConfigsResponse instance + */ + public static create(properties?: google.cloud.retail.v2.IListServingConfigsResponse): google.cloud.retail.v2.ListServingConfigsResponse; - /** - * Gets the default type url for Facet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Encodes the specified ListServingConfigsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsResponse.verify|verify} messages. + * @param message ListServingConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IListServingConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - namespace Facet { + /** + * Encodes the specified ListServingConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsResponse.verify|verify} messages. + * @param message ListServingConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IListServingConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** Properties of a FacetValue. */ - interface IFacetValue { + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.ListServingConfigsResponse; - /** FacetValue value */ - value?: (string|null); + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.ListServingConfigsResponse; - /** FacetValue interval */ - interval?: (google.cloud.retail.v2.IInterval|null); + /** + * Verifies a ListServingConfigsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** FacetValue count */ - count?: (number|Long|string|null); + /** + * Creates a ListServingConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServingConfigsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.ListServingConfigsResponse; - /** FacetValue minValue */ - minValue?: (number|null); + /** + * Creates a plain object from a ListServingConfigsResponse message. Also converts values to other types if specified. + * @param message ListServingConfigsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.ListServingConfigsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** FacetValue maxValue */ - maxValue?: (number|null); - } + /** + * Converts this ListServingConfigsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** Represents a FacetValue. */ - class FacetValue implements IFacetValue { + /** + * Gets the default type url for ListServingConfigsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Constructs a new FacetValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue); + /** Properties of an AddControlRequest. */ + interface IAddControlRequest { - /** FacetValue value. */ - public value?: (string|null); + /** AddControlRequest servingConfig */ + servingConfig?: (string|null); - /** FacetValue interval. */ - public interval?: (google.cloud.retail.v2.IInterval|null); + /** AddControlRequest controlId */ + controlId?: (string|null); + } - /** FacetValue count. */ - public count: (number|Long|string); + /** Represents an AddControlRequest. */ + class AddControlRequest implements IAddControlRequest { - /** FacetValue minValue. */ - public minValue: number; + /** + * Constructs a new AddControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IAddControlRequest); - /** FacetValue maxValue. */ - public maxValue: number; + /** AddControlRequest servingConfig. */ + public servingConfig: string; - /** FacetValue facetValue. */ - public facetValue?: ("value"|"interval"); + /** AddControlRequest controlId. */ + public controlId: string; - /** - * Creates a new FacetValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FacetValue instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Creates a new AddControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AddControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IAddControlRequest): google.cloud.retail.v2.AddControlRequest; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddControlRequest message. Does not implicitly {@link google.cloud.retail.v2.AddControlRequest.verify|verify} messages. + * @param message AddControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IAddControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @param message FacetValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.Facet.IFacetValue, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified AddControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddControlRequest.verify|verify} messages. + * @param message AddControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IAddControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Decodes an AddControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.AddControlRequest; - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Decodes an AddControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.AddControlRequest; - /** - * Verifies a FacetValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies an AddControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FacetValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.Facet.FacetValue; + /** + * Creates an AddControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AddControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.AddControlRequest; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @param message FacetValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.Facet.FacetValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from an AddControlRequest message. Also converts values to other types if specified. + * @param message AddControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.AddControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this FacetValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Converts this AddControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Gets the default type url for FacetValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } + /** + * Gets the default type url for AddControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** Properties of a QueryExpansionInfo. */ - interface IQueryExpansionInfo { + /** Properties of a RemoveControlRequest. */ + interface IRemoveControlRequest { - /** QueryExpansionInfo expandedQuery */ - expandedQuery?: (boolean|null); + /** RemoveControlRequest servingConfig */ + servingConfig?: (string|null); - /** QueryExpansionInfo pinnedResultCount */ - pinnedResultCount?: (number|Long|string|null); - } + /** RemoveControlRequest controlId */ + controlId?: (string|null); + } - /** Represents a QueryExpansionInfo. */ - class QueryExpansionInfo implements IQueryExpansionInfo { + /** Represents a RemoveControlRequest. */ + class RemoveControlRequest implements IRemoveControlRequest { - /** - * Constructs a new QueryExpansionInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo); + /** + * Constructs a new RemoveControlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.IRemoveControlRequest); - /** QueryExpansionInfo expandedQuery. */ - public expandedQuery: boolean; + /** RemoveControlRequest servingConfig. */ + public servingConfig: string; - /** QueryExpansionInfo pinnedResultCount. */ - public pinnedResultCount: (number|Long|string); + /** RemoveControlRequest controlId. */ + public controlId: string; - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryExpansionInfo instance - */ - public static create(properties?: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Creates a new RemoveControlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveControlRequest instance + */ + public static create(properties?: google.cloud.retail.v2.IRemoveControlRequest): google.cloud.retail.v2.RemoveControlRequest; - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified RemoveControlRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveControlRequest.verify|verify} messages. + * @param message RemoveControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.IRemoveControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @param message QueryExpansionInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified RemoveControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveControlRequest.verify|verify} messages. + * @param message RemoveControlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.IRemoveControlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.RemoveControlRequest; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.RemoveControlRequest; - /** - * Verifies a QueryExpansionInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Verifies a RemoveControlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryExpansionInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchResponse.QueryExpansionInfo; + /** + * Creates a RemoveControlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveControlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.RemoveControlRequest; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @param message QueryExpansionInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.retail.v2.SearchResponse.QueryExpansionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a RemoveControlRequest message. Also converts values to other types if specified. + * @param message RemoveControlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.RemoveControlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this QueryExpansionInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Converts this RemoveControlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Gets the default type url for QueryExpansionInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Gets the default type url for RemoveControlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a UserEventService */ @@ -50309,91 +54986,206 @@ export namespace google { } } - /** Properties of an Empty. */ - interface IEmpty { + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); } - /** Represents an Empty. */ - class Empty implements IEmpty { + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { /** - * Constructs a new Empty. + * Constructs a new Timestamp. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IEmpty); + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; /** - * Creates a new Empty instance using the specified properties. + * Creates a new Timestamp instance using the specified properties. * @param [properties] Properties to set - * @returns Empty instance + * @returns Timestamp instance */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Empty message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Empty + * @returns Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; /** - * Decodes an Empty message from the specified reader or buffer, length delimited. + * Decodes a Timestamp message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Empty + * @returns Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; /** - * Verifies an Empty message. + * Verifies a Timestamp message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Empty + * @returns Timestamp */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @param message Empty + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Empty to JSON. + * Converts this Timestamp to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Empty + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -50497,212 +55289,6 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a Timestamp. */ - interface ITimestamp { - - /** Timestamp seconds */ - seconds?: (number|Long|string|null); - - /** Timestamp nanos */ - nanos?: (number|null); - } - - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { - - /** - * Constructs a new Timestamp. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ITimestamp); - - /** Timestamp seconds. */ - public seconds: (number|Long|string); - - /** Timestamp nanos. */ - public nanos: number; - - /** - * Creates a new Timestamp instance using the specified properties. - * @param [properties] Properties to set - * @returns Timestamp instance - */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; - - /** - * Verifies a Timestamp message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Timestamp - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @param message Timestamp - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Timestamp to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Timestamp - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Duration. */ - interface IDuration { - - /** Duration seconds */ - seconds?: (number|Long|string|null); - - /** Duration nanos */ - nanos?: (number|null); - } - - /** Represents a Duration. */ - class Duration implements IDuration { - - /** - * Constructs a new Duration. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDuration); - - /** Duration seconds. */ - public seconds: (number|Long|string); - - /** Duration nanos. */ - public nanos: number; - - /** - * Creates a new Duration instance using the specified properties. - * @param [properties] Properties to set - * @returns Duration instance - */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; - - /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Duration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; - - /** - * Decodes a Duration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; - - /** - * Verifies a Duration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Duration - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; - - /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @param message Duration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Duration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Duration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - /** Properties of a DoubleValue. */ interface IDoubleValue { @@ -51679,6 +56265,97 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a Struct. */ interface IStruct { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index dc13da7fd3d..855c45cbae7 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -293,26 +293,29 @@ return ProductLevelConfig; })(); - v2.Catalog = (function() { + v2.CatalogAttribute = (function() { /** - * Properties of a Catalog. + * Properties of a CatalogAttribute. * @memberof google.cloud.retail.v2 - * @interface ICatalog - * @property {string|null} [name] Catalog name - * @property {string|null} [displayName] Catalog displayName - * @property {google.cloud.retail.v2.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig + * @interface ICatalogAttribute + * @property {string|null} [key] CatalogAttribute key + * @property {boolean|null} [inUse] CatalogAttribute inUse + * @property {google.cloud.retail.v2.CatalogAttribute.AttributeType|null} [type] CatalogAttribute type + * @property {google.cloud.retail.v2.CatalogAttribute.IndexableOption|null} [indexableOption] CatalogAttribute indexableOption + * @property {google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption|null} [dynamicFacetableOption] CatalogAttribute dynamicFacetableOption + * @property {google.cloud.retail.v2.CatalogAttribute.SearchableOption|null} [searchableOption] CatalogAttribute searchableOption */ /** - * Constructs a new Catalog. + * Constructs a new CatalogAttribute. * @memberof google.cloud.retail.v2 - * @classdesc Represents a Catalog. - * @implements ICatalog + * @classdesc Represents a CatalogAttribute. + * @implements ICatalogAttribute * @constructor - * @param {google.cloud.retail.v2.ICatalog=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICatalogAttribute=} [properties] Properties to set */ - function Catalog(properties) { + function CatalogAttribute(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -320,103 +323,145 @@ } /** - * Catalog name. - * @member {string} name - * @memberof google.cloud.retail.v2.Catalog + * CatalogAttribute key. + * @member {string} key + * @memberof google.cloud.retail.v2.CatalogAttribute * @instance */ - Catalog.prototype.name = ""; + CatalogAttribute.prototype.key = ""; /** - * Catalog displayName. - * @member {string} displayName - * @memberof google.cloud.retail.v2.Catalog + * CatalogAttribute inUse. + * @member {boolean} inUse + * @memberof google.cloud.retail.v2.CatalogAttribute * @instance */ - Catalog.prototype.displayName = ""; + CatalogAttribute.prototype.inUse = false; /** - * Catalog productLevelConfig. - * @member {google.cloud.retail.v2.IProductLevelConfig|null|undefined} productLevelConfig - * @memberof google.cloud.retail.v2.Catalog + * CatalogAttribute type. + * @member {google.cloud.retail.v2.CatalogAttribute.AttributeType} type + * @memberof google.cloud.retail.v2.CatalogAttribute * @instance */ - Catalog.prototype.productLevelConfig = null; + CatalogAttribute.prototype.type = 0; /** - * Creates a new Catalog instance using the specified properties. + * CatalogAttribute indexableOption. + * @member {google.cloud.retail.v2.CatalogAttribute.IndexableOption} indexableOption + * @memberof google.cloud.retail.v2.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.indexableOption = 0; + + /** + * CatalogAttribute dynamicFacetableOption. + * @member {google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption} dynamicFacetableOption + * @memberof google.cloud.retail.v2.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.dynamicFacetableOption = 0; + + /** + * CatalogAttribute searchableOption. + * @member {google.cloud.retail.v2.CatalogAttribute.SearchableOption} searchableOption + * @memberof google.cloud.retail.v2.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.searchableOption = 0; + + /** + * Creates a new CatalogAttribute instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static - * @param {google.cloud.retail.v2.ICatalog=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Catalog} Catalog instance + * @param {google.cloud.retail.v2.ICatalogAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CatalogAttribute} CatalogAttribute instance */ - Catalog.create = function create(properties) { - return new Catalog(properties); + CatalogAttribute.create = function create(properties) { + return new CatalogAttribute(properties); }; /** - * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * Encodes the specified CatalogAttribute message. Does not implicitly {@link google.cloud.retail.v2.CatalogAttribute.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static - * @param {google.cloud.retail.v2.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2.ICatalogAttribute} message CatalogAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encode = function encode(message, writer) { + CatalogAttribute.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) - $root.google.cloud.retail.v2.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.indexableOption != null && Object.hasOwnProperty.call(message, "indexableOption")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.indexableOption); + if (message.dynamicFacetableOption != null && Object.hasOwnProperty.call(message, "dynamicFacetableOption")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.dynamicFacetableOption); + if (message.searchableOption != null && Object.hasOwnProperty.call(message, "searchableOption")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.searchableOption); + if (message.inUse != null && Object.hasOwnProperty.call(message, "inUse")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.inUse); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.type); return writer; }; /** - * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. + * Encodes the specified CatalogAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CatalogAttribute.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static - * @param {google.cloud.retail.v2.ICatalog} message Catalog message or plain object to encode + * @param {google.cloud.retail.v2.ICatalogAttribute} message CatalogAttribute message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Catalog.encodeDelimited = function encodeDelimited(message, writer) { + CatalogAttribute.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Catalog message from the specified reader or buffer. + * Decodes a CatalogAttribute message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Catalog} Catalog + * @returns {google.cloud.retail.v2.CatalogAttribute} CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decode = function decode(reader, length) { + CatalogAttribute.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Catalog(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CatalogAttribute(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.key = reader.string(); break; } - case 2: { - message.displayName = reader.string(); + case 9: { + message.inUse = reader.bool(); break; } - case 4: { - message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.decode(reader, reader.uint32()); + case 10: { + message.type = reader.int32(); + break; + } + case 5: { + message.indexableOption = reader.int32(); + break; + } + case 6: { + message.dynamicFacetableOption = reader.int32(); + break; + } + case 7: { + message.searchableOption = reader.int32(); break; } default: @@ -428,313 +473,302 @@ }; /** - * Decodes a Catalog message from the specified reader or buffer, length delimited. + * Decodes a CatalogAttribute message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Catalog} Catalog + * @returns {google.cloud.retail.v2.CatalogAttribute} CatalogAttribute * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Catalog.decodeDelimited = function decodeDelimited(reader) { + CatalogAttribute.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Catalog message. + * Verifies a CatalogAttribute message. * @function verify - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Catalog.verify = function verify(message) { + CatalogAttribute.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { - var error = $root.google.cloud.retail.v2.ProductLevelConfig.verify(message.productLevelConfig); - if (error) - return "productLevelConfig." + error; - } + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.inUse != null && message.hasOwnProperty("inUse")) + if (typeof message.inUse !== "boolean") + return "inUse: boolean expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) + switch (message.indexableOption) { + default: + return "indexableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) + switch (message.dynamicFacetableOption) { + default: + return "dynamicFacetableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) + switch (message.searchableOption) { + default: + return "searchableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates a Catalog message from a plain object. Also converts values to their respective internal types. + * Creates a CatalogAttribute message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Catalog} Catalog + * @returns {google.cloud.retail.v2.CatalogAttribute} CatalogAttribute */ - Catalog.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Catalog) + CatalogAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CatalogAttribute) return object; - var message = new $root.google.cloud.retail.v2.Catalog(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.productLevelConfig != null) { - if (typeof object.productLevelConfig !== "object") - throw TypeError(".google.cloud.retail.v2.Catalog.productLevelConfig: object expected"); - message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.fromObject(object.productLevelConfig); + var message = new $root.google.cloud.retail.v2.CatalogAttribute(); + if (object.key != null) + message.key = String(object.key); + if (object.inUse != null) + message.inUse = Boolean(object.inUse); + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "TEXTUAL": + case 1: + message.type = 1; + break; + case "NUMERICAL": + case 2: + message.type = 2; + break; + } + switch (object.indexableOption) { + case "INDEXABLE_OPTION_UNSPECIFIED": + case 0: + message.indexableOption = 0; + break; + case "INDEXABLE_ENABLED": + case 1: + message.indexableOption = 1; + break; + case "INDEXABLE_DISABLED": + case 2: + message.indexableOption = 2; + break; + } + switch (object.dynamicFacetableOption) { + case "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": + case 0: + message.dynamicFacetableOption = 0; + break; + case "DYNAMIC_FACETABLE_ENABLED": + case 1: + message.dynamicFacetableOption = 1; + break; + case "DYNAMIC_FACETABLE_DISABLED": + case 2: + message.dynamicFacetableOption = 2; + break; + } + switch (object.searchableOption) { + case "SEARCHABLE_OPTION_UNSPECIFIED": + case 0: + message.searchableOption = 0; + break; + case "SEARCHABLE_ENABLED": + case 1: + message.searchableOption = 1; + break; + case "SEARCHABLE_DISABLED": + case 2: + message.searchableOption = 2; + break; } return message; }; /** - * Creates a plain object from a Catalog message. Also converts values to other types if specified. + * Creates a plain object from a CatalogAttribute message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static - * @param {google.cloud.retail.v2.Catalog} message Catalog + * @param {google.cloud.retail.v2.CatalogAttribute} message CatalogAttribute * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Catalog.toObject = function toObject(message, options) { + CatalogAttribute.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.productLevelConfig = null; + object.key = ""; + object.indexableOption = options.enums === String ? "INDEXABLE_OPTION_UNSPECIFIED" : 0; + object.dynamicFacetableOption = options.enums === String ? "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" : 0; + object.searchableOption = options.enums === String ? "SEARCHABLE_OPTION_UNSPECIFIED" : 0; + object.inUse = false; + object.type = options.enums === String ? "UNKNOWN" : 0; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) - object.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.toObject(message.productLevelConfig, options); + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) + object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; + if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) + object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; + if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) + object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + if (message.inUse != null && message.hasOwnProperty("inUse")) + object.inUse = message.inUse; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.AttributeType[message.type] : message.type; return object; }; /** - * Converts this Catalog to JSON. + * Converts this CatalogAttribute to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @instance * @returns {Object.} JSON object */ - Catalog.prototype.toJSON = function toJSON() { + CatalogAttribute.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Catalog + * Gets the default type url for CatalogAttribute * @function getTypeUrl - * @memberof google.cloud.retail.v2.Catalog + * @memberof google.cloud.retail.v2.CatalogAttribute * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Catalog.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CatalogAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.Catalog"; - }; - - return Catalog; - })(); - - v2.CatalogService = (function() { - - /** - * Constructs a new CatalogService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CatalogService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function CatalogService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; - - /** - * Creates new CatalogService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.CatalogService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. - */ - CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + return typeUrlPrefix + "/google.cloud.retail.v2.CatalogAttribute"; }; /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|listCatalogs}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef ListCatalogsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse - */ - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { - return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); - }, "name", { value: "ListCatalogs" }); - - /** - * Calls ListCatalogs. - * @function listCatalogs - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCatalog}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef UpdateCatalogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Catalog} [response] Catalog - */ - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { - return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); - }, "name", { value: "UpdateCatalog" }); - - /** - * Calls UpdateCatalog. - * @function updateCatalog - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|setDefaultBranch}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef SetDefaultBranchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { - return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "SetDefaultBranch" }); - - /** - * Calls SetDefaultBranch. - * @function setDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * AttributeType enum. + * @name google.cloud.retail.v2.CatalogAttribute.AttributeType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} TEXTUAL=1 TEXTUAL value + * @property {number} NUMERICAL=2 NUMERICAL value */ + CatalogAttribute.AttributeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "TEXTUAL"] = 1; + values[valuesById[2] = "NUMERICAL"] = 2; + return values; + })(); /** - * Callback as used by {@link google.cloud.retail.v2.CatalogService|getDefaultBranch}. - * @memberof google.cloud.retail.v2.CatalogService - * @typedef GetDefaultBranchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + * IndexableOption enum. + * @name google.cloud.retail.v2.CatalogAttribute.IndexableOption + * @enum {number} + * @property {number} INDEXABLE_OPTION_UNSPECIFIED=0 INDEXABLE_OPTION_UNSPECIFIED value + * @property {number} INDEXABLE_ENABLED=1 INDEXABLE_ENABLED value + * @property {number} INDEXABLE_DISABLED=2 INDEXABLE_DISABLED value */ + CatalogAttribute.IndexableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INDEXABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "INDEXABLE_ENABLED"] = 1; + values[valuesById[2] = "INDEXABLE_DISABLED"] = 2; + return values; + })(); /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @param {google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse - * @returns {undefined} - * @variation 1 + * DynamicFacetableOption enum. + * @name google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption + * @enum {number} + * @property {number} DYNAMIC_FACETABLE_OPTION_UNSPECIFIED=0 DYNAMIC_FACETABLE_OPTION_UNSPECIFIED value + * @property {number} DYNAMIC_FACETABLE_ENABLED=1 DYNAMIC_FACETABLE_ENABLED value + * @property {number} DYNAMIC_FACETABLE_DISABLED=2 DYNAMIC_FACETABLE_DISABLED value */ - Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { - return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2.GetDefaultBranchRequest, $root.google.cloud.retail.v2.GetDefaultBranchResponse, request, callback); - }, "name", { value: "GetDefaultBranch" }); + CatalogAttribute.DynamicFacetableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DYNAMIC_FACETABLE_ENABLED"] = 1; + values[valuesById[2] = "DYNAMIC_FACETABLE_DISABLED"] = 2; + return values; + })(); /** - * Calls GetDefaultBranch. - * @function getDefaultBranch - * @memberof google.cloud.retail.v2.CatalogService - * @instance - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * SearchableOption enum. + * @name google.cloud.retail.v2.CatalogAttribute.SearchableOption + * @enum {number} + * @property {number} SEARCHABLE_OPTION_UNSPECIFIED=0 SEARCHABLE_OPTION_UNSPECIFIED value + * @property {number} SEARCHABLE_ENABLED=1 SEARCHABLE_ENABLED value + * @property {number} SEARCHABLE_DISABLED=2 SEARCHABLE_DISABLED value */ + CatalogAttribute.SearchableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCHABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "SEARCHABLE_ENABLED"] = 1; + values[valuesById[2] = "SEARCHABLE_DISABLED"] = 2; + return values; + })(); - return CatalogService; + return CatalogAttribute; })(); - v2.ListCatalogsRequest = (function() { + v2.AttributesConfig = (function() { /** - * Properties of a ListCatalogsRequest. + * Properties of an AttributesConfig. * @memberof google.cloud.retail.v2 - * @interface IListCatalogsRequest - * @property {string|null} [parent] ListCatalogsRequest parent - * @property {number|null} [pageSize] ListCatalogsRequest pageSize - * @property {string|null} [pageToken] ListCatalogsRequest pageToken + * @interface IAttributesConfig + * @property {string|null} [name] AttributesConfig name + * @property {Object.|null} [catalogAttributes] AttributesConfig catalogAttributes + * @property {google.cloud.retail.v2.AttributeConfigLevel|null} [attributeConfigLevel] AttributesConfig attributeConfigLevel */ /** - * Constructs a new ListCatalogsRequest. + * Constructs a new AttributesConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListCatalogsRequest. - * @implements IListCatalogsRequest + * @classdesc Represents an AttributesConfig. + * @implements IAttributesConfig * @constructor - * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAttributesConfig=} [properties] Properties to set */ - function ListCatalogsRequest(properties) { + function AttributesConfig(properties) { + this.catalogAttributes = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -742,103 +776,125 @@ } /** - * ListCatalogsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * AttributesConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2.AttributesConfig * @instance */ - ListCatalogsRequest.prototype.parent = ""; + AttributesConfig.prototype.name = ""; /** - * ListCatalogsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * AttributesConfig catalogAttributes. + * @member {Object.} catalogAttributes + * @memberof google.cloud.retail.v2.AttributesConfig * @instance */ - ListCatalogsRequest.prototype.pageSize = 0; + AttributesConfig.prototype.catalogAttributes = $util.emptyObject; /** - * ListCatalogsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * AttributesConfig attributeConfigLevel. + * @member {google.cloud.retail.v2.AttributeConfigLevel} attributeConfigLevel + * @memberof google.cloud.retail.v2.AttributesConfig * @instance */ - ListCatalogsRequest.prototype.pageToken = ""; + AttributesConfig.prototype.attributeConfigLevel = 0; /** - * Creates a new ListCatalogsRequest instance using the specified properties. + * Creates a new AttributesConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance + * @param {google.cloud.retail.v2.IAttributesConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AttributesConfig} AttributesConfig instance */ - ListCatalogsRequest.create = function create(properties) { - return new ListCatalogsRequest(properties); + AttributesConfig.create = function create(properties) { + return new AttributesConfig(properties); }; /** - * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified AttributesConfig message. Does not implicitly {@link google.cloud.retail.v2.AttributesConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IAttributesConfig} message AttributesConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encode = function encode(message, writer) { + AttributesConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.catalogAttributes != null && Object.hasOwnProperty.call(message, "catalogAttributes")) + for (var keys = Object.keys(message.catalogAttributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CatalogAttribute.encode(message.catalogAttributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.attributeConfigLevel != null && Object.hasOwnProperty.call(message, "attributeConfigLevel")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.attributeConfigLevel); return writer; }; /** - * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. + * Encodes the specified AttributesConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AttributesConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static - * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IAttributesConfig} message AttributesConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + AttributesConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer. + * Decodes an AttributesConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.AttributesConfig} AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decode = function decode(reader, length) { + AttributesConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AttributesConfig(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.parent = reader.string(); + message.name = reader.string(); break; } case 2: { - message.pageSize = reader.int32(); + if (message.catalogAttributes === $util.emptyObject) + message.catalogAttributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CatalogAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.catalogAttributes[key] = value; break; } case 3: { - message.pageToken = reader.string(); + message.attributeConfigLevel = reader.int32(); break; } default: @@ -850,141 +906,187 @@ }; /** - * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. + * Decodes an AttributesConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.AttributesConfig} AttributesConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { + AttributesConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsRequest message. + * Verifies an AttributesConfig message. * @function verify - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsRequest.verify = function verify(message) { + AttributesConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.catalogAttributes != null && message.hasOwnProperty("catalogAttributes")) { + if (!$util.isObject(message.catalogAttributes)) + return "catalogAttributes: object expected"; + var key = Object.keys(message.catalogAttributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CatalogAttribute.verify(message.catalogAttributes[key[i]]); + if (error) + return "catalogAttributes." + error; + } + } + if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) + switch (message.attributeConfigLevel) { + default: + return "attributeConfigLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AttributesConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest + * @returns {google.cloud.retail.v2.AttributesConfig} AttributesConfig */ - ListCatalogsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) + AttributesConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AttributesConfig) return object; - var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + var message = new $root.google.cloud.retail.v2.AttributesConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.catalogAttributes) { + if (typeof object.catalogAttributes !== "object") + throw TypeError(".google.cloud.retail.v2.AttributesConfig.catalogAttributes: object expected"); + message.catalogAttributes = {}; + for (var keys = Object.keys(object.catalogAttributes), i = 0; i < keys.length; ++i) { + if (typeof object.catalogAttributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.AttributesConfig.catalogAttributes: object expected"); + message.catalogAttributes[keys[i]] = $root.google.cloud.retail.v2.CatalogAttribute.fromObject(object.catalogAttributes[keys[i]]); + } + } + switch (object.attributeConfigLevel) { + case "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": + case 0: + message.attributeConfigLevel = 0; + break; + case "PRODUCT_LEVEL_ATTRIBUTE_CONFIG": + case 1: + message.attributeConfigLevel = 1; + break; + case "CATALOG_LEVEL_ATTRIBUTE_CONFIG": + case 2: + message.attributeConfigLevel = 2; + break; + } return message; }; /** - * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. + * Creates a plain object from an AttributesConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static - * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest + * @param {google.cloud.retail.v2.AttributesConfig} message AttributesConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsRequest.toObject = function toObject(message, options) { + AttributesConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.catalogAttributes = {}; if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; + object.name = ""; + object.attributeConfigLevel = options.enums === String ? "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" : 0; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + var keys2; + if (message.catalogAttributes && (keys2 = Object.keys(message.catalogAttributes)).length) { + object.catalogAttributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.catalogAttributes[keys2[j]] = $root.google.cloud.retail.v2.CatalogAttribute.toObject(message.catalogAttributes[keys2[j]], options); + } + if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) + object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; return object; }; /** - * Converts this ListCatalogsRequest to JSON. + * Converts this AttributesConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @instance * @returns {Object.} JSON object */ - ListCatalogsRequest.prototype.toJSON = function toJSON() { + AttributesConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListCatalogsRequest + * Gets the default type url for AttributesConfig * @function getTypeUrl - * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @memberof google.cloud.retail.v2.AttributesConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListCatalogsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AttributesConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.ListCatalogsRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.AttributesConfig"; }; - return ListCatalogsRequest; + return AttributesConfig; })(); - v2.ListCatalogsResponse = (function() { + v2.CompletionConfig = (function() { /** - * Properties of a ListCatalogsResponse. + * Properties of a CompletionConfig. * @memberof google.cloud.retail.v2 - * @interface IListCatalogsResponse - * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs - * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken + * @interface ICompletionConfig + * @property {string|null} [name] CompletionConfig name + * @property {string|null} [matchingOrder] CompletionConfig matchingOrder + * @property {number|null} [maxSuggestions] CompletionConfig maxSuggestions + * @property {number|null} [minPrefixLength] CompletionConfig minPrefixLength + * @property {boolean|null} [autoLearning] CompletionConfig autoLearning + * @property {google.cloud.retail.v2.ICompletionDataInputConfig|null} [suggestionsInputConfig] CompletionConfig suggestionsInputConfig + * @property {string|null} [lastSuggestionsImportOperation] CompletionConfig lastSuggestionsImportOperation + * @property {google.cloud.retail.v2.ICompletionDataInputConfig|null} [denylistInputConfig] CompletionConfig denylistInputConfig + * @property {string|null} [lastDenylistImportOperation] CompletionConfig lastDenylistImportOperation + * @property {google.cloud.retail.v2.ICompletionDataInputConfig|null} [allowlistInputConfig] CompletionConfig allowlistInputConfig + * @property {string|null} [lastAllowlistImportOperation] CompletionConfig lastAllowlistImportOperation */ /** - * Constructs a new ListCatalogsResponse. + * Constructs a new CompletionConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListCatalogsResponse. - * @implements IListCatalogsResponse + * @classdesc Represents a CompletionConfig. + * @implements ICompletionConfig * @constructor - * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompletionConfig=} [properties] Properties to set */ - function ListCatalogsResponse(properties) { - this.catalogs = []; + function CompletionConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -992,92 +1094,215 @@ } /** - * ListCatalogsResponse catalogs. - * @member {Array.} catalogs - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * CompletionConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2.CompletionConfig * @instance */ - ListCatalogsResponse.prototype.catalogs = $util.emptyArray; + CompletionConfig.prototype.name = ""; /** - * ListCatalogsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * CompletionConfig matchingOrder. + * @member {string} matchingOrder + * @memberof google.cloud.retail.v2.CompletionConfig * @instance */ - ListCatalogsResponse.prototype.nextPageToken = ""; + CompletionConfig.prototype.matchingOrder = ""; /** - * Creates a new ListCatalogsResponse instance using the specified properties. + * CompletionConfig maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.maxSuggestions = 0; + + /** + * CompletionConfig minPrefixLength. + * @member {number} minPrefixLength + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.minPrefixLength = 0; + + /** + * CompletionConfig autoLearning. + * @member {boolean} autoLearning + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.autoLearning = false; + + /** + * CompletionConfig suggestionsInputConfig. + * @member {google.cloud.retail.v2.ICompletionDataInputConfig|null|undefined} suggestionsInputConfig + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.suggestionsInputConfig = null; + + /** + * CompletionConfig lastSuggestionsImportOperation. + * @member {string} lastSuggestionsImportOperation + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastSuggestionsImportOperation = ""; + + /** + * CompletionConfig denylistInputConfig. + * @member {google.cloud.retail.v2.ICompletionDataInputConfig|null|undefined} denylistInputConfig + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.denylistInputConfig = null; + + /** + * CompletionConfig lastDenylistImportOperation. + * @member {string} lastDenylistImportOperation + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastDenylistImportOperation = ""; + + /** + * CompletionConfig allowlistInputConfig. + * @member {google.cloud.retail.v2.ICompletionDataInputConfig|null|undefined} allowlistInputConfig + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.allowlistInputConfig = null; + + /** + * CompletionConfig lastAllowlistImportOperation. + * @member {string} lastAllowlistImportOperation + * @memberof google.cloud.retail.v2.CompletionConfig + * @instance + */ + CompletionConfig.prototype.lastAllowlistImportOperation = ""; + + /** + * Creates a new CompletionConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance + * @param {google.cloud.retail.v2.ICompletionConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompletionConfig} CompletionConfig instance */ - ListCatalogsResponse.create = function create(properties) { - return new ListCatalogsResponse(properties); + CompletionConfig.create = function create(properties) { + return new CompletionConfig(properties); }; /** - * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified CompletionConfig message. Does not implicitly {@link google.cloud.retail.v2.CompletionConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.ICompletionConfig} message CompletionConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encode = function encode(message, writer) { + CompletionConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalogs != null && message.catalogs.length) - for (var i = 0; i < message.catalogs.length; ++i) - $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.matchingOrder != null && Object.hasOwnProperty.call(message, "matchingOrder")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.matchingOrder); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxSuggestions); + if (message.minPrefixLength != null && Object.hasOwnProperty.call(message, "minPrefixLength")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minPrefixLength); + if (message.suggestionsInputConfig != null && Object.hasOwnProperty.call(message, "suggestionsInputConfig")) + $root.google.cloud.retail.v2.CompletionDataInputConfig.encode(message.suggestionsInputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.lastSuggestionsImportOperation != null && Object.hasOwnProperty.call(message, "lastSuggestionsImportOperation")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.lastSuggestionsImportOperation); + if (message.denylistInputConfig != null && Object.hasOwnProperty.call(message, "denylistInputConfig")) + $root.google.cloud.retail.v2.CompletionDataInputConfig.encode(message.denylistInputConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.lastDenylistImportOperation != null && Object.hasOwnProperty.call(message, "lastDenylistImportOperation")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.lastDenylistImportOperation); + if (message.allowlistInputConfig != null && Object.hasOwnProperty.call(message, "allowlistInputConfig")) + $root.google.cloud.retail.v2.CompletionDataInputConfig.encode(message.allowlistInputConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.lastAllowlistImportOperation != null && Object.hasOwnProperty.call(message, "lastAllowlistImportOperation")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.lastAllowlistImportOperation); + if (message.autoLearning != null && Object.hasOwnProperty.call(message, "autoLearning")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoLearning); return writer; }; /** - * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. + * Encodes the specified CompletionConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompletionConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static - * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode + * @param {google.cloud.retail.v2.ICompletionConfig} message CompletionConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + CompletionConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer. + * Decodes a CompletionConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.CompletionConfig} CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decode = function decode(reader, length) { + CompletionConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompletionConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.catalogs && message.catalogs.length)) - message.catalogs = []; - message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); + message.name = reader.string(); break; } case 2: { - message.nextPageToken = reader.string(); + message.matchingOrder = reader.string(); + break; + } + case 3: { + message.maxSuggestions = reader.int32(); + break; + } + case 4: { + message.minPrefixLength = reader.int32(); + break; + } + case 11: { + message.autoLearning = reader.bool(); + break; + } + case 5: { + message.suggestionsInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.lastSuggestionsImportOperation = reader.string(); + break; + } + case 7: { + message.denylistInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.lastDenylistImportOperation = reader.string(); + break; + } + case 9: { + message.allowlistInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.lastAllowlistImportOperation = reader.string(); break; } default: @@ -1089,149 +1314,220 @@ }; /** - * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. + * Decodes a CompletionConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.CompletionConfig} CompletionConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { + CompletionConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListCatalogsResponse message. + * Verifies a CompletionConfig message. * @function verify - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListCatalogsResponse.verify = function verify(message) { + CompletionConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalogs != null && message.hasOwnProperty("catalogs")) { - if (!Array.isArray(message.catalogs)) - return "catalogs: array expected"; - for (var i = 0; i < message.catalogs.length; ++i) { - var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); - if (error) - return "catalogs." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.matchingOrder != null && message.hasOwnProperty("matchingOrder")) + if (!$util.isString(message.matchingOrder)) + return "matchingOrder: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + if (!$util.isInteger(message.minPrefixLength)) + return "minPrefixLength: integer expected"; + if (message.autoLearning != null && message.hasOwnProperty("autoLearning")) + if (typeof message.autoLearning !== "boolean") + return "autoLearning: boolean expected"; + if (message.suggestionsInputConfig != null && message.hasOwnProperty("suggestionsInputConfig")) { + var error = $root.google.cloud.retail.v2.CompletionDataInputConfig.verify(message.suggestionsInputConfig); + if (error) + return "suggestionsInputConfig." + error; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; + if (message.lastSuggestionsImportOperation != null && message.hasOwnProperty("lastSuggestionsImportOperation")) + if (!$util.isString(message.lastSuggestionsImportOperation)) + return "lastSuggestionsImportOperation: string expected"; + if (message.denylistInputConfig != null && message.hasOwnProperty("denylistInputConfig")) { + var error = $root.google.cloud.retail.v2.CompletionDataInputConfig.verify(message.denylistInputConfig); + if (error) + return "denylistInputConfig." + error; + } + if (message.lastDenylistImportOperation != null && message.hasOwnProperty("lastDenylistImportOperation")) + if (!$util.isString(message.lastDenylistImportOperation)) + return "lastDenylistImportOperation: string expected"; + if (message.allowlistInputConfig != null && message.hasOwnProperty("allowlistInputConfig")) { + var error = $root.google.cloud.retail.v2.CompletionDataInputConfig.verify(message.allowlistInputConfig); + if (error) + return "allowlistInputConfig." + error; + } + if (message.lastAllowlistImportOperation != null && message.hasOwnProperty("lastAllowlistImportOperation")) + if (!$util.isString(message.lastAllowlistImportOperation)) + return "lastAllowlistImportOperation: string expected"; return null; }; /** - * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CompletionConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse + * @returns {google.cloud.retail.v2.CompletionConfig} CompletionConfig */ - ListCatalogsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) + CompletionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompletionConfig) return object; - var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); - if (object.catalogs) { - if (!Array.isArray(object.catalogs)) - throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); - message.catalogs = []; - for (var i = 0; i < object.catalogs.length; ++i) { - if (typeof object.catalogs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); - message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); - } + var message = new $root.google.cloud.retail.v2.CompletionConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.matchingOrder != null) + message.matchingOrder = String(object.matchingOrder); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; + if (object.minPrefixLength != null) + message.minPrefixLength = object.minPrefixLength | 0; + if (object.autoLearning != null) + message.autoLearning = Boolean(object.autoLearning); + if (object.suggestionsInputConfig != null) { + if (typeof object.suggestionsInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.CompletionConfig.suggestionsInputConfig: object expected"); + message.suggestionsInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.fromObject(object.suggestionsInputConfig); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); + if (object.lastSuggestionsImportOperation != null) + message.lastSuggestionsImportOperation = String(object.lastSuggestionsImportOperation); + if (object.denylistInputConfig != null) { + if (typeof object.denylistInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.CompletionConfig.denylistInputConfig: object expected"); + message.denylistInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.fromObject(object.denylistInputConfig); + } + if (object.lastDenylistImportOperation != null) + message.lastDenylistImportOperation = String(object.lastDenylistImportOperation); + if (object.allowlistInputConfig != null) { + if (typeof object.allowlistInputConfig !== "object") + throw TypeError(".google.cloud.retail.v2.CompletionConfig.allowlistInputConfig: object expected"); + message.allowlistInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.fromObject(object.allowlistInputConfig); + } + if (object.lastAllowlistImportOperation != null) + message.lastAllowlistImportOperation = String(object.lastAllowlistImportOperation); return message; }; /** - * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. + * Creates a plain object from a CompletionConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static - * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse + * @param {google.cloud.retail.v2.CompletionConfig} message CompletionConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListCatalogsResponse.toObject = function toObject(message, options) { + CompletionConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.catalogs = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.catalogs && message.catalogs.length) { - object.catalogs = []; - for (var j = 0; j < message.catalogs.length; ++j) - object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); + if (options.defaults) { + object.name = ""; + object.matchingOrder = ""; + object.maxSuggestions = 0; + object.minPrefixLength = 0; + object.suggestionsInputConfig = null; + object.lastSuggestionsImportOperation = ""; + object.denylistInputConfig = null; + object.lastDenylistImportOperation = ""; + object.allowlistInputConfig = null; + object.lastAllowlistImportOperation = ""; + object.autoLearning = false; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.matchingOrder != null && message.hasOwnProperty("matchingOrder")) + object.matchingOrder = message.matchingOrder; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.minPrefixLength != null && message.hasOwnProperty("minPrefixLength")) + object.minPrefixLength = message.minPrefixLength; + if (message.suggestionsInputConfig != null && message.hasOwnProperty("suggestionsInputConfig")) + object.suggestionsInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.toObject(message.suggestionsInputConfig, options); + if (message.lastSuggestionsImportOperation != null && message.hasOwnProperty("lastSuggestionsImportOperation")) + object.lastSuggestionsImportOperation = message.lastSuggestionsImportOperation; + if (message.denylistInputConfig != null && message.hasOwnProperty("denylistInputConfig")) + object.denylistInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.toObject(message.denylistInputConfig, options); + if (message.lastDenylistImportOperation != null && message.hasOwnProperty("lastDenylistImportOperation")) + object.lastDenylistImportOperation = message.lastDenylistImportOperation; + if (message.allowlistInputConfig != null && message.hasOwnProperty("allowlistInputConfig")) + object.allowlistInputConfig = $root.google.cloud.retail.v2.CompletionDataInputConfig.toObject(message.allowlistInputConfig, options); + if (message.lastAllowlistImportOperation != null && message.hasOwnProperty("lastAllowlistImportOperation")) + object.lastAllowlistImportOperation = message.lastAllowlistImportOperation; + if (message.autoLearning != null && message.hasOwnProperty("autoLearning")) + object.autoLearning = message.autoLearning; return object; }; /** - * Converts this ListCatalogsResponse to JSON. + * Converts this CompletionConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @instance * @returns {Object.} JSON object */ - ListCatalogsResponse.prototype.toJSON = function toJSON() { + CompletionConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListCatalogsResponse + * Gets the default type url for CompletionConfig * @function getTypeUrl - * @memberof google.cloud.retail.v2.ListCatalogsResponse + * @memberof google.cloud.retail.v2.CompletionConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListCatalogsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CompletionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.ListCatalogsResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.CompletionConfig"; }; - return ListCatalogsResponse; + return CompletionConfig; })(); - v2.UpdateCatalogRequest = (function() { + v2.Catalog = (function() { /** - * Properties of an UpdateCatalogRequest. + * Properties of a Catalog. * @memberof google.cloud.retail.v2 - * @interface IUpdateCatalogRequest - * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + * @interface ICatalog + * @property {string|null} [name] Catalog name + * @property {string|null} [displayName] Catalog displayName + * @property {google.cloud.retail.v2.IProductLevelConfig|null} [productLevelConfig] Catalog productLevelConfig */ /** - * Constructs a new UpdateCatalogRequest. + * Constructs a new Catalog. * @memberof google.cloud.retail.v2 - * @classdesc Represents an UpdateCatalogRequest. - * @implements IUpdateCatalogRequest + * @classdesc Represents a Catalog. + * @implements ICatalog * @constructor - * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICatalog=} [properties] Properties to set */ - function UpdateCatalogRequest(properties) { + function Catalog(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1239,89 +1535,103 @@ } /** - * UpdateCatalogRequest catalog. - * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * Catalog name. + * @member {string} name + * @memberof google.cloud.retail.v2.Catalog * @instance */ - UpdateCatalogRequest.prototype.catalog = null; + Catalog.prototype.name = ""; /** - * UpdateCatalogRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * Catalog displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2.Catalog * @instance */ - UpdateCatalogRequest.prototype.updateMask = null; + Catalog.prototype.displayName = ""; /** - * Creates a new UpdateCatalogRequest instance using the specified properties. + * Catalog productLevelConfig. + * @member {google.cloud.retail.v2.IProductLevelConfig|null|undefined} productLevelConfig + * @memberof google.cloud.retail.v2.Catalog + * @instance + */ + Catalog.prototype.productLevelConfig = null; + + /** + * Creates a new Catalog instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance + * @param {google.cloud.retail.v2.ICatalog=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Catalog} Catalog instance */ - UpdateCatalogRequest.create = function create(properties) { - return new UpdateCatalogRequest(properties); + Catalog.create = function create(properties) { + return new Catalog(properties); }; /** - * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified Catalog message. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICatalog} message Catalog message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encode = function encode(message, writer) { + Catalog.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.productLevelConfig != null && Object.hasOwnProperty.call(message, "productLevelConfig")) + $root.google.cloud.retail.v2.ProductLevelConfig.encode(message.productLevelConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. + * Encodes the specified Catalog message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Catalog.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static - * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICatalog} message Catalog message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { + Catalog.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer. + * Decodes a Catalog message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.Catalog} Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decode = function decode(reader, length) { + Catalog.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Catalog(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); + message.name = reader.string(); break; } case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.displayName = reader.string(); + break; + } + case 4: { + message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.decode(reader, reader.uint32()); break; } default: @@ -1333,144 +1643,195 @@ }; /** - * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. + * Decodes a Catalog message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.Catalog} Catalog * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { + Catalog.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateCatalogRequest message. + * Verifies a Catalog message. * @function verify - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateCatalogRequest.verify = function verify(message) { + Catalog.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) { - var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); - if (error) - return "catalog." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) { + var error = $root.google.cloud.retail.v2.ProductLevelConfig.verify(message.productLevelConfig); if (error) - return "updateMask." + error; + return "productLevelConfig." + error; } return null; }; /** - * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Catalog message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest + * @returns {google.cloud.retail.v2.Catalog} Catalog */ - UpdateCatalogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) + Catalog.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Catalog) return object; - var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); - if (object.catalog != null) { - if (typeof object.catalog !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); - message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + var message = new $root.google.cloud.retail.v2.Catalog(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.productLevelConfig != null) { + if (typeof object.productLevelConfig !== "object") + throw TypeError(".google.cloud.retail.v2.Catalog.productLevelConfig: object expected"); + message.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.fromObject(object.productLevelConfig); } return message; }; /** - * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. + * Creates a plain object from a Catalog message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static - * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest + * @param {google.cloud.retail.v2.Catalog} message Catalog * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateCatalogRequest.toObject = function toObject(message, options) { + Catalog.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.catalog = null; - object.updateMask = null; + object.name = ""; + object.displayName = ""; + object.productLevelConfig = null; } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.productLevelConfig != null && message.hasOwnProperty("productLevelConfig")) + object.productLevelConfig = $root.google.cloud.retail.v2.ProductLevelConfig.toObject(message.productLevelConfig, options); return object; }; /** - * Converts this UpdateCatalogRequest to JSON. + * Converts this Catalog to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @instance * @returns {Object.} JSON object */ - UpdateCatalogRequest.prototype.toJSON = function toJSON() { + Catalog.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for UpdateCatalogRequest + * Gets the default type url for Catalog * @function getTypeUrl - * @memberof google.cloud.retail.v2.UpdateCatalogRequest + * @memberof google.cloud.retail.v2.Catalog * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - UpdateCatalogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Catalog.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.UpdateCatalogRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.Catalog"; }; - return UpdateCatalogRequest; + return Catalog; })(); - v2.SetDefaultBranchRequest = (function() { + /** + * AttributeConfigLevel enum. + * @name google.cloud.retail.v2.AttributeConfigLevel + * @enum {number} + * @property {number} ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED=0 ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED value + * @property {number} PRODUCT_LEVEL_ATTRIBUTE_CONFIG=1 PRODUCT_LEVEL_ATTRIBUTE_CONFIG value + * @property {number} CATALOG_LEVEL_ATTRIBUTE_CONFIG=2 CATALOG_LEVEL_ATTRIBUTE_CONFIG value + */ + v2.AttributeConfigLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_LEVEL_ATTRIBUTE_CONFIG"] = 1; + values[valuesById[2] = "CATALOG_LEVEL_ATTRIBUTE_CONFIG"] = 2; + return values; + })(); + + /** + * SolutionType enum. + * @name google.cloud.retail.v2.SolutionType + * @enum {number} + * @property {number} SOLUTION_TYPE_UNSPECIFIED=0 SOLUTION_TYPE_UNSPECIFIED value + * @property {number} SOLUTION_TYPE_RECOMMENDATION=1 SOLUTION_TYPE_RECOMMENDATION value + * @property {number} SOLUTION_TYPE_SEARCH=2 SOLUTION_TYPE_SEARCH value + */ + v2.SolutionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SOLUTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOLUTION_TYPE_RECOMMENDATION"] = 1; + values[valuesById[2] = "SOLUTION_TYPE_SEARCH"] = 2; + return values; + })(); + + /** + * SearchSolutionUseCase enum. + * @name google.cloud.retail.v2.SearchSolutionUseCase + * @enum {number} + * @property {number} SEARCH_SOLUTION_USE_CASE_UNSPECIFIED=0 SEARCH_SOLUTION_USE_CASE_UNSPECIFIED value + * @property {number} SEARCH_SOLUTION_USE_CASE_SEARCH=1 SEARCH_SOLUTION_USE_CASE_SEARCH value + * @property {number} SEARCH_SOLUTION_USE_CASE_BROWSE=2 SEARCH_SOLUTION_USE_CASE_BROWSE value + */ + v2.SearchSolutionUseCase = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SEARCH_SOLUTION_USE_CASE_SEARCH"] = 1; + values[valuesById[2] = "SEARCH_SOLUTION_USE_CASE_BROWSE"] = 2; + return values; + })(); + + v2.Condition = (function() { /** - * Properties of a SetDefaultBranchRequest. + * Properties of a Condition. * @memberof google.cloud.retail.v2 - * @interface ISetDefaultBranchRequest - * @property {string|null} [catalog] SetDefaultBranchRequest catalog - * @property {string|null} [branchId] SetDefaultBranchRequest branchId - * @property {string|null} [note] SetDefaultBranchRequest note - * @property {boolean|null} [force] SetDefaultBranchRequest force + * @interface ICondition + * @property {Array.|null} [queryTerms] Condition queryTerms + * @property {Array.|null} [activeTimeRange] Condition activeTimeRange */ /** - * Constructs a new SetDefaultBranchRequest. + * Constructs a new Condition. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SetDefaultBranchRequest. - * @implements ISetDefaultBranchRequest + * @classdesc Represents a Condition. + * @implements ICondition * @constructor - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICondition=} [properties] Properties to set */ - function SetDefaultBranchRequest(properties) { + function Condition(properties) { + this.queryTerms = []; + this.activeTimeRange = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1478,117 +1839,95 @@ } /** - * SetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest - * @instance - */ - SetDefaultBranchRequest.prototype.catalog = ""; - - /** - * SetDefaultBranchRequest branchId. - * @member {string} branchId - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest - * @instance - */ - SetDefaultBranchRequest.prototype.branchId = ""; - - /** - * SetDefaultBranchRequest note. - * @member {string} note - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * Condition queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2.Condition * @instance */ - SetDefaultBranchRequest.prototype.note = ""; + Condition.prototype.queryTerms = $util.emptyArray; /** - * SetDefaultBranchRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * Condition activeTimeRange. + * @member {Array.} activeTimeRange + * @memberof google.cloud.retail.v2.Condition * @instance */ - SetDefaultBranchRequest.prototype.force = false; + Condition.prototype.activeTimeRange = $util.emptyArray; /** - * Creates a new SetDefaultBranchRequest instance using the specified properties. + * Creates a new Condition instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest instance + * @param {google.cloud.retail.v2.ICondition=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Condition} Condition instance */ - SetDefaultBranchRequest.create = function create(properties) { - return new SetDefaultBranchRequest(properties); + Condition.create = function create(properties) { + return new Condition(properties); }; /** - * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Condition message. Does not implicitly {@link google.cloud.retail.v2.Condition.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICondition} message Condition message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetDefaultBranchRequest.encode = function encode(message, writer) { + Condition.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + $root.google.cloud.retail.v2.Condition.QueryTerm.encode(message.queryTerms[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeTimeRange != null && message.activeTimeRange.length) + for (var i = 0; i < message.activeTimeRange.length; ++i) + $root.google.cloud.retail.v2.Condition.TimeRange.encode(message.activeTimeRange[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Condition.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static - * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICondition} message Condition message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + Condition.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a Condition message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Condition} Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetDefaultBranchRequest.decode = function decode(reader, length) { + Condition.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Condition(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.catalog = reader.string(); - break; - } - case 2: { - message.branchId = reader.string(); + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push($root.google.cloud.retail.v2.Condition.QueryTerm.decode(reader, reader.uint32())); break; } case 3: { - message.note = reader.string(); - break; - } - case 4: { - message.force = reader.bool(); + if (!(message.activeTimeRange && message.activeTimeRange.length)) + message.activeTimeRange = []; + message.activeTimeRange.push($root.google.cloud.retail.v2.Condition.TimeRange.decode(reader, reader.uint32())); break; } default: @@ -1600,147 +1939,637 @@ }; /** - * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a Condition message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Condition} Condition * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + Condition.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetDefaultBranchRequest message. + * Verifies a Condition message. * @function verify - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetDefaultBranchRequest.verify = function verify(message) { + Condition.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.branchId != null && message.hasOwnProperty("branchId")) - if (!$util.isString(message.branchId)) - return "branchId: string expected"; - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) { + var error = $root.google.cloud.retail.v2.Condition.QueryTerm.verify(message.queryTerms[i]); + if (error) + return "queryTerms." + error; + } + } + if (message.activeTimeRange != null && message.hasOwnProperty("activeTimeRange")) { + if (!Array.isArray(message.activeTimeRange)) + return "activeTimeRange: array expected"; + for (var i = 0; i < message.activeTimeRange.length; ++i) { + var error = $root.google.cloud.retail.v2.Condition.TimeRange.verify(message.activeTimeRange[i]); + if (error) + return "activeTimeRange." + error; + } + } return null; }; /** - * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Condition message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Condition} Condition */ - SetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SetDefaultBranchRequest) + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Condition) return object; - var message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.branchId != null) - message.branchId = String(object.branchId); - if (object.note != null) - message.note = String(object.note); - if (object.force != null) - message.force = Boolean(object.force); + var message = new $root.google.cloud.retail.v2.Condition(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2.Condition.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) { + if (typeof object.queryTerms[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Condition.queryTerms: object expected"); + message.queryTerms[i] = $root.google.cloud.retail.v2.Condition.QueryTerm.fromObject(object.queryTerms[i]); + } + } + if (object.activeTimeRange) { + if (!Array.isArray(object.activeTimeRange)) + throw TypeError(".google.cloud.retail.v2.Condition.activeTimeRange: array expected"); + message.activeTimeRange = []; + for (var i = 0; i < object.activeTimeRange.length; ++i) { + if (typeof object.activeTimeRange[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Condition.activeTimeRange: object expected"); + message.activeTimeRange[i] = $root.google.cloud.retail.v2.Condition.TimeRange.fromObject(object.activeTimeRange[i]); + } + } return message; }; /** - * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. + * Creates a plain object from a Condition message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static - * @param {google.cloud.retail.v2.SetDefaultBranchRequest} message SetDefaultBranchRequest + * @param {google.cloud.retail.v2.Condition} message Condition * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetDefaultBranchRequest.toObject = function toObject(message, options) { + Condition.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.catalog = ""; - object.branchId = ""; - object.note = ""; - object.force = false; + if (options.arrays || options.defaults) { + object.queryTerms = []; + object.activeTimeRange = []; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = $root.google.cloud.retail.v2.Condition.QueryTerm.toObject(message.queryTerms[j], options); + } + if (message.activeTimeRange && message.activeTimeRange.length) { + object.activeTimeRange = []; + for (var j = 0; j < message.activeTimeRange.length; ++j) + object.activeTimeRange[j] = $root.google.cloud.retail.v2.Condition.TimeRange.toObject(message.activeTimeRange[j], options); } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.branchId != null && message.hasOwnProperty("branchId")) - object.branchId = message.branchId; - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; return object; }; /** - * Converts this SetDefaultBranchRequest to JSON. + * Converts this Condition to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @instance * @returns {Object.} JSON object */ - SetDefaultBranchRequest.prototype.toJSON = function toJSON() { + Condition.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for SetDefaultBranchRequest + * Gets the default type url for Condition * @function getTypeUrl - * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Condition * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - SetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Condition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SetDefaultBranchRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.Condition"; }; - return SetDefaultBranchRequest; + Condition.QueryTerm = (function() { + + /** + * Properties of a QueryTerm. + * @memberof google.cloud.retail.v2.Condition + * @interface IQueryTerm + * @property {string|null} [value] QueryTerm value + * @property {boolean|null} [fullMatch] QueryTerm fullMatch + */ + + /** + * Constructs a new QueryTerm. + * @memberof google.cloud.retail.v2.Condition + * @classdesc Represents a QueryTerm. + * @implements IQueryTerm + * @constructor + * @param {google.cloud.retail.v2.Condition.IQueryTerm=} [properties] Properties to set + */ + function QueryTerm(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTerm value. + * @member {string} value + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.value = ""; + + /** + * QueryTerm fullMatch. + * @member {boolean} fullMatch + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @instance + */ + QueryTerm.prototype.fullMatch = false; + + /** + * Creates a new QueryTerm instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2.Condition.IQueryTerm=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Condition.QueryTerm} QueryTerm instance + */ + QueryTerm.create = function create(properties) { + return new QueryTerm(properties); + }; + + /** + * Encodes the specified QueryTerm message. Does not implicitly {@link google.cloud.retail.v2.Condition.QueryTerm.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.fullMatch != null && Object.hasOwnProperty.call(message, "fullMatch")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullMatch); + return writer; + }; + + /** + * Encodes the specified QueryTerm message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Condition.QueryTerm.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2.Condition.IQueryTerm} message QueryTerm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTerm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Condition.QueryTerm(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.fullMatch = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTerm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Condition.QueryTerm} QueryTerm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTerm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTerm message. + * @function verify + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTerm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + if (typeof message.fullMatch !== "boolean") + return "fullMatch: boolean expected"; + return null; + }; + + /** + * Creates a QueryTerm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Condition.QueryTerm} QueryTerm + */ + QueryTerm.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Condition.QueryTerm) + return object; + var message = new $root.google.cloud.retail.v2.Condition.QueryTerm(); + if (object.value != null) + message.value = String(object.value); + if (object.fullMatch != null) + message.fullMatch = Boolean(object.fullMatch); + return message; + }; + + /** + * Creates a plain object from a QueryTerm message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {google.cloud.retail.v2.Condition.QueryTerm} message QueryTerm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTerm.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.fullMatch = false; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.fullMatch != null && message.hasOwnProperty("fullMatch")) + object.fullMatch = message.fullMatch; + return object; + }; + + /** + * Converts this QueryTerm to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @instance + * @returns {Object.} JSON object + */ + QueryTerm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryTerm + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Condition.QueryTerm + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTerm.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Condition.QueryTerm"; + }; + + return QueryTerm; + })(); + + Condition.TimeRange = (function() { + + /** + * Properties of a TimeRange. + * @memberof google.cloud.retail.v2.Condition + * @interface ITimeRange + * @property {google.protobuf.ITimestamp|null} [startTime] TimeRange startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeRange endTime + */ + + /** + * Constructs a new TimeRange. + * @memberof google.cloud.retail.v2.Condition + * @classdesc Represents a TimeRange. + * @implements ITimeRange + * @constructor + * @param {google.cloud.retail.v2.Condition.ITimeRange=} [properties] Properties to set + */ + function TimeRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeRange startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @instance + */ + TimeRange.prototype.startTime = null; + + /** + * TimeRange endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @instance + */ + TimeRange.prototype.endTime = null; + + /** + * Creates a new TimeRange instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2.Condition.ITimeRange=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Condition.TimeRange} TimeRange instance + */ + TimeRange.create = function create(properties) { + return new TimeRange(properties); + }; + + /** + * Encodes the specified TimeRange message. Does not implicitly {@link google.cloud.retail.v2.Condition.TimeRange.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeRange message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Condition.TimeRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2.Condition.ITimeRange} message TimeRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Condition.TimeRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Condition.TimeRange} TimeRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeRange message. + * @function verify + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a TimeRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Condition.TimeRange} TimeRange + */ + TimeRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Condition.TimeRange) + return object; + var message = new $root.google.cloud.retail.v2.Condition.TimeRange(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.retail.v2.Condition.TimeRange.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.retail.v2.Condition.TimeRange.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a TimeRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {google.cloud.retail.v2.Condition.TimeRange} message TimeRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this TimeRange to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @instance + * @returns {Object.} JSON object + */ + TimeRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TimeRange + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Condition.TimeRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Condition.TimeRange"; + }; + + return TimeRange; + })(); + + return Condition; })(); - v2.GetDefaultBranchRequest = (function() { + v2.Rule = (function() { /** - * Properties of a GetDefaultBranchRequest. + * Properties of a Rule. * @memberof google.cloud.retail.v2 - * @interface IGetDefaultBranchRequest - * @property {string|null} [catalog] GetDefaultBranchRequest catalog + * @interface IRule + * @property {google.cloud.retail.v2.Rule.IBoostAction|null} [boostAction] Rule boostAction + * @property {google.cloud.retail.v2.Rule.IRedirectAction|null} [redirectAction] Rule redirectAction + * @property {google.cloud.retail.v2.Rule.IOnewaySynonymsAction|null} [onewaySynonymsAction] Rule onewaySynonymsAction + * @property {google.cloud.retail.v2.Rule.IDoNotAssociateAction|null} [doNotAssociateAction] Rule doNotAssociateAction + * @property {google.cloud.retail.v2.Rule.IReplacementAction|null} [replacementAction] Rule replacementAction + * @property {google.cloud.retail.v2.Rule.IIgnoreAction|null} [ignoreAction] Rule ignoreAction + * @property {google.cloud.retail.v2.Rule.IFilterAction|null} [filterAction] Rule filterAction + * @property {google.cloud.retail.v2.Rule.ITwowaySynonymsAction|null} [twowaySynonymsAction] Rule twowaySynonymsAction + * @property {google.cloud.retail.v2.ICondition|null} [condition] Rule condition */ /** - * Constructs a new GetDefaultBranchRequest. + * Constructs a new Rule. * @memberof google.cloud.retail.v2 - * @classdesc Represents a GetDefaultBranchRequest. - * @implements IGetDefaultBranchRequest + * @classdesc Represents a Rule. + * @implements IRule * @constructor - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRule=} [properties] Properties to set */ - function GetDefaultBranchRequest(properties) { + function Rule(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1748,75 +2577,201 @@ } /** - * GetDefaultBranchRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * Rule boostAction. + * @member {google.cloud.retail.v2.Rule.IBoostAction|null|undefined} boostAction + * @memberof google.cloud.retail.v2.Rule * @instance */ - GetDefaultBranchRequest.prototype.catalog = ""; + Rule.prototype.boostAction = null; /** - * Creates a new GetDefaultBranchRequest instance using the specified properties. + * Rule redirectAction. + * @member {google.cloud.retail.v2.Rule.IRedirectAction|null|undefined} redirectAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.redirectAction = null; + + /** + * Rule onewaySynonymsAction. + * @member {google.cloud.retail.v2.Rule.IOnewaySynonymsAction|null|undefined} onewaySynonymsAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.onewaySynonymsAction = null; + + /** + * Rule doNotAssociateAction. + * @member {google.cloud.retail.v2.Rule.IDoNotAssociateAction|null|undefined} doNotAssociateAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.doNotAssociateAction = null; + + /** + * Rule replacementAction. + * @member {google.cloud.retail.v2.Rule.IReplacementAction|null|undefined} replacementAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.replacementAction = null; + + /** + * Rule ignoreAction. + * @member {google.cloud.retail.v2.Rule.IIgnoreAction|null|undefined} ignoreAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.ignoreAction = null; + + /** + * Rule filterAction. + * @member {google.cloud.retail.v2.Rule.IFilterAction|null|undefined} filterAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.filterAction = null; + + /** + * Rule twowaySynonymsAction. + * @member {google.cloud.retail.v2.Rule.ITwowaySynonymsAction|null|undefined} twowaySynonymsAction + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.twowaySynonymsAction = null; + + /** + * Rule condition. + * @member {google.cloud.retail.v2.ICondition|null|undefined} condition + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Rule.prototype.condition = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Rule action. + * @member {"boostAction"|"redirectAction"|"onewaySynonymsAction"|"doNotAssociateAction"|"replacementAction"|"ignoreAction"|"filterAction"|"twowaySynonymsAction"|undefined} action + * @memberof google.cloud.retail.v2.Rule + * @instance + */ + Object.defineProperty(Rule.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["boostAction", "redirectAction", "onewaySynonymsAction", "doNotAssociateAction", "replacementAction", "ignoreAction", "filterAction", "twowaySynonymsAction"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Rule instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest instance + * @param {google.cloud.retail.v2.IRule=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule} Rule instance */ - GetDefaultBranchRequest.create = function create(properties) { - return new GetDefaultBranchRequest(properties); + Rule.create = function create(properties) { + return new Rule(properties); }; /** - * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Rule message. Does not implicitly {@link google.cloud.retail.v2.Rule.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRule} message Rule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchRequest.encode = function encode(message, writer) { + Rule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.cloud.retail.v2.Condition.encode(message.condition, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boostAction != null && Object.hasOwnProperty.call(message, "boostAction")) + $root.google.cloud.retail.v2.Rule.BoostAction.encode(message.boostAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.redirectAction != null && Object.hasOwnProperty.call(message, "redirectAction")) + $root.google.cloud.retail.v2.Rule.RedirectAction.encode(message.redirectAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.onewaySynonymsAction != null && Object.hasOwnProperty.call(message, "onewaySynonymsAction")) + $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction.encode(message.onewaySynonymsAction, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.doNotAssociateAction != null && Object.hasOwnProperty.call(message, "doNotAssociateAction")) + $root.google.cloud.retail.v2.Rule.DoNotAssociateAction.encode(message.doNotAssociateAction, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.replacementAction != null && Object.hasOwnProperty.call(message, "replacementAction")) + $root.google.cloud.retail.v2.Rule.ReplacementAction.encode(message.replacementAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.ignoreAction != null && Object.hasOwnProperty.call(message, "ignoreAction")) + $root.google.cloud.retail.v2.Rule.IgnoreAction.encode(message.ignoreAction, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.filterAction != null && Object.hasOwnProperty.call(message, "filterAction")) + $root.google.cloud.retail.v2.Rule.FilterAction.encode(message.filterAction, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.twowaySynonymsAction != null && Object.hasOwnProperty.call(message, "twowaySynonymsAction")) + $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction.encode(message.twowaySynonymsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. + * Encodes the specified Rule message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRule} message Rule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { + Rule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. + * Decodes a Rule message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Rule} Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchRequest.decode = function decode(reader, length) { + Rule.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 2: { + message.boostAction = $root.google.cloud.retail.v2.Rule.BoostAction.decode(reader, reader.uint32()); + break; + } + case 3: { + message.redirectAction = $root.google.cloud.retail.v2.Rule.RedirectAction.decode(reader, reader.uint32()); + break; + } + case 6: { + message.onewaySynonymsAction = $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction.decode(reader, reader.uint32()); + break; + } + case 7: { + message.doNotAssociateAction = $root.google.cloud.retail.v2.Rule.DoNotAssociateAction.decode(reader, reader.uint32()); + break; + } + case 8: { + message.replacementAction = $root.google.cloud.retail.v2.Rule.ReplacementAction.decode(reader, reader.uint32()); + break; + } + case 9: { + message.ignoreAction = $root.google.cloud.retail.v2.Rule.IgnoreAction.decode(reader, reader.uint32()); + break; + } + case 10: { + message.filterAction = $root.google.cloud.retail.v2.Rule.FilterAction.decode(reader, reader.uint32()); + break; + } + case 11: { + message.twowaySynonymsAction = $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction.decode(reader, reader.uint32()); + break; + } case 1: { - message.catalog = reader.string(); + message.condition = $root.google.cloud.retail.v2.Condition.decode(reader, reader.uint32()); break; } default: @@ -1828,1337 +2783,2319 @@ }; /** - * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. + * Decodes a Rule message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Rule} Rule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { + Rule.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetDefaultBranchRequest message. + * Verifies a Rule message. * @function verify - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetDefaultBranchRequest.verify = function verify(message) { + Rule.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; + var properties = {}; + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.BoostAction.verify(message.boostAction); + if (error) + return "boostAction." + error; + } + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.RedirectAction.verify(message.redirectAction); + if (error) + return "redirectAction." + error; + } + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction.verify(message.onewaySynonymsAction); + if (error) + return "onewaySynonymsAction." + error; + } + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.DoNotAssociateAction.verify(message.doNotAssociateAction); + if (error) + return "doNotAssociateAction." + error; + } + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.ReplacementAction.verify(message.replacementAction); + if (error) + return "replacementAction." + error; + } + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.IgnoreAction.verify(message.ignoreAction); + if (error) + return "ignoreAction." + error; + } + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.FilterAction.verify(message.filterAction); + if (error) + return "filterAction." + error; + } + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction.verify(message.twowaySynonymsAction); + if (error) + return "twowaySynonymsAction." + error; + } + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.cloud.retail.v2.Condition.verify(message.condition); + if (error) + return "condition." + error; + } return null; }; /** - * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. + * Creates a Rule message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest + * @returns {google.cloud.retail.v2.Rule} Rule */ - GetDefaultBranchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchRequest) + Rule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule) return object; - var message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); + var message = new $root.google.cloud.retail.v2.Rule(); + if (object.boostAction != null) { + if (typeof object.boostAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.boostAction: object expected"); + message.boostAction = $root.google.cloud.retail.v2.Rule.BoostAction.fromObject(object.boostAction); + } + if (object.redirectAction != null) { + if (typeof object.redirectAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.redirectAction: object expected"); + message.redirectAction = $root.google.cloud.retail.v2.Rule.RedirectAction.fromObject(object.redirectAction); + } + if (object.onewaySynonymsAction != null) { + if (typeof object.onewaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.onewaySynonymsAction: object expected"); + message.onewaySynonymsAction = $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction.fromObject(object.onewaySynonymsAction); + } + if (object.doNotAssociateAction != null) { + if (typeof object.doNotAssociateAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.doNotAssociateAction: object expected"); + message.doNotAssociateAction = $root.google.cloud.retail.v2.Rule.DoNotAssociateAction.fromObject(object.doNotAssociateAction); + } + if (object.replacementAction != null) { + if (typeof object.replacementAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.replacementAction: object expected"); + message.replacementAction = $root.google.cloud.retail.v2.Rule.ReplacementAction.fromObject(object.replacementAction); + } + if (object.ignoreAction != null) { + if (typeof object.ignoreAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.ignoreAction: object expected"); + message.ignoreAction = $root.google.cloud.retail.v2.Rule.IgnoreAction.fromObject(object.ignoreAction); + } + if (object.filterAction != null) { + if (typeof object.filterAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.filterAction: object expected"); + message.filterAction = $root.google.cloud.retail.v2.Rule.FilterAction.fromObject(object.filterAction); + } + if (object.twowaySynonymsAction != null) { + if (typeof object.twowaySynonymsAction !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.twowaySynonymsAction: object expected"); + message.twowaySynonymsAction = $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction.fromObject(object.twowaySynonymsAction); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.cloud.retail.v2.Rule.condition: object expected"); + message.condition = $root.google.cloud.retail.v2.Condition.fromObject(object.condition); + } return message; }; /** - * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. + * Creates a plain object from a Rule message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static - * @param {google.cloud.retail.v2.GetDefaultBranchRequest} message GetDefaultBranchRequest + * @param {google.cloud.retail.v2.Rule} message Rule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetDefaultBranchRequest.toObject = function toObject(message, options) { + Rule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.catalog = ""; - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; + object.condition = null; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.cloud.retail.v2.Condition.toObject(message.condition, options); + if (message.boostAction != null && message.hasOwnProperty("boostAction")) { + object.boostAction = $root.google.cloud.retail.v2.Rule.BoostAction.toObject(message.boostAction, options); + if (options.oneofs) + object.action = "boostAction"; + } + if (message.redirectAction != null && message.hasOwnProperty("redirectAction")) { + object.redirectAction = $root.google.cloud.retail.v2.Rule.RedirectAction.toObject(message.redirectAction, options); + if (options.oneofs) + object.action = "redirectAction"; + } + if (message.onewaySynonymsAction != null && message.hasOwnProperty("onewaySynonymsAction")) { + object.onewaySynonymsAction = $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction.toObject(message.onewaySynonymsAction, options); + if (options.oneofs) + object.action = "onewaySynonymsAction"; + } + if (message.doNotAssociateAction != null && message.hasOwnProperty("doNotAssociateAction")) { + object.doNotAssociateAction = $root.google.cloud.retail.v2.Rule.DoNotAssociateAction.toObject(message.doNotAssociateAction, options); + if (options.oneofs) + object.action = "doNotAssociateAction"; + } + if (message.replacementAction != null && message.hasOwnProperty("replacementAction")) { + object.replacementAction = $root.google.cloud.retail.v2.Rule.ReplacementAction.toObject(message.replacementAction, options); + if (options.oneofs) + object.action = "replacementAction"; + } + if (message.ignoreAction != null && message.hasOwnProperty("ignoreAction")) { + object.ignoreAction = $root.google.cloud.retail.v2.Rule.IgnoreAction.toObject(message.ignoreAction, options); + if (options.oneofs) + object.action = "ignoreAction"; + } + if (message.filterAction != null && message.hasOwnProperty("filterAction")) { + object.filterAction = $root.google.cloud.retail.v2.Rule.FilterAction.toObject(message.filterAction, options); + if (options.oneofs) + object.action = "filterAction"; + } + if (message.twowaySynonymsAction != null && message.hasOwnProperty("twowaySynonymsAction")) { + object.twowaySynonymsAction = $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction.toObject(message.twowaySynonymsAction, options); + if (options.oneofs) + object.action = "twowaySynonymsAction"; + } return object; }; /** - * Converts this GetDefaultBranchRequest to JSON. + * Converts this Rule to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @instance * @returns {Object.} JSON object */ - GetDefaultBranchRequest.prototype.toJSON = function toJSON() { + Rule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GetDefaultBranchRequest + * Gets the default type url for Rule * @function getTypeUrl - * @memberof google.cloud.retail.v2.GetDefaultBranchRequest + * @memberof google.cloud.retail.v2.Rule * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Rule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.GetDefaultBranchRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.Rule"; }; - return GetDefaultBranchRequest; - })(); - - v2.GetDefaultBranchResponse = (function() { - - /** - * Properties of a GetDefaultBranchResponse. - * @memberof google.cloud.retail.v2 - * @interface IGetDefaultBranchResponse - * @property {string|null} [branch] GetDefaultBranchResponse branch - * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime - * @property {string|null} [note] GetDefaultBranchResponse note - */ + Rule.BoostAction = (function() { - /** - * Constructs a new GetDefaultBranchResponse. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a GetDefaultBranchResponse. - * @implements IGetDefaultBranchResponse - * @constructor - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set - */ - function GetDefaultBranchResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a BoostAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IBoostAction + * @property {number|null} [boost] BoostAction boost + * @property {string|null} [productsFilter] BoostAction productsFilter + */ - /** - * GetDefaultBranchResponse branch. - * @member {string} branch - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @instance - */ - GetDefaultBranchResponse.prototype.branch = ""; + /** + * Constructs a new BoostAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents a BoostAction. + * @implements IBoostAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IBoostAction=} [properties] Properties to set + */ + function BoostAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * GetDefaultBranchResponse setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @instance - */ - GetDefaultBranchResponse.prototype.setTime = null; + /** + * BoostAction boost. + * @member {number} boost + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @instance + */ + BoostAction.prototype.boost = 0; - /** - * GetDefaultBranchResponse note. - * @member {string} note - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @instance - */ - GetDefaultBranchResponse.prototype.note = ""; + /** + * BoostAction productsFilter. + * @member {string} productsFilter + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @instance + */ + BoostAction.prototype.productsFilter = ""; - /** - * Creates a new GetDefaultBranchResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse instance - */ - GetDefaultBranchResponse.create = function create(properties) { - return new GetDefaultBranchResponse(properties); - }; + /** + * Creates a new BoostAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2.Rule.IBoostAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.BoostAction} BoostAction instance + */ + BoostAction.create = function create(properties) { + return new BoostAction(properties); + }; - /** - * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDefaultBranchResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.note != null && Object.hasOwnProperty.call(message, "note")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); - return writer; - }; + /** + * Encodes the specified BoostAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.BoostAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.boost); + if (message.productsFilter != null && Object.hasOwnProperty.call(message, "productsFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productsFilter); + return writer; + }; - /** - * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified BoostAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.BoostAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2.Rule.IBoostAction} message BoostAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDefaultBranchResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.branch = reader.string(); - break; - } - case 2: { - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.note = reader.string(); + /** + * Decodes a BoostAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.BoostAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.boost = reader.float(); + break; + } + case 2: { + message.productsFilter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; - - /** - * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a GetDefaultBranchResponse message. - * @function verify - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetDefaultBranchResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); - if (error) - return "setTime." + error; - } - if (message.note != null && message.hasOwnProperty("note")) - if (!$util.isString(message.note)) - return "note: string expected"; - return null; - }; + /** + * Decodes a BoostAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.BoostAction} BoostAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse - */ - GetDefaultBranchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchResponse) - return object; - var message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); - if (object.branch != null) - message.branch = String(object.branch); - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2.GetDefaultBranchResponse.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); - } - if (object.note != null) - message.note = String(object.note); - return message; - }; + /** + * Verifies a BoostAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + if (!$util.isString(message.productsFilter)) + return "productsFilter: string expected"; + return null; + }; - /** - * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {google.cloud.retail.v2.GetDefaultBranchResponse} message GetDefaultBranchResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetDefaultBranchResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.branch = ""; - object.setTime = null; - object.note = ""; - } - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.note != null && message.hasOwnProperty("note")) - object.note = message.note; - return object; - }; + /** + * Creates a BoostAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.BoostAction} BoostAction + */ + BoostAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.BoostAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.BoostAction(); + if (object.boost != null) + message.boost = Number(object.boost); + if (object.productsFilter != null) + message.productsFilter = String(object.productsFilter); + return message; + }; - /** - * Converts this GetDefaultBranchResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @instance - * @returns {Object.} JSON object - */ - GetDefaultBranchResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a BoostAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {google.cloud.retail.v2.Rule.BoostAction} message BoostAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.boost = 0; + object.productsFilter = ""; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + if (message.productsFilter != null && message.hasOwnProperty("productsFilter")) + object.productsFilter = message.productsFilter; + return object; + }; - /** - * Gets the default type url for GetDefaultBranchResponse - * @function getTypeUrl - * @memberof google.cloud.retail.v2.GetDefaultBranchResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetDefaultBranchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.GetDefaultBranchResponse"; - }; + /** + * Converts this BoostAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @instance + * @returns {Object.} JSON object + */ + BoostAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GetDefaultBranchResponse; - })(); + /** + * Gets the default type url for BoostAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.BoostAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.BoostAction"; + }; - v2.Audience = (function() { + return BoostAction; + })(); - /** - * Properties of an Audience. - * @memberof google.cloud.retail.v2 - * @interface IAudience - * @property {Array.|null} [genders] Audience genders - * @property {Array.|null} [ageGroups] Audience ageGroups - */ + Rule.FilterAction = (function() { - /** - * Constructs a new Audience. - * @memberof google.cloud.retail.v2 - * @classdesc Represents an Audience. - * @implements IAudience - * @constructor - * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set - */ - function Audience(properties) { - this.genders = []; - this.ageGroups = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a FilterAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IFilterAction + * @property {string|null} [filter] FilterAction filter + */ - /** - * Audience genders. - * @member {Array.} genders - * @memberof google.cloud.retail.v2.Audience - * @instance - */ - Audience.prototype.genders = $util.emptyArray; + /** + * Constructs a new FilterAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents a FilterAction. + * @implements IFilterAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IFilterAction=} [properties] Properties to set + */ + function FilterAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Audience ageGroups. - * @member {Array.} ageGroups - * @memberof google.cloud.retail.v2.Audience - * @instance - */ - Audience.prototype.ageGroups = $util.emptyArray; + /** + * FilterAction filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @instance + */ + FilterAction.prototype.filter = ""; - /** - * Creates a new Audience instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set - * @returns {google.cloud.retail.v2.Audience} Audience instance - */ - Audience.create = function create(properties) { - return new Audience(properties); - }; + /** + * Creates a new FilterAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2.Rule.IFilterAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.FilterAction} FilterAction instance + */ + FilterAction.create = function create(properties) { + return new FilterAction(properties); + }; - /** - * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Audience.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.genders != null && message.genders.length) - for (var i = 0; i < message.genders.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); - if (message.ageGroups != null && message.ageGroups.length) - for (var i = 0; i < message.ageGroups.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); - return writer; - }; + /** + * Encodes the specified FilterAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.FilterAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + return writer; + }; - /** - * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Audience.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified FilterAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.FilterAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2.Rule.IFilterAction} message FilterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FilterAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an Audience message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.Audience} Audience - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Audience.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Audience(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.genders && message.genders.length)) - message.genders = []; - message.genders.push(reader.string()); - break; - } - case 2: { - if (!(message.ageGroups && message.ageGroups.length)) - message.ageGroups = []; - message.ageGroups.push(reader.string()); + /** + * Decodes a FilterAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.FilterAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; + return message; + }; - /** - * Decodes an Audience message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.Audience} Audience - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Audience.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a FilterAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.FilterAction} FilterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FilterAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an Audience message. - * @function verify - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Audience.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.genders != null && message.hasOwnProperty("genders")) { - if (!Array.isArray(message.genders)) - return "genders: array expected"; - for (var i = 0; i < message.genders.length; ++i) - if (!$util.isString(message.genders[i])) - return "genders: string[] expected"; - } - if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { - if (!Array.isArray(message.ageGroups)) - return "ageGroups: array expected"; - for (var i = 0; i < message.ageGroups.length; ++i) - if (!$util.isString(message.ageGroups[i])) - return "ageGroups: string[] expected"; - } - return null; - }; + /** + * Verifies a FilterAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FilterAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; - /** - * Creates an Audience message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.Audience} Audience - */ - Audience.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.Audience) + /** + * Creates a FilterAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.FilterAction} FilterAction + */ + FilterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.FilterAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.FilterAction(); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a FilterAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {google.cloud.retail.v2.Rule.FilterAction} message FilterAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FilterAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.filter = ""; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; return object; - var message = new $root.google.cloud.retail.v2.Audience(); - if (object.genders) { - if (!Array.isArray(object.genders)) - throw TypeError(".google.cloud.retail.v2.Audience.genders: array expected"); - message.genders = []; - for (var i = 0; i < object.genders.length; ++i) - message.genders[i] = String(object.genders[i]); - } - if (object.ageGroups) { - if (!Array.isArray(object.ageGroups)) - throw TypeError(".google.cloud.retail.v2.Audience.ageGroups: array expected"); - message.ageGroups = []; - for (var i = 0; i < object.ageGroups.length; ++i) - message.ageGroups[i] = String(object.ageGroups[i]); - } - return message; - }; + }; - /** - * Creates a plain object from an Audience message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {google.cloud.retail.v2.Audience} message Audience - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Audience.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.genders = []; - object.ageGroups = []; - } - if (message.genders && message.genders.length) { - object.genders = []; - for (var j = 0; j < message.genders.length; ++j) - object.genders[j] = message.genders[j]; - } - if (message.ageGroups && message.ageGroups.length) { - object.ageGroups = []; - for (var j = 0; j < message.ageGroups.length; ++j) - object.ageGroups[j] = message.ageGroups[j]; - } - return object; - }; + /** + * Converts this FilterAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @instance + * @returns {Object.} JSON object + */ + FilterAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this Audience to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.Audience - * @instance - * @returns {Object.} JSON object - */ - Audience.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for FilterAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.FilterAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FilterAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.FilterAction"; + }; - /** - * Gets the default type url for Audience - * @function getTypeUrl - * @memberof google.cloud.retail.v2.Audience - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Audience.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.Audience"; - }; + return FilterAction; + })(); - return Audience; - })(); - - v2.ColorInfo = (function() { - - /** - * Properties of a ColorInfo. - * @memberof google.cloud.retail.v2 - * @interface IColorInfo - * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies - * @property {Array.|null} [colors] ColorInfo colors - */ + Rule.RedirectAction = (function() { - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set - */ - function ColorInfo(properties) { - this.colorFamilies = []; - this.colors = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a RedirectAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IRedirectAction + * @property {string|null} [redirectUri] RedirectAction redirectUri + */ - /** - * ColorInfo colorFamilies. - * @member {Array.} colorFamilies - * @memberof google.cloud.retail.v2.ColorInfo - * @instance - */ - ColorInfo.prototype.colorFamilies = $util.emptyArray; + /** + * Constructs a new RedirectAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents a RedirectAction. + * @implements IRedirectAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IRedirectAction=} [properties] Properties to set + */ + function RedirectAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * ColorInfo colors. - * @member {Array.} colors - * @memberof google.cloud.retail.v2.ColorInfo - * @instance - */ - ColorInfo.prototype.colors = $util.emptyArray; + /** + * RedirectAction redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @instance + */ + RedirectAction.prototype.redirectUri = ""; - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; + /** + * Creates a new RedirectAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2.Rule.IRedirectAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.RedirectAction} RedirectAction instance + */ + RedirectAction.create = function create(properties) { + return new RedirectAction(properties); + }; - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.colorFamilies != null && message.colorFamilies.length) - for (var i = 0; i < message.colorFamilies.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); - return writer; - }; + /** + * Encodes the specified RedirectAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.RedirectAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.redirectUri); + return writer; + }; - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified RedirectAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.RedirectAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2.Rule.IRedirectAction} message RedirectAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedirectAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ColorInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.colorFamilies && message.colorFamilies.length)) - message.colorFamilies = []; - message.colorFamilies.push(reader.string()); - break; - } - case 2: { - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push(reader.string()); + /** + * Decodes a RedirectAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.RedirectAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.redirectUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ColorInfo message. - * @function verify - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ColorInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { - if (!Array.isArray(message.colorFamilies)) - return "colorFamilies: array expected"; - for (var i = 0; i < message.colorFamilies.length; ++i) - if (!$util.isString(message.colorFamilies[i])) - return "colorFamilies: string[] expected"; - } - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) - if (!$util.isString(message.colors[i])) - return "colors: string[] expected"; - } - return null; - }; + return message; + }; - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ColorInfo) - return object; - var message = new $root.google.cloud.retail.v2.ColorInfo(); - if (object.colorFamilies) { - if (!Array.isArray(object.colorFamilies)) - throw TypeError(".google.cloud.retail.v2.ColorInfo.colorFamilies: array expected"); - message.colorFamilies = []; - for (var i = 0; i < object.colorFamilies.length; ++i) - message.colorFamilies[i] = String(object.colorFamilies[i]); - } - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.retail.v2.ColorInfo.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) - message.colors[i] = String(object.colors[i]); - } - return message; - }; + /** + * Decodes a RedirectAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.RedirectAction} RedirectAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedirectAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {google.cloud.retail.v2.ColorInfo} message ColorInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ColorInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.colorFamilies = []; - object.colors = []; - } - if (message.colorFamilies && message.colorFamilies.length) { - object.colorFamilies = []; - for (var j = 0; j < message.colorFamilies.length; ++j) - object.colorFamilies[j] = message.colorFamilies[j]; - } - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = message.colors[j]; - } - return object; - }; + /** + * Verifies a RedirectAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedirectAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + return null; + }; - /** - * Converts this ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a RedirectAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.RedirectAction} RedirectAction + */ + RedirectAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.RedirectAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.RedirectAction(); + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + return message; + }; - /** - * Gets the default type url for ColorInfo - * @function getTypeUrl - * @memberof google.cloud.retail.v2.ColorInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.ColorInfo"; - }; + /** + * Creates a plain object from a RedirectAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {google.cloud.retail.v2.Rule.RedirectAction} message RedirectAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedirectAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.redirectUri = ""; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + return object; + }; - return ColorInfo; - })(); + /** + * Converts this RedirectAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @instance + * @returns {Object.} JSON object + */ + RedirectAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - v2.CustomAttribute = (function() { + /** + * Gets the default type url for RedirectAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.RedirectAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RedirectAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.RedirectAction"; + }; - /** - * Properties of a CustomAttribute. - * @memberof google.cloud.retail.v2 - * @interface ICustomAttribute - * @property {Array.|null} [text] CustomAttribute text - * @property {Array.|null} [numbers] CustomAttribute numbers - * @property {boolean|null} [searchable] CustomAttribute searchable - * @property {boolean|null} [indexable] CustomAttribute indexable - */ + return RedirectAction; + })(); - /** - * Constructs a new CustomAttribute. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a CustomAttribute. - * @implements ICustomAttribute - * @constructor - * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set - */ - function CustomAttribute(properties) { - this.text = []; - this.numbers = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Rule.TwowaySynonymsAction = (function() { - /** - * CustomAttribute text. - * @member {Array.} text - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.text = $util.emptyArray; + /** + * Properties of a TwowaySynonymsAction. + * @memberof google.cloud.retail.v2.Rule + * @interface ITwowaySynonymsAction + * @property {Array.|null} [synonyms] TwowaySynonymsAction synonyms + */ - /** - * CustomAttribute numbers. - * @member {Array.} numbers - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.numbers = $util.emptyArray; + /** + * Constructs a new TwowaySynonymsAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents a TwowaySynonymsAction. + * @implements ITwowaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2.Rule.ITwowaySynonymsAction=} [properties] Properties to set + */ + function TwowaySynonymsAction(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CustomAttribute searchable. - * @member {boolean|null|undefined} searchable - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.searchable = null; + /** + * TwowaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @instance + */ + TwowaySynonymsAction.prototype.synonyms = $util.emptyArray; - /** - * CustomAttribute indexable. - * @member {boolean|null|undefined} indexable - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - CustomAttribute.prototype.indexable = null; + /** + * Creates a new TwowaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.ITwowaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.TwowaySynonymsAction} TwowaySynonymsAction instance + */ + TwowaySynonymsAction.create = function create(properties) { + return new TwowaySynonymsAction(properties); + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Encodes the specified TwowaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.synonyms[i]); + return writer; + }; - /** - * CustomAttribute _searchable. - * @member {"searchable"|undefined} _searchable - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_searchable", { - get: $util.oneOfGetter($oneOfFields = ["searchable"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Encodes the specified TwowaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.TwowaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.ITwowaySynonymsAction} message TwowaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TwowaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * CustomAttribute _indexable. - * @member {"indexable"|undefined} _indexable - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - */ - Object.defineProperty(CustomAttribute.prototype, "_indexable", { - get: $util.oneOfGetter($oneOfFields = ["indexable"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new CustomAttribute instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance - */ - CustomAttribute.create = function create(properties) { - return new CustomAttribute(properties); - }; + /** + * Decodes a TwowaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.TwowaySynonymsAction} TwowaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TwowaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomAttribute.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.text != null && message.text.length) - for (var i = 0; i < message.text.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); - if (message.numbers != null && message.numbers.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.numbers.length; ++i) - writer.double(message.numbers[i]); - writer.ldelim(); - } - if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); - if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); - return writer; - }; + /** + * Verifies a TwowaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TwowaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; - /** - * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a TwowaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.TwowaySynonymsAction} TwowaySynonymsAction + */ + TwowaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.TwowaySynonymsAction(); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2.Rule.TwowaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; - /** - * Decodes a CustomAttribute message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomAttribute.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.text && message.text.length)) - message.text = []; - message.text.push(reader.string()); - break; - } - case 2: { - if (!(message.numbers && message.numbers.length)) - message.numbers = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.numbers.push(reader.double()); - } else - message.numbers.push(reader.double()); - break; - } - case 3: { - message.searchable = reader.bool(); - break; - } - case 4: { - message.indexable = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; + /** + * Creates a plain object from a TwowaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.TwowaySynonymsAction} message TwowaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TwowaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; } - } - return message; - }; + return object; + }; - /** - * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomAttribute.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this TwowaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + TwowaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a CustomAttribute message. - * @function verify - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomAttribute.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.text != null && message.hasOwnProperty("text")) { - if (!Array.isArray(message.text)) - return "text: array expected"; - for (var i = 0; i < message.text.length; ++i) - if (!$util.isString(message.text[i])) - return "text: string[] expected"; - } - if (message.numbers != null && message.hasOwnProperty("numbers")) { - if (!Array.isArray(message.numbers)) - return "numbers: array expected"; - for (var i = 0; i < message.numbers.length; ++i) - if (typeof message.numbers[i] !== "number") - return "numbers: number[] expected"; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - properties._searchable = 1; - if (typeof message.searchable !== "boolean") - return "searchable: boolean expected"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - properties._indexable = 1; - if (typeof message.indexable !== "boolean") - return "indexable: boolean expected"; - } - return null; - }; + /** + * Gets the default type url for TwowaySynonymsAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.TwowaySynonymsAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TwowaySynonymsAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.TwowaySynonymsAction"; + }; - /** - * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute - */ - CustomAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) - return object; - var message = new $root.google.cloud.retail.v2.CustomAttribute(); - if (object.text) { - if (!Array.isArray(object.text)) - throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); - message.text = []; - for (var i = 0; i < object.text.length; ++i) - message.text[i] = String(object.text[i]); - } - if (object.numbers) { - if (!Array.isArray(object.numbers)) - throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); - message.numbers = []; - for (var i = 0; i < object.numbers.length; ++i) - message.numbers[i] = Number(object.numbers[i]); - } - if (object.searchable != null) - message.searchable = Boolean(object.searchable); - if (object.indexable != null) - message.indexable = Boolean(object.indexable); - return message; - }; + return TwowaySynonymsAction; + })(); - /** - * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomAttribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.text = []; - object.numbers = []; - } - if (message.text && message.text.length) { - object.text = []; - for (var j = 0; j < message.text.length; ++j) - object.text[j] = message.text[j]; - } - if (message.numbers && message.numbers.length) { - object.numbers = []; - for (var j = 0; j < message.numbers.length; ++j) - object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; - } - if (message.searchable != null && message.hasOwnProperty("searchable")) { - object.searchable = message.searchable; - if (options.oneofs) - object._searchable = "searchable"; - } - if (message.indexable != null && message.hasOwnProperty("indexable")) { - object.indexable = message.indexable; - if (options.oneofs) - object._indexable = "indexable"; - } - return object; - }; + Rule.OnewaySynonymsAction = (function() { - /** - * Converts this CustomAttribute to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CustomAttribute - * @instance - * @returns {Object.} JSON object - */ - CustomAttribute.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Properties of an OnewaySynonymsAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IOnewaySynonymsAction + * @property {Array.|null} [queryTerms] OnewaySynonymsAction queryTerms + * @property {Array.|null} [synonyms] OnewaySynonymsAction synonyms + * @property {Array.|null} [onewayTerms] OnewaySynonymsAction onewayTerms + */ - /** - * Gets the default type url for CustomAttribute - * @function getTypeUrl - * @memberof google.cloud.retail.v2.CustomAttribute - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CustomAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + /** + * Constructs a new OnewaySynonymsAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents an OnewaySynonymsAction. + * @implements IOnewaySynonymsAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IOnewaySynonymsAction=} [properties] Properties to set + */ + function OnewaySynonymsAction(properties) { + this.queryTerms = []; + this.synonyms = []; + this.onewayTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return typeUrlPrefix + "/google.cloud.retail.v2.CustomAttribute"; - }; - return CustomAttribute; - })(); + /** + * OnewaySynonymsAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.queryTerms = $util.emptyArray; - v2.FulfillmentInfo = (function() { + /** + * OnewaySynonymsAction synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.synonyms = $util.emptyArray; - /** - * Properties of a FulfillmentInfo. - * @memberof google.cloud.retail.v2 - * @interface IFulfillmentInfo - * @property {string|null} [type] FulfillmentInfo type - * @property {Array.|null} [placeIds] FulfillmentInfo placeIds - */ + /** + * OnewaySynonymsAction onewayTerms. + * @member {Array.} onewayTerms + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @instance + */ + OnewaySynonymsAction.prototype.onewayTerms = $util.emptyArray; - /** - * Constructs a new FulfillmentInfo. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a FulfillmentInfo. - * @implements IFulfillmentInfo - * @constructor - * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set - */ - function FulfillmentInfo(properties) { - this.placeIds = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a new OnewaySynonymsAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.IOnewaySynonymsAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.OnewaySynonymsAction} OnewaySynonymsAction instance + */ + OnewaySynonymsAction.create = function create(properties) { + return new OnewaySynonymsAction(properties); + }; - /** - * FulfillmentInfo type. - * @member {string} type - * @memberof google.cloud.retail.v2.FulfillmentInfo - * @instance - */ - FulfillmentInfo.prototype.type = ""; + /** + * Encodes the specified OnewaySynonymsAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.onewayTerms != null && message.onewayTerms.length) + for (var i = 0; i < message.onewayTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.onewayTerms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.queryTerms[i]); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.synonyms[i]); + return writer; + }; - /** - * FulfillmentInfo placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2.FulfillmentInfo - * @instance - */ - FulfillmentInfo.prototype.placeIds = $util.emptyArray; + /** + * Encodes the specified OnewaySynonymsAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.OnewaySynonymsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.IOnewaySynonymsAction} message OnewaySynonymsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnewaySynonymsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new FulfillmentInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.FulfillmentInfo - * @static - * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo instance - */ - FulfillmentInfo.create = function create(properties) { - return new FulfillmentInfo(properties); - }; + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 4: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + case 2: { + if (!(message.onewayTerms && message.onewayTerms.length)) + message.onewayTerms = []; + message.onewayTerms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OnewaySynonymsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.OnewaySynonymsAction} OnewaySynonymsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnewaySynonymsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OnewaySynonymsAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnewaySynonymsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + if (message.onewayTerms != null && message.hasOwnProperty("onewayTerms")) { + if (!Array.isArray(message.onewayTerms)) + return "onewayTerms: array expected"; + for (var i = 0; i < message.onewayTerms.length; ++i) + if (!$util.isString(message.onewayTerms[i])) + return "onewayTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an OnewaySynonymsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.OnewaySynonymsAction} OnewaySynonymsAction + */ + OnewaySynonymsAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.OnewaySynonymsAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2.Rule.OnewaySynonymsAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.retail.v2.Rule.OnewaySynonymsAction.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + if (object.onewayTerms) { + if (!Array.isArray(object.onewayTerms)) + throw TypeError(".google.cloud.retail.v2.Rule.OnewaySynonymsAction.onewayTerms: array expected"); + message.onewayTerms = []; + for (var i = 0; i < object.onewayTerms.length; ++i) + message.onewayTerms[i] = String(object.onewayTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an OnewaySynonymsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {google.cloud.retail.v2.Rule.OnewaySynonymsAction} message OnewaySynonymsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnewaySynonymsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.onewayTerms = []; + object.queryTerms = []; + object.synonyms = []; + } + if (message.onewayTerms && message.onewayTerms.length) { + object.onewayTerms = []; + for (var j = 0; j < message.onewayTerms.length; ++j) + object.onewayTerms[j] = message.onewayTerms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this OnewaySynonymsAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @instance + * @returns {Object.} JSON object + */ + OnewaySynonymsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OnewaySynonymsAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.OnewaySynonymsAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OnewaySynonymsAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.OnewaySynonymsAction"; + }; + + return OnewaySynonymsAction; + })(); + + Rule.DoNotAssociateAction = (function() { + + /** + * Properties of a DoNotAssociateAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IDoNotAssociateAction + * @property {Array.|null} [queryTerms] DoNotAssociateAction queryTerms + * @property {Array.|null} [doNotAssociateTerms] DoNotAssociateAction doNotAssociateTerms + * @property {Array.|null} [terms] DoNotAssociateAction terms + */ + + /** + * Constructs a new DoNotAssociateAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents a DoNotAssociateAction. + * @implements IDoNotAssociateAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IDoNotAssociateAction=} [properties] Properties to set + */ + function DoNotAssociateAction(properties) { + this.queryTerms = []; + this.doNotAssociateTerms = []; + this.terms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoNotAssociateAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.queryTerms = $util.emptyArray; + + /** + * DoNotAssociateAction doNotAssociateTerms. + * @member {Array.} doNotAssociateTerms + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.doNotAssociateTerms = $util.emptyArray; + + /** + * DoNotAssociateAction terms. + * @member {Array.} terms + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @instance + */ + DoNotAssociateAction.prototype.terms = $util.emptyArray; + + /** + * Creates a new DoNotAssociateAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2.Rule.IDoNotAssociateAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.DoNotAssociateAction} DoNotAssociateAction instance + */ + DoNotAssociateAction.create = function create(properties) { + return new DoNotAssociateAction(properties); + }; + + /** + * Encodes the specified DoNotAssociateAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.terms != null && message.terms.length) + for (var i = 0; i < message.terms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.terms[i]); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.doNotAssociateTerms != null && message.doNotAssociateTerms.length) + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.doNotAssociateTerms[i]); + return writer; + }; + + /** + * Encodes the specified DoNotAssociateAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.DoNotAssociateAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2.Rule.IDoNotAssociateAction} message DoNotAssociateAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoNotAssociateAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.DoNotAssociateAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 3: { + if (!(message.doNotAssociateTerms && message.doNotAssociateTerms.length)) + message.doNotAssociateTerms = []; + message.doNotAssociateTerms.push(reader.string()); + break; + } + case 1: { + if (!(message.terms && message.terms.length)) + message.terms = []; + message.terms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoNotAssociateAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.DoNotAssociateAction} DoNotAssociateAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoNotAssociateAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoNotAssociateAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoNotAssociateAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.doNotAssociateTerms != null && message.hasOwnProperty("doNotAssociateTerms")) { + if (!Array.isArray(message.doNotAssociateTerms)) + return "doNotAssociateTerms: array expected"; + for (var i = 0; i < message.doNotAssociateTerms.length; ++i) + if (!$util.isString(message.doNotAssociateTerms[i])) + return "doNotAssociateTerms: string[] expected"; + } + if (message.terms != null && message.hasOwnProperty("terms")) { + if (!Array.isArray(message.terms)) + return "terms: array expected"; + for (var i = 0; i < message.terms.length; ++i) + if (!$util.isString(message.terms[i])) + return "terms: string[] expected"; + } + return null; + }; + + /** + * Creates a DoNotAssociateAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.DoNotAssociateAction} DoNotAssociateAction + */ + DoNotAssociateAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.DoNotAssociateAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.DoNotAssociateAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2.Rule.DoNotAssociateAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.doNotAssociateTerms) { + if (!Array.isArray(object.doNotAssociateTerms)) + throw TypeError(".google.cloud.retail.v2.Rule.DoNotAssociateAction.doNotAssociateTerms: array expected"); + message.doNotAssociateTerms = []; + for (var i = 0; i < object.doNotAssociateTerms.length; ++i) + message.doNotAssociateTerms[i] = String(object.doNotAssociateTerms[i]); + } + if (object.terms) { + if (!Array.isArray(object.terms)) + throw TypeError(".google.cloud.retail.v2.Rule.DoNotAssociateAction.terms: array expected"); + message.terms = []; + for (var i = 0; i < object.terms.length; ++i) + message.terms[i] = String(object.terms[i]); + } + return message; + }; + + /** + * Creates a plain object from a DoNotAssociateAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {google.cloud.retail.v2.Rule.DoNotAssociateAction} message DoNotAssociateAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoNotAssociateAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.terms = []; + object.queryTerms = []; + object.doNotAssociateTerms = []; + } + if (message.terms && message.terms.length) { + object.terms = []; + for (var j = 0; j < message.terms.length; ++j) + object.terms[j] = message.terms[j]; + } + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.doNotAssociateTerms && message.doNotAssociateTerms.length) { + object.doNotAssociateTerms = []; + for (var j = 0; j < message.doNotAssociateTerms.length; ++j) + object.doNotAssociateTerms[j] = message.doNotAssociateTerms[j]; + } + return object; + }; + + /** + * Converts this DoNotAssociateAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @instance + * @returns {Object.} JSON object + */ + DoNotAssociateAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DoNotAssociateAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.DoNotAssociateAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoNotAssociateAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.DoNotAssociateAction"; + }; + + return DoNotAssociateAction; + })(); + + Rule.ReplacementAction = (function() { + + /** + * Properties of a ReplacementAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IReplacementAction + * @property {Array.|null} [queryTerms] ReplacementAction queryTerms + * @property {string|null} [replacementTerm] ReplacementAction replacementTerm + * @property {string|null} [term] ReplacementAction term + */ + + /** + * Constructs a new ReplacementAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents a ReplacementAction. + * @implements IReplacementAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IReplacementAction=} [properties] Properties to set + */ + function ReplacementAction(properties) { + this.queryTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplacementAction queryTerms. + * @member {Array.} queryTerms + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.queryTerms = $util.emptyArray; + + /** + * ReplacementAction replacementTerm. + * @member {string} replacementTerm + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.replacementTerm = ""; + + /** + * ReplacementAction term. + * @member {string} term + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @instance + */ + ReplacementAction.prototype.term = ""; + + /** + * Creates a new ReplacementAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2.Rule.IReplacementAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.ReplacementAction} ReplacementAction instance + */ + ReplacementAction.create = function create(properties) { + return new ReplacementAction(properties); + }; + + /** + * Encodes the specified ReplacementAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.ReplacementAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.term != null && Object.hasOwnProperty.call(message, "term")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.term); + if (message.queryTerms != null && message.queryTerms.length) + for (var i = 0; i < message.queryTerms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryTerms[i]); + if (message.replacementTerm != null && Object.hasOwnProperty.call(message, "replacementTerm")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.replacementTerm); + return writer; + }; + + /** + * Encodes the specified ReplacementAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.ReplacementAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2.Rule.IReplacementAction} message ReplacementAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplacementAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.ReplacementAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.queryTerms && message.queryTerms.length)) + message.queryTerms = []; + message.queryTerms.push(reader.string()); + break; + } + case 3: { + message.replacementTerm = reader.string(); + break; + } + case 1: { + message.term = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplacementAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.ReplacementAction} ReplacementAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplacementAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplacementAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplacementAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTerms != null && message.hasOwnProperty("queryTerms")) { + if (!Array.isArray(message.queryTerms)) + return "queryTerms: array expected"; + for (var i = 0; i < message.queryTerms.length; ++i) + if (!$util.isString(message.queryTerms[i])) + return "queryTerms: string[] expected"; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + if (!$util.isString(message.replacementTerm)) + return "replacementTerm: string expected"; + if (message.term != null && message.hasOwnProperty("term")) + if (!$util.isString(message.term)) + return "term: string expected"; + return null; + }; + + /** + * Creates a ReplacementAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.ReplacementAction} ReplacementAction + */ + ReplacementAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.ReplacementAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.ReplacementAction(); + if (object.queryTerms) { + if (!Array.isArray(object.queryTerms)) + throw TypeError(".google.cloud.retail.v2.Rule.ReplacementAction.queryTerms: array expected"); + message.queryTerms = []; + for (var i = 0; i < object.queryTerms.length; ++i) + message.queryTerms[i] = String(object.queryTerms[i]); + } + if (object.replacementTerm != null) + message.replacementTerm = String(object.replacementTerm); + if (object.term != null) + message.term = String(object.term); + return message; + }; + + /** + * Creates a plain object from a ReplacementAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {google.cloud.retail.v2.Rule.ReplacementAction} message ReplacementAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplacementAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.queryTerms = []; + if (options.defaults) { + object.term = ""; + object.replacementTerm = ""; + } + if (message.term != null && message.hasOwnProperty("term")) + object.term = message.term; + if (message.queryTerms && message.queryTerms.length) { + object.queryTerms = []; + for (var j = 0; j < message.queryTerms.length; ++j) + object.queryTerms[j] = message.queryTerms[j]; + } + if (message.replacementTerm != null && message.hasOwnProperty("replacementTerm")) + object.replacementTerm = message.replacementTerm; + return object; + }; + + /** + * Converts this ReplacementAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @instance + * @returns {Object.} JSON object + */ + ReplacementAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplacementAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.ReplacementAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplacementAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.ReplacementAction"; + }; + + return ReplacementAction; + })(); + + Rule.IgnoreAction = (function() { + + /** + * Properties of an IgnoreAction. + * @memberof google.cloud.retail.v2.Rule + * @interface IIgnoreAction + * @property {Array.|null} [ignoreTerms] IgnoreAction ignoreTerms + */ + + /** + * Constructs a new IgnoreAction. + * @memberof google.cloud.retail.v2.Rule + * @classdesc Represents an IgnoreAction. + * @implements IIgnoreAction + * @constructor + * @param {google.cloud.retail.v2.Rule.IIgnoreAction=} [properties] Properties to set + */ + function IgnoreAction(properties) { + this.ignoreTerms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IgnoreAction ignoreTerms. + * @member {Array.} ignoreTerms + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @instance + */ + IgnoreAction.prototype.ignoreTerms = $util.emptyArray; + + /** + * Creates a new IgnoreAction instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2.Rule.IIgnoreAction=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Rule.IgnoreAction} IgnoreAction instance + */ + IgnoreAction.create = function create(properties) { + return new IgnoreAction(properties); + }; + + /** + * Encodes the specified IgnoreAction message. Does not implicitly {@link google.cloud.retail.v2.Rule.IgnoreAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ignoreTerms != null && message.ignoreTerms.length) + for (var i = 0; i < message.ignoreTerms.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ignoreTerms[i]); + return writer; + }; + + /** + * Encodes the specified IgnoreAction message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Rule.IgnoreAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2.Rule.IIgnoreAction} message IgnoreAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IgnoreAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Rule.IgnoreAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.ignoreTerms && message.ignoreTerms.length)) + message.ignoreTerms = []; + message.ignoreTerms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IgnoreAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.Rule.IgnoreAction} IgnoreAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IgnoreAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IgnoreAction message. + * @function verify + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IgnoreAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ignoreTerms != null && message.hasOwnProperty("ignoreTerms")) { + if (!Array.isArray(message.ignoreTerms)) + return "ignoreTerms: array expected"; + for (var i = 0; i < message.ignoreTerms.length; ++i) + if (!$util.isString(message.ignoreTerms[i])) + return "ignoreTerms: string[] expected"; + } + return null; + }; + + /** + * Creates an IgnoreAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Rule.IgnoreAction} IgnoreAction + */ + IgnoreAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Rule.IgnoreAction) + return object; + var message = new $root.google.cloud.retail.v2.Rule.IgnoreAction(); + if (object.ignoreTerms) { + if (!Array.isArray(object.ignoreTerms)) + throw TypeError(".google.cloud.retail.v2.Rule.IgnoreAction.ignoreTerms: array expected"); + message.ignoreTerms = []; + for (var i = 0; i < object.ignoreTerms.length; ++i) + message.ignoreTerms[i] = String(object.ignoreTerms[i]); + } + return message; + }; + + /** + * Creates a plain object from an IgnoreAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {google.cloud.retail.v2.Rule.IgnoreAction} message IgnoreAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IgnoreAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreTerms = []; + if (message.ignoreTerms && message.ignoreTerms.length) { + object.ignoreTerms = []; + for (var j = 0; j < message.ignoreTerms.length; ++j) + object.ignoreTerms[j] = message.ignoreTerms[j]; + } + return object; + }; + + /** + * Converts this IgnoreAction to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @instance + * @returns {Object.} JSON object + */ + IgnoreAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IgnoreAction + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Rule.IgnoreAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IgnoreAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Rule.IgnoreAction"; + }; + + return IgnoreAction; + })(); + + return Rule; + })(); + + v2.Audience = (function() { /** - * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * Properties of an Audience. + * @memberof google.cloud.retail.v2 + * @interface IAudience + * @property {Array.|null} [genders] Audience genders + * @property {Array.|null} [ageGroups] Audience ageGroups + */ + + /** + * Constructs a new Audience. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an Audience. + * @implements IAudience + * @constructor + * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set + */ + function Audience(properties) { + this.genders = []; + this.ageGroups = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Audience genders. + * @member {Array.} genders + * @memberof google.cloud.retail.v2.Audience + * @instance + */ + Audience.prototype.genders = $util.emptyArray; + + /** + * Audience ageGroups. + * @member {Array.} ageGroups + * @memberof google.cloud.retail.v2.Audience + * @instance + */ + Audience.prototype.ageGroups = $util.emptyArray; + + /** + * Creates a new Audience instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {google.cloud.retail.v2.IAudience=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Audience} Audience instance + */ + Audience.create = function create(properties) { + return new Audience(properties); + }; + + /** + * Encodes the specified Audience message. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.Audience * @static - * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encode = function encode(message, writer) { + Audience.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.genders != null && message.genders.length) + for (var i = 0; i < message.genders.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.genders[i]); + if (message.ageGroups != null && message.ageGroups.length) + for (var i = 0; i < message.ageGroups.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ageGroups[i]); return writer; }; /** - * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * Encodes the specified Audience message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Audience.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.Audience * @static - * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {google.cloud.retail.v2.IAudience} message Audience message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + Audience.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer. + * Decodes an Audience message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decode = function decode(reader, length) { + Audience.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.FulfillmentInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Audience(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.type = reader.string(); + if (!(message.genders && message.genders.length)) + message.genders = []; + message.genders.push(reader.string()); break; } case 2: { - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); + if (!(message.ageGroups && message.ageGroups.length)) + message.ageGroups = []; + message.ageGroups.push(reader.string()); break; } default: @@ -3170,61 +5107,922 @@ }; /** - * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * Decodes an Audience message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.Audience * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2.Audience} Audience * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + Audience.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FulfillmentInfo message. + * Verifies an Audience message. * @function verify - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.Audience * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FulfillmentInfo.verify = function verify(message) { + Audience.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; + if (message.genders != null && message.hasOwnProperty("genders")) { + if (!Array.isArray(message.genders)) + return "genders: array expected"; + for (var i = 0; i < message.genders.length; ++i) + if (!$util.isString(message.genders[i])) + return "genders: string[] expected"; + } + if (message.ageGroups != null && message.hasOwnProperty("ageGroups")) { + if (!Array.isArray(message.ageGroups)) + return "ageGroups: array expected"; + for (var i = 0; i < message.ageGroups.length; ++i) + if (!$util.isString(message.ageGroups[i])) + return "ageGroups: string[] expected"; } return null; }; /** - * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * Creates an Audience message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.FulfillmentInfo + * @memberof google.cloud.retail.v2.Audience * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @returns {google.cloud.retail.v2.Audience} Audience */ - FulfillmentInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.FulfillmentInfo) + Audience.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Audience) return object; - var message = new $root.google.cloud.retail.v2.FulfillmentInfo(); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) + var message = new $root.google.cloud.retail.v2.Audience(); + if (object.genders) { + if (!Array.isArray(object.genders)) + throw TypeError(".google.cloud.retail.v2.Audience.genders: array expected"); + message.genders = []; + for (var i = 0; i < object.genders.length; ++i) + message.genders[i] = String(object.genders[i]); + } + if (object.ageGroups) { + if (!Array.isArray(object.ageGroups)) + throw TypeError(".google.cloud.retail.v2.Audience.ageGroups: array expected"); + message.ageGroups = []; + for (var i = 0; i < object.ageGroups.length; ++i) + message.ageGroups[i] = String(object.ageGroups[i]); + } + return message; + }; + + /** + * Creates a plain object from an Audience message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {google.cloud.retail.v2.Audience} message Audience + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Audience.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.genders = []; + object.ageGroups = []; + } + if (message.genders && message.genders.length) { + object.genders = []; + for (var j = 0; j < message.genders.length; ++j) + object.genders[j] = message.genders[j]; + } + if (message.ageGroups && message.ageGroups.length) { + object.ageGroups = []; + for (var j = 0; j < message.ageGroups.length; ++j) + object.ageGroups[j] = message.ageGroups[j]; + } + return object; + }; + + /** + * Converts this Audience to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Audience + * @instance + * @returns {Object.} JSON object + */ + Audience.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Audience + * @function getTypeUrl + * @memberof google.cloud.retail.v2.Audience + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Audience.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.Audience"; + }; + + return Audience; + })(); + + v2.ColorInfo = (function() { + + /** + * Properties of a ColorInfo. + * @memberof google.cloud.retail.v2 + * @interface IColorInfo + * @property {Array.|null} [colorFamilies] ColorInfo colorFamilies + * @property {Array.|null} [colors] ColorInfo colors + */ + + /** + * Constructs a new ColorInfo. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ColorInfo. + * @implements IColorInfo + * @constructor + * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set + */ + function ColorInfo(properties) { + this.colorFamilies = []; + this.colors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ColorInfo colorFamilies. + * @member {Array.} colorFamilies + * @memberof google.cloud.retail.v2.ColorInfo + * @instance + */ + ColorInfo.prototype.colorFamilies = $util.emptyArray; + + /** + * ColorInfo colors. + * @member {Array.} colors + * @memberof google.cloud.retail.v2.ColorInfo + * @instance + */ + ColorInfo.prototype.colors = $util.emptyArray; + + /** + * Creates a new ColorInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {google.cloud.retail.v2.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo instance + */ + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); + }; + + /** + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColorInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.colorFamilies != null && message.colorFamilies.length) + for (var i = 0; i < message.colorFamilies.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.colorFamilies[i]); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.colors[i]); + return writer; + }; + + /** + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ColorInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {google.cloud.retail.v2.IColorInfo} message ColorInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ColorInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColorInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ColorInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.colorFamilies && message.colorFamilies.length)) + message.colorFamilies = []; + message.colorFamilies.push(reader.string()); + break; + } + case 2: { + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColorInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ColorInfo message. + * @function verify + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ColorInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.colorFamilies != null && message.hasOwnProperty("colorFamilies")) { + if (!Array.isArray(message.colorFamilies)) + return "colorFamilies: array expected"; + for (var i = 0; i < message.colorFamilies.length; ++i) + if (!$util.isString(message.colorFamilies[i])) + return "colorFamilies: string[] expected"; + } + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) + if (!$util.isString(message.colors[i])) + return "colors: string[] expected"; + } + return null; + }; + + /** + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ColorInfo} ColorInfo + */ + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ColorInfo) + return object; + var message = new $root.google.cloud.retail.v2.ColorInfo(); + if (object.colorFamilies) { + if (!Array.isArray(object.colorFamilies)) + throw TypeError(".google.cloud.retail.v2.ColorInfo.colorFamilies: array expected"); + message.colorFamilies = []; + for (var i = 0; i < object.colorFamilies.length; ++i) + message.colorFamilies[i] = String(object.colorFamilies[i]); + } + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.retail.v2.ColorInfo.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) + message.colors[i] = String(object.colors[i]); + } + return message; + }; + + /** + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {google.cloud.retail.v2.ColorInfo} message ColorInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ColorInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.colorFamilies = []; + object.colors = []; + } + if (message.colorFamilies && message.colorFamilies.length) { + object.colorFamilies = []; + for (var j = 0; j < message.colorFamilies.length; ++j) + object.colorFamilies[j] = message.colorFamilies[j]; + } + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = message.colors[j]; + } + return object; + }; + + /** + * Converts this ColorInfo to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ColorInfo + * @instance + * @returns {Object.} JSON object + */ + ColorInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ColorInfo + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ColorInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ColorInfo"; + }; + + return ColorInfo; + })(); + + v2.CustomAttribute = (function() { + + /** + * Properties of a CustomAttribute. + * @memberof google.cloud.retail.v2 + * @interface ICustomAttribute + * @property {Array.|null} [text] CustomAttribute text + * @property {Array.|null} [numbers] CustomAttribute numbers + * @property {boolean|null} [searchable] CustomAttribute searchable + * @property {boolean|null} [indexable] CustomAttribute indexable + */ + + /** + * Constructs a new CustomAttribute. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CustomAttribute. + * @implements ICustomAttribute + * @constructor + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + */ + function CustomAttribute(properties) { + this.text = []; + this.numbers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomAttribute text. + * @member {Array.} text + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.text = $util.emptyArray; + + /** + * CustomAttribute numbers. + * @member {Array.} numbers + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.numbers = $util.emptyArray; + + /** + * CustomAttribute searchable. + * @member {boolean|null|undefined} searchable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.searchable = null; + + /** + * CustomAttribute indexable. + * @member {boolean|null|undefined} indexable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + CustomAttribute.prototype.indexable = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CustomAttribute _searchable. + * @member {"searchable"|undefined} _searchable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_searchable", { + get: $util.oneOfGetter($oneOfFields = ["searchable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * CustomAttribute _indexable. + * @member {"indexable"|undefined} _indexable + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + */ + Object.defineProperty(CustomAttribute.prototype, "_indexable", { + get: $util.oneOfGetter($oneOfFields = ["indexable"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CustomAttribute instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.ICustomAttribute=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute instance + */ + CustomAttribute.create = function create(properties) { + return new CustomAttribute(properties); + }; + + /** + * Encodes the specified CustomAttribute message. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.numbers != null && message.numbers.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.numbers.length; ++i) + writer.double(message.numbers[i]); + writer.ldelim(); + } + if (message.searchable != null && Object.hasOwnProperty.call(message, "searchable")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.searchable); + if (message.indexable != null && Object.hasOwnProperty.call(message, "indexable")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.indexable); + return writer; + }; + + /** + * Encodes the specified CustomAttribute message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CustomAttribute.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.ICustomAttribute} message CustomAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomAttribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CustomAttribute(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + case 2: { + if (!(message.numbers && message.numbers.length)) + message.numbers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.numbers.push(reader.double()); + } else + message.numbers.push(reader.double()); + break; + } + case 3: { + message.searchable = reader.bool(); + break; + } + case 4: { + message.indexable = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomAttribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomAttribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomAttribute message. + * @function verify + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomAttribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.numbers != null && message.hasOwnProperty("numbers")) { + if (!Array.isArray(message.numbers)) + return "numbers: array expected"; + for (var i = 0; i < message.numbers.length; ++i) + if (typeof message.numbers[i] !== "number") + return "numbers: number[] expected"; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + properties._searchable = 1; + if (typeof message.searchable !== "boolean") + return "searchable: boolean expected"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + properties._indexable = 1; + if (typeof message.indexable !== "boolean") + return "indexable: boolean expected"; + } + return null; + }; + + /** + * Creates a CustomAttribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CustomAttribute} CustomAttribute + */ + CustomAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CustomAttribute) + return object; + var message = new $root.google.cloud.retail.v2.CustomAttribute(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.numbers) { + if (!Array.isArray(object.numbers)) + throw TypeError(".google.cloud.retail.v2.CustomAttribute.numbers: array expected"); + message.numbers = []; + for (var i = 0; i < object.numbers.length; ++i) + message.numbers[i] = Number(object.numbers[i]); + } + if (object.searchable != null) + message.searchable = Boolean(object.searchable); + if (object.indexable != null) + message.indexable = Boolean(object.indexable); + return message; + }; + + /** + * Creates a plain object from a CustomAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {google.cloud.retail.v2.CustomAttribute} message CustomAttribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomAttribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.text = []; + object.numbers = []; + } + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.numbers && message.numbers.length) { + object.numbers = []; + for (var j = 0; j < message.numbers.length; ++j) + object.numbers[j] = options.json && !isFinite(message.numbers[j]) ? String(message.numbers[j]) : message.numbers[j]; + } + if (message.searchable != null && message.hasOwnProperty("searchable")) { + object.searchable = message.searchable; + if (options.oneofs) + object._searchable = "searchable"; + } + if (message.indexable != null && message.hasOwnProperty("indexable")) { + object.indexable = message.indexable; + if (options.oneofs) + object._indexable = "indexable"; + } + return object; + }; + + /** + * Converts this CustomAttribute to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CustomAttribute + * @instance + * @returns {Object.} JSON object + */ + CustomAttribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomAttribute + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CustomAttribute + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomAttribute.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CustomAttribute"; + }; + + return CustomAttribute; + })(); + + v2.FulfillmentInfo = (function() { + + /** + * Properties of a FulfillmentInfo. + * @memberof google.cloud.retail.v2 + * @interface IFulfillmentInfo + * @property {string|null} [type] FulfillmentInfo type + * @property {Array.|null} [placeIds] FulfillmentInfo placeIds + */ + + /** + * Constructs a new FulfillmentInfo. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo + * @constructor + * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set + */ + function FulfillmentInfo(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FulfillmentInfo type. + * @member {string} type + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @instance + */ + FulfillmentInfo.prototype.type = ""; + + /** + * FulfillmentInfo placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @instance + */ + FulfillmentInfo.prototype.placeIds = $util.emptyArray; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo instance + */ + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); + }; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + return writer; + }; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.FulfillmentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {google.cloud.retail.v2.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.FulfillmentInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FulfillmentInfo message. + * @function verify + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FulfillmentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + return null; + }; + + /** + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.FulfillmentInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.FulfillmentInfo} FulfillmentInfo + */ + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.FulfillmentInfo) + return object; + var message = new $root.google.cloud.retail.v2.FulfillmentInfo(); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) throw TypeError(".google.cloud.retail.v2.FulfillmentInfo.placeIds: array expected"); message.placeIds = []; for (var i = 0; i < object.placeIds.length; ++i) @@ -5336,132 +8134,272 @@ return LocalInventory; })(); - v2.CompletionService = (function() { + v2.GcsSource = (function() { /** - * Constructs a new CompletionService service. + * Properties of a GcsSource. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompletionService - * @extends $protobuf.rpc.Service + * @interface IGcsSource + * @property {Array.|null} [inputUris] GcsSource inputUris + * @property {string|null} [dataSchema] GcsSource dataSchema + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set */ - function CompletionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function GcsSource(properties) { + this.inputUris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; + /** + * GcsSource inputUris. + * @member {Array.} inputUris + * @memberof google.cloud.retail.v2.GcsSource + * @instance + */ + GcsSource.prototype.inputUris = $util.emptyArray; /** - * Creates new CompletionService service using the specified rpc implementation. + * GcsSource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2.GcsSource + * @instance + */ + GcsSource.prototype.dataSchema = ""; + + /** + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompletionService + * @memberof google.cloud.retail.v2.GcsSource * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GcsSource} GcsSource instance */ - CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService|completeQuery}. - * @memberof google.cloud.retail.v2.CompletionService - * @typedef CompleteQueryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.CompleteQueryResponse} [response] CompleteQueryResponse + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + GcsSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputUris != null && message.inputUris.length) + for (var i = 0; i < message.inputUris.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); + return writer; + }; /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2.CompletionService - * @instance - * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @param {google.cloud.retail.v2.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { - return this.rpcCall(completeQuery, $root.google.cloud.retail.v2.CompleteQueryRequest, $root.google.cloud.retail.v2.CompleteQueryResponse, request, callback); - }, "name", { value: "CompleteQuery" }); + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls CompleteQuery. - * @function completeQuery - * @memberof google.cloud.retail.v2.CompletionService - * @instance - * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a GcsSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.inputUris && message.inputUris.length)) + message.inputUris = []; + message.inputUris.push(reader.string()); + break; + } + case 2: { + message.dataSchema = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + GcsSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Callback as used by {@link google.cloud.retail.v2.CompletionService|importCompletionData}. - * @memberof google.cloud.retail.v2.CompletionService - * @typedef ImportCompletionDataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Verifies a GcsSource message. + * @function verify + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ + GcsSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputUris != null && message.hasOwnProperty("inputUris")) { + if (!Array.isArray(message.inputUris)) + return "inputUris: array expected"; + for (var i = 0; i < message.inputUris.length; ++i) + if (!$util.isString(message.inputUris[i])) + return "inputUris: string[] expected"; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; + return null; + }; /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2.CompletionService - * @instance - * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @param {google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.GcsSource} GcsSource */ - Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { - return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportCompletionData" }); + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GcsSource) + return object; + var message = new $root.google.cloud.retail.v2.GcsSource(); + if (object.inputUris) { + if (!Array.isArray(object.inputUris)) + throw TypeError(".google.cloud.retail.v2.GcsSource.inputUris: array expected"); + message.inputUris = []; + for (var i = 0; i < object.inputUris.length; ++i) + message.inputUris[i] = String(object.inputUris[i]); + } + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); + return message; + }; /** - * Calls ImportCompletionData. - * @function importCompletionData - * @memberof google.cloud.retail.v2.CompletionService + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {google.cloud.retail.v2.GcsSource} message GcsSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputUris = []; + if (options.defaults) + object.dataSchema = ""; + if (message.inputUris && message.inputUris.length) { + object.inputUris = []; + for (var j = 0; j < message.inputUris.length; ++j) + object.inputUris[j] = message.inputUris[j]; + } + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.GcsSource * @instance - * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GcsSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ + GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GcsSource"; + }; - return CompletionService; + return GcsSource; })(); - v2.CompleteQueryRequest = (function() { + v2.BigQuerySource = (function() { /** - * Properties of a CompleteQueryRequest. + * Properties of a BigQuerySource. * @memberof google.cloud.retail.v2 - * @interface ICompleteQueryRequest - * @property {string|null} [catalog] CompleteQueryRequest catalog - * @property {string|null} [query] CompleteQueryRequest query - * @property {string|null} [visitorId] CompleteQueryRequest visitorId - * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes - * @property {string|null} [deviceType] CompleteQueryRequest deviceType - * @property {string|null} [dataset] CompleteQueryRequest dataset - * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions + * @interface IBigQuerySource + * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate + * @property {string|null} [projectId] BigQuerySource projectId + * @property {string|null} [datasetId] BigQuerySource datasetId + * @property {string|null} [tableId] BigQuerySource tableId + * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir + * @property {string|null} [dataSchema] BigQuerySource dataSchema */ /** - * Constructs a new CompleteQueryRequest. + * Constructs a new BigQuerySource. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompleteQueryRequest. - * @implements ICompleteQueryRequest + * @classdesc Represents a BigQuerySource. + * @implements IBigQuerySource * @constructor - * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set */ - function CompleteQueryRequest(properties) { - this.languageCodes = []; + function BigQuerySource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5469,162 +8407,159 @@ } /** - * CompleteQueryRequest catalog. - * @member {string} catalog - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource partitionDate. + * @member {google.type.IDate|null|undefined} partitionDate + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.catalog = ""; + BigQuerySource.prototype.partitionDate = null; /** - * CompleteQueryRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource projectId. + * @member {string} projectId + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.query = ""; + BigQuerySource.prototype.projectId = ""; /** - * CompleteQueryRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource datasetId. + * @member {string} datasetId + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.visitorId = ""; + BigQuerySource.prototype.datasetId = ""; /** - * CompleteQueryRequest languageCodes. - * @member {Array.} languageCodes - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource tableId. + * @member {string} tableId + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; + BigQuerySource.prototype.tableId = ""; /** - * CompleteQueryRequest deviceType. - * @member {string} deviceType - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource gcsStagingDir. + * @member {string} gcsStagingDir + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.deviceType = ""; + BigQuerySource.prototype.gcsStagingDir = ""; /** - * CompleteQueryRequest dataset. - * @member {string} dataset - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource dataSchema. + * @member {string} dataSchema + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.dataset = ""; + BigQuerySource.prototype.dataSchema = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * CompleteQueryRequest maxSuggestions. - * @member {number} maxSuggestions - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * BigQuerySource partition. + * @member {"partitionDate"|undefined} partition + * @memberof google.cloud.retail.v2.BigQuerySource * @instance */ - CompleteQueryRequest.prototype.maxSuggestions = 0; + Object.defineProperty(BigQuerySource.prototype, "partition", { + get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new CompleteQueryRequest instance using the specified properties. + * Creates a new BigQuerySource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest instance + * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource instance */ - CompleteQueryRequest.create = function create(properties) { - return new CompleteQueryRequest(properties); + BigQuerySource.create = function create(properties) { + return new BigQuerySource(properties); }; /** - * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encode = function encode(message, writer) { + BigQuerySource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); - if (message.languageCodes != null && message.languageCodes.length) - for (var i = 0; i < message.languageCodes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); - if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); - if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); - if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); + if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); + if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); + if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) + $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. + * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode + * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { + BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer. + * Decodes a BigQuerySource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decode = function decode(reader, length) { + BigQuerySource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.BigQuerySource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - message.catalog = reader.string(); - break; - } - case 2: { - message.query = reader.string(); + case 6: { + message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); break; } - case 7: { - message.visitorId = reader.string(); + case 5: { + message.projectId = reader.string(); break; } - case 3: { - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); + case 1: { + message.datasetId = reader.string(); break; } - case 4: { - message.deviceType = reader.string(); + case 2: { + message.tableId = reader.string(); break; } - case 6: { - message.dataset = reader.string(); + case 3: { + message.gcsStagingDir = reader.string(); break; } - case 5: { - message.maxSuggestions = reader.int32(); + case 4: { + message.dataSchema = reader.string(); break; } default: @@ -5636,188 +8571,175 @@ }; /** - * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. + * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { + BigQuerySource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryRequest message. + * Verifies a BigQuerySource message. * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryRequest.verify = function verify(message) { + BigQuerySource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.catalog != null && message.hasOwnProperty("catalog")) - if (!$util.isString(message.catalog)) - return "catalog: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { - if (!Array.isArray(message.languageCodes)) - return "languageCodes: array expected"; - for (var i = 0; i < message.languageCodes.length; ++i) - if (!$util.isString(message.languageCodes[i])) - return "languageCodes: string[] expected"; + var properties = {}; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + properties.partition = 1; + { + var error = $root.google.type.Date.verify(message.partitionDate); + if (error) + return "partitionDate." + error; + } } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - if (!$util.isString(message.deviceType)) - return "deviceType: string expected"; - if (message.dataset != null && message.hasOwnProperty("dataset")) - if (!$util.isString(message.dataset)) - return "dataset: string expected"; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - if (!$util.isInteger(message.maxSuggestions)) - return "maxSuggestions: integer expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + if (message.tableId != null && message.hasOwnProperty("tableId")) + if (!$util.isString(message.tableId)) + return "tableId: string expected"; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + if (!$util.isString(message.gcsStagingDir)) + return "gcsStagingDir: string expected"; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + if (!$util.isString(message.dataSchema)) + return "dataSchema: string expected"; return null; }; /** - * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest + * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource */ - CompleteQueryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryRequest) + BigQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.BigQuerySource) return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); - if (object.catalog != null) - message.catalog = String(object.catalog); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.languageCodes) { - if (!Array.isArray(object.languageCodes)) - throw TypeError(".google.cloud.retail.v2.CompleteQueryRequest.languageCodes: array expected"); - message.languageCodes = []; - for (var i = 0; i < object.languageCodes.length; ++i) - message.languageCodes[i] = String(object.languageCodes[i]); + var message = new $root.google.cloud.retail.v2.BigQuerySource(); + if (object.partitionDate != null) { + if (typeof object.partitionDate !== "object") + throw TypeError(".google.cloud.retail.v2.BigQuerySource.partitionDate: object expected"); + message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); } - if (object.deviceType != null) - message.deviceType = String(object.deviceType); - if (object.dataset != null) - message.dataset = String(object.dataset); - if (object.maxSuggestions != null) - message.maxSuggestions = object.maxSuggestions | 0; + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + if (object.tableId != null) + message.tableId = String(object.tableId); + if (object.gcsStagingDir != null) + message.gcsStagingDir = String(object.gcsStagingDir); + if (object.dataSchema != null) + message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. + * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static - * @param {google.cloud.retail.v2.CompleteQueryRequest} message CompleteQueryRequest + * @param {google.cloud.retail.v2.BigQuerySource} message BigQuerySource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryRequest.toObject = function toObject(message, options) { + BigQuerySource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.languageCodes = []; if (options.defaults) { - object.catalog = ""; - object.query = ""; - object.deviceType = ""; - object.maxSuggestions = 0; - object.dataset = ""; - object.visitorId = ""; + object.datasetId = ""; + object.tableId = ""; + object.gcsStagingDir = ""; + object.dataSchema = ""; + object.projectId = ""; } - if (message.catalog != null && message.hasOwnProperty("catalog")) - object.catalog = message.catalog; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.languageCodes && message.languageCodes.length) { - object.languageCodes = []; - for (var j = 0; j < message.languageCodes.length; ++j) - object.languageCodes[j] = message.languageCodes[j]; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + if (message.tableId != null && message.hasOwnProperty("tableId")) + object.tableId = message.tableId; + if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) + object.gcsStagingDir = message.gcsStagingDir; + if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) + object.dataSchema = message.dataSchema; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { + object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (options.oneofs) + object.partition = "partitionDate"; } - if (message.deviceType != null && message.hasOwnProperty("deviceType")) - object.deviceType = message.deviceType; - if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) - object.maxSuggestions = message.maxSuggestions; - if (message.dataset != null && message.hasOwnProperty("dataset")) - object.dataset = message.dataset; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; return object; }; /** - * Converts this CompleteQueryRequest to JSON. + * Converts this BigQuerySource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @instance * @returns {Object.} JSON object */ - CompleteQueryRequest.prototype.toJSON = function toJSON() { + BigQuerySource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CompleteQueryRequest + * Gets the default type url for BigQuerySource * @function getTypeUrl - * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @memberof google.cloud.retail.v2.BigQuerySource * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CompleteQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + BigQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.BigQuerySource"; }; - return CompleteQueryRequest; + return BigQuerySource; })(); - v2.CompleteQueryResponse = (function() { + v2.ProductInlineSource = (function() { /** - * Properties of a CompleteQueryResponse. + * Properties of a ProductInlineSource. * @memberof google.cloud.retail.v2 - * @interface ICompleteQueryResponse - * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults - * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken - * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults + * @interface IProductInlineSource + * @property {Array.|null} [products] ProductInlineSource products */ /** - * Constructs a new CompleteQueryResponse. + * Constructs a new ProductInlineSource. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CompleteQueryResponse. - * @implements ICompleteQueryResponse + * @classdesc Represents a ProductInlineSource. + * @implements IProductInlineSource * @constructor - * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set */ - function CompleteQueryResponse(properties) { - this.completionResults = []; - this.recentSearchResults = []; + function ProductInlineSource(properties) { + this.products = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5825,109 +8747,78 @@ } /** - * CompleteQueryResponse completionResults. - * @member {Array.} completionResults - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @instance - */ - CompleteQueryResponse.prototype.completionResults = $util.emptyArray; - - /** - * CompleteQueryResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @instance - */ - CompleteQueryResponse.prototype.attributionToken = ""; - - /** - * CompleteQueryResponse recentSearchResults. - * @member {Array.} recentSearchResults - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * ProductInlineSource products. + * @member {Array.} products + * @memberof google.cloud.retail.v2.ProductInlineSource * @instance */ - CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + ProductInlineSource.prototype.products = $util.emptyArray; /** - * Creates a new CompleteQueryResponse instance using the specified properties. + * Creates a new ProductInlineSource instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse instance + * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource instance */ - CompleteQueryResponse.create = function create(properties) { - return new CompleteQueryResponse(properties); + ProductInlineSource.create = function create(properties) { + return new ProductInlineSource(properties); }; /** - * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encode = function encode(message, writer) { + ProductInlineSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.completionResults != null && message.completionResults.length) - for (var i = 0; i < message.completionResults.length; ++i) - $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.recentSearchResults != null && message.recentSearchResults.length) - for (var i = 0; i < message.recentSearchResults.length; ++i) - $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. + * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode + * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { + ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer. + * Decodes a ProductInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decode = function decode(reader, length) { + ProductInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.completionResults && message.completionResults.length)) - message.completionResults = []; - message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); - break; - } - case 2: { - message.attributionToken = reader.string(); - break; - } - case 3: { - if (!(message.recentSearchResults && message.recentSearchResults.length)) - message.recentSearchResults = []; - message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); break; } default: @@ -5939,741 +8830,219 @@ }; /** - * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. + * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { + ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CompleteQueryResponse message. + * Verifies a ProductInlineSource message. * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CompleteQueryResponse.verify = function verify(message) { + ProductInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.completionResults != null && message.hasOwnProperty("completionResults")) { - if (!Array.isArray(message.completionResults)) - return "completionResults: array expected"; - for (var i = 0; i < message.completionResults.length; ++i) { - var error = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); - if (error) - return "completionResults." + error; - } - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { - if (!Array.isArray(message.recentSearchResults)) - return "recentSearchResults: array expected"; - for (var i = 0; i < message.recentSearchResults.length; ++i) { - var error = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); if (error) - return "recentSearchResults." + error; + return "products." + error; } } return null; }; /** - * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse + * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource */ - CompleteQueryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse) + ProductInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ProductInlineSource) return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); - if (object.completionResults) { - if (!Array.isArray(object.completionResults)) - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: array expected"); - message.completionResults = []; - for (var i = 0; i < object.completionResults.length; ++i) { - if (typeof object.completionResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: object expected"); - message.completionResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); - } - } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.recentSearchResults) { - if (!Array.isArray(object.recentSearchResults)) - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: array expected"); - message.recentSearchResults = []; - for (var i = 0; i < object.recentSearchResults.length; ++i) { - if (typeof object.recentSearchResults[i] !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: object expected"); - message.recentSearchResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + var message = new $root.google.cloud.retail.v2.ProductInlineSource(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); } } return message; }; /** - * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. + * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse} message CompleteQueryResponse + * @param {google.cloud.retail.v2.ProductInlineSource} message ProductInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CompleteQueryResponse.toObject = function toObject(message, options) { + ProductInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.completionResults = []; - object.recentSearchResults = []; - } - if (options.defaults) - object.attributionToken = ""; - if (message.completionResults && message.completionResults.length) { - object.completionResults = []; - for (var j = 0; j < message.completionResults.length; ++j) - object.completionResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.recentSearchResults && message.recentSearchResults.length) { - object.recentSearchResults = []; - for (var j = 0; j < message.recentSearchResults.length; ++j) - object.recentSearchResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + if (options.arrays || options.defaults) + object.products = []; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); } return object; }; /** - * Converts this CompleteQueryResponse to JSON. + * Converts this ProductInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @instance * @returns {Object.} JSON object */ - CompleteQueryResponse.prototype.toJSON = function toJSON() { + ProductInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CompleteQueryResponse + * Gets the default type url for ProductInlineSource * @function getTypeUrl - * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @memberof google.cloud.retail.v2.ProductInlineSource * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CompleteQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ProductInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.ProductInlineSource"; }; - CompleteQueryResponse.CompletionResult = (function() { + return ProductInlineSource; + })(); - /** - * Properties of a CompletionResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @interface ICompletionResult - * @property {string|null} [suggestion] CompletionResult suggestion - * @property {Object.|null} [attributes] CompletionResult attributes - */ + v2.UserEventInlineSource = (function() { - /** - * Constructs a new CompletionResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @classdesc Represents a CompletionResult. - * @implements ICompletionResult - * @constructor - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - */ - function CompletionResult(properties) { - this.attributes = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a UserEventInlineSource. + * @memberof google.cloud.retail.v2 + * @interface IUserEventInlineSource + * @property {Array.|null} [userEvents] UserEventInlineSource userEvents + */ - /** - * CompletionResult suggestion. - * @member {string} suggestion - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.suggestion = ""; + /** + * Constructs a new UserEventInlineSource. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a UserEventInlineSource. + * @implements IUserEventInlineSource + * @constructor + * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set + */ + function UserEventInlineSource(properties) { + this.userEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * CompletionResult attributes. - * @member {Object.} attributes - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @instance - */ - CompletionResult.prototype.attributes = $util.emptyObject; + /** + * UserEventInlineSource userEvents. + * @member {Array.} userEvents + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @instance + */ + UserEventInlineSource.prototype.userEvents = $util.emptyArray; - /** - * Creates a new CompletionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult instance - */ - CompletionResult.create = function create(properties) { - return new CompletionResult(properties); - }; + /** + * Creates a new UserEventInlineSource instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource instance + */ + UserEventInlineSource.create = function create(properties) { + return new UserEventInlineSource(properties); + }; - /** - * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); - if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) - for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; + /** + * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userEvents != null && message.userEvents.length) + for (var i = 0; i < message.userEvents.length; ++i) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.suggestion = reader.string(); - break; - } - case 2: { - if (message.attributes === $util.emptyObject) - message.attributes = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.attributes[key] = value; - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompletionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompletionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompletionResult message. - * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompletionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - if (!$util.isString(message.suggestion)) - return "suggestion: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!$util.isObject(message.attributes)) - return "attributes: object expected"; - var key = Object.keys(message.attributes); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); - if (error) - return "attributes." + error; - } - } - return null; - }; - - /** - * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult - */ - CompletionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult) - return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(); - if (object.suggestion != null) - message.suggestion = String(object.suggestion); - if (object.attributes) { - if (typeof object.attributes !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes = {}; - for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { - if (typeof object.attributes[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); - message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} message CompletionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompletionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.attributes = {}; - if (options.defaults) - object.suggestion = ""; - if (message.suggestion != null && message.hasOwnProperty("suggestion")) - object.suggestion = message.suggestion; - var keys2; - if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { - object.attributes = {}; - for (var j = 0; j < keys2.length; ++j) - object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); - } - return object; - }; - - /** - * Converts this CompletionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @instance - * @returns {Object.} JSON object - */ - CompletionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CompletionResult - * @function getTypeUrl - * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CompletionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"; - }; - - return CompletionResult; - })(); - - CompleteQueryResponse.RecentSearchResult = (function() { - - /** - * Properties of a RecentSearchResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @interface IRecentSearchResult - * @property {string|null} [recentSearch] RecentSearchResult recentSearch - */ - - /** - * Constructs a new RecentSearchResult. - * @memberof google.cloud.retail.v2.CompleteQueryResponse - * @classdesc Represents a RecentSearchResult. - * @implements IRecentSearchResult - * @constructor - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - */ - function RecentSearchResult(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RecentSearchResult recentSearch. - * @member {string} recentSearch - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @instance - */ - RecentSearchResult.prototype.recentSearch = ""; - - /** - * Creates a new RecentSearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance - */ - RecentSearchResult.create = function create(properties) { - return new RecentSearchResult(properties); - }; - - /** - * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); - return writer; - }; - - /** - * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.recentSearch = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RecentSearchResult message. - * @function verify - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RecentSearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - if (!$util.isString(message.recentSearch)) - return "recentSearch: string expected"; - return null; - }; - - /** - * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult - */ - RecentSearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult) - return object; - var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); - if (object.recentSearch != null) - message.recentSearch = String(object.recentSearch); - return message; - }; - - /** - * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RecentSearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.recentSearch = ""; - if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) - object.recentSearch = message.recentSearch; - return object; - }; - - /** - * Converts this RecentSearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @instance - * @returns {Object.} JSON object - */ - RecentSearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RecentSearchResult - * @function getTypeUrl - * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RecentSearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"; - }; - - return RecentSearchResult; - })(); - - return CompleteQueryResponse; - })(); - - v2.GcsSource = (function() { + /** + * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UserEventInlineSource + * @static + * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Properties of a GcsSource. - * @memberof google.cloud.retail.v2 - * @interface IGcsSource - * @property {Array.|null} [inputUris] GcsSource inputUris - * @property {string|null} [dataSchema] GcsSource dataSchema - */ - - /** - * Constructs a new GcsSource. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a GcsSource. - * @implements IGcsSource - * @constructor - * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set - */ - function GcsSource(properties) { - this.inputUris = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GcsSource inputUris. - * @member {Array.} inputUris - * @memberof google.cloud.retail.v2.GcsSource - * @instance - */ - GcsSource.prototype.inputUris = $util.emptyArray; - - /** - * GcsSource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2.GcsSource - * @instance - */ - GcsSource.prototype.dataSchema = ""; - - /** - * Creates a new GcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.GcsSource - * @static - * @param {google.cloud.retail.v2.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GcsSource} GcsSource instance - */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); - }; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.GcsSource - * @static - * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputUris != null && message.inputUris.length) - for (var i = 0; i < message.inputUris.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUris[i]); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.dataSchema); - return writer; - }; - - /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GcsSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.GcsSource - * @static - * @param {google.cloud.retail.v2.IGcsSource} message GcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a UserEventInlineSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + UserEventInlineSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInlineSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.inputUris && message.inputUris.length)) - message.inputUris = []; - message.inputUris.push(reader.string()); - break; - } - case 2: { - message.dataSchema = reader.string(); + if (!(message.userEvents && message.userEvents.length)) + message.userEvents = []; + message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); break; } default: @@ -6685,148 +9054,139 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies a UserEventInlineSource message. * @function verify - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + UserEventInlineSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputUris != null && message.hasOwnProperty("inputUris")) { - if (!Array.isArray(message.inputUris)) - return "inputUris: array expected"; - for (var i = 0; i < message.inputUris.length; ++i) - if (!$util.isString(message.inputUris[i])) - return "inputUris: string[] expected"; + if (message.userEvents != null && message.hasOwnProperty("userEvents")) { + if (!Array.isArray(message.userEvents)) + return "userEvents: array expected"; + for (var i = 0; i < message.userEvents.length; ++i) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvents[i]); + if (error) + return "userEvents." + error; + } } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GcsSource} GcsSource + * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GcsSource) + UserEventInlineSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UserEventInlineSource) return object; - var message = new $root.google.cloud.retail.v2.GcsSource(); - if (object.inputUris) { - if (!Array.isArray(object.inputUris)) - throw TypeError(".google.cloud.retail.v2.GcsSource.inputUris: array expected"); - message.inputUris = []; - for (var i = 0; i < object.inputUris.length; ++i) - message.inputUris[i] = String(object.inputUris[i]); + var message = new $root.google.cloud.retail.v2.UserEventInlineSource(); + if (object.userEvents) { + if (!Array.isArray(object.userEvents)) + throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: array expected"); + message.userEvents = []; + for (var i = 0; i < object.userEvents.length; ++i) { + if (typeof object.userEvents[i] !== "object") + throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: object expected"); + message.userEvents[i] = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvents[i]); + } } - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static - * @param {google.cloud.retail.v2.GcsSource} message GcsSource + * @param {google.cloud.retail.v2.UserEventInlineSource} message UserEventInlineSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + UserEventInlineSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.inputUris = []; - if (options.defaults) - object.dataSchema = ""; - if (message.inputUris && message.inputUris.length) { - object.inputUris = []; - for (var j = 0; j < message.inputUris.length; ++j) - object.inputUris[j] = message.inputUris[j]; + object.userEvents = []; + if (message.userEvents && message.userEvents.length) { + object.userEvents = []; + for (var j = 0; j < message.userEvents.length; ++j) + object.userEvents[j] = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvents[j], options); } - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; return object; }; /** - * Converts this GcsSource to JSON. + * Converts this UserEventInlineSource to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + UserEventInlineSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GcsSource + * Gets the default type url for UserEventInlineSource * @function getTypeUrl - * @memberof google.cloud.retail.v2.GcsSource + * @memberof google.cloud.retail.v2.UserEventInlineSource * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + UserEventInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.GcsSource"; + return typeUrlPrefix + "/google.cloud.retail.v2.UserEventInlineSource"; }; - return GcsSource; + return UserEventInlineSource; })(); - v2.BigQuerySource = (function() { + v2.ImportErrorsConfig = (function() { /** - * Properties of a BigQuerySource. + * Properties of an ImportErrorsConfig. * @memberof google.cloud.retail.v2 - * @interface IBigQuerySource - * @property {google.type.IDate|null} [partitionDate] BigQuerySource partitionDate - * @property {string|null} [projectId] BigQuerySource projectId - * @property {string|null} [datasetId] BigQuerySource datasetId - * @property {string|null} [tableId] BigQuerySource tableId - * @property {string|null} [gcsStagingDir] BigQuerySource gcsStagingDir - * @property {string|null} [dataSchema] BigQuerySource dataSchema + * @interface IImportErrorsConfig + * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix */ /** - * Constructs a new BigQuerySource. + * Constructs a new ImportErrorsConfig. * @memberof google.cloud.retail.v2 - * @classdesc Represents a BigQuerySource. - * @implements IBigQuerySource + * @classdesc Represents an ImportErrorsConfig. + * @implements IImportErrorsConfig * @constructor - * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set */ - function BigQuerySource(properties) { + function ImportErrorsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6834,159 +9194,89 @@ } /** - * BigQuerySource partitionDate. - * @member {google.type.IDate|null|undefined} partitionDate - * @memberof google.cloud.retail.v2.BigQuerySource - * @instance - */ - BigQuerySource.prototype.partitionDate = null; - - /** - * BigQuerySource projectId. - * @member {string} projectId - * @memberof google.cloud.retail.v2.BigQuerySource - * @instance - */ - BigQuerySource.prototype.projectId = ""; - - /** - * BigQuerySource datasetId. - * @member {string} datasetId - * @memberof google.cloud.retail.v2.BigQuerySource - * @instance - */ - BigQuerySource.prototype.datasetId = ""; - - /** - * BigQuerySource tableId. - * @member {string} tableId - * @memberof google.cloud.retail.v2.BigQuerySource - * @instance - */ - BigQuerySource.prototype.tableId = ""; - - /** - * BigQuerySource gcsStagingDir. - * @member {string} gcsStagingDir - * @memberof google.cloud.retail.v2.BigQuerySource - * @instance - */ - BigQuerySource.prototype.gcsStagingDir = ""; - - /** - * BigQuerySource dataSchema. - * @member {string} dataSchema - * @memberof google.cloud.retail.v2.BigQuerySource + * ImportErrorsConfig gcsPrefix. + * @member {string|null|undefined} gcsPrefix + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance */ - BigQuerySource.prototype.dataSchema = ""; + ImportErrorsConfig.prototype.gcsPrefix = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * BigQuerySource partition. - * @member {"partitionDate"|undefined} partition - * @memberof google.cloud.retail.v2.BigQuerySource + * ImportErrorsConfig destination. + * @member {"gcsPrefix"|undefined} destination + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance */ - Object.defineProperty(BigQuerySource.prototype, "partition", { - get: $util.oneOfGetter($oneOfFields = ["partitionDate"]), + Object.defineProperty(ImportErrorsConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new BigQuerySource instance using the specified properties. + * Creates a new ImportErrorsConfig instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.IBigQuerySource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource instance + * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig instance */ - BigQuerySource.create = function create(properties) { - return new BigQuerySource(properties); + ImportErrorsConfig.create = function create(properties) { + return new ImportErrorsConfig(properties); }; /** - * Encodes the specified BigQuerySource message. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encode = function encode(message, writer) { + ImportErrorsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); - if (message.tableId != null && Object.hasOwnProperty.call(message, "tableId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tableId); - if (message.gcsStagingDir != null && Object.hasOwnProperty.call(message, "gcsStagingDir")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsStagingDir); - if (message.dataSchema != null && Object.hasOwnProperty.call(message, "dataSchema")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dataSchema); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.projectId); - if (message.partitionDate != null && Object.hasOwnProperty.call(message, "partitionDate")) - $root.google.type.Date.encode(message.partitionDate, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); return writer; }; /** - * Encodes the specified BigQuerySource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.BigQuerySource.verify|verify} messages. + * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.IBigQuerySource} message BigQuerySource message or plain object to encode + * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BigQuerySource message from the specified reader or buffer. + * Decodes an ImportErrorsConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decode = function decode(reader, length) { + ImportErrorsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.BigQuerySource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 6: { - message.partitionDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - } - case 5: { - message.projectId = reader.string(); - break; - } case 1: { - message.datasetId = reader.string(); - break; - } - case 2: { - message.tableId = reader.string(); - break; - } - case 3: { - message.gcsStagingDir = reader.string(); - break; - } - case 4: { - message.dataSchema = reader.string(); + message.gcsPrefix = reader.string(); break; } default: @@ -6998,175 +9288,132 @@ }; /** - * Decodes a BigQuerySource message from the specified reader or buffer, length delimited. + * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BigQuerySource.decodeDelimited = function decodeDelimited(reader) { + ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BigQuerySource message. + * Verifies an ImportErrorsConfig message. * @function verify - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BigQuerySource.verify = function verify(message) { + ImportErrorsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - properties.partition = 1; - { - var error = $root.google.type.Date.verify(message.partitionDate); - if (error) - return "partitionDate." + error; - } + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + properties.destination = 1; + if (!$util.isString(message.gcsPrefix)) + return "gcsPrefix: string expected"; } - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - if (!$util.isString(message.datasetId)) - return "datasetId: string expected"; - if (message.tableId != null && message.hasOwnProperty("tableId")) - if (!$util.isString(message.tableId)) - return "tableId: string expected"; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - if (!$util.isString(message.gcsStagingDir)) - return "gcsStagingDir: string expected"; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - if (!$util.isString(message.dataSchema)) - return "dataSchema: string expected"; return null; }; /** - * Creates a BigQuerySource message from a plain object. Also converts values to their respective internal types. + * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.BigQuerySource} BigQuerySource + * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig */ - BigQuerySource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.BigQuerySource) + ImportErrorsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ImportErrorsConfig) return object; - var message = new $root.google.cloud.retail.v2.BigQuerySource(); - if (object.partitionDate != null) { - if (typeof object.partitionDate !== "object") - throw TypeError(".google.cloud.retail.v2.BigQuerySource.partitionDate: object expected"); - message.partitionDate = $root.google.type.Date.fromObject(object.partitionDate); - } - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.datasetId != null) - message.datasetId = String(object.datasetId); - if (object.tableId != null) - message.tableId = String(object.tableId); - if (object.gcsStagingDir != null) - message.gcsStagingDir = String(object.gcsStagingDir); - if (object.dataSchema != null) - message.dataSchema = String(object.dataSchema); + var message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); + if (object.gcsPrefix != null) + message.gcsPrefix = String(object.gcsPrefix); return message; }; /** - * Creates a plain object from a BigQuerySource message. Also converts values to other types if specified. + * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static - * @param {google.cloud.retail.v2.BigQuerySource} message BigQuerySource + * @param {google.cloud.retail.v2.ImportErrorsConfig} message ImportErrorsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQuerySource.toObject = function toObject(message, options) { + ImportErrorsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.datasetId = ""; - object.tableId = ""; - object.gcsStagingDir = ""; - object.dataSchema = ""; - object.projectId = ""; - } - if (message.datasetId != null && message.hasOwnProperty("datasetId")) - object.datasetId = message.datasetId; - if (message.tableId != null && message.hasOwnProperty("tableId")) - object.tableId = message.tableId; - if (message.gcsStagingDir != null && message.hasOwnProperty("gcsStagingDir")) - object.gcsStagingDir = message.gcsStagingDir; - if (message.dataSchema != null && message.hasOwnProperty("dataSchema")) - object.dataSchema = message.dataSchema; - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.partitionDate != null && message.hasOwnProperty("partitionDate")) { - object.partitionDate = $root.google.type.Date.toObject(message.partitionDate, options); + if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { + object.gcsPrefix = message.gcsPrefix; if (options.oneofs) - object.partition = "partitionDate"; + object.destination = "gcsPrefix"; } return object; }; /** - * Converts this BigQuerySource to JSON. + * Converts this ImportErrorsConfig to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @instance * @returns {Object.} JSON object */ - BigQuerySource.prototype.toJSON = function toJSON() { + ImportErrorsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for BigQuerySource + * Gets the default type url for ImportErrorsConfig * @function getTypeUrl - * @memberof google.cloud.retail.v2.BigQuerySource + * @memberof google.cloud.retail.v2.ImportErrorsConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - BigQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ImportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.BigQuerySource"; + return typeUrlPrefix + "/google.cloud.retail.v2.ImportErrorsConfig"; }; - return BigQuerySource; + return ImportErrorsConfig; })(); - v2.ProductInlineSource = (function() { + v2.ImportProductsRequest = (function() { /** - * Properties of a ProductInlineSource. + * Properties of an ImportProductsRequest. * @memberof google.cloud.retail.v2 - * @interface IProductInlineSource - * @property {Array.|null} [products] ProductInlineSource products + * @interface IImportProductsRequest + * @property {string|null} [parent] ImportProductsRequest parent + * @property {string|null} [requestId] ImportProductsRequest requestId + * @property {google.cloud.retail.v2.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig + * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask + * @property {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode + * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic */ /** - * Constructs a new ProductInlineSource. + * Constructs a new ImportProductsRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductInlineSource. - * @implements IProductInlineSource + * @classdesc Represents an ImportProductsRequest. + * @implements IImportProductsRequest * @constructor - * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set + * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set */ - function ProductInlineSource(properties) { - this.products = []; + function ImportProductsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7174,78 +9421,159 @@ } /** - * ProductInlineSource products. - * @member {Array.} products - * @memberof google.cloud.retail.v2.ProductInlineSource + * ImportProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ImportProductsRequest * @instance */ - ProductInlineSource.prototype.products = $util.emptyArray; + ImportProductsRequest.prototype.parent = ""; /** - * Creates a new ProductInlineSource instance using the specified properties. + * ImportProductsRequest requestId. + * @member {string} requestId + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.requestId = ""; + + /** + * ImportProductsRequest inputConfig. + * @member {google.cloud.retail.v2.IProductInputConfig|null|undefined} inputConfig + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.inputConfig = null; + + /** + * ImportProductsRequest errorsConfig. + * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.errorsConfig = null; + + /** + * ImportProductsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.updateMask = null; + + /** + * ImportProductsRequest reconciliationMode. + * @member {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} reconciliationMode + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.reconciliationMode = 0; + + /** + * ImportProductsRequest notificationPubsubTopic. + * @member {string} notificationPubsubTopic + * @memberof google.cloud.retail.v2.ImportProductsRequest + * @instance + */ + ImportProductsRequest.prototype.notificationPubsubTopic = ""; + + /** + * Creates a new ImportProductsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.IProductInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource instance + * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest instance */ - ProductInlineSource.create = function create(properties) { - return new ProductInlineSource(properties); + ImportProductsRequest.create = function create(properties) { + return new ImportProductsRequest(properties); }; /** - * Encodes the specified ProductInlineSource message. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encode = function encode(message, writer) { + ImportProductsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.retail.v2.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) + $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); return writer; }; /** - * Encodes the specified ProductInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ProductInlineSource.verify|verify} messages. + * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static - * @param {google.cloud.retail.v2.IProductInlineSource} message ProductInlineSource message or plain object to encode + * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ProductInlineSource.encodeDelimited = function encodeDelimited(message, writer) { + ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer. + * Decodes an ImportProductsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ProductInlineSource + * @memberof google.cloud.retail.v2.ImportProductsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource + * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ProductInlineSource.decode = function decode(reader, length) { + ImportProductsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ProductInlineSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + message.parent = reader.string(); + break; + } + case 6: { + message.requestId = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.reconciliationMode = reader.int32(); + break; + } + case 7: { + message.notificationPubsubTopic = reader.string(); break; } default: @@ -7257,762 +9585,7 @@ }; /** - * Decodes a ProductInlineSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.ProductInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductInlineSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductInlineSource message. - * @function verify - * @memberof google.cloud.retail.v2.ProductInlineSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductInlineSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - return null; - }; - - /** - * Creates a ProductInlineSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.ProductInlineSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ProductInlineSource} ProductInlineSource - */ - ProductInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ProductInlineSource) - return object; - var message = new $root.google.cloud.retail.v2.ProductInlineSource(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ProductInlineSource.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ProductInlineSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.ProductInlineSource - * @static - * @param {google.cloud.retail.v2.ProductInlineSource} message ProductInlineSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); - } - return object; - }; - - /** - * Converts this ProductInlineSource to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.ProductInlineSource - * @instance - * @returns {Object.} JSON object - */ - ProductInlineSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductInlineSource - * @function getTypeUrl - * @memberof google.cloud.retail.v2.ProductInlineSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.ProductInlineSource"; - }; - - return ProductInlineSource; - })(); - - v2.UserEventInlineSource = (function() { - - /** - * Properties of a UserEventInlineSource. - * @memberof google.cloud.retail.v2 - * @interface IUserEventInlineSource - * @property {Array.|null} [userEvents] UserEventInlineSource userEvents - */ - - /** - * Constructs a new UserEventInlineSource. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a UserEventInlineSource. - * @implements IUserEventInlineSource - * @constructor - * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set - */ - function UserEventInlineSource(properties) { - this.userEvents = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UserEventInlineSource userEvents. - * @member {Array.} userEvents - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @instance - */ - UserEventInlineSource.prototype.userEvents = $util.emptyArray; - - /** - * Creates a new UserEventInlineSource instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2.IUserEventInlineSource=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource instance - */ - UserEventInlineSource.create = function create(properties) { - return new UserEventInlineSource(properties); - }; - - /** - * Encodes the specified UserEventInlineSource message. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventInlineSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.userEvents != null && message.userEvents.length) - for (var i = 0; i < message.userEvents.length; ++i) - $root.google.cloud.retail.v2.UserEvent.encode(message.userEvents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UserEventInlineSource message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UserEventInlineSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2.IUserEventInlineSource} message UserEventInlineSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserEventInlineSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UserEventInlineSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventInlineSource.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UserEventInlineSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.userEvents && message.userEvents.length)) - message.userEvents = []; - message.userEvents.push($root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UserEventInlineSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserEventInlineSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UserEventInlineSource message. - * @function verify - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UserEventInlineSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.userEvents != null && message.hasOwnProperty("userEvents")) { - if (!Array.isArray(message.userEvents)) - return "userEvents: array expected"; - for (var i = 0; i < message.userEvents.length; ++i) { - var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvents[i]); - if (error) - return "userEvents." + error; - } - } - return null; - }; - - /** - * Creates a UserEventInlineSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UserEventInlineSource} UserEventInlineSource - */ - UserEventInlineSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UserEventInlineSource) - return object; - var message = new $root.google.cloud.retail.v2.UserEventInlineSource(); - if (object.userEvents) { - if (!Array.isArray(object.userEvents)) - throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: array expected"); - message.userEvents = []; - for (var i = 0; i < object.userEvents.length; ++i) { - if (typeof object.userEvents[i] !== "object") - throw TypeError(".google.cloud.retail.v2.UserEventInlineSource.userEvents: object expected"); - message.userEvents[i] = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvents[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a UserEventInlineSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {google.cloud.retail.v2.UserEventInlineSource} message UserEventInlineSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserEventInlineSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.userEvents = []; - if (message.userEvents && message.userEvents.length) { - object.userEvents = []; - for (var j = 0; j < message.userEvents.length; ++j) - object.userEvents[j] = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvents[j], options); - } - return object; - }; - - /** - * Converts this UserEventInlineSource to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @instance - * @returns {Object.} JSON object - */ - UserEventInlineSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UserEventInlineSource - * @function getTypeUrl - * @memberof google.cloud.retail.v2.UserEventInlineSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UserEventInlineSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.UserEventInlineSource"; - }; - - return UserEventInlineSource; - })(); - - v2.ImportErrorsConfig = (function() { - - /** - * Properties of an ImportErrorsConfig. - * @memberof google.cloud.retail.v2 - * @interface IImportErrorsConfig - * @property {string|null} [gcsPrefix] ImportErrorsConfig gcsPrefix - */ - - /** - * Constructs a new ImportErrorsConfig. - * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportErrorsConfig. - * @implements IImportErrorsConfig - * @constructor - * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set - */ - function ImportErrorsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ImportErrorsConfig gcsPrefix. - * @member {string|null|undefined} gcsPrefix - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @instance - */ - ImportErrorsConfig.prototype.gcsPrefix = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportErrorsConfig destination. - * @member {"gcsPrefix"|undefined} destination - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @instance - */ - Object.defineProperty(ImportErrorsConfig.prototype, "destination", { - get: $util.oneOfGetter($oneOfFields = ["gcsPrefix"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ImportErrorsConfig instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2.IImportErrorsConfig=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig instance - */ - ImportErrorsConfig.create = function create(properties) { - return new ImportErrorsConfig(properties); - }; - - /** - * Encodes the specified ImportErrorsConfig message. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportErrorsConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsPrefix != null && Object.hasOwnProperty.call(message, "gcsPrefix")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsPrefix); - return writer; - }; - - /** - * Encodes the specified ImportErrorsConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportErrorsConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2.IImportErrorsConfig} message ImportErrorsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportErrorsConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportErrorsConfig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsPrefix = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportErrorsConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportErrorsConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportErrorsConfig message. - * @function verify - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportErrorsConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - properties.destination = 1; - if (!$util.isString(message.gcsPrefix)) - return "gcsPrefix: string expected"; - } - return null; - }; - - /** - * Creates an ImportErrorsConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ImportErrorsConfig} ImportErrorsConfig - */ - ImportErrorsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ImportErrorsConfig) - return object; - var message = new $root.google.cloud.retail.v2.ImportErrorsConfig(); - if (object.gcsPrefix != null) - message.gcsPrefix = String(object.gcsPrefix); - return message; - }; - - /** - * Creates a plain object from an ImportErrorsConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {google.cloud.retail.v2.ImportErrorsConfig} message ImportErrorsConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportErrorsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsPrefix != null && message.hasOwnProperty("gcsPrefix")) { - object.gcsPrefix = message.gcsPrefix; - if (options.oneofs) - object.destination = "gcsPrefix"; - } - return object; - }; - - /** - * Converts this ImportErrorsConfig to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @instance - * @returns {Object.} JSON object - */ - ImportErrorsConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportErrorsConfig - * @function getTypeUrl - * @memberof google.cloud.retail.v2.ImportErrorsConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportErrorsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.ImportErrorsConfig"; - }; - - return ImportErrorsConfig; - })(); - - v2.ImportProductsRequest = (function() { - - /** - * Properties of an ImportProductsRequest. - * @memberof google.cloud.retail.v2 - * @interface IImportProductsRequest - * @property {string|null} [parent] ImportProductsRequest parent - * @property {string|null} [requestId] ImportProductsRequest requestId - * @property {google.cloud.retail.v2.IProductInputConfig|null} [inputConfig] ImportProductsRequest inputConfig - * @property {google.cloud.retail.v2.IImportErrorsConfig|null} [errorsConfig] ImportProductsRequest errorsConfig - * @property {google.protobuf.IFieldMask|null} [updateMask] ImportProductsRequest updateMask - * @property {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode|null} [reconciliationMode] ImportProductsRequest reconciliationMode - * @property {string|null} [notificationPubsubTopic] ImportProductsRequest notificationPubsubTopic - */ - - /** - * Constructs a new ImportProductsRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents an ImportProductsRequest. - * @implements IImportProductsRequest - * @constructor - * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set - */ - function ImportProductsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ImportProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.parent = ""; - - /** - * ImportProductsRequest requestId. - * @member {string} requestId - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.requestId = ""; - - /** - * ImportProductsRequest inputConfig. - * @member {google.cloud.retail.v2.IProductInputConfig|null|undefined} inputConfig - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.inputConfig = null; - - /** - * ImportProductsRequest errorsConfig. - * @member {google.cloud.retail.v2.IImportErrorsConfig|null|undefined} errorsConfig - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.errorsConfig = null; - - /** - * ImportProductsRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.updateMask = null; - - /** - * ImportProductsRequest reconciliationMode. - * @member {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} reconciliationMode - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.reconciliationMode = 0; - - /** - * ImportProductsRequest notificationPubsubTopic. - * @member {string} notificationPubsubTopic - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @instance - */ - ImportProductsRequest.prototype.notificationPubsubTopic = ""; - - /** - * Creates a new ImportProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2.IImportProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest instance - */ - ImportProductsRequest.create = function create(properties) { - return new ImportProductsRequest(properties); - }; - - /** - * Encodes the specified ImportProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.retail.v2.ProductInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.errorsConfig != null && Object.hasOwnProperty.call(message, "errorsConfig")) - $root.google.cloud.retail.v2.ImportErrorsConfig.encode(message.errorsConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reconciliationMode != null && Object.hasOwnProperty.call(message, "reconciliationMode")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.reconciliationMode); - if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); - if (message.notificationPubsubTopic != null && Object.hasOwnProperty.call(message, "notificationPubsubTopic")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.notificationPubsubTopic); - return writer; - }; - - /** - * Encodes the specified ImportProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ImportProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @static - * @param {google.cloud.retail.v2.IImportProductsRequest} message ImportProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.ImportProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ImportProductsRequest} ImportProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ImportProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 6: { - message.requestId = reader.string(); - break; - } - case 2: { - message.inputConfig = $root.google.cloud.retail.v2.ProductInputConfig.decode(reader, reader.uint32()); - break; - } - case 3: { - message.errorsConfig = $root.google.cloud.retail.v2.ImportErrorsConfig.decode(reader, reader.uint32()); - break; - } - case 4: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - case 5: { - message.reconciliationMode = reader.int32(); - break; - } - case 7: { - message.notificationPubsubTopic = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. + * Decodes an ImportProductsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof google.cloud.retail.v2.ImportProductsRequest * @static @@ -10954,6 +12527,7 @@ * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields * @property {Array.|null} [variants] Product variants + * @property {Array.|null} [localInventories] Product localInventories */ /** @@ -10978,6 +12552,7 @@ this.conditions = []; this.promotions = []; this.variants = []; + this.localInventories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11248,6 +12823,14 @@ */ Product.prototype.variants = $util.emptyArray; + /** + * Product localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2.Product + * @instance + */ + Product.prototype.localInventories = $util.emptyArray; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -11367,6 +12950,9 @@ if (message.promotions != null && message.promotions.length) for (var i = 0; i < message.promotions.length; ++i) $root.google.cloud.retail.v2.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); return writer; }; @@ -11576,6 +13162,12 @@ message.variants.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); break; } + case 35: { + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2.LocalInventory.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -11817,6 +13409,15 @@ return "variants." + error; } } + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } return null; }; @@ -12044,6 +13645,16 @@ message.variants[i] = $root.google.cloud.retail.v2.Product.fromObject(object.variants[i]); } } + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2.Product.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2.Product.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2.LocalInventory.fromObject(object.localInventories[i]); + } + } return message; }; @@ -12073,6 +13684,7 @@ object.conditions = []; object.variants = []; object.promotions = []; + object.localInventories = []; } if (options.objects || options.defaults) object.attributes = {}; @@ -12208,6 +13820,11 @@ for (var j = 0; j < message.promotions.length; ++j) object.promotions[j] = $root.google.cloud.retail.v2.Promotion.toObject(message.promotions[j], options); } + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2.LocalInventory.toObject(message.localInventories[j], options); + } return object; }; @@ -14023,319 +15640,530 @@ return PurchaseTransaction; })(); - v2.PredictionService = (function() { + v2.CatalogService = (function() { /** - * Constructs a new PredictionService service. + * Constructs a new CatalogService service. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PredictionService + * @classdesc Represents a CatalogService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + function CatalogService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + (CatalogService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CatalogService; /** - * Creates new PredictionService service using the specified rpc implementation. + * Creates new CatalogService service using the specified rpc implementation. * @function create - * @memberof google.cloud.retail.v2.PredictionService + * @memberof google.cloud.retail.v2.CatalogService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + * @returns {CatalogService} RPC service. Useful where requests and/or responses are streamed. */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + CatalogService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.cloud.retail.v2.PredictionService|predict}. - * @memberof google.cloud.retail.v2.PredictionService - * @typedef PredictCallback + * Callback as used by {@link google.cloud.retail.v2.CatalogService|listCatalogs}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef ListCatalogsCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.PredictResponse} [response] PredictResponse + * @param {google.cloud.retail.v2.ListCatalogsResponse} [response] ListCatalogsResponse */ /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2.PredictionService + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService * @instance - * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.ListCatalogsCallback} callback Node-style callback called with the error, if any, and ListCatalogsResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2.PredictRequest, $root.google.cloud.retail.v2.PredictResponse, request, callback); - }, "name", { value: "Predict" }); + Object.defineProperty(CatalogService.prototype.listCatalogs = function listCatalogs(request, callback) { + return this.rpcCall(listCatalogs, $root.google.cloud.retail.v2.ListCatalogsRequest, $root.google.cloud.retail.v2.ListCatalogsResponse, request, callback); + }, "name", { value: "ListCatalogs" }); /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2.PredictionService + * Calls ListCatalogs. + * @function listCatalogs + * @memberof google.cloud.retail.v2.CatalogService * @instance - * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.retail.v2.IListCatalogsRequest} request ListCatalogsRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return PredictionService; - })(); + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCatalog}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef UpdateCatalogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Catalog} [response] Catalog + */ - v2.PredictRequest = (function() { + /** + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.UpdateCatalogCallback} callback Node-style callback called with the error, if any, and Catalog + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateCatalog = function updateCatalog(request, callback) { + return this.rpcCall(updateCatalog, $root.google.cloud.retail.v2.UpdateCatalogRequest, $root.google.cloud.retail.v2.Catalog, request, callback); + }, "name", { value: "UpdateCatalog" }); /** - * Properties of a PredictRequest. - * @memberof google.cloud.retail.v2 - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * Calls UpdateCatalog. + * @function updateCatalog + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} request UpdateCatalogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ /** - * Constructs a new PredictRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest - * @constructor - * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + * Callback as used by {@link google.cloud.retail.v2.CatalogService|setDefaultBranch}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef SetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2.PredictRequest + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.SetDefaultBranchCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.placement = ""; + Object.defineProperty(CatalogService.prototype.setDefaultBranch = function setDefaultBranch(request, callback) { + return this.rpcCall(setDefaultBranch, $root.google.cloud.retail.v2.SetDefaultBranchRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SetDefaultBranch" }); /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2.PredictRequest + * Calls SetDefaultBranch. + * @function setDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} request SetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.userEvent = null; /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.PredictRequest + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getDefaultBranch}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef GetDefaultBranchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.GetDefaultBranchResponse} [response] GetDefaultBranchResponse + */ + + /** + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.GetDefaultBranchCallback} callback Node-style callback called with the error, if any, and GetDefaultBranchResponse + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.pageSize = 0; + Object.defineProperty(CatalogService.prototype.getDefaultBranch = function getDefaultBranch(request, callback) { + return this.rpcCall(getDefaultBranch, $root.google.cloud.retail.v2.GetDefaultBranchRequest, $root.google.cloud.retail.v2.GetDefaultBranchResponse, request, callback); + }, "name", { value: "GetDefaultBranch" }); /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.PredictRequest + * Calls GetDefaultBranch. + * @function getDefaultBranch + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} request GetDefaultBranchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.pageToken = ""; /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.PredictRequest + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getCompletionConfig}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef GetCompletionConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.CompletionConfig} [response] CompletionConfig + */ + + /** + * Calls GetCompletionConfig. + * @function getCompletionConfig + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IGetCompletionConfigRequest} request GetCompletionConfigRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.GetCompletionConfigCallback} callback Node-style callback called with the error, if any, and CompletionConfig + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.filter = ""; + Object.defineProperty(CatalogService.prototype.getCompletionConfig = function getCompletionConfig(request, callback) { + return this.rpcCall(getCompletionConfig, $root.google.cloud.retail.v2.GetCompletionConfigRequest, $root.google.cloud.retail.v2.CompletionConfig, request, callback); + }, "name", { value: "GetCompletionConfig" }); /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2.PredictRequest + * Calls GetCompletionConfig. + * @function getCompletionConfig + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IGetCompletionConfigRequest} request GetCompletionConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.validateOnly = false; /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2.PredictRequest + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateCompletionConfig}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef UpdateCompletionConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.CompletionConfig} [response] CompletionConfig + */ + + /** + * Calls UpdateCompletionConfig. + * @function updateCompletionConfig + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IUpdateCompletionConfigRequest} request UpdateCompletionConfigRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.UpdateCompletionConfigCallback} callback Node-style callback called with the error, if any, and CompletionConfig + * @returns {undefined} + * @variation 1 */ - PredictRequest.prototype.params = $util.emptyObject; + Object.defineProperty(CatalogService.prototype.updateCompletionConfig = function updateCompletionConfig(request, callback) { + return this.rpcCall(updateCompletionConfig, $root.google.cloud.retail.v2.UpdateCompletionConfigRequest, $root.google.cloud.retail.v2.CompletionConfig, request, callback); + }, "name", { value: "UpdateCompletionConfig" }); /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2.PredictRequest + * Calls UpdateCompletionConfig. + * @function updateCompletionConfig + * @memberof google.cloud.retail.v2.CatalogService * @instance + * @param {google.cloud.retail.v2.IUpdateCompletionConfigRequest} request UpdateCompletionConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - PredictRequest.prototype.labels = $util.emptyObject; /** - * Creates a new PredictRequest instance using the specified properties. + * Callback as used by {@link google.cloud.retail.v2.CatalogService|getAttributesConfig}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef GetAttributesConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls GetAttributesConfig. + * @function getAttributesConfig + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IGetAttributesConfigRequest} request GetAttributesConfigRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.GetAttributesConfigCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.getAttributesConfig = function getAttributesConfig(request, callback) { + return this.rpcCall(getAttributesConfig, $root.google.cloud.retail.v2.GetAttributesConfigRequest, $root.google.cloud.retail.v2.AttributesConfig, request, callback); + }, "name", { value: "GetAttributesConfig" }); + + /** + * Calls GetAttributesConfig. + * @function getAttributesConfig + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IGetAttributesConfigRequest} request GetAttributesConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|updateAttributesConfig}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef UpdateAttributesConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls UpdateAttributesConfig. + * @function updateAttributesConfig + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateAttributesConfigRequest} request UpdateAttributesConfigRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.UpdateAttributesConfigCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.updateAttributesConfig = function updateAttributesConfig(request, callback) { + return this.rpcCall(updateAttributesConfig, $root.google.cloud.retail.v2.UpdateAttributesConfigRequest, $root.google.cloud.retail.v2.AttributesConfig, request, callback); + }, "name", { value: "UpdateAttributesConfig" }); + + /** + * Calls UpdateAttributesConfig. + * @function updateAttributesConfig + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IUpdateAttributesConfigRequest} request UpdateAttributesConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|addCatalogAttribute}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef AddCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls AddCatalogAttribute. + * @function addCatalogAttribute + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IAddCatalogAttributeRequest} request AddCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.AddCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.addCatalogAttribute = function addCatalogAttribute(request, callback) { + return this.rpcCall(addCatalogAttribute, $root.google.cloud.retail.v2.AddCatalogAttributeRequest, $root.google.cloud.retail.v2.AttributesConfig, request, callback); + }, "name", { value: "AddCatalogAttribute" }); + + /** + * Calls AddCatalogAttribute. + * @function addCatalogAttribute + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IAddCatalogAttributeRequest} request AddCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|removeCatalogAttribute}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef RemoveCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls RemoveCatalogAttribute. + * @function removeCatalogAttribute + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IRemoveCatalogAttributeRequest} request RemoveCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.RemoveCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.removeCatalogAttribute = function removeCatalogAttribute(request, callback) { + return this.rpcCall(removeCatalogAttribute, $root.google.cloud.retail.v2.RemoveCatalogAttributeRequest, $root.google.cloud.retail.v2.AttributesConfig, request, callback); + }, "name", { value: "RemoveCatalogAttribute" }); + + /** + * Calls RemoveCatalogAttribute. + * @function removeCatalogAttribute + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IRemoveCatalogAttributeRequest} request RemoveCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.CatalogService|replaceCatalogAttribute}. + * @memberof google.cloud.retail.v2.CatalogService + * @typedef ReplaceCatalogAttributeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.AttributesConfig} [response] AttributesConfig + */ + + /** + * Calls ReplaceCatalogAttribute. + * @function replaceCatalogAttribute + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IReplaceCatalogAttributeRequest} request ReplaceCatalogAttributeRequest message or plain object + * @param {google.cloud.retail.v2.CatalogService.ReplaceCatalogAttributeCallback} callback Node-style callback called with the error, if any, and AttributesConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.replaceCatalogAttribute = function replaceCatalogAttribute(request, callback) { + return this.rpcCall(replaceCatalogAttribute, $root.google.cloud.retail.v2.ReplaceCatalogAttributeRequest, $root.google.cloud.retail.v2.AttributesConfig, request, callback); + }, "name", { value: "ReplaceCatalogAttribute" }); + + /** + * Calls ReplaceCatalogAttribute. + * @function replaceCatalogAttribute + * @memberof google.cloud.retail.v2.CatalogService + * @instance + * @param {google.cloud.retail.v2.IReplaceCatalogAttributeRequest} request ReplaceCatalogAttributeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CatalogService; + })(); + + v2.ListCatalogsRequest = (function() { + + /** + * Properties of a ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @interface IListCatalogsRequest + * @property {string|null} [parent] ListCatalogsRequest parent + * @property {number|null} [pageSize] ListCatalogsRequest pageSize + * @property {string|null} [pageToken] ListCatalogsRequest pageToken + */ + + /** + * Constructs a new ListCatalogsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListCatalogsRequest. + * @implements IListCatalogsRequest + * @constructor + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + */ + function ListCatalogsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCatalogsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.parent = ""; + + /** + * ListCatalogsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageSize = 0; + + /** + * ListCatalogsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListCatalogsRequest + * @instance + */ + ListCatalogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListCatalogsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2.IListCatalogsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + ListCatalogsRequest.create = function create(properties) { + return new ListCatalogsRequest(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + ListCatalogsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * Encodes the specified ListCatalogsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsRequest} message ListCatalogsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a ListCatalogsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + ListCatalogsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.placement = reader.string(); + message.parent = reader.string(); break; } case 2: { - message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); - break; - } - case 3: { message.pageSize = reader.int32(); break; } - case 4: { + case 3: { message.pageToken = reader.string(); break; } - case 5: { - message.filter = reader.string(); - break; - } - case 6: { - message.validateOnly = reader.bool(); - break; - } - case 7: { - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; - break; - } - case 8: { - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - } default: reader.skipType(tag & 7); break; @@ -14345,223 +16173,141 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies a ListCatalogsRequest message. * @function verify - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + ListCatalogsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; if (message.pageSize != null && message.hasOwnProperty("pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; if (message.pageToken != null && message.hasOwnProperty("pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; - } - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; - } return null; }; /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2.ListCatalogsRequest} ListCatalogsRequest */ - PredictRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PredictRequest) + ListCatalogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsRequest) return object; - var message = new $root.google.cloud.retail.v2.PredictRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.userEvent != null) { - if (typeof object.userEvent !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.userEvent: object expected"); - message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); - } + var message = new $root.google.cloud.retail.v2.ListCatalogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); if (object.pageSize != null) message.pageSize = object.pageSize | 0; if (object.pageToken != null) message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); - if (object.params) { - if (typeof object.params !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); - message.params = {}; - for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { - if (typeof object.params[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); - message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); - } - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2.PredictRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); - } return message; }; /** - * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static - * @param {google.cloud.retail.v2.PredictRequest} message PredictRequest + * @param {google.cloud.retail.v2.ListCatalogsRequest} message ListCatalogsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictRequest.toObject = function toObject(message, options) { + ListCatalogsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) { - object.params = {}; - object.labels = {}; - } if (options.defaults) { - object.placement = ""; - object.userEvent = null; + object.parent = ""; object.pageSize = 0; object.pageToken = ""; - object.filter = ""; - object.validateOnly = false; } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) - object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; if (message.pageSize != null && message.hasOwnProperty("pageSize")) object.pageSize = message.pageSize; if (message.pageToken != null && message.hasOwnProperty("pageToken")) object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; - var keys2; - if (message.params && (keys2 = Object.keys(message.params)).length) { - object.params = {}; - for (var j = 0; j < keys2.length; ++j) - object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); - } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; - } return object; }; /** - * Converts this PredictRequest to JSON. + * Converts this ListCatalogsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @instance * @returns {Object.} JSON object */ - PredictRequest.prototype.toJSON = function toJSON() { + ListCatalogsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PredictRequest + * Gets the default type url for ListCatalogsRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.PredictRequest + * @memberof google.cloud.retail.v2.ListCatalogsRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListCatalogsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.PredictRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.ListCatalogsRequest"; }; - return PredictRequest; + return ListCatalogsRequest; })(); - v2.PredictResponse = (function() { + v2.ListCatalogsResponse = (function() { /** - * Properties of a PredictResponse. + * Properties of a ListCatalogsResponse. * @memberof google.cloud.retail.v2 - * @interface IPredictResponse - * @property {Array.|null} [results] PredictResponse results - * @property {string|null} [attributionToken] PredictResponse attributionToken - * @property {Array.|null} [missingIds] PredictResponse missingIds - * @property {boolean|null} [validateOnly] PredictResponse validateOnly + * @interface IListCatalogsResponse + * @property {Array.|null} [catalogs] ListCatalogsResponse catalogs + * @property {string|null} [nextPageToken] ListCatalogsResponse nextPageToken */ /** - * Constructs a new PredictResponse. + * Constructs a new ListCatalogsResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a PredictResponse. - * @implements IPredictResponse + * @classdesc Represents a ListCatalogsResponse. + * @implements IListCatalogsResponse * @constructor - * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set */ - function PredictResponse(properties) { - this.results = []; - this.missingIds = []; + function ListCatalogsResponse(properties) { + this.catalogs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14569,123 +16315,92 @@ } /** - * PredictResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2.PredictResponse - * @instance - */ - PredictResponse.prototype.results = $util.emptyArray; - - /** - * PredictResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.PredictResponse - * @instance - */ - PredictResponse.prototype.attributionToken = ""; - - /** - * PredictResponse missingIds. - * @member {Array.} missingIds - * @memberof google.cloud.retail.v2.PredictResponse + * ListCatalogsResponse catalogs. + * @member {Array.} catalogs + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance */ - PredictResponse.prototype.missingIds = $util.emptyArray; + ListCatalogsResponse.prototype.catalogs = $util.emptyArray; /** - * PredictResponse validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2.PredictResponse + * ListCatalogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance */ - PredictResponse.prototype.validateOnly = false; + ListCatalogsResponse.prototype.nextPageToken = ""; /** - * Creates a new PredictResponse instance using the specified properties. + * Creates a new ListCatalogsResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse instance + * @param {google.cloud.retail.v2.IListCatalogsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse instance */ - PredictResponse.create = function create(properties) { - return new PredictResponse(properties); + ListCatalogsResponse.create = function create(properties) { + return new ListCatalogsResponse(properties); }; /** - * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encode = function encode(message, writer) { + ListCatalogsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); - if (message.missingIds != null && message.missingIds.length) - for (var i = 0; i < message.missingIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.catalogs != null && message.catalogs.length) + for (var i = 0; i < message.catalogs.length; ++i) + $root.google.cloud.retail.v2.Catalog.encode(message.catalogs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * Encodes the specified ListCatalogsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListCatalogsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListCatalogsResponse} message ListCatalogsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListCatalogsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictResponse message from the specified reader or buffer. + * Decodes a ListCatalogsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decode = function decode(reader, length) { + ListCatalogsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + if (!(message.catalogs && message.catalogs.length)) + message.catalogs = []; + message.catalogs.push($root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32())); break; } case 2: { - message.attributionToken = reader.string(); - break; - } - case 3: { - if (!(message.missingIds && message.missingIds.length)) - message.missingIds = []; - message.missingIds.push(reader.string()); - break; - } - case 4: { - message.validateOnly = reader.bool(); + message.nextPageToken = reader.string(); break; } default: @@ -14697,847 +16412,149 @@ }; /** - * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * Decodes a ListCatalogsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictResponse.decodeDelimited = function decodeDelimited(reader) { + ListCatalogsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictResponse message. + * Verifies a ListCatalogsResponse message. * @function verify - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictResponse.verify = function verify(message) { + ListCatalogsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.verify(message.results[i]); + if (message.catalogs != null && message.hasOwnProperty("catalogs")) { + if (!Array.isArray(message.catalogs)) + return "catalogs: array expected"; + for (var i = 0; i < message.catalogs.length; ++i) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalogs[i]); if (error) - return "results." + error; + return "catalogs." + error; } } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.missingIds != null && message.hasOwnProperty("missingIds")) { - if (!Array.isArray(message.missingIds)) - return "missingIds: array expected"; - for (var i = 0; i < message.missingIds.length; ++i) - if (!$util.isString(message.missingIds[i])) - return "missingIds: string[] expected"; - } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListCatalogsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @returns {google.cloud.retail.v2.ListCatalogsResponse} ListCatalogsResponse */ - PredictResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PredictResponse) + ListCatalogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListCatalogsResponse) return object; - var message = new $root.google.cloud.retail.v2.PredictResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2.PredictResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2.PredictResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.fromObject(object.results[i]); + var message = new $root.google.cloud.retail.v2.ListCatalogsResponse(); + if (object.catalogs) { + if (!Array.isArray(object.catalogs)) + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: array expected"); + message.catalogs = []; + for (var i = 0; i < object.catalogs.length; ++i) { + if (typeof object.catalogs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListCatalogsResponse.catalogs: object expected"); + message.catalogs[i] = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalogs[i]); } } - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.missingIds) { - if (!Array.isArray(object.missingIds)) - throw TypeError(".google.cloud.retail.v2.PredictResponse.missingIds: array expected"); - message.missingIds = []; - for (var i = 0; i < object.missingIds.length; ++i) - message.missingIds[i] = String(object.missingIds[i]); - } - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListCatalogsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static - * @param {google.cloud.retail.v2.PredictResponse} message PredictResponse + * @param {google.cloud.retail.v2.ListCatalogsResponse} message ListCatalogsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PredictResponse.toObject = function toObject(message, options) { + ListCatalogsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.missingIds = []; - } - if (options.defaults) { - object.attributionToken = ""; - object.validateOnly = false; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.toObject(message.results[j], options); - } - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.missingIds && message.missingIds.length) { - object.missingIds = []; - for (var j = 0; j < message.missingIds.length; ++j) - object.missingIds[j] = message.missingIds[j]; + if (options.arrays || options.defaults) + object.catalogs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.catalogs && message.catalogs.length) { + object.catalogs = []; + for (var j = 0; j < message.catalogs.length; ++j) + object.catalogs[j] = $root.google.cloud.retail.v2.Catalog.toObject(message.catalogs[j], options); } - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this PredictResponse to JSON. + * Converts this ListCatalogsResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @instance * @returns {Object.} JSON object */ - PredictResponse.prototype.toJSON = function toJSON() { + ListCatalogsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PredictResponse + * Gets the default type url for ListCatalogsResponse * @function getTypeUrl - * @memberof google.cloud.retail.v2.PredictResponse + * @memberof google.cloud.retail.v2.ListCatalogsResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListCatalogsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.PredictResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.ListCatalogsResponse"; }; - PredictResponse.PredictionResult = (function() { - - /** - * Properties of a PredictionResult. - * @memberof google.cloud.retail.v2.PredictResponse - * @interface IPredictionResult - * @property {string|null} [id] PredictionResult id - * @property {Object.|null} [metadata] PredictionResult metadata - */ - - /** - * Constructs a new PredictionResult. - * @memberof google.cloud.retail.v2.PredictResponse - * @classdesc Represents a PredictionResult. - * @implements IPredictionResult - * @constructor - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set - */ - function PredictionResult(properties) { - this.metadata = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + return ListCatalogsResponse; + })(); - /** - * PredictionResult id. - * @member {string} id - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.id = ""; + v2.UpdateCatalogRequest = (function() { - /** - * PredictionResult metadata. - * @member {Object.} metadata - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @instance - */ - PredictionResult.prototype.metadata = $util.emptyObject; - - /** - * Creates a new PredictionResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult instance - */ - PredictionResult.create = function create(properties) { - return new PredictionResult(properties); - }; - - /** - * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.id = reader.string(); - break; - } - case 2: { - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PredictionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PredictionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PredictionResult message. - * @function verify - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PredictionResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); - if (error) - return "metadata." + error; - } - } - return null; - }; - - /** - * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult - */ - PredictionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PredictResponse.PredictionResult) - return object; - var message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(); - if (object.id != null) - message.id = String(object.id); - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { - if (typeof object.metadata[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); - message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {google.cloud.retail.v2.PredictResponse.PredictionResult} message PredictionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PredictionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.metadata = {}; - if (options.defaults) - object.id = ""; - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); - } - return object; - }; - - /** - * Converts this PredictionResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @instance - * @returns {Object.} JSON object - */ - PredictionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PredictionResult - * @function getTypeUrl - * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PredictionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.PredictResponse.PredictionResult"; - }; - - return PredictionResult; - })(); - - return PredictResponse; - })(); - - v2.ProductService = (function() { - - /** - * Constructs a new ProductService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a ProductService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ProductService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; - - /** - * Creates new ProductService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.ProductService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. - */ - ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|createProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.retail.v2.CreateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); - }, "name", { value: "CreateProduct" }); - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|getProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Product} [response] Product - */ - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.retail.v2.GetProductRequest, $root.google.cloud.retail.v2.Product, request, callback); - }, "name", { value: "GetProduct" }); - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|listProducts}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.ListProductsResponse} [response] ListProductsResponse - */ - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.retail.v2.ListProductsRequest, $root.google.cloud.retail.v2.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|updateProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.Product} [response] Product - */ - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.retail.v2.UpdateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|deleteProduct}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|importProducts}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef ImportProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { - return this.rpcCall(importProducts, $root.google.cloud.retail.v2.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProducts" }); - - /** - * Calls ImportProducts. - * @function importProducts - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|setInventory}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef SetInventoryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { - return this.rpcCall(setInventory, $root.google.cloud.retail.v2.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "SetInventory" }); - - /** - * Calls SetInventory. - * @function setInventory - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.ISetInventoryRequest} request SetInventoryRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|addFulfillmentPlaces}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef AddFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { - return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddFulfillmentPlaces" }); - - /** - * Calls AddFulfillmentPlaces. - * @function addFulfillmentPlaces - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|removeFulfillmentPlaces}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef RemoveFulfillmentPlacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { - return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveFulfillmentPlaces" }); - - /** - * Calls RemoveFulfillmentPlaces. - * @function removeFulfillmentPlaces - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|addLocalInventories}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef AddLocalInventoriesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AddLocalInventories. - * @function addLocalInventories - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { - return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AddLocalInventories" }); - - /** - * Calls AddLocalInventories. - * @function addLocalInventories - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.retail.v2.ProductService|removeLocalInventories}. - * @memberof google.cloud.retail.v2.ProductService - * @typedef RemoveLocalInventoriesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls RemoveLocalInventories. - * @function removeLocalInventories - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object - * @param {google.cloud.retail.v2.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { - return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "RemoveLocalInventories" }); - - /** - * Calls RemoveLocalInventories. - * @function removeLocalInventories - * @memberof google.cloud.retail.v2.ProductService - * @instance - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductService; - })(); - - v2.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.retail.v2 - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.retail.v2.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ + /** + * Properties of an UpdateCatalogRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateCatalogRequest + * @property {google.cloud.retail.v2.ICatalog|null} [catalog] UpdateCatalogRequest catalog + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCatalogRequest updateMask + */ /** - * Constructs a new CreateProductRequest. + * Constructs a new UpdateCatalogRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest + * @classdesc Represents an UpdateCatalogRequest. + * @implements IUpdateCatalogRequest * @constructor - * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set */ - function CreateProductRequest(properties) { + function UpdateCatalogRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15545,103 +16562,89 @@ } /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.CreateProductRequest + * UpdateCatalogRequest catalog. + * @member {google.cloud.retail.v2.ICatalog|null|undefined} catalog + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance */ - CreateProductRequest.prototype.product = null; + UpdateCatalogRequest.prototype.catalog = null; /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.retail.v2.CreateProductRequest + * UpdateCatalogRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance */ - CreateProductRequest.prototype.productId = ""; + UpdateCatalogRequest.prototype.updateMask = null; /** - * Creates a new CreateProductRequest instance using the specified properties. + * Creates a new UpdateCatalogRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest instance + * @param {google.cloud.retail.v2.IUpdateCatalogRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest instance */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); + UpdateCatalogRequest.create = function create(properties) { + return new UpdateCatalogRequest(properties); }; /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encode = function encode(message, writer) { + UpdateCatalogRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.google.cloud.retail.v2.Catalog.encode(message.catalog, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * Encodes the specified UpdateCatalogRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCatalogRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCatalogRequest} message UpdateCatalogRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + UpdateCatalogRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decode = function decode(reader, length) { + UpdateCatalogRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.parent = reader.string(); + message.catalog = $root.google.cloud.retail.v2.Catalog.decode(reader, reader.uint32()); break; } case 2: { - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productId = reader.string(); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } default: @@ -15653,144 +16656,144 @@ }; /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * Decodes an UpdateCatalogRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + UpdateCatalogRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateProductRequest message. + * Verifies an UpdateCatalogRequest message. * @function verify - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateProductRequest.verify = function verify(message) { + UpdateCatalogRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.google.cloud.retail.v2.Catalog.verify(message.catalog); if (error) - return "product." + error; + return "catalog." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; return null; }; /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCatalogRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @returns {google.cloud.retail.v2.UpdateCatalogRequest} UpdateCatalogRequest */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.CreateProductRequest) + UpdateCatalogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateCatalogRequest) return object; - var message = new $root.google.cloud.retail.v2.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + var message = new $root.google.cloud.retail.v2.UpdateCatalogRequest(); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.catalog: object expected"); + message.catalog = $root.google.cloud.retail.v2.Catalog.fromObject(object.catalog); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCatalogRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } - if (object.productId != null) - message.productId = String(object.productId); return message; }; /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from an UpdateCatalogRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static - * @param {google.cloud.retail.v2.CreateProductRequest} message CreateProductRequest + * @param {google.cloud.retail.v2.UpdateCatalogRequest} message UpdateCatalogRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateProductRequest.toObject = function toObject(message, options) { + UpdateCatalogRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; + object.catalog = null; + object.updateMask = null; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.google.cloud.retail.v2.Catalog.toObject(message.catalog, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this CreateProductRequest to JSON. + * Converts this UpdateCatalogRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @instance * @returns {Object.} JSON object */ - CreateProductRequest.prototype.toJSON = function toJSON() { + UpdateCatalogRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CreateProductRequest + * Gets the default type url for UpdateCatalogRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.CreateProductRequest + * @memberof google.cloud.retail.v2.UpdateCatalogRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + UpdateCatalogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.CreateProductRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateCatalogRequest"; }; - return CreateProductRequest; + return UpdateCatalogRequest; })(); - v2.GetProductRequest = (function() { + v2.SetDefaultBranchRequest = (function() { /** - * Properties of a GetProductRequest. + * Properties of a SetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name + * @interface ISetDefaultBranchRequest + * @property {string|null} [catalog] SetDefaultBranchRequest catalog + * @property {string|null} [branchId] SetDefaultBranchRequest branchId + * @property {string|null} [note] SetDefaultBranchRequest note + * @property {boolean|null} [force] SetDefaultBranchRequest force */ /** - * Constructs a new GetProductRequest. + * Constructs a new SetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest + * @classdesc Represents a SetDefaultBranchRequest. + * @implements ISetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set */ - function GetProductRequest(properties) { + function SetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15798,75 +16801,117 @@ } /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2.GetProductRequest + * SetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance */ - GetProductRequest.prototype.name = ""; + SetDefaultBranchRequest.prototype.catalog = ""; /** - * Creates a new GetProductRequest instance using the specified properties. + * SetDefaultBranchRequest branchId. + * @member {string} branchId + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.branchId = ""; + + /** + * SetDefaultBranchRequest note. + * @member {string} note + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.note = ""; + + /** + * SetDefaultBranchRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest + * @instance + */ + SetDefaultBranchRequest.prototype.force = false; + + /** + * Creates a new SetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest instance + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest instance */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); + SetDefaultBranchRequest.create = function create(properties) { + return new SetDefaultBranchRequest(properties); }; /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encode = function encode(message, writer) { + SetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.branchId != null && Object.hasOwnProperty.call(message, "branchId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branchId); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); return writer; }; /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * Encodes the specified SetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISetDefaultBranchRequest} message SetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + SetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetProductRequest message from the specified reader or buffer. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decode = function decode(reader, length) { + SetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.catalog = reader.string(); + break; + } + case 2: { + message.branchId = reader.string(); + break; + } + case 3: { + message.note = reader.string(); + break; + } + case 4: { + message.force = reader.bool(); break; } default: @@ -15878,124 +16923,147 @@ }; /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * Decodes a SetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + SetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetProductRequest message. + * Verifies a SetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetProductRequest.verify = function verify(message) { + SetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.branchId != null && message.hasOwnProperty("branchId")) + if (!$util.isString(message.branchId)) + return "branchId: string expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a SetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @returns {google.cloud.retail.v2.SetDefaultBranchRequest} SetDefaultBranchRequest */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.GetProductRequest) + SetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2.SetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.branchId != null) + message.branchId = String(object.branchId); + if (object.note != null) + message.note = String(object.note); + if (object.force != null) + message.force = Boolean(object.force); return message; }; /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a SetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.GetProductRequest} message GetProductRequest + * @param {google.cloud.retail.v2.SetDefaultBranchRequest} message SetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetProductRequest.toObject = function toObject(message, options) { + SetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.catalog = ""; + object.branchId = ""; + object.note = ""; + object.force = false; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.branchId != null && message.hasOwnProperty("branchId")) + object.branchId = message.branchId; + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; /** - * Converts this GetProductRequest to JSON. + * Converts this SetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - GetProductRequest.prototype.toJSON = function toJSON() { + SetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GetProductRequest + * Gets the default type url for SetDefaultBranchRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.GetProductRequest + * @memberof google.cloud.retail.v2.SetDefaultBranchRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + SetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.GetProductRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.SetDefaultBranchRequest"; }; - return GetProductRequest; + return SetDefaultBranchRequest; })(); - v2.UpdateProductRequest = (function() { + v2.GetDefaultBranchRequest = (function() { /** - * Properties of an UpdateProductRequest. + * Properties of a GetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @interface IUpdateProductRequest - * @property {google.cloud.retail.v2.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing + * @interface IGetDefaultBranchRequest + * @property {string|null} [catalog] GetDefaultBranchRequest catalog */ /** - * Constructs a new UpdateProductRequest. + * Constructs a new GetDefaultBranchRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest + * @classdesc Represents a GetDefaultBranchRequest. + * @implements IGetDefaultBranchRequest * @constructor - * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set */ - function UpdateProductRequest(properties) { + function GetDefaultBranchRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16003,103 +17071,75 @@ } /** - * UpdateProductRequest product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.retail.v2.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.updateMask = null; - - /** - * UpdateProductRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.UpdateProductRequest + * GetDefaultBranchRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @instance */ - UpdateProductRequest.prototype.allowMissing = false; + GetDefaultBranchRequest.prototype.catalog = ""; /** - * Creates a new UpdateProductRequest instance using the specified properties. + * Creates a new GetDefaultBranchRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest instance + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest instance */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); + GetDefaultBranchRequest.create = function create(properties) { + return new GetDefaultBranchRequest(properties); }; /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchRequest message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encode = function encode(message, writer) { + GetDefaultBranchRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); return writer; }; /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchRequest} message GetDefaultBranchRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decode = function decode(reader, length) { + GetDefaultBranchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - case 3: { - message.allowMissing = reader.bool(); + message.catalog = reader.string(); break; } default: @@ -16111,149 +17151,124 @@ }; /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateProductRequest message. + * Verifies a GetDefaultBranchRequest message. * @function verify - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateProductRequest.verify = function verify(message) { + GetDefaultBranchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; return null; }; /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchRequest} GetDefaultBranchRequest */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.UpdateProductRequest) + GetDefaultBranchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchRequest) return object; - var message = new $root.google.cloud.retail.v2.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + var message = new $root.google.cloud.retail.v2.GetDefaultBranchRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); return message; }; /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static - * @param {google.cloud.retail.v2.UpdateProductRequest} message UpdateProductRequest + * @param {google.cloud.retail.v2.GetDefaultBranchRequest} message GetDefaultBranchRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateProductRequest.toObject = function toObject(message, options) { + GetDefaultBranchRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (options.defaults) + object.catalog = ""; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; return object; }; /** - * Converts this UpdateProductRequest to JSON. + * Converts this GetDefaultBranchRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @instance * @returns {Object.} JSON object */ - UpdateProductRequest.prototype.toJSON = function toJSON() { + GetDefaultBranchRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for UpdateProductRequest + * Gets the default type url for GetDefaultBranchRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.UpdateProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetDefaultBranchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.UpdateProductRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.GetDefaultBranchRequest"; }; - return UpdateProductRequest; + return GetDefaultBranchRequest; })(); - v2.DeleteProductRequest = (function() { + v2.GetDefaultBranchResponse = (function() { /** - * Properties of a DeleteProductRequest. + * Properties of a GetDefaultBranchResponse. * @memberof google.cloud.retail.v2 - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name + * @interface IGetDefaultBranchResponse + * @property {string|null} [branch] GetDefaultBranchResponse branch + * @property {google.protobuf.ITimestamp|null} [setTime] GetDefaultBranchResponse setTime + * @property {string|null} [note] GetDefaultBranchResponse note */ /** - * Constructs a new DeleteProductRequest. + * Constructs a new GetDefaultBranchResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest + * @classdesc Represents a GetDefaultBranchResponse. + * @implements IGetDefaultBranchResponse * @constructor - * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set */ - function DeleteProductRequest(properties) { + function GetDefaultBranchResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16261,75 +17276,103 @@ } /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.retail.v2.DeleteProductRequest + * GetDefaultBranchResponse branch. + * @member {string} branch + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance */ - DeleteProductRequest.prototype.name = ""; + GetDefaultBranchResponse.prototype.branch = ""; /** - * Creates a new DeleteProductRequest instance using the specified properties. + * GetDefaultBranchResponse setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.setTime = null; + + /** + * GetDefaultBranchResponse note. + * @member {string} note + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse + * @instance + */ + GetDefaultBranchResponse.prototype.note = ""; + + /** + * Creates a new GetDefaultBranchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest instance + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse instance */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); + GetDefaultBranchResponse.create = function create(properties) { + return new GetDefaultBranchResponse(properties); }; /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encode = function encode(message, writer) { + GetDefaultBranchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.branch); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.note); return writer; }; /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * Encodes the specified GetDefaultBranchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetDefaultBranchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetDefaultBranchResponse} message GetDefaultBranchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetDefaultBranchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decode = function decode(reader, length) { + GetDefaultBranchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteProductRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.branch = reader.string(); + break; + } + case 2: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.note = reader.string(); break; } default: @@ -16341,126 +17384,144 @@ }; /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * Decodes a GetDefaultBranchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + GetDefaultBranchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteProductRequest message. + * Verifies a GetDefaultBranchResponse message. * @function verify - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteProductRequest.verify = function verify(message) { + GetDefaultBranchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; return null; }; /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetDefaultBranchResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @returns {google.cloud.retail.v2.GetDefaultBranchResponse} GetDefaultBranchResponse */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.DeleteProductRequest) + GetDefaultBranchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetDefaultBranchResponse) return object; - var message = new $root.google.cloud.retail.v2.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.retail.v2.GetDefaultBranchResponse(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2.GetDefaultBranchResponse.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.note != null) + message.note = String(object.note); return message; }; /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetDefaultBranchResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static - * @param {google.cloud.retail.v2.DeleteProductRequest} message DeleteProductRequest + * @param {google.cloud.retail.v2.GetDefaultBranchResponse} message GetDefaultBranchResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteProductRequest.toObject = function toObject(message, options) { + GetDefaultBranchResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.branch = ""; + object.setTime = null; + object.note = ""; + } + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; return object; }; /** - * Converts this DeleteProductRequest to JSON. + * Converts this GetDefaultBranchResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @instance * @returns {Object.} JSON object */ - DeleteProductRequest.prototype.toJSON = function toJSON() { + GetDefaultBranchResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for DeleteProductRequest + * Gets the default type url for GetDefaultBranchResponse * @function getTypeUrl - * @memberof google.cloud.retail.v2.DeleteProductRequest + * @memberof google.cloud.retail.v2.GetDefaultBranchResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetDefaultBranchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.DeleteProductRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.GetDefaultBranchResponse"; }; - return DeleteProductRequest; + return GetDefaultBranchResponse; })(); - v2.ListProductsRequest = (function() { + v2.GetCompletionConfigRequest = (function() { /** - * Properties of a ListProductsRequest. + * Properties of a GetCompletionConfigRequest. * @memberof google.cloud.retail.v2 - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - * @property {string|null} [filter] ListProductsRequest filter - * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + * @interface IGetCompletionConfigRequest + * @property {string|null} [name] GetCompletionConfigRequest name */ /** - * Constructs a new ListProductsRequest. + * Constructs a new GetCompletionConfigRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest + * @classdesc Represents a GetCompletionConfigRequest. + * @implements IGetCompletionConfigRequest * @constructor - * @param {google.cloud.retail.v2.IListProductsRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetCompletionConfigRequest=} [properties] Properties to set */ - function ListProductsRequest(properties) { + function GetCompletionConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16468,131 +17529,75 @@ } /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; - - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; - - /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageToken = ""; - - /** - * ListProductsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.filter = ""; - - /** - * ListProductsRequest readMask. - * @member {google.protobuf.IFieldMask|null|undefined} readMask - * @memberof google.cloud.retail.v2.ListProductsRequest + * GetCompletionConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @instance */ - ListProductsRequest.prototype.readMask = null; + GetCompletionConfigRequest.prototype.name = ""; /** - * Creates a new ListProductsRequest instance using the specified properties. + * Creates a new GetCompletionConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest instance + * @param {google.cloud.retail.v2.IGetCompletionConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetCompletionConfigRequest} GetCompletionConfigRequest instance */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); + GetCompletionConfigRequest.create = function create(properties) { + return new GetCompletionConfigRequest(properties); }; /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. + * Encodes the specified GetCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.GetCompletionConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetCompletionConfigRequest} message GetCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsRequest.encode = function encode(message, writer) { + GetCompletionConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) - $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. + * Encodes the specified GetCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetCompletionConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetCompletionConfigRequest} message GetCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetCompletionConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2.GetCompletionConfigRequest} GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decode = function decode(reader, length) { + GetCompletionConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListProductsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetCompletionConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.filter = reader.string(); - break; - } - case 5: { - message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.name = reader.string(); break; } default: @@ -16604,162 +17609,123 @@ }; /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * Decodes a GetCompletionConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2.GetCompletionConfigRequest} GetCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + GetCompletionConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsRequest message. + * Verifies a GetCompletionConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsRequest.verify = function verify(message) { + GetCompletionConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.readMask != null && message.hasOwnProperty("readMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.readMask); - if (error) - return "readMask." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest + * @returns {google.cloud.retail.v2.GetCompletionConfigRequest} GetCompletionConfigRequest */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListProductsRequest) + GetCompletionConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetCompletionConfigRequest) return object; - var message = new $root.google.cloud.retail.v2.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.readMask != null) { - if (typeof object.readMask !== "object") - throw TypeError(".google.cloud.retail.v2.ListProductsRequest.readMask: object expected"); - message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); - } + var message = new $root.google.cloud.retail.v2.GetCompletionConfigRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetCompletionConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.ListProductsRequest} message ListProductsRequest + * @param {google.cloud.retail.v2.GetCompletionConfigRequest} message GetCompletionConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsRequest.toObject = function toObject(message, options) { + GetCompletionConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.readMask = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.readMask != null && message.hasOwnProperty("readMask")) - object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this ListProductsRequest to JSON. + * Converts this GetCompletionConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @instance * @returns {Object.} JSON object */ - ListProductsRequest.prototype.toJSON = function toJSON() { + GetCompletionConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListProductsRequest + * Gets the default type url for GetCompletionConfigRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.ListProductsRequest + * @memberof google.cloud.retail.v2.GetCompletionConfigRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetCompletionConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.ListProductsRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.GetCompletionConfigRequest"; }; - return ListProductsRequest; + return GetCompletionConfigRequest; })(); - v2.ListProductsResponse = (function() { + v2.UpdateCompletionConfigRequest = (function() { /** - * Properties of a ListProductsResponse. + * Properties of an UpdateCompletionConfigRequest. * @memberof google.cloud.retail.v2 - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + * @interface IUpdateCompletionConfigRequest + * @property {google.cloud.retail.v2.ICompletionConfig|null} [completionConfig] UpdateCompletionConfigRequest completionConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCompletionConfigRequest updateMask */ /** - * Constructs a new ListProductsResponse. + * Constructs a new UpdateCompletionConfigRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse + * @classdesc Represents an UpdateCompletionConfigRequest. + * @implements IUpdateCompletionConfigRequest * @constructor - * @param {google.cloud.retail.v2.IListProductsResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUpdateCompletionConfigRequest=} [properties] Properties to set */ - function ListProductsResponse(properties) { - this.products = []; + function UpdateCompletionConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16767,92 +17733,89 @@ } /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.retail.v2.ListProductsResponse + * UpdateCompletionConfigRequest completionConfig. + * @member {google.cloud.retail.v2.ICompletionConfig|null|undefined} completionConfig + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @instance */ - ListProductsResponse.prototype.products = $util.emptyArray; + UpdateCompletionConfigRequest.prototype.completionConfig = null; /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2.ListProductsResponse + * UpdateCompletionConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @instance */ - ListProductsResponse.prototype.nextPageToken = ""; + UpdateCompletionConfigRequest.prototype.updateMask = null; /** - * Creates a new ListProductsResponse instance using the specified properties. + * Creates a new UpdateCompletionConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse instance + * @param {google.cloud.retail.v2.IUpdateCompletionConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest instance */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); + UpdateCompletionConfigRequest.create = function create(properties) { + return new UpdateCompletionConfigRequest(properties); }; /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. + * Encodes the specified UpdateCompletionConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateCompletionConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCompletionConfigRequest} message UpdateCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encode = function encode(message, writer) { + UpdateCompletionConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.completionConfig != null && Object.hasOwnProperty.call(message, "completionConfig")) + $root.google.cloud.retail.v2.CompletionConfig.encode(message.completionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. + * Encodes the specified UpdateCompletionConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateCompletionConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateCompletionConfigRequest} message UpdateCompletionConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + UpdateCompletionConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decode = function decode(reader, length) { + UpdateCompletionConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListProductsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateCompletionConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + message.completionConfig = $root.google.cloud.retail.v2.CompletionConfig.decode(reader, reader.uint32()); break; } case 2: { - message.nextPageToken = reader.string(); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } default: @@ -16864,151 +17827,141 @@ }; /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * Decodes an UpdateCompletionConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + UpdateCompletionConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListProductsResponse message. + * Verifies an UpdateCompletionConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListProductsResponse.verify = function verify(message) { + UpdateCompletionConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); - if (error) - return "products." + error; - } + if (message.completionConfig != null && message.hasOwnProperty("completionConfig")) { + var error = $root.google.cloud.retail.v2.CompletionConfig.verify(message.completionConfig); + if (error) + return "completionConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; return null; }; /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateCompletionConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse + * @returns {google.cloud.retail.v2.UpdateCompletionConfigRequest} UpdateCompletionConfigRequest */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.ListProductsResponse) + UpdateCompletionConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateCompletionConfigRequest) return object; - var message = new $root.google.cloud.retail.v2.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.retail.v2.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.retail.v2.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); - } + var message = new $root.google.cloud.retail.v2.UpdateCompletionConfigRequest(); + if (object.completionConfig != null) { + if (typeof object.completionConfig !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCompletionConfigRequest.completionConfig: object expected"); + message.completionConfig = $root.google.cloud.retail.v2.CompletionConfig.fromObject(object.completionConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateCompletionConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * Creates a plain object from an UpdateCompletionConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static - * @param {google.cloud.retail.v2.ListProductsResponse} message ListProductsResponse + * @param {google.cloud.retail.v2.UpdateCompletionConfigRequest} message UpdateCompletionConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListProductsResponse.toObject = function toObject(message, options) { + UpdateCompletionConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); + if (options.defaults) { + object.completionConfig = null; + object.updateMask = null; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; + if (message.completionConfig != null && message.hasOwnProperty("completionConfig")) + object.completionConfig = $root.google.cloud.retail.v2.CompletionConfig.toObject(message.completionConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; /** - * Converts this ListProductsResponse to JSON. + * Converts this UpdateCompletionConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @instance * @returns {Object.} JSON object */ - ListProductsResponse.prototype.toJSON = function toJSON() { + UpdateCompletionConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListProductsResponse + * Gets the default type url for UpdateCompletionConfigRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.ListProductsResponse + * @memberof google.cloud.retail.v2.UpdateCompletionConfigRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + UpdateCompletionConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.ListProductsResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateCompletionConfigRequest"; }; - return ListProductsResponse; + return UpdateCompletionConfigRequest; })(); - v2.SetInventoryRequest = (function() { + v2.GetAttributesConfigRequest = (function() { /** - * Properties of a SetInventoryRequest. + * Properties of a GetAttributesConfigRequest. * @memberof google.cloud.retail.v2 - * @interface ISetInventoryRequest - * @property {google.cloud.retail.v2.IProduct|null} [inventory] SetInventoryRequest inventory - * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask - * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime - * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + * @interface IGetAttributesConfigRequest + * @property {string|null} [name] GetAttributesConfigRequest name */ /** - * Constructs a new SetInventoryRequest. + * Constructs a new GetAttributesConfigRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SetInventoryRequest. - * @implements ISetInventoryRequest + * @classdesc Represents a GetAttributesConfigRequest. + * @implements IGetAttributesConfigRequest * @constructor - * @param {google.cloud.retail.v2.ISetInventoryRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetAttributesConfigRequest=} [properties] Properties to set */ - function SetInventoryRequest(properties) { + function GetAttributesConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17016,117 +17969,75 @@ } /** - * SetInventoryRequest inventory. - * @member {google.cloud.retail.v2.IProduct|null|undefined} inventory - * @memberof google.cloud.retail.v2.SetInventoryRequest - * @instance - */ - SetInventoryRequest.prototype.inventory = null; - - /** - * SetInventoryRequest setMask. - * @member {google.protobuf.IFieldMask|null|undefined} setMask - * @memberof google.cloud.retail.v2.SetInventoryRequest - * @instance - */ - SetInventoryRequest.prototype.setMask = null; - - /** - * SetInventoryRequest setTime. - * @member {google.protobuf.ITimestamp|null|undefined} setTime - * @memberof google.cloud.retail.v2.SetInventoryRequest - * @instance - */ - SetInventoryRequest.prototype.setTime = null; - - /** - * SetInventoryRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.SetInventoryRequest + * GetAttributesConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @instance */ - SetInventoryRequest.prototype.allowMissing = false; + GetAttributesConfigRequest.prototype.name = ""; /** - * Creates a new SetInventoryRequest instance using the specified properties. + * Creates a new GetAttributesConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest instance + * @param {google.cloud.retail.v2.IGetAttributesConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetAttributesConfigRequest} GetAttributesConfigRequest instance */ - SetInventoryRequest.create = function create(properties) { - return new SetInventoryRequest(properties); + GetAttributesConfigRequest.create = function create(properties) { + return new GetAttributesConfigRequest(properties); }; /** - * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. + * Encodes the specified GetAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.GetAttributesConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetAttributesConfigRequest} message GetAttributesConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encode = function encode(message, writer) { + GetAttributesConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) - $root.google.cloud.retail.v2.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) - $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) - $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. + * Encodes the specified GetAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetAttributesConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetAttributesConfigRequest} message GetAttributesConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetAttributesConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2.GetAttributesConfigRequest} GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decode = function decode(reader, length) { + GetAttributesConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetAttributesConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.inventory = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - case 3: { - message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.allowMissing = reader.bool(); + message.name = reader.string(); break; } default: @@ -17138,161 +18049,123 @@ }; /** - * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * Decodes a GetAttributesConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2.GetAttributesConfigRequest} GetAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + GetAttributesConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryRequest message. + * Verifies a GetAttributesConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryRequest.verify = function verify(message) { + GetAttributesConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inventory != null && message.hasOwnProperty("inventory")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.inventory); - if (error) - return "inventory." + error; - } - if (message.setMask != null && message.hasOwnProperty("setMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.setMask); - if (error) - return "setMask." + error; - } - if (message.setTime != null && message.hasOwnProperty("setTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.setTime); - if (error) - return "setTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest + * @returns {google.cloud.retail.v2.GetAttributesConfigRequest} GetAttributesConfigRequest */ - SetInventoryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SetInventoryRequest) + GetAttributesConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetAttributesConfigRequest) return object; - var message = new $root.google.cloud.retail.v2.SetInventoryRequest(); - if (object.inventory != null) { - if (typeof object.inventory !== "object") - throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.inventory: object expected"); - message.inventory = $root.google.cloud.retail.v2.Product.fromObject(object.inventory); - } - if (object.setMask != null) { - if (typeof object.setMask !== "object") - throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.setMask: object expected"); - message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); - } - if (object.setTime != null) { - if (typeof object.setTime !== "object") - throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.setTime: object expected"); - message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + var message = new $root.google.cloud.retail.v2.GetAttributesConfigRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetAttributesConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.SetInventoryRequest} message SetInventoryRequest + * @param {google.cloud.retail.v2.GetAttributesConfigRequest} message GetAttributesConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryRequest.toObject = function toObject(message, options) { + GetAttributesConfigRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.inventory = null; - object.setMask = null; - object.setTime = null; - object.allowMissing = false; - } - if (message.inventory != null && message.hasOwnProperty("inventory")) - object.inventory = $root.google.cloud.retail.v2.Product.toObject(message.inventory, options); - if (message.setMask != null && message.hasOwnProperty("setMask")) - object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); - if (message.setTime != null && message.hasOwnProperty("setTime")) - object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this SetInventoryRequest to JSON. + * Converts this GetAttributesConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @instance * @returns {Object.} JSON object */ - SetInventoryRequest.prototype.toJSON = function toJSON() { + GetAttributesConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for SetInventoryRequest + * Gets the default type url for GetAttributesConfigRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.SetInventoryRequest + * @memberof google.cloud.retail.v2.GetAttributesConfigRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - SetInventoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetAttributesConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.GetAttributesConfigRequest"; }; - return SetInventoryRequest; + return GetAttributesConfigRequest; })(); - v2.SetInventoryMetadata = (function() { + v2.UpdateAttributesConfigRequest = (function() { /** - * Properties of a SetInventoryMetadata. + * Properties of an UpdateAttributesConfigRequest. * @memberof google.cloud.retail.v2 - * @interface ISetInventoryMetadata + * @interface IUpdateAttributesConfigRequest + * @property {google.cloud.retail.v2.IAttributesConfig|null} [attributesConfig] UpdateAttributesConfigRequest attributesConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAttributesConfigRequest updateMask */ /** - * Constructs a new SetInventoryMetadata. + * Constructs a new UpdateAttributesConfigRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SetInventoryMetadata. - * @implements ISetInventoryMetadata + * @classdesc Represents an UpdateAttributesConfigRequest. + * @implements IUpdateAttributesConfigRequest * @constructor - * @param {google.cloud.retail.v2.ISetInventoryMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUpdateAttributesConfigRequest=} [properties] Properties to set */ - function SetInventoryMetadata(properties) { + function UpdateAttributesConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17300,174 +18173,236 @@ } /** - * Creates a new SetInventoryMetadata instance using the specified properties. + * UpdateAttributesConfigRequest attributesConfig. + * @member {google.cloud.retail.v2.IAttributesConfig|null|undefined} attributesConfig + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest + * @instance + */ + UpdateAttributesConfigRequest.prototype.attributesConfig = null; + + /** + * UpdateAttributesConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest + * @instance + */ + UpdateAttributesConfigRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateAttributesConfigRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata instance + * @param {google.cloud.retail.v2.IUpdateAttributesConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest instance */ - SetInventoryMetadata.create = function create(properties) { - return new SetInventoryMetadata(properties); + UpdateAttributesConfigRequest.create = function create(properties) { + return new UpdateAttributesConfigRequest(properties); }; /** - * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified UpdateAttributesConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateAttributesConfigRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateAttributesConfigRequest} message UpdateAttributesConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encode = function encode(message, writer) { + UpdateAttributesConfigRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + $root.google.cloud.retail.v2.AttributesConfig.encode(message.attributesConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. + * Encodes the specified UpdateAttributesConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateAttributesConfigRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateAttributesConfigRequest} message UpdateAttributesConfigRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + UpdateAttributesConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decode = function decode(reader, length) { + UpdateAttributesConfigRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateAttributesConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } + case 1: { + message.attributesConfig = $root.google.cloud.retail.v2.AttributesConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } return message; }; /** - * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * Decodes an UpdateAttributesConfigRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + UpdateAttributesConfigRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryMetadata message. + * Verifies an UpdateAttributesConfigRequest message. * @function verify - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryMetadata.verify = function verify(message) { + UpdateAttributesConfigRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) { + var error = $root.google.cloud.retail.v2.AttributesConfig.verify(message.attributesConfig); + if (error) + return "attributesConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } return null; }; /** - * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateAttributesConfigRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata + * @returns {google.cloud.retail.v2.UpdateAttributesConfigRequest} UpdateAttributesConfigRequest */ - SetInventoryMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SetInventoryMetadata) + UpdateAttributesConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateAttributesConfigRequest) return object; - return new $root.google.cloud.retail.v2.SetInventoryMetadata(); + var message = new $root.google.cloud.retail.v2.UpdateAttributesConfigRequest(); + if (object.attributesConfig != null) { + if (typeof object.attributesConfig !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateAttributesConfigRequest.attributesConfig: object expected"); + message.attributesConfig = $root.google.cloud.retail.v2.AttributesConfig.fromObject(object.attributesConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateAttributesConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; }; /** - * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * Creates a plain object from an UpdateAttributesConfigRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static - * @param {google.cloud.retail.v2.SetInventoryMetadata} message SetInventoryMetadata + * @param {google.cloud.retail.v2.UpdateAttributesConfigRequest} message UpdateAttributesConfigRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryMetadata.toObject = function toObject() { - return {}; + UpdateAttributesConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = null; + object.updateMask = null; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = $root.google.cloud.retail.v2.AttributesConfig.toObject(message.attributesConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; }; /** - * Converts this SetInventoryMetadata to JSON. + * Converts this UpdateAttributesConfigRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @instance * @returns {Object.} JSON object */ - SetInventoryMetadata.prototype.toJSON = function toJSON() { + UpdateAttributesConfigRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for SetInventoryMetadata + * Gets the default type url for UpdateAttributesConfigRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @memberof google.cloud.retail.v2.UpdateAttributesConfigRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - SetInventoryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + UpdateAttributesConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryMetadata"; + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateAttributesConfigRequest"; }; - return SetInventoryMetadata; + return UpdateAttributesConfigRequest; })(); - v2.SetInventoryResponse = (function() { + v2.AddCatalogAttributeRequest = (function() { /** - * Properties of a SetInventoryResponse. + * Properties of an AddCatalogAttributeRequest. * @memberof google.cloud.retail.v2 - * @interface ISetInventoryResponse + * @interface IAddCatalogAttributeRequest + * @property {string|null} [attributesConfig] AddCatalogAttributeRequest attributesConfig + * @property {google.cloud.retail.v2.ICatalogAttribute|null} [catalogAttribute] AddCatalogAttributeRequest catalogAttribute */ /** - * Constructs a new SetInventoryResponse. + * Constructs a new AddCatalogAttributeRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SetInventoryResponse. - * @implements ISetInventoryResponse + * @classdesc Represents an AddCatalogAttributeRequest. + * @implements IAddCatalogAttributeRequest * @constructor - * @param {google.cloud.retail.v2.ISetInventoryResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IAddCatalogAttributeRequest=} [properties] Properties to set */ - function SetInventoryResponse(properties) { + function AddCatalogAttributeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17475,63 +18410,91 @@ } /** - * Creates a new SetInventoryResponse instance using the specified properties. + * AddCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest + * @instance + */ + AddCatalogAttributeRequest.prototype.attributesConfig = ""; + + /** + * AddCatalogAttributeRequest catalogAttribute. + * @member {google.cloud.retail.v2.ICatalogAttribute|null|undefined} catalogAttribute + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest + * @instance + */ + AddCatalogAttributeRequest.prototype.catalogAttribute = null; + + /** + * Creates a new AddCatalogAttributeRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse instance + * @param {google.cloud.retail.v2.IAddCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddCatalogAttributeRequest} AddCatalogAttributeRequest instance */ - SetInventoryResponse.create = function create(properties) { - return new SetInventoryResponse(properties); + AddCatalogAttributeRequest.create = function create(properties) { + return new AddCatalogAttributeRequest(properties); }; /** - * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. + * Encodes the specified AddCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2.AddCatalogAttributeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {google.cloud.retail.v2.IAddCatalogAttributeRequest} message AddCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryResponse.encode = function encode(message, writer) { + AddCatalogAttributeRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.catalogAttribute != null && Object.hasOwnProperty.call(message, "catalogAttribute")) + $root.google.cloud.retail.v2.CatalogAttribute.encode(message.catalogAttribute, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. + * Encodes the specified AddCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddCatalogAttributeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {google.cloud.retail.v2.IAddCatalogAttributeRequest} message AddCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + AddCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2.AddCatalogAttributeRequest} AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryResponse.decode = function decode(reader, length) { + AddCatalogAttributeRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddCatalogAttributeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.catalogAttribute = $root.google.cloud.retail.v2.CatalogAttribute.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -17541,114 +18504,137 @@ }; /** - * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * Decodes an AddCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2.AddCatalogAttributeRequest} AddCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { + AddCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SetInventoryResponse message. + * Verifies an AddCatalogAttributeRequest message. * @function verify - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SetInventoryResponse.verify = function verify(message) { + AddCatalogAttributeRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) { + var error = $root.google.cloud.retail.v2.CatalogAttribute.verify(message.catalogAttribute); + if (error) + return "catalogAttribute." + error; + } return null; }; /** - * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AddCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse + * @returns {google.cloud.retail.v2.AddCatalogAttributeRequest} AddCatalogAttributeRequest */ - SetInventoryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SetInventoryResponse) + AddCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddCatalogAttributeRequest) return object; - return new $root.google.cloud.retail.v2.SetInventoryResponse(); + var message = new $root.google.cloud.retail.v2.AddCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.catalogAttribute != null) { + if (typeof object.catalogAttribute !== "object") + throw TypeError(".google.cloud.retail.v2.AddCatalogAttributeRequest.catalogAttribute: object expected"); + message.catalogAttribute = $root.google.cloud.retail.v2.CatalogAttribute.fromObject(object.catalogAttribute); + } + return message; }; /** - * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * Creates a plain object from an AddCatalogAttributeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.SetInventoryResponse} message SetInventoryResponse + * @param {google.cloud.retail.v2.AddCatalogAttributeRequest} message AddCatalogAttributeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SetInventoryResponse.toObject = function toObject() { - return {}; + AddCatalogAttributeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = ""; + object.catalogAttribute = null; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) + object.catalogAttribute = $root.google.cloud.retail.v2.CatalogAttribute.toObject(message.catalogAttribute, options); + return object; }; /** - * Converts this SetInventoryResponse to JSON. + * Converts this AddCatalogAttributeRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @instance * @returns {Object.} JSON object */ - SetInventoryResponse.prototype.toJSON = function toJSON() { + AddCatalogAttributeRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for SetInventoryResponse + * Gets the default type url for AddCatalogAttributeRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.SetInventoryResponse + * @memberof google.cloud.retail.v2.AddCatalogAttributeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - SetInventoryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AddCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.AddCatalogAttributeRequest"; }; - return SetInventoryResponse; + return AddCatalogAttributeRequest; })(); - v2.AddFulfillmentPlacesRequest = (function() { + v2.RemoveCatalogAttributeRequest = (function() { /** - * Properties of an AddFulfillmentPlacesRequest. + * Properties of a RemoveCatalogAttributeRequest. * @memberof google.cloud.retail.v2 - * @interface IAddFulfillmentPlacesRequest - * @property {string|null} [product] AddFulfillmentPlacesRequest product - * @property {string|null} [type] AddFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime - * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + * @interface IRemoveCatalogAttributeRequest + * @property {string|null} [attributesConfig] RemoveCatalogAttributeRequest attributesConfig + * @property {string|null} [key] RemoveCatalogAttributeRequest key */ /** - * Constructs a new AddFulfillmentPlacesRequest. + * Constructs a new RemoveCatalogAttributeRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an AddFulfillmentPlacesRequest. - * @implements IAddFulfillmentPlacesRequest + * @classdesc Represents a RemoveCatalogAttributeRequest. + * @implements IRemoveCatalogAttributeRequest * @constructor - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IRemoveCatalogAttributeRequest=} [properties] Properties to set */ - function AddFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function RemoveCatalogAttributeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17656,134 +18642,89 @@ } /** - * AddFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.product = ""; - - /** - * AddFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.type = ""; - - /** - * AddFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest - * @instance - */ - AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; - - /** - * AddFulfillmentPlacesRequest addTime. - * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * RemoveCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.addTime = null; + RemoveCatalogAttributeRequest.prototype.attributesConfig = ""; /** - * AddFulfillmentPlacesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * RemoveCatalogAttributeRequest key. + * @member {string} key + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @instance */ - AddFulfillmentPlacesRequest.prototype.allowMissing = false; + RemoveCatalogAttributeRequest.prototype.key = ""; /** - * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * Creates a new RemoveCatalogAttributeRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2.IRemoveCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest instance */ - AddFulfillmentPlacesRequest.create = function create(properties) { - return new AddFulfillmentPlacesRequest(properties); + RemoveCatalogAttributeRequest.create = function create(properties) { + return new RemoveCatalogAttributeRequest(properties); }; /** - * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified RemoveCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveCatalogAttributeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + RemoveCatalogAttributeRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified RemoveCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveCatalogAttributeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2.IRemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + RemoveCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + RemoveCatalogAttributeRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveCatalogAttributeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.product = reader.string(); + message.attributesConfig = reader.string(); break; } case 2: { - message.type = reader.string(); - break; - } - case 3: { - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - } - case 4: { - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.allowMissing = reader.bool(); + message.key = reader.string(); break; } default: @@ -17795,172 +18736,133 @@ }; /** - * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a RemoveCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + RemoveCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesRequest message. + * Verifies a RemoveCatalogAttributeRequest message. * @function verify - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesRequest.verify = function verify(message) { + RemoveCatalogAttributeRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.addTime); - if (error) - return "addTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; return null; }; /** - * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a RemoveCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.RemoveCatalogAttributeRequest} RemoveCatalogAttributeRequest */ - AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest) + RemoveCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveCatalogAttributeRequest) return object; - var message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2.AddFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.addTime != null) { - if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2.AddFulfillmentPlacesRequest.addTime: object expected"); - message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + var message = new $root.google.cloud.retail.v2.RemoveCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.key != null) + message.key = String(object.key); return message; }; /** - * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a RemoveCatalogAttributeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {google.cloud.retail.v2.RemoveCatalogAttributeRequest} message RemoveCatalogAttributeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + RemoveCatalogAttributeRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; if (options.defaults) { - object.product = ""; - object.type = ""; - object.addTime = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + object.attributesConfig = ""; + object.key = ""; } - if (message.addTime != null && message.hasOwnProperty("addTime")) - object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; return object; }; /** - * Converts this AddFulfillmentPlacesRequest to JSON. + * Converts this RemoveCatalogAttributeRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + RemoveCatalogAttributeRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AddFulfillmentPlacesRequest + * Gets the default type url for RemoveCatalogAttributeRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.RemoveCatalogAttributeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AddFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + RemoveCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveCatalogAttributeRequest"; }; - return AddFulfillmentPlacesRequest; + return RemoveCatalogAttributeRequest; })(); - v2.AddFulfillmentPlacesMetadata = (function() { + v2.ReplaceCatalogAttributeRequest = (function() { /** - * Properties of an AddFulfillmentPlacesMetadata. + * Properties of a ReplaceCatalogAttributeRequest. * @memberof google.cloud.retail.v2 - * @interface IAddFulfillmentPlacesMetadata + * @interface IReplaceCatalogAttributeRequest + * @property {string|null} [attributesConfig] ReplaceCatalogAttributeRequest attributesConfig + * @property {google.cloud.retail.v2.ICatalogAttribute|null} [catalogAttribute] ReplaceCatalogAttributeRequest catalogAttribute + * @property {google.protobuf.IFieldMask|null} [updateMask] ReplaceCatalogAttributeRequest updateMask */ /** - * Constructs a new AddFulfillmentPlacesMetadata. + * Constructs a new ReplaceCatalogAttributeRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an AddFulfillmentPlacesMetadata. - * @implements IAddFulfillmentPlacesMetadata + * @classdesc Represents a ReplaceCatalogAttributeRequest. + * @implements IReplaceCatalogAttributeRequest * @constructor - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IReplaceCatalogAttributeRequest=} [properties] Properties to set */ - function AddFulfillmentPlacesMetadata(properties) { + function ReplaceCatalogAttributeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17968,63 +18870,105 @@ } /** - * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * ReplaceCatalogAttributeRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.attributesConfig = ""; + + /** + * ReplaceCatalogAttributeRequest catalogAttribute. + * @member {google.cloud.retail.v2.ICatalogAttribute|null|undefined} catalogAttribute + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.catalogAttribute = null; + + /** + * ReplaceCatalogAttributeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest + * @instance + */ + ReplaceCatalogAttributeRequest.prototype.updateMask = null; + + /** + * Creates a new ReplaceCatalogAttributeRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance + * @param {google.cloud.retail.v2.IReplaceCatalogAttributeRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest instance */ - AddFulfillmentPlacesMetadata.create = function create(properties) { - return new AddFulfillmentPlacesMetadata(properties); + ReplaceCatalogAttributeRequest.create = function create(properties) { + return new ReplaceCatalogAttributeRequest(properties); }; /** - * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified ReplaceCatalogAttributeRequest message. Does not implicitly {@link google.cloud.retail.v2.ReplaceCatalogAttributeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { + ReplaceCatalogAttributeRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.catalogAttribute != null && Object.hasOwnProperty.call(message, "catalogAttribute")) + $root.google.cloud.retail.v2.CatalogAttribute.encode(message.catalogAttribute, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified ReplaceCatalogAttributeRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ReplaceCatalogAttributeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ReplaceCatalogAttributeRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { + ReplaceCatalogAttributeRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ReplaceCatalogAttributeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + message.catalogAttribute = $root.google.cloud.retail.v2.CatalogAttribute.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -18034,289 +18978,257 @@ }; /** - * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a ReplaceCatalogAttributeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + ReplaceCatalogAttributeRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddFulfillmentPlacesMetadata message. + * Verifies a ReplaceCatalogAttributeRequest message. * @function verify - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddFulfillmentPlacesMetadata.verify = function verify(message) { + ReplaceCatalogAttributeRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) { + var error = $root.google.cloud.retail.v2.CatalogAttribute.verify(message.catalogAttribute); + if (error) + return "catalogAttribute." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } return null; }; /** - * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ReplaceCatalogAttributeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.ReplaceCatalogAttributeRequest} ReplaceCatalogAttributeRequest */ - AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata) + ReplaceCatalogAttributeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ReplaceCatalogAttributeRequest) return object; - return new $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata(); + var message = new $root.google.cloud.retail.v2.ReplaceCatalogAttributeRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.catalogAttribute != null) { + if (typeof object.catalogAttribute !== "object") + throw TypeError(".google.cloud.retail.v2.ReplaceCatalogAttributeRequest.catalogAttribute: object expected"); + message.catalogAttribute = $root.google.cloud.retail.v2.CatalogAttribute.fromObject(object.catalogAttribute); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.ReplaceCatalogAttributeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; }; /** - * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ReplaceCatalogAttributeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static - * @param {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata + * @param {google.cloud.retail.v2.ReplaceCatalogAttributeRequest} message ReplaceCatalogAttributeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddFulfillmentPlacesMetadata.toObject = function toObject() { - return {}; + ReplaceCatalogAttributeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attributesConfig = ""; + object.catalogAttribute = null; + object.updateMask = null; + } + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.catalogAttribute != null && message.hasOwnProperty("catalogAttribute")) + object.catalogAttribute = $root.google.cloud.retail.v2.CatalogAttribute.toObject(message.catalogAttribute, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; }; /** - * Converts this AddFulfillmentPlacesMetadata to JSON. + * Converts this ReplaceCatalogAttributeRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @instance * @returns {Object.} JSON object */ - AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + ReplaceCatalogAttributeRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AddFulfillmentPlacesMetadata + * Gets the default type url for ReplaceCatalogAttributeRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ReplaceCatalogAttributeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AddFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ReplaceCatalogAttributeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"; + return typeUrlPrefix + "/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"; }; - return AddFulfillmentPlacesMetadata; + return ReplaceCatalogAttributeRequest; })(); - v2.AddFulfillmentPlacesResponse = (function() { - - /** - * Properties of an AddFulfillmentPlacesResponse. - * @memberof google.cloud.retail.v2 - * @interface IAddFulfillmentPlacesResponse - */ + v2.CompletionService = (function() { /** - * Constructs a new AddFulfillmentPlacesResponse. + * Constructs a new CompletionService service. * @memberof google.cloud.retail.v2 - * @classdesc Represents an AddFulfillmentPlacesResponse. - * @implements IAddFulfillmentPlacesResponse + * @classdesc Represents a CompletionService + * @extends $protobuf.rpc.Service * @constructor - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function AddFulfillmentPlacesResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + function CompletionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - /** - * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance - */ - AddFulfillmentPlacesResponse.create = function create(properties) { - return new AddFulfillmentPlacesResponse(properties); - }; - - /** - * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddFulfillmentPlacesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + (CompletionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CompletionService; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * Creates new CompletionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.CompletionService * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CompletionService} RPC service. Useful where requests and/or responses are streamed. */ - AddFulfillmentPlacesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; + CompletionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.retail.v2.CompletionService|completeQuery}. + * @memberof google.cloud.retail.v2.CompletionService + * @typedef CompleteQueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.CompleteQueryResponse} [response] CompleteQueryResponse */ - AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; /** - * Verifies an AddFulfillmentPlacesResponse message. - * @function verify - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @param {google.cloud.retail.v2.CompletionService.CompleteQueryCallback} callback Node-style callback called with the error, if any, and CompleteQueryResponse + * @returns {undefined} + * @variation 1 */ - AddFulfillmentPlacesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; + Object.defineProperty(CompletionService.prototype.completeQuery = function completeQuery(request, callback) { + return this.rpcCall(completeQuery, $root.google.cloud.retail.v2.CompleteQueryRequest, $root.google.cloud.retail.v2.CompleteQueryResponse, request, callback); + }, "name", { value: "CompleteQuery" }); /** - * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * Calls CompleteQuery. + * @function completeQuery + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest} request CompleteQueryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse) - return object; - return new $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse(); - }; /** - * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Callback as used by {@link google.cloud.retail.v2.CompletionService|importCompletionData}. + * @memberof google.cloud.retail.v2.CompletionService + * @typedef ImportCompletionDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - AddFulfillmentPlacesResponse.toObject = function toObject() { - return {}; - }; /** - * Converts this AddFulfillmentPlacesResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2.CompletionService * @instance - * @returns {Object.} JSON object + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @param {google.cloud.retail.v2.CompletionService.ImportCompletionDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + Object.defineProperty(CompletionService.prototype.importCompletionData = function importCompletionData(request, callback) { + return this.rpcCall(importCompletionData, $root.google.cloud.retail.v2.ImportCompletionDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportCompletionData" }); /** - * Gets the default type url for AddFulfillmentPlacesResponse - * @function getTypeUrl - * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * Calls ImportCompletionData. + * @function importCompletionData + * @memberof google.cloud.retail.v2.CompletionService + * @instance + * @param {google.cloud.retail.v2.IImportCompletionDataRequest} request ImportCompletionDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - AddFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesResponse"; - }; - return AddFulfillmentPlacesResponse; + return CompletionService; })(); - v2.AddLocalInventoriesRequest = (function() { + v2.CompleteQueryRequest = (function() { /** - * Properties of an AddLocalInventoriesRequest. + * Properties of a CompleteQueryRequest. * @memberof google.cloud.retail.v2 - * @interface IAddLocalInventoriesRequest - * @property {string|null} [product] AddLocalInventoriesRequest product - * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories - * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask - * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime - * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing + * @interface ICompleteQueryRequest + * @property {string|null} [catalog] CompleteQueryRequest catalog + * @property {string|null} [query] CompleteQueryRequest query + * @property {string|null} [visitorId] CompleteQueryRequest visitorId + * @property {Array.|null} [languageCodes] CompleteQueryRequest languageCodes + * @property {string|null} [deviceType] CompleteQueryRequest deviceType + * @property {string|null} [dataset] CompleteQueryRequest dataset + * @property {number|null} [maxSuggestions] CompleteQueryRequest maxSuggestions */ /** - * Constructs a new AddLocalInventoriesRequest. + * Constructs a new CompleteQueryRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents an AddLocalInventoriesRequest. - * @implements IAddLocalInventoriesRequest + * @classdesc Represents a CompleteQueryRequest. + * @implements ICompleteQueryRequest * @constructor - * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set */ - function AddLocalInventoriesRequest(properties) { - this.localInventories = []; + function CompleteQueryRequest(properties) { + this.languageCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18324,134 +19236,162 @@ } /** - * AddLocalInventoriesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * CompleteQueryRequest catalog. + * @member {string} catalog + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - AddLocalInventoriesRequest.prototype.product = ""; + CompleteQueryRequest.prototype.catalog = ""; /** - * AddLocalInventoriesRequest localInventories. - * @member {Array.} localInventories - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * CompleteQueryRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; + CompleteQueryRequest.prototype.query = ""; /** - * AddLocalInventoriesRequest addMask. - * @member {google.protobuf.IFieldMask|null|undefined} addMask - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * CompleteQueryRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - AddLocalInventoriesRequest.prototype.addMask = null; + CompleteQueryRequest.prototype.visitorId = ""; /** - * AddLocalInventoriesRequest addTime. - * @member {google.protobuf.ITimestamp|null|undefined} addTime - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * CompleteQueryRequest languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - AddLocalInventoriesRequest.prototype.addTime = null; + CompleteQueryRequest.prototype.languageCodes = $util.emptyArray; /** - * AddLocalInventoriesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * CompleteQueryRequest deviceType. + * @member {string} deviceType + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance */ - AddLocalInventoriesRequest.prototype.allowMissing = false; + CompleteQueryRequest.prototype.deviceType = ""; /** - * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * CompleteQueryRequest dataset. + * @member {string} dataset + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.dataset = ""; + + /** + * CompleteQueryRequest maxSuggestions. + * @member {number} maxSuggestions + * @memberof google.cloud.retail.v2.CompleteQueryRequest + * @instance + */ + CompleteQueryRequest.prototype.maxSuggestions = 0; + + /** + * Creates a new CompleteQueryRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance + * @param {google.cloud.retail.v2.ICompleteQueryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest instance */ - AddLocalInventoriesRequest.create = function create(properties) { - return new AddLocalInventoriesRequest(properties); + CompleteQueryRequest.create = function create(properties) { + return new CompleteQueryRequest(properties); }; /** - * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesRequest.encode = function encode(message, writer) { + CompleteQueryRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.localInventories != null && message.localInventories.length) - for (var i = 0; i < message.localInventories.length; ++i) - $root.google.cloud.retail.v2.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) - $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) - $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.catalog); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCodes[i]); + if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceType); + if (message.maxSuggestions != null && Object.hasOwnProperty.call(message, "maxSuggestions")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxSuggestions); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dataset); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.visitorId); return writer; }; /** - * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified CompleteQueryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryRequest} message CompleteQueryRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * Decodes a CompleteQueryRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesRequest.decode = function decode(reader, length) { + CompleteQueryRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.product = reader.string(); + message.catalog = reader.string(); break; } case 2: { - if (!(message.localInventories && message.localInventories.length)) - message.localInventories = []; - message.localInventories.push($root.google.cloud.retail.v2.LocalInventory.decode(reader, reader.uint32())); + message.query = reader.string(); break; } - case 4: { - message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + case 7: { + message.visitorId = reader.string(); break; } - case 5: { - message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + case 3: { + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + } + case 4: { + message.deviceType = reader.string(); break; } case 6: { - message.allowMissing = reader.bool(); + message.dataset = reader.string(); + break; + } + case 5: { + message.maxSuggestions = reader.int32(); break; } default: @@ -18463,182 +19403,188 @@ }; /** - * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesRequest message. + * Verifies a CompleteQueryRequest message. * @function verify - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesRequest.verify = function verify(message) { + CompleteQueryRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.localInventories != null && message.hasOwnProperty("localInventories")) { - if (!Array.isArray(message.localInventories)) - return "localInventories: array expected"; - for (var i = 0; i < message.localInventories.length; ++i) { - var error = $root.google.cloud.retail.v2.LocalInventory.verify(message.localInventories[i]); - if (error) - return "localInventories." + error; - } - } - if (message.addMask != null && message.hasOwnProperty("addMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.addMask); - if (error) - return "addMask." + error; - } - if (message.addTime != null && message.hasOwnProperty("addTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.addTime); - if (error) - return "addTime." + error; + if (message.catalog != null && message.hasOwnProperty("catalog")) + if (!$util.isString(message.catalog)) + return "catalog: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + if (!$util.isString(message.deviceType)) + return "deviceType: string expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + if (!$util.isInteger(message.maxSuggestions)) + return "maxSuggestions: integer expected"; return null; }; /** - * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @returns {google.cloud.retail.v2.CompleteQueryRequest} CompleteQueryRequest */ - AddLocalInventoriesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesRequest) + CompleteQueryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryRequest) return object; - var message = new $root.google.cloud.retail.v2.AddLocalInventoriesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.localInventories) { - if (!Array.isArray(object.localInventories)) - throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.localInventories: array expected"); - message.localInventories = []; - for (var i = 0; i < object.localInventories.length; ++i) { - if (typeof object.localInventories[i] !== "object") - throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.localInventories: object expected"); - message.localInventories[i] = $root.google.cloud.retail.v2.LocalInventory.fromObject(object.localInventories[i]); - } - } - if (object.addMask != null) { - if (typeof object.addMask !== "object") - throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.addMask: object expected"); - message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); - } - if (object.addTime != null) { - if (typeof object.addTime !== "object") - throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.addTime: object expected"); - message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + var message = new $root.google.cloud.retail.v2.CompleteQueryRequest(); + if (object.catalog != null) + message.catalog = String(object.catalog); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryRequest.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + if (object.deviceType != null) + message.deviceType = String(object.deviceType); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.maxSuggestions != null) + message.maxSuggestions = object.maxSuggestions | 0; return message; }; /** - * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static - * @param {google.cloud.retail.v2.AddLocalInventoriesRequest} message AddLocalInventoriesRequest + * @param {google.cloud.retail.v2.CompleteQueryRequest} message CompleteQueryRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesRequest.toObject = function toObject(message, options) { + CompleteQueryRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.localInventories = []; + object.languageCodes = []; if (options.defaults) { - object.product = ""; - object.addMask = null; - object.addTime = null; - object.allowMissing = false; + object.catalog = ""; + object.query = ""; + object.deviceType = ""; + object.maxSuggestions = 0; + object.dataset = ""; + object.visitorId = ""; } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.localInventories && message.localInventories.length) { - object.localInventories = []; - for (var j = 0; j < message.localInventories.length; ++j) - object.localInventories[j] = $root.google.cloud.retail.v2.LocalInventory.toObject(message.localInventories[j], options); + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = message.catalog; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; } - if (message.addMask != null && message.hasOwnProperty("addMask")) - object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); - if (message.addTime != null && message.hasOwnProperty("addTime")) - object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (message.deviceType != null && message.hasOwnProperty("deviceType")) + object.deviceType = message.deviceType; + if (message.maxSuggestions != null && message.hasOwnProperty("maxSuggestions")) + object.maxSuggestions = message.maxSuggestions; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; return object; }; /** - * Converts this AddLocalInventoriesRequest to JSON. + * Converts this CompleteQueryRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { + CompleteQueryRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AddLocalInventoriesRequest + * Gets the default type url for CompleteQueryRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CompleteQueryRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AddLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CompleteQueryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryRequest"; }; - return AddLocalInventoriesRequest; + return CompleteQueryRequest; })(); - v2.AddLocalInventoriesMetadata = (function() { + v2.CompleteQueryResponse = (function() { /** - * Properties of an AddLocalInventoriesMetadata. + * Properties of a CompleteQueryResponse. * @memberof google.cloud.retail.v2 - * @interface IAddLocalInventoriesMetadata + * @interface ICompleteQueryResponse + * @property {Array.|null} [completionResults] CompleteQueryResponse completionResults + * @property {string|null} [attributionToken] CompleteQueryResponse attributionToken + * @property {Array.|null} [recentSearchResults] CompleteQueryResponse recentSearchResults */ /** - * Constructs a new AddLocalInventoriesMetadata. + * Constructs a new CompleteQueryResponse. * @memberof google.cloud.retail.v2 - * @classdesc Represents an AddLocalInventoriesMetadata. - * @implements IAddLocalInventoriesMetadata + * @classdesc Represents a CompleteQueryResponse. + * @implements ICompleteQueryResponse * @constructor - * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set */ - function AddLocalInventoriesMetadata(properties) { + function CompleteQueryResponse(properties) { + this.completionResults = []; + this.recentSearchResults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18646,63 +19592,111 @@ } /** - * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * CompleteQueryResponse completionResults. + * @member {Array.} completionResults + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.completionResults = $util.emptyArray; + + /** + * CompleteQueryResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.attributionToken = ""; + + /** + * CompleteQueryResponse recentSearchResults. + * @member {Array.} recentSearchResults + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @instance + */ + CompleteQueryResponse.prototype.recentSearchResults = $util.emptyArray; + + /** + * Creates a new CompleteQueryResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + * @param {google.cloud.retail.v2.ICompleteQueryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse instance */ - AddLocalInventoriesMetadata.create = function create(properties) { - return new AddLocalInventoriesMetadata(properties); + CompleteQueryResponse.create = function create(properties) { + return new CompleteQueryResponse(properties); }; /** - * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesMetadata.encode = function encode(message, writer) { + CompleteQueryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.completionResults != null && message.completionResults.length) + for (var i = 0; i < message.completionResults.length; ++i) + $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.encode(message.completionResults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.recentSearchResults != null && message.recentSearchResults.length) + for (var i = 0; i < message.recentSearchResults.length; ++i) + $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.encode(message.recentSearchResults[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified CompleteQueryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.ICompleteQueryResponse} message CompleteQueryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + CompleteQueryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * Decodes a CompleteQueryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesMetadata.decode = function decode(reader, length) { + CompleteQueryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + if (!(message.completionResults && message.completionResults.length)) + message.completionResults = []; + message.completionResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.recentSearchResults && message.recentSearchResults.length)) + message.recentSearchResults = []; + message.recentSearchResults.push($root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -18712,108 +19706,654 @@ }; /** - * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * Decodes a CompleteQueryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + CompleteQueryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesMetadata message. + * Verifies a CompleteQueryResponse message. * @function verify - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesMetadata.verify = function verify(message) { + CompleteQueryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.completionResults != null && message.hasOwnProperty("completionResults")) { + if (!Array.isArray(message.completionResults)) + return "completionResults: array expected"; + for (var i = 0; i < message.completionResults.length; ++i) { + var error = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify(message.completionResults[i]); + if (error) + return "completionResults." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.recentSearchResults != null && message.hasOwnProperty("recentSearchResults")) { + if (!Array.isArray(message.recentSearchResults)) + return "recentSearchResults: array expected"; + for (var i = 0; i < message.recentSearchResults.length; ++i) { + var error = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify(message.recentSearchResults[i]); + if (error) + return "recentSearchResults." + error; + } + } return null; }; /** - * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a CompleteQueryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @returns {google.cloud.retail.v2.CompleteQueryResponse} CompleteQueryResponse */ - AddLocalInventoriesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesMetadata) + CompleteQueryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse) return object; - return new $root.google.cloud.retail.v2.AddLocalInventoriesMetadata(); + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse(); + if (object.completionResults) { + if (!Array.isArray(object.completionResults)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: array expected"); + message.completionResults = []; + for (var i = 0; i < object.completionResults.length; ++i) { + if (typeof object.completionResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.completionResults: object expected"); + message.completionResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.fromObject(object.completionResults[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.recentSearchResults) { + if (!Array.isArray(object.recentSearchResults)) + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: array expected"); + message.recentSearchResults = []; + for (var i = 0; i < object.recentSearchResults.length; ++i) { + if (typeof object.recentSearchResults[i] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.recentSearchResults: object expected"); + message.recentSearchResults[i] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.fromObject(object.recentSearchResults[i]); + } + } + return message; }; /** - * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * Creates a plain object from a CompleteQueryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static - * @param {google.cloud.retail.v2.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {google.cloud.retail.v2.CompleteQueryResponse} message CompleteQueryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AddLocalInventoriesMetadata.toObject = function toObject() { - return {}; + CompleteQueryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.completionResults = []; + object.recentSearchResults = []; + } + if (options.defaults) + object.attributionToken = ""; + if (message.completionResults && message.completionResults.length) { + object.completionResults = []; + for (var j = 0; j < message.completionResults.length; ++j) + object.completionResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.toObject(message.completionResults[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.recentSearchResults && message.recentSearchResults.length) { + object.recentSearchResults = []; + for (var j = 0; j < message.recentSearchResults.length; ++j) + object.recentSearchResults[j] = $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.toObject(message.recentSearchResults[j], options); + } + return object; }; /** - * Converts this AddLocalInventoriesMetadata to JSON. + * Converts this CompleteQueryResponse to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + CompleteQueryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AddLocalInventoriesMetadata + * Gets the default type url for CompleteQueryResponse * @function getTypeUrl - * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.CompleteQueryResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AddLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CompleteQueryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesMetadata"; + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse"; }; - return AddLocalInventoriesMetadata; + CompleteQueryResponse.CompletionResult = (function() { + + /** + * Properties of a CompletionResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @interface ICompletionResult + * @property {string|null} [suggestion] CompletionResult suggestion + * @property {Object.|null} [attributes] CompletionResult attributes + */ + + /** + * Constructs a new CompletionResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @classdesc Represents a CompletionResult. + * @implements ICompletionResult + * @constructor + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + */ + function CompletionResult(properties) { + this.attributes = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompletionResult suggestion. + * @member {string} suggestion + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.suggestion = ""; + + /** + * CompletionResult attributes. + * @member {Object.} attributes + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + */ + CompletionResult.prototype.attributes = $util.emptyObject; + + /** + * Creates a new CompletionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult instance + */ + CompletionResult.create = function create(properties) { + return new CompletionResult(properties); + }; + + /** + * Encodes the specified CompletionResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.suggestion); + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) + for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.retail.v2.CustomAttribute.encode(message.attributes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompletionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.ICompletionResult} message CompletionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompletionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.suggestion = reader.string(); + break; + } + case 2: { + if (message.attributes === $util.emptyObject) + message.attributes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.retail.v2.CustomAttribute.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.attributes[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompletionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompletionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompletionResult message. + * @function verify + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompletionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + if (!$util.isString(message.suggestion)) + return "suggestion: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!$util.isObject(message.attributes)) + return "attributes: object expected"; + var key = Object.keys(message.attributes); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.retail.v2.CustomAttribute.verify(message.attributes[key[i]]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a CompletionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} CompletionResult + */ + CompletionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult) + return object; + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult(); + if (object.suggestion != null) + message.suggestion = String(object.suggestion); + if (object.attributes) { + if (typeof object.attributes !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes = {}; + for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { + if (typeof object.attributes[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.attributes: object expected"); + message.attributes[keys[i]] = $root.google.cloud.retail.v2.CustomAttribute.fromObject(object.attributes[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompletionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.CompletionResult} message CompletionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompletionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.attributes = {}; + if (options.defaults) + object.suggestion = ""; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = message.suggestion; + var keys2; + if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { + object.attributes = {}; + for (var j = 0; j < keys2.length; ++j) + object.attributes[keys2[j]] = $root.google.cloud.retail.v2.CustomAttribute.toObject(message.attributes[keys2[j]], options); + } + return object; + }; + + /** + * Converts this CompletionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @instance + * @returns {Object.} JSON object + */ + CompletionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompletionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompleteQueryResponse.CompletionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompletionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"; + }; + + return CompletionResult; + })(); + + CompleteQueryResponse.RecentSearchResult = (function() { + + /** + * Properties of a RecentSearchResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @interface IRecentSearchResult + * @property {string|null} [recentSearch] RecentSearchResult recentSearch + */ + + /** + * Constructs a new RecentSearchResult. + * @memberof google.cloud.retail.v2.CompleteQueryResponse + * @classdesc Represents a RecentSearchResult. + * @implements IRecentSearchResult + * @constructor + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + */ + function RecentSearchResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentSearchResult recentSearch. + * @member {string} recentSearch + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @instance + */ + RecentSearchResult.prototype.recentSearch = ""; + + /** + * Creates a new RecentSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult instance + */ + RecentSearchResult.create = function create(properties) { + return new RecentSearchResult(properties); + }; + + /** + * Encodes the specified RecentSearchResult message. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSearch != null && Object.hasOwnProperty.call(message, "recentSearch")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.recentSearch); + return writer; + }; + + /** + * Encodes the specified RecentSearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.IRecentSearchResult} message RecentSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.recentSearch = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentSearchResult message. + * @function verify + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + if (!$util.isString(message.recentSearch)) + return "recentSearch: string expected"; + return null; + }; + + /** + * Creates a RecentSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} RecentSearchResult + */ + RecentSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult) + return object; + var message = new $root.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult(); + if (object.recentSearch != null) + message.recentSearch = String(object.recentSearch); + return message; + }; + + /** + * Creates a plain object from a RecentSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult} message RecentSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSearch = ""; + if (message.recentSearch != null && message.hasOwnProperty("recentSearch")) + object.recentSearch = message.recentSearch; + return object; + }; + + /** + * Converts this RecentSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @instance + * @returns {Object.} JSON object + */ + RecentSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RecentSearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RecentSearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"; + }; + + return RecentSearchResult; + })(); + + return CompleteQueryResponse; })(); - v2.AddLocalInventoriesResponse = (function() { + v2.Control = (function() { /** - * Properties of an AddLocalInventoriesResponse. + * Properties of a Control. * @memberof google.cloud.retail.v2 - * @interface IAddLocalInventoriesResponse + * @interface IControl + * @property {google.cloud.retail.v2.IRule|null} [rule] Control rule + * @property {string|null} [name] Control name + * @property {string|null} [displayName] Control displayName + * @property {Array.|null} [associatedServingConfigIds] Control associatedServingConfigIds + * @property {Array.|null} [solutionTypes] Control solutionTypes + * @property {Array.|null} [searchSolutionUseCase] Control searchSolutionUseCase */ /** - * Constructs a new AddLocalInventoriesResponse. + * Constructs a new Control. * @memberof google.cloud.retail.v2 - * @classdesc Represents an AddLocalInventoriesResponse. - * @implements IAddLocalInventoriesResponse + * @classdesc Represents a Control. + * @implements IControl * @constructor - * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IControl=} [properties] Properties to set */ - function AddLocalInventoriesResponse(properties) { + function Control(properties) { + this.associatedServingConfigIds = []; + this.solutionTypes = []; + this.searchSolutionUseCase = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18821,63 +20361,186 @@ } /** - * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * Control rule. + * @member {google.cloud.retail.v2.IRule|null|undefined} rule + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Control.prototype.rule = null; + + /** + * Control name. + * @member {string} name + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Control.prototype.name = ""; + + /** + * Control displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Control.prototype.displayName = ""; + + /** + * Control associatedServingConfigIds. + * @member {Array.} associatedServingConfigIds + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Control.prototype.associatedServingConfigIds = $util.emptyArray; + + /** + * Control solutionTypes. + * @member {Array.} solutionTypes + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Control.prototype.solutionTypes = $util.emptyArray; + + /** + * Control searchSolutionUseCase. + * @member {Array.} searchSolutionUseCase + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Control.prototype.searchSolutionUseCase = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Control control. + * @member {"rule"|undefined} control + * @memberof google.cloud.retail.v2.Control + * @instance + */ + Object.defineProperty(Control.prototype, "control", { + get: $util.oneOfGetter($oneOfFields = ["rule"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Control instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + * @param {google.cloud.retail.v2.IControl=} [properties] Properties to set + * @returns {google.cloud.retail.v2.Control} Control instance */ - AddLocalInventoriesResponse.create = function create(properties) { - return new AddLocalInventoriesResponse(properties); + Control.create = function create(properties) { + return new Control(properties); }; /** - * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified Control message. Does not implicitly {@link google.cloud.retail.v2.Control.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2.IControl} message Control message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesResponse.encode = function encode(message, writer) { + Control.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.rule != null && Object.hasOwnProperty.call(message, "rule")) + $root.google.cloud.retail.v2.Rule.encode(message.rule, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.associatedServingConfigIds != null && message.associatedServingConfigIds.length) + for (var i = 0; i < message.associatedServingConfigIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.associatedServingConfigIds[i]); + if (message.solutionTypes != null && message.solutionTypes.length) { + writer.uint32(/* id 6, wireType 2 =*/50).fork(); + for (var i = 0; i < message.solutionTypes.length; ++i) + writer.int32(message.solutionTypes[i]); + writer.ldelim(); + } + if (message.searchSolutionUseCase != null && message.searchSolutionUseCase.length) { + writer.uint32(/* id 7, wireType 2 =*/58).fork(); + for (var i = 0; i < message.searchSolutionUseCase.length; ++i) + writer.int32(message.searchSolutionUseCase[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified Control message, length delimited. Does not implicitly {@link google.cloud.retail.v2.Control.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static - * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2.IControl} message Control message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + Control.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * Decodes a Control message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2.Control} Control * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesResponse.decode = function decode(reader, length) { + Control.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.Control(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 4: { + message.rule = $root.google.cloud.retail.v2.Rule.decode(reader, reader.uint32()); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 5: { + if (!(message.associatedServingConfigIds && message.associatedServingConfigIds.length)) + message.associatedServingConfigIds = []; + message.associatedServingConfigIds.push(reader.string()); + break; + } + case 6: { + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else + message.solutionTypes.push(reader.int32()); + break; + } + case 7: { + if (!(message.searchSolutionUseCase && message.searchSolutionUseCase.length)) + message.searchSolutionUseCase = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.searchSolutionUseCase.push(reader.int32()); + } else + message.searchSolutionUseCase.push(reader.int32()); + break; + } default: reader.skipType(tag & 7); break; @@ -18887,113 +20550,454 @@ }; /** - * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * Decodes a Control message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @returns {google.cloud.retail.v2.Control} Control * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + Control.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AddLocalInventoriesResponse message. + * Verifies a Control message. * @function verify - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AddLocalInventoriesResponse.verify = function verify(message) { + Control.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - return null; - }; - - /** - * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse - */ - AddLocalInventoriesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesResponse) - return object; - return new $root.google.cloud.retail.v2.AddLocalInventoriesResponse(); - }; - - /** - * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse - * @static - * @param {google.cloud.retail.v2.AddLocalInventoriesResponse} message AddLocalInventoriesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AddLocalInventoriesResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this AddLocalInventoriesResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + var properties = {}; + if (message.rule != null && message.hasOwnProperty("rule")) { + properties.control = 1; + { + var error = $root.google.cloud.retail.v2.Rule.verify(message.rule); + if (error) + return "rule." + error; + } + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.associatedServingConfigIds != null && message.hasOwnProperty("associatedServingConfigIds")) { + if (!Array.isArray(message.associatedServingConfigIds)) + return "associatedServingConfigIds: array expected"; + for (var i = 0; i < message.associatedServingConfigIds.length; ++i) + if (!$util.isString(message.associatedServingConfigIds[i])) + return "associatedServingConfigIds: string[] expected"; + } + if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { + if (!Array.isArray(message.solutionTypes)) + return "solutionTypes: array expected"; + for (var i = 0; i < message.solutionTypes.length; ++i) + switch (message.solutionTypes[i]) { + default: + return "solutionTypes: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.searchSolutionUseCase != null && message.hasOwnProperty("searchSolutionUseCase")) { + if (!Array.isArray(message.searchSolutionUseCase)) + return "searchSolutionUseCase: array expected"; + for (var i = 0; i < message.searchSolutionUseCase.length; ++i) + switch (message.searchSolutionUseCase[i]) { + default: + return "searchSolutionUseCase: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a Control message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.Control + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.Control} Control + */ + Control.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.Control) + return object; + var message = new $root.google.cloud.retail.v2.Control(); + if (object.rule != null) { + if (typeof object.rule !== "object") + throw TypeError(".google.cloud.retail.v2.Control.rule: object expected"); + message.rule = $root.google.cloud.retail.v2.Rule.fromObject(object.rule); + } + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.associatedServingConfigIds) { + if (!Array.isArray(object.associatedServingConfigIds)) + throw TypeError(".google.cloud.retail.v2.Control.associatedServingConfigIds: array expected"); + message.associatedServingConfigIds = []; + for (var i = 0; i < object.associatedServingConfigIds.length; ++i) + message.associatedServingConfigIds[i] = String(object.associatedServingConfigIds[i]); + } + if (object.solutionTypes) { + if (!Array.isArray(object.solutionTypes)) + throw TypeError(".google.cloud.retail.v2.Control.solutionTypes: array expected"); + message.solutionTypes = []; + for (var i = 0; i < object.solutionTypes.length; ++i) + switch (object.solutionTypes[i]) { + default: + case "SOLUTION_TYPE_UNSPECIFIED": + case 0: + message.solutionTypes[i] = 0; + break; + case "SOLUTION_TYPE_RECOMMENDATION": + case 1: + message.solutionTypes[i] = 1; + break; + case "SOLUTION_TYPE_SEARCH": + case 2: + message.solutionTypes[i] = 2; + break; + } + } + if (object.searchSolutionUseCase) { + if (!Array.isArray(object.searchSolutionUseCase)) + throw TypeError(".google.cloud.retail.v2.Control.searchSolutionUseCase: array expected"); + message.searchSolutionUseCase = []; + for (var i = 0; i < object.searchSolutionUseCase.length; ++i) + switch (object.searchSolutionUseCase[i]) { + default: + case "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": + case 0: + message.searchSolutionUseCase[i] = 0; + break; + case "SEARCH_SOLUTION_USE_CASE_SEARCH": + case 1: + message.searchSolutionUseCase[i] = 1; + break; + case "SEARCH_SOLUTION_USE_CASE_BROWSE": + case 2: + message.searchSolutionUseCase[i] = 2; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a Control message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.Control + * @static + * @param {google.cloud.retail.v2.Control} message Control + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Control.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.associatedServingConfigIds = []; + object.solutionTypes = []; + object.searchSolutionUseCase = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.rule != null && message.hasOwnProperty("rule")) { + object.rule = $root.google.cloud.retail.v2.Rule.toObject(message.rule, options); + if (options.oneofs) + object.control = "rule"; + } + if (message.associatedServingConfigIds && message.associatedServingConfigIds.length) { + object.associatedServingConfigIds = []; + for (var j = 0; j < message.associatedServingConfigIds.length; ++j) + object.associatedServingConfigIds[j] = message.associatedServingConfigIds[j]; + } + if (message.solutionTypes && message.solutionTypes.length) { + object.solutionTypes = []; + for (var j = 0; j < message.solutionTypes.length; ++j) + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + } + if (message.searchSolutionUseCase && message.searchSolutionUseCase.length) { + object.searchSolutionUseCase = []; + for (var j = 0; j < message.searchSolutionUseCase.length; ++j) + object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; + } + return object; + }; + + /** + * Converts this Control to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.Control * @instance * @returns {Object.} JSON object */ - AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + Control.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AddLocalInventoriesResponse + * Gets the default type url for Control * @function getTypeUrl - * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @memberof google.cloud.retail.v2.Control * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AddLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Control.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.Control"; }; - return AddLocalInventoriesResponse; + return Control; })(); - v2.RemoveLocalInventoriesRequest = (function() { + v2.ControlService = (function() { /** - * Properties of a RemoveLocalInventoriesRequest. + * Constructs a new ControlService service. * @memberof google.cloud.retail.v2 - * @interface IRemoveLocalInventoriesRequest - * @property {string|null} [product] RemoveLocalInventoriesRequest product - * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + * @classdesc Represents a ControlService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function ControlService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ControlService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ControlService; /** - * Constructs a new RemoveLocalInventoriesRequest. + * Creates new ControlService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.ControlService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ControlService} RPC service. Useful where requests and/or responses are streamed. + */ + ControlService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.ControlService|createControl}. + * @memberof google.cloud.retail.v2.ControlService + * @typedef CreateControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Control} [response] Control + */ + + /** + * Calls CreateControl. + * @function createControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.ICreateControlRequest} request CreateControlRequest message or plain object + * @param {google.cloud.retail.v2.ControlService.CreateControlCallback} callback Node-style callback called with the error, if any, and Control + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.createControl = function createControl(request, callback) { + return this.rpcCall(createControl, $root.google.cloud.retail.v2.CreateControlRequest, $root.google.cloud.retail.v2.Control, request, callback); + }, "name", { value: "CreateControl" }); + + /** + * Calls CreateControl. + * @function createControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.ICreateControlRequest} request CreateControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ControlService|deleteControl}. + * @memberof google.cloud.retail.v2.ControlService + * @typedef DeleteControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteControl. + * @function deleteControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IDeleteControlRequest} request DeleteControlRequest message or plain object + * @param {google.cloud.retail.v2.ControlService.DeleteControlCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.deleteControl = function deleteControl(request, callback) { + return this.rpcCall(deleteControl, $root.google.cloud.retail.v2.DeleteControlRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteControl" }); + + /** + * Calls DeleteControl. + * @function deleteControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IDeleteControlRequest} request DeleteControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ControlService|updateControl}. + * @memberof google.cloud.retail.v2.ControlService + * @typedef UpdateControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Control} [response] Control + */ + + /** + * Calls UpdateControl. + * @function updateControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IUpdateControlRequest} request UpdateControlRequest message or plain object + * @param {google.cloud.retail.v2.ControlService.UpdateControlCallback} callback Node-style callback called with the error, if any, and Control + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.updateControl = function updateControl(request, callback) { + return this.rpcCall(updateControl, $root.google.cloud.retail.v2.UpdateControlRequest, $root.google.cloud.retail.v2.Control, request, callback); + }, "name", { value: "UpdateControl" }); + + /** + * Calls UpdateControl. + * @function updateControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IUpdateControlRequest} request UpdateControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ControlService|getControl}. + * @memberof google.cloud.retail.v2.ControlService + * @typedef GetControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Control} [response] Control + */ + + /** + * Calls GetControl. + * @function getControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IGetControlRequest} request GetControlRequest message or plain object + * @param {google.cloud.retail.v2.ControlService.GetControlCallback} callback Node-style callback called with the error, if any, and Control + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.getControl = function getControl(request, callback) { + return this.rpcCall(getControl, $root.google.cloud.retail.v2.GetControlRequest, $root.google.cloud.retail.v2.Control, request, callback); + }, "name", { value: "GetControl" }); + + /** + * Calls GetControl. + * @function getControl + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IGetControlRequest} request GetControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ControlService|listControls}. + * @memberof google.cloud.retail.v2.ControlService + * @typedef ListControlsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ListControlsResponse} [response] ListControlsResponse + */ + + /** + * Calls ListControls. + * @function listControls + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IListControlsRequest} request ListControlsRequest message or plain object + * @param {google.cloud.retail.v2.ControlService.ListControlsCallback} callback Node-style callback called with the error, if any, and ListControlsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ControlService.prototype.listControls = function listControls(request, callback) { + return this.rpcCall(listControls, $root.google.cloud.retail.v2.ListControlsRequest, $root.google.cloud.retail.v2.ListControlsResponse, request, callback); + }, "name", { value: "ListControls" }); + + /** + * Calls ListControls. + * @function listControls + * @memberof google.cloud.retail.v2.ControlService + * @instance + * @param {google.cloud.retail.v2.IListControlsRequest} request ListControlsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ControlService; + })(); + + v2.CreateControlRequest = (function() { + + /** + * Properties of a CreateControlRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveLocalInventoriesRequest. - * @implements IRemoveLocalInventoriesRequest + * @interface ICreateControlRequest + * @property {string|null} [parent] CreateControlRequest parent + * @property {google.cloud.retail.v2.IControl|null} [control] CreateControlRequest control + * @property {string|null} [controlId] CreateControlRequest controlId + */ + + /** + * Constructs a new CreateControlRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CreateControlRequest. + * @implements ICreateControlRequest * @constructor - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.ICreateControlRequest=} [properties] Properties to set */ - function RemoveLocalInventoriesRequest(properties) { - this.placeIds = []; + function CreateControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19001,120 +21005,103 @@ } /** - * RemoveLocalInventoriesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest - * @instance - */ - RemoveLocalInventoriesRequest.prototype.product = ""; - - /** - * RemoveLocalInventoriesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * CreateControlRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CreateControlRequest * @instance */ - RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; + CreateControlRequest.prototype.parent = ""; /** - * RemoveLocalInventoriesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * CreateControlRequest control. + * @member {google.cloud.retail.v2.IControl|null|undefined} control + * @memberof google.cloud.retail.v2.CreateControlRequest * @instance */ - RemoveLocalInventoriesRequest.prototype.removeTime = null; + CreateControlRequest.prototype.control = null; /** - * RemoveLocalInventoriesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * CreateControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2.CreateControlRequest * @instance */ - RemoveLocalInventoriesRequest.prototype.allowMissing = false; + CreateControlRequest.prototype.controlId = ""; /** - * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * Creates a new CreateControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + * @param {google.cloud.retail.v2.ICreateControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CreateControlRequest} CreateControlRequest instance */ - RemoveLocalInventoriesRequest.create = function create(properties) { - return new RemoveLocalInventoriesRequest(properties); + CreateControlRequest.create = function create(properties) { + return new CreateControlRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified CreateControlRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICreateControlRequest} message CreateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + CreateControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.control != null && Object.hasOwnProperty.call(message, "control")) + $root.google.cloud.retail.v2.Control.encode(message.control, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.controlId); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. + * Encodes the specified CreateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {google.cloud.retail.v2.ICreateControlRequest} message CreateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + CreateControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * Decodes a CreateControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2.CreateControlRequest} CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + CreateControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.product = reader.string(); + message.parent = reader.string(); break; } case 2: { - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - } - case 5: { - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.control = $root.google.cloud.retail.v2.Control.decode(reader, reader.uint32()); break; } case 3: { - message.allowMissing = reader.bool(); + message.controlId = reader.string(); break; } default: @@ -19126,164 +21113,145 @@ }; /** - * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2.CreateControlRequest} CreateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + CreateControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesRequest message. + * Verifies a CreateControlRequest message. * @function verify - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesRequest.verify = function verify(message) { + CreateControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.control != null && message.hasOwnProperty("control")) { + var error = $root.google.cloud.retail.v2.Control.verify(message.control); if (error) - return "removeTime." + error; + return "control." + error; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; return null; }; /** - * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @returns {google.cloud.retail.v2.CreateControlRequest} CreateControlRequest */ - RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest) + CreateControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CreateControlRequest) return object; - var message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2.RemoveLocalInventoriesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2.RemoveLocalInventoriesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + var message = new $root.google.cloud.retail.v2.CreateControlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.control != null) { + if (typeof object.control !== "object") + throw TypeError(".google.cloud.retail.v2.CreateControlRequest.control: object expected"); + message.control = $root.google.cloud.retail.v2.Control.fromObject(object.control); } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + if (object.controlId != null) + message.controlId = String(object.controlId); return message; }; /** - * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * Creates a plain object from a CreateControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static - * @param {google.cloud.retail.v2.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {google.cloud.retail.v2.CreateControlRequest} message CreateControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + CreateControlRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; if (options.defaults) { - object.product = ""; - object.allowMissing = false; - object.removeTime = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; + object.parent = ""; + object.control = null; + object.controlId = ""; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.control != null && message.hasOwnProperty("control")) + object.control = $root.google.cloud.retail.v2.Control.toObject(message.control, options); + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; return object; }; /** - * Converts this RemoveLocalInventoriesRequest to JSON. + * Converts this CreateControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + CreateControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RemoveLocalInventoriesRequest + * Gets the default type url for CreateControlRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @memberof google.cloud.retail.v2.CreateControlRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RemoveLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CreateControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.CreateControlRequest"; }; - return RemoveLocalInventoriesRequest; + return CreateControlRequest; })(); - v2.RemoveLocalInventoriesMetadata = (function() { + v2.UpdateControlRequest = (function() { /** - * Properties of a RemoveLocalInventoriesMetadata. + * Properties of an UpdateControlRequest. * @memberof google.cloud.retail.v2 - * @interface IRemoveLocalInventoriesMetadata + * @interface IUpdateControlRequest + * @property {google.cloud.retail.v2.IControl|null} [control] UpdateControlRequest control + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateControlRequest updateMask */ /** - * Constructs a new RemoveLocalInventoriesMetadata. + * Constructs a new UpdateControlRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveLocalInventoriesMetadata. - * @implements IRemoveLocalInventoriesMetadata + * @classdesc Represents an UpdateControlRequest. + * @implements IUpdateControlRequest * @constructor - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IUpdateControlRequest=} [properties] Properties to set */ - function RemoveLocalInventoriesMetadata(properties) { + function UpdateControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19291,63 +21259,91 @@ } /** - * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * UpdateControlRequest control. + * @member {google.cloud.retail.v2.IControl|null|undefined} control + * @memberof google.cloud.retail.v2.UpdateControlRequest + * @instance + */ + UpdateControlRequest.prototype.control = null; + + /** + * UpdateControlRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateControlRequest + * @instance + */ + UpdateControlRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + * @param {google.cloud.retail.v2.IUpdateControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateControlRequest} UpdateControlRequest instance */ - RemoveLocalInventoriesMetadata.create = function create(properties) { - return new RemoveLocalInventoriesMetadata(properties); + UpdateControlRequest.create = function create(properties) { + return new UpdateControlRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified UpdateControlRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateControlRequest} message UpdateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + UpdateControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.control != null && Object.hasOwnProperty.call(message, "control")) + $root.google.cloud.retail.v2.Control.encode(message.control, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. + * Encodes the specified UpdateControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IUpdateControlRequest} message UpdateControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + UpdateControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * Decodes an UpdateControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2.UpdateControlRequest} UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + UpdateControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.control = $root.google.cloud.retail.v2.Control.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -19357,108 +21353,141 @@ }; /** - * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * Decodes an UpdateControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2.UpdateControlRequest} UpdateControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + UpdateControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesMetadata message. + * Verifies an UpdateControlRequest message. * @function verify - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesMetadata.verify = function verify(message) { + UpdateControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.control != null && message.hasOwnProperty("control")) { + var error = $root.google.cloud.retail.v2.Control.verify(message.control); + if (error) + return "control." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } return null; }; /** - * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an UpdateControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @returns {google.cloud.retail.v2.UpdateControlRequest} UpdateControlRequest */ - RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata) + UpdateControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateControlRequest) return object; - return new $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata(); + var message = new $root.google.cloud.retail.v2.UpdateControlRequest(); + if (object.control != null) { + if (typeof object.control !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateControlRequest.control: object expected"); + message.control = $root.google.cloud.retail.v2.Control.fromObject(object.control); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateControlRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; }; /** - * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * Creates a plain object from an UpdateControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static - * @param {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {google.cloud.retail.v2.UpdateControlRequest} message UpdateControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesMetadata.toObject = function toObject() { - return {}; + UpdateControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.control = null; + object.updateMask = null; + } + if (message.control != null && message.hasOwnProperty("control")) + object.control = $root.google.cloud.retail.v2.Control.toObject(message.control, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; }; /** - * Converts this RemoveLocalInventoriesMetadata to JSON. + * Converts this UpdateControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + UpdateControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RemoveLocalInventoriesMetadata + * Gets the default type url for UpdateControlRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @memberof google.cloud.retail.v2.UpdateControlRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RemoveLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + UpdateControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"; + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateControlRequest"; }; - return RemoveLocalInventoriesMetadata; + return UpdateControlRequest; })(); - v2.RemoveLocalInventoriesResponse = (function() { + v2.DeleteControlRequest = (function() { /** - * Properties of a RemoveLocalInventoriesResponse. + * Properties of a DeleteControlRequest. * @memberof google.cloud.retail.v2 - * @interface IRemoveLocalInventoriesResponse + * @interface IDeleteControlRequest + * @property {string|null} [name] DeleteControlRequest name */ /** - * Constructs a new RemoveLocalInventoriesResponse. + * Constructs a new DeleteControlRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveLocalInventoriesResponse. - * @implements IRemoveLocalInventoriesResponse + * @classdesc Represents a DeleteControlRequest. + * @implements IDeleteControlRequest * @constructor - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IDeleteControlRequest=} [properties] Properties to set */ - function RemoveLocalInventoriesResponse(properties) { + function DeleteControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19466,63 +21495,77 @@ } /** - * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * DeleteControlRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.DeleteControlRequest + * @instance + */ + DeleteControlRequest.prototype.name = ""; + + /** + * Creates a new DeleteControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + * @param {google.cloud.retail.v2.IDeleteControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.DeleteControlRequest} DeleteControlRequest instance */ - RemoveLocalInventoriesResponse.create = function create(properties) { - return new RemoveLocalInventoriesResponse(properties); + DeleteControlRequest.create = function create(properties) { + return new DeleteControlRequest(properties); }; /** - * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified DeleteControlRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2.IDeleteControlRequest} message DeleteControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + DeleteControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. + * Encodes the specified DeleteControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {google.cloud.retail.v2.IDeleteControlRequest} message DeleteControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + DeleteControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * Decodes a DeleteControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2.DeleteControlRequest} DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + DeleteControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19532,114 +21575,122 @@ }; /** - * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * Decodes a DeleteControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2.DeleteControlRequest} DeleteControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + DeleteControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveLocalInventoriesResponse message. + * Verifies a DeleteControlRequest message. * @function verify - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveLocalInventoriesResponse.verify = function verify(message) { + DeleteControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @returns {google.cloud.retail.v2.DeleteControlRequest} DeleteControlRequest */ - RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse) + DeleteControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.DeleteControlRequest) return object; - return new $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse(); + var message = new $root.google.cloud.retail.v2.DeleteControlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; }; /** - * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * Creates a plain object from a DeleteControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static - * @param {google.cloud.retail.v2.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {google.cloud.retail.v2.DeleteControlRequest} message DeleteControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveLocalInventoriesResponse.toObject = function toObject() { - return {}; + DeleteControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; }; /** - * Converts this RemoveLocalInventoriesResponse to JSON. + * Converts this DeleteControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @instance * @returns {Object.} JSON object */ - RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + DeleteControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RemoveLocalInventoriesResponse + * Gets the default type url for DeleteControlRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @memberof google.cloud.retail.v2.DeleteControlRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RemoveLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + DeleteControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.DeleteControlRequest"; }; - return RemoveLocalInventoriesResponse; + return DeleteControlRequest; })(); - v2.RemoveFulfillmentPlacesRequest = (function() { + v2.GetControlRequest = (function() { /** - * Properties of a RemoveFulfillmentPlacesRequest. + * Properties of a GetControlRequest. * @memberof google.cloud.retail.v2 - * @interface IRemoveFulfillmentPlacesRequest - * @property {string|null} [product] RemoveFulfillmentPlacesRequest product - * @property {string|null} [type] RemoveFulfillmentPlacesRequest type - * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds - * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime - * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + * @interface IGetControlRequest + * @property {string|null} [name] GetControlRequest name */ /** - * Constructs a new RemoveFulfillmentPlacesRequest. + * Constructs a new GetControlRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveFulfillmentPlacesRequest. - * @implements IRemoveFulfillmentPlacesRequest + * @classdesc Represents a GetControlRequest. + * @implements IGetControlRequest * @constructor - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetControlRequest=} [properties] Properties to set */ - function RemoveFulfillmentPlacesRequest(properties) { - this.placeIds = []; + function GetControlRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19647,134 +21698,75 @@ } /** - * RemoveFulfillmentPlacesRequest product. - * @member {string} product - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.product = ""; - - /** - * RemoveFulfillmentPlacesRequest type. - * @member {string} type - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.type = ""; - - /** - * RemoveFulfillmentPlacesRequest placeIds. - * @member {Array.} placeIds - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; - - /** - * RemoveFulfillmentPlacesRequest removeTime. - * @member {google.protobuf.ITimestamp|null|undefined} removeTime - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest - * @instance - */ - RemoveFulfillmentPlacesRequest.prototype.removeTime = null; - - /** - * RemoveFulfillmentPlacesRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * GetControlRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetControlRequest * @instance */ - RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + GetControlRequest.prototype.name = ""; /** - * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * Creates a new GetControlRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + * @param {google.cloud.retail.v2.IGetControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetControlRequest} GetControlRequest instance */ - RemoveFulfillmentPlacesRequest.create = function create(properties) { - return new RemoveFulfillmentPlacesRequest(properties); + GetControlRequest.create = function create(properties) { + return new GetControlRequest(properties); }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified GetControlRequest message. Does not implicitly {@link google.cloud.retail.v2.GetControlRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetControlRequest} message GetControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + GetControlRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.placeIds != null && message.placeIds.length) - for (var i = 0; i < message.placeIds.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); - if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) - $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * Encodes the specified GetControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetControlRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {google.cloud.retail.v2.IGetControlRequest} message GetControlRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetControlRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * Decodes a GetControlRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.GetControlRequest} GetControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + GetControlRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetControlRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.product = reader.string(); - break; - } - case 2: { - message.type = reader.string(); - break; - } - case 3: { - if (!(message.placeIds && message.placeIds.length)) - message.placeIds = []; - message.placeIds.push(reader.string()); - break; - } - case 4: { - message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.allowMissing = reader.bool(); + message.name = reader.string(); break; } default: @@ -19786,172 +21778,125 @@ }; /** - * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * Decodes a GetControlRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.GetControlRequest} GetControlRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + GetControlRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RemoveFulfillmentPlacesRequest message. + * Verifies a GetControlRequest message. * @function verify - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RemoveFulfillmentPlacesRequest.verify = function verify(message) { + GetControlRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.placeIds != null && message.hasOwnProperty("placeIds")) { - if (!Array.isArray(message.placeIds)) - return "placeIds: array expected"; - for (var i = 0; i < message.placeIds.length; ++i) - if (!$util.isString(message.placeIds[i])) - return "placeIds: string[] expected"; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.removeTime); - if (error) - return "removeTime." + error; - } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetControlRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @returns {google.cloud.retail.v2.GetControlRequest} GetControlRequest */ - RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest) + GetControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetControlRequest) return object; - var message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); - if (object.product != null) - message.product = String(object.product); - if (object.type != null) - message.type = String(object.type); - if (object.placeIds) { - if (!Array.isArray(object.placeIds)) - throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.placeIds: array expected"); - message.placeIds = []; - for (var i = 0; i < object.placeIds.length; ++i) - message.placeIds[i] = String(object.placeIds[i]); - } - if (object.removeTime != null) { - if (typeof object.removeTime !== "object") - throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.removeTime: object expected"); - message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); - } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); + var message = new $root.google.cloud.retail.v2.GetControlRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetControlRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static - * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {google.cloud.retail.v2.GetControlRequest} message GetControlRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + GetControlRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.placeIds = []; - if (options.defaults) { - object.product = ""; - object.type = ""; - object.removeTime = null; - object.allowMissing = false; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.placeIds && message.placeIds.length) { - object.placeIds = []; - for (var j = 0; j < message.placeIds.length; ++j) - object.placeIds[j] = message.placeIds[j]; - } - if (message.removeTime != null && message.hasOwnProperty("removeTime")) - object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this RemoveFulfillmentPlacesRequest to JSON. + * Converts this GetControlRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @instance * @returns {Object.} JSON object */ - RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + GetControlRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RemoveFulfillmentPlacesRequest + * Gets the default type url for GetControlRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @memberof google.cloud.retail.v2.GetControlRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RemoveFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"; + return typeUrlPrefix + "/google.cloud.retail.v2.GetControlRequest"; }; - return RemoveFulfillmentPlacesRequest; + return GetControlRequest; })(); - v2.RemoveFulfillmentPlacesMetadata = (function() { + v2.ListControlsRequest = (function() { /** - * Properties of a RemoveFulfillmentPlacesMetadata. + * Properties of a ListControlsRequest. * @memberof google.cloud.retail.v2 - * @interface IRemoveFulfillmentPlacesMetadata + * @interface IListControlsRequest + * @property {string|null} [parent] ListControlsRequest parent + * @property {number|null} [pageSize] ListControlsRequest pageSize + * @property {string|null} [pageToken] ListControlsRequest pageToken + * @property {string|null} [filter] ListControlsRequest filter */ /** - * Constructs a new RemoveFulfillmentPlacesMetadata. + * Constructs a new ListControlsRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveFulfillmentPlacesMetadata. - * @implements IRemoveFulfillmentPlacesMetadata + * @classdesc Represents a ListControlsRequest. + * @implements IListControlsRequest * @constructor - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @param {google.cloud.retail.v2.IListControlsRequest=} [properties] Properties to set */ - function RemoveFulfillmentPlacesMetadata(properties) { + function ListControlsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19959,63 +21904,119 @@ } /** - * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata - * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + * ListControlsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListControlsRequest + * @instance */ - RemoveFulfillmentPlacesMetadata.create = function create(properties) { - return new RemoveFulfillmentPlacesMetadata(properties); - }; + ListControlsRequest.prototype.parent = ""; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * ListControlsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.pageSize = 0; + + /** + * ListControlsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.pageToken = ""; + + /** + * ListControlsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.ListControlsRequest + * @instance + */ + ListControlsRequest.prototype.filter = ""; + + /** + * Creates a new ListControlsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListControlsRequest + * @static + * @param {google.cloud.retail.v2.IListControlsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListControlsRequest} ListControlsRequest instance + */ + ListControlsRequest.create = function create(properties) { + return new ListControlsRequest(properties); + }; + + /** + * Encodes the specified ListControlsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListControlsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ListControlsRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IListControlsRequest} message ListControlsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + ListControlsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); return writer; }; /** - * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * Encodes the specified ListControlsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListControlsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ListControlsRequest * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {google.cloud.retail.v2.IListControlsRequest} message ListControlsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListControlsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * Decodes a ListControlsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ListControlsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.ListControlsRequest} ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + ListControlsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListControlsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -20025,1417 +22026,10652 @@ }; /** - * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListControlsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @memberof google.cloud.retail.v2.ListControlsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @returns {google.cloud.retail.v2.ListControlsRequest} ListControlsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + ListControlsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListControlsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.ListControlsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListControlsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListControlsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListControlsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListControlsRequest} ListControlsRequest + */ + ListControlsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListControlsRequest) + return object; + var message = new $root.google.cloud.retail.v2.ListControlsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListControlsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListControlsRequest + * @static + * @param {google.cloud.retail.v2.ListControlsRequest} message ListControlsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListControlsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListControlsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListControlsRequest + * @instance + * @returns {Object.} JSON object + */ + ListControlsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListControlsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListControlsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListControlsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListControlsRequest"; + }; + + return ListControlsRequest; + })(); + + v2.ListControlsResponse = (function() { + + /** + * Properties of a ListControlsResponse. + * @memberof google.cloud.retail.v2 + * @interface IListControlsResponse + * @property {Array.|null} [controls] ListControlsResponse controls + * @property {string|null} [nextPageToken] ListControlsResponse nextPageToken + */ + + /** + * Constructs a new ListControlsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListControlsResponse. + * @implements IListControlsResponse + * @constructor + * @param {google.cloud.retail.v2.IListControlsResponse=} [properties] Properties to set + */ + function ListControlsResponse(properties) { + this.controls = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListControlsResponse controls. + * @member {Array.} controls + * @memberof google.cloud.retail.v2.ListControlsResponse + * @instance + */ + ListControlsResponse.prototype.controls = $util.emptyArray; + + /** + * ListControlsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListControlsResponse + * @instance + */ + ListControlsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListControlsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {google.cloud.retail.v2.IListControlsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListControlsResponse} ListControlsResponse instance + */ + ListControlsResponse.create = function create(properties) { + return new ListControlsResponse(properties); + }; + + /** + * Encodes the specified ListControlsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListControlsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {google.cloud.retail.v2.IListControlsResponse} message ListControlsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListControlsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.controls != null && message.controls.length) + for (var i = 0; i < message.controls.length; ++i) + $root.google.cloud.retail.v2.Control.encode(message.controls[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListControlsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListControlsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {google.cloud.retail.v2.IListControlsResponse} message ListControlsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListControlsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ListControlsResponse} ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListControlsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.controls && message.controls.length)) + message.controls = []; + message.controls.push($root.google.cloud.retail.v2.Control.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListControlsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ListControlsResponse} ListControlsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListControlsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListControlsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListControlsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.controls != null && message.hasOwnProperty("controls")) { + if (!Array.isArray(message.controls)) + return "controls: array expected"; + for (var i = 0; i < message.controls.length; ++i) { + var error = $root.google.cloud.retail.v2.Control.verify(message.controls[i]); + if (error) + return "controls." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListControlsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListControlsResponse} ListControlsResponse + */ + ListControlsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListControlsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ListControlsResponse(); + if (object.controls) { + if (!Array.isArray(object.controls)) + throw TypeError(".google.cloud.retail.v2.ListControlsResponse.controls: array expected"); + message.controls = []; + for (var i = 0; i < object.controls.length; ++i) { + if (typeof object.controls[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListControlsResponse.controls: object expected"); + message.controls[i] = $root.google.cloud.retail.v2.Control.fromObject(object.controls[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListControlsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {google.cloud.retail.v2.ListControlsResponse} message ListControlsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListControlsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.controls = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.controls && message.controls.length) { + object.controls = []; + for (var j = 0; j < message.controls.length; ++j) + object.controls[j] = $root.google.cloud.retail.v2.Control.toObject(message.controls[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListControlsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListControlsResponse + * @instance + * @returns {Object.} JSON object + */ + ListControlsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListControlsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListControlsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListControlsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListControlsResponse"; + }; + + return ListControlsResponse; + })(); + + v2.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.PredictionService|predict}. + * @memberof google.cloud.retail.v2.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2.PredictionService + * @instance + * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2.PredictRequest, $root.google.cloud.retail.v2.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2.PredictionService + * @instance + * @param {google.cloud.retail.v2.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2 + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2.UserEvent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.validateOnly = reader.bool(); + break; + } + case 7: { + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; - /** - * Verifies a RemoveFulfillmentPlacesMetadata message. - * @function verify - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RemoveFulfillmentPlacesMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictRequest} PredictRequest + */ + PredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictRequest) + return object; + var message = new $root.google.cloud.retail.v2.PredictRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.userEvent != null) { + if (typeof object.userEvent !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.userEvent: object expected"); + message.userEvent = $root.google.cloud.retail.v2.UserEvent.fromObject(object.userEvent); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.params) { + if (typeof object.params !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); + message.params = {}; + for (var keys = Object.keys(object.params), i = 0; i < keys.length; ++i) { + if (typeof object.params[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.params: object expected"); + message.params[keys[i]] = $root.google.protobuf.Value.fromObject(object.params[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2.PredictRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a PredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {google.cloud.retail.v2.PredictRequest} message PredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.params = {}; + object.labels = {}; + } + if (options.defaults) { + object.placement = ""; + object.userEvent = null; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.validateOnly = false; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) + object.userEvent = $root.google.cloud.retail.v2.UserEvent.toObject(message.userEvent, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + var keys2; + if (message.params && (keys2 = Object.keys(message.params)).length) { + object.params = {}; + for (var j = 0; j < keys2.length; ++j) + object.params[keys2[j]] = $root.google.protobuf.Value.toObject(message.params[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this PredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictRequest + * @instance + * @returns {Object.} JSON object + */ + PredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PredictRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PredictRequest"; + }; + + return PredictRequest; + })(); + + v2.PredictResponse = (function() { + + /** + * Properties of a PredictResponse. + * @memberof google.cloud.retail.v2 + * @interface IPredictResponse + * @property {Array.|null} [results] PredictResponse results + * @property {string|null} [attributionToken] PredictResponse attributionToken + * @property {Array.|null} [missingIds] PredictResponse missingIds + * @property {boolean|null} [validateOnly] PredictResponse validateOnly + */ + + /** + * Constructs a new PredictResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PredictResponse. + * @implements IPredictResponse + * @constructor + * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + */ + function PredictResponse(properties) { + this.results = []; + this.missingIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.results = $util.emptyArray; + + /** + * PredictResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.attributionToken = ""; + + /** + * PredictResponse missingIds. + * @member {Array.} missingIds + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.missingIds = $util.emptyArray; + + /** + * PredictResponse validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + */ + PredictResponse.prototype.validateOnly = false; + + /** + * Creates a new PredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse instance + */ + PredictResponse.create = function create(properties) { + return new PredictResponse(properties); + }; + + /** + * Encodes the specified PredictResponse message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2.PredictResponse.PredictionResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributionToken); + if (message.missingIds != null && message.missingIds.length) + for (var i = 0; i < message.missingIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.missingIds[i]); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified PredictResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.IPredictResponse} message PredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.PredictResponse.PredictionResult.decode(reader, reader.uint32())); + break; + } + case 2: { + message.attributionToken = reader.string(); + break; + } + case 3: { + if (!(message.missingIds && message.missingIds.length)) + message.missingIds = []; + message.missingIds.push(reader.string()); + break; + } + case 4: { + message.validateOnly = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictResponse message. + * @function verify + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.missingIds != null && message.hasOwnProperty("missingIds")) { + if (!Array.isArray(message.missingIds)) + return "missingIds: array expected"; + for (var i = 0; i < message.missingIds.length; ++i) + if (!$util.isString(message.missingIds[i])) + return "missingIds: string[] expected"; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a PredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictResponse} PredictResponse + */ + PredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictResponse) + return object; + var message = new $root.google.cloud.retail.v2.PredictResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2.PredictResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.fromObject(object.results[i]); + } + } + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.missingIds) { + if (!Array.isArray(object.missingIds)) + throw TypeError(".google.cloud.retail.v2.PredictResponse.missingIds: array expected"); + message.missingIds = []; + for (var i = 0; i < object.missingIds.length; ++i) + message.missingIds[i] = String(object.missingIds[i]); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a PredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {google.cloud.retail.v2.PredictResponse} message PredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.missingIds = []; + } + if (options.defaults) { + object.attributionToken = ""; + object.validateOnly = false; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2.PredictResponse.PredictionResult.toObject(message.results[j], options); + } + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.missingIds && message.missingIds.length) { + object.missingIds = []; + for (var j = 0; j < message.missingIds.length; ++j) + object.missingIds[j] = message.missingIds[j]; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this PredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictResponse + * @instance + * @returns {Object.} JSON object + */ + PredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PredictResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PredictResponse"; + }; + + PredictResponse.PredictionResult = (function() { + + /** + * Properties of a PredictionResult. + * @memberof google.cloud.retail.v2.PredictResponse + * @interface IPredictionResult + * @property {string|null} [id] PredictionResult id + * @property {Object.|null} [metadata] PredictionResult metadata + */ + + /** + * Constructs a new PredictionResult. + * @memberof google.cloud.retail.v2.PredictResponse + * @classdesc Represents a PredictionResult. + * @implements IPredictionResult + * @constructor + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set + */ + function PredictionResult(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictionResult id. + * @member {string} id + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.id = ""; + + /** + * PredictionResult metadata. + * @member {Object.} metadata + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + */ + PredictionResult.prototype.metadata = $util.emptyObject; + + /** + * Creates a new PredictionResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult instance + */ + PredictionResult.create = function create(properties) { + return new PredictionResult(properties); + }; + + /** + * Encodes the specified PredictionResult message. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.metadata[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified PredictionResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PredictResponse.PredictionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.IPredictionResult} message PredictionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.id = reader.string(); + break; + } + case 2: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictionResult message. + * @function verify + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.metadata[key[i]]); + if (error) + return "metadata." + error; + } + } + return null; + }; + + /** + * Creates a PredictionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PredictResponse.PredictionResult} PredictionResult + */ + PredictionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PredictResponse.PredictionResult) + return object; + var message = new $root.google.cloud.retail.v2.PredictResponse.PredictionResult(); + if (object.id != null) + message.id = String(object.id); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) { + if (typeof object.metadata[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.PredictResponse.PredictionResult.metadata: object expected"); + message.metadata[keys[i]] = $root.google.protobuf.Value.fromObject(object.metadata[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a PredictionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {google.cloud.retail.v2.PredictResponse.PredictionResult} message PredictionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PredictionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.id = ""; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = $root.google.protobuf.Value.toObject(message.metadata[keys2[j]], options); + } + return object; + }; + + /** + * Converts this PredictionResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @instance + * @returns {Object.} JSON object + */ + PredictionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PredictionResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PredictResponse.PredictionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PredictionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PredictResponse.PredictionResult"; + }; + + return PredictionResult; + })(); + + return PredictResponse; + })(); + + v2.ProductService = (function() { + + /** + * Constructs a new ProductService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ProductService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ProductService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ProductService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductService; + + /** + * Creates new ProductService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.ProductService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ProductService} RPC service. Useful where requests and/or responses are streamed. + */ + ProductService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|createProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef CreateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product + */ + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.CreateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.createProduct = function createProduct(request, callback) { + return this.rpcCall(createProduct, $root.google.cloud.retail.v2.CreateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "CreateProduct" }); + + /** + * Calls CreateProduct. + * @function createProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ICreateProductRequest} request CreateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|getProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef GetProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product + */ + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.GetProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.getProduct = function getProduct(request, callback) { + return this.rpcCall(getProduct, $root.google.cloud.retail.v2.GetProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "GetProduct" }); + + /** + * Calls GetProduct. + * @function getProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IGetProductRequest} request GetProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|listProducts}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef ListProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ListProductsResponse} [response] ListProductsResponse + */ + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IListProductsRequest} request ListProductsRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.listProducts = function listProducts(request, callback) { + return this.rpcCall(listProducts, $root.google.cloud.retail.v2.ListProductsRequest, $root.google.cloud.retail.v2.ListProductsResponse, request, callback); + }, "name", { value: "ListProducts" }); + + /** + * Calls ListProducts. + * @function listProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IListProductsRequest} request ListProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|updateProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef UpdateProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.Product} [response] Product + */ + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.updateProduct = function updateProduct(request, callback) { + return this.rpcCall(updateProduct, $root.google.cloud.retail.v2.UpdateProductRequest, $root.google.cloud.retail.v2.Product, request, callback); + }, "name", { value: "UpdateProduct" }); + + /** + * Calls UpdateProduct. + * @function updateProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IUpdateProductRequest} request UpdateProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|deleteProduct}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef DeleteProductCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.deleteProduct = function deleteProduct(request, callback) { + return this.rpcCall(deleteProduct, $root.google.cloud.retail.v2.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteProduct" }); + + /** + * Calls DeleteProduct. + * @function deleteProduct + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IDeleteProductRequest} request DeleteProductRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|importProducts}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef ImportProductsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.ImportProductsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.importProducts = function importProducts(request, callback) { + return this.rpcCall(importProducts, $root.google.cloud.retail.v2.ImportProductsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportProducts" }); + + /** + * Calls ImportProducts. + * @function importProducts + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IImportProductsRequest} request ImportProductsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|setInventory}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef SetInventoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.SetInventoryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.setInventory = function setInventory(request, callback) { + return this.rpcCall(setInventory, $root.google.cloud.retail.v2.SetInventoryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetInventory" }); + + /** + * Calls SetInventory. + * @function setInventory + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.ISetInventoryRequest} request SetInventoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|addFulfillmentPlaces}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef AddFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.AddFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addFulfillmentPlaces = function addFulfillmentPlaces(request, callback) { + return this.rpcCall(addFulfillmentPlaces, $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddFulfillmentPlaces" }); + + /** + * Calls AddFulfillmentPlaces. + * @function addFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} request AddFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|removeFulfillmentPlaces}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef RemoveFulfillmentPlacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.RemoveFulfillmentPlacesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeFulfillmentPlaces = function removeFulfillmentPlaces(request, callback) { + return this.rpcCall(removeFulfillmentPlaces, $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveFulfillmentPlaces" }); + + /** + * Calls RemoveFulfillmentPlaces. + * @function removeFulfillmentPlaces + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} request RemoveFulfillmentPlacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|addLocalInventories}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef AddLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.AddLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.addLocalInventories = function addLocalInventories(request, callback) { + return this.rpcCall(addLocalInventories, $root.google.cloud.retail.v2.AddLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AddLocalInventories" }); + + /** + * Calls AddLocalInventories. + * @function addLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} request AddLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2.ProductService|removeLocalInventories}. + * @memberof google.cloud.retail.v2.ProductService + * @typedef RemoveLocalInventoriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @param {google.cloud.retail.v2.ProductService.RemoveLocalInventoriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ProductService.prototype.removeLocalInventories = function removeLocalInventories(request, callback) { + return this.rpcCall(removeLocalInventories, $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RemoveLocalInventories" }); + + /** + * Calls RemoveLocalInventories. + * @function removeLocalInventories + * @memberof google.cloud.retail.v2.ProductService + * @instance + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} request RemoveLocalInventoriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ProductService; + })(); + + v2.CreateProductRequest = (function() { + + /** + * Properties of a CreateProductRequest. + * @memberof google.cloud.retail.v2 + * @interface ICreateProductRequest + * @property {string|null} [parent] CreateProductRequest parent + * @property {google.cloud.retail.v2.IProduct|null} [product] CreateProductRequest product + * @property {string|null} [productId] CreateProductRequest productId + */ + + /** + * Constructs a new CreateProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CreateProductRequest. + * @implements ICreateProductRequest + * @constructor + * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set + */ + function CreateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateProductRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.parent = ""; + + /** + * CreateProductRequest product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.product = null; + + /** + * CreateProductRequest productId. + * @member {string} productId + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + */ + CreateProductRequest.prototype.productId = ""; + + /** + * Creates a new CreateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.ICreateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest instance + */ + CreateProductRequest.create = function create(properties) { + return new CreateProductRequest(properties); + }; + + /** + * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); + return writer; + }; + + /** + * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.ICreateProductRequest} message CreateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.productId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CreateProductRequest} CreateProductRequest + */ + CreateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CreateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.CreateProductRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.CreateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {google.cloud.retail.v2.CreateProductRequest} message CreateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.product = null; + object.productId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this CreateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CreateProductRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CreateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CreateProductRequest"; + }; + + return CreateProductRequest; + })(); + + v2.GetProductRequest = (function() { + + /** + * Properties of a GetProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IGetProductRequest + * @property {string|null} [name] GetProductRequest name + */ + + /** + * Constructs a new GetProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a GetProductRequest. + * @implements IGetProductRequest + * @constructor + * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + */ + function GetProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetProductRequest + * @instance + */ + GetProductRequest.prototype.name = ""; + + /** + * Creates a new GetProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.IGetProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest instance + */ + GetProductRequest.create = function create(properties) { + return new GetProductRequest(properties); + }; + + /** + * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.IGetProductRequest} message GetProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.GetProductRequest} GetProductRequest + */ + GetProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.GetProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {google.cloud.retail.v2.GetProductRequest} message GetProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.GetProductRequest + * @instance + * @returns {Object.} JSON object + */ + GetProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GetProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GetProductRequest"; + }; + + return GetProductRequest; + })(); + + v2.UpdateProductRequest = (function() { + + /** + * Properties of an UpdateProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateProductRequest + * @property {google.cloud.retail.v2.IProduct|null} [product] UpdateProductRequest product + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask + * @property {boolean|null} [allowMissing] UpdateProductRequest allowMissing + */ + + /** + * Constructs a new UpdateProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an UpdateProductRequest. + * @implements IUpdateProductRequest + * @constructor + * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + */ + function UpdateProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateProductRequest product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.product = null; + + /** + * UpdateProductRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.updateMask = null; + + /** + * UpdateProductRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + */ + UpdateProductRequest.prototype.allowMissing = false; + + /** + * Creates a new UpdateProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.IUpdateProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest instance + */ + UpdateProductRequest.create = function create(properties) { + return new UpdateProductRequest(properties); + }; + + /** + * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UpdateProductRequest} UpdateProductRequest + */ + UpdateProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.UpdateProductRequest(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateProductRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {google.cloud.retail.v2.UpdateProductRequest} message UpdateProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.updateMask = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this UpdateProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UpdateProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateProductRequest"; + }; + + return UpdateProductRequest; + })(); + + v2.DeleteProductRequest = (function() { + + /** + * Properties of a DeleteProductRequest. + * @memberof google.cloud.retail.v2 + * @interface IDeleteProductRequest + * @property {string|null} [name] DeleteProductRequest name + */ + + /** + * Constructs a new DeleteProductRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a DeleteProductRequest. + * @implements IDeleteProductRequest + * @constructor + * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + */ + function DeleteProductRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteProductRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @instance + */ + DeleteProductRequest.prototype.name = ""; + + /** + * Creates a new DeleteProductRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.IDeleteProductRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest instance + */ + DeleteProductRequest.create = function create(properties) { + return new DeleteProductRequest(properties); + }; + + /** + * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteProductRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteProductRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProductRequest message. + * @function verify + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProductRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.DeleteProductRequest} DeleteProductRequest + */ + DeleteProductRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.DeleteProductRequest) + return object; + var message = new $root.google.cloud.retail.v2.DeleteProductRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {google.cloud.retail.v2.DeleteProductRequest} message DeleteProductRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProductRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteProductRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProductRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteProductRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.DeleteProductRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.DeleteProductRequest"; + }; + + return DeleteProductRequest; + })(); + + v2.ListProductsRequest = (function() { + + /** + * Properties of a ListProductsRequest. + * @memberof google.cloud.retail.v2 + * @interface IListProductsRequest + * @property {string|null} [parent] ListProductsRequest parent + * @property {number|null} [pageSize] ListProductsRequest pageSize + * @property {string|null} [pageToken] ListProductsRequest pageToken + * @property {string|null} [filter] ListProductsRequest filter + * @property {google.protobuf.IFieldMask|null} [readMask] ListProductsRequest readMask + */ + + /** + * Constructs a new ListProductsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListProductsRequest. + * @implements IListProductsRequest + * @constructor + * @param {google.cloud.retail.v2.IListProductsRequest=} [properties] Properties to set + */ + function ListProductsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProductsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.parent = ""; + + /** + * ListProductsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageSize = 0; + + /** + * ListProductsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.pageToken = ""; + + /** + * ListProductsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.filter = ""; + + /** + * ListProductsRequest readMask. + * @member {google.protobuf.IFieldMask|null|undefined} readMask + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + */ + ListProductsRequest.prototype.readMask = null; + + /** + * Creates a new ListProductsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {google.cloud.retail.v2.IListProductsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest instance + */ + ListProductsRequest.create = function create(properties) { + return new ListProductsRequest(properties); + }; + + /** + * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {google.cloud.retail.v2.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.readMask != null && Object.hasOwnProperty.call(message, "readMask")) + $root.google.protobuf.FieldMask.encode(message.readMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {google.cloud.retail.v2.IListProductsRequest} message ListProductsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListProductsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.readMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProductsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProductsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.readMask != null && message.hasOwnProperty("readMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.readMask); + if (error) + return "readMask." + error; + } + return null; + }; + + /** + * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListProductsRequest} ListProductsRequest + */ + ListProductsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListProductsRequest) + return object; + var message = new $root.google.cloud.retail.v2.ListProductsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.readMask != null) { + if (typeof object.readMask !== "object") + throw TypeError(".google.cloud.retail.v2.ListProductsRequest.readMask: object expected"); + message.readMask = $root.google.protobuf.FieldMask.fromObject(object.readMask); + } + return message; + }; + + /** + * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {google.cloud.retail.v2.ListProductsRequest} message ListProductsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProductsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.readMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.readMask != null && message.hasOwnProperty("readMask")) + object.readMask = $root.google.protobuf.FieldMask.toObject(message.readMask, options); + return object; + }; + + /** + * Converts this ListProductsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListProductsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProductsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListProductsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListProductsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListProductsRequest"; + }; + + return ListProductsRequest; + })(); + + v2.ListProductsResponse = (function() { + + /** + * Properties of a ListProductsResponse. + * @memberof google.cloud.retail.v2 + * @interface IListProductsResponse + * @property {Array.|null} [products] ListProductsResponse products + * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken + */ + + /** + * Constructs a new ListProductsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListProductsResponse. + * @implements IListProductsResponse + * @constructor + * @param {google.cloud.retail.v2.IListProductsResponse=} [properties] Properties to set + */ + function ListProductsResponse(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProductsResponse products. + * @member {Array.} products + * @memberof google.cloud.retail.v2.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.products = $util.emptyArray; + + /** + * ListProductsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListProductsResponse + * @instance + */ + ListProductsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProductsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {google.cloud.retail.v2.IListProductsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse instance + */ + ListProductsResponse.create = function create(properties) { + return new ListProductsResponse(properties); + }; + + /** + * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {google.cloud.retail.v2.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.google.cloud.retail.v2.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListProductsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {google.cloud.retail.v2.IListProductsResponse} message ListProductsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListProductsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.google.cloud.retail.v2.Product.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProductsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProductsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.google.cloud.retail.v2.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListProductsResponse} ListProductsResponse + */ + ListProductsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListProductsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ListProductsResponse(); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".google.cloud.retail.v2.ListProductsResponse.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListProductsResponse.products: object expected"); + message.products[i] = $root.google.cloud.retail.v2.Product.fromObject(object.products[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {google.cloud.retail.v2.ListProductsResponse} message ListProductsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProductsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.google.cloud.retail.v2.Product.toObject(message.products[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProductsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListProductsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProductsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListProductsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListProductsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListProductsResponse"; + }; + + return ListProductsResponse; + })(); + + v2.SetInventoryRequest = (function() { + + /** + * Properties of a SetInventoryRequest. + * @memberof google.cloud.retail.v2 + * @interface ISetInventoryRequest + * @property {google.cloud.retail.v2.IProduct|null} [inventory] SetInventoryRequest inventory + * @property {google.protobuf.IFieldMask|null} [setMask] SetInventoryRequest setMask + * @property {google.protobuf.ITimestamp|null} [setTime] SetInventoryRequest setTime + * @property {boolean|null} [allowMissing] SetInventoryRequest allowMissing + */ + + /** + * Constructs a new SetInventoryRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SetInventoryRequest. + * @implements ISetInventoryRequest + * @constructor + * @param {google.cloud.retail.v2.ISetInventoryRequest=} [properties] Properties to set + */ + function SetInventoryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetInventoryRequest inventory. + * @member {google.cloud.retail.v2.IProduct|null|undefined} inventory + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.inventory = null; + + /** + * SetInventoryRequest setMask. + * @member {google.protobuf.IFieldMask|null|undefined} setMask + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setMask = null; + + /** + * SetInventoryRequest setTime. + * @member {google.protobuf.ITimestamp|null|undefined} setTime + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.setTime = null; + + /** + * SetInventoryRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + */ + SetInventoryRequest.prototype.allowMissing = false; + + /** + * Creates a new SetInventoryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2.ISetInventoryRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest instance + */ + SetInventoryRequest.create = function create(properties) { + return new SetInventoryRequest(properties); + }; + + /** + * Encodes the specified SetInventoryRequest message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inventory != null && Object.hasOwnProperty.call(message, "inventory")) + $root.google.cloud.retail.v2.Product.encode(message.inventory, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.setMask != null && Object.hasOwnProperty.call(message, "setMask")) + $root.google.protobuf.FieldMask.encode(message.setMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.setTime != null && Object.hasOwnProperty.call(message, "setTime")) + $root.google.protobuf.Timestamp.encode(message.setTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified SetInventoryRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2.ISetInventoryRequest} message SetInventoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.inventory = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 2: { + message.setMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.setTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.allowMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryRequest message. + * @function verify + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inventory != null && message.hasOwnProperty("inventory")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.inventory); + if (error) + return "inventory." + error; + } + if (message.setMask != null && message.hasOwnProperty("setMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.setMask); + if (error) + return "setMask." + error; + } + if (message.setTime != null && message.hasOwnProperty("setTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.setTime); + if (error) + return "setTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a SetInventoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SetInventoryRequest} SetInventoryRequest + */ + SetInventoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetInventoryRequest) + return object; + var message = new $root.google.cloud.retail.v2.SetInventoryRequest(); + if (object.inventory != null) { + if (typeof object.inventory !== "object") + throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.inventory: object expected"); + message.inventory = $root.google.cloud.retail.v2.Product.fromObject(object.inventory); + } + if (object.setMask != null) { + if (typeof object.setMask !== "object") + throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.setMask: object expected"); + message.setMask = $root.google.protobuf.FieldMask.fromObject(object.setMask); + } + if (object.setTime != null) { + if (typeof object.setTime !== "object") + throw TypeError(".google.cloud.retail.v2.SetInventoryRequest.setTime: object expected"); + message.setTime = $root.google.protobuf.Timestamp.fromObject(object.setTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a SetInventoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {google.cloud.retail.v2.SetInventoryRequest} message SetInventoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.inventory = null; + object.setMask = null; + object.setTime = null; + object.allowMissing = false; + } + if (message.inventory != null && message.hasOwnProperty("inventory")) + object.inventory = $root.google.cloud.retail.v2.Product.toObject(message.inventory, options); + if (message.setMask != null && message.hasOwnProperty("setMask")) + object.setMask = $root.google.protobuf.FieldMask.toObject(message.setMask, options); + if (message.setTime != null && message.hasOwnProperty("setTime")) + object.setTime = $root.google.protobuf.Timestamp.toObject(message.setTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this SetInventoryRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @instance + * @returns {Object.} JSON object + */ + SetInventoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetInventoryRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetInventoryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryRequest"; + }; + + return SetInventoryRequest; + })(); + + v2.SetInventoryMetadata = (function() { + + /** + * Properties of a SetInventoryMetadata. + * @memberof google.cloud.retail.v2 + * @interface ISetInventoryMetadata + */ + + /** + * Constructs a new SetInventoryMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SetInventoryMetadata. + * @implements ISetInventoryMetadata + * @constructor + * @param {google.cloud.retail.v2.ISetInventoryMetadata=} [properties] Properties to set + */ + function SetInventoryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SetInventoryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2.ISetInventoryMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata instance + */ + SetInventoryMetadata.create = function create(properties) { + return new SetInventoryMetadata(properties); + }; + + /** + * Encodes the specified SetInventoryMetadata message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetInventoryMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2.ISetInventoryMetadata} message SetInventoryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetInventoryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SetInventoryMetadata} SetInventoryMetadata + */ + SetInventoryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetInventoryMetadata) + return object; + return new $root.google.cloud.retail.v2.SetInventoryMetadata(); + }; + + /** + * Creates a plain object from a SetInventoryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {google.cloud.retail.v2.SetInventoryMetadata} message SetInventoryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetInventoryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @instance + * @returns {Object.} JSON object + */ + SetInventoryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetInventoryMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetInventoryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryMetadata"; + }; + + return SetInventoryMetadata; + })(); + + v2.SetInventoryResponse = (function() { + + /** + * Properties of a SetInventoryResponse. + * @memberof google.cloud.retail.v2 + * @interface ISetInventoryResponse + */ + + /** + * Constructs a new SetInventoryResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SetInventoryResponse. + * @implements ISetInventoryResponse + * @constructor + * @param {google.cloud.retail.v2.ISetInventoryResponse=} [properties] Properties to set + */ + function SetInventoryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new SetInventoryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2.ISetInventoryResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse instance + */ + SetInventoryResponse.create = function create(properties) { + return new SetInventoryResponse(properties); + }; + + /** + * Encodes the specified SetInventoryResponse message. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetInventoryResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SetInventoryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2.ISetInventoryResponse} message SetInventoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetInventoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SetInventoryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetInventoryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetInventoryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetInventoryResponse message. + * @function verify + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetInventoryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetInventoryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SetInventoryResponse} SetInventoryResponse + */ + SetInventoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SetInventoryResponse) + return object; + return new $root.google.cloud.retail.v2.SetInventoryResponse(); + }; + + /** + * Creates a plain object from a SetInventoryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {google.cloud.retail.v2.SetInventoryResponse} message SetInventoryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetInventoryResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetInventoryResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @instance + * @returns {Object.} JSON object + */ + SetInventoryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetInventoryResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SetInventoryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetInventoryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SetInventoryResponse"; + }; + + return SetInventoryResponse; + })(); + + v2.AddFulfillmentPlacesRequest = (function() { + + /** + * Properties of an AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @interface IAddFulfillmentPlacesRequest + * @property {string|null} [product] AddFulfillmentPlacesRequest product + * @property {string|null} [type] AddFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] AddFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [addTime] AddFulfillmentPlacesRequest addTime + * @property {boolean|null} [allowMissing] AddFulfillmentPlacesRequest allowMissing + */ + + /** + * Constructs a new AddFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddFulfillmentPlacesRequest. + * @implements IAddFulfillmentPlacesRequest + * @constructor + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest=} [properties] Properties to set + */ + function AddFulfillmentPlacesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.product = ""; + + /** + * AddFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.type = ""; + + /** + * AddFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * AddFulfillmentPlacesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.addTime = null; + + /** + * AddFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + */ + AddFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest instance + */ + AddFulfillmentPlacesRequest.create = function create(properties) { + return new AddFulfillmentPlacesRequest(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesRequest} AddFulfillmentPlacesRequest + */ + AddFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.AddFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2.AddFulfillmentPlacesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.AddFulfillmentPlacesRequest} message AddFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this AddFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AddFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesRequest"; + }; + + return AddFulfillmentPlacesRequest; + })(); + + v2.AddFulfillmentPlacesMetadata = (function() { + + /** + * Properties of an AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IAddFulfillmentPlacesMetadata + */ + + /** + * Constructs a new AddFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddFulfillmentPlacesMetadata. + * @implements IAddFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function AddFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata instance + */ + AddFulfillmentPlacesMetadata.create = function create(properties) { + return new AddFulfillmentPlacesMetadata(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} AddFulfillmentPlacesMetadata + */ + AddFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2.AddFulfillmentPlacesMetadata(); + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.AddFulfillmentPlacesMetadata} message AddFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AddFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"; + }; + + return AddFulfillmentPlacesMetadata; + })(); + + v2.AddFulfillmentPlacesResponse = (function() { + + /** + * Properties of an AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @interface IAddFulfillmentPlacesResponse + */ + + /** + * Constructs a new AddFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddFulfillmentPlacesResponse. + * @implements IAddFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse=} [properties] Properties to set + */ + function AddFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse instance + */ + AddFulfillmentPlacesResponse.create = function create(properties) { + return new AddFulfillmentPlacesResponse(properties); + }; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IAddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddFulfillmentPlacesResponse} AddFulfillmentPlacesResponse + */ + AddFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2.AddFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from an AddFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.AddFulfillmentPlacesResponse} message AddFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + AddFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AddFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddFulfillmentPlacesResponse"; + }; + + return AddFulfillmentPlacesResponse; + })(); + + v2.AddLocalInventoriesRequest = (function() { + + /** + * Properties of an AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2 + * @interface IAddLocalInventoriesRequest + * @property {string|null} [product] AddLocalInventoriesRequest product + * @property {Array.|null} [localInventories] AddLocalInventoriesRequest localInventories + * @property {google.protobuf.IFieldMask|null} [addMask] AddLocalInventoriesRequest addMask + * @property {google.protobuf.ITimestamp|null} [addTime] AddLocalInventoriesRequest addTime + * @property {boolean|null} [allowMissing] AddLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new AddLocalInventoriesRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddLocalInventoriesRequest. + * @implements IAddLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest=} [properties] Properties to set + */ + function AddLocalInventoriesRequest(properties) { + this.localInventories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AddLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.product = ""; + + /** + * AddLocalInventoriesRequest localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.localInventories = $util.emptyArray; + + /** + * AddLocalInventoriesRequest addMask. + * @member {google.protobuf.IFieldMask|null|undefined} addMask + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addMask = null; + + /** + * AddLocalInventoriesRequest addTime. + * @member {google.protobuf.ITimestamp|null|undefined} addTime + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.addTime = null; + + /** + * AddLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @instance + */ + AddLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new AddLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest instance + */ + AddLocalInventoriesRequest.create = function create(properties) { + return new AddLocalInventoriesRequest(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.addMask != null && Object.hasOwnProperty.call(message, "addMask")) + $root.google.protobuf.FieldMask.encode(message.addMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.addTime != null && Object.hasOwnProperty.call(message, "addTime")) + $root.google.protobuf.Timestamp.encode(message.addTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesRequest} message AddLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2.LocalInventory.decode(reader, reader.uint32())); + break; + } + case 4: { + message.addMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.addTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.allowMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } + if (message.addMask != null && message.hasOwnProperty("addMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.addMask); + if (error) + return "addMask." + error; + } + if (message.addTime != null && message.hasOwnProperty("addTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.addTime); + if (error) + return "addTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddLocalInventoriesRequest} AddLocalInventoriesRequest + */ + AddLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2.AddLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2.LocalInventory.fromObject(object.localInventories[i]); + } + } + if (object.addMask != null) { + if (typeof object.addMask !== "object") + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.addMask: object expected"); + message.addMask = $root.google.protobuf.FieldMask.fromObject(object.addMask); + } + if (object.addTime != null) { + if (typeof object.addTime !== "object") + throw TypeError(".google.cloud.retail.v2.AddLocalInventoriesRequest.addTime: object expected"); + message.addTime = $root.google.protobuf.Timestamp.fromObject(object.addTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from an AddLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.AddLocalInventoriesRequest} message AddLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.localInventories = []; + if (options.defaults) { + object.product = ""; + object.addMask = null; + object.addTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2.LocalInventory.toObject(message.localInventories[j], options); + } + if (message.addMask != null && message.hasOwnProperty("addMask")) + object.addMask = $root.google.protobuf.FieldMask.toObject(message.addMask, options); + if (message.addTime != null && message.hasOwnProperty("addTime")) + object.addTime = $root.google.protobuf.Timestamp.toObject(message.addTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this AddLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AddLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesRequest"; + }; + + return AddLocalInventoriesRequest; + })(); + + v2.AddLocalInventoriesMetadata = (function() { + + /** + * Properties of an AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IAddLocalInventoriesMetadata + */ + + /** + * Constructs a new AddLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddLocalInventoriesMetadata. + * @implements IAddLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata=} [properties] Properties to set + */ + function AddLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata instance + */ + AddLocalInventoriesMetadata.create = function create(properties) { + return new AddLocalInventoriesMetadata(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesMetadata} message AddLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddLocalInventoriesMetadata} AddLocalInventoriesMetadata + */ + AddLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesMetadata) + return object; + return new $root.google.cloud.retail.v2.AddLocalInventoriesMetadata(); + }; + + /** + * Creates a plain object from an AddLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.AddLocalInventoriesMetadata} message AddLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AddLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesMetadata"; + }; + + return AddLocalInventoriesMetadata; + })(); + + v2.AddLocalInventoriesResponse = (function() { + + /** + * Properties of an AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2 + * @interface IAddLocalInventoriesResponse + */ + + /** + * Constructs a new AddLocalInventoriesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddLocalInventoriesResponse. + * @implements IAddLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse=} [properties] Properties to set + */ + function AddLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AddLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse instance + */ + AddLocalInventoriesResponse.create = function create(properties) { + return new AddLocalInventoriesResponse(properties); + }; + + /** + * Encodes the specified AddLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AddLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.IAddLocalInventoriesResponse} message AddLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AddLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AddLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AddLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddLocalInventoriesResponse} AddLocalInventoriesResponse + */ + AddLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2.AddLocalInventoriesResponse(); + }; + + /** + * Creates a plain object from an AddLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.AddLocalInventoriesResponse} message AddLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AddLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + AddLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AddLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddLocalInventoriesResponse"; + }; + + return AddLocalInventoriesResponse; + })(); + + v2.RemoveLocalInventoriesRequest = (function() { + + /** + * Properties of a RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2 + * @interface IRemoveLocalInventoriesRequest + * @property {string|null} [product] RemoveLocalInventoriesRequest product + * @property {Array.|null} [placeIds] RemoveLocalInventoriesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveLocalInventoriesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveLocalInventoriesRequest allowMissing + */ + + /** + * Constructs a new RemoveLocalInventoriesRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveLocalInventoriesRequest. + * @implements IRemoveLocalInventoriesRequest + * @constructor + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest=} [properties] Properties to set + */ + function RemoveLocalInventoriesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveLocalInventoriesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.product = ""; + + /** + * RemoveLocalInventoriesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveLocalInventoriesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.removeTime = null; + + /** + * RemoveLocalInventoriesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + */ + RemoveLocalInventoriesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveLocalInventoriesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest instance + */ + RemoveLocalInventoriesRequest.create = function create(properties) { + return new RemoveLocalInventoriesRequest(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.placeIds[i]); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.product = reader.string(); + break; + } + case 2: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 5: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesRequest} RemoveLocalInventoriesRequest + */ + RemoveLocalInventoriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest) + return object; + var message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.RemoveLocalInventoriesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2.RemoveLocalInventoriesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {google.cloud.retail.v2.RemoveLocalInventoriesRequest} message RemoveLocalInventoriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.allowMissing = false; + object.removeTime = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + return object; + }; + + /** + * Converts this RemoveLocalInventoriesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RemoveLocalInventoriesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesRequest"; + }; + + return RemoveLocalInventoriesRequest; + })(); + + v2.RemoveLocalInventoriesMetadata = (function() { + + /** + * Properties of a RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRemoveLocalInventoriesMetadata + */ + + /** + * Constructs a new RemoveLocalInventoriesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveLocalInventoriesMetadata. + * @implements IRemoveLocalInventoriesMetadata + * @constructor + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + */ + function RemoveLocalInventoriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveLocalInventoriesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata instance + */ + RemoveLocalInventoriesMetadata.create = function create(properties) { + return new RemoveLocalInventoriesMetadata(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} RemoveLocalInventoriesMetadata + */ + RemoveLocalInventoriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata) + return object; + return new $root.google.cloud.retail.v2.RemoveLocalInventoriesMetadata(); + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {google.cloud.retail.v2.RemoveLocalInventoriesMetadata} message RemoveLocalInventoriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveLocalInventoriesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RemoveLocalInventoriesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"; + }; + + return RemoveLocalInventoriesMetadata; + })(); + + v2.RemoveLocalInventoriesResponse = (function() { + + /** + * Properties of a RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2 + * @interface IRemoveLocalInventoriesResponse + */ + + /** + * Constructs a new RemoveLocalInventoriesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveLocalInventoriesResponse. + * @implements IRemoveLocalInventoriesResponse + * @constructor + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse=} [properties] Properties to set + */ + function RemoveLocalInventoriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveLocalInventoriesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse instance + */ + RemoveLocalInventoriesResponse.create = function create(properties) { + return new RemoveLocalInventoriesResponse(properties); + }; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveLocalInventoriesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveLocalInventoriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveLocalInventoriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveLocalInventoriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveLocalInventoriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveLocalInventoriesResponse message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveLocalInventoriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveLocalInventoriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveLocalInventoriesResponse} RemoveLocalInventoriesResponse + */ + RemoveLocalInventoriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse) + return object; + return new $root.google.cloud.retail.v2.RemoveLocalInventoriesResponse(); + }; + + /** + * Creates a plain object from a RemoveLocalInventoriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {google.cloud.retail.v2.RemoveLocalInventoriesResponse} message RemoveLocalInventoriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveLocalInventoriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveLocalInventoriesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveLocalInventoriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RemoveLocalInventoriesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveLocalInventoriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveLocalInventoriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveLocalInventoriesResponse"; + }; + + return RemoveLocalInventoriesResponse; + })(); + + v2.RemoveFulfillmentPlacesRequest = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesRequest + * @property {string|null} [product] RemoveFulfillmentPlacesRequest product + * @property {string|null} [type] RemoveFulfillmentPlacesRequest type + * @property {Array.|null} [placeIds] RemoveFulfillmentPlacesRequest placeIds + * @property {google.protobuf.ITimestamp|null} [removeTime] RemoveFulfillmentPlacesRequest removeTime + * @property {boolean|null} [allowMissing] RemoveFulfillmentPlacesRequest allowMissing + */ + + /** + * Constructs a new RemoveFulfillmentPlacesRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesRequest. + * @implements IRemoveFulfillmentPlacesRequest + * @constructor + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesRequest(properties) { + this.placeIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveFulfillmentPlacesRequest product. + * @member {string} product + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.product = ""; + + /** + * RemoveFulfillmentPlacesRequest type. + * @member {string} type + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.type = ""; + + /** + * RemoveFulfillmentPlacesRequest placeIds. + * @member {Array.} placeIds + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.placeIds = $util.emptyArray; + + /** + * RemoveFulfillmentPlacesRequest removeTime. + * @member {google.protobuf.ITimestamp|null|undefined} removeTime + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.removeTime = null; + + /** + * RemoveFulfillmentPlacesRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @instance + */ + RemoveFulfillmentPlacesRequest.prototype.allowMissing = false; + + /** + * Creates a new RemoveFulfillmentPlacesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest instance + */ + RemoveFulfillmentPlacesRequest.create = function create(properties) { + return new RemoveFulfillmentPlacesRequest(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.product); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.placeIds != null && message.placeIds.length) + for (var i = 0; i < message.placeIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.placeIds[i]); + if (message.removeTime != null && Object.hasOwnProperty.call(message, "removeTime")) + $root.google.protobuf.Timestamp.encode(message.removeTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allowMissing); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.product = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.placeIds && message.placeIds.length)) + message.placeIds = []; + message.placeIds.push(reader.string()); + break; + } + case 4: { + message.removeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allowMissing = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) + if (!$util.isString(message.product)) + return "product: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.placeIds != null && message.hasOwnProperty("placeIds")) { + if (!Array.isArray(message.placeIds)) + return "placeIds: array expected"; + for (var i = 0; i < message.placeIds.length; ++i) + if (!$util.isString(message.placeIds[i])) + return "placeIds: string[] expected"; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.removeTime); + if (error) + return "removeTime." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} RemoveFulfillmentPlacesRequest + */ + RemoveFulfillmentPlacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest) + return object; + var message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest(); + if (object.product != null) + message.product = String(object.product); + if (object.type != null) + message.type = String(object.type); + if (object.placeIds) { + if (!Array.isArray(object.placeIds)) + throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.placeIds: array expected"); + message.placeIds = []; + for (var i = 0; i < object.placeIds.length; ++i) + message.placeIds[i] = String(object.placeIds[i]); + } + if (object.removeTime != null) { + if (typeof object.removeTime !== "object") + throw TypeError(".google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.removeTime: object expected"); + message.removeTime = $root.google.protobuf.Timestamp.fromObject(object.removeTime); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + return message; + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesRequest} message RemoveFulfillmentPlacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.placeIds = []; + if (options.defaults) { + object.product = ""; + object.type = ""; + object.removeTime = null; + object.allowMissing = false; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = message.product; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.placeIds && message.placeIds.length) { + object.placeIds = []; + for (var j = 0; j < message.placeIds.length; ++j) + object.placeIds[j] = message.placeIds[j]; + } + if (message.removeTime != null && message.hasOwnProperty("removeTime")) + object.removeTime = $root.google.protobuf.Timestamp.toObject(message.removeTime, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + return object; + }; + + /** + * Converts this RemoveFulfillmentPlacesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"; + }; + + return RemoveFulfillmentPlacesRequest; + })(); + + v2.RemoveFulfillmentPlacesMetadata = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesMetadata + */ + + /** + * Constructs a new RemoveFulfillmentPlacesMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesMetadata. + * @implements IRemoveFulfillmentPlacesMetadata + * @constructor + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveFulfillmentPlacesMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata instance + */ + RemoveFulfillmentPlacesMetadata.create = function create(properties) { + return new RemoveFulfillmentPlacesMetadata(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata + */ + RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata) + return object; + return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"; + }; + + return RemoveFulfillmentPlacesMetadata; + })(); + + v2.RemoveFulfillmentPlacesResponse = (function() { + + /** + * Properties of a RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @interface IRemoveFulfillmentPlacesResponse + */ + + /** + * Constructs a new RemoveFulfillmentPlacesResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveFulfillmentPlacesResponse. + * @implements IRemoveFulfillmentPlacesResponse + * @constructor + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + */ + function RemoveFulfillmentPlacesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance + */ + RemoveFulfillmentPlacesResponse.create = function create(properties) { + return new RemoveFulfillmentPlacesResponse(properties); + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveFulfillmentPlacesResponse message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveFulfillmentPlacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse + */ + RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse) + return object; + return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); + }; + + /** + * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveFulfillmentPlacesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RemoveFulfillmentPlacesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @instance + * @returns {Object.} JSON object + */ + RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RemoveFulfillmentPlacesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"; + }; + + return RemoveFulfillmentPlacesResponse; + })(); + + v2.PurgeMetadata = (function() { + + /** + * Properties of a PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @interface IPurgeMetadata + */ + + /** + * Constructs a new PurgeMetadata. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeMetadata. + * @implements IPurgeMetadata + * @constructor + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + */ + function PurgeMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PurgeMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance + */ + PurgeMetadata.create = function create(properties) { + return new PurgeMetadata(properties); + }; + + /** + * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeMetadata message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata + */ + PurgeMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) + return object; + return new $root.google.cloud.retail.v2.PurgeMetadata(); + }; + + /** + * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PurgeMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeMetadata + * @instance + * @returns {Object.} JSON object + */ + PurgeMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PurgeMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurgeMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurgeMetadata"; + }; + + return PurgeMetadata; + })(); + + v2.PurgeUserEventsRequest = (function() { + + /** + * Properties of a PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsRequest + * @property {string|null} [parent] PurgeUserEventsRequest parent + * @property {string|null} [filter] PurgeUserEventsRequest filter + * @property {boolean|null} [force] PurgeUserEventsRequest force + */ + + /** + * Constructs a new PurgeUserEventsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsRequest. + * @implements IPurgeUserEventsRequest + * @constructor + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + */ + function PurgeUserEventsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.parent = ""; + + /** + * PurgeUserEventsRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.filter = ""; + + /** + * PurgeUserEventsRequest force. + * @member {boolean} force + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + */ + PurgeUserEventsRequest.prototype.force = false; + + /** + * Creates a new PurgeUserEventsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance + */ + PurgeUserEventsRequest.create = function create(properties) { + return new PurgeUserEventsRequest(properties); + }; + + /** + * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.force = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsRequest message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest + */ + PurgeUserEventsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) + return object; + var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.force = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this PurgeUserEventsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PurgeUserEventsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurgeUserEventsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurgeUserEventsRequest"; + }; + + return PurgeUserEventsRequest; + })(); + + v2.PurgeUserEventsResponse = (function() { + + /** + * Properties of a PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @interface IPurgeUserEventsResponse + * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount + */ + + /** + * Constructs a new PurgeUserEventsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a PurgeUserEventsResponse. + * @implements IPurgeUserEventsResponse + * @constructor + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + */ + function PurgeUserEventsResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PurgeUserEventsResponse purgedEventsCount. + * @member {number|Long} purgedEventsCount + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @instance + */ + PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PurgeUserEventsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance + */ + PurgeUserEventsResponse.create = function create(properties) { + return new PurgeUserEventsResponse(properties); + }; + + /** + * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); + return writer; + }; + + /** + * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.purgedEventsCount = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PurgeUserEventsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PurgeUserEventsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) + return "purgedEventsCount: integer|Long expected"; + return null; + }; + + /** + * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse + */ + PurgeUserEventsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) + return object; + var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); + if (object.purgedEventsCount != null) + if ($util.Long) + (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; + else if (typeof object.purgedEventsCount === "string") + message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); + else if (typeof object.purgedEventsCount === "number") + message.purgedEventsCount = object.purgedEventsCount; + else if (typeof object.purgedEventsCount === "object") + message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PurgeUserEventsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.purgedEventsCount = options.longs === String ? "0" : 0; + if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) + if (typeof message.purgedEventsCount === "number") + object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; + else + object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; + return object; + }; + + /** + * Converts this PurgeUserEventsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @instance + * @returns {Object.} JSON object + */ + PurgeUserEventsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PurgeUserEventsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.PurgeUserEventsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PurgeUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.PurgeUserEventsResponse"; + }; + + return PurgeUserEventsResponse; + })(); + + v2.SearchService = (function() { + + /** + * Constructs a new SearchService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SearchService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; + + /** + * Creates new SearchService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.SearchService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. + */ + SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2.SearchService|search}. + * @memberof google.cloud.retail.v2.SearchService + * @typedef SearchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.SearchResponse} [response] SearchResponse + */ + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2.SearchService + * @instance + * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object + * @param {google.cloud.retail.v2.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SearchService.prototype.search = function search(request, callback) { + return this.rpcCall(search, $root.google.cloud.retail.v2.SearchRequest, $root.google.cloud.retail.v2.SearchResponse, request, callback); + }, "name", { value: "Search" }); + + /** + * Calls Search. + * @function search + * @memberof google.cloud.retail.v2.SearchService + * @instance + * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SearchService; + })(); + + v2.SearchRequest = (function() { + + /** + * Properties of a SearchRequest. + * @memberof google.cloud.retail.v2 + * @interface ISearchRequest + * @property {string|null} [placement] SearchRequest placement + * @property {string|null} [branch] SearchRequest branch + * @property {string|null} [query] SearchRequest query + * @property {string|null} [visitorId] SearchRequest visitorId + * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] SearchRequest userInfo + * @property {number|null} [pageSize] SearchRequest pageSize + * @property {string|null} [pageToken] SearchRequest pageToken + * @property {number|null} [offset] SearchRequest offset + * @property {string|null} [filter] SearchRequest filter + * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter + * @property {string|null} [orderBy] SearchRequest orderBy + * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs + * @property {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec + * @property {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec + * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys + * @property {Array.|null} [pageCategories] SearchRequest pageCategories + * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode + * @property {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec + * @property {Object.|null} [labels] SearchRequest labels + * @property {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null} [spellCorrectionSpec] SearchRequest spellCorrectionSpec + */ + + /** + * Constructs a new SearchRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchRequest. + * @implements ISearchRequest + * @constructor + * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set + */ + function SearchRequest(properties) { + this.facetSpecs = []; + this.variantRollupKeys = []; + this.pageCategories = []; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.placement = ""; + + /** + * SearchRequest branch. + * @member {string} branch + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.branch = ""; + + /** + * SearchRequest query. + * @member {string} query + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.query = ""; + + /** + * SearchRequest visitorId. + * @member {string} visitorId + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.visitorId = ""; + + /** + * SearchRequest userInfo. + * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.userInfo = null; + + /** + * SearchRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageSize = 0; + + /** + * SearchRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageToken = ""; + + /** + * SearchRequest offset. + * @member {number} offset + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.offset = 0; + + /** + * SearchRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.filter = ""; + + /** + * SearchRequest canonicalFilter. + * @member {string} canonicalFilter + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.canonicalFilter = ""; + + /** + * SearchRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.orderBy = ""; + + /** + * SearchRequest facetSpecs. + * @member {Array.} facetSpecs + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.facetSpecs = $util.emptyArray; + + /** + * SearchRequest dynamicFacetSpec. + * @member {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.dynamicFacetSpec = null; + + /** + * SearchRequest boostSpec. + * @member {google.cloud.retail.v2.SearchRequest.IBoostSpec|null|undefined} boostSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.boostSpec = null; + + /** + * SearchRequest queryExpansionSpec. + * @member {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.queryExpansionSpec = null; + + /** + * SearchRequest variantRollupKeys. + * @member {Array.} variantRollupKeys + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + + /** + * SearchRequest pageCategories. + * @member {Array.} pageCategories + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.pageCategories = $util.emptyArray; + + /** + * SearchRequest searchMode. + * @member {google.cloud.retail.v2.SearchRequest.SearchMode} searchMode + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.searchMode = 0; + + /** + * SearchRequest personalizationSpec. + * @member {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.personalizationSpec = null; + + /** + * SearchRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.labels = $util.emptyObject; + + /** + * SearchRequest spellCorrectionSpec. + * @member {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null|undefined} spellCorrectionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.spellCorrectionSpec = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SearchRequest _spellCorrectionSpec. + * @member {"spellCorrectionSpec"|undefined} _spellCorrectionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + Object.defineProperty(SearchRequest.prototype, "_spellCorrectionSpec", { + get: $util.oneOfGetter($oneOfFields = ["spellCorrectionSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SearchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest instance + */ + SearchRequest.create = function create(properties) { + return new SearchRequest(properties); + }; + + /** + * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); + if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); + if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) + $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); + if (message.facetSpecs != null && message.facetSpecs.length) + for (var i = 0; i < message.facetSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) + $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.variantRollupKeys != null && message.variantRollupKeys.length) + for (var i = 0; i < message.variantRollupKeys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.pageCategories != null && message.pageCategories.length) + for (var i = 0; i < message.pageCategories.length; ++i) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); + if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); + if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); + if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) + $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.spellCorrectionSpec != null && Object.hasOwnProperty.call(message, "spellCorrectionSpec")) + $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.encode(message.spellCorrectionSpec, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.branch = reader.string(); + break; + } + case 3: { + message.query = reader.string(); + break; + } + case 4: { + message.visitorId = reader.string(); + break; + } + case 5: { + message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); + break; + } + case 7: { + message.pageSize = reader.int32(); + break; + } + case 8: { + message.pageToken = reader.string(); + break; + } + case 9: { + message.offset = reader.int32(); + break; + } + case 10: { + message.filter = reader.string(); + break; + } + case 28: { + message.canonicalFilter = reader.string(); + break; + } + case 11: { + message.orderBy = reader.string(); + break; + } + case 12: { + if (!(message.facetSpecs && message.facetSpecs.length)) + message.facetSpecs = []; + message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); + break; + } + case 21: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 13: { + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + break; + } + case 14: { + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); + break; + } + case 17: { + if (!(message.variantRollupKeys && message.variantRollupKeys.length)) + message.variantRollupKeys = []; + message.variantRollupKeys.push(reader.string()); + break; + } + case 23: { + if (!(message.pageCategories && message.pageCategories.length)) + message.pageCategories = []; + message.pageCategories.push(reader.string()); + break; + } + case 31: { + message.searchMode = reader.int32(); + break; + } + case 32: { + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + } + case 34: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 35: { + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchRequest message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.branch != null && message.hasOwnProperty("branch")) + if (!$util.isString(message.branch)) + return "branch: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + if (!$util.isString(message.visitorId)) + return "visitorId: string expected"; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) { + var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); + if (error) + return "userInfo." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + if (!$util.isString(message.canonicalFilter)) + return "canonicalFilter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { + if (!Array.isArray(message.facetSpecs)) + return "facetSpecs: array expected"; + for (var i = 0; i < message.facetSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (error) + return "facetSpecs." + error; + } + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.verify(message.boostSpec); + if (error) + return "boostSpec." + error; + } + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); + if (error) + return "queryExpansionSpec." + error; + } + if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { + if (!Array.isArray(message.variantRollupKeys)) + return "variantRollupKeys: array expected"; + for (var i = 0; i < message.variantRollupKeys.length; ++i) + if (!$util.isString(message.variantRollupKeys[i])) + return "variantRollupKeys: string[] expected"; + } + if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { + if (!Array.isArray(message.pageCategories)) + return "pageCategories: array expected"; + for (var i = 0; i < message.pageCategories.length; ++i) + if (!$util.isString(message.pageCategories[i])) + return "pageCategories: string[] expected"; + } + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + switch (message.searchMode) { + default: + return "searchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); + if (error) + return "personalizationSpec." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + properties._spellCorrectionSpec = 1; + { + var error = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify(message.spellCorrectionSpec); + if (error) + return "spellCorrectionSpec." + error; + } + } + return null; + }; + + /** + * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + */ + SearchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest(); + if (object.placement != null) + message.placement = String(object.placement); + if (object.branch != null) + message.branch = String(object.branch); + if (object.query != null) + message.query = String(object.query); + if (object.visitorId != null) + message.visitorId = String(object.visitorId); + if (object.userInfo != null) { + if (typeof object.userInfo !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.userInfo: object expected"); + message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.offset != null) + message.offset = object.offset | 0; + if (object.filter != null) + message.filter = String(object.filter); + if (object.canonicalFilter != null) + message.canonicalFilter = String(object.canonicalFilter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.facetSpecs) { + if (!Array.isArray(object.facetSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: array expected"); + message.facetSpecs = []; + for (var i = 0; i < object.facetSpecs.length; ++i) { + if (typeof object.facetSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: object expected"); + message.facetSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + } + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostSpec != null) { + if (typeof object.boostSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.boostSpec: object expected"); + message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.fromObject(object.boostSpec); + } + if (object.queryExpansionSpec != null) { + if (typeof object.queryExpansionSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.queryExpansionSpec: object expected"); + message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); + } + if (object.variantRollupKeys) { + if (!Array.isArray(object.variantRollupKeys)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.variantRollupKeys: array expected"); + message.variantRollupKeys = []; + for (var i = 0; i < object.variantRollupKeys.length; ++i) + message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); + } + if (object.pageCategories) { + if (!Array.isArray(object.pageCategories)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.pageCategories: array expected"); + message.pageCategories = []; + for (var i = 0; i < object.pageCategories.length; ++i) + message.pageCategories[i] = String(object.pageCategories[i]); + } + switch (object.searchMode) { + case "SEARCH_MODE_UNSPECIFIED": + case 0: + message.searchMode = 0; + break; + case "PRODUCT_SEARCH_ONLY": + case 1: + message.searchMode = 1; + break; + case "FACETED_SEARCH_ONLY": + case 2: + message.searchMode = 2; + break; + } + if (object.personalizationSpec != null) { + if (typeof object.personalizationSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.personalizationSpec: object expected"); + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.spellCorrectionSpec != null) { + if (typeof object.spellCorrectionSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.spellCorrectionSpec: object expected"); + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.fromObject(object.spellCorrectionSpec); + } + return message; + }; + + /** + * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {google.cloud.retail.v2.SearchRequest} message SearchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetSpecs = []; + object.variantRollupKeys = []; + object.pageCategories = []; + } + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.placement = ""; + object.branch = ""; + object.query = ""; + object.visitorId = ""; + object.userInfo = null; + object.pageSize = 0; + object.pageToken = ""; + object.offset = 0; + object.filter = ""; + object.orderBy = ""; + object.boostSpec = null; + object.queryExpansionSpec = null; + object.dynamicFacetSpec = null; + object.canonicalFilter = ""; + object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; + object.personalizationSpec = null; + } + if (message.placement != null && message.hasOwnProperty("placement")) + object.placement = message.placement; + if (message.branch != null && message.hasOwnProperty("branch")) + object.branch = message.branch; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.visitorId != null && message.hasOwnProperty("visitorId")) + object.visitorId = message.visitorId; + if (message.userInfo != null && message.hasOwnProperty("userInfo")) + object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.facetSpecs && message.facetSpecs.length) { + object.facetSpecs = []; + for (var j = 0; j < message.facetSpecs.length; ++j) + object.facetSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); + } + if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) + object.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.toObject(message.boostSpec, options); + if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) + object.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); + if (message.variantRollupKeys && message.variantRollupKeys.length) { + object.variantRollupKeys = []; + for (var j = 0; j < message.variantRollupKeys.length; ++j) + object.variantRollupKeys[j] = message.variantRollupKeys[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.pageCategories && message.pageCategories.length) { + object.pageCategories = []; + for (var j = 0; j < message.pageCategories.length; ++j) + object.pageCategories[j] = message.pageCategories[j]; + } + if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) + object.canonicalFilter = message.canonicalFilter; + if (message.searchMode != null && message.hasOwnProperty("searchMode")) + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) + object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + object.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.toObject(message.spellCorrectionSpec, options); + if (options.oneofs) + object._spellCorrectionSpec = "spellCorrectionSpec"; + } + return object; + }; + + /** + * Converts this SearchRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + * @returns {Object.} JSON object + */ + SearchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest"; + }; + + SearchRequest.FacetSpec = (function() { + + /** + * Properties of a FacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey + * @property {number|null} [limit] FacetSpec limit + * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys + * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + */ + + /** + * Constructs a new FacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a FacetSpec. + * @implements IFacetSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set + */ + function FacetSpec(properties) { + this.excludedFilterKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetSpec facetKey. + * @member {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.facetKey = null; + + /** + * FacetSpec limit. + * @member {number} limit + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.limit = 0; + + /** + * FacetSpec excludedFilterKeys. + * @member {Array.} excludedFilterKeys + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + + /** + * FacetSpec enableDynamicPosition. + * @member {boolean} enableDynamicPosition + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + */ + FacetSpec.prototype.enableDynamicPosition = false; + + /** + * Creates a new FacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec instance + */ + FacetSpec.create = function create(properties) { + return new FacetSpec(properties); + }; + + /** + * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) + $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); + if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); + if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + return writer; + }; + + /** + * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + break; + } + case 2: { + message.limit = reader.int32(); + break; + } + case 3: { + if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) + message.excludedFilterKeys = []; + message.excludedFilterKeys.push(reader.string()); + break; + } + case 4: { + message.enableDynamicPosition = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.facetKey != null && message.hasOwnProperty("facetKey")) { + var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); + if (error) + return "facetKey." + error; + } + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit)) + return "limit: integer expected"; + if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { + if (!Array.isArray(message.excludedFilterKeys)) + return "excludedFilterKeys: array expected"; + for (var i = 0; i < message.excludedFilterKeys.length; ++i) + if (!$util.isString(message.excludedFilterKeys[i])) + return "excludedFilterKeys: string[] expected"; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + if (typeof message.enableDynamicPosition !== "boolean") + return "enableDynamicPosition: boolean expected"; + return null; + }; + + /** + * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + */ + FacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); + if (object.facetKey != null) { + if (typeof object.facetKey !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.facetKey: object expected"); + message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); + } + if (object.limit != null) + message.limit = object.limit | 0; + if (object.excludedFilterKeys) { + if (!Array.isArray(object.excludedFilterKeys)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); + message.excludedFilterKeys = []; + for (var i = 0; i < object.excludedFilterKeys.length; ++i) + message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + } + if (object.enableDynamicPosition != null) + message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + return message; + }; + + /** + * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec} message FacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.excludedFilterKeys = []; + if (options.defaults) { + object.facetKey = null; + object.limit = 0; + object.enableDynamicPosition = false; + } + if (message.facetKey != null && message.hasOwnProperty("facetKey")) + object.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); + if (message.limit != null && message.hasOwnProperty("limit")) + object.limit = message.limit; + if (message.excludedFilterKeys && message.excludedFilterKeys.length) { + object.excludedFilterKeys = []; + for (var j = 0; j < message.excludedFilterKeys.length; ++j) + object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + } + if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) + object.enableDynamicPosition = message.enableDynamicPosition; + return object; + }; + + /** + * Converts this FacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @instance + * @returns {Object.} JSON object + */ + FacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.FacetSpec"; + }; + + FacetSpec.FacetKey = (function() { + + /** + * Properties of a FacetKey. + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @interface IFacetKey + * @property {string|null} [key] FacetKey key + * @property {Array.|null} [intervals] FacetKey intervals + * @property {Array.|null} [restrictedValues] FacetKey restrictedValues + * @property {Array.|null} [prefixes] FacetKey prefixes + * @property {Array.|null} [contains] FacetKey contains + * @property {boolean|null} [caseInsensitive] FacetKey caseInsensitive + * @property {string|null} [orderBy] FacetKey orderBy + * @property {string|null} [query] FacetKey query + * @property {boolean|null} [returnMinMax] FacetKey returnMinMax + */ + + /** + * Constructs a new FacetKey. + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @classdesc Represents a FacetKey. + * @implements IFacetKey + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + */ + function FacetKey(properties) { + this.intervals = []; + this.restrictedValues = []; + this.prefixes = []; + this.contains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FacetKey key. + * @member {string} key + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.key = ""; + + /** + * FacetKey intervals. + * @member {Array.} intervals + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.intervals = $util.emptyArray; + + /** + * FacetKey restrictedValues. + * @member {Array.} restrictedValues + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.restrictedValues = $util.emptyArray; + + /** + * FacetKey prefixes. + * @member {Array.} prefixes + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.prefixes = $util.emptyArray; + + /** + * FacetKey contains. + * @member {Array.} contains + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.contains = $util.emptyArray; + + /** + * FacetKey caseInsensitive. + * @member {boolean} caseInsensitive + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.caseInsensitive = false; + + /** + * FacetKey orderBy. + * @member {string} orderBy + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.orderBy = ""; + + /** + * FacetKey query. + * @member {string} query + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.query = ""; + + /** + * FacetKey returnMinMax. + * @member {boolean} returnMinMax + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + */ + FacetKey.prototype.returnMinMax = false; + + /** + * Creates a new FacetKey instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey instance + */ + FacetKey.create = function create(properties) { + return new FacetKey(properties); + }; + + /** + * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.intervals != null && message.intervals.length) + for (var i = 0; i < message.intervals.length; ++i) + $root.google.cloud.retail.v2.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.restrictedValues != null && message.restrictedValues.length) + for (var i = 0; i < message.restrictedValues.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); + if (message.prefixes != null && message.prefixes.length) + for (var i = 0; i < message.prefixes.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); + if (message.contains != null && message.contains.length) + for (var i = 0; i < message.contains.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); + if (message.caseInsensitive != null && Object.hasOwnProperty.call(message, "caseInsensitive")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.caseInsensitive); + if (message.returnMinMax != null && Object.hasOwnProperty.call(message, "returnMinMax")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.returnMinMax); + return writer; + }; + + /** + * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.intervals && message.intervals.length)) + message.intervals = []; + message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.restrictedValues && message.restrictedValues.length)) + message.restrictedValues = []; + message.restrictedValues.push(reader.string()); + break; + } + case 8: { + if (!(message.prefixes && message.prefixes.length)) + message.prefixes = []; + message.prefixes.push(reader.string()); + break; + } + case 9: { + if (!(message.contains && message.contains.length)) + message.contains = []; + message.contains.push(reader.string()); + break; + } + case 10: { + message.caseInsensitive = reader.bool(); + break; + } + case 4: { + message.orderBy = reader.string(); + break; + } + case 5: { + message.query = reader.string(); + break; + } + case 11: { + message.returnMinMax = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FacetKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FacetKey message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FacetKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.intervals != null && message.hasOwnProperty("intervals")) { + if (!Array.isArray(message.intervals)) + return "intervals: array expected"; + for (var i = 0; i < message.intervals.length; ++i) { + var error = $root.google.cloud.retail.v2.Interval.verify(message.intervals[i]); + if (error) + return "intervals." + error; + } + } + if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { + if (!Array.isArray(message.restrictedValues)) + return "restrictedValues: array expected"; + for (var i = 0; i < message.restrictedValues.length; ++i) + if (!$util.isString(message.restrictedValues[i])) + return "restrictedValues: string[] expected"; + } + if (message.prefixes != null && message.hasOwnProperty("prefixes")) { + if (!Array.isArray(message.prefixes)) + return "prefixes: array expected"; + for (var i = 0; i < message.prefixes.length; ++i) + if (!$util.isString(message.prefixes[i])) + return "prefixes: string[] expected"; + } + if (message.contains != null && message.hasOwnProperty("contains")) { + if (!Array.isArray(message.contains)) + return "contains: array expected"; + for (var i = 0; i < message.contains.length; ++i) + if (!$util.isString(message.contains[i])) + return "contains: string[] expected"; + } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + if (typeof message.caseInsensitive !== "boolean") + return "caseInsensitive: boolean expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + if (typeof message.returnMinMax !== "boolean") + return "returnMinMax: boolean expected"; + return null; + }; + + /** + * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + */ + FacetKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); + if (object.key != null) + message.key = String(object.key); + if (object.intervals) { + if (!Array.isArray(object.intervals)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); + message.intervals = []; + for (var i = 0; i < object.intervals.length; ++i) { + if (typeof object.intervals[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); + message.intervals[i] = $root.google.cloud.retail.v2.Interval.fromObject(object.intervals[i]); + } + } + if (object.restrictedValues) { + if (!Array.isArray(object.restrictedValues)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); + message.restrictedValues = []; + for (var i = 0; i < object.restrictedValues.length; ++i) + message.restrictedValues[i] = String(object.restrictedValues[i]); + } + if (object.prefixes) { + if (!Array.isArray(object.prefixes)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); + message.prefixes = []; + for (var i = 0; i < object.prefixes.length; ++i) + message.prefixes[i] = String(object.prefixes[i]); + } + if (object.contains) { + if (!Array.isArray(object.contains)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.contains: array expected"); + message.contains = []; + for (var i = 0; i < object.contains.length; ++i) + message.contains[i] = String(object.contains[i]); + } + if (object.caseInsensitive != null) + message.caseInsensitive = Boolean(object.caseInsensitive); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.query != null) + message.query = String(object.query); + if (object.returnMinMax != null) + message.returnMinMax = Boolean(object.returnMinMax); + return message; + }; + + /** + * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FacetKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.intervals = []; + object.restrictedValues = []; + object.prefixes = []; + object.contains = []; + } + if (options.defaults) { + object.key = ""; + object.orderBy = ""; + object.query = ""; + object.caseInsensitive = false; + object.returnMinMax = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.intervals && message.intervals.length) { + object.intervals = []; + for (var j = 0; j < message.intervals.length; ++j) + object.intervals[j] = $root.google.cloud.retail.v2.Interval.toObject(message.intervals[j], options); + } + if (message.restrictedValues && message.restrictedValues.length) { + object.restrictedValues = []; + for (var j = 0; j < message.restrictedValues.length; ++j) + object.restrictedValues[j] = message.restrictedValues[j]; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.prefixes && message.prefixes.length) { + object.prefixes = []; + for (var j = 0; j < message.prefixes.length; ++j) + object.prefixes[j] = message.prefixes[j]; + } + if (message.contains && message.contains.length) { + object.contains = []; + for (var j = 0; j < message.contains.length; ++j) + object.contains[j] = message.contains[j]; + } + if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) + object.caseInsensitive = message.caseInsensitive; + if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) + object.returnMinMax = message.returnMinMax; + return object; + }; + + /** + * Converts this FacetKey to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @instance + * @returns {Object.} JSON object + */ + FacetKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FacetKey + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FacetKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"; + }; + + return FacetKey; + })(); + + return FacetSpec; + })(); + + SearchRequest.DynamicFacetSpec = (function() { + + /** + * Properties of a DynamicFacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IDynamicFacetSpec + * @property {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + */ + + /** + * Constructs a new DynamicFacetSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a DynamicFacetSpec. + * @implements IDynamicFacetSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + */ + function DynamicFacetSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DynamicFacetSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @instance + */ + DynamicFacetSpec.prototype.mode = 0; + + /** + * Creates a new DynamicFacetSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + */ + DynamicFacetSpec.create = function create(properties) { + return new DynamicFacetSpec(properties); + }; + + /** + * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DynamicFacetSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DynamicFacetSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + */ + DynamicFacetSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "DISABLED": + case 1: + message.mode = 1; + break; + case "ENABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DynamicFacetSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this DynamicFacetSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @instance + * @returns {Object.} JSON object + */ + DynamicFacetSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DynamicFacetSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DynamicFacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"; + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} ENABLED=2 ENABLED value + */ + DynamicFacetSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[2] = "ENABLED"] = 2; + return values; + })(); - /** - * Creates a RemoveFulfillmentPlacesMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} RemoveFulfillmentPlacesMetadata - */ - RemoveFulfillmentPlacesMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata) - return object; - return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata(); - }; + return DynamicFacetSpec; + })(); - /** - * Creates a plain object from a RemoveFulfillmentPlacesMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata - * @static - * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata} message RemoveFulfillmentPlacesMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RemoveFulfillmentPlacesMetadata.toObject = function toObject() { - return {}; - }; + SearchRequest.BoostSpec = (function() { - /** - * Converts this RemoveFulfillmentPlacesMetadata to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata - * @instance - * @returns {Object.} JSON object - */ - RemoveFulfillmentPlacesMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Properties of a BoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IBoostSpec + * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs + * @property {boolean|null} [skipBoostSpecValidation] BoostSpec skipBoostSpecValidation + */ - /** - * Gets the default type url for RemoveFulfillmentPlacesMetadata - * @function getTypeUrl - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RemoveFulfillmentPlacesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + /** + * Constructs a new BoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a BoostSpec. + * @implements IBoostSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set + */ + function BoostSpec(properties) { + this.conditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"; - }; - return RemoveFulfillmentPlacesMetadata; - })(); + /** + * BoostSpec conditionBoostSpecs. + * @member {Array.} conditionBoostSpecs + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; - v2.RemoveFulfillmentPlacesResponse = (function() { + /** + * BoostSpec skipBoostSpecValidation. + * @member {boolean|null|undefined} skipBoostSpecValidation + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + BoostSpec.prototype.skipBoostSpecValidation = null; - /** - * Properties of a RemoveFulfillmentPlacesResponse. - * @memberof google.cloud.retail.v2 - * @interface IRemoveFulfillmentPlacesResponse - */ + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Constructs a new RemoveFulfillmentPlacesResponse. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a RemoveFulfillmentPlacesResponse. - * @implements IRemoveFulfillmentPlacesResponse - * @constructor - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set - */ - function RemoveFulfillmentPlacesResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * BoostSpec _skipBoostSpecValidation. + * @member {"skipBoostSpecValidation"|undefined} _skipBoostSpecValidation + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + */ + Object.defineProperty(BoostSpec.prototype, "_skipBoostSpecValidation", { + get: $util.oneOfGetter($oneOfFields = ["skipBoostSpecValidation"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Creates a new RemoveFulfillmentPlacesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse instance - */ - RemoveFulfillmentPlacesResponse.create = function create(properties) { - return new RemoveFulfillmentPlacesResponse(properties); - }; + /** + * Creates a new BoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec instance + */ + BoostSpec.create = function create(properties) { + return new BoostSpec(properties); + }; - /** - * Encodes the specified RemoveFulfillmentPlacesResponse message. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveFulfillmentPlacesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; + /** + * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.skipBoostSpecValidation != null && Object.hasOwnProperty.call(message, "skipBoostSpecValidation")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.skipBoostSpecValidation); + return writer; + }; - /** - * Encodes the specified RemoveFulfillmentPlacesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveFulfillmentPlacesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.IRemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveFulfillmentPlacesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveFulfillmentPlacesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a BoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) + message.conditionBoostSpecs = []; + message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + break; + } + case 2: { + message.skipBoostSpecValidation = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a RemoveFulfillmentPlacesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveFulfillmentPlacesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a BoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a RemoveFulfillmentPlacesResponse message. - * @function verify - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RemoveFulfillmentPlacesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; + /** + * Verifies a BoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { + if (!Array.isArray(message.conditionBoostSpecs)) + return "conditionBoostSpecs: array expected"; + for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); + if (error) + return "conditionBoostSpecs." + error; + } + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + properties._skipBoostSpecValidation = 1; + if (typeof message.skipBoostSpecValidation !== "boolean") + return "skipBoostSpecValidation: boolean expected"; + } + return null; + }; - /** - * Creates a RemoveFulfillmentPlacesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} RemoveFulfillmentPlacesResponse - */ - RemoveFulfillmentPlacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse) + /** + * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec + */ + BoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); + if (object.conditionBoostSpecs) { + if (!Array.isArray(object.conditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); + message.conditionBoostSpecs = []; + for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { + if (typeof object.conditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); + message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); + } + } + if (object.skipBoostSpecValidation != null) + message.skipBoostSpecValidation = Boolean(object.skipBoostSpecValidation); + return message; + }; + + /** + * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} message BoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conditionBoostSpecs = []; + if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { + object.conditionBoostSpecs = []; + for (var j = 0; j < message.conditionBoostSpecs.length; ++j) + object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); + } + if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { + object.skipBoostSpecValidation = message.skipBoostSpecValidation; + if (options.oneofs) + object._skipBoostSpecValidation = "skipBoostSpecValidation"; + } return object; - return new $root.google.cloud.retail.v2.RemoveFulfillmentPlacesResponse(); - }; + }; - /** - * Creates a plain object from a RemoveFulfillmentPlacesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {google.cloud.retail.v2.RemoveFulfillmentPlacesResponse} message RemoveFulfillmentPlacesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RemoveFulfillmentPlacesResponse.toObject = function toObject() { - return {}; - }; + /** + * Converts this BoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @instance + * @returns {Object.} JSON object + */ + BoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this RemoveFulfillmentPlacesResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @instance - * @returns {Object.} JSON object - */ - RemoveFulfillmentPlacesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for BoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.BoostSpec"; + }; - /** - * Gets the default type url for RemoveFulfillmentPlacesResponse - * @function getTypeUrl - * @memberof google.cloud.retail.v2.RemoveFulfillmentPlacesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RemoveFulfillmentPlacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"; - }; + BoostSpec.ConditionBoostSpec = (function() { - return RemoveFulfillmentPlacesResponse; - })(); + /** + * Properties of a ConditionBoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @interface IConditionBoostSpec + * @property {string|null} [condition] ConditionBoostSpec condition + * @property {number|null} [boost] ConditionBoostSpec boost + */ - v2.PurgeMetadata = (function() { + /** + * Constructs a new ConditionBoostSpec. + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec + * @classdesc Represents a ConditionBoostSpec. + * @implements IConditionBoostSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + */ + function ConditionBoostSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Properties of a PurgeMetadata. - * @memberof google.cloud.retail.v2 - * @interface IPurgeMetadata - */ + /** + * ConditionBoostSpec condition. + * @member {string} condition + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.condition = ""; - /** - * Constructs a new PurgeMetadata. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeMetadata. - * @implements IPurgeMetadata - * @constructor - * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set - */ - function PurgeMetadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * ConditionBoostSpec boost. + * @member {number} boost + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + */ + ConditionBoostSpec.prototype.boost = 0; - /** - * Creates a new PurgeMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {google.cloud.retail.v2.IPurgeMetadata=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata instance - */ - PurgeMetadata.create = function create(properties) { - return new PurgeMetadata(properties); - }; + /** + * Creates a new ConditionBoostSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance + */ + ConditionBoostSpec.create = function create(properties) { + return new ConditionBoostSpec(properties); + }; - /** - * Encodes the specified PurgeMetadata message. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; + /** + * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; - /** - * Encodes the specified PurgeMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {google.cloud.retail.v2.IPurgeMetadata} message PurgeMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PurgeMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.condition = reader.string(); + break; + } + case 2: { + message.boost = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Decodes a PurgeMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a PurgeMetadata message. - * @function verify - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; + /** + * Verifies a ConditionBoostSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionBoostSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; - /** - * Creates a PurgeMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeMetadata} PurgeMetadata - */ - PurgeMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeMetadata) - return object; - return new $root.google.cloud.retail.v2.PurgeMetadata(); - }; + /** + * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec + */ + ConditionBoostSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; - /** - * Creates a plain object from a PurgeMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {google.cloud.retail.v2.PurgeMetadata} message PurgeMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeMetadata.toObject = function toObject() { - return {}; - }; + /** + * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionBoostSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = ""; + object.boost = 0; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; - /** - * Converts this PurgeMetadata to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.PurgeMetadata - * @instance - * @returns {Object.} JSON object - */ - PurgeMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this ConditionBoostSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @instance + * @returns {Object.} JSON object + */ + ConditionBoostSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Gets the default type url for PurgeMetadata - * @function getTypeUrl - * @memberof google.cloud.retail.v2.PurgeMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PurgeMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.PurgeMetadata"; - }; + /** + * Gets the default type url for ConditionBoostSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConditionBoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"; + }; - return PurgeMetadata; - })(); + return ConditionBoostSpec; + })(); - v2.PurgeUserEventsRequest = (function() { + return BoostSpec; + })(); - /** - * Properties of a PurgeUserEventsRequest. - * @memberof google.cloud.retail.v2 - * @interface IPurgeUserEventsRequest - * @property {string|null} [parent] PurgeUserEventsRequest parent - * @property {string|null} [filter] PurgeUserEventsRequest filter - * @property {boolean|null} [force] PurgeUserEventsRequest force - */ + SearchRequest.QueryExpansionSpec = (function() { - /** - * Constructs a new PurgeUserEventsRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeUserEventsRequest. - * @implements IPurgeUserEventsRequest - * @constructor - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set - */ - function PurgeUserEventsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a QueryExpansionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IQueryExpansionSpec + * @property {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition + * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults + */ - /** - * PurgeUserEventsRequest parent. - * @member {string} parent - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.parent = ""; + /** + * Constructs a new QueryExpansionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a QueryExpansionSpec. + * @implements IQueryExpansionSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + */ + function QueryExpansionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PurgeUserEventsRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.filter = ""; + /** + * QueryExpansionSpec condition. + * @member {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition} condition + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.condition = 0; - /** - * PurgeUserEventsRequest force. - * @member {boolean} force - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - */ - PurgeUserEventsRequest.prototype.force = false; + /** + * QueryExpansionSpec pinUnexpandedResults. + * @member {boolean} pinUnexpandedResults + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + */ + QueryExpansionSpec.prototype.pinUnexpandedResults = false; - /** - * Creates a new PurgeUserEventsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest instance - */ - PurgeUserEventsRequest.create = function create(properties) { - return new PurgeUserEventsRequest(properties); - }; + /** + * Creates a new QueryExpansionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance + */ + QueryExpansionSpec.create = function create(properties) { + return new QueryExpansionSpec(properties); + }; - /** - * Encodes the specified PurgeUserEventsRequest message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeUserEventsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); - return writer; - }; + /** + * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); + if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); + return writer; + }; - /** - * Encodes the specified PurgeUserEventsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsRequest} message PurgeUserEventsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeUserEventsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeUserEventsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.filter = reader.string(); + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.condition = reader.int32(); + break; + } + case 2: { + message.pinUnexpandedResults = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); break; } - case 3: { - message.force = reader.bool(); + } + return message; + }; + + /** + * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryExpansionSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryExpansionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + switch (message.condition) { + default: + return "condition: enum value expected"; + case 0: + case 1: + case 3: break; } - default: - reader.skipType(tag & 7); + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + if (typeof message.pinUnexpandedResults !== "boolean") + return "pinUnexpandedResults: boolean expected"; + return null; + }; + + /** + * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec + */ + QueryExpansionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); + switch (object.condition) { + case "CONDITION_UNSPECIFIED": + case 0: + message.condition = 0; + break; + case "DISABLED": + case 1: + message.condition = 1; + break; + case "AUTO": + case 3: + message.condition = 3; break; } - } - return message; - }; - - /** - * Decodes a PurgeUserEventsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeUserEventsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PurgeUserEventsRequest message. - * @function verify - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeUserEventsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; - return null; - }; + if (object.pinUnexpandedResults != null) + message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); + return message; + }; - /** - * Creates a PurgeUserEventsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeUserEventsRequest} PurgeUserEventsRequest - */ - PurgeUserEventsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsRequest) + /** + * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryExpansionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; + object.pinUnexpandedResults = false; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) + object.pinUnexpandedResults = message.pinUnexpandedResults; return object; - var message = new $root.google.cloud.retail.v2.PurgeUserEventsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.filter != null) - message.filter = String(object.filter); - if (object.force != null) - message.force = Boolean(object.force); - return message; - }; + }; - /** - * Creates a plain object from a PurgeUserEventsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {google.cloud.retail.v2.PurgeUserEventsRequest} message PurgeUserEventsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeUserEventsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.filter = ""; - object.force = false; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; - return object; - }; + /** + * Converts this QueryExpansionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @instance + * @returns {Object.} JSON object + */ + QueryExpansionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this PurgeUserEventsRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @instance - * @returns {Object.} JSON object - */ - PurgeUserEventsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for QueryExpansionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryExpansionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"; + }; - /** - * Gets the default type url for PurgeUserEventsRequest - * @function getTypeUrl - * @memberof google.cloud.retail.v2.PurgeUserEventsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PurgeUserEventsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.PurgeUserEventsRequest"; - }; + /** + * Condition enum. + * @name google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition + * @enum {number} + * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value + * @property {number} DISABLED=1 DISABLED value + * @property {number} AUTO=3 AUTO value + */ + QueryExpansionSpec.Condition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLED"] = 1; + values[valuesById[3] = "AUTO"] = 3; + return values; + })(); - return PurgeUserEventsRequest; - })(); + return QueryExpansionSpec; + })(); - v2.PurgeUserEventsResponse = (function() { + SearchRequest.PersonalizationSpec = (function() { - /** - * Properties of a PurgeUserEventsResponse. - * @memberof google.cloud.retail.v2 - * @interface IPurgeUserEventsResponse - * @property {number|Long|null} [purgedEventsCount] PurgeUserEventsResponse purgedEventsCount - */ + /** + * Properties of a PersonalizationSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface IPersonalizationSpec + * @property {google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|null} [mode] PersonalizationSpec mode + */ - /** - * Constructs a new PurgeUserEventsResponse. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a PurgeUserEventsResponse. - * @implements IPurgeUserEventsResponse - * @constructor - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set - */ - function PurgeUserEventsResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new PersonalizationSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a PersonalizationSpec. + * @implements IPersonalizationSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + */ + function PersonalizationSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * PurgeUserEventsResponse purgedEventsCount. - * @member {number|Long} purgedEventsCount - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @instance - */ - PurgeUserEventsResponse.prototype.purgedEventsCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * PersonalizationSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @instance + */ + PersonalizationSpec.prototype.mode = 0; - /** - * Creates a new PurgeUserEventsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse instance - */ - PurgeUserEventsResponse.create = function create(properties) { - return new PurgeUserEventsResponse(properties); - }; + /** + * Creates a new PersonalizationSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec instance + */ + PersonalizationSpec.create = function create(properties) { + return new PersonalizationSpec(properties); + }; - /** - * Encodes the specified PurgeUserEventsResponse message. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeUserEventsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.purgedEventsCount != null && Object.hasOwnProperty.call(message, "purgedEventsCount")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.purgedEventsCount); - return writer; - }; + /** + * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; - /** - * Encodes the specified PurgeUserEventsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.PurgeUserEventsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.IPurgeUserEventsResponse} message PurgeUserEventsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeUserEventsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PersonalizationSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeUserEventsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.purgedEventsCount = reader.int64(); + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; - - /** - * Decodes a PurgeUserEventsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeUserEventsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a PurgeUserEventsResponse message. - * @function verify - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeUserEventsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (!$util.isInteger(message.purgedEventsCount) && !(message.purgedEventsCount && $util.isInteger(message.purgedEventsCount.low) && $util.isInteger(message.purgedEventsCount.high))) - return "purgedEventsCount: integer|Long expected"; - return null; - }; + /** + * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PersonalizationSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a PurgeUserEventsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.PurgeUserEventsResponse} PurgeUserEventsResponse - */ - PurgeUserEventsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.PurgeUserEventsResponse) - return object; - var message = new $root.google.cloud.retail.v2.PurgeUserEventsResponse(); - if (object.purgedEventsCount != null) - if ($util.Long) - (message.purgedEventsCount = $util.Long.fromValue(object.purgedEventsCount)).unsigned = false; - else if (typeof object.purgedEventsCount === "string") - message.purgedEventsCount = parseInt(object.purgedEventsCount, 10); - else if (typeof object.purgedEventsCount === "number") - message.purgedEventsCount = object.purgedEventsCount; - else if (typeof object.purgedEventsCount === "object") - message.purgedEventsCount = new $util.LongBits(object.purgedEventsCount.low >>> 0, object.purgedEventsCount.high >>> 0).toNumber(); - return message; - }; + /** + * Verifies a PersonalizationSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PersonalizationSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; - /** - * Creates a plain object from a PurgeUserEventsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {google.cloud.retail.v2.PurgeUserEventsResponse} message PurgeUserEventsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeUserEventsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.purgedEventsCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.purgedEventsCount = options.longs === String ? "0" : 0; - if (message.purgedEventsCount != null && message.hasOwnProperty("purgedEventsCount")) - if (typeof message.purgedEventsCount === "number") - object.purgedEventsCount = options.longs === String ? String(message.purgedEventsCount) : message.purgedEventsCount; - else - object.purgedEventsCount = options.longs === String ? $util.Long.prototype.toString.call(message.purgedEventsCount) : options.longs === Number ? new $util.LongBits(message.purgedEventsCount.low >>> 0, message.purgedEventsCount.high >>> 0).toNumber() : message.purgedEventsCount; - return object; - }; + /** + * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec + */ + PersonalizationSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "AUTO": + case 1: + message.mode = 1; + break; + case "DISABLED": + case 2: + message.mode = 2; + break; + } + return message; + }; - /** - * Converts this PurgeUserEventsResponse to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @instance - * @returns {Object.} JSON object - */ - PurgeUserEventsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} message PersonalizationSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PersonalizationSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + return object; + }; - /** - * Gets the default type url for PurgeUserEventsResponse - * @function getTypeUrl - * @memberof google.cloud.retail.v2.PurgeUserEventsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PurgeUserEventsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.PurgeUserEventsResponse"; - }; + /** + * Converts this PersonalizationSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @instance + * @returns {Object.} JSON object + */ + PersonalizationSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return PurgeUserEventsResponse; - })(); + /** + * Gets the default type url for PersonalizationSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PersonalizationSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"; + }; - v2.SearchService = (function() { + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} AUTO=1 AUTO value + * @property {number} DISABLED=2 DISABLED value + */ + PersonalizationSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); - /** - * Constructs a new SearchService service. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a SearchService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SearchService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } + return PersonalizationSpec; + })(); - (SearchService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SearchService; + SearchRequest.SpellCorrectionSpec = (function() { - /** - * Creates new SearchService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2.SearchService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SearchService} RPC service. Useful where requests and/or responses are streamed. - */ - SearchService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + /** + * Properties of a SpellCorrectionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface ISpellCorrectionSpec + * @property {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null} [mode] SpellCorrectionSpec mode + */ - /** - * Callback as used by {@link google.cloud.retail.v2.SearchService|search}. - * @memberof google.cloud.retail.v2.SearchService - * @typedef SearchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2.SearchResponse} [response] SearchResponse - */ + /** + * Constructs a new SpellCorrectionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a SpellCorrectionSpec. + * @implements ISpellCorrectionSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + */ + function SpellCorrectionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2.SearchService - * @instance - * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object - * @param {google.cloud.retail.v2.SearchService.SearchCallback} callback Node-style callback called with the error, if any, and SearchResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SearchService.prototype.search = function search(request, callback) { - return this.rpcCall(search, $root.google.cloud.retail.v2.SearchRequest, $root.google.cloud.retail.v2.SearchResponse, request, callback); - }, "name", { value: "Search" }); + /** + * SpellCorrectionSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @instance + */ + SpellCorrectionSpec.prototype.mode = 0; - /** - * Calls Search. - * @function search - * @memberof google.cloud.retail.v2.SearchService - * @instance - * @param {google.cloud.retail.v2.ISearchRequest} request SearchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec instance + */ + SpellCorrectionSpec.create = function create(properties) { + return new SpellCorrectionSpec(properties); + }; - return SearchService; - })(); + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; - v2.SearchRequest = (function() { + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Properties of a SearchRequest. - * @memberof google.cloud.retail.v2 - * @interface ISearchRequest - * @property {string|null} [placement] SearchRequest placement - * @property {string|null} [branch] SearchRequest branch - * @property {string|null} [query] SearchRequest query - * @property {string|null} [visitorId] SearchRequest visitorId - * @property {google.cloud.retail.v2.IUserInfo|null} [userInfo] SearchRequest userInfo - * @property {number|null} [pageSize] SearchRequest pageSize - * @property {string|null} [pageToken] SearchRequest pageToken - * @property {number|null} [offset] SearchRequest offset - * @property {string|null} [filter] SearchRequest filter - * @property {string|null} [canonicalFilter] SearchRequest canonicalFilter - * @property {string|null} [orderBy] SearchRequest orderBy - * @property {Array.|null} [facetSpecs] SearchRequest facetSpecs - * @property {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] SearchRequest dynamicFacetSpec - * @property {google.cloud.retail.v2.SearchRequest.IBoostSpec|null} [boostSpec] SearchRequest boostSpec - * @property {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null} [queryExpansionSpec] SearchRequest queryExpansionSpec - * @property {Array.|null} [variantRollupKeys] SearchRequest variantRollupKeys - * @property {Array.|null} [pageCategories] SearchRequest pageCategories - * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode - * @property {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec - * @property {Object.|null} [labels] SearchRequest labels - * @property {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null} [spellCorrectionSpec] SearchRequest spellCorrectionSpec - */ + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Constructs a new SearchRequest. - * @memberof google.cloud.retail.v2 - * @classdesc Represents a SearchRequest. - * @implements ISearchRequest - * @constructor - * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set - */ - function SearchRequest(properties) { - this.facetSpecs = []; - this.variantRollupKeys = []; - this.pageCategories = []; - this.labels = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * SearchRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.placement = ""; + /** + * Verifies a SpellCorrectionSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpellCorrectionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; - /** - * SearchRequest branch. - * @member {string} branch - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.branch = ""; + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + */ + SpellCorrectionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SUGGESTION_ONLY": + case 1: + message.mode = 1; + break; + case "AUTO": + case 2: + message.mode = 2; + break; + } + return message; + }; - /** - * SearchRequest query. - * @member {string} query - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.query = ""; + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} message SpellCorrectionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpellCorrectionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + return object; + }; - /** - * SearchRequest visitorId. - * @member {string} visitorId - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.visitorId = ""; + /** + * Converts this SpellCorrectionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @instance + * @returns {Object.} JSON object + */ + SpellCorrectionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * SearchRequest userInfo. - * @member {google.cloud.retail.v2.IUserInfo|null|undefined} userInfo - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.userInfo = null; + /** + * Gets the default type url for SpellCorrectionSpec + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpellCorrectionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"; + }; - /** - * SearchRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.pageSize = 0; + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} SUGGESTION_ONLY=1 SUGGESTION_ONLY value + * @property {number} AUTO=2 AUTO value + */ + SpellCorrectionSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SUGGESTION_ONLY"] = 1; + values[valuesById[2] = "AUTO"] = 2; + return values; + })(); - /** - * SearchRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.pageToken = ""; + return SpellCorrectionSpec; + })(); /** - * SearchRequest offset. - * @member {number} offset - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * SearchMode enum. + * @name google.cloud.retail.v2.SearchRequest.SearchMode + * @enum {number} + * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value + * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value + * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value */ - SearchRequest.prototype.offset = 0; + SearchRequest.SearchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; + values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; + return values; + })(); - /** - * SearchRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.filter = ""; + return SearchRequest; + })(); - /** - * SearchRequest canonicalFilter. - * @member {string} canonicalFilter - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - */ - SearchRequest.prototype.canonicalFilter = ""; + v2.SearchResponse = (function() { /** - * SearchRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Properties of a SearchResponse. + * @memberof google.cloud.retail.v2 + * @interface ISearchResponse + * @property {Array.|null} [results] SearchResponse results + * @property {Array.|null} [facets] SearchResponse facets + * @property {number|null} [totalSize] SearchResponse totalSize + * @property {string|null} [correctedQuery] SearchResponse correctedQuery + * @property {string|null} [attributionToken] SearchResponse attributionToken + * @property {string|null} [nextPageToken] SearchResponse nextPageToken + * @property {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo + * @property {string|null} [redirectUri] SearchResponse redirectUri + * @property {Array.|null} [appliedControls] SearchResponse appliedControls + * @property {Array.|null} [invalidConditionBoostSpecs] SearchResponse invalidConditionBoostSpecs */ - SearchRequest.prototype.orderBy = ""; /** - * SearchRequest facetSpecs. - * @member {Array.} facetSpecs - * @memberof google.cloud.retail.v2.SearchRequest - * @instance + * Constructs a new SearchResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a SearchResponse. + * @implements ISearchResponse + * @constructor + * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set */ - SearchRequest.prototype.facetSpecs = $util.emptyArray; + function SearchResponse(properties) { + this.results = []; + this.facets = []; + this.appliedControls = []; + this.invalidConditionBoostSpecs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * SearchRequest dynamicFacetSpec. - * @member {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse results. + * @member {Array.} results + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.dynamicFacetSpec = null; + SearchResponse.prototype.results = $util.emptyArray; /** - * SearchRequest boostSpec. - * @member {google.cloud.retail.v2.SearchRequest.IBoostSpec|null|undefined} boostSpec - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse facets. + * @member {Array.} facets + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.boostSpec = null; + SearchResponse.prototype.facets = $util.emptyArray; /** - * SearchRequest queryExpansionSpec. - * @member {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec|null|undefined} queryExpansionSpec - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.queryExpansionSpec = null; + SearchResponse.prototype.totalSize = 0; /** - * SearchRequest variantRollupKeys. - * @member {Array.} variantRollupKeys - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse correctedQuery. + * @member {string} correctedQuery + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.variantRollupKeys = $util.emptyArray; + SearchResponse.prototype.correctedQuery = ""; /** - * SearchRequest pageCategories. - * @member {Array.} pageCategories - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse attributionToken. + * @member {string} attributionToken + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.pageCategories = $util.emptyArray; + SearchResponse.prototype.attributionToken = ""; /** - * SearchRequest searchMode. - * @member {google.cloud.retail.v2.SearchRequest.SearchMode} searchMode - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.searchMode = 0; + SearchResponse.prototype.nextPageToken = ""; /** - * SearchRequest personalizationSpec. - * @member {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse queryExpansionInfo. + * @member {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.personalizationSpec = null; + SearchResponse.prototype.queryExpansionInfo = null; /** - * SearchRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse redirectUri. + * @member {string} redirectUri + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.labels = $util.emptyObject; + SearchResponse.prototype.redirectUri = ""; /** - * SearchRequest spellCorrectionSpec. - * @member {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null|undefined} spellCorrectionSpec - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse appliedControls. + * @member {Array.} appliedControls + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - SearchRequest.prototype.spellCorrectionSpec = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + SearchResponse.prototype.appliedControls = $util.emptyArray; /** - * SearchRequest _spellCorrectionSpec. - * @member {"spellCorrectionSpec"|undefined} _spellCorrectionSpec - * @memberof google.cloud.retail.v2.SearchRequest + * SearchResponse invalidConditionBoostSpecs. + * @member {Array.} invalidConditionBoostSpecs + * @memberof google.cloud.retail.v2.SearchResponse * @instance */ - Object.defineProperty(SearchRequest.prototype, "_spellCorrectionSpec", { - get: $util.oneOfGetter($oneOfFields = ["spellCorrectionSpec"]), - set: $util.oneOfSetter($oneOfFields) - }); + SearchResponse.prototype.invalidConditionBoostSpecs = $util.emptyArray; /** - * Creates a new SearchRequest instance using the specified properties. + * Creates a new SearchResponse instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.ISearchRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest instance + * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse instance */ - SearchRequest.create = function create(properties) { - return new SearchRequest(properties); + SearchResponse.create = function create(properties) { + return new SearchResponse(properties); }; /** - * Encodes the specified SearchRequest message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encode = function encode(message, writer) { + SearchResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.query); - if (message.visitorId != null && Object.hasOwnProperty.call(message, "visitorId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.visitorId); - if (message.userInfo != null && Object.hasOwnProperty.call(message, "userInfo")) - $root.google.cloud.retail.v2.UserInfo.encode(message.userInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.pageToken); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.offset); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.orderBy); - if (message.facetSpecs != null && message.facetSpecs.length) - for (var i = 0; i < message.facetSpecs.length; ++i) - $root.google.cloud.retail.v2.SearchRequest.FacetSpec.encode(message.facetSpecs[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.boostSpec != null && Object.hasOwnProperty.call(message, "boostSpec")) - $root.google.cloud.retail.v2.SearchRequest.BoostSpec.encode(message.boostSpec, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.queryExpansionSpec != null && Object.hasOwnProperty.call(message, "queryExpansionSpec")) - $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.encode(message.queryExpansionSpec, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.variantRollupKeys != null && message.variantRollupKeys.length) - for (var i = 0; i < message.variantRollupKeys.length; ++i) - writer.uint32(/* id 17, wireType 2 =*/138).string(message.variantRollupKeys[i]); - if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) - $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.pageCategories != null && message.pageCategories.length) - for (var i = 0; i < message.pageCategories.length; ++i) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.pageCategories[i]); - if (message.canonicalFilter != null && Object.hasOwnProperty.call(message, "canonicalFilter")) - writer.uint32(/* id 28, wireType 2 =*/226).string(message.canonicalFilter); - if (message.searchMode != null && Object.hasOwnProperty.call(message, "searchMode")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); - if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) - $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); - if (message.spellCorrectionSpec != null && Object.hasOwnProperty.call(message, "spellCorrectionSpec")) - $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.encode(message.spellCorrectionSpec, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.facets != null && message.facets.length) + for (var i = 0; i < message.facets.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); + if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); + if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) + $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); + if (message.appliedControls != null && message.appliedControls.length) + for (var i = 0; i < message.appliedControls.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); + if (message.invalidConditionBoostSpecs != null && message.invalidConditionBoostSpecs.length) + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) + $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.invalidConditionBoostSpecs[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); return writer; }; /** - * Encodes the specified SearchRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.verify|verify} messages. + * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static - * @param {google.cloud.retail.v2.ISearchRequest} message SearchRequest message or plain object to encode + * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchRequest.encodeDelimited = function encodeDelimited(message, writer) { + SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchRequest message from the specified reader or buffer. + * Decodes a SearchResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decode = function decode(reader, length) { + SearchResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.placement = reader.string(); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); break; } case 2: { - message.branch = reader.string(); + if (!(message.facets && message.facets.length)) + message.facets = []; + message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); break; } case 3: { - message.query = reader.string(); + message.totalSize = reader.int32(); break; } case 4: { - message.visitorId = reader.string(); + message.correctedQuery = reader.string(); break; } case 5: { - message.userInfo = $root.google.cloud.retail.v2.UserInfo.decode(reader, reader.uint32()); - break; - } - case 7: { - message.pageSize = reader.int32(); + message.attributionToken = reader.string(); break; } - case 8: { - message.pageToken = reader.string(); + case 6: { + message.nextPageToken = reader.string(); break; } - case 9: { - message.offset = reader.int32(); + case 7: { + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); break; } case 10: { - message.filter = reader.string(); - break; - } - case 28: { - message.canonicalFilter = reader.string(); - break; - } - case 11: { - message.orderBy = reader.string(); + message.redirectUri = reader.string(); break; } case 12: { - if (!(message.facetSpecs && message.facetSpecs.length)) - message.facetSpecs = []; - message.facetSpecs.push($root.google.cloud.retail.v2.SearchRequest.FacetSpec.decode(reader, reader.uint32())); - break; - } - case 21: { - message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); - break; - } - case 13: { - message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.decode(reader, reader.uint32()); + if (!(message.appliedControls && message.appliedControls.length)) + message.appliedControls = []; + message.appliedControls.push(reader.string()); break; } case 14: { - message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.decode(reader, reader.uint32()); - break; - } - case 17: { - if (!(message.variantRollupKeys && message.variantRollupKeys.length)) - message.variantRollupKeys = []; - message.variantRollupKeys.push(reader.string()); - break; - } - case 23: { - if (!(message.pageCategories && message.pageCategories.length)) - message.pageCategories = []; - message.pageCategories.push(reader.string()); - break; - } - case 31: { - message.searchMode = reader.int32(); - break; - } - case 32: { - message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); - break; - } - case 34: { - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - } - case 35: { - message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) + message.invalidConditionBoostSpecs = []; + message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); break; } default: @@ -21447,396 +32683,691 @@ }; /** - * Decodes a SearchRequest message from the specified reader or buffer, length delimited. + * Decodes a SearchResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchRequest.decodeDelimited = function decodeDelimited(reader) { + SearchResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchRequest message. + * Verifies a SearchResponse message. * @function verify - * @memberof google.cloud.retail.v2.SearchRequest + * @memberof google.cloud.retail.v2.SearchResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchRequest.verify = function verify(message) { + SearchResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.branch != null && message.hasOwnProperty("branch")) - if (!$util.isString(message.branch)) - return "branch: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - if (!$util.isString(message.visitorId)) - return "visitorId: string expected"; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) { - var error = $root.google.cloud.retail.v2.UserInfo.verify(message.userInfo); - if (error) - return "userInfo." + error; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.SearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset)) - return "offset: integer expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - if (!$util.isString(message.canonicalFilter)) - return "canonicalFilter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.facetSpecs != null && message.hasOwnProperty("facetSpecs")) { - if (!Array.isArray(message.facetSpecs)) - return "facetSpecs: array expected"; - for (var i = 0; i < message.facetSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.verify(message.facetSpecs[i]); + if (message.facets != null && message.hasOwnProperty("facets")) { + if (!Array.isArray(message.facets)) + return "facets: array expected"; + for (var i = 0; i < message.facets.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.Facet.verify(message.facets[i]); if (error) - return "facetSpecs." + error; + return "facets." + error; } } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + if (!$util.isString(message.correctedQuery)) + return "correctedQuery: string expected"; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + if (!$util.isString(message.attributionToken)) + return "attributionToken: string expected"; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { + var error = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); if (error) - return "dynamicFacetSpec." + error; + return "queryExpansionInfo." + error; } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.verify(message.boostSpec); - if (error) - return "boostSpec." + error; + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + if (!$util.isString(message.redirectUri)) + return "redirectUri: string expected"; + if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { + if (!Array.isArray(message.appliedControls)) + return "appliedControls: array expected"; + for (var i = 0; i < message.appliedControls.length; ++i) + if (!$util.isString(message.appliedControls[i])) + return "appliedControls: string[] expected"; } - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify(message.queryExpansionSpec); - if (error) - return "queryExpansionSpec." + error; + if (message.invalidConditionBoostSpecs != null && message.hasOwnProperty("invalidConditionBoostSpecs")) { + if (!Array.isArray(message.invalidConditionBoostSpecs)) + return "invalidConditionBoostSpecs: array expected"; + for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.invalidConditionBoostSpecs[i]); + if (error) + return "invalidConditionBoostSpecs." + error; + } } - if (message.variantRollupKeys != null && message.hasOwnProperty("variantRollupKeys")) { - if (!Array.isArray(message.variantRollupKeys)) - return "variantRollupKeys: array expected"; - for (var i = 0; i < message.variantRollupKeys.length; ++i) - if (!$util.isString(message.variantRollupKeys[i])) - return "variantRollupKeys: string[] expected"; + return null; + }; + + /** + * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + */ + SearchResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.results: object expected"); + message.results[i] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.fromObject(object.results[i]); + } } - if (message.pageCategories != null && message.hasOwnProperty("pageCategories")) { - if (!Array.isArray(message.pageCategories)) - return "pageCategories: array expected"; - for (var i = 0; i < message.pageCategories.length; ++i) - if (!$util.isString(message.pageCategories[i])) - return "pageCategories: string[] expected"; + if (object.facets) { + if (!Array.isArray(object.facets)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: array expected"); + message.facets = []; + for (var i = 0; i < object.facets.length; ++i) { + if (typeof object.facets[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: object expected"); + message.facets[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.fromObject(object.facets[i]); + } } - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - switch (message.searchMode) { - default: - return "searchMode: enum value expected"; - case 0: - case 1: - case 2: - break; + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + if (object.correctedQuery != null) + message.correctedQuery = String(object.correctedQuery); + if (object.attributionToken != null) + message.attributionToken = String(object.attributionToken); + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.queryExpansionInfo != null) { + if (typeof object.queryExpansionInfo !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.queryExpansionInfo: object expected"); + message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); + } + if (object.redirectUri != null) + message.redirectUri = String(object.redirectUri); + if (object.appliedControls) { + if (!Array.isArray(object.appliedControls)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.appliedControls: array expected"); + message.appliedControls = []; + for (var i = 0; i < object.appliedControls.length; ++i) + message.appliedControls[i] = String(object.appliedControls[i]); + } + if (object.invalidConditionBoostSpecs) { + if (!Array.isArray(object.invalidConditionBoostSpecs)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.invalidConditionBoostSpecs: array expected"); + message.invalidConditionBoostSpecs = []; + for (var i = 0; i < object.invalidConditionBoostSpecs.length; ++i) { + if (typeof object.invalidConditionBoostSpecs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.invalidConditionBoostSpecs: object expected"); + message.invalidConditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.invalidConditionBoostSpecs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse + * @static + * @param {google.cloud.retail.v2.SearchResponse} message SearchResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.facets = []; + object.appliedControls = []; + object.invalidConditionBoostSpecs = []; + } + if (options.defaults) { + object.totalSize = 0; + object.correctedQuery = ""; + object.attributionToken = ""; + object.nextPageToken = ""; + object.queryExpansionInfo = null; + object.redirectUri = ""; + } + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.toObject(message.results[j], options); + } + if (message.facets && message.facets.length) { + object.facets = []; + for (var j = 0; j < message.facets.length; ++j) + object.facets[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.toObject(message.facets[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) + object.correctedQuery = message.correctedQuery; + if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) + object.attributionToken = message.attributionToken; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) + object.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); + if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) + object.redirectUri = message.redirectUri; + if (message.appliedControls && message.appliedControls.length) { + object.appliedControls = []; + for (var j = 0; j < message.appliedControls.length; ++j) + object.appliedControls[j] = message.appliedControls[j]; + } + if (message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length) { + object.invalidConditionBoostSpecs = []; + for (var j = 0; j < message.invalidConditionBoostSpecs.length; ++j) + object.invalidConditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.invalidConditionBoostSpecs[j], options); + } + return object; + }; + + /** + * Converts this SearchResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse + * @instance + * @returns {Object.} JSON object + */ + SearchResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse"; + }; + + SearchResponse.SearchResult = (function() { + + /** + * Properties of a SearchResult. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface ISearchResult + * @property {string|null} [id] SearchResult id + * @property {google.cloud.retail.v2.IProduct|null} [product] SearchResult product + * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount + * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields + * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + * @property {Array.|null} [personalLabels] SearchResult personalLabels + */ + + /** + * Constructs a new SearchResult. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a SearchResult. + * @implements ISearchResult + * @constructor + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + */ + function SearchResult(properties) { + this.matchingVariantFields = {}; + this.variantRollupValues = {}; + this.personalLabels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchResult id. + * @member {string} id + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.id = ""; + + /** + * SearchResult product. + * @member {google.cloud.retail.v2.IProduct|null|undefined} product + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.product = null; + + /** + * SearchResult matchingVariantCount. + * @member {number} matchingVariantCount + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantCount = 0; + + /** + * SearchResult matchingVariantFields. + * @member {Object.} matchingVariantFields + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.matchingVariantFields = $util.emptyObject; + + /** + * SearchResult variantRollupValues. + * @member {Object.} variantRollupValues + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.variantRollupValues = $util.emptyObject; + + /** + * SearchResult personalLabels. + * @member {Array.} personalLabels + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.personalLabels = $util.emptyArray; + + /** + * Creates a new SearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult instance + */ + SearchResult.create = function create(properties) { + return new SearchResult(properties); + }; + + /** + * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); + if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) + for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) + for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.personalLabels != null && message.personalLabels.length) + for (var i = 0; i < message.personalLabels.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.personalLabels[i]); + return writer; + }; + + /** + * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); + break; + } + case 3: { + message.matchingVariantCount = reader.int32(); + break; + } + case 4: { + if (message.matchingVariantFields === $util.emptyObject) + message.matchingVariantFields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.matchingVariantFields[key] = value; + break; + } + case 5: { + if (message.variantRollupValues === $util.emptyObject) + message.variantRollupValues = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.variantRollupValues[key] = value; + break; + } + case 7: { + if (!(message.personalLabels && message.personalLabels.length)) + message.personalLabels = []; + message.personalLabels.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchResult message. + * @function verify + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.google.cloud.retail.v2.Product.verify(message.product); + if (error) + return "product." + error; + } + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + if (!$util.isInteger(message.matchingVariantCount)) + return "matchingVariantCount: integer expected"; + if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { + if (!$util.isObject(message.matchingVariantFields)) + return "matchingVariantFields: object expected"; + var key = Object.keys(message.matchingVariantFields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); + if (error) + return "matchingVariantFields." + error; + } + } + if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { + if (!$util.isObject(message.variantRollupValues)) + return "variantRollupValues: object expected"; + var key = Object.keys(message.variantRollupValues); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); + if (error) + return "variantRollupValues." + error; + } + } + if (message.personalLabels != null && message.hasOwnProperty("personalLabels")) { + if (!Array.isArray(message.personalLabels)) + return "personalLabels: array expected"; + for (var i = 0; i < message.personalLabels.length; ++i) + if (!$util.isString(message.personalLabels[i])) + return "personalLabels: string[] expected"; + } + return null; + }; + + /** + * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult + */ + SearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.SearchResult) + return object; + var message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(); + if (object.id != null) + message.id = String(object.id); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.product: object expected"); + message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); } - if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { - var error = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); - if (error) - return "personalizationSpec." + error; - } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; - } - if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { - properties._spellCorrectionSpec = 1; - { - var error = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify(message.spellCorrectionSpec); - if (error) - return "spellCorrectionSpec." + error; + if (object.matchingVariantCount != null) + message.matchingVariantCount = object.matchingVariantCount | 0; + if (object.matchingVariantFields) { + if (typeof object.matchingVariantFields !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields = {}; + for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { + if (typeof object.matchingVariantFields[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); + message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); + } } - } - return null; - }; + if (object.variantRollupValues) { + if (typeof object.variantRollupValues !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues = {}; + for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { + if (typeof object.variantRollupValues[keys[i]] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); + message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); + } + } + if (object.personalLabels) { + if (!Array.isArray(object.personalLabels)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.personalLabels: array expected"); + message.personalLabels = []; + for (var i = 0; i < object.personalLabels.length; ++i) + message.personalLabels[i] = String(object.personalLabels[i]); + } + return message; + }; - /** - * Creates a SearchRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest} SearchRequest - */ - SearchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest(); - if (object.placement != null) - message.placement = String(object.placement); - if (object.branch != null) - message.branch = String(object.branch); - if (object.query != null) - message.query = String(object.query); - if (object.visitorId != null) - message.visitorId = String(object.visitorId); - if (object.userInfo != null) { - if (typeof object.userInfo !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.userInfo: object expected"); - message.userInfo = $root.google.cloud.retail.v2.UserInfo.fromObject(object.userInfo); - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.offset != null) - message.offset = object.offset | 0; - if (object.filter != null) - message.filter = String(object.filter); - if (object.canonicalFilter != null) - message.canonicalFilter = String(object.canonicalFilter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.facetSpecs) { - if (!Array.isArray(object.facetSpecs)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: array expected"); - message.facetSpecs = []; - for (var i = 0; i < object.facetSpecs.length; ++i) { - if (typeof object.facetSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.facetSpecs: object expected"); - message.facetSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.fromObject(object.facetSpecs[i]); + /** + * Creates a plain object from a SearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {google.cloud.retail.v2.SearchResponse.SearchResult} message SearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.personalLabels = []; + if (options.objects || options.defaults) { + object.matchingVariantFields = {}; + object.variantRollupValues = {}; } - } - if (object.dynamicFacetSpec != null) { - if (typeof object.dynamicFacetSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.dynamicFacetSpec: object expected"); - message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); - } - if (object.boostSpec != null) { - if (typeof object.boostSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.boostSpec: object expected"); - message.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.fromObject(object.boostSpec); - } - if (object.queryExpansionSpec != null) { - if (typeof object.queryExpansionSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.queryExpansionSpec: object expected"); - message.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); - } - if (object.variantRollupKeys) { - if (!Array.isArray(object.variantRollupKeys)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.variantRollupKeys: array expected"); - message.variantRollupKeys = []; - for (var i = 0; i < object.variantRollupKeys.length; ++i) - message.variantRollupKeys[i] = String(object.variantRollupKeys[i]); - } - if (object.pageCategories) { - if (!Array.isArray(object.pageCategories)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.pageCategories: array expected"); - message.pageCategories = []; - for (var i = 0; i < object.pageCategories.length; ++i) - message.pageCategories[i] = String(object.pageCategories[i]); - } - switch (object.searchMode) { - case "SEARCH_MODE_UNSPECIFIED": - case 0: - message.searchMode = 0; - break; - case "PRODUCT_SEARCH_ONLY": - case 1: - message.searchMode = 1; - break; - case "FACETED_SEARCH_ONLY": - case 2: - message.searchMode = 2; - break; - } - if (object.personalizationSpec != null) { - if (typeof object.personalizationSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.personalizationSpec: object expected"); - message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); - } - if (object.spellCorrectionSpec != null) { - if (typeof object.spellCorrectionSpec !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.spellCorrectionSpec: object expected"); - message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.fromObject(object.spellCorrectionSpec); - } - return message; - }; + if (options.defaults) { + object.id = ""; + object.product = null; + object.matchingVariantCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); + if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) + object.matchingVariantCount = message.matchingVariantCount; + var keys2; + if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { + object.matchingVariantFields = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); + } + if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { + object.variantRollupValues = {}; + for (var j = 0; j < keys2.length; ++j) + object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); + } + if (message.personalLabels && message.personalLabels.length) { + object.personalLabels = []; + for (var j = 0; j < message.personalLabels.length; ++j) + object.personalLabels[j] = message.personalLabels[j]; + } + return object; + }; - /** - * Creates a plain object from a SearchRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest - * @static - * @param {google.cloud.retail.v2.SearchRequest} message SearchRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.facetSpecs = []; - object.variantRollupKeys = []; - object.pageCategories = []; - } - if (options.objects || options.defaults) - object.labels = {}; - if (options.defaults) { - object.placement = ""; - object.branch = ""; - object.query = ""; - object.visitorId = ""; - object.userInfo = null; - object.pageSize = 0; - object.pageToken = ""; - object.offset = 0; - object.filter = ""; - object.orderBy = ""; - object.boostSpec = null; - object.queryExpansionSpec = null; - object.dynamicFacetSpec = null; - object.canonicalFilter = ""; - object.searchMode = options.enums === String ? "SEARCH_MODE_UNSPECIFIED" : 0; - object.personalizationSpec = null; - } - if (message.placement != null && message.hasOwnProperty("placement")) - object.placement = message.placement; - if (message.branch != null && message.hasOwnProperty("branch")) - object.branch = message.branch; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.visitorId != null && message.hasOwnProperty("visitorId")) - object.visitorId = message.visitorId; - if (message.userInfo != null && message.hasOwnProperty("userInfo")) - object.userInfo = $root.google.cloud.retail.v2.UserInfo.toObject(message.userInfo, options); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.offset != null && message.hasOwnProperty("offset")) - object.offset = message.offset; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.facetSpecs && message.facetSpecs.length) { - object.facetSpecs = []; - for (var j = 0; j < message.facetSpecs.length; ++j) - object.facetSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.toObject(message.facetSpecs[j], options); - } - if (message.boostSpec != null && message.hasOwnProperty("boostSpec")) - object.boostSpec = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.toObject(message.boostSpec, options); - if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) - object.queryExpansionSpec = $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); - if (message.variantRollupKeys && message.variantRollupKeys.length) { - object.variantRollupKeys = []; - for (var j = 0; j < message.variantRollupKeys.length; ++j) - object.variantRollupKeys[j] = message.variantRollupKeys[j]; - } - if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) - object.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); - if (message.pageCategories && message.pageCategories.length) { - object.pageCategories = []; - for (var j = 0; j < message.pageCategories.length; ++j) - object.pageCategories[j] = message.pageCategories[j]; - } - if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) - object.canonicalFilter = message.canonicalFilter; - if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; - if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) - object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); - var keys2; - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; - } - if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { - object.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.toObject(message.spellCorrectionSpec, options); - if (options.oneofs) - object._spellCorrectionSpec = "spellCorrectionSpec"; - } - return object; - }; + /** + * Converts this SearchResult to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @instance + * @returns {Object.} JSON object + */ + SearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this SearchRequest to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest - * @instance - * @returns {Object.} JSON object - */ - SearchRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for SearchResult + * @function getTypeUrl + * @memberof google.cloud.retail.v2.SearchResponse.SearchResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.SearchResult"; + }; - /** - * Gets the default type url for SearchRequest - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SearchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest"; - }; + return SearchResult; + })(); - SearchRequest.FacetSpec = (function() { + SearchResponse.Facet = (function() { /** - * Properties of a FacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IFacetSpec - * @property {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null} [facetKey] FacetSpec facetKey - * @property {number|null} [limit] FacetSpec limit - * @property {Array.|null} [excludedFilterKeys] FacetSpec excludedFilterKeys - * @property {boolean|null} [enableDynamicPosition] FacetSpec enableDynamicPosition + * Properties of a Facet. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface IFacet + * @property {string|null} [key] Facet key + * @property {Array.|null} [values] Facet values + * @property {boolean|null} [dynamicFacet] Facet dynamicFacet */ /** - * Constructs a new FacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a FacetSpec. - * @implements IFacetSpec + * Constructs a new Facet. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a Facet. + * @implements IFacet * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set + * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set */ - function FacetSpec(properties) { - this.excludedFilterKeys = []; + function Facet(properties) { + this.values = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21844,120 +33375,106 @@ } /** - * FacetSpec facetKey. - * @member {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey|null|undefined} facetKey - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @instance - */ - FacetSpec.prototype.facetKey = null; - - /** - * FacetSpec limit. - * @member {number} limit - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * Facet key. + * @member {string} key + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @instance */ - FacetSpec.prototype.limit = 0; + Facet.prototype.key = ""; /** - * FacetSpec excludedFilterKeys. - * @member {Array.} excludedFilterKeys - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * Facet values. + * @member {Array.} values + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @instance */ - FacetSpec.prototype.excludedFilterKeys = $util.emptyArray; + Facet.prototype.values = $util.emptyArray; /** - * FacetSpec enableDynamicPosition. - * @member {boolean} enableDynamicPosition - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * Facet dynamicFacet. + * @member {boolean} dynamicFacet + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @instance */ - FacetSpec.prototype.enableDynamicPosition = false; + Facet.prototype.dynamicFacet = false; /** - * Creates a new FacetSpec instance using the specified properties. + * Creates a new Facet instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec instance + * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet instance */ - FacetSpec.create = function create(properties) { - return new FacetSpec(properties); + Facet.create = function create(properties) { + return new Facet(properties); }; /** - * Encodes the specified FacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FacetSpec.encode = function encode(message, writer) { + Facet.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.facetKey != null && Object.hasOwnProperty.call(message, "facetKey")) - $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.encode(message.facetKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit); - if (message.excludedFilterKeys != null && message.excludedFilterKeys.length) - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.excludedFilterKeys[i]); - if (message.enableDynamicPosition != null && Object.hasOwnProperty.call(message, "enableDynamicPosition")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enableDynamicPosition); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); return writer; }; /** - * Encodes the specified FacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.verify|verify} messages. + * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2.SearchRequest.IFacetSpec} message FacetSpec message or plain object to encode + * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + Facet.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FacetSpec message from the specified reader or buffer. + * Decodes a Facet message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FacetSpec.decode = function decode(reader, length) { + Facet.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.decode(reader, reader.uint32()); + message.key = reader.string(); break; } case 2: { - message.limit = reader.int32(); + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); break; } case 3: { - if (!(message.excludedFilterKeys && message.excludedFilterKeys.length)) - message.excludedFilterKeys = []; - message.excludedFilterKeys.push(reader.string()); - break; - } - case 4: { - message.enableDynamicPosition = reader.bool(); + message.dynamicFacet = reader.bool(); break; } default: @@ -21969,174 +33486,158 @@ }; /** - * Decodes a FacetSpec message from the specified reader or buffer, length delimited. + * Decodes a Facet message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FacetSpec.decodeDelimited = function decodeDelimited(reader) { + Facet.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FacetSpec message. + * Verifies a Facet message. * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FacetSpec.verify = function verify(message) { + Facet.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.facetKey != null && message.hasOwnProperty("facetKey")) { - var error = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify(message.facetKey); - if (error) - return "facetKey." + error; - } - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit)) - return "limit: integer expected"; - if (message.excludedFilterKeys != null && message.hasOwnProperty("excludedFilterKeys")) { - if (!Array.isArray(message.excludedFilterKeys)) - return "excludedFilterKeys: array expected"; - for (var i = 0; i < message.excludedFilterKeys.length; ++i) - if (!$util.isString(message.excludedFilterKeys[i])) - return "excludedFilterKeys: string[] expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify(message.values[i]); + if (error) + return "values." + error; + } } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - if (typeof message.enableDynamicPosition !== "boolean") - return "enableDynamicPosition: boolean expected"; + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + if (typeof message.dynamicFacet !== "boolean") + return "dynamicFacet: boolean expected"; return null; }; /** - * Creates a FacetSpec message from a plain object. Also converts values to their respective internal types. + * Creates a Facet message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec} FacetSpec + * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet */ - FacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec) + Facet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet) return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec(); - if (object.facetKey != null) { - if (typeof object.facetKey !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.facetKey: object expected"); - message.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.fromObject(object.facetKey); - } - if (object.limit != null) - message.limit = object.limit | 0; - if (object.excludedFilterKeys) { - if (!Array.isArray(object.excludedFilterKeys)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.excludedFilterKeys: array expected"); - message.excludedFilterKeys = []; - for (var i = 0; i < object.excludedFilterKeys.length; ++i) - message.excludedFilterKeys[i] = String(object.excludedFilterKeys[i]); + var message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); + if (object.key != null) + message.key = String(object.key); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: object expected"); + message.values[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); + } } - if (object.enableDynamicPosition != null) - message.enableDynamicPosition = Boolean(object.enableDynamicPosition); + if (object.dynamicFacet != null) + message.dynamicFacet = Boolean(object.dynamicFacet); return message; }; /** - * Creates a plain object from a FacetSpec message. Also converts values to other types if specified. + * Creates a plain object from a Facet message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec} message FacetSpec + * @param {google.cloud.retail.v2.SearchResponse.Facet} message Facet * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FacetSpec.toObject = function toObject(message, options) { + Facet.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.excludedFilterKeys = []; + object.values = []; if (options.defaults) { - object.facetKey = null; - object.limit = 0; - object.enableDynamicPosition = false; + object.key = ""; + object.dynamicFacet = false; } - if (message.facetKey != null && message.hasOwnProperty("facetKey")) - object.facetKey = $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.toObject(message.facetKey, options); - if (message.limit != null && message.hasOwnProperty("limit")) - object.limit = message.limit; - if (message.excludedFilterKeys && message.excludedFilterKeys.length) { - object.excludedFilterKeys = []; - for (var j = 0; j < message.excludedFilterKeys.length; ++j) - object.excludedFilterKeys[j] = message.excludedFilterKeys[j]; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); } - if (message.enableDynamicPosition != null && message.hasOwnProperty("enableDynamicPosition")) - object.enableDynamicPosition = message.enableDynamicPosition; + if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) + object.dynamicFacet = message.dynamicFacet; return object; }; /** - * Converts this FacetSpec to JSON. + * Converts this Facet to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @instance * @returns {Object.} JSON object */ - FacetSpec.prototype.toJSON = function toJSON() { + Facet.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FacetSpec + * Gets the default type url for Facet * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.Facet * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Facet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.FacetSpec"; + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.Facet"; }; - FacetSpec.FacetKey = (function() { + Facet.FacetValue = (function() { /** - * Properties of a FacetKey. - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @interface IFacetKey - * @property {string|null} [key] FacetKey key - * @property {Array.|null} [intervals] FacetKey intervals - * @property {Array.|null} [restrictedValues] FacetKey restrictedValues - * @property {Array.|null} [prefixes] FacetKey prefixes - * @property {Array.|null} [contains] FacetKey contains - * @property {boolean|null} [caseInsensitive] FacetKey caseInsensitive - * @property {string|null} [orderBy] FacetKey orderBy - * @property {string|null} [query] FacetKey query - * @property {boolean|null} [returnMinMax] FacetKey returnMinMax + * Properties of a FacetValue. + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @interface IFacetValue + * @property {string|null} [value] FacetValue value + * @property {google.cloud.retail.v2.IInterval|null} [interval] FacetValue interval + * @property {number|Long|null} [count] FacetValue count + * @property {number|null} [minValue] FacetValue minValue + * @property {number|null} [maxValue] FacetValue maxValue */ /** - * Constructs a new FacetKey. - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec - * @classdesc Represents a FacetKey. - * @implements IFacetKey + * Constructs a new FacetValue. + * @memberof google.cloud.retail.v2.SearchResponse.Facet + * @classdesc Represents a FacetValue. + * @implements IFacetValue * @constructor - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set */ - function FacetKey(properties) { - this.intervals = []; - this.restrictedValues = []; - this.prefixes = []; - this.contains = []; + function FacetValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22144,199 +33645,145 @@ } /** - * FacetKey key. - * @member {string} key - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.key = ""; - - /** - * FacetKey intervals. - * @member {Array.} intervals - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.intervals = $util.emptyArray; - - /** - * FacetKey restrictedValues. - * @member {Array.} restrictedValues - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * FacetValue value. + * @member {string|null|undefined} value + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance */ - FacetKey.prototype.restrictedValues = $util.emptyArray; + FacetValue.prototype.value = null; /** - * FacetKey prefixes. - * @member {Array.} prefixes - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * FacetValue interval. + * @member {google.cloud.retail.v2.IInterval|null|undefined} interval + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance */ - FacetKey.prototype.prefixes = $util.emptyArray; + FacetValue.prototype.interval = null; /** - * FacetKey contains. - * @member {Array.} contains - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * FacetValue count. + * @member {number|Long} count + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance */ - FacetKey.prototype.contains = $util.emptyArray; + FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * FacetKey caseInsensitive. - * @member {boolean} caseInsensitive - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * FacetValue minValue. + * @member {number} minValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance */ - FacetKey.prototype.caseInsensitive = false; + FacetValue.prototype.minValue = 0; /** - * FacetKey orderBy. - * @member {string} orderBy - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * FacetValue maxValue. + * @member {number} maxValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance */ - FacetKey.prototype.orderBy = ""; + FacetValue.prototype.maxValue = 0; - /** - * FacetKey query. - * @member {string} query - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey - * @instance - */ - FacetKey.prototype.query = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * FacetKey returnMinMax. - * @member {boolean} returnMinMax - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * FacetValue facetValue. + * @member {"value"|"interval"|undefined} facetValue + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance */ - FacetKey.prototype.returnMinMax = false; + Object.defineProperty(FacetValue.prototype, "facetValue", { + get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new FacetKey instance using the specified properties. + * Creates a new FacetValue instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey instance + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue instance */ - FacetKey.create = function create(properties) { - return new FacetKey(properties); + FacetValue.create = function create(properties) { + return new FacetValue(properties); }; /** - * Encodes the specified FacetKey message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FacetKey.encode = function encode(message, writer) { + FacetValue.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.intervals != null && message.intervals.length) - for (var i = 0; i < message.intervals.length; ++i) - $root.google.cloud.retail.v2.Interval.encode(message.intervals[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.restrictedValues != null && message.restrictedValues.length) - for (var i = 0; i < message.restrictedValues.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.restrictedValues[i]); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.query); - if (message.prefixes != null && message.prefixes.length) - for (var i = 0; i < message.prefixes.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.prefixes[i]); - if (message.contains != null && message.contains.length) - for (var i = 0; i < message.contains.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.contains[i]); - if (message.caseInsensitive != null && Object.hasOwnProperty.call(message, "caseInsensitive")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.caseInsensitive); - if (message.returnMinMax != null && Object.hasOwnProperty.call(message, "returnMinMax")) - writer.uint32(/* id 11, wireType 0 =*/88).bool(message.returnMinMax); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.cloud.retail.v2.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); + if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.minValue); + if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.maxValue); return writer; }; /** - * Encodes the specified FacetKey message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.verify|verify} messages. + * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.IFacetKey} message FacetKey message or plain object to encode + * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FacetKey.encodeDelimited = function encodeDelimited(message, writer) { + FacetValue.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FacetKey message from the specified reader or buffer. + * Decodes a FacetValue message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FacetKey.decode = function decode(reader, length) { + FacetValue.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.key = reader.string(); + message.value = reader.string(); break; } case 2: { - if (!(message.intervals && message.intervals.length)) - message.intervals = []; - message.intervals.push($root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32())); + message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); break; } case 3: { - if (!(message.restrictedValues && message.restrictedValues.length)) - message.restrictedValues = []; - message.restrictedValues.push(reader.string()); - break; - } - case 8: { - if (!(message.prefixes && message.prefixes.length)) - message.prefixes = []; - message.prefixes.push(reader.string()); - break; - } - case 9: { - if (!(message.contains && message.contains.length)) - message.contains = []; - message.contains.push(reader.string()); - break; - } - case 10: { - message.caseInsensitive = reader.bool(); - break; - } - case 4: { - message.orderBy = reader.string(); + message.count = reader.int64(); break; } case 5: { - message.query = reader.string(); + message.minValue = reader.double(); break; } - case 11: { - message.returnMinMax = reader.bool(); + case 6: { + message.maxValue = reader.double(); break; } default: @@ -22348,245 +33795,190 @@ }; /** - * Decodes a FacetKey message from the specified reader or buffer, length delimited. + * Decodes a FacetValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FacetKey.decodeDelimited = function decodeDelimited(reader) { + FacetValue.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FacetKey message. + * Verifies a FacetValue message. * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FacetKey.verify = function verify(message) { + FacetValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.intervals != null && message.hasOwnProperty("intervals")) { - if (!Array.isArray(message.intervals)) - return "intervals: array expected"; - for (var i = 0; i < message.intervals.length; ++i) { - var error = $root.google.cloud.retail.v2.Interval.verify(message.intervals[i]); + var properties = {}; + if (message.value != null && message.hasOwnProperty("value")) { + properties.facetValue = 1; + if (!$util.isString(message.value)) + return "value: string expected"; + } + if (message.interval != null && message.hasOwnProperty("interval")) { + if (properties.facetValue === 1) + return "facetValue: multiple values"; + properties.facetValue = 1; + { + var error = $root.google.cloud.retail.v2.Interval.verify(message.interval); if (error) - return "intervals." + error; + return "interval." + error; } } - if (message.restrictedValues != null && message.hasOwnProperty("restrictedValues")) { - if (!Array.isArray(message.restrictedValues)) - return "restrictedValues: array expected"; - for (var i = 0; i < message.restrictedValues.length; ++i) - if (!$util.isString(message.restrictedValues[i])) - return "restrictedValues: string[] expected"; - } - if (message.prefixes != null && message.hasOwnProperty("prefixes")) { - if (!Array.isArray(message.prefixes)) - return "prefixes: array expected"; - for (var i = 0; i < message.prefixes.length; ++i) - if (!$util.isString(message.prefixes[i])) - return "prefixes: string[] expected"; - } - if (message.contains != null && message.hasOwnProperty("contains")) { - if (!Array.isArray(message.contains)) - return "contains: array expected"; - for (var i = 0; i < message.contains.length; ++i) - if (!$util.isString(message.contains[i])) - return "contains: string[] expected"; - } - if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) - if (typeof message.caseInsensitive !== "boolean") - return "caseInsensitive: boolean expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; - if (message.query != null && message.hasOwnProperty("query")) - if (!$util.isString(message.query)) - return "query: string expected"; - if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) - if (typeof message.returnMinMax !== "boolean") - return "returnMinMax: boolean expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + if (message.minValue != null && message.hasOwnProperty("minValue")) + if (typeof message.minValue !== "number") + return "minValue: number expected"; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + if (typeof message.maxValue !== "number") + return "maxValue: number expected"; return null; }; /** - * Creates a FacetKey message from a plain object. Also converts values to their respective internal types. + * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} FacetKey + * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue */ - FacetKey.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey) + FacetValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue) return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey(); - if (object.key != null) - message.key = String(object.key); - if (object.intervals) { - if (!Array.isArray(object.intervals)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: array expected"); - message.intervals = []; - for (var i = 0; i < object.intervals.length; ++i) { - if (typeof object.intervals[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals: object expected"); - message.intervals[i] = $root.google.cloud.retail.v2.Interval.fromObject(object.intervals[i]); - } - } - if (object.restrictedValues) { - if (!Array.isArray(object.restrictedValues)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restrictedValues: array expected"); - message.restrictedValues = []; - for (var i = 0; i < object.restrictedValues.length; ++i) - message.restrictedValues[i] = String(object.restrictedValues[i]); - } - if (object.prefixes) { - if (!Array.isArray(object.prefixes)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.prefixes: array expected"); - message.prefixes = []; - for (var i = 0; i < object.prefixes.length; ++i) - message.prefixes[i] = String(object.prefixes[i]); - } - if (object.contains) { - if (!Array.isArray(object.contains)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.contains: array expected"); - message.contains = []; - for (var i = 0; i < object.contains.length; ++i) - message.contains[i] = String(object.contains[i]); + var message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); + if (object.value != null) + message.value = String(object.value); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval: object expected"); + message.interval = $root.google.cloud.retail.v2.Interval.fromObject(object.interval); } - if (object.caseInsensitive != null) - message.caseInsensitive = Boolean(object.caseInsensitive); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); - if (object.query != null) - message.query = String(object.query); - if (object.returnMinMax != null) - message.returnMinMax = Boolean(object.returnMinMax); + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.minValue != null) + message.minValue = Number(object.minValue); + if (object.maxValue != null) + message.maxValue = Number(object.maxValue); return message; }; /** - * Creates a plain object from a FacetKey message. Also converts values to other types if specified. + * Creates a plain object from a FacetValue message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static - * @param {google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey} message FacetKey + * @param {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} message FacetValue * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FacetKey.toObject = function toObject(message, options) { + FacetValue.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.intervals = []; - object.restrictedValues = []; - object.prefixes = []; - object.contains = []; - } if (options.defaults) { - object.key = ""; - object.orderBy = ""; - object.query = ""; - object.caseInsensitive = false; - object.returnMinMax = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.intervals && message.intervals.length) { - object.intervals = []; - for (var j = 0; j < message.intervals.length; ++j) - object.intervals[j] = $root.google.cloud.retail.v2.Interval.toObject(message.intervals[j], options); - } - if (message.restrictedValues && message.restrictedValues.length) { - object.restrictedValues = []; - for (var j = 0; j < message.restrictedValues.length; ++j) - object.restrictedValues[j] = message.restrictedValues[j]; - } - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; - if (message.query != null && message.hasOwnProperty("query")) - object.query = message.query; - if (message.prefixes && message.prefixes.length) { - object.prefixes = []; - for (var j = 0; j < message.prefixes.length; ++j) - object.prefixes[j] = message.prefixes[j]; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + object.minValue = 0; + object.maxValue = 0; } - if (message.contains && message.contains.length) { - object.contains = []; - for (var j = 0; j < message.contains.length; ++j) - object.contains[j] = message.contains[j]; + if (message.value != null && message.hasOwnProperty("value")) { + object.value = message.value; + if (options.oneofs) + object.facetValue = "value"; } - if (message.caseInsensitive != null && message.hasOwnProperty("caseInsensitive")) - object.caseInsensitive = message.caseInsensitive; - if (message.returnMinMax != null && message.hasOwnProperty("returnMinMax")) - object.returnMinMax = message.returnMinMax; + if (message.interval != null && message.hasOwnProperty("interval")) { + object.interval = $root.google.cloud.retail.v2.Interval.toObject(message.interval, options); + if (options.oneofs) + object.facetValue = "interval"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (message.minValue != null && message.hasOwnProperty("minValue")) + object.minValue = options.json && !isFinite(message.minValue) ? String(message.minValue) : message.minValue; + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + object.maxValue = options.json && !isFinite(message.maxValue) ? String(message.maxValue) : message.maxValue; return object; }; /** - * Converts this FacetKey to JSON. + * Converts this FacetValue to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @instance * @returns {Object.} JSON object */ - FacetKey.prototype.toJSON = function toJSON() { + FacetValue.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FacetKey + * Gets the default type url for FacetValue * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey + * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FacetKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FacetValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"; + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"; }; - return FacetKey; + return FacetValue; })(); - return FacetSpec; + return Facet; })(); - SearchRequest.DynamicFacetSpec = (function() { + SearchResponse.QueryExpansionInfo = (function() { /** - * Properties of a DynamicFacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IDynamicFacetSpec - * @property {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode|null} [mode] DynamicFacetSpec mode + * Properties of a QueryExpansionInfo. + * @memberof google.cloud.retail.v2.SearchResponse + * @interface IQueryExpansionInfo + * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery + * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount */ /** - * Constructs a new DynamicFacetSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a DynamicFacetSpec. - * @implements IDynamicFacetSpec + * Constructs a new QueryExpansionInfo. + * @memberof google.cloud.retail.v2.SearchResponse + * @classdesc Represents a QueryExpansionInfo. + * @implements IQueryExpansionInfo * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set */ - function DynamicFacetSpec(properties) { + function QueryExpansionInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22594,75 +33986,89 @@ } /** - * DynamicFacetSpec mode. - * @member {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode} mode - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * QueryExpansionInfo expandedQuery. + * @member {boolean} expandedQuery + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @instance */ - DynamicFacetSpec.prototype.mode = 0; + QueryExpansionInfo.prototype.expandedQuery = false; /** - * Creates a new DynamicFacetSpec instance using the specified properties. + * QueryExpansionInfo pinnedResultCount. + * @member {number|Long} pinnedResultCount + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo + * @instance + */ + QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new QueryExpansionInfo instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec instance + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance */ - DynamicFacetSpec.create = function create(properties) { - return new DynamicFacetSpec(properties); + QueryExpansionInfo.create = function create(properties) { + return new QueryExpansionInfo(properties); }; /** - * Encodes the specified DynamicFacetSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DynamicFacetSpec.encode = function encode(message, writer) { + QueryExpansionInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); + if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); return writer; }; /** - * Encodes the specified DynamicFacetSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify|verify} messages. + * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec} message DynamicFacetSpec message or plain object to encode + * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DynamicFacetSpec.encodeDelimited = function encodeDelimited(message, writer) { + QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer. + * Decodes a QueryExpansionInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DynamicFacetSpec.decode = function decode(reader, length) { + QueryExpansionInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.mode = reader.int32(); + message.expandedQuery = reader.bool(); + break; + } + case 2: { + message.pinnedResultCount = reader.int64(); break; } default: @@ -22674,1416 +34080,1904 @@ }; /** - * Decodes a DynamicFacetSpec message from the specified reader or buffer, length delimited. + * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DynamicFacetSpec.decodeDelimited = function decodeDelimited(reader) { + QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DynamicFacetSpec message. + * Verifies a QueryExpansionInfo message. * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DynamicFacetSpec.verify = function verify(message) { + QueryExpansionInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + if (typeof message.expandedQuery !== "boolean") + return "expandedQuery: boolean expected"; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) + return "pinnedResultCount: integer|Long expected"; return null; }; /** - * Creates a DynamicFacetSpec message from a plain object. Also converts values to their respective internal types. + * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} DynamicFacetSpec + * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo */ - DynamicFacetSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec) + QueryExpansionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo) return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "DISABLED": - case 1: - message.mode = 1; - break; - case "ENABLED": - case 2: - message.mode = 2; - break; - } + var message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); + if (object.expandedQuery != null) + message.expandedQuery = Boolean(object.expandedQuery); + if (object.pinnedResultCount != null) + if ($util.Long) + (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; + else if (typeof object.pinnedResultCount === "string") + message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); + else if (typeof object.pinnedResultCount === "number") + message.pinnedResultCount = object.pinnedResultCount; + else if (typeof object.pinnedResultCount === "object") + message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); return message; }; /** - * Creates a plain object from a DynamicFacetSpec message. Also converts values to other types if specified. + * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static - * @param {google.cloud.retail.v2.SearchRequest.DynamicFacetSpec} message DynamicFacetSpec + * @param {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DynamicFacetSpec.toObject = function toObject(message, options) { + QueryExpansionInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + if (options.defaults) { + object.expandedQuery = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pinnedResultCount = options.longs === String ? "0" : 0; + } + if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) + object.expandedQuery = message.expandedQuery; + if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) + if (typeof message.pinnedResultCount === "number") + object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; + else + object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; return object; }; /** - * Converts this DynamicFacetSpec to JSON. + * Converts this QueryExpansionInfo to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @instance * @returns {Object.} JSON object */ - DynamicFacetSpec.prototype.toJSON = function toJSON() { + QueryExpansionInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for DynamicFacetSpec + * Gets the default type url for QueryExpansionInfo * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.DynamicFacetSpec + * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - DynamicFacetSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + QueryExpansionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"; + return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"; }; - /** - * Mode enum. - * @name google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} ENABLED=2 ENABLED value - */ - DynamicFacetSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[2] = "ENABLED"] = 2; - return values; - })(); - - return DynamicFacetSpec; + return QueryExpansionInfo; })(); - SearchRequest.BoostSpec = (function() { + return SearchResponse; + })(); - /** - * Properties of a BoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IBoostSpec - * @property {Array.|null} [conditionBoostSpecs] BoostSpec conditionBoostSpecs - * @property {boolean|null} [skipBoostSpecValidation] BoostSpec skipBoostSpecValidation - */ + v2.ServingConfig = (function() { - /** - * Constructs a new BoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a BoostSpec. - * @implements IBoostSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set - */ - function BoostSpec(properties) { - this.conditionBoostSpecs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Properties of a ServingConfig. + * @memberof google.cloud.retail.v2 + * @interface IServingConfig + * @property {string|null} [name] ServingConfig name + * @property {string|null} [displayName] ServingConfig displayName + * @property {string|null} [modelId] ServingConfig modelId + * @property {string|null} [priceRerankingLevel] ServingConfig priceRerankingLevel + * @property {Array.|null} [facetControlIds] ServingConfig facetControlIds + * @property {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null} [dynamicFacetSpec] ServingConfig dynamicFacetSpec + * @property {Array.|null} [boostControlIds] ServingConfig boostControlIds + * @property {Array.|null} [filterControlIds] ServingConfig filterControlIds + * @property {Array.|null} [redirectControlIds] ServingConfig redirectControlIds + * @property {Array.|null} [twowaySynonymsControlIds] ServingConfig twowaySynonymsControlIds + * @property {Array.|null} [onewaySynonymsControlIds] ServingConfig onewaySynonymsControlIds + * @property {Array.|null} [doNotAssociateControlIds] ServingConfig doNotAssociateControlIds + * @property {Array.|null} [replacementControlIds] ServingConfig replacementControlIds + * @property {Array.|null} [ignoreControlIds] ServingConfig ignoreControlIds + * @property {string|null} [diversityLevel] ServingConfig diversityLevel + * @property {string|null} [enableCategoryFilterLevel] ServingConfig enableCategoryFilterLevel + * @property {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] ServingConfig personalizationSpec + * @property {Array.|null} [solutionTypes] ServingConfig solutionTypes + */ + + /** + * Constructs a new ServingConfig. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ServingConfig. + * @implements IServingConfig + * @constructor + * @param {google.cloud.retail.v2.IServingConfig=} [properties] Properties to set + */ + function ServingConfig(properties) { + this.facetControlIds = []; + this.boostControlIds = []; + this.filterControlIds = []; + this.redirectControlIds = []; + this.twowaySynonymsControlIds = []; + this.onewaySynonymsControlIds = []; + this.doNotAssociateControlIds = []; + this.replacementControlIds = []; + this.ignoreControlIds = []; + this.solutionTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServingConfig name. + * @member {string} name + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.name = ""; + + /** + * ServingConfig displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.displayName = ""; + + /** + * ServingConfig modelId. + * @member {string} modelId + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.modelId = ""; + + /** + * ServingConfig priceRerankingLevel. + * @member {string} priceRerankingLevel + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.priceRerankingLevel = ""; + + /** + * ServingConfig facetControlIds. + * @member {Array.} facetControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.facetControlIds = $util.emptyArray; + + /** + * ServingConfig dynamicFacetSpec. + * @member {google.cloud.retail.v2.SearchRequest.IDynamicFacetSpec|null|undefined} dynamicFacetSpec + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.dynamicFacetSpec = null; + + /** + * ServingConfig boostControlIds. + * @member {Array.} boostControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.boostControlIds = $util.emptyArray; + + /** + * ServingConfig filterControlIds. + * @member {Array.} filterControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.filterControlIds = $util.emptyArray; + + /** + * ServingConfig redirectControlIds. + * @member {Array.} redirectControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.redirectControlIds = $util.emptyArray; + + /** + * ServingConfig twowaySynonymsControlIds. + * @member {Array.} twowaySynonymsControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.twowaySynonymsControlIds = $util.emptyArray; + + /** + * ServingConfig onewaySynonymsControlIds. + * @member {Array.} onewaySynonymsControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.onewaySynonymsControlIds = $util.emptyArray; + + /** + * ServingConfig doNotAssociateControlIds. + * @member {Array.} doNotAssociateControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.doNotAssociateControlIds = $util.emptyArray; + + /** + * ServingConfig replacementControlIds. + * @member {Array.} replacementControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.replacementControlIds = $util.emptyArray; + + /** + * ServingConfig ignoreControlIds. + * @member {Array.} ignoreControlIds + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.ignoreControlIds = $util.emptyArray; + + /** + * ServingConfig diversityLevel. + * @member {string} diversityLevel + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.diversityLevel = ""; + + /** + * ServingConfig enableCategoryFilterLevel. + * @member {string} enableCategoryFilterLevel + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.enableCategoryFilterLevel = ""; + + /** + * ServingConfig personalizationSpec. + * @member {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.personalizationSpec = null; + + /** + * ServingConfig solutionTypes. + * @member {Array.} solutionTypes + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + */ + ServingConfig.prototype.solutionTypes = $util.emptyArray; + + /** + * Creates a new ServingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {google.cloud.retail.v2.IServingConfig=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ServingConfig} ServingConfig instance + */ + ServingConfig.create = function create(properties) { + return new ServingConfig(properties); + }; + + /** + * Encodes the specified ServingConfig message. Does not implicitly {@link google.cloud.retail.v2.ServingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {google.cloud.retail.v2.IServingConfig} message ServingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.modelId != null && Object.hasOwnProperty.call(message, "modelId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.modelId); + if (message.priceRerankingLevel != null && Object.hasOwnProperty.call(message, "priceRerankingLevel")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.priceRerankingLevel); + if (message.facetControlIds != null && message.facetControlIds.length) + for (var i = 0; i < message.facetControlIds.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.facetControlIds[i]); + if (message.dynamicFacetSpec != null && Object.hasOwnProperty.call(message, "dynamicFacetSpec")) + $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.encode(message.dynamicFacetSpec, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.boostControlIds != null && message.boostControlIds.length) + for (var i = 0; i < message.boostControlIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.boostControlIds[i]); + if (message.diversityLevel != null && Object.hasOwnProperty.call(message, "diversityLevel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.diversityLevel); + if (message.filterControlIds != null && message.filterControlIds.length) + for (var i = 0; i < message.filterControlIds.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.filterControlIds[i]); + if (message.redirectControlIds != null && message.redirectControlIds.length) + for (var i = 0; i < message.redirectControlIds.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectControlIds[i]); + if (message.onewaySynonymsControlIds != null && message.onewaySynonymsControlIds.length) + for (var i = 0; i < message.onewaySynonymsControlIds.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.onewaySynonymsControlIds[i]); + if (message.doNotAssociateControlIds != null && message.doNotAssociateControlIds.length) + for (var i = 0; i < message.doNotAssociateControlIds.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.doNotAssociateControlIds[i]); + if (message.replacementControlIds != null && message.replacementControlIds.length) + for (var i = 0; i < message.replacementControlIds.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.replacementControlIds[i]); + if (message.ignoreControlIds != null && message.ignoreControlIds.length) + for (var i = 0; i < message.ignoreControlIds.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.ignoreControlIds[i]); + if (message.enableCategoryFilterLevel != null && Object.hasOwnProperty.call(message, "enableCategoryFilterLevel")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.enableCategoryFilterLevel); + if (message.twowaySynonymsControlIds != null && message.twowaySynonymsControlIds.length) + for (var i = 0; i < message.twowaySynonymsControlIds.length; ++i) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.twowaySynonymsControlIds[i]); + if (message.solutionTypes != null && message.solutionTypes.length) { + writer.uint32(/* id 19, wireType 2 =*/154).fork(); + for (var i = 0; i < message.solutionTypes.length; ++i) + writer.int32(message.solutionTypes[i]); + writer.ldelim(); } + if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) + $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + return writer; + }; - /** - * BoostSpec conditionBoostSpecs. - * @member {Array.} conditionBoostSpecs - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @instance - */ - BoostSpec.prototype.conditionBoostSpecs = $util.emptyArray; + /** + * Encodes the specified ServingConfig message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ServingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {google.cloud.retail.v2.IServingConfig} message ServingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * BoostSpec skipBoostSpecValidation. - * @member {boolean|null|undefined} skipBoostSpecValidation - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @instance - */ - BoostSpec.prototype.skipBoostSpecValidation = null; + /** + * Decodes a ServingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ServingConfig} ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ServingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.modelId = reader.string(); + break; + } + case 4: { + message.priceRerankingLevel = reader.string(); + break; + } + case 5: { + if (!(message.facetControlIds && message.facetControlIds.length)) + message.facetControlIds = []; + message.facetControlIds.push(reader.string()); + break; + } + case 6: { + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.boostControlIds && message.boostControlIds.length)) + message.boostControlIds = []; + message.boostControlIds.push(reader.string()); + break; + } + case 9: { + if (!(message.filterControlIds && message.filterControlIds.length)) + message.filterControlIds = []; + message.filterControlIds.push(reader.string()); + break; + } + case 10: { + if (!(message.redirectControlIds && message.redirectControlIds.length)) + message.redirectControlIds = []; + message.redirectControlIds.push(reader.string()); + break; + } + case 18: { + if (!(message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length)) + message.twowaySynonymsControlIds = []; + message.twowaySynonymsControlIds.push(reader.string()); + break; + } + case 12: { + if (!(message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length)) + message.onewaySynonymsControlIds = []; + message.onewaySynonymsControlIds.push(reader.string()); + break; + } + case 13: { + if (!(message.doNotAssociateControlIds && message.doNotAssociateControlIds.length)) + message.doNotAssociateControlIds = []; + message.doNotAssociateControlIds.push(reader.string()); + break; + } + case 14: { + if (!(message.replacementControlIds && message.replacementControlIds.length)) + message.replacementControlIds = []; + message.replacementControlIds.push(reader.string()); + break; + } + case 15: { + if (!(message.ignoreControlIds && message.ignoreControlIds.length)) + message.ignoreControlIds = []; + message.ignoreControlIds.push(reader.string()); + break; + } + case 8: { + message.diversityLevel = reader.string(); + break; + } + case 16: { + message.enableCategoryFilterLevel = reader.string(); + break; + } + case 21: { + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + } + case 19: { + if (!(message.solutionTypes && message.solutionTypes.length)) + message.solutionTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.solutionTypes.push(reader.int32()); + } else + message.solutionTypes.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Decodes a ServingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ServingConfig} ServingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * BoostSpec _skipBoostSpecValidation. - * @member {"skipBoostSpecValidation"|undefined} _skipBoostSpecValidation - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @instance - */ - Object.defineProperty(BoostSpec.prototype, "_skipBoostSpecValidation", { - get: $util.oneOfGetter($oneOfFields = ["skipBoostSpecValidation"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Verifies a ServingConfig message. + * @function verify + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.modelId != null && message.hasOwnProperty("modelId")) + if (!$util.isString(message.modelId)) + return "modelId: string expected"; + if (message.priceRerankingLevel != null && message.hasOwnProperty("priceRerankingLevel")) + if (!$util.isString(message.priceRerankingLevel)) + return "priceRerankingLevel: string expected"; + if (message.facetControlIds != null && message.hasOwnProperty("facetControlIds")) { + if (!Array.isArray(message.facetControlIds)) + return "facetControlIds: array expected"; + for (var i = 0; i < message.facetControlIds.length; ++i) + if (!$util.isString(message.facetControlIds[i])) + return "facetControlIds: string[] expected"; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.verify(message.dynamicFacetSpec); + if (error) + return "dynamicFacetSpec." + error; + } + if (message.boostControlIds != null && message.hasOwnProperty("boostControlIds")) { + if (!Array.isArray(message.boostControlIds)) + return "boostControlIds: array expected"; + for (var i = 0; i < message.boostControlIds.length; ++i) + if (!$util.isString(message.boostControlIds[i])) + return "boostControlIds: string[] expected"; + } + if (message.filterControlIds != null && message.hasOwnProperty("filterControlIds")) { + if (!Array.isArray(message.filterControlIds)) + return "filterControlIds: array expected"; + for (var i = 0; i < message.filterControlIds.length; ++i) + if (!$util.isString(message.filterControlIds[i])) + return "filterControlIds: string[] expected"; + } + if (message.redirectControlIds != null && message.hasOwnProperty("redirectControlIds")) { + if (!Array.isArray(message.redirectControlIds)) + return "redirectControlIds: array expected"; + for (var i = 0; i < message.redirectControlIds.length; ++i) + if (!$util.isString(message.redirectControlIds[i])) + return "redirectControlIds: string[] expected"; + } + if (message.twowaySynonymsControlIds != null && message.hasOwnProperty("twowaySynonymsControlIds")) { + if (!Array.isArray(message.twowaySynonymsControlIds)) + return "twowaySynonymsControlIds: array expected"; + for (var i = 0; i < message.twowaySynonymsControlIds.length; ++i) + if (!$util.isString(message.twowaySynonymsControlIds[i])) + return "twowaySynonymsControlIds: string[] expected"; + } + if (message.onewaySynonymsControlIds != null && message.hasOwnProperty("onewaySynonymsControlIds")) { + if (!Array.isArray(message.onewaySynonymsControlIds)) + return "onewaySynonymsControlIds: array expected"; + for (var i = 0; i < message.onewaySynonymsControlIds.length; ++i) + if (!$util.isString(message.onewaySynonymsControlIds[i])) + return "onewaySynonymsControlIds: string[] expected"; + } + if (message.doNotAssociateControlIds != null && message.hasOwnProperty("doNotAssociateControlIds")) { + if (!Array.isArray(message.doNotAssociateControlIds)) + return "doNotAssociateControlIds: array expected"; + for (var i = 0; i < message.doNotAssociateControlIds.length; ++i) + if (!$util.isString(message.doNotAssociateControlIds[i])) + return "doNotAssociateControlIds: string[] expected"; + } + if (message.replacementControlIds != null && message.hasOwnProperty("replacementControlIds")) { + if (!Array.isArray(message.replacementControlIds)) + return "replacementControlIds: array expected"; + for (var i = 0; i < message.replacementControlIds.length; ++i) + if (!$util.isString(message.replacementControlIds[i])) + return "replacementControlIds: string[] expected"; + } + if (message.ignoreControlIds != null && message.hasOwnProperty("ignoreControlIds")) { + if (!Array.isArray(message.ignoreControlIds)) + return "ignoreControlIds: array expected"; + for (var i = 0; i < message.ignoreControlIds.length; ++i) + if (!$util.isString(message.ignoreControlIds[i])) + return "ignoreControlIds: string[] expected"; + } + if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) + if (!$util.isString(message.diversityLevel)) + return "diversityLevel: string expected"; + if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) + if (!$util.isString(message.enableCategoryFilterLevel)) + return "enableCategoryFilterLevel: string expected"; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { + var error = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); + if (error) + return "personalizationSpec." + error; + } + if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { + if (!Array.isArray(message.solutionTypes)) + return "solutionTypes: array expected"; + for (var i = 0; i < message.solutionTypes.length; ++i) + switch (message.solutionTypes[i]) { + default: + return "solutionTypes: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a ServingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ServingConfig} ServingConfig + */ + ServingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ServingConfig) + return object; + var message = new $root.google.cloud.retail.v2.ServingConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.modelId != null) + message.modelId = String(object.modelId); + if (object.priceRerankingLevel != null) + message.priceRerankingLevel = String(object.priceRerankingLevel); + if (object.facetControlIds) { + if (!Array.isArray(object.facetControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.facetControlIds: array expected"); + message.facetControlIds = []; + for (var i = 0; i < object.facetControlIds.length; ++i) + message.facetControlIds[i] = String(object.facetControlIds[i]); + } + if (object.dynamicFacetSpec != null) { + if (typeof object.dynamicFacetSpec !== "object") + throw TypeError(".google.cloud.retail.v2.ServingConfig.dynamicFacetSpec: object expected"); + message.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.fromObject(object.dynamicFacetSpec); + } + if (object.boostControlIds) { + if (!Array.isArray(object.boostControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.boostControlIds: array expected"); + message.boostControlIds = []; + for (var i = 0; i < object.boostControlIds.length; ++i) + message.boostControlIds[i] = String(object.boostControlIds[i]); + } + if (object.filterControlIds) { + if (!Array.isArray(object.filterControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.filterControlIds: array expected"); + message.filterControlIds = []; + for (var i = 0; i < object.filterControlIds.length; ++i) + message.filterControlIds[i] = String(object.filterControlIds[i]); + } + if (object.redirectControlIds) { + if (!Array.isArray(object.redirectControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.redirectControlIds: array expected"); + message.redirectControlIds = []; + for (var i = 0; i < object.redirectControlIds.length; ++i) + message.redirectControlIds[i] = String(object.redirectControlIds[i]); + } + if (object.twowaySynonymsControlIds) { + if (!Array.isArray(object.twowaySynonymsControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.twowaySynonymsControlIds: array expected"); + message.twowaySynonymsControlIds = []; + for (var i = 0; i < object.twowaySynonymsControlIds.length; ++i) + message.twowaySynonymsControlIds[i] = String(object.twowaySynonymsControlIds[i]); + } + if (object.onewaySynonymsControlIds) { + if (!Array.isArray(object.onewaySynonymsControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.onewaySynonymsControlIds: array expected"); + message.onewaySynonymsControlIds = []; + for (var i = 0; i < object.onewaySynonymsControlIds.length; ++i) + message.onewaySynonymsControlIds[i] = String(object.onewaySynonymsControlIds[i]); + } + if (object.doNotAssociateControlIds) { + if (!Array.isArray(object.doNotAssociateControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.doNotAssociateControlIds: array expected"); + message.doNotAssociateControlIds = []; + for (var i = 0; i < object.doNotAssociateControlIds.length; ++i) + message.doNotAssociateControlIds[i] = String(object.doNotAssociateControlIds[i]); + } + if (object.replacementControlIds) { + if (!Array.isArray(object.replacementControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.replacementControlIds: array expected"); + message.replacementControlIds = []; + for (var i = 0; i < object.replacementControlIds.length; ++i) + message.replacementControlIds[i] = String(object.replacementControlIds[i]); + } + if (object.ignoreControlIds) { + if (!Array.isArray(object.ignoreControlIds)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.ignoreControlIds: array expected"); + message.ignoreControlIds = []; + for (var i = 0; i < object.ignoreControlIds.length; ++i) + message.ignoreControlIds[i] = String(object.ignoreControlIds[i]); + } + if (object.diversityLevel != null) + message.diversityLevel = String(object.diversityLevel); + if (object.enableCategoryFilterLevel != null) + message.enableCategoryFilterLevel = String(object.enableCategoryFilterLevel); + if (object.personalizationSpec != null) { + if (typeof object.personalizationSpec !== "object") + throw TypeError(".google.cloud.retail.v2.ServingConfig.personalizationSpec: object expected"); + message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); + } + if (object.solutionTypes) { + if (!Array.isArray(object.solutionTypes)) + throw TypeError(".google.cloud.retail.v2.ServingConfig.solutionTypes: array expected"); + message.solutionTypes = []; + for (var i = 0; i < object.solutionTypes.length; ++i) + switch (object.solutionTypes[i]) { + default: + case "SOLUTION_TYPE_UNSPECIFIED": + case 0: + message.solutionTypes[i] = 0; + break; + case "SOLUTION_TYPE_RECOMMENDATION": + case 1: + message.solutionTypes[i] = 1; + break; + case "SOLUTION_TYPE_SEARCH": + case 2: + message.solutionTypes[i] = 2; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ServingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {google.cloud.retail.v2.ServingConfig} message ServingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.facetControlIds = []; + object.boostControlIds = []; + object.filterControlIds = []; + object.redirectControlIds = []; + object.onewaySynonymsControlIds = []; + object.doNotAssociateControlIds = []; + object.replacementControlIds = []; + object.ignoreControlIds = []; + object.twowaySynonymsControlIds = []; + object.solutionTypes = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.modelId = ""; + object.priceRerankingLevel = ""; + object.dynamicFacetSpec = null; + object.diversityLevel = ""; + object.enableCategoryFilterLevel = ""; + object.personalizationSpec = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.modelId != null && message.hasOwnProperty("modelId")) + object.modelId = message.modelId; + if (message.priceRerankingLevel != null && message.hasOwnProperty("priceRerankingLevel")) + object.priceRerankingLevel = message.priceRerankingLevel; + if (message.facetControlIds && message.facetControlIds.length) { + object.facetControlIds = []; + for (var j = 0; j < message.facetControlIds.length; ++j) + object.facetControlIds[j] = message.facetControlIds[j]; + } + if (message.dynamicFacetSpec != null && message.hasOwnProperty("dynamicFacetSpec")) + object.dynamicFacetSpec = $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.toObject(message.dynamicFacetSpec, options); + if (message.boostControlIds && message.boostControlIds.length) { + object.boostControlIds = []; + for (var j = 0; j < message.boostControlIds.length; ++j) + object.boostControlIds[j] = message.boostControlIds[j]; + } + if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) + object.diversityLevel = message.diversityLevel; + if (message.filterControlIds && message.filterControlIds.length) { + object.filterControlIds = []; + for (var j = 0; j < message.filterControlIds.length; ++j) + object.filterControlIds[j] = message.filterControlIds[j]; + } + if (message.redirectControlIds && message.redirectControlIds.length) { + object.redirectControlIds = []; + for (var j = 0; j < message.redirectControlIds.length; ++j) + object.redirectControlIds[j] = message.redirectControlIds[j]; + } + if (message.onewaySynonymsControlIds && message.onewaySynonymsControlIds.length) { + object.onewaySynonymsControlIds = []; + for (var j = 0; j < message.onewaySynonymsControlIds.length; ++j) + object.onewaySynonymsControlIds[j] = message.onewaySynonymsControlIds[j]; + } + if (message.doNotAssociateControlIds && message.doNotAssociateControlIds.length) { + object.doNotAssociateControlIds = []; + for (var j = 0; j < message.doNotAssociateControlIds.length; ++j) + object.doNotAssociateControlIds[j] = message.doNotAssociateControlIds[j]; + } + if (message.replacementControlIds && message.replacementControlIds.length) { + object.replacementControlIds = []; + for (var j = 0; j < message.replacementControlIds.length; ++j) + object.replacementControlIds[j] = message.replacementControlIds[j]; + } + if (message.ignoreControlIds && message.ignoreControlIds.length) { + object.ignoreControlIds = []; + for (var j = 0; j < message.ignoreControlIds.length; ++j) + object.ignoreControlIds[j] = message.ignoreControlIds[j]; + } + if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) + object.enableCategoryFilterLevel = message.enableCategoryFilterLevel; + if (message.twowaySynonymsControlIds && message.twowaySynonymsControlIds.length) { + object.twowaySynonymsControlIds = []; + for (var j = 0; j < message.twowaySynonymsControlIds.length; ++j) + object.twowaySynonymsControlIds[j] = message.twowaySynonymsControlIds[j]; + } + if (message.solutionTypes && message.solutionTypes.length) { + object.solutionTypes = []; + for (var j = 0; j < message.solutionTypes.length; ++j) + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + } + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) + object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + return object; + }; + + /** + * Converts this ServingConfig to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ServingConfig + * @instance + * @returns {Object.} JSON object + */ + ServingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServingConfig + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ServingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ServingConfig"; + }; - /** - * Creates a new BoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec instance - */ - BoostSpec.create = function create(properties) { - return new BoostSpec(properties); - }; + return ServingConfig; + })(); - /** - * Encodes the specified BoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.conditionBoostSpecs != null && message.conditionBoostSpecs.length) - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) - $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.conditionBoostSpecs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.skipBoostSpecValidation != null && Object.hasOwnProperty.call(message, "skipBoostSpecValidation")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.skipBoostSpecValidation); - return writer; - }; + v2.ServingConfigService = (function() { - /** - * Encodes the specified BoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IBoostSpec} message BoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new ServingConfigService service. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ServingConfigService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ServingConfigService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * Decodes a BoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.conditionBoostSpecs && message.conditionBoostSpecs.length)) - message.conditionBoostSpecs = []; - message.conditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); - break; - } - case 2: { - message.skipBoostSpecValidation = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + (ServingConfigService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ServingConfigService; - /** - * Decodes a BoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates new ServingConfigService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2.ServingConfigService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ServingConfigService} RPC service. Useful where requests and/or responses are streamed. + */ + ServingConfigService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Verifies a BoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.conditionBoostSpecs != null && message.hasOwnProperty("conditionBoostSpecs")) { - if (!Array.isArray(message.conditionBoostSpecs)) - return "conditionBoostSpecs: array expected"; - for (var i = 0; i < message.conditionBoostSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.conditionBoostSpecs[i]); - if (error) - return "conditionBoostSpecs." + error; - } - } - if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { - properties._skipBoostSpecValidation = 1; - if (typeof message.skipBoostSpecValidation !== "boolean") - return "skipBoostSpecValidation: boolean expected"; - } - return null; - }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|createServingConfig}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef CreateServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ServingConfig} [response] ServingConfig + */ - /** - * Creates a BoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec} BoostSpec - */ - BoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec(); - if (object.conditionBoostSpecs) { - if (!Array.isArray(object.conditionBoostSpecs)) - throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: array expected"); - message.conditionBoostSpecs = []; - for (var i = 0; i < object.conditionBoostSpecs.length; ++i) { - if (typeof object.conditionBoostSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchRequest.BoostSpec.conditionBoostSpecs: object expected"); - message.conditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.conditionBoostSpecs[i]); - } - } - if (object.skipBoostSpecValidation != null) - message.skipBoostSpecValidation = Boolean(object.skipBoostSpecValidation); - return message; - }; + /** + * Calls CreateServingConfig. + * @function createServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.ICreateServingConfigRequest} request CreateServingConfigRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.CreateServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.createServingConfig = function createServingConfig(request, callback) { + return this.rpcCall(createServingConfig, $root.google.cloud.retail.v2.CreateServingConfigRequest, $root.google.cloud.retail.v2.ServingConfig, request, callback); + }, "name", { value: "CreateServingConfig" }); - /** - * Creates a plain object from a BoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec} message BoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.conditionBoostSpecs = []; - if (message.conditionBoostSpecs && message.conditionBoostSpecs.length) { - object.conditionBoostSpecs = []; - for (var j = 0; j < message.conditionBoostSpecs.length; ++j) - object.conditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.conditionBoostSpecs[j], options); - } - if (message.skipBoostSpecValidation != null && message.hasOwnProperty("skipBoostSpecValidation")) { - object.skipBoostSpecValidation = message.skipBoostSpecValidation; - if (options.oneofs) - object._skipBoostSpecValidation = "skipBoostSpecValidation"; - } - return object; - }; + /** + * Calls CreateServingConfig. + * @function createServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.ICreateServingConfigRequest} request CreateServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Converts this BoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @instance - * @returns {Object.} JSON object - */ - BoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|deleteServingConfig}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef DeleteServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ - /** - * Gets the default type url for BoostSpec - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.BoostSpec"; - }; + /** + * Calls DeleteServingConfig. + * @function deleteServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IDeleteServingConfigRequest} request DeleteServingConfigRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.DeleteServingConfigCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.deleteServingConfig = function deleteServingConfig(request, callback) { + return this.rpcCall(deleteServingConfig, $root.google.cloud.retail.v2.DeleteServingConfigRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteServingConfig" }); - BoostSpec.ConditionBoostSpec = (function() { + /** + * Calls DeleteServingConfig. + * @function deleteServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IDeleteServingConfigRequest} request DeleteServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Properties of a ConditionBoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @interface IConditionBoostSpec - * @property {string|null} [condition] ConditionBoostSpec condition - * @property {number|null} [boost] ConditionBoostSpec boost - */ + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|updateServingConfig}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef UpdateServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ServingConfig} [response] ServingConfig + */ - /** - * Constructs a new ConditionBoostSpec. - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec - * @classdesc Represents a ConditionBoostSpec. - * @implements IConditionBoostSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - */ - function ConditionBoostSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Calls UpdateServingConfig. + * @function updateServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IUpdateServingConfigRequest} request UpdateServingConfigRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.UpdateServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.updateServingConfig = function updateServingConfig(request, callback) { + return this.rpcCall(updateServingConfig, $root.google.cloud.retail.v2.UpdateServingConfigRequest, $root.google.cloud.retail.v2.ServingConfig, request, callback); + }, "name", { value: "UpdateServingConfig" }); - /** - * ConditionBoostSpec condition. - * @member {string} condition - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.condition = ""; + /** + * Calls UpdateServingConfig. + * @function updateServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IUpdateServingConfigRequest} request UpdateServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * ConditionBoostSpec boost. - * @member {number} boost - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - */ - ConditionBoostSpec.prototype.boost = 0; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|getServingConfig}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef GetServingConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ServingConfig} [response] ServingConfig + */ - /** - * Creates a new ConditionBoostSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec instance - */ - ConditionBoostSpec.create = function create(properties) { - return new ConditionBoostSpec(properties); - }; + /** + * Calls GetServingConfig. + * @function getServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IGetServingConfigRequest} request GetServingConfigRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.GetServingConfigCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.getServingConfig = function getServingConfig(request, callback) { + return this.rpcCall(getServingConfig, $root.google.cloud.retail.v2.GetServingConfigRequest, $root.google.cloud.retail.v2.ServingConfig, request, callback); + }, "name", { value: "GetServingConfig" }); - /** - * Encodes the specified ConditionBoostSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); - if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); - return writer; - }; + /** + * Calls GetServingConfig. + * @function getServingConfig + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IGetServingConfigRequest} request GetServingConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Encodes the specified ConditionBoostSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.IConditionBoostSpec} message ConditionBoostSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConditionBoostSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|listServingConfigs}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef ListServingConfigsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ListServingConfigsResponse} [response] ListServingConfigsResponse + */ - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.condition = reader.string(); - break; - } - case 2: { - message.boost = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Calls ListServingConfigs. + * @function listServingConfigs + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IListServingConfigsRequest} request ListServingConfigsRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.ListServingConfigsCallback} callback Node-style callback called with the error, if any, and ListServingConfigsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.listServingConfigs = function listServingConfigs(request, callback) { + return this.rpcCall(listServingConfigs, $root.google.cloud.retail.v2.ListServingConfigsRequest, $root.google.cloud.retail.v2.ListServingConfigsResponse, request, callback); + }, "name", { value: "ListServingConfigs" }); - /** - * Decodes a ConditionBoostSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConditionBoostSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Calls ListServingConfigs. + * @function listServingConfigs + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IListServingConfigsRequest} request ListServingConfigsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Verifies a ConditionBoostSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConditionBoostSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - if (!$util.isString(message.condition)) - return "condition: string expected"; - if (message.boost != null && message.hasOwnProperty("boost")) - if (typeof message.boost !== "number") - return "boost: number expected"; - return null; - }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|addControl}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef AddControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ServingConfig} [response] ServingConfig + */ - /** - * Creates a ConditionBoostSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} ConditionBoostSpec - */ - ConditionBoostSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec(); - if (object.condition != null) - message.condition = String(object.condition); - if (object.boost != null) - message.boost = Number(object.boost); - return message; - }; + /** + * Calls AddControl. + * @function addControl + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IAddControlRequest} request AddControlRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.AddControlCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.addControl = function addControl(request, callback) { + return this.rpcCall(addControl, $root.google.cloud.retail.v2.AddControlRequest, $root.google.cloud.retail.v2.ServingConfig, request, callback); + }, "name", { value: "AddControl" }); - /** - * Creates a plain object from a ConditionBoostSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec} message ConditionBoostSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConditionBoostSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = ""; - object.boost = 0; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = message.condition; - if (message.boost != null && message.hasOwnProperty("boost")) - object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; - return object; - }; + /** + * Calls AddControl. + * @function addControl + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IAddControlRequest} request AddControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Converts this ConditionBoostSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @instance - * @returns {Object.} JSON object - */ - ConditionBoostSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Callback as used by {@link google.cloud.retail.v2.ServingConfigService|removeControl}. + * @memberof google.cloud.retail.v2.ServingConfigService + * @typedef RemoveControlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2.ServingConfig} [response] ServingConfig + */ - /** - * Gets the default type url for ConditionBoostSpec - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConditionBoostSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"; - }; + /** + * Calls RemoveControl. + * @function removeControl + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IRemoveControlRequest} request RemoveControlRequest message or plain object + * @param {google.cloud.retail.v2.ServingConfigService.RemoveControlCallback} callback Node-style callback called with the error, if any, and ServingConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServingConfigService.prototype.removeControl = function removeControl(request, callback) { + return this.rpcCall(removeControl, $root.google.cloud.retail.v2.RemoveControlRequest, $root.google.cloud.retail.v2.ServingConfig, request, callback); + }, "name", { value: "RemoveControl" }); - return ConditionBoostSpec; - })(); + /** + * Calls RemoveControl. + * @function removeControl + * @memberof google.cloud.retail.v2.ServingConfigService + * @instance + * @param {google.cloud.retail.v2.IRemoveControlRequest} request RemoveControlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - return BoostSpec; - })(); + return ServingConfigService; + })(); - SearchRequest.QueryExpansionSpec = (function() { + v2.CreateServingConfigRequest = (function() { - /** - * Properties of a QueryExpansionSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IQueryExpansionSpec - * @property {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition|null} [condition] QueryExpansionSpec condition - * @property {boolean|null} [pinUnexpandedResults] QueryExpansionSpec pinUnexpandedResults - */ + /** + * Properties of a CreateServingConfigRequest. + * @memberof google.cloud.retail.v2 + * @interface ICreateServingConfigRequest + * @property {string|null} [parent] CreateServingConfigRequest parent + * @property {google.cloud.retail.v2.IServingConfig|null} [servingConfig] CreateServingConfigRequest servingConfig + * @property {string|null} [servingConfigId] CreateServingConfigRequest servingConfigId + */ - /** - * Constructs a new QueryExpansionSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a QueryExpansionSpec. - * @implements IQueryExpansionSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - */ - function QueryExpansionSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Constructs a new CreateServingConfigRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a CreateServingConfigRequest. + * @implements ICreateServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2.ICreateServingConfigRequest=} [properties] Properties to set + */ + function CreateServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * QueryExpansionSpec condition. - * @member {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition} condition - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.condition = 0; + /** + * CreateServingConfigRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.parent = ""; - /** - * QueryExpansionSpec pinUnexpandedResults. - * @member {boolean} pinUnexpandedResults - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @instance - */ - QueryExpansionSpec.prototype.pinUnexpandedResults = false; + /** + * CreateServingConfigRequest servingConfig. + * @member {google.cloud.retail.v2.IServingConfig|null|undefined} servingConfig + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.servingConfig = null; - /** - * Creates a new QueryExpansionSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec instance - */ - QueryExpansionSpec.create = function create(properties) { - return new QueryExpansionSpec(properties); - }; + /** + * CreateServingConfigRequest servingConfigId. + * @member {string} servingConfigId + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @instance + */ + CreateServingConfigRequest.prototype.servingConfigId = ""; - /** - * Encodes the specified QueryExpansionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.condition); - if (message.pinUnexpandedResults != null && Object.hasOwnProperty.call(message, "pinUnexpandedResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.pinUnexpandedResults); - return writer; - }; + /** + * Creates a new CreateServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.ICreateServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.CreateServingConfigRequest} CreateServingConfigRequest instance + */ + CreateServingConfigRequest.create = function create(properties) { + return new CreateServingConfigRequest(properties); + }; - /** - * Encodes the specified QueryExpansionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IQueryExpansionSpec} message QueryExpansionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified CreateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.CreateServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.ICreateServingConfigRequest} message CreateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + $root.google.cloud.retail.v2.ServingConfig.encode(message.servingConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.servingConfigId != null && Object.hasOwnProperty.call(message, "servingConfigId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.servingConfigId); + return writer; + }; - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.condition = reader.int32(); - break; - } - case 2: { - message.pinUnexpandedResults = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Encodes the specified CreateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.CreateServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.ICreateServingConfigRequest} message CreateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.CreateServingConfigRequest} CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.CreateServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); break; } - } - return message; - }; - - /** - * Decodes a QueryExpansionSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryExpansionSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.condition != null && message.hasOwnProperty("condition")) - switch (message.condition) { - default: - return "condition: enum value expected"; - case 0: - case 1: - case 3: + case 2: { + message.servingConfig = $root.google.cloud.retail.v2.ServingConfig.decode(reader, reader.uint32()); break; } - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - if (typeof message.pinUnexpandedResults !== "boolean") - return "pinUnexpandedResults: boolean expected"; - return null; - }; - - /** - * Creates a QueryExpansionSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} QueryExpansionSpec - */ - QueryExpansionSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); - switch (object.condition) { - case "CONDITION_UNSPECIFIED": - case 0: - message.condition = 0; - break; - case "DISABLED": - case 1: - message.condition = 1; - break; - case "AUTO": - case 3: - message.condition = 3; + case 3: { + message.servingConfigId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); break; } - if (object.pinUnexpandedResults != null) - message.pinUnexpandedResults = Boolean(object.pinUnexpandedResults); - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a QueryExpansionSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} message QueryExpansionSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.condition = options.enums === String ? "CONDITION_UNSPECIFIED" : 0; - object.pinUnexpandedResults = false; - } - if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; - if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) - object.pinUnexpandedResults = message.pinUnexpandedResults; + /** + * Decodes a CreateServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.CreateServingConfigRequest} CreateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) { + var error = $root.google.cloud.retail.v2.ServingConfig.verify(message.servingConfig); + if (error) + return "servingConfig." + error; + } + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) + if (!$util.isString(message.servingConfigId)) + return "servingConfigId: string expected"; + return null; + }; + + /** + * Creates a CreateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.CreateServingConfigRequest} CreateServingConfigRequest + */ + CreateServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.CreateServingConfigRequest) return object; - }; + var message = new $root.google.cloud.retail.v2.CreateServingConfigRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.servingConfig != null) { + if (typeof object.servingConfig !== "object") + throw TypeError(".google.cloud.retail.v2.CreateServingConfigRequest.servingConfig: object expected"); + message.servingConfig = $root.google.cloud.retail.v2.ServingConfig.fromObject(object.servingConfig); + } + if (object.servingConfigId != null) + message.servingConfigId = String(object.servingConfigId); + return message; + }; - /** - * Converts this QueryExpansionSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a CreateServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.CreateServingConfigRequest} message CreateServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.servingConfig = null; + object.servingConfigId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = $root.google.cloud.retail.v2.ServingConfig.toObject(message.servingConfig, options); + if (message.servingConfigId != null && message.hasOwnProperty("servingConfigId")) + object.servingConfigId = message.servingConfigId; + return object; + }; - /** - * Gets the default type url for QueryExpansionSpec - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.QueryExpansionSpec - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - QueryExpansionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"; - }; + /** + * Converts this CreateServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @instance + * @returns {Object.} JSON object + */ + CreateServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Condition enum. - * @name google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition - * @enum {number} - * @property {number} CONDITION_UNSPECIFIED=0 CONDITION_UNSPECIFIED value - * @property {number} DISABLED=1 DISABLED value - * @property {number} AUTO=3 AUTO value - */ - QueryExpansionSpec.Condition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONDITION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLED"] = 1; - values[valuesById[3] = "AUTO"] = 3; - return values; - })(); + /** + * Gets the default type url for CreateServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.CreateServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.CreateServingConfigRequest"; + }; + + return CreateServingConfigRequest; + })(); - return QueryExpansionSpec; - })(); + v2.UpdateServingConfigRequest = (function() { - SearchRequest.PersonalizationSpec = (function() { + /** + * Properties of an UpdateServingConfigRequest. + * @memberof google.cloud.retail.v2 + * @interface IUpdateServingConfigRequest + * @property {google.cloud.retail.v2.IServingConfig|null} [servingConfig] UpdateServingConfigRequest servingConfig + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateServingConfigRequest updateMask + */ - /** - * Properties of a PersonalizationSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface IPersonalizationSpec - * @property {google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode|null} [mode] PersonalizationSpec mode - */ + /** + * Constructs a new UpdateServingConfigRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an UpdateServingConfigRequest. + * @implements IUpdateServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2.IUpdateServingConfigRequest=} [properties] Properties to set + */ + function UpdateServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new PersonalizationSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a PersonalizationSpec. - * @implements IPersonalizationSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec=} [properties] Properties to set - */ - function PersonalizationSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * UpdateServingConfigRequest servingConfig. + * @member {google.cloud.retail.v2.IServingConfig|null|undefined} servingConfig + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @instance + */ + UpdateServingConfigRequest.prototype.servingConfig = null; - /** - * PersonalizationSpec mode. - * @member {google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode} mode - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @instance - */ - PersonalizationSpec.prototype.mode = 0; + /** + * UpdateServingConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @instance + */ + UpdateServingConfigRequest.prototype.updateMask = null; - /** - * Creates a new PersonalizationSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec instance - */ - PersonalizationSpec.create = function create(properties) { - return new PersonalizationSpec(properties); - }; + /** + * Creates a new UpdateServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IUpdateServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.UpdateServingConfigRequest} UpdateServingConfigRequest instance + */ + UpdateServingConfigRequest.create = function create(properties) { + return new UpdateServingConfigRequest(properties); + }; - /** - * Encodes the specified PersonalizationSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersonalizationSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; + /** + * Encodes the specified UpdateServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.UpdateServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IUpdateServingConfigRequest} message UpdateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + $root.google.cloud.retail.v2.ServingConfig.encode(message.servingConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified PersonalizationSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.PersonalizationSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec} message PersonalizationSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PersonalizationSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified UpdateServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.UpdateServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IUpdateServingConfigRequest} message UpdateServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a PersonalizationSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersonalizationSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.mode = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.UpdateServingConfigRequest} UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.UpdateServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.servingConfig = $root.google.cloud.retail.v2.ServingConfig.decode(reader, reader.uint32()); break; } - } - return message; - }; - - /** - * Decodes a PersonalizationSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PersonalizationSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PersonalizationSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PersonalizationSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } - return null; - }; - - /** - * Creates a PersonalizationSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} PersonalizationSpec - */ - PersonalizationSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "AUTO": - case 1: - message.mode = 1; - break; - case "DISABLED": - case 2: - message.mode = 2; + default: + reader.skipType(tag & 7); break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a PersonalizationSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} message PersonalizationSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PersonalizationSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; - return object; - }; + /** + * Decodes an UpdateServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.UpdateServingConfigRequest} UpdateServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this PersonalizationSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @instance - * @returns {Object.} JSON object - */ - PersonalizationSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies an UpdateServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) { + var error = $root.google.cloud.retail.v2.ServingConfig.verify(message.servingConfig); + if (error) + return "servingConfig." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; - /** - * Gets the default type url for PersonalizationSpec - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.PersonalizationSpec - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PersonalizationSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"; - }; + /** + * Creates an UpdateServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.UpdateServingConfigRequest} UpdateServingConfigRequest + */ + UpdateServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.UpdateServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2.UpdateServingConfigRequest(); + if (object.servingConfig != null) { + if (typeof object.servingConfig !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateServingConfigRequest.servingConfig: object expected"); + message.servingConfig = $root.google.cloud.retail.v2.ServingConfig.fromObject(object.servingConfig); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2.UpdateServingConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; - /** - * Mode enum. - * @name google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} AUTO=1 AUTO value - * @property {number} DISABLED=2 DISABLED value - */ - PersonalizationSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTO"] = 1; - values[valuesById[2] = "DISABLED"] = 2; - return values; - })(); + /** + * Creates a plain object from an UpdateServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {google.cloud.retail.v2.UpdateServingConfigRequest} message UpdateServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = null; + object.updateMask = null; + } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = $root.google.cloud.retail.v2.ServingConfig.toObject(message.servingConfig, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; - return PersonalizationSpec; - })(); + /** + * Converts this UpdateServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - SearchRequest.SpellCorrectionSpec = (function() { + /** + * Gets the default type url for UpdateServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.UpdateServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.UpdateServingConfigRequest"; + }; - /** - * Properties of a SpellCorrectionSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @interface ISpellCorrectionSpec - * @property {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null} [mode] SpellCorrectionSpec mode - */ + return UpdateServingConfigRequest; + })(); - /** - * Constructs a new SpellCorrectionSpec. - * @memberof google.cloud.retail.v2.SearchRequest - * @classdesc Represents a SpellCorrectionSpec. - * @implements ISpellCorrectionSpec - * @constructor - * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set - */ - function SpellCorrectionSpec(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v2.DeleteServingConfigRequest = (function() { - /** - * SpellCorrectionSpec mode. - * @member {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode} mode - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @instance - */ - SpellCorrectionSpec.prototype.mode = 0; + /** + * Properties of a DeleteServingConfigRequest. + * @memberof google.cloud.retail.v2 + * @interface IDeleteServingConfigRequest + * @property {string|null} [name] DeleteServingConfigRequest name + */ - /** - * Creates a new SpellCorrectionSpec instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec instance - */ - SpellCorrectionSpec.create = function create(properties) { - return new SpellCorrectionSpec(properties); - }; + /** + * Constructs a new DeleteServingConfigRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a DeleteServingConfigRequest. + * @implements IDeleteServingConfigRequest + * @constructor + * @param {google.cloud.retail.v2.IDeleteServingConfigRequest=} [properties] Properties to set + */ + function DeleteServingConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SpellCorrectionSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; + /** + * DeleteServingConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @instance + */ + DeleteServingConfigRequest.prototype.name = ""; - /** - * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SpellCorrectionSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new DeleteServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IDeleteServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.DeleteServingConfigRequest} DeleteServingConfigRequest instance + */ + DeleteServingConfigRequest.create = function create(properties) { + return new DeleteServingConfigRequest(properties); + }; - /** - * Decodes a SpellCorrectionSpec message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SpellCorrectionSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.mode = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified DeleteServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.DeleteServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IDeleteServingConfigRequest} message DeleteServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; - /** - * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SpellCorrectionSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified DeleteServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.DeleteServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IDeleteServingConfigRequest} message DeleteServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a SpellCorrectionSpec message. - * @function verify - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SpellCorrectionSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: + /** + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.DeleteServingConfigRequest} DeleteServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.DeleteServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); break; } - return null; - }; - - /** - * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec - */ - SpellCorrectionSpec.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec) - return object; - var message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); - switch (object.mode) { - case "MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "SUGGESTION_ONLY": - case 1: - message.mode = 1; - break; - case "AUTO": - case 2: - message.mode = 2; + default: + reader.skipType(tag & 7); break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} message SpellCorrectionSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SpellCorrectionSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; - return object; - }; + /** + * Decodes a DeleteServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.DeleteServingConfigRequest} DeleteServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this SpellCorrectionSpec to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @instance - * @returns {Object.} JSON object - */ - SpellCorrectionSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies a DeleteServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; - /** - * Gets the default type url for SpellCorrectionSpec - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SpellCorrectionSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"; - }; + /** + * Creates a DeleteServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.DeleteServingConfigRequest} DeleteServingConfigRequest + */ + DeleteServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.DeleteServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2.DeleteServingConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Mode enum. - * @name google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode - * @enum {number} - * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value - * @property {number} SUGGESTION_ONLY=1 SUGGESTION_ONLY value - * @property {number} AUTO=2 AUTO value - */ - SpellCorrectionSpec.Mode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SUGGESTION_ONLY"] = 1; - values[valuesById[2] = "AUTO"] = 2; - return values; - })(); + /** + * Creates a plain object from a DeleteServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {google.cloud.retail.v2.DeleteServingConfigRequest} message DeleteServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; - return SpellCorrectionSpec; - })(); + /** + * Converts this DeleteServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * SearchMode enum. - * @name google.cloud.retail.v2.SearchRequest.SearchMode - * @enum {number} - * @property {number} SEARCH_MODE_UNSPECIFIED=0 SEARCH_MODE_UNSPECIFIED value - * @property {number} PRODUCT_SEARCH_ONLY=1 PRODUCT_SEARCH_ONLY value - * @property {number} FACETED_SEARCH_ONLY=2 FACETED_SEARCH_ONLY value + * Gets the default type url for DeleteServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.DeleteServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ - SearchRequest.SearchMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SEARCH_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRODUCT_SEARCH_ONLY"] = 1; - values[valuesById[2] = "FACETED_SEARCH_ONLY"] = 2; - return values; - })(); + DeleteServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.DeleteServingConfigRequest"; + }; - return SearchRequest; + return DeleteServingConfigRequest; })(); - v2.SearchResponse = (function() { + v2.GetServingConfigRequest = (function() { /** - * Properties of a SearchResponse. + * Properties of a GetServingConfigRequest. * @memberof google.cloud.retail.v2 - * @interface ISearchResponse - * @property {Array.|null} [results] SearchResponse results - * @property {Array.|null} [facets] SearchResponse facets - * @property {number|null} [totalSize] SearchResponse totalSize - * @property {string|null} [correctedQuery] SearchResponse correctedQuery - * @property {string|null} [attributionToken] SearchResponse attributionToken - * @property {string|null} [nextPageToken] SearchResponse nextPageToken - * @property {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null} [queryExpansionInfo] SearchResponse queryExpansionInfo - * @property {string|null} [redirectUri] SearchResponse redirectUri - * @property {Array.|null} [appliedControls] SearchResponse appliedControls - * @property {Array.|null} [invalidConditionBoostSpecs] SearchResponse invalidConditionBoostSpecs + * @interface IGetServingConfigRequest + * @property {string|null} [name] GetServingConfigRequest name */ /** - * Constructs a new SearchResponse. + * Constructs a new GetServingConfigRequest. * @memberof google.cloud.retail.v2 - * @classdesc Represents a SearchResponse. - * @implements ISearchResponse + * @classdesc Represents a GetServingConfigRequest. + * @implements IGetServingConfigRequest * @constructor - * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set + * @param {google.cloud.retail.v2.IGetServingConfigRequest=} [properties] Properties to set */ - function SearchResponse(properties) { - this.results = []; - this.facets = []; - this.appliedControls = []; - this.invalidConditionBoostSpecs = []; + function GetServingConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24091,213 +35985,308 @@ } /** - * SearchResponse results. - * @member {Array.} results - * @memberof google.cloud.retail.v2.SearchResponse + * GetServingConfigRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2.GetServingConfigRequest * @instance */ - SearchResponse.prototype.results = $util.emptyArray; + GetServingConfigRequest.prototype.name = ""; /** - * SearchResponse facets. - * @member {Array.} facets - * @memberof google.cloud.retail.v2.SearchResponse - * @instance + * Creates a new GetServingConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IGetServingConfigRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.GetServingConfigRequest} GetServingConfigRequest instance */ - SearchResponse.prototype.facets = $util.emptyArray; + GetServingConfigRequest.create = function create(properties) { + return new GetServingConfigRequest(properties); + }; /** - * SearchResponse totalSize. - * @member {number} totalSize - * @memberof google.cloud.retail.v2.SearchResponse - * @instance + * Encodes the specified GetServingConfigRequest message. Does not implicitly {@link google.cloud.retail.v2.GetServingConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IGetServingConfigRequest} message GetServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - SearchResponse.prototype.totalSize = 0; + GetServingConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; /** - * SearchResponse correctedQuery. - * @member {string} correctedQuery - * @memberof google.cloud.retail.v2.SearchResponse - * @instance + * Encodes the specified GetServingConfigRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.GetServingConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2.IGetServingConfigRequest} message GetServingConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - SearchResponse.prototype.correctedQuery = ""; + GetServingConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * SearchResponse attributionToken. - * @member {string} attributionToken - * @memberof google.cloud.retail.v2.SearchResponse - * @instance + * Decodes a GetServingConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.GetServingConfigRequest} GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.prototype.attributionToken = ""; + GetServingConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.GetServingConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * SearchResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.retail.v2.SearchResponse - * @instance + * Decodes a GetServingConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.GetServingConfigRequest} GetServingConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.prototype.nextPageToken = ""; + GetServingConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * SearchResponse queryExpansionInfo. - * @member {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo|null|undefined} queryExpansionInfo - * @memberof google.cloud.retail.v2.SearchResponse + * Verifies a GetServingConfigRequest message. + * @function verify + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetServingConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetServingConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.GetServingConfigRequest} GetServingConfigRequest + */ + GetServingConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.GetServingConfigRequest) + return object; + var message = new $root.google.cloud.retail.v2.GetServingConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetServingConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {google.cloud.retail.v2.GetServingConfigRequest} message GetServingConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetServingConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetServingConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.GetServingConfigRequest * @instance + * @returns {Object.} JSON object */ - SearchResponse.prototype.queryExpansionInfo = null; + GetServingConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * SearchResponse redirectUri. - * @member {string} redirectUri - * @memberof google.cloud.retail.v2.SearchResponse + * Gets the default type url for GetServingConfigRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.GetServingConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetServingConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.GetServingConfigRequest"; + }; + + return GetServingConfigRequest; + })(); + + v2.ListServingConfigsRequest = (function() { + + /** + * Properties of a ListServingConfigsRequest. + * @memberof google.cloud.retail.v2 + * @interface IListServingConfigsRequest + * @property {string|null} [parent] ListServingConfigsRequest parent + * @property {number|null} [pageSize] ListServingConfigsRequest pageSize + * @property {string|null} [pageToken] ListServingConfigsRequest pageToken + */ + + /** + * Constructs a new ListServingConfigsRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListServingConfigsRequest. + * @implements IListServingConfigsRequest + * @constructor + * @param {google.cloud.retail.v2.IListServingConfigsRequest=} [properties] Properties to set + */ + function ListServingConfigsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListServingConfigsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @instance */ - SearchResponse.prototype.redirectUri = ""; + ListServingConfigsRequest.prototype.parent = ""; /** - * SearchResponse appliedControls. - * @member {Array.} appliedControls - * @memberof google.cloud.retail.v2.SearchResponse + * ListServingConfigsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @instance */ - SearchResponse.prototype.appliedControls = $util.emptyArray; + ListServingConfigsRequest.prototype.pageSize = 0; /** - * SearchResponse invalidConditionBoostSpecs. - * @member {Array.} invalidConditionBoostSpecs - * @memberof google.cloud.retail.v2.SearchResponse + * ListServingConfigsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @instance */ - SearchResponse.prototype.invalidConditionBoostSpecs = $util.emptyArray; + ListServingConfigsRequest.prototype.pageToken = ""; /** - * Creates a new SearchResponse instance using the specified properties. + * Creates a new ListServingConfigsRequest instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static - * @param {google.cloud.retail.v2.ISearchResponse=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse instance + * @param {google.cloud.retail.v2.IListServingConfigsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListServingConfigsRequest} ListServingConfigsRequest instance */ - SearchResponse.create = function create(properties) { - return new SearchResponse(properties); + ListServingConfigsRequest.create = function create(properties) { + return new ListServingConfigsRequest(properties); }; /** - * Encodes the specified SearchResponse message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * Encodes the specified ListServingConfigsRequest message. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static - * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListServingConfigsRequest} message ListServingConfigsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encode = function encode(message, writer) { + ListServingConfigsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.retail.v2.SearchResponse.SearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.facets != null && message.facets.length) - for (var i = 0; i < message.facets.length; ++i) - $root.google.cloud.retail.v2.SearchResponse.Facet.encode(message.facets[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); - if (message.correctedQuery != null && Object.hasOwnProperty.call(message, "correctedQuery")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.correctedQuery); - if (message.attributionToken != null && Object.hasOwnProperty.call(message, "attributionToken")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.attributionToken); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.nextPageToken); - if (message.queryExpansionInfo != null && Object.hasOwnProperty.call(message, "queryExpansionInfo")) - $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.encode(message.queryExpansionInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.redirectUri); - if (message.appliedControls != null && message.appliedControls.length) - for (var i = 0; i < message.appliedControls.length; ++i) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.appliedControls[i]); - if (message.invalidConditionBoostSpecs != null && message.invalidConditionBoostSpecs.length) - for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) - $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.encode(message.invalidConditionBoostSpecs[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified SearchResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.verify|verify} messages. + * Encodes the specified ListServingConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static - * @param {google.cloud.retail.v2.ISearchResponse} message SearchResponse message or plain object to encode + * @param {google.cloud.retail.v2.IListServingConfigsRequest} message ListServingConfigsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SearchResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListServingConfigsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SearchResponse message from the specified reader or buffer. + * Decodes a ListServingConfigsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2.ListServingConfigsRequest} ListServingConfigsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decode = function decode(reader, length) { + ListServingConfigsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListServingConfigsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.retail.v2.SearchResponse.SearchResult.decode(reader, reader.uint32())); + message.parent = reader.string(); break; } case 2: { - if (!(message.facets && message.facets.length)) - message.facets = []; - message.facets.push($root.google.cloud.retail.v2.SearchResponse.Facet.decode(reader, reader.uint32())); + message.pageSize = reader.int32(); break; } case 3: { - message.totalSize = reader.int32(); - break; - } - case 4: { - message.correctedQuery = reader.string(); - break; - } - case 5: { - message.attributionToken = reader.string(); - break; - } - case 6: { - message.nextPageToken = reader.string(); - break; - } - case 7: { - message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.decode(reader, reader.uint32()); - break; - } - case 10: { - message.redirectUri = reader.string(); - break; - } - case 12: { - if (!(message.appliedControls && message.appliedControls.length)) - message.appliedControls = []; - message.appliedControls.push(reader.string()); - break; - } - case 14: { - if (!(message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length)) - message.invalidConditionBoostSpecs = []; - message.invalidConditionBoostSpecs.push($root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.decode(reader, reader.uint32())); + message.pageToken = reader.string(); break; } default: @@ -24309,1485 +36298,821 @@ }; /** - * Decodes a SearchResponse message from the specified reader or buffer, length delimited. + * Decodes a ListServingConfigsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2.ListServingConfigsRequest} ListServingConfigsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SearchResponse.decodeDelimited = function decodeDelimited(reader) { + ListServingConfigsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SearchResponse message. + * Verifies a ListServingConfigsRequest message. * @function verify - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SearchResponse.verify = function verify(message) { + ListServingConfigsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchResponse.SearchResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.facets != null && message.hasOwnProperty("facets")) { - if (!Array.isArray(message.facets)) - return "facets: array expected"; - for (var i = 0; i < message.facets.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchResponse.Facet.verify(message.facets[i]); - if (error) - return "facets." + error; - } - } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - if (!$util.isInteger(message.totalSize)) - return "totalSize: integer expected"; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - if (!$util.isString(message.correctedQuery)) - return "correctedQuery: string expected"; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - if (!$util.isString(message.attributionToken)) - return "attributionToken: string expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) { - var error = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify(message.queryExpansionInfo); - if (error) - return "queryExpansionInfo." + error; - } - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - if (!$util.isString(message.redirectUri)) - return "redirectUri: string expected"; - if (message.appliedControls != null && message.hasOwnProperty("appliedControls")) { - if (!Array.isArray(message.appliedControls)) - return "appliedControls: array expected"; - for (var i = 0; i < message.appliedControls.length; ++i) - if (!$util.isString(message.appliedControls[i])) - return "appliedControls: string[] expected"; - } - if (message.invalidConditionBoostSpecs != null && message.hasOwnProperty("invalidConditionBoostSpecs")) { - if (!Array.isArray(message.invalidConditionBoostSpecs)) - return "invalidConditionBoostSpecs: array expected"; - for (var i = 0; i < message.invalidConditionBoostSpecs.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.verify(message.invalidConditionBoostSpecs[i]); - if (error) - return "invalidConditionBoostSpecs." + error; - } - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates a SearchResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListServingConfigsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse} SearchResponse + * @returns {google.cloud.retail.v2.ListServingConfigsRequest} ListServingConfigsRequest */ - SearchResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse) + ListServingConfigsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListServingConfigsRequest) return object; - var message = new $root.google.cloud.retail.v2.SearchResponse(); - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.results: object expected"); - message.results[i] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.fromObject(object.results[i]); - } - } - if (object.facets) { - if (!Array.isArray(object.facets)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: array expected"); - message.facets = []; - for (var i = 0; i < object.facets.length; ++i) { - if (typeof object.facets[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.facets: object expected"); - message.facets[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.fromObject(object.facets[i]); - } - } - if (object.totalSize != null) - message.totalSize = object.totalSize | 0; - if (object.correctedQuery != null) - message.correctedQuery = String(object.correctedQuery); - if (object.attributionToken != null) - message.attributionToken = String(object.attributionToken); - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.queryExpansionInfo != null) { - if (typeof object.queryExpansionInfo !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.queryExpansionInfo: object expected"); - message.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.fromObject(object.queryExpansionInfo); - } - if (object.redirectUri != null) - message.redirectUri = String(object.redirectUri); - if (object.appliedControls) { - if (!Array.isArray(object.appliedControls)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.appliedControls: array expected"); - message.appliedControls = []; - for (var i = 0; i < object.appliedControls.length; ++i) - message.appliedControls[i] = String(object.appliedControls[i]); - } - if (object.invalidConditionBoostSpecs) { - if (!Array.isArray(object.invalidConditionBoostSpecs)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.invalidConditionBoostSpecs: array expected"); - message.invalidConditionBoostSpecs = []; - for (var i = 0; i < object.invalidConditionBoostSpecs.length; ++i) { - if (typeof object.invalidConditionBoostSpecs[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.invalidConditionBoostSpecs: object expected"); - message.invalidConditionBoostSpecs[i] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.fromObject(object.invalidConditionBoostSpecs[i]); - } - } + var message = new $root.google.cloud.retail.v2.ListServingConfigsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from a SearchResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListServingConfigsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static - * @param {google.cloud.retail.v2.SearchResponse} message SearchResponse + * @param {google.cloud.retail.v2.ListServingConfigsRequest} message ListServingConfigsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SearchResponse.toObject = function toObject(message, options) { + ListServingConfigsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.facets = []; - object.appliedControls = []; - object.invalidConditionBoostSpecs = []; - } if (options.defaults) { - object.totalSize = 0; - object.correctedQuery = ""; - object.attributionToken = ""; - object.nextPageToken = ""; - object.queryExpansionInfo = null; - object.redirectUri = ""; - } - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.retail.v2.SearchResponse.SearchResult.toObject(message.results[j], options); - } - if (message.facets && message.facets.length) { - object.facets = []; - for (var j = 0; j < message.facets.length; ++j) - object.facets[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.toObject(message.facets[j], options); - } - if (message.totalSize != null && message.hasOwnProperty("totalSize")) - object.totalSize = message.totalSize; - if (message.correctedQuery != null && message.hasOwnProperty("correctedQuery")) - object.correctedQuery = message.correctedQuery; - if (message.attributionToken != null && message.hasOwnProperty("attributionToken")) - object.attributionToken = message.attributionToken; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.queryExpansionInfo != null && message.hasOwnProperty("queryExpansionInfo")) - object.queryExpansionInfo = $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.toObject(message.queryExpansionInfo, options); - if (message.redirectUri != null && message.hasOwnProperty("redirectUri")) - object.redirectUri = message.redirectUri; - if (message.appliedControls && message.appliedControls.length) { - object.appliedControls = []; - for (var j = 0; j < message.appliedControls.length; ++j) - object.appliedControls[j] = message.appliedControls[j]; - } - if (message.invalidConditionBoostSpecs && message.invalidConditionBoostSpecs.length) { - object.invalidConditionBoostSpecs = []; - for (var j = 0; j < message.invalidConditionBoostSpecs.length; ++j) - object.invalidConditionBoostSpecs[j] = $root.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.toObject(message.invalidConditionBoostSpecs[j], options); + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; return object; }; /** - * Converts this SearchResponse to JSON. + * Converts this ListServingConfigsRequest to JSON. * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @instance * @returns {Object.} JSON object */ - SearchResponse.prototype.toJSON = function toJSON() { + ListServingConfigsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for SearchResponse + * Gets the default type url for ListServingConfigsRequest * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchResponse + * @memberof google.cloud.retail.v2.ListServingConfigsRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - SearchResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListServingConfigsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse"; + return typeUrlPrefix + "/google.cloud.retail.v2.ListServingConfigsRequest"; }; - SearchResponse.SearchResult = (function() { - - /** - * Properties of a SearchResult. - * @memberof google.cloud.retail.v2.SearchResponse - * @interface ISearchResult - * @property {string|null} [id] SearchResult id - * @property {google.cloud.retail.v2.IProduct|null} [product] SearchResult product - * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount - * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields - * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues - */ - - /** - * Constructs a new SearchResult. - * @memberof google.cloud.retail.v2.SearchResponse - * @classdesc Represents a SearchResult. - * @implements ISearchResult - * @constructor - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set - */ - function SearchResult(properties) { - this.matchingVariantFields = {}; - this.variantRollupValues = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SearchResult id. - * @member {string} id - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.id = ""; - - /** - * SearchResult product. - * @member {google.cloud.retail.v2.IProduct|null|undefined} product - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.product = null; - - /** - * SearchResult matchingVariantCount. - * @member {number} matchingVariantCount - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantCount = 0; - - /** - * SearchResult matchingVariantFields. - * @member {Object.} matchingVariantFields - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.matchingVariantFields = $util.emptyObject; - - /** - * SearchResult variantRollupValues. - * @member {Object.} variantRollupValues - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - */ - SearchResult.prototype.variantRollupValues = $util.emptyObject; - - /** - * Creates a new SearchResult instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult instance - */ - SearchResult.create = function create(properties) { - return new SearchResult(properties); - }; - - /** - * Encodes the specified SearchResult message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.retail.v2.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.matchingVariantCount != null && Object.hasOwnProperty.call(message, "matchingVariantCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.matchingVariantCount); - if (message.matchingVariantFields != null && Object.hasOwnProperty.call(message, "matchingVariantFields")) - for (var keys = Object.keys(message.matchingVariantFields), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.FieldMask.encode(message.matchingVariantFields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.variantRollupValues != null && Object.hasOwnProperty.call(message, "variantRollupValues")) - for (var keys = Object.keys(message.variantRollupValues), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - return writer; - }; - - /** - * Encodes the specified SearchResult message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.SearchResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2.SearchResponse.ISearchResult} message SearchResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SearchResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.id = reader.string(); - break; - } - case 2: { - message.product = $root.google.cloud.retail.v2.Product.decode(reader, reader.uint32()); - break; - } - case 3: { - message.matchingVariantCount = reader.int32(); - break; - } - case 4: { - if (message.matchingVariantFields === $util.emptyObject) - message.matchingVariantFields = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.matchingVariantFields[key] = value; - break; - } - case 5: { - if (message.variantRollupValues === $util.emptyObject) - message.variantRollupValues = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.variantRollupValues[key] = value; - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SearchResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SearchResult message. - * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SearchResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.retail.v2.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - if (!$util.isInteger(message.matchingVariantCount)) - return "matchingVariantCount: integer expected"; - if (message.matchingVariantFields != null && message.hasOwnProperty("matchingVariantFields")) { - if (!$util.isObject(message.matchingVariantFields)) - return "matchingVariantFields: object expected"; - var key = Object.keys(message.matchingVariantFields); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.FieldMask.verify(message.matchingVariantFields[key[i]]); - if (error) - return "matchingVariantFields." + error; - } - } - if (message.variantRollupValues != null && message.hasOwnProperty("variantRollupValues")) { - if (!$util.isObject(message.variantRollupValues)) - return "variantRollupValues: object expected"; - var key = Object.keys(message.variantRollupValues); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.variantRollupValues[key[i]]); - if (error) - return "variantRollupValues." + error; - } - } - return null; - }; - - /** - * Creates a SearchResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.SearchResult} SearchResult - */ - SearchResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.SearchResult) - return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.SearchResult(); - if (object.id != null) - message.id = String(object.id); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.product: object expected"); - message.product = $root.google.cloud.retail.v2.Product.fromObject(object.product); - } - if (object.matchingVariantCount != null) - message.matchingVariantCount = object.matchingVariantCount | 0; - if (object.matchingVariantFields) { - if (typeof object.matchingVariantFields !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields = {}; - for (var keys = Object.keys(object.matchingVariantFields), i = 0; i < keys.length; ++i) { - if (typeof object.matchingVariantFields[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.matchingVariantFields: object expected"); - message.matchingVariantFields[keys[i]] = $root.google.protobuf.FieldMask.fromObject(object.matchingVariantFields[keys[i]]); - } - } - if (object.variantRollupValues) { - if (typeof object.variantRollupValues !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues = {}; - for (var keys = Object.keys(object.variantRollupValues), i = 0; i < keys.length; ++i) { - if (typeof object.variantRollupValues[keys[i]] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.SearchResult.variantRollupValues: object expected"); - message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); - } - } - return message; - }; - - /** - * Creates a plain object from a SearchResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {google.cloud.retail.v2.SearchResponse.SearchResult} message SearchResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) { - object.matchingVariantFields = {}; - object.variantRollupValues = {}; - } - if (options.defaults) { - object.id = ""; - object.product = null; - object.matchingVariantCount = 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.retail.v2.Product.toObject(message.product, options); - if (message.matchingVariantCount != null && message.hasOwnProperty("matchingVariantCount")) - object.matchingVariantCount = message.matchingVariantCount; - var keys2; - if (message.matchingVariantFields && (keys2 = Object.keys(message.matchingVariantFields)).length) { - object.matchingVariantFields = {}; - for (var j = 0; j < keys2.length; ++j) - object.matchingVariantFields[keys2[j]] = $root.google.protobuf.FieldMask.toObject(message.matchingVariantFields[keys2[j]], options); - } - if (message.variantRollupValues && (keys2 = Object.keys(message.variantRollupValues)).length) { - object.variantRollupValues = {}; - for (var j = 0; j < keys2.length; ++j) - object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); - } - return object; - }; - - /** - * Converts this SearchResult to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @instance - * @returns {Object.} JSON object - */ - SearchResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SearchResult - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchResponse.SearchResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SearchResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.SearchResult"; - }; - - return SearchResult; - })(); - - SearchResponse.Facet = (function() { - - /** - * Properties of a Facet. - * @memberof google.cloud.retail.v2.SearchResponse - * @interface IFacet - * @property {string|null} [key] Facet key - * @property {Array.|null} [values] Facet values - * @property {boolean|null} [dynamicFacet] Facet dynamicFacet - */ - - /** - * Constructs a new Facet. - * @memberof google.cloud.retail.v2.SearchResponse - * @classdesc Represents a Facet. - * @implements IFacet - * @constructor - * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set - */ - function Facet(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Facet key. - * @member {string} key - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - */ - Facet.prototype.key = ""; - - /** - * Facet values. - * @member {Array.} values - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - */ - Facet.prototype.values = $util.emptyArray; - - /** - * Facet dynamicFacet. - * @member {boolean} dynamicFacet - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - */ - Facet.prototype.dynamicFacet = false; - - /** - * Creates a new Facet instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.IFacet=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet instance - */ - Facet.create = function create(properties) { - return new Facet(properties); - }; + return ListServingConfigsRequest; + })(); - /** - * Encodes the specified Facet message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.encode(message.values[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dynamicFacet != null && Object.hasOwnProperty.call(message, "dynamicFacet")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dynamicFacet); - return writer; - }; + v2.ListServingConfigsResponse = (function() { - /** - * Encodes the specified Facet message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.IFacet} message Facet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Facet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Properties of a ListServingConfigsResponse. + * @memberof google.cloud.retail.v2 + * @interface IListServingConfigsResponse + * @property {Array.|null} [servingConfigs] ListServingConfigsResponse servingConfigs + * @property {string|null} [nextPageToken] ListServingConfigsResponse nextPageToken + */ - /** - * Decodes a Facet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.key = reader.string(); - break; - } - case 2: { - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.decode(reader, reader.uint32())); - break; - } - case 3: { - message.dynamicFacet = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Constructs a new ListServingConfigsResponse. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a ListServingConfigsResponse. + * @implements IListServingConfigsResponse + * @constructor + * @param {google.cloud.retail.v2.IListServingConfigsResponse=} [properties] Properties to set + */ + function ListServingConfigsResponse(properties) { + this.servingConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a Facet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Facet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * ListServingConfigsResponse servingConfigs. + * @member {Array.} servingConfigs + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @instance + */ + ListServingConfigsResponse.prototype.servingConfigs = $util.emptyArray; - /** - * Verifies a Facet message. - * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Facet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify(message.values[i]); - if (error) - return "values." + error; - } - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - if (typeof message.dynamicFacet !== "boolean") - return "dynamicFacet: boolean expected"; - return null; - }; + /** + * ListServingConfigsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @instance + */ + ListServingConfigsResponse.prototype.nextPageToken = ""; - /** - * Creates a Facet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.Facet} Facet - */ - Facet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet) - return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.Facet(); - if (object.key != null) - message.key = String(object.key); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.values: object expected"); - message.values[i] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.fromObject(object.values[i]); - } - } - if (object.dynamicFacet != null) - message.dynamicFacet = Boolean(object.dynamicFacet); - return message; - }; + /** + * Creates a new ListServingConfigsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2.IListServingConfigsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2.ListServingConfigsResponse} ListServingConfigsResponse instance + */ + ListServingConfigsResponse.create = function create(properties) { + return new ListServingConfigsResponse(properties); + }; - /** - * Creates a plain object from a Facet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet} message Facet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Facet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (options.defaults) { - object.key = ""; - object.dynamicFacet = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue.toObject(message.values[j], options); - } - if (message.dynamicFacet != null && message.hasOwnProperty("dynamicFacet")) - object.dynamicFacet = message.dynamicFacet; - return object; - }; + /** + * Encodes the specified ListServingConfigsResponse message. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2.IListServingConfigsResponse} message ListServingConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfigs != null && message.servingConfigs.length) + for (var i = 0; i < message.servingConfigs.length; ++i) + $root.google.cloud.retail.v2.ServingConfig.encode(message.servingConfigs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; - /** - * Converts this Facet to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @instance - * @returns {Object.} JSON object - */ - Facet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified ListServingConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2.ListServingConfigsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2.IListServingConfigsResponse} message ListServingConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServingConfigsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Gets the default type url for Facet - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Facet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.ListServingConfigsResponse} ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.ListServingConfigsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.servingConfigs && message.servingConfigs.length)) + message.servingConfigs = []; + message.servingConfigs.push($root.google.cloud.retail.v2.ServingConfig.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.Facet"; - }; + } + return message; + }; - Facet.FacetValue = (function() { + /** + * Decodes a ListServingConfigsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.ListServingConfigsResponse} ListServingConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServingConfigsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Properties of a FacetValue. - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @interface IFacetValue - * @property {string|null} [value] FacetValue value - * @property {google.cloud.retail.v2.IInterval|null} [interval] FacetValue interval - * @property {number|Long|null} [count] FacetValue count - * @property {number|null} [minValue] FacetValue minValue - * @property {number|null} [maxValue] FacetValue maxValue - */ + /** + * Verifies a ListServingConfigsResponse message. + * @function verify + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServingConfigsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfigs != null && message.hasOwnProperty("servingConfigs")) { + if (!Array.isArray(message.servingConfigs)) + return "servingConfigs: array expected"; + for (var i = 0; i < message.servingConfigs.length; ++i) { + var error = $root.google.cloud.retail.v2.ServingConfig.verify(message.servingConfigs[i]); + if (error) + return "servingConfigs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; - /** - * Constructs a new FacetValue. - * @memberof google.cloud.retail.v2.SearchResponse.Facet - * @classdesc Represents a FacetValue. - * @implements IFacetValue - * @constructor - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - */ - function FacetValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Creates a ListServingConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.ListServingConfigsResponse} ListServingConfigsResponse + */ + ListServingConfigsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.ListServingConfigsResponse) + return object; + var message = new $root.google.cloud.retail.v2.ListServingConfigsResponse(); + if (object.servingConfigs) { + if (!Array.isArray(object.servingConfigs)) + throw TypeError(".google.cloud.retail.v2.ListServingConfigsResponse.servingConfigs: array expected"); + message.servingConfigs = []; + for (var i = 0; i < object.servingConfigs.length; ++i) { + if (typeof object.servingConfigs[i] !== "object") + throw TypeError(".google.cloud.retail.v2.ListServingConfigsResponse.servingConfigs: object expected"); + message.servingConfigs[i] = $root.google.cloud.retail.v2.ServingConfig.fromObject(object.servingConfigs[i]); } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; - /** - * FacetValue value. - * @member {string|null|undefined} value - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.value = null; + /** + * Creates a plain object from a ListServingConfigsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {google.cloud.retail.v2.ListServingConfigsResponse} message ListServingConfigsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServingConfigsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.servingConfigs && message.servingConfigs.length) { + object.servingConfigs = []; + for (var j = 0; j < message.servingConfigs.length; ++j) + object.servingConfigs[j] = $root.google.cloud.retail.v2.ServingConfig.toObject(message.servingConfigs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; - /** - * FacetValue interval. - * @member {google.cloud.retail.v2.IInterval|null|undefined} interval - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.interval = null; + /** + * Converts this ListServingConfigsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @instance + * @returns {Object.} JSON object + */ + ListServingConfigsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * FacetValue count. - * @member {number|Long} count - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * Gets the default type url for ListServingConfigsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2.ListServingConfigsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServingConfigsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.ListServingConfigsResponse"; + }; - /** - * FacetValue minValue. - * @member {number} minValue - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.minValue = 0; + return ListServingConfigsResponse; + })(); - /** - * FacetValue maxValue. - * @member {number} maxValue - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - */ - FacetValue.prototype.maxValue = 0; + v2.AddControlRequest = (function() { - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Properties of an AddControlRequest. + * @memberof google.cloud.retail.v2 + * @interface IAddControlRequest + * @property {string|null} [servingConfig] AddControlRequest servingConfig + * @property {string|null} [controlId] AddControlRequest controlId + */ - /** - * FacetValue facetValue. - * @member {"value"|"interval"|undefined} facetValue - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - */ - Object.defineProperty(FacetValue.prototype, "facetValue", { - get: $util.oneOfGetter($oneOfFields = ["value", "interval"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Constructs a new AddControlRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents an AddControlRequest. + * @implements IAddControlRequest + * @constructor + * @param {google.cloud.retail.v2.IAddControlRequest=} [properties] Properties to set + */ + function AddControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new FacetValue instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue instance - */ - FacetValue.create = function create(properties) { - return new FacetValue(properties); - }; + /** + * AddControlRequest servingConfig. + * @member {string} servingConfig + * @memberof google.cloud.retail.v2.AddControlRequest + * @instance + */ + AddControlRequest.prototype.servingConfig = ""; - /** - * Encodes the specified FacetValue message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) - $root.google.cloud.retail.v2.Interval.encode(message.interval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.count); - if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) - writer.uint32(/* id 5, wireType 1 =*/41).double(message.minValue); - if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) - writer.uint32(/* id 6, wireType 1 =*/49).double(message.maxValue); - return writer; - }; + /** + * AddControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2.AddControlRequest + * @instance + */ + AddControlRequest.prototype.controlId = ""; - /** - * Encodes the specified FacetValue message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.Facet.FacetValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.IFacetValue} message FacetValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FacetValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new AddControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {google.cloud.retail.v2.IAddControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.AddControlRequest} AddControlRequest instance + */ + AddControlRequest.create = function create(properties) { + return new AddControlRequest(properties); + }; - /** - * Decodes a FacetValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - case 2: { - message.interval = $root.google.cloud.retail.v2.Interval.decode(reader, reader.uint32()); - break; - } - case 3: { - message.count = reader.int64(); - break; - } - case 5: { - message.minValue = reader.double(); - break; - } - case 6: { - message.maxValue = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified AddControlRequest message. Does not implicitly {@link google.cloud.retail.v2.AddControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {google.cloud.retail.v2.IAddControlRequest} message AddControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfig); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.controlId); + return writer; + }; - /** - * Decodes a FacetValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FacetValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified AddControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.AddControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {google.cloud.retail.v2.IAddControlRequest} message AddControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AddControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a FacetValue message. - * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FacetValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.value != null && message.hasOwnProperty("value")) { - properties.facetValue = 1; - if (!$util.isString(message.value)) - return "value: string expected"; + /** + * Decodes an AddControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.AddControlRequest} AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.AddControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.servingConfig = reader.string(); + break; } - if (message.interval != null && message.hasOwnProperty("interval")) { - if (properties.facetValue === 1) - return "facetValue: multiple values"; - properties.facetValue = 1; - { - var error = $root.google.cloud.retail.v2.Interval.verify(message.interval); - if (error) - return "interval." + error; - } + case 2: { + message.controlId = reader.string(); + break; } - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - if (message.minValue != null && message.hasOwnProperty("minValue")) - if (typeof message.minValue !== "number") - return "minValue: number expected"; - if (message.maxValue != null && message.hasOwnProperty("maxValue")) - if (typeof message.maxValue !== "number") - return "maxValue: number expected"; - return null; - }; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a FacetValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} FacetValue - */ - FacetValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue) - return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.Facet.FacetValue(); - if (object.value != null) - message.value = String(object.value); - if (object.interval != null) { - if (typeof object.interval !== "object") - throw TypeError(".google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval: object expected"); - message.interval = $root.google.cloud.retail.v2.Interval.fromObject(object.interval); - } - if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = false; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); - if (object.minValue != null) - message.minValue = Number(object.minValue); - if (object.maxValue != null) - message.maxValue = Number(object.maxValue); - return message; - }; + /** + * Decodes an AddControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.AddControlRequest} AddControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AddControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a FacetValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {google.cloud.retail.v2.SearchResponse.Facet.FacetValue} message FacetValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FacetValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - object.minValue = 0; - object.maxValue = 0; - } - if (message.value != null && message.hasOwnProperty("value")) { - object.value = message.value; - if (options.oneofs) - object.facetValue = "value"; - } - if (message.interval != null && message.hasOwnProperty("interval")) { - object.interval = $root.google.cloud.retail.v2.Interval.toObject(message.interval, options); - if (options.oneofs) - object.facetValue = "interval"; - } - if (message.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; - if (message.minValue != null && message.hasOwnProperty("minValue")) - object.minValue = options.json && !isFinite(message.minValue) ? String(message.minValue) : message.minValue; - if (message.maxValue != null && message.hasOwnProperty("maxValue")) - object.maxValue = options.json && !isFinite(message.maxValue) ? String(message.maxValue) : message.maxValue; - return object; - }; + /** + * Verifies an AddControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AddControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + if (!$util.isString(message.servingConfig)) + return "servingConfig: string expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; - /** - * Converts this FacetValue to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @instance - * @returns {Object.} JSON object - */ - FacetValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates an AddControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.AddControlRequest} AddControlRequest + */ + AddControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.AddControlRequest) + return object; + var message = new $root.google.cloud.retail.v2.AddControlRequest(); + if (object.servingConfig != null) + message.servingConfig = String(object.servingConfig); + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; - /** - * Gets the default type url for FacetValue - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchResponse.Facet.FacetValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FacetValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"; - }; + /** + * Creates a plain object from an AddControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {google.cloud.retail.v2.AddControlRequest} message AddControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AddControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = ""; + object.controlId = ""; + } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = message.servingConfig; + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; - return FacetValue; - })(); + /** + * Converts this AddControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.AddControlRequest + * @instance + * @returns {Object.} JSON object + */ + AddControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Facet; - })(); + /** + * Gets the default type url for AddControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.AddControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AddControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.AddControlRequest"; + }; - SearchResponse.QueryExpansionInfo = (function() { + return AddControlRequest; + })(); - /** - * Properties of a QueryExpansionInfo. - * @memberof google.cloud.retail.v2.SearchResponse - * @interface IQueryExpansionInfo - * @property {boolean|null} [expandedQuery] QueryExpansionInfo expandedQuery - * @property {number|Long|null} [pinnedResultCount] QueryExpansionInfo pinnedResultCount - */ + v2.RemoveControlRequest = (function() { - /** - * Constructs a new QueryExpansionInfo. - * @memberof google.cloud.retail.v2.SearchResponse - * @classdesc Represents a QueryExpansionInfo. - * @implements IQueryExpansionInfo - * @constructor - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - */ - function QueryExpansionInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a RemoveControlRequest. + * @memberof google.cloud.retail.v2 + * @interface IRemoveControlRequest + * @property {string|null} [servingConfig] RemoveControlRequest servingConfig + * @property {string|null} [controlId] RemoveControlRequest controlId + */ - /** - * QueryExpansionInfo expandedQuery. - * @member {boolean} expandedQuery - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.expandedQuery = false; + /** + * Constructs a new RemoveControlRequest. + * @memberof google.cloud.retail.v2 + * @classdesc Represents a RemoveControlRequest. + * @implements IRemoveControlRequest + * @constructor + * @param {google.cloud.retail.v2.IRemoveControlRequest=} [properties] Properties to set + */ + function RemoveControlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * QueryExpansionInfo pinnedResultCount. - * @member {number|Long} pinnedResultCount - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @instance - */ - QueryExpansionInfo.prototype.pinnedResultCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + /** + * RemoveControlRequest servingConfig. + * @member {string} servingConfig + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @instance + */ + RemoveControlRequest.prototype.servingConfig = ""; - /** - * Creates a new QueryExpansionInfo instance using the specified properties. - * @function create - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo=} [properties] Properties to set - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo instance - */ - QueryExpansionInfo.create = function create(properties) { - return new QueryExpansionInfo(properties); - }; + /** + * RemoveControlRequest controlId. + * @member {string} controlId + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @instance + */ + RemoveControlRequest.prototype.controlId = ""; - /** - * Encodes the specified QueryExpansionInfo message. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.expandedQuery != null && Object.hasOwnProperty.call(message, "expandedQuery")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.expandedQuery); - if (message.pinnedResultCount != null && Object.hasOwnProperty.call(message, "pinnedResultCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pinnedResultCount); - return writer; - }; + /** + * Creates a new RemoveControlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2.IRemoveControlRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2.RemoveControlRequest} RemoveControlRequest instance + */ + RemoveControlRequest.create = function create(properties) { + return new RemoveControlRequest(properties); + }; - /** - * Encodes the specified QueryExpansionInfo message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchResponse.QueryExpansionInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2.SearchResponse.IQueryExpansionInfo} message QueryExpansionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryExpansionInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified RemoveControlRequest message. Does not implicitly {@link google.cloud.retail.v2.RemoveControlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2.IRemoveControlRequest} message RemoveControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveControlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfig != null && Object.hasOwnProperty.call(message, "servingConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfig); + if (message.controlId != null && Object.hasOwnProperty.call(message, "controlId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.controlId); + return writer; + }; - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.expandedQuery = reader.bool(); - break; - } - case 2: { - message.pinnedResultCount = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Encodes the specified RemoveControlRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2.RemoveControlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2.IRemoveControlRequest} message RemoveControlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveControlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.RemoveControlRequest} RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveControlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.RemoveControlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.servingConfig = reader.string(); + break; + } + case 2: { + message.controlId = reader.string(); break; } + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a QueryExpansionInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryExpansionInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + } + return message; + }; - /** - * Verifies a QueryExpansionInfo message. - * @function verify - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryExpansionInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - if (typeof message.expandedQuery !== "boolean") - return "expandedQuery: boolean expected"; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (!$util.isInteger(message.pinnedResultCount) && !(message.pinnedResultCount && $util.isInteger(message.pinnedResultCount.low) && $util.isInteger(message.pinnedResultCount.high))) - return "pinnedResultCount: integer|Long expected"; - return null; - }; + /** + * Decodes a RemoveControlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.RemoveControlRequest} RemoveControlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveControlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a QueryExpansionInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} QueryExpansionInfo - */ - QueryExpansionInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo) - return object; - var message = new $root.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo(); - if (object.expandedQuery != null) - message.expandedQuery = Boolean(object.expandedQuery); - if (object.pinnedResultCount != null) - if ($util.Long) - (message.pinnedResultCount = $util.Long.fromValue(object.pinnedResultCount)).unsigned = false; - else if (typeof object.pinnedResultCount === "string") - message.pinnedResultCount = parseInt(object.pinnedResultCount, 10); - else if (typeof object.pinnedResultCount === "number") - message.pinnedResultCount = object.pinnedResultCount; - else if (typeof object.pinnedResultCount === "object") - message.pinnedResultCount = new $util.LongBits(object.pinnedResultCount.low >>> 0, object.pinnedResultCount.high >>> 0).toNumber(); - return message; - }; + /** + * Verifies a RemoveControlRequest message. + * @function verify + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveControlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + if (!$util.isString(message.servingConfig)) + return "servingConfig: string expected"; + if (message.controlId != null && message.hasOwnProperty("controlId")) + if (!$util.isString(message.controlId)) + return "controlId: string expected"; + return null; + }; - /** - * Creates a plain object from a QueryExpansionInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {google.cloud.retail.v2.SearchResponse.QueryExpansionInfo} message QueryExpansionInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryExpansionInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.expandedQuery = false; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pinnedResultCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pinnedResultCount = options.longs === String ? "0" : 0; - } - if (message.expandedQuery != null && message.hasOwnProperty("expandedQuery")) - object.expandedQuery = message.expandedQuery; - if (message.pinnedResultCount != null && message.hasOwnProperty("pinnedResultCount")) - if (typeof message.pinnedResultCount === "number") - object.pinnedResultCount = options.longs === String ? String(message.pinnedResultCount) : message.pinnedResultCount; - else - object.pinnedResultCount = options.longs === String ? $util.Long.prototype.toString.call(message.pinnedResultCount) : options.longs === Number ? new $util.LongBits(message.pinnedResultCount.low >>> 0, message.pinnedResultCount.high >>> 0).toNumber() : message.pinnedResultCount; + /** + * Creates a RemoveControlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.RemoveControlRequest} RemoveControlRequest + */ + RemoveControlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.RemoveControlRequest) return object; - }; + var message = new $root.google.cloud.retail.v2.RemoveControlRequest(); + if (object.servingConfig != null) + message.servingConfig = String(object.servingConfig); + if (object.controlId != null) + message.controlId = String(object.controlId); + return message; + }; - /** - * Converts this QueryExpansionInfo to JSON. - * @function toJSON - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @instance - * @returns {Object.} JSON object - */ - QueryExpansionInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a RemoveControlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {google.cloud.retail.v2.RemoveControlRequest} message RemoveControlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveControlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.servingConfig = ""; + object.controlId = ""; + } + if (message.servingConfig != null && message.hasOwnProperty("servingConfig")) + object.servingConfig = message.servingConfig; + if (message.controlId != null && message.hasOwnProperty("controlId")) + object.controlId = message.controlId; + return object; + }; - /** - * Gets the default type url for QueryExpansionInfo - * @function getTypeUrl - * @memberof google.cloud.retail.v2.SearchResponse.QueryExpansionInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - QueryExpansionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"; - }; + /** + * Converts this RemoveControlRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @instance + * @returns {Object.} JSON object + */ + RemoveControlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return QueryExpansionInfo; - })(); + /** + * Gets the default type url for RemoveControlRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2.RemoveControlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RemoveControlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2.RemoveControlRequest"; + }; - return SearchResponse; + return RemoveControlRequest; })(); v2.UserEventService = (function() { @@ -124787,23 +136112,25 @@ return GeneratedCodeInfo; })(); - protobuf.Empty = (function() { + protobuf.Timestamp = (function() { /** - * Properties of an Empty. + * Properties of a Timestamp. * @memberof google.protobuf - * @interface IEmpty + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos */ /** - * Constructs a new Empty. + * Constructs a new Timestamp. * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty + * @classdesc Represents a Timestamp. + * @implements ITimestamp * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @param {google.protobuf.ITimestamp=} [properties] Properties to set */ - function Empty(properties) { + function Timestamp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -124811,255 +136138,89 @@ } /** - * Creates a new Empty instance using the specified properties. - * @function create - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance - */ - Empty.create = function create(properties) { - return new Empty(properties); - }; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Empty message. - * @function verify - * @memberof google.protobuf.Empty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Empty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Empty - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty - */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) - return object; - return new $root.google.protobuf.Empty(); - }; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.Empty} message Empty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Empty.toObject = function toObject() { - return {}; - }; - - /** - * Converts this Empty to JSON. - * @function toJSON - * @memberof google.protobuf.Empty + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp * @instance - * @returns {Object.} JSON object - */ - Empty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Empty - * @function getTypeUrl - * @memberof google.protobuf.Empty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url */ - Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Empty"; - }; - - return Empty; - })(); - - protobuf.FieldMask = (function() { - - /** - * Properties of a FieldMask. - * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths - */ - - /** - * Constructs a new FieldMask. - * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask - * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - */ - function FieldMask(properties) { - this.paths = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp * @instance */ - FieldMask.prototype.paths = $util.emptyArray; + Timestamp.prototype.nanos = 0; /** - * Creates a new FieldMask instance using the specified properties. + * Creates a new Timestamp instance using the specified properties. * @function create - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); + Timestamp.create = function create(properties) { + return new Timestamp(properties); }; /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encode = function encode(message, writer) { + Timestamp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (var i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldMask message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldMask.decode = function decode(reader, length) { + Timestamp.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); break; } default: @@ -125071,135 +136232,146 @@ }; /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * Decodes a Timestamp message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { + Timestamp.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldMask message. + * Verifies a Timestamp message. * @function verify - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldMask.verify = function verify(message) { + Timestamp.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (var i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; return null; }; /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask + * @returns {google.protobuf.Timestamp} Timestamp */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) return object; - var message = new $root.google.protobuf.FieldMask(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".google.protobuf.FieldMask.paths: array expected"); - message.paths = []; - for (var i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; return message; }; /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.FieldMask} message FieldMask + * @param {google.protobuf.Timestamp} message Timestamp * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldMask.toObject = function toObject(message, options) { + Timestamp.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (var j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; return object; }; /** - * Converts this FieldMask to JSON. + * Converts this Timestamp to JSON. * @function toJSON - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @instance * @returns {Object.} JSON object */ - FieldMask.prototype.toJSON = function toJSON() { + Timestamp.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FieldMask + * Gets the default type url for Timestamp * @function getTypeUrl - * @memberof google.protobuf.FieldMask + * @memberof google.protobuf.Timestamp * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldMask"; + return typeUrlPrefix + "/google.protobuf.Timestamp"; }; - return FieldMask; + return Timestamp; })(); - protobuf.Timestamp = (function() { + protobuf.Duration = (function() { /** - * Properties of a Timestamp. + * Properties of a Duration. * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos */ /** - * Constructs a new Timestamp. + * Constructs a new Duration. * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp + * @classdesc Represents a Duration. + * @implements IDuration * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @param {google.protobuf.IDuration=} [properties] Properties to set */ - function Timestamp(properties) { + function Duration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -125207,43 +136379,43 @@ } /** - * Timestamp seconds. + * Duration seconds. * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @instance */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Timestamp nanos. + * Duration nanos. * @member {number} nanos - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @instance */ - Timestamp.prototype.nanos = 0; + Duration.prototype.nanos = 0; /** - * Creates a new Timestamp instance using the specified properties. + * Creates a new Duration instance using the specified properties. * @function create - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); + Duration.create = function create(properties) { + return new Duration(properties); }; /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encode - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.protobuf.IDuration} message Duration message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encode = function encode(message, writer) { + Duration.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) @@ -125254,33 +136426,33 @@ }; /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.protobuf.IDuration} message Duration message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + Duration.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a Duration message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.protobuf.Duration} Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decode = function decode(reader, length) { + Duration.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -125301,30 +136473,30 @@ }; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a Duration message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.protobuf.Duration} Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { + Duration.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Timestamp message. + * Verifies a Duration message. * @function verify - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Timestamp.verify = function verify(message) { + Duration.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.seconds != null && message.hasOwnProperty("seconds")) @@ -125337,17 +136509,17 @@ }; /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * Creates a Duration message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.protobuf.Duration} Duration */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) return object; - var message = new $root.google.protobuf.Timestamp(); + var message = new $root.google.protobuf.Duration(); if (object.seconds != null) if ($util.Long) (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; @@ -125363,15 +136535,15 @@ }; /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * Creates a plain object from a Duration message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.Timestamp} message Timestamp + * @param {google.protobuf.Duration} message Duration * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Timestamp.toObject = function toObject(message, options) { + Duration.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -125394,53 +136566,53 @@ }; /** - * Converts this Timestamp to JSON. + * Converts this Duration to JSON. * @function toJSON - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @instance * @returns {Object.} JSON object */ - Timestamp.prototype.toJSON = function toJSON() { + Duration.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Timestamp + * Gets the default type url for Duration * @function getTypeUrl - * @memberof google.protobuf.Timestamp + * @memberof google.protobuf.Duration * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.Timestamp"; + return typeUrlPrefix + "/google.protobuf.Duration"; }; - return Timestamp; + return Duration; })(); - protobuf.Duration = (function() { + protobuf.FieldMask = (function() { /** - * Properties of a Duration. + * Properties of a FieldMask. * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths */ /** - * Constructs a new Duration. + * Constructs a new FieldMask. * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration + * @classdesc Represents a FieldMask. + * @implements IFieldMask * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set + * @param {google.protobuf.IFieldMask=} [properties] Properties to set */ - function Duration(properties) { + function FieldMask(properties) { + this.paths = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -125448,89 +136620,78 @@ } /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask * @instance */ - Duration.prototype.nanos = 0; + FieldMask.prototype.paths = $util.emptyArray; /** - * Creates a new Duration instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @function create - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance */ - Duration.create = function create(properties) { - return new Duration(properties); + FieldMask.create = function create(properties) { + return new FieldMask(properties); }; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. * @function encode - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encode = function encode(message, writer) { + FieldMask.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); return writer; }; /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes a FieldMask message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.FieldMask} FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decode = function decode(reader, length) { + FieldMask.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.seconds = reader.int64(); - break; - } - case 2: { - message.nanos = reader.int32(); + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); break; } default: @@ -125542,125 +136703,114 @@ }; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes a FieldMask message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.FieldMask} FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decodeDelimited = function decodeDelimited(reader) { + FieldMask.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Duration message. + * Verifies a FieldMask message. * @function verify - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Duration.verify = function verify(message) { + FieldMask.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } return null; }; /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration + * @returns {google.protobuf.FieldMask} FieldMask */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) return object; - var message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } return message; }; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.Duration} message Duration + * @param {google.protobuf.FieldMask} message FieldMask * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + FieldMask.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; return object; }; /** - * Converts this Duration to JSON. + * Converts this FieldMask to JSON. * @function toJSON - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @instance * @returns {Object.} JSON object */ - Duration.prototype.toJSON = function toJSON() { + FieldMask.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Duration + * Gets the default type url for FieldMask * @function getTypeUrl - * @memberof google.protobuf.Duration + * @memberof google.protobuf.FieldMask * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.Duration"; + return typeUrlPrefix + "/google.protobuf.FieldMask"; }; - return Duration; + return FieldMask; })(); protobuf.DoubleValue = (function() { @@ -127763,6 +138913,181 @@ return Any; })(); + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + protobuf.Struct = (function() { /** diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 1e557e9079b..6e41657c3a0 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -32,593 +32,666 @@ } } }, - "Catalog": { - "options": { - "(google.api.resource).type": "retail.googleapis.com/Catalog", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" - }, + "CatalogAttribute": { "fields": { - "name": { + "key": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "REQUIRED" } }, - "displayName": { - "type": "string", - "id": 2, + "inUse": { + "type": "bool", + "id": 9, "options": { - "(google.api.field_behavior)": "IMMUTABLE" + "(google.api.field_behavior)": "OUTPUT_ONLY" } }, - "productLevelConfig": { - "type": "ProductLevelConfig", - "id": 4, + "type": { + "type": "AttributeType", + "id": 10, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "indexableOption": { + "type": "IndexableOption", + "id": 5 + }, + "dynamicFacetableOption": { + "type": "DynamicFacetableOption", + "id": 6 + }, + "searchableOption": { + "type": "SearchableOption", + "id": 7 } - } - }, - "CatalogService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, - "methods": { - "ListCatalogs": { - "requestType": "ListCatalogsRequest", - "responseType": "ListCatalogsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=projects/*/locations/*}/catalogs" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] + "nested": { + "AttributeType": { + "values": { + "UNKNOWN": 0, + "TEXTUAL": 1, + "NUMERICAL": 2 + } }, - "UpdateCatalog": { - "requestType": "UpdateCatalogRequest", - "responseType": "Catalog", - "options": { - "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", - "(google.api.http).body": "catalog", - "(google.api.method_signature)": "catalog,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", - "body": "catalog" - } - }, - { - "(google.api.method_signature)": "catalog,update_mask" - } - ] + "IndexableOption": { + "values": { + "INDEXABLE_OPTION_UNSPECIFIED": 0, + "INDEXABLE_ENABLED": 1, + "INDEXABLE_DISABLED": 2 + } }, - "SetDefaultBranch": { - "requestType": "SetDefaultBranchRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", - "(google.api.http).body": "*", - "(google.api.method_signature)": "catalog" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", - "body": "*" - } - }, - { - "(google.api.method_signature)": "catalog" - } - ] + "DynamicFacetableOption": { + "values": { + "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": 0, + "DYNAMIC_FACETABLE_ENABLED": 1, + "DYNAMIC_FACETABLE_DISABLED": 2 + } }, - "GetDefaultBranch": { - "requestType": "GetDefaultBranchRequest", - "responseType": "GetDefaultBranchResponse", - "options": { - "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", - "(google.api.method_signature)": "catalog" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" - } - }, - { - "(google.api.method_signature)": "catalog" - } - ] + "SearchableOption": { + "values": { + "SEARCHABLE_OPTION_UNSPECIFIED": 0, + "SEARCHABLE_ENABLED": 1, + "SEARCHABLE_DISABLED": 2 + } } } }, - "ListCatalogsRequest": { + "AttributesConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/AttributesConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" + }, "fields": { - "parent": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "pageSize": { - "type": "int32", + "catalogAttributes": { + "keyType": "string", + "type": "CatalogAttribute", "id": 2 }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListCatalogsResponse": { - "fields": { - "catalogs": { - "rule": "repeated", - "type": "Catalog", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "UpdateCatalogRequest": { - "fields": { - "catalog": { - "type": "Catalog", - "id": 1, + "attributeConfigLevel": { + "type": "AttributeConfigLevel", + "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OUTPUT_ONLY" } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 } } }, - "SetDefaultBranchRequest": { + "CompletionConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/CompletionConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" + }, "fields": { - "catalog": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "branchId": { + "matchingOrder": { "type": "string", - "id": 2, - "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" - } + "id": 2 }, - "note": { - "type": "string", + "maxSuggestions": { + "type": "int32", "id": 3 }, - "force": { - "type": "bool", + "minPrefixLength": { + "type": "int32", "id": 4 - } - } - }, - "GetDefaultBranchRequest": { - "fields": { - "catalog": { - "type": "string", - "id": 1, + }, + "autoLearning": { + "type": "bool", + "id": 11 + }, + "suggestionsInputConfig": { + "type": "CompletionDataInputConfig", + "id": 5, "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + "(google.api.field_behavior)": "OUTPUT_ONLY" } - } - } - }, - "GetDefaultBranchResponse": { - "fields": { - "branch": { + }, + "lastSuggestionsImportOperation": { "type": "string", - "id": 1, + "id": 6, "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.field_behavior)": "OUTPUT_ONLY" } }, - "setTime": { - "type": "google.protobuf.Timestamp", - "id": 2 + "denylistInputConfig": { + "type": "CompletionDataInputConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "note": { - "type": "string", - "id": 3 - } - } - }, - "Audience": { - "fields": { - "genders": { - "rule": "repeated", + "lastDenylistImportOperation": { "type": "string", - "id": 1 + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "ageGroups": { - "rule": "repeated", - "type": "string", - "id": 2 - } - } - }, - "ColorInfo": { - "fields": { - "colorFamilies": { - "rule": "repeated", - "type": "string", - "id": 1 + "allowlistInputConfig": { + "type": "CompletionDataInputConfig", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "colors": { - "rule": "repeated", + "lastAllowlistImportOperation": { "type": "string", - "id": 2 + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, - "CustomAttribute": { - "oneofs": { - "_searchable": { - "oneof": [ - "searchable" - ] - }, - "_indexable": { - "oneof": [ - "indexable" - ] - } + "Catalog": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Catalog", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}" }, "fields": { - "text": { - "rule": "repeated", + "name": { "type": "string", - "id": 1 - }, - "numbers": { - "rule": "repeated", - "type": "double", - "id": 2 + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } }, - "searchable": { - "type": "bool", - "id": 3, + "displayName": { + "type": "string", + "id": 2, "options": { - "deprecated": true, - "proto3_optional": true + "(google.api.field_behavior)": "IMMUTABLE" } }, - "indexable": { - "type": "bool", + "productLevelConfig": { + "type": "ProductLevelConfig", "id": 4, "options": { - "deprecated": true, - "proto3_optional": true + "(google.api.field_behavior)": "REQUIRED" } } } }, - "FulfillmentInfo": { + "AttributeConfigLevel": { + "values": { + "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": 0, + "PRODUCT_LEVEL_ATTRIBUTE_CONFIG": 1, + "CATALOG_LEVEL_ATTRIBUTE_CONFIG": 2 + } + }, + "SolutionType": { + "values": { + "SOLUTION_TYPE_UNSPECIFIED": 0, + "SOLUTION_TYPE_RECOMMENDATION": 1, + "SOLUTION_TYPE_SEARCH": 2 + } + }, + "SearchSolutionUseCase": { + "values": { + "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": 0, + "SEARCH_SOLUTION_USE_CASE_SEARCH": 1, + "SEARCH_SOLUTION_USE_CASE_BROWSE": 2 + } + }, + "Condition": { "fields": { - "type": { - "type": "string", + "queryTerms": { + "rule": "repeated", + "type": "QueryTerm", "id": 1 }, - "placeIds": { + "activeTimeRange": { "rule": "repeated", - "type": "string", - "id": 2 + "type": "TimeRange", + "id": 3 } - } - }, - "Image": { - "fields": { - "uri": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" + }, + "nested": { + "QueryTerm": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "fullMatch": { + "type": "bool", + "id": 2 + } } }, - "height": { - "type": "int32", - "id": 2 - }, - "width": { - "type": "int32", - "id": 3 + "TimeRange": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } } } }, - "Interval": { + "Rule": { "oneofs": { - "min": { - "oneof": [ - "minimum", - "exclusiveMinimum" - ] - }, - "max": { + "action": { "oneof": [ - "maximum", - "exclusiveMaximum" + "boostAction", + "redirectAction", + "onewaySynonymsAction", + "doNotAssociateAction", + "replacementAction", + "ignoreAction", + "filterAction", + "twowaySynonymsAction" ] } }, "fields": { - "minimum": { - "type": "double", - "id": 1 - }, - "exclusiveMinimum": { - "type": "double", + "boostAction": { + "type": "BoostAction", "id": 2 }, - "maximum": { - "type": "double", + "redirectAction": { + "type": "RedirectAction", "id": 3 }, - "exclusiveMaximum": { - "type": "double", - "id": 4 - } - } - }, - "PriceInfo": { - "fields": { - "currencyCode": { - "type": "string", - "id": 1 + "onewaySynonymsAction": { + "type": "OnewaySynonymsAction", + "id": 6 }, - "price": { - "type": "float", - "id": 2 + "doNotAssociateAction": { + "type": "DoNotAssociateAction", + "id": 7 }, - "originalPrice": { - "type": "float", - "id": 3 + "replacementAction": { + "type": "ReplacementAction", + "id": 8 }, - "cost": { - "type": "float", - "id": 4 + "ignoreAction": { + "type": "IgnoreAction", + "id": 9 }, - "priceEffectiveTime": { - "type": "google.protobuf.Timestamp", - "id": 5 + "filterAction": { + "type": "FilterAction", + "id": 10 }, - "priceExpireTime": { - "type": "google.protobuf.Timestamp", - "id": 6 + "twowaySynonymsAction": { + "type": "TwowaySynonymsAction", + "id": 11 }, - "priceRange": { - "type": "PriceRange", - "id": 7, + "condition": { + "type": "Condition", + "id": 1, "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" + "(google.api.field_behavior)": "REQUIRED" } } }, "nested": { - "PriceRange": { + "BoostAction": { "fields": { - "price": { - "type": "Interval", + "boost": { + "type": "float", "id": 1 }, - "originalPrice": { - "type": "Interval", + "productsFilter": { + "type": "string", "id": 2 } } - } - } + }, + "FilterAction": { + "fields": { + "filter": { + "type": "string", + "id": 1 + } + } + }, + "RedirectAction": { + "fields": { + "redirectUri": { + "type": "string", + "id": 1 + } + } + }, + "TwowaySynonymsAction": { + "fields": { + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "OnewaySynonymsAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "onewayTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "DoNotAssociateAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "doNotAssociateTerms": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "terms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "ReplacementAction": { + "fields": { + "queryTerms": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "replacementTerm": { + "type": "string", + "id": 3 + }, + "term": { + "type": "string", + "id": 1 + } + } + }, + "IgnoreAction": { + "fields": { + "ignoreTerms": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } }, - "Rating": { + "Audience": { "fields": { - "ratingCount": { - "type": "int32", + "genders": { + "rule": "repeated", + "type": "string", "id": 1 }, - "averageRating": { - "type": "float", - "id": 2 - }, - "ratingHistogram": { + "ageGroups": { "rule": "repeated", - "type": "int32", - "id": 3 + "type": "string", + "id": 2 } } }, - "UserInfo": { + "ColorInfo": { "fields": { - "userId": { + "colorFamilies": { + "rule": "repeated", "type": "string", "id": 1 }, - "ipAddress": { + "colors": { + "rule": "repeated", "type": "string", "id": 2 - }, - "userAgent": { - "type": "string", - "id": 3 - }, - "directUserRequest": { - "type": "bool", - "id": 4 } } }, - "LocalInventory": { + "CustomAttribute": { + "oneofs": { + "_searchable": { + "oneof": [ + "searchable" + ] + }, + "_indexable": { + "oneof": [ + "indexable" + ] + } + }, "fields": { - "placeId": { + "text": { + "rule": "repeated", "type": "string", "id": 1 }, - "priceInfo": { - "type": "PriceInfo", + "numbers": { + "rule": "repeated", + "type": "double", "id": 2 }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", - "id": 3 + "searchable": { + "type": "bool", + "id": 3, + "options": { + "deprecated": true, + "proto3_optional": true + } }, - "fulfillmentTypes": { - "rule": "repeated", - "type": "string", + "indexable": { + "type": "bool", "id": 4, "options": { - "(google.api.field_behavior)": "INPUT_ONLY" + "deprecated": true, + "proto3_optional": true } } } }, - "CompletionService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "CompleteQuery": { - "requestType": "CompleteQueryRequest", - "responseType": "CompleteQueryResponse", - "options": { - "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" - } - } - ] + "FulfillmentInfo": { + "fields": { + "type": { + "type": "string", + "id": 1 }, - "ImportCompletionData": { - "requestType": "ImportCompletionDataRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", - "body": "*" - } - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", - "metadata_type": "google.cloud.retail.v2.ImportMetadata" - } - } - ] + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2 } } }, - "CompleteQueryRequest": { + "Image": { "fields": { - "catalog": { + "uri": { "type": "string", "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" - } - }, - "query": { - "type": "string", - "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "visitorId": { - "type": "string", - "id": 7 - }, - "languageCodes": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "deviceType": { - "type": "string", - "id": 4 - }, - "dataset": { - "type": "string", - "id": 6 + "height": { + "type": "int32", + "id": 2 }, - "maxSuggestions": { + "width": { "type": "int32", - "id": 5 + "id": 3 } } }, - "CompleteQueryResponse": { - "fields": { - "completionResults": { - "rule": "repeated", - "type": "CompletionResult", + "Interval": { + "oneofs": { + "min": { + "oneof": [ + "minimum", + "exclusiveMinimum" + ] + }, + "max": { + "oneof": [ + "maximum", + "exclusiveMaximum" + ] + } + }, + "fields": { + "minimum": { + "type": "double", "id": 1 }, - "attributionToken": { + "exclusiveMinimum": { + "type": "double", + "id": 2 + }, + "maximum": { + "type": "double", + "id": 3 + }, + "exclusiveMaximum": { + "type": "double", + "id": 4 + } + } + }, + "PriceInfo": { + "fields": { + "currencyCode": { "type": "string", + "id": 1 + }, + "price": { + "type": "float", "id": 2 }, - "recentSearchResults": { - "rule": "repeated", - "type": "RecentSearchResult", + "originalPrice": { + "type": "float", "id": 3 + }, + "cost": { + "type": "float", + "id": 4 + }, + "priceEffectiveTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "priceExpireTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "priceRange": { + "type": "PriceRange", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { - "CompletionResult": { + "PriceRange": { "fields": { - "suggestion": { - "type": "string", + "price": { + "type": "Interval", "id": 1 }, - "attributes": { - "keyType": "string", - "type": "CustomAttribute", + "originalPrice": { + "type": "Interval", "id": 2 } } + } + } + }, + "Rating": { + "fields": { + "ratingCount": { + "type": "int32", + "id": 1 }, - "RecentSearchResult": { - "fields": { - "recentSearch": { - "type": "string", - "id": 1 - } + "averageRating": { + "type": "float", + "id": 2 + }, + "ratingHistogram": { + "rule": "repeated", + "type": "int32", + "id": 3 + } + } + }, + "UserInfo": { + "fields": { + "userId": { + "type": "string", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "userAgent": { + "type": "string", + "id": 3 + }, + "directUserRequest": { + "type": "bool", + "id": 4 + } + } + }, + "LocalInventory": { + "fields": { + "placeId": { + "type": "string", + "id": 1 + }, + "priceInfo": { + "type": "PriceInfo", + "id": 2 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 3 + }, + "fulfillmentTypes": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" } } } @@ -1151,6 +1224,14 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 35, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -1336,157 +1417,99 @@ } } }, - "PredictionService": { + "CatalogService": { "options": { "(google.api.default_host)": "retail.googleapis.com", "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, "methods": { - "Predict": { - "requestType": "PredictRequest", - "responseType": "PredictResponse", + "ListCatalogs": { + "requestType": "ListCatalogsRequest", + "responseType": "ListCatalogsResponse", "options": { - "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", - "(google.api.http).additional_bindings.body": "*" + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/catalogs", + "(google.api.method_signature)": "parent" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*", - "additional_bindings": { - "post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", - "body": "*" - } + "get": "/v2/{parent=projects/*/locations/*}/catalogs" } + }, + { + "(google.api.method_signature)": "parent" } ] - } - } - }, - "PredictRequest": { - "fields": { - "placement": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } }, - "userEvent": { - "type": "UserEvent", - "id": 2, + "UpdateCatalog": { + "requestType": "UpdateCatalogRequest", + "responseType": "Catalog", "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "pageSize": { - "type": "int32", - "id": 3 + "(google.api.http).patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "(google.api.http).body": "catalog", + "(google.api.method_signature)": "catalog,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{catalog.name=projects/*/locations/*/catalogs/*}", + "body": "catalog" + } + }, + { + "(google.api.method_signature)": "catalog,update_mask" + } + ] }, - "pageToken": { - "type": "string", - "id": 4, + "SetDefaultBranch": { + "requestType": "SetDefaultBranchRequest", + "responseType": "google.protobuf.Empty", "options": { - "deprecated": true - } + "(google.api.http).post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "(google.api.http).body": "*", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch", + "body": "*" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] }, - "filter": { - "type": "string", - "id": 5 + "GetDefaultBranch": { + "requestType": "GetDefaultBranchRequest", + "responseType": "GetDefaultBranchResponse", + "options": { + "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch", + "(google.api.method_signature)": "catalog" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" + } + }, + { + "(google.api.method_signature)": "catalog" + } + ] }, - "validateOnly": { - "type": "bool", - "id": 6 - }, - "params": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 7 - }, - "labels": { - "keyType": "string", - "type": "string", - "id": 8 - } - } - }, - "PredictResponse": { - "fields": { - "results": { - "rule": "repeated", - "type": "PredictionResult", - "id": 1 - }, - "attributionToken": { - "type": "string", - "id": 2 - }, - "missingIds": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "validateOnly": { - "type": "bool", - "id": 4 - } - }, - "nested": { - "PredictionResult": { - "fields": { - "id": { - "type": "string", - "id": 1 - }, - "metadata": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 2 - } - } - } - } - }, - "ProductService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "body": "product" - } - }, - { - "(google.api.method_signature)": "parent,product,product_id" - } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", + "GetCompletionConfig": { + "requestType": "GetCompletionConfigRequest", + "responseType": "CompletionConfig", "options": { - "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "get": "/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}" } }, { @@ -1494,55 +1517,37 @@ } ] }, - "ListProducts": { - "requestType": "ListProductsRequest", - "responseType": "ListProductsResponse", - "options": { - "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", + "UpdateCompletionConfig": { + "requestType": "UpdateCompletionConfigRequest", + "responseType": "CompletionConfig", "options": { - "(google.api.http).patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" + "(google.api.http).patch": "/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}", + "(google.api.http).body": "completion_config", + "(google.api.method_signature)": "completion_config,update_mask" }, "parsedOptions": [ { "(google.api.http)": { - "patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", - "body": "product" + "patch": "/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}", + "body": "completion_config" } }, { - "(google.api.method_signature)": "product,update_mask" + "(google.api.method_signature)": "completion_config,update_mask" } ] }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", - "responseType": "google.protobuf.Empty", + "GetAttributesConfig": { + "requestType": "GetAttributesConfigRequest", + "responseType": "AttributesConfig", "options": { - "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { - "delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + "get": "/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}" } }, { @@ -1550,471 +1555,344 @@ } ] }, - "ImportProducts": { - "requestType": "ImportProductsRequest", - "responseType": "google.longrunning.Operation", + "UpdateAttributesConfig": { + "requestType": "UpdateAttributesConfigRequest", + "responseType": "AttributesConfig", "options": { - "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", - "(google.api.http).body": "*", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportProductsResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + "(google.api.http).patch": "/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}", + "(google.api.http).body": "attributes_config", + "(google.api.method_signature)": "attributes_config,update_mask" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", - "body": "*" + "patch": "/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}", + "body": "attributes_config" } }, { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.ImportProductsResponse", - "metadata_type": "google.cloud.retail.v2.ImportMetadata" - } + "(google.api.method_signature)": "attributes_config,update_mask" } ] }, - "SetInventory": { - "requestType": "SetInventoryRequest", - "responseType": "google.longrunning.Operation", + "AddCatalogAttribute": { + "requestType": "AddCatalogAttributeRequest", + "responseType": "AttributesConfig", "options": { - "(google.api.http).post": "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", - "(google.api.http).body": "*", - "(google.api.method_signature)": "inventory,set_mask", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.SetInventoryResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.SetInventoryMetadata" + "(google.api.http).post": "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", + "(google.api.http).body": "*" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "post": "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute", "body": "*" } - }, - { - "(google.api.method_signature)": "inventory,set_mask" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.SetInventoryResponse", - "metadata_type": "google.cloud.retail.v2.SetInventoryMetadata" - } } ] }, - "AddFulfillmentPlaces": { - "requestType": "AddFulfillmentPlacesRequest", - "responseType": "google.longrunning.Operation", + "RemoveCatalogAttribute": { + "requestType": "RemoveCatalogAttributeRequest", + "responseType": "AttributesConfig", "options": { - "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", - "(google.api.http).body": "*", - "(google.api.method_signature)": "product", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.AddFulfillmentPlacesResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" + "(google.api.http).post": "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", + "(google.api.http).body": "*" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "post": "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute", "body": "*" } - }, - { - "(google.api.method_signature)": "product" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.AddFulfillmentPlacesResponse", - "metadata_type": "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" - } } ] }, - "RemoveFulfillmentPlaces": { - "requestType": "RemoveFulfillmentPlacesRequest", - "responseType": "google.longrunning.Operation", + "ReplaceCatalogAttribute": { + "requestType": "ReplaceCatalogAttributeRequest", + "responseType": "AttributesConfig", "options": { - "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", - "(google.api.http).body": "*", - "(google.api.method_signature)": "product", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" + "(google.api.http).post": "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", + "(google.api.http).body": "*" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "post": "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute", "body": "*" } - }, - { - "(google.api.method_signature)": "product" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse", - "metadata_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" - } } ] - }, - "AddLocalInventories": { - "requestType": "AddLocalInventoriesRequest", - "responseType": "google.longrunning.Operation", + } + } + }, + "ListCatalogsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, "options": { - "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", - "(google.api.http).body": "*", - "(google.api.method_signature)": "product", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.AddLocalInventoriesResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.AddLocalInventoriesMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", - "body": "*" - } - }, - { - "(google.api.method_signature)": "product" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.AddLocalInventoriesResponse", - "metadata_type": "google.cloud.retail.v2.AddLocalInventoriesMetadata" - } - } - ] + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } }, - "RemoveLocalInventories": { - "requestType": "RemoveLocalInventoriesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", - "(google.api.http).body": "*", - "(google.api.method_signature)": "product", - "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.RemoveLocalInventoriesResponse", - "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", - "body": "*" - } - }, - { - "(google.api.method_signature)": "product" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.cloud.retail.v2.RemoveLocalInventoriesResponse", - "metadata_type": "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" - } - } - ] + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 } } }, - "CreateProductRequest": { + "ListCatalogsResponse": { "fields": { - "parent": { + "catalogs": { + "rule": "repeated", + "type": "Catalog", + "id": 1 + }, + "nextPageToken": { "type": "string", + "id": 2 + } + } + }, + "UpdateCatalogRequest": { + "fields": { + "catalog": { + "type": "Catalog", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.field_behavior)": "REQUIRED" } }, - "product": { - "type": "Product", - "id": 2, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "SetDefaultBranchRequest": { + "fields": { + "catalog": { + "type": "string", + "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "productId": { + "branchId": { "type": "string", - "id": 3, + "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } + }, + "note": { + "type": "string", + "id": 3 + }, + "force": { + "type": "bool", + "id": 4 } } }, - "GetProductRequest": { + "GetDefaultBranchRequest": { "fields": { - "name": { + "catalog": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } } } }, - "UpdateProductRequest": { + "GetDefaultBranchResponse": { "fields": { - "product": { - "type": "Product", + "branch": { + "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" } }, - "updateMask": { - "type": "google.protobuf.FieldMask", + "setTime": { + "type": "google.protobuf.Timestamp", "id": 2 }, - "allowMissing": { - "type": "bool", + "note": { + "type": "string", "id": 3 } } }, - "DeleteProductRequest": { + "GetCompletionConfigRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/CompletionConfig" } } } }, - "ListProductsRequest": { + "UpdateCompletionConfigRequest": { "fields": { - "parent": { - "type": "string", + "completionConfig": { + "type": "CompletionConfig", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.field_behavior)": "REQUIRED" } }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "filter": { - "type": "string", - "id": 4 - }, - "readMask": { + "updateMask": { "type": "google.protobuf.FieldMask", - "id": 5 + "id": 2 } } }, - "ListProductsResponse": { + "GetAttributesConfigRequest": { "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { + "name": { "type": "string", - "id": 2 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } } } }, - "SetInventoryRequest": { + "UpdateAttributesConfigRequest": { "fields": { - "inventory": { - "type": "Product", + "attributesConfig": { + "type": "AttributesConfig", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "setMask": { + "updateMask": { "type": "google.protobuf.FieldMask", "id": 2 - }, - "setTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - }, - "allowMissing": { - "type": "bool", - "id": 4 } } }, - "SetInventoryMetadata": { - "fields": {} - }, - "SetInventoryResponse": { - "fields": {} - }, - "AddFulfillmentPlacesRequest": { + "AddCatalogAttributeRequest": { "fields": { - "product": { + "attributesConfig": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" } }, - "type": { - "type": "string", + "catalogAttribute": { + "type": "CatalogAttribute", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } - }, - "placeIds": { - "rule": "repeated", - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "addTime": { - "type": "google.protobuf.Timestamp", - "id": 4 - }, - "allowMissing": { - "type": "bool", - "id": 5 } } }, - "AddFulfillmentPlacesMetadata": { - "fields": {} - }, - "AddFulfillmentPlacesResponse": { - "fields": {} - }, - "AddLocalInventoriesRequest": { + "RemoveCatalogAttributeRequest": { "fields": { - "product": { + "attributesConfig": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" } }, - "localInventories": { - "rule": "repeated", - "type": "LocalInventory", + "key": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } - }, - "addMask": { - "type": "google.protobuf.FieldMask", - "id": 4 - }, - "addTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "allowMissing": { - "type": "bool", - "id": 6 } } }, - "AddLocalInventoriesMetadata": { - "fields": {} - }, - "AddLocalInventoriesResponse": { - "fields": {} - }, - "RemoveLocalInventoriesRequest": { + "ReplaceCatalogAttributeRequest": { "fields": { - "product": { + "attributesConfig": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" } }, - "placeIds": { - "rule": "repeated", - "type": "string", + "catalogAttribute": { + "type": "CatalogAttribute", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "removeTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "allowMissing": { - "type": "bool", + "updateMask": { + "type": "google.protobuf.FieldMask", "id": 3 } } }, - "RemoveLocalInventoriesMetadata": { - "fields": {} - }, - "RemoveLocalInventoriesResponse": { - "fields": {} - }, - "RemoveFulfillmentPlacesRequest": { - "fields": { - "product": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "retail.googleapis.com/Product" - } - }, - "type": { - "type": "string", - "id": 2, + "CompletionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CompleteQuery": { + "requestType": "CompleteQueryRequest", + "responseType": "CompleteQueryResponse", "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "(google.api.http).get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" + } + } + ] }, - "placeIds": { - "rule": "repeated", - "type": "string", - "id": 3, + "ImportCompletionData": { + "requestType": "ImportCompletionDataRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "removeTime": { - "type": "google.protobuf.Timestamp", - "id": 4 - }, - "allowMissing": { - "type": "bool", - "id": 5 + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportCompletionDataResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } + } + ] } } }, - "RemoveFulfillmentPlacesMetadata": { - "fields": {} - }, - "RemoveFulfillmentPlacesResponse": { - "fields": {} - }, - "PurgeMetadata": { - "fields": {} - }, - "PurgeUserEventsRequest": { + "CompleteQueryRequest": { "fields": { - "parent": { + "catalog": { "type": "string", "id": 1, "options": { @@ -2022,497 +1900,1909 @@ "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "filter": { + "query": { "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "force": { - "type": "bool", + "visitorId": { + "type": "string", + "id": 7 + }, + "languageCodes": { + "rule": "repeated", + "type": "string", "id": 3 + }, + "deviceType": { + "type": "string", + "id": 4 + }, + "dataset": { + "type": "string", + "id": 6 + }, + "maxSuggestions": { + "type": "int32", + "id": 5 } } }, - "PurgeUserEventsResponse": { + "CompleteQueryResponse": { "fields": { - "purgedEventsCount": { - "type": "int64", + "completionResults": { + "rule": "repeated", + "type": "CompletionResult", "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "recentSearchResults": { + "rule": "repeated", + "type": "RecentSearchResult", + "id": 3 } - } - }, - "SearchService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" }, - "methods": { - "Search": { - "requestType": "SearchRequest", - "responseType": "SearchResponse", - "options": { - "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", - "(google.api.http).additional_bindings.body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", - "body": "*", - "additional_bindings": { - "post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", - "body": "*" - } - } + "nested": { + "CompletionResult": { + "fields": { + "suggestion": { + "type": "string", + "id": 1 + }, + "attributes": { + "keyType": "string", + "type": "CustomAttribute", + "id": 2 } - ] + } + }, + "RecentSearchResult": { + "fields": { + "recentSearch": { + "type": "string", + "id": 1 + } + } } } }, - "SearchRequest": { + "Control": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/Control", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" + }, "oneofs": { - "_spellCorrectionSpec": { + "control": { "oneof": [ - "spellCorrectionSpec" + "rule" ] } }, "fields": { - "placement": { + "rule": { + "type": "Rule", + "id": 4 + }, + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "IMMUTABLE" } }, - "branch": { + "displayName": { "type": "string", "id": 2, "options": { - "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + "(google.api.field_behavior)": "REQUIRED" } }, - "query": { - "type": "string", - "id": 3 - }, - "visitorId": { + "associatedServingConfigIds": { + "rule": "repeated", "type": "string", - "id": 4, + "id": 5, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OUTPUT_ONLY" } }, - "userInfo": { - "type": "UserInfo", - "id": 5 - }, - "pageSize": { - "type": "int32", - "id": 7 - }, - "pageToken": { - "type": "string", - "id": 8 - }, - "offset": { - "type": "int32", - "id": 9 - }, - "filter": { - "type": "string", - "id": 10 - }, - "canonicalFilter": { - "type": "string", - "id": 28 - }, - "orderBy": { - "type": "string", - "id": 11 - }, - "facetSpecs": { + "solutionTypes": { "rule": "repeated", - "type": "FacetSpec", - "id": 12 - }, - "dynamicFacetSpec": { - "type": "DynamicFacetSpec", - "id": 21, + "type": "SolutionType", + "id": 6, "options": { - "deprecated": true + "(google.api.field_behavior)": "IMMUTABLE" } }, - "boostSpec": { - "type": "BoostSpec", - "id": 13 - }, - "queryExpansionSpec": { - "type": "QueryExpansionSpec", - "id": 14 - }, - "variantRollupKeys": { - "rule": "repeated", - "type": "string", - "id": 17 - }, - "pageCategories": { + "searchSolutionUseCase": { "rule": "repeated", - "type": "string", - "id": 23 + "type": "SearchSolutionUseCase", + "id": 7 + } + } + }, + "ControlService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateControl": { + "requestType": "CreateControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.http).body": "control", + "(google.api.method_signature)": "parent,control,control_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/controls", + "body": "control" + } + }, + { + "(google.api.method_signature)": "parent,control,control_id" + } + ] + }, + "DeleteControl": { + "requestType": "DeleteControlRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateControl": { + "requestType": "UpdateControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).patch": "/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.http).body": "control", + "(google.api.method_signature)": "control,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}", + "body": "control" + } + }, + { + "(google.api.method_signature)": "control,update_mask" + } + ] + }, + "GetControl": { + "requestType": "GetControlRequest", + "responseType": "Control", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListControls": { + "requestType": "ListControlsRequest", + "responseType": "ListControlsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*}/controls", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*/catalogs/*}/controls" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "CreateControlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "control": { + "type": "Control", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "controlId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateControlRequest": { + "fields": { + "control": { + "type": "Control", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteControlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" + } + } + } + }, + "GetControlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Control" + } + } + } + }, + "ListControlsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListControlsResponse": { + "fields": { + "controls": { + "rule": "repeated", + "type": "Control", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*", + "additional_bindings": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "body": "*" + } + } + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "deprecated": true + } + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" + } + ] + }, + "GetProduct": { + "requestType": "GetProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListProducts": { + "requestType": "ListProductsRequest", + "responseType": "ListProductsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateProduct": { + "requestType": "UpdateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.http).body": "product", + "(google.api.method_signature)": "product,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "body": "product" + } + }, + { + "(google.api.method_signature)": "product,update_mask" + } + ] + }, + "DeleteProduct": { + "requestType": "DeleteProductRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ImportProducts": { + "requestType": "ImportProductsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.ImportProductsResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.ImportMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.ImportProductsResponse", + "metadata_type": "google.cloud.retail.v2.ImportMetadata" + } + } + ] + }, + "SetInventory": { + "requestType": "SetInventoryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "(google.api.http).body": "*", + "(google.api.method_signature)": "inventory,set_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.SetInventoryResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.SetInventoryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory", + "body": "*" + } + }, + { + "(google.api.method_signature)": "inventory,set_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.SetInventoryResponse", + "metadata_type": "google.cloud.retail.v2.SetInventoryMetadata" + } + } + ] + }, + "AddFulfillmentPlaces": { + "requestType": "AddFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.AddFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.AddFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2.AddFulfillmentPlacesMetadata" + } + } + ] + }, + "RemoveFulfillmentPlaces": { + "requestType": "RemoveFulfillmentPlacesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesResponse", + "metadata_type": "google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata" + } + } + ] + }, + "AddLocalInventories": { + "requestType": "AddLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.AddLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.AddLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.AddLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2.AddLocalInventoriesMetadata" + } + } + ] + }, + "RemoveLocalInventories": { + "requestType": "RemoveLocalInventoriesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "(google.api.http).body": "*", + "(google.api.method_signature)": "product", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2.RemoveLocalInventoriesResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories", + "body": "*" + } + }, + { + "(google.api.method_signature)": "product" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2.RemoveLocalInventoriesResponse", + "metadata_type": "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" + } + } + ] + } + } + }, + "CreateProductRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "product": { + "type": "Product", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "productId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "UpdateProductRequest": { + "fields": { + "product": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "DeleteProductRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + } + } + }, + "ListProductsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "readMask": { + "type": "google.protobuf.FieldMask", + "id": 5 + } + } + }, + "ListProductsResponse": { + "fields": { + "products": { + "rule": "repeated", + "type": "Product", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "SetInventoryRequest": { + "fields": { + "inventory": { + "type": "Product", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "setMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "setTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "allowMissing": { + "type": "bool", + "id": 4 + } + } + }, + "SetInventoryMetadata": { + "fields": {} + }, + "SetInventoryResponse": { + "fields": {} + }, + "AddFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "AddFulfillmentPlacesMetadata": { + "fields": {} + }, + "AddFulfillmentPlacesResponse": { + "fields": {} + }, + "AddLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "addMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "addTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 6 + } + } + }, + "AddLocalInventoriesMetadata": { + "fields": {} + }, + "AddLocalInventoriesResponse": { + "fields": {} + }, + "RemoveLocalInventoriesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allowMissing": { + "type": "bool", + "id": 3 + } + } + }, + "RemoveLocalInventoriesMetadata": { + "fields": {} + }, + "RemoveLocalInventoriesResponse": { + "fields": {} + }, + "RemoveFulfillmentPlacesRequest": { + "fields": { + "product": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Product" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "placeIds": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "removeTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "allowMissing": { + "type": "bool", + "id": 5 + } + } + }, + "RemoveFulfillmentPlacesMetadata": { + "fields": {} + }, + "RemoveFulfillmentPlacesResponse": { + "fields": {} + }, + "PurgeMetadata": { + "fields": {} + }, + "PurgeUserEventsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "force": { + "type": "bool", + "id": 3 + } + } + }, + "PurgeUserEventsResponse": { + "fields": { + "purgedEventsCount": { + "type": "int64", + "id": 1 + } + } + }, + "SearchService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Search": { + "requestType": "SearchRequest", + "responseType": "SearchResponse", + "options": { + "(google.api.http).post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search", + "body": "*", + "additional_bindings": { + "post": "/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search", + "body": "*" + } + } + } + ] + } + } + }, + "SearchRequest": { + "oneofs": { + "_spellCorrectionSpec": { + "oneof": [ + "spellCorrectionSpec" + ] + } + }, + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "branch": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "retail.googleapis.com/Branch" + } + }, + "query": { + "type": "string", + "id": 3 + }, + "visitorId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userInfo": { + "type": "UserInfo", + "id": 5 + }, + "pageSize": { + "type": "int32", + "id": 7 + }, + "pageToken": { + "type": "string", + "id": 8 + }, + "offset": { + "type": "int32", + "id": 9 + }, + "filter": { + "type": "string", + "id": 10 + }, + "canonicalFilter": { + "type": "string", + "id": 28 + }, + "orderBy": { + "type": "string", + "id": 11 + }, + "facetSpecs": { + "rule": "repeated", + "type": "FacetSpec", + "id": 12 + }, + "dynamicFacetSpec": { + "type": "DynamicFacetSpec", + "id": 21, + "options": { + "deprecated": true + } + }, + "boostSpec": { + "type": "BoostSpec", + "id": 13 + }, + "queryExpansionSpec": { + "type": "QueryExpansionSpec", + "id": 14 + }, + "variantRollupKeys": { + "rule": "repeated", + "type": "string", + "id": 17 + }, + "pageCategories": { + "rule": "repeated", + "type": "string", + "id": 23 + }, + "searchMode": { + "type": "SearchMode", + "id": 31 + }, + "personalizationSpec": { + "type": "PersonalizationSpec", + "id": 32 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "spellCorrectionSpec": { + "type": "SpellCorrectionSpec", + "id": 35, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "FacetSpec": { + "fields": { + "facetKey": { + "type": "FacetKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "limit": { + "type": "int32", + "id": 2 + }, + "excludedFilterKeys": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "enableDynamicPosition": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "FacetKey": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "intervals": { + "rule": "repeated", + "type": "Interval", + "id": 2 + }, + "restrictedValues": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "prefixes": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "contains": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "caseInsensitive": { + "type": "bool", + "id": 10 + }, + "orderBy": { + "type": "string", + "id": 4 + }, + "query": { + "type": "string", + "id": 5 + }, + "returnMinMax": { + "type": "bool", + "id": 11 + } + } + } + } + }, + "DynamicFacetSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "DISABLED": 1, + "ENABLED": 2 + } + } + } + }, + "BoostSpec": { + "oneofs": { + "_skipBoostSpecValidation": { + "oneof": [ + "skipBoostSpecValidation" + ] + } + }, + "fields": { + "conditionBoostSpecs": { + "rule": "repeated", + "type": "ConditionBoostSpec", + "id": 1 + }, + "skipBoostSpecValidation": { + "type": "bool", + "id": 2, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "ConditionBoostSpec": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } + } + }, + "QueryExpansionSpec": { + "fields": { + "condition": { + "type": "Condition", + "id": 1 + }, + "pinUnexpandedResults": { + "type": "bool", + "id": 2 + } + }, + "nested": { + "Condition": { + "values": { + "CONDITION_UNSPECIFIED": 0, + "DISABLED": 1, + "AUTO": 3 + } + } + } + }, + "PersonalizationSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "AUTO": 1, + "DISABLED": 2 + } + } + } + }, + "SpellCorrectionSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "SUGGESTION_ONLY": 1, + "AUTO": 2 + } + } + } }, - "searchMode": { - "type": "SearchMode", - "id": 31 + "SearchMode": { + "values": { + "SEARCH_MODE_UNSPECIFIED": 0, + "PRODUCT_SEARCH_ONLY": 1, + "FACETED_SEARCH_ONLY": 2 + } + } + } + }, + "SearchResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "SearchResult", + "id": 1 }, - "personalizationSpec": { - "type": "PersonalizationSpec", - "id": 32 + "facets": { + "rule": "repeated", + "type": "Facet", + "id": 2 }, - "labels": { - "keyType": "string", + "totalSize": { + "type": "int32", + "id": 3 + }, + "correctedQuery": { "type": "string", - "id": 34 + "id": 4 }, - "spellCorrectionSpec": { - "type": "SpellCorrectionSpec", - "id": 35, - "options": { - "proto3_optional": true - } + "attributionToken": { + "type": "string", + "id": 5 + }, + "nextPageToken": { + "type": "string", + "id": 6 + }, + "queryExpansionInfo": { + "type": "QueryExpansionInfo", + "id": 7 + }, + "redirectUri": { + "type": "string", + "id": 10 + }, + "appliedControls": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "invalidConditionBoostSpecs": { + "rule": "repeated", + "type": "SearchRequest.BoostSpec.ConditionBoostSpec", + "id": 14 } }, "nested": { - "FacetSpec": { + "SearchResult": { "fields": { - "facetKey": { - "type": "FacetKey", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": { + "type": "string", + "id": 1 }, - "limit": { - "type": "int32", + "product": { + "type": "Product", "id": 2 }, - "excludedFilterKeys": { + "matchingVariantCount": { + "type": "int32", + "id": 3 + }, + "matchingVariantFields": { + "keyType": "string", + "type": "google.protobuf.FieldMask", + "id": 4 + }, + "variantRollupValues": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 5 + }, + "personalLabels": { "rule": "repeated", "type": "string", - "id": 3 + "id": 7 + } + } + }, + "Facet": { + "fields": { + "key": { + "type": "string", + "id": 1 }, - "enableDynamicPosition": { + "values": { + "rule": "repeated", + "type": "FacetValue", + "id": 2 + }, + "dynamicFacet": { "type": "bool", - "id": 4 + "id": 3 + } + }, + "nested": { + "FacetValue": { + "oneofs": { + "facetValue": { + "oneof": [ + "value", + "interval" + ] + } + }, + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "interval": { + "type": "Interval", + "id": 2 + }, + "count": { + "type": "int64", + "id": 3 + }, + "minValue": { + "type": "double", + "id": 5 + }, + "maxValue": { + "type": "double", + "id": 6 + } + } + } + } + }, + "QueryExpansionInfo": { + "fields": { + "expandedQuery": { + "type": "bool", + "id": 1 + }, + "pinnedResultCount": { + "type": "int64", + "id": 2 } + } + } + } + }, + "ServingConfig": { + "options": { + "(google.api.resource).type": "retail.googleapis.com/ServingConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "modelId": { + "type": "string", + "id": 3 + }, + "priceRerankingLevel": { + "type": "string", + "id": 4 + }, + "facetControlIds": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "dynamicFacetSpec": { + "type": "SearchRequest.DynamicFacetSpec", + "id": 6 + }, + "boostControlIds": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "filterControlIds": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "redirectControlIds": { + "rule": "repeated", + "type": "string", + "id": 10 + }, + "twowaySynonymsControlIds": { + "rule": "repeated", + "type": "string", + "id": 18 + }, + "onewaySynonymsControlIds": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "doNotAssociateControlIds": { + "rule": "repeated", + "type": "string", + "id": 13 + }, + "replacementControlIds": { + "rule": "repeated", + "type": "string", + "id": 14 + }, + "ignoreControlIds": { + "rule": "repeated", + "type": "string", + "id": 15 + }, + "diversityLevel": { + "type": "string", + "id": 8 + }, + "enableCategoryFilterLevel": { + "type": "string", + "id": 16 + }, + "personalizationSpec": { + "type": "SearchRequest.PersonalizationSpec", + "id": 21 + }, + "solutionTypes": { + "rule": "repeated", + "type": "SolutionType", + "id": 19, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + } + } + }, + "ServingConfigService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateServingConfig": { + "requestType": "CreateServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "(google.api.http).body": "serving_config", + "(google.api.method_signature)": "parent,serving_config,serving_config_id" }, - "nested": { - "FacetKey": { - "fields": { - "key": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "intervals": { - "rule": "repeated", - "type": "Interval", - "id": 2 - }, - "restrictedValues": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "prefixes": { - "rule": "repeated", - "type": "string", - "id": 8 - }, - "contains": { - "rule": "repeated", - "type": "string", - "id": 9 - }, - "caseInsensitive": { - "type": "bool", - "id": 10 - }, - "orderBy": { - "type": "string", - "id": 4 - }, - "query": { - "type": "string", - "id": 5 - }, - "returnMinMax": { - "type": "bool", - "id": 11 - } + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "body": "serving_config" } + }, + { + "(google.api.method_signature)": "parent,serving_config,serving_config_id" } - } + ] }, - "DynamicFacetSpec": { - "fields": { - "mode": { - "type": "Mode", - "id": 1 - } + "DeleteServingConfig": { + "requestType": "DeleteServingConfigRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.method_signature)": "name" }, - "nested": { - "Mode": { - "values": { - "MODE_UNSPECIFIED": 0, - "DISABLED": 1, - "ENABLED": 2 + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" } + }, + { + "(google.api.method_signature)": "name" } - } + ] }, - "BoostSpec": { - "oneofs": { - "_skipBoostSpecValidation": { - "oneof": [ - "skipBoostSpecValidation" - ] - } + "UpdateServingConfig": { + "requestType": "UpdateServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).patch": "/v2/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.http).body": "serving_config", + "(google.api.method_signature)": "serving_config,update_mask" }, - "fields": { - "conditionBoostSpecs": { - "rule": "repeated", - "type": "ConditionBoostSpec", - "id": 1 - }, - "skipBoostSpecValidation": { - "type": "bool", - "id": 2, - "options": { - "proto3_optional": true + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "body": "serving_config" } + }, + { + "(google.api.method_signature)": "serving_config,update_mask" } + ] + }, + "GetServingConfig": { + "requestType": "GetServingConfigRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}", + "(google.api.method_signature)": "name" }, - "nested": { - "ConditionBoostSpec": { - "fields": { - "condition": { - "type": "string", - "id": 1 - }, - "boost": { - "type": "float", - "id": 2 - } + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" } - } - } - }, - "QueryExpansionSpec": { - "fields": { - "condition": { - "type": "Condition", - "id": 1 }, - "pinUnexpandedResults": { - "type": "bool", - "id": 2 + { + "(google.api.method_signature)": "name" } + ] + }, + "ListServingConfigs": { + "requestType": "ListServingConfigsRequest", + "responseType": "ListServingConfigsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs", + "(google.api.method_signature)": "parent" }, - "nested": { - "Condition": { - "values": { - "CONDITION_UNSPECIFIED": 0, - "DISABLED": 1, - "AUTO": 3 + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" } + }, + { + "(google.api.method_signature)": "parent" } - } + ] }, - "PersonalizationSpec": { - "fields": { - "mode": { - "type": "Mode", - "id": 1 - } + "AddControl": { + "requestType": "AddControlRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + "(google.api.http).body": "*", + "(google.api.method_signature)": "serving_config" }, - "nested": { - "Mode": { - "values": { - "MODE_UNSPECIFIED": 0, - "AUTO": 1, - "DISABLED": 2 + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl", + "body": "*" } + }, + { + "(google.api.method_signature)": "serving_config" } - } + ] }, - "SpellCorrectionSpec": { - "fields": { - "mode": { - "type": "Mode", - "id": 1 - } + "RemoveControl": { + "requestType": "RemoveControlRequest", + "responseType": "ServingConfig", + "options": { + "(google.api.http).post": "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + "(google.api.http).body": "*", + "(google.api.method_signature)": "serving_config" }, - "nested": { - "Mode": { - "values": { - "MODE_UNSPECIFIED": 0, - "SUGGESTION_ONLY": 1, - "AUTO": 2 + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl", + "body": "*" } + }, + { + "(google.api.method_signature)": "serving_config" } + ] + } + } + }, + "CreateServingConfigRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, - "SearchMode": { - "values": { - "SEARCH_MODE_UNSPECIFIED": 0, - "PRODUCT_SEARCH_ONLY": 1, - "FACETED_SEARCH_ONLY": 2 + "servingConfig": { + "type": "ServingConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "servingConfigId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" } } } }, - "SearchResponse": { + "UpdateServingConfigRequest": { "fields": { - "results": { - "rule": "repeated", - "type": "SearchResult", - "id": 1 + "servingConfig": { + "type": "ServingConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "facets": { - "rule": "repeated", - "type": "Facet", + "updateMask": { + "type": "google.protobuf.FieldMask", "id": 2 - }, - "totalSize": { - "type": "int32", - "id": 3 - }, - "correctedQuery": { + } + } + }, + "DeleteServingConfigRequest": { + "fields": { + "name": { "type": "string", - "id": 4 - }, - "attributionToken": { + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" + } + } + } + }, + "GetServingConfigRequest": { + "fields": { + "name": { "type": "string", - "id": 5 - }, - "nextPageToken": { + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" + } + } + } + }, + "ListServingConfigsRequest": { + "fields": { + "parent": { "type": "string", - "id": 6 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } }, - "queryExpansionInfo": { - "type": "QueryExpansionInfo", - "id": 7 + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "redirectUri": { + "pageToken": { "type": "string", - "id": 10 - }, - "appliedControls": { + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListServingConfigsResponse": { + "fields": { + "servingConfigs": { "rule": "repeated", - "type": "string", - "id": 12 + "type": "ServingConfig", + "id": 1 }, - "invalidConditionBoostSpecs": { - "rule": "repeated", - "type": "SearchRequest.BoostSpec.ConditionBoostSpec", - "id": 14 + "nextPageToken": { + "type": "string", + "id": 2 } - }, - "nested": { - "SearchResult": { - "fields": { - "id": { - "type": "string", - "id": 1 - }, - "product": { - "type": "Product", - "id": 2 - }, - "matchingVariantCount": { - "type": "int32", - "id": 3 - }, - "matchingVariantFields": { - "keyType": "string", - "type": "google.protobuf.FieldMask", - "id": 4 - }, - "variantRollupValues": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 5 - } + } + }, + "AddControlRequest": { + "fields": { + "servingConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" } }, - "Facet": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "values": { - "rule": "repeated", - "type": "FacetValue", - "id": 2 - }, - "dynamicFacet": { - "type": "bool", - "id": 3 - } - }, - "nested": { - "FacetValue": { - "oneofs": { - "facetValue": { - "oneof": [ - "value", - "interval" - ] - } - }, - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "interval": { - "type": "Interval", - "id": 2 - }, - "count": { - "type": "int64", - "id": 3 - }, - "minValue": { - "type": "double", - "id": 5 - }, - "maxValue": { - "type": "double", - "id": 6 - } - } - } + "controlId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "RemoveControlRequest": { + "fields": { + "servingConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/ServingConfig" } }, - "QueryExpansionInfo": { - "fields": { - "expandedQuery": { - "type": "bool", - "id": 1 - }, - "pinnedResultCount": { - "type": "int64", - "id": 2 - } + "controlId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" } } } @@ -12753,18 +14043,6 @@ } } }, - "Empty": { - "fields": {} - }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, "Timestamp": { "fields": { "seconds": { @@ -12789,6 +14067,15 @@ } } }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, "DoubleValue": { "fields": { "value": { @@ -12873,6 +14160,9 @@ } } }, + "Empty": { + "fields": {} + }, "Struct": { "fields": { "fields": { diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js new file mode 100644 index 00000000000..4386360f55e --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.add_catalog_attribute.js @@ -0,0 +1,68 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, catalogAttribute) { + // [START retail_v2_generated_CatalogService_AddCatalogAttribute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + */ + // const attributesConfig = 'abc123' + /** + * Required. The CatalogAttribute google.cloud.retail.v2.CatalogAttribute + * to add. + */ + // const catalogAttribute = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callAddCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + catalogAttribute, + }; + + // Run request + const response = await retailClient.addCatalogAttribute(request); + console.log(response); + } + + callAddCatalogAttribute(); + // [END retail_v2_generated_CatalogService_AddCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_attributes_config.js new file mode 100644 index 00000000000..21de131eb6c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_attributes_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2_generated_CatalogService_GetAttributesConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + */ + // const name = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callGetAttributesConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getAttributesConfig(request); + console.log(response); + } + + callGetAttributesConfig(); + // [END retail_v2_generated_CatalogService_GetAttributesConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_completion_config.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_completion_config.js new file mode 100644 index 00000000000..93696f792fe --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.get_completion_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2_generated_CatalogService_GetCompletionConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + */ + // const name = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callGetCompletionConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getCompletionConfig(request); + console.log(response); + } + + callGetCompletionConfig(); + // [END retail_v2_generated_CatalogService_GetCompletionConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.remove_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.remove_catalog_attribute.js new file mode 100644 index 00000000000..c9b1893a954 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.remove_catalog_attribute.js @@ -0,0 +1,68 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, key) { + // [START retail_v2_generated_CatalogService_RemoveCatalogAttribute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + */ + // const attributesConfig = 'abc123' + /** + * Required. The attribute name key of the + * CatalogAttribute google.cloud.retail.v2.CatalogAttribute to remove. + */ + // const key = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callRemoveCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + key, + }; + + // Run request + const response = await retailClient.removeCatalogAttribute(request); + console.log(response); + } + + callRemoveCatalogAttribute(); + // [END retail_v2_generated_CatalogService_RemoveCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.replace_catalog_attribute.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.replace_catalog_attribute.js new file mode 100644 index 00000000000..dde0a278a26 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.replace_catalog_attribute.js @@ -0,0 +1,76 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, catalogAttribute) { + // [START retail_v2_generated_CatalogService_ReplaceCatalogAttribute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + */ + // const attributesConfig = 'abc123' + /** + * Required. The updated + * CatalogAttribute google.cloud.retail.v2.CatalogAttribute. + */ + // const catalogAttribute = {} + /** + * Indicates which fields in the provided + * CatalogAttribute google.cloud.retail.v2.CatalogAttribute to update. The + * following are NOT supported: + * * CatalogAttribute.key google.cloud.retail.v2.CatalogAttribute.key + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callReplaceCatalogAttribute() { + // Construct request + const request = { + attributesConfig, + catalogAttribute, + }; + + // Run request + const response = await retailClient.replaceCatalogAttribute(request); + console.log(response); + } + + callReplaceCatalogAttribute(); + // [END retail_v2_generated_CatalogService_ReplaceCatalogAttribute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_attributes_config.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_attributes_config.js new file mode 100644 index 00000000000..67b08a13db6 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_attributes_config.js @@ -0,0 +1,70 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig) { + // [START retail_v2_generated_CatalogService_UpdateAttributesConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The AttributesConfig google.cloud.retail.v2.AttributesConfig + * to update. + */ + // const attributesConfig = {} + /** + * Indicates which fields in the provided + * AttributesConfig google.cloud.retail.v2.AttributesConfig to update. The + * following is the only supported field: + * * AttributesConfig.catalog_attributes google.cloud.retail.v2.AttributesConfig.catalog_attributes + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callUpdateAttributesConfig() { + // Construct request + const request = { + attributesConfig, + }; + + // Run request + const response = await retailClient.updateAttributesConfig(request); + console.log(response); + } + + callUpdateAttributesConfig(); + // [END retail_v2_generated_CatalogService_UpdateAttributesConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_completion_config.js b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_completion_config.js new file mode 100644 index 00000000000..0ff17c7e15b --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/catalog_service.update_completion_config.js @@ -0,0 +1,78 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(completionConfig) { + // [START retail_v2_generated_CatalogService_UpdateCompletionConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The CompletionConfig google.cloud.retail.v2.CompletionConfig + * to update. + * If the caller does not have permission to update the + * CompletionConfig google.cloud.retail.v2.CompletionConfig, then a + * PERMISSION_DENIED error is returned. + * If the CompletionConfig google.cloud.retail.v2.CompletionConfig to + * update does not exist, a NOT_FOUND error is returned. + */ + // const completionConfig = {} + /** + * Indicates which fields in the provided + * CompletionConfig google.cloud.retail.v2.CompletionConfig to update. The + * following are the only supported fields: + * * CompletionConfig.matching_order google.cloud.retail.v2.CompletionConfig.matching_order + * * CompletionConfig.max_suggestions google.cloud.retail.v2.CompletionConfig.max_suggestions + * * CompletionConfig.min_prefix_length google.cloud.retail.v2.CompletionConfig.min_prefix_length + * * CompletionConfig.auto_learning google.cloud.retail.v2.CompletionConfig.auto_learning + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callUpdateCompletionConfig() { + // Construct request + const request = { + completionConfig, + }; + + // Run request + const response = await retailClient.updateCompletionConfig(request); + console.log(response); + } + + callUpdateCompletionConfig(); + // [END retail_v2_generated_CatalogService_UpdateCompletionConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js index 9182f5fbe72..cfddc591fa1 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.complete_query.js @@ -86,7 +86,8 @@ function main(catalog, query) { // const dataset = 'abc123' /** * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value CompletionConfig.max_suggestions . + * to the configured value + * CompletionConfig.max_suggestions google.cloud.retail.v2.CompletionConfig.max_suggestions. * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. */ diff --git a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js index c20455d0c35..c712950649a 100644 --- a/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2/completion_service.import_completion_data.js @@ -39,8 +39,8 @@ function main(parent, inputConfig) { // const inputConfig = {} /** * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. */ diff --git a/packages/google-cloud-retail/samples/generated/v2/control_service.create_control.js b/packages/google-cloud-retail/samples/generated/v2/control_service.create_control.js new file mode 100644 index 00000000000..3d26c4eb157 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/control_service.create_control.js @@ -0,0 +1,75 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, control, controlId) { + // [START retail_v2_generated_ControlService_CreateControl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of parent catalog. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + */ + // const parent = 'abc123' + /** + * Required. The Control to create. + */ + // const control = {} + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-_/. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callCreateControl() { + // Construct request + const request = { + parent, + control, + controlId, + }; + + // Run request + const response = await retailClient.createControl(request); + console.log(response); + } + + callCreateControl(); + // [END retail_v2_generated_ControlService_CreateControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/control_service.delete_control.js b/packages/google-cloud-retail/samples/generated/v2/control_service.delete_control.js new file mode 100644 index 00000000000..d62a37b0a3c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/control_service.delete_control.js @@ -0,0 +1,62 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2_generated_ControlService_DeleteControl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + */ + // const name = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callDeleteControl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteControl(request); + console.log(response); + } + + callDeleteControl(); + // [END retail_v2_generated_ControlService_DeleteControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2/control_service.get_control.js new file mode 100644 index 00000000000..3131bfcdbc1 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/control_service.get_control.js @@ -0,0 +1,62 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2_generated_ControlService_GetControl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + */ + // const name = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callGetControl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getControl(request); + console.log(response); + } + + callGetControl(); + // [END retail_v2_generated_ControlService_GetControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/control_service.list_controls.js b/packages/google-cloud-retail/samples/generated/v2/control_service.list_controls.js new file mode 100644 index 00000000000..7acee0255e5 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/control_service.list_controls.js @@ -0,0 +1,82 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2_generated_ControlService_ListControls_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * filter google.cloud.retail.v2.ListControlsRequest.filter is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + */ + // const filter = 'abc123' + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callListControls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listControlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListControls(); + // [END retail_v2_generated_ControlService_ListControls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/control_service.update_control.js b/packages/google-cloud-retail/samples/generated/v2/control_service.update_control.js new file mode 100644 index 00000000000..b057ce67127 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/control_service.update_control.js @@ -0,0 +1,69 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(control) { + // [START retail_v2_generated_ControlService_UpdateControl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Control to update. + */ + // const control = {} + /** + * Indicates which fields in the provided + * Control google.cloud.retail.v2.Control to update. The following are NOT + * supported: + * * Control.name google.cloud.retail.v2.Control.name + * If not set or empty, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {ControlServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ControlServiceClient(); + + async function callUpdateControl() { + // Construct request + const request = { + control, + }; + + // Run request + const response = await retailClient.updateControl(request); + console.log(response); + } + + callUpdateControl(); + // [END retail_v2_generated_ControlService_UpdateControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js index 7e1d37beace..c3071f1fda4 100644 --- a/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2/product_service.import_products.js @@ -44,8 +44,8 @@ function main(parent, inputConfig) { */ // const errorsConfig = {} /** - * Indicates which fields in the provided imported 'products' to update. If - * not set, will by default update all fields. + * Indicates which fields in the provided imported `products` to update. If + * not set, all fields are updated. */ // const updateMask = {} /** @@ -56,19 +56,15 @@ function main(parent, inputConfig) { // const reconciliationMode = {} /** * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has * to be within the same project as * ImportProductsRequest.parent google.cloud.retail.v2.ImportProductsRequest.parent. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. + * Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + * `pubsub.topics.publish` IAM permission on the topic. */ // const notificationPubsubTopic = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js index 3dd41e919be..744714838f9 100644 --- a/packages/google-cloud-retail/samples/generated/v2/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2/search_service.search.js @@ -134,7 +134,9 @@ function main(placement, visitorId) { /** * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). - * Notice that if both ServingConfig.boost_control_ids and + * Notice that if both + * ServingConfig.boost_control_ids google.cloud.retail.v2.ServingConfig.boost_control_ids + * and * SearchRequest.boost_spec google.cloud.retail.v2.SearchRequest.boost_spec * are set, the boost conditions from both places are evaluated. If a search * request matches multiple boost conditions, the final boost score is equal @@ -236,6 +238,14 @@ function main(placement, visitorId) { // const searchMode = {} /** * The specification for personalization. + * Notice that if both + * ServingConfig.personalization_spec google.cloud.retail.v2.ServingConfig.personalization_spec + * and + * SearchRequest.personalization_spec google.cloud.retail.v2.SearchRequest.personalization_spec + * are set. + * SearchRequest.personalization_spec google.cloud.retail.v2.SearchRequest.personalization_spec + * will override + * ServingConfig.personalization_spec google.cloud.retail.v2.ServingConfig.personalization_spec. */ // const personalizationSpec = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.add_control.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.add_control.js new file mode 100644 index 00000000000..0e0ee81f026 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.add_control.js @@ -0,0 +1,68 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig, controlId) { + // [START retail_v2_generated_ServingConfigService_AddControl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const servingConfig = 'abc123' + /** + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config - if id is not found a NOT_FOUND error is returned. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callAddControl() { + // Construct request + const request = { + servingConfig, + controlId, + }; + + // Run request + const response = await retailClient.addControl(request); + console.log(response); + } + + callAddControl(); + // [END retail_v2_generated_ServingConfigService_AddControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.create_serving_config.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.create_serving_config.js new file mode 100644 index 00000000000..5adc3ee4905 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.create_serving_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, servingConfig, servingConfigId) { + // [START retail_v2_generated_ServingConfigService_CreateServingConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Full resource name of parent. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + */ + // const parent = 'abc123' + /** + * Required. The ServingConfig to create. + */ + // const servingConfig = {} + /** + * Required. The ID to use for the ServingConfig, which will become the final + * component of the ServingConfig's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-_/. + */ + // const servingConfigId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callCreateServingConfig() { + // Construct request + const request = { + parent, + servingConfig, + servingConfigId, + }; + + // Run request + const response = await retailClient.createServingConfig(request); + console.log(response); + } + + callCreateServingConfig(); + // [END retail_v2_generated_ServingConfigService_CreateServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.delete_serving_config.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.delete_serving_config.js new file mode 100644 index 00000000000..b9a3fe649c4 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.delete_serving_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2_generated_ServingConfigService_DeleteServingConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callDeleteServingConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteServingConfig(request); + console.log(response); + } + + callDeleteServingConfig(); + // [END retail_v2_generated_ServingConfigService_DeleteServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.get_serving_config.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.get_serving_config.js new file mode 100644 index 00000000000..0aea4a0429c --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.get_serving_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2_generated_ServingConfigService_GetServingConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const name = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callGetServingConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.getServingConfig(request); + console.log(response); + } + + callGetServingConfig(); + // [END retail_v2_generated_ServingConfigService_GetServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.list_serving_configs.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.list_serving_configs.js new file mode 100644 index 00000000000..2aa4c4d944d --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.list_serving_configs.js @@ -0,0 +1,75 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2_generated_ServingConfigService_ListServingConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callListServingConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listServingConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServingConfigs(); + // [END retail_v2_generated_ServingConfigService_ListServingConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.remove_control.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.remove_control.js new file mode 100644 index 00000000000..2f32073bc1a --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.remove_control.js @@ -0,0 +1,68 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig, controlId) { + // [START retail_v2_generated_ServingConfigService_RemoveControl_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + */ + // const servingConfig = 'abc123' + /** + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config. + */ + // const controlId = 'abc123' + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callRemoveControl() { + // Construct request + const request = { + servingConfig, + controlId, + }; + + // Run request + const response = await retailClient.removeControl(request); + console.log(response); + } + + callRemoveControl(); + // [END retail_v2_generated_ServingConfigService_RemoveControl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/serving_config_service.update_serving_config.js b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.update_serving_config.js new file mode 100644 index 00000000000..c4ba8ac6acf --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2/serving_config_service.update_serving_config.js @@ -0,0 +1,69 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(servingConfig) { + // [START retail_v2_generated_ServingConfigService_UpdateServingConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ServingConfig to update. + */ + // const servingConfig = {} + /** + * Indicates which fields in the provided + * ServingConfig google.cloud.retail.v2.ServingConfig to update. The + * following are NOT supported: + * * ServingConfig.name google.cloud.retail.v2.ServingConfig.name + * If not set, all supported fields are updated. + */ + // const updateMask = {} + + // Imports the Retail library + const {ServingConfigServiceClient} = require('@google-cloud/retail').v2; + + // Instantiates a client + const retailClient = new ServingConfigServiceClient(); + + async function callUpdateServingConfig() { + // Construct request + const request = { + servingConfig, + }; + + // Run request + const response = await retailClient.updateServingConfig(request); + console.log(response); + } + + callUpdateServingConfig(); + // [END retail_v2_generated_ServingConfigService_UpdateServingConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index e45d3a1b72f..21749b266a3 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -195,6 +195,310 @@ } } }, + { + "regionTag": "retail_v2_generated_CatalogService_GetCompletionConfig_async", + "title": "CatalogService getCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].", + "canonical": true, + "file": "catalog_service.get_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2.CatalogService.GetCompletionConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "GetCompletionConfig", + "fullName": "google.cloud.retail.v2.CatalogService.GetCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_UpdateCompletionConfig_async", + "title": "CatalogService updateCompletionConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.", + "canonical": true, + "file": "catalog_service.update_completion_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateCompletionConfig", + "async": true, + "parameters": [ + { + "name": "completion_config", + "type": ".google.cloud.retail.v2.CompletionConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.CompletionConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateCompletionConfig", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateCompletionConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_GetAttributesConfig_async", + "title": "CatalogService getAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].", + "canonical": true, + "file": "catalog_service.get_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2.CatalogService.GetAttributesConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "GetAttributesConfig", + "fullName": "google.cloud.retail.v2.CatalogService.GetAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_UpdateAttributesConfig_async", + "title": "CatalogService updateAttributesConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", + "canonical": true, + "file": "catalog_service.update_attributes_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateAttributesConfig", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": ".google.cloud.retail.v2.AttributesConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "UpdateAttributesConfig", + "fullName": "google.cloud.retail.v2.CatalogService.UpdateAttributesConfig", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_AddCatalogAttribute_async", + "title": "CatalogService addCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "catalog_service.add_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2.CatalogService.AddCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2.CatalogAttribute" + } + ], + "resultType": ".google.cloud.retail.v2.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "AddCatalogAttribute", + "fullName": "google.cloud.retail.v2.CatalogService.AddCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_RemoveCatalogAttribute_async", + "title": "CatalogService removeCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.remove_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "key", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "RemoveCatalogAttribute", + "fullName": "google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CatalogService_ReplaceCatalogAttribute_async", + "title": "CatalogService replaceCatalogAttribute Sample", + "origin": "API_DEFINITION", + "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "catalog_service.replace_catalog_attribute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "catalog_attribute", + "type": ".google.cloud.retail.v2.CatalogAttribute" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.AttributesConfig", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2.CatalogServiceClient" + }, + "method": { + "shortName": "ReplaceCatalogAttribute", + "fullName": "google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2.CatalogService" + } + } + } + }, { "regionTag": "retail_v2_generated_CompletionService_CompleteQuery_async", "title": "CatalogService completeQuery Sample", @@ -206,7 +510,7 @@ "segments": [ { "start": 25, - "end": 113, + "end": 114, "type": "FULL" } ], @@ -236,47 +540,267 @@ "type": "TYPE_STRING" }, { - "name": "dataset", + "name": "dataset", + "type": "TYPE_STRING" + }, + { + "name": "max_suggestions", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.retail.v2.CompleteQueryResponse", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2.CompletionServiceClient" + }, + "method": { + "shortName": "CompleteQuery", + "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", + "title": "CatalogService importCompletionData Sample", + "origin": "API_DEFINITION", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "canonical": true, + "file": "completion_service.import_completion_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.retail.v2.CompletionDataInputConfig" + }, + { + "name": "notification_pubsub_topic", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CompletionServiceClient", + "fullName": "google.cloud.retail.v2.CompletionServiceClient" + }, + "method": { + "shortName": "ImportCompletionData", + "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "service": { + "shortName": "CompletionService", + "fullName": "google.cloud.retail.v2.CompletionService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ControlService_CreateControl_async", + "title": "CatalogService createControl Sample", + "origin": "API_DEFINITION", + "description": " Creates a Control. If the [Control][google.cloud.retail.v2.Control] to create already exists, an ALREADY_EXISTS error is returned.", + "canonical": true, + "file": "control_service.create_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2.ControlService.CreateControl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "control", + "type": ".google.cloud.retail.v2.Control" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2.ControlServiceClient" + }, + "method": { + "shortName": "CreateControl", + "fullName": "google.cloud.retail.v2.ControlService.CreateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ControlService_DeleteControl_async", + "title": "CatalogService deleteControl Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Control. If the [Control][google.cloud.retail.v2.Control] to delete does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.delete_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2.ControlService.DeleteControl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2.ControlServiceClient" + }, + "method": { + "shortName": "DeleteControl", + "fullName": "google.cloud.retail.v2.ControlService.DeleteControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ControlService_UpdateControl_async", + "title": "CatalogService updateControl Sample", + "origin": "API_DEFINITION", + "description": " Updates a Control. [Control][google.cloud.retail.v2.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2.Control] to update does not exist, a NOT_FOUND error is returned.", + "canonical": true, + "file": "control_service.update_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2.ControlService.UpdateControl", + "async": true, + "parameters": [ + { + "name": "control", + "type": ".google.cloud.retail.v2.Control" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.Control", + "client": { + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2.ControlServiceClient" + }, + "method": { + "shortName": "UpdateControl", + "fullName": "google.cloud.retail.v2.ControlService.UpdateControl", + "service": { + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2.ControlService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ControlService_GetControl_async", + "title": "CatalogService getControl Sample", + "origin": "API_DEFINITION", + "description": " Gets a Control.", + "canonical": true, + "file": "control_service.get_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2.ControlService.GetControl", + "async": true, + "parameters": [ + { + "name": "name", "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" } ], - "resultType": ".google.cloud.retail.v2.CompleteQueryResponse", + "resultType": ".google.cloud.retail.v2.Control", "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2.CompletionServiceClient" + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2.ControlServiceClient" }, "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "shortName": "GetControl", + "fullName": "google.cloud.retail.v2.ControlService.GetControl", "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2.CompletionService" + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2.ControlService" } } } }, { - "regionTag": "retail_v2_generated_CompletionService_ImportCompletionData_async", - "title": "CatalogService importCompletionData Sample", + "regionTag": "retail_v2_generated_ControlService_ListControls_async", + "title": "CatalogService listControls Sample", "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Lists all Controls by their parent [Catalog][google.cloud.retail.v2.Catalog].", "canonical": true, - "file": "completion_service.import_completion_data.js", + "file": "control_service.list_controls.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 68, + "end": 74, "type": "FULL" } ], "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2.ControlService.ListControls", "async": true, "parameters": [ { @@ -284,25 +808,29 @@ "type": "TYPE_STRING" }, { - "name": "input_config", - "type": ".google.cloud.retail.v2.CompletionDataInputConfig" + "name": "page_size", + "type": "TYPE_INT32" }, { - "name": "notification_pubsub_topic", + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", "type": "TYPE_STRING" } ], - "resultType": ".google.longrunning.Operation", + "resultType": ".google.cloud.retail.v2.ListControlsResponse", "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2.CompletionServiceClient" + "shortName": "ControlServiceClient", + "fullName": "google.cloud.retail.v2.ControlServiceClient" }, "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "shortName": "ListControls", + "fullName": "google.cloud.retail.v2.ControlService.ListControls", "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2.CompletionService" + "shortName": "ControlService", + "fullName": "google.cloud.retail.v2.ControlService" } } } @@ -618,7 +1146,7 @@ "segments": [ { "start": 25, - "end": 94, + "end": 90, "type": "FULL" } ], @@ -675,7 +1203,7 @@ "regionTag": "retail_v2_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][]s associated with the stale updates will not be marked as [done][Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", @@ -727,7 +1255,7 @@ "regionTag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][]s associated with the stale updates will not be marked as [done][Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", @@ -783,7 +1311,7 @@ "regionTag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][]s associated with the stale updates will not be marked as [done][Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", @@ -839,7 +1367,7 @@ "regionTag": "retail_v2_generated_ProductService_AddLocalInventories_async", "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][]s associated with the stale updates will not be marked as [done][Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", @@ -895,7 +1423,7 @@ "regionTag": "retail_v2_generated_ProductService_RemoveLocalInventories_async", "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][]s will be obsolete after 1 day, and [GetOperation][] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][]s associated with the stale updates will not be marked as [done][Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", @@ -954,7 +1482,7 @@ "segments": [ { "start": 25, - "end": 285, + "end": 295, "type": "FULL" } ], @@ -1063,6 +1591,314 @@ } } }, + { + "regionTag": "retail_v2_generated_ServingConfigService_CreateServingConfig_async", + "title": "CatalogService createServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a FAILED_PRECONDITION error is returned.", + "canonical": true, + "file": "serving_config_service.create_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.CreateServingConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "serving_config", + "type": ".google.cloud.retail.v2.ServingConfig" + }, + { + "name": "serving_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "CreateServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.CreateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ServingConfigService_DeleteServingConfig_async", + "title": "CatalogService deleteServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.delete_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.DeleteServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "DeleteServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.DeleteServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ServingConfigService_UpdateServingConfig_async", + "title": "CatalogService updateServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ServingConfig.", + "canonical": true, + "file": "serving_config_service.update_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.UpdateServingConfig", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": ".google.cloud.retail.v2.ServingConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "UpdateServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.UpdateServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ServingConfigService_GetServingConfig_async", + "title": "CatalogService getServingConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", + "canonical": true, + "file": "serving_config_service.get_serving_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.GetServingConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "GetServingConfig", + "fullName": "google.cloud.retail.v2.ServingConfigService.GetServingConfig", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ServingConfigService_ListServingConfigs_async", + "title": "CatalogService listServingConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists all ServingConfigs linked to this catalog.", + "canonical": true, + "file": "serving_config_service.list_serving_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2.ServingConfigService.ListServingConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ListServingConfigsResponse", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "ListServingConfigs", + "fullName": "google.cloud.retail.v2.ServingConfigService.ListServingConfigs", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ServingConfigService_AddControl_async", + "title": "CatalogService addControl Sample", + "origin": "API_DEFINITION", + "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", + "canonical": true, + "file": "serving_config_service.add_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2.ServingConfigService.AddControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "AddControl", + "fullName": "google.cloud.retail.v2.ServingConfigService.AddControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, + { + "regionTag": "retail_v2_generated_ServingConfigService_RemoveControl_async", + "title": "CatalogService removeControl Sample", + "origin": "API_DEFINITION", + "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", + "canonical": true, + "file": "serving_config_service.remove_control.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2.ServingConfigService.RemoveControl", + "async": true, + "parameters": [ + { + "name": "serving_config", + "type": "TYPE_STRING" + }, + { + "name": "control_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2.ServingConfig", + "client": { + "shortName": "ServingConfigServiceClient", + "fullName": "google.cloud.retail.v2.ServingConfigServiceClient" + }, + "method": { + "shortName": "RemoveControl", + "fullName": "google.cloud.retail.v2.ServingConfigService.RemoveControl", + "service": { + "shortName": "ServingConfigService", + "fullName": "google.cloud.retail.v2.ServingConfigService" + } + } + } + }, { "regionTag": "retail_v2_generated_UserEventService_WriteUserEvent_async", "title": "CatalogService writeUserEvent Sample", @@ -1211,7 +2047,7 @@ "regionTag": "retail_v2_generated_UserEventService_ImportUserEvents_async", "title": "CatalogService importUserEvents Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " 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`.", "canonical": true, "file": "user_event_service.import_user_events.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index bb605c6d2a3..1035f584969 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class CatalogServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CatalogServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CatalogServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class CatalogServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class CatalogServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -168,18 +184,30 @@ export class CatalogServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -245,7 +273,7 @@ export class CatalogServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -285,6 +313,13 @@ export class CatalogServiceClient { 'updateCatalog', 'setDefaultBranch', 'getDefaultBranch', + 'getCompletionConfig', + 'updateCompletionConfig', + 'getAttributesConfig', + 'updateAttributesConfig', + 'addCatalogAttribute', + 'removeCatalogAttribute', + 'replaceCatalogAttribute', ]; for (const methodName of catalogServiceStubMethods) { const callPromise = this.catalogServiceStub.then( @@ -460,7 +495,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'catalog.name': request.catalog!.name || '', }); this.initialize(); @@ -495,94 +530,791 @@ export class CatalogServiceClient { * * More specifically: * - * * PredictionService will only return product IDs from branch {newBranch}. - * * SearchService will only return product IDs from branch {newBranch} - * (if branch is not explicitly set). - * * UserEventService will only join events with products from branch - * {newBranch}. + * * PredictionService will only return product IDs from branch {newBranch}. + * * SearchService will only return product IDs from branch {newBranch} + * (if branch is not explicitly set). + * * UserEventService will only join events with products from branch + * {newBranch}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * Full resource name of the catalog, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.branchId + * The final component of the resource name of a branch. + * + * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + * error is returned. + * + * If there are no sufficient active products in the targeted branch and + * {@link google.cloud.retail.v2.SetDefaultBranchRequest.force|force} is not set, a + * FAILED_PRECONDITION error is returned. + * @param {string} request.note + * Some note on this request, this can be retrieved by + * {@link google.cloud.retail.v2.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} + * before next valid default branch set occurs. + * + * This field must be a UTF-8 encoded string with a length limit of 1,000 + * characters. Otherwise, an INVALID_ARGUMENT error is returned. + * @param {boolean} request.force + * If set to true, it permits switching to a branch with + * {@link google.cloud.retail.v2.SetDefaultBranchRequest.branch_id|branch_id} even + * if it has no sufficient active products. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.set_default_branch.js + * region_tag:retail_v2_generated_CatalogService_SetDefaultBranch_async + */ + setDefaultBranch( + request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + setDefaultBranch( + request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + setDefaultBranch( + request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.ISetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultBranch(request, options, callback); + } + /** + * Get which branch is currently default branch set by + * {@link google.cloud.retail.v2.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} + * method under a specified parent catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.catalog + * The parent catalog resource name, such as + * `projects/* /locations/global/catalogs/default_catalog`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2.GetDefaultBranchResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.get_default_branch.js + * region_tag:retail_v2_generated_CatalogService_GetDefaultBranch_async + */ + getDefaultBranch( + request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + >; + getDefaultBranch( + request: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + callback: Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): void; + getDefaultBranch( + request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + | protos.google.cloud.retail.v2.IGetDefaultBranchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IGetDefaultBranchResponse, + protos.google.cloud.retail.v2.IGetDefaultBranchRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + catalog: request.catalog || '', + }); + this.initialize(); + return this.innerApiCalls.getDefaultBranch(request, options, callback); + } + /** + * Gets a {@link google.cloud.retail.v2.CompletionConfig|CompletionConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full CompletionConfig resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompletionConfig]{@link google.cloud.retail.v2.CompletionConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.get_completion_config.js + * region_tag:retail_v2_generated_CatalogService_GetCompletionConfig_async + */ + getCompletionConfig( + request?: protos.google.cloud.retail.v2.IGetCompletionConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICompletionConfig, + protos.google.cloud.retail.v2.IGetCompletionConfigRequest | undefined, + {} | undefined + ] + >; + getCompletionConfig( + request: protos.google.cloud.retail.v2.IGetCompletionConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getCompletionConfig( + request: protos.google.cloud.retail.v2.IGetCompletionConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getCompletionConfig( + request?: protos.google.cloud.retail.v2.IGetCompletionConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IGetCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.ICompletionConfig, + protos.google.cloud.retail.v2.IGetCompletionConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getCompletionConfig(request, options, callback); + } + /** + * Updates the {@link google.cloud.retail.v2.CompletionConfig|CompletionConfig}s. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.CompletionConfig} request.completionConfig + * Required. The {@link google.cloud.retail.v2.CompletionConfig|CompletionConfig} + * to update. + * + * If the caller does not have permission to update the + * {@link google.cloud.retail.v2.CompletionConfig|CompletionConfig}, then a + * PERMISSION_DENIED error is returned. + * + * If the {@link google.cloud.retail.v2.CompletionConfig|CompletionConfig} to + * update does not exist, a NOT_FOUND error is returned. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.CompletionConfig|CompletionConfig} to update. The + * following are the only supported fields: + * + * * {@link google.cloud.retail.v2.CompletionConfig.matching_order|CompletionConfig.matching_order} + * * {@link google.cloud.retail.v2.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions} + * * {@link google.cloud.retail.v2.CompletionConfig.min_prefix_length|CompletionConfig.min_prefix_length} + * * {@link google.cloud.retail.v2.CompletionConfig.auto_learning|CompletionConfig.auto_learning} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CompletionConfig]{@link google.cloud.retail.v2.CompletionConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.update_completion_config.js + * region_tag:retail_v2_generated_CatalogService_UpdateCompletionConfig_async + */ + updateCompletionConfig( + request?: protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.ICompletionConfig, + protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest | undefined, + {} | undefined + ] + >; + updateCompletionConfig( + request: protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCompletionConfig( + request: protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCompletionConfig( + request?: protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.ICompletionConfig, + | protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.ICompletionConfig, + protos.google.cloud.retail.v2.IUpdateCompletionConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'completion_config.name': request.completionConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateCompletionConfig( + request, + options, + callback + ); + } + /** + * Gets an {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.get_attributes_config.js + * region_tag:retail_v2_generated_CatalogService_GetAttributesConfig_async + */ + getAttributesConfig( + request?: protos.google.cloud.retail.v2.IGetAttributesConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IGetAttributesConfigRequest | undefined, + {} | undefined + ] + >; + getAttributesConfig( + request: protos.google.cloud.retail.v2.IGetAttributesConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAttributesConfig( + request: protos.google.cloud.retail.v2.IGetAttributesConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAttributesConfig( + request?: protos.google.cloud.retail.v2.IGetAttributesConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IGetAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IGetAttributesConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAttributesConfig(request, options, callback); + } + /** + * Updates the {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig}. + * + * The catalog attributes in the request will be updated in the catalog, or + * inserted if they do not exist. Existing catalog attributes not included in + * the request will remain unchanged. Attributes that are assigned to + * products, but do not exist at the catalog level, are always included in the + * response. The product attribute is assigned default values for missing + * catalog attribute fields, e.g., searchable and dynamic facetable options. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.AttributesConfig} request.attributesConfig + * Required. The {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig} + * to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig} to update. The + * following is the only supported field: + * + * * {@link google.cloud.retail.v2.AttributesConfig.catalog_attributes|AttributesConfig.catalog_attributes} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.update_attributes_config.js + * region_tag:retail_v2_generated_CatalogService_UpdateAttributesConfig_async + */ + updateAttributesConfig( + request?: protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest | undefined, + {} | undefined + ] + >; + updateAttributesConfig( + request: protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAttributesConfig( + request: protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAttributesConfig( + request?: protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IUpdateAttributesConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'attributes_config.name': request.attributesConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAttributesConfig( + request, + options, + callback + ); + } + /** + * Adds the specified + * {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} to the + * {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig}. + * + * If the {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} to add + * already exists, an ALREADY_EXISTS error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @param {google.cloud.retail.v2.CatalogAttribute} request.catalogAttribute + * Required. The {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} + * to add. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2.AttributesConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/catalog_service.add_catalog_attribute.js + * region_tag:retail_v2_generated_CatalogService_AddCatalogAttribute_async + */ + addCatalogAttribute( + request?: protos.google.cloud.retail.v2.IAddCatalogAttributeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IAddCatalogAttributeRequest | undefined, + {} | undefined + ] + >; + addCatalogAttribute( + request: protos.google.cloud.retail.v2.IAddCatalogAttributeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + addCatalogAttribute( + request: protos.google.cloud.retail.v2.IAddCatalogAttributeRequest, + callback: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + addCatalogAttribute( + request?: protos.google.cloud.retail.v2.IAddCatalogAttributeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IAddCatalogAttributeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IAddCatalogAttributeRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + attributes_config: request.attributesConfig || '', + }); + this.initialize(); + return this.innerApiCalls.addCatalogAttribute(request, options, callback); + } + /** + * Removes the specified + * {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} from the + * {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig}. + * + * If the {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} to + * remove does not exist, a NOT_FOUND error is returned. * * @param {Object} request * The request object that will be sent. - * @param {string} request.catalog - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.branchId - * The final component of the resource name of a branch. - * - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * - * If there are no sufficient active products in the targeted branch and - * {@link google.cloud.retail.v2.SetDefaultBranchRequest.force|force} is not set, a - * FAILED_PRECONDITION error is returned. - * @param {string} request.note - * Some note on this request, this can be retrieved by - * {@link google.cloud.retail.v2.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} - * before next valid default branch set occurs. - * - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {boolean} request.force - * If set to true, it permits switching to a branch with - * {@link google.cloud.retail.v2.SetDefaultBranchRequest.branch_id|branch_id} even - * if it has no sufficient active products. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @param {string} request.key + * Required. The attribute name key of the + * {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} to remove. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2.AttributesConfig}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v2/catalog_service.set_default_branch.js - * region_tag:retail_v2_generated_CatalogService_SetDefaultBranch_async + * @example include:samples/generated/v2/catalog_service.remove_catalog_attribute.js + * region_tag:retail_v2_generated_CatalogService_RemoveCatalogAttribute_async */ - setDefaultBranch( - request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + removeCatalogAttribute( + request?: protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest, options?: CallOptions ): Promise< [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest | undefined, {} | undefined ] >; - setDefaultBranch( - request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + removeCatalogAttribute( + request: protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest, options: CallOptions, callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest + | null + | undefined, {} | null | undefined > ): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + removeCatalogAttribute( + request: protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest, callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest + | null + | undefined, {} | null | undefined > ): void; - setDefaultBranch( - request?: protos.google.cloud.retail.v2.ISetDefaultBranchRequest, + removeCatalogAttribute( + request?: protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest, optionsOrCallback?: | CallOptions | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.retail.v2.ISetDefaultBranchRequest + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest | null | undefined, {} | null | undefined >, callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | null | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest + | null + | undefined, {} | null | undefined > ): Promise< [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2.ISetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IRemoveCatalogAttributeRequest | undefined, {} | undefined ] > | void { @@ -598,79 +1330,105 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - catalog: request.catalog || '', + this._gaxModule.routingHeader.fromParams({ + attributes_config: request.attributesConfig || '', }); this.initialize(); - return this.innerApiCalls.setDefaultBranch(request, options, callback); + return this.innerApiCalls.removeCatalogAttribute( + request, + options, + callback + ); } /** - * Get which branch is currently default branch set by - * {@link google.cloud.retail.v2.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. + * Replaces the specified + * {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} in the + * {@link google.cloud.retail.v2.AttributesConfig|AttributesConfig} by updating the + * catalog attribute with the same + * {@link google.cloud.retail.v2.CatalogAttribute.key|CatalogAttribute.key}. + * + * If the {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} to + * replace does not exist, a NOT_FOUND error is returned. * * @param {Object} request * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. + * @param {string} request.attributesConfig + * Required. Full AttributesConfig resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @param {google.cloud.retail.v2.CatalogAttribute} request.catalogAttribute + * Required. The updated + * {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute}. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.CatalogAttribute|CatalogAttribute} to update. The + * following are NOT supported: + * + * * {@link google.cloud.retail.v2.CatalogAttribute.key|CatalogAttribute.key} + * + * If not set, all supported fields are updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GetDefaultBranchResponse]{@link google.cloud.retail.v2.GetDefaultBranchResponse}. + * The first element of the array is an object representing [AttributesConfig]{@link google.cloud.retail.v2.AttributesConfig}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v2/catalog_service.get_default_branch.js - * region_tag:retail_v2_generated_CatalogService_GetDefaultBranch_async + * @example include:samples/generated/v2/catalog_service.replace_catalog_attribute.js + * region_tag:retail_v2_generated_CatalogService_ReplaceCatalogAttribute_async */ - getDefaultBranch( - request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request?: protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest, options?: CallOptions ): Promise< [ - protos.google.cloud.retail.v2.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2.IGetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest | undefined, {} | undefined ] >; - getDefaultBranch( - request: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request: protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest, options: CallOptions, callback: Callback< - protos.google.cloud.retail.v2.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest + | null + | undefined, {} | null | undefined > ): void; - getDefaultBranch( - request: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request: protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest, callback: Callback< - protos.google.cloud.retail.v2.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest + | null + | undefined, {} | null | undefined > ): void; - getDefaultBranch( - request?: protos.google.cloud.retail.v2.IGetDefaultBranchRequest, + replaceCatalogAttribute( + request?: protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest, optionsOrCallback?: | CallOptions | Callback< - protos.google.cloud.retail.v2.IGetDefaultBranchResponse, - | protos.google.cloud.retail.v2.IGetDefaultBranchRequest + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest | null | undefined, {} | null | undefined >, callback?: Callback< - protos.google.cloud.retail.v2.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2.IGetDefaultBranchRequest | null | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + | protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest + | null + | undefined, {} | null | undefined > ): Promise< [ - protos.google.cloud.retail.v2.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2.IGetDefaultBranchRequest | undefined, + protos.google.cloud.retail.v2.IAttributesConfig, + protos.google.cloud.retail.v2.IReplaceCatalogAttributeRequest | undefined, {} | undefined ] > | void { @@ -686,11 +1444,15 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - catalog: request.catalog || '', + this._gaxModule.routingHeader.fromParams({ + attributes_config: request.attributesConfig || '', }); this.initialize(); - return this.innerApiCalls.getDefaultBranch(request, options, callback); + return this.innerApiCalls.replaceCatalogAttribute( + request, + options, + callback + ); } /** @@ -798,7 +1560,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -854,7 +1616,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listCatalogs']; @@ -919,7 +1681,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listCatalogs']; @@ -1192,6 +1954,61 @@ export class CatalogServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -1308,6 +2125,128 @@ export class CatalogServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified location resource name string. * @@ -1425,6 +2364,77 @@ export class CatalogServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json index dd5a76fae17..407c2a8de65 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_client_config.json @@ -48,6 +48,41 @@ "timeout_millis": 5000, "retry_codes_name": "idempotent", "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "GetCompletionConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "UpdateCompletionConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "GetAttributesConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "UpdateAttributesConfig": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "AddCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "RemoveCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, + "ReplaceCatalogAttribute": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" } } } diff --git a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json index dd7dfb7a71b..cd900335805 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/catalog_service_proto_list.json @@ -3,6 +3,8 @@ "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", @@ -10,6 +12,8 @@ "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index eabd1c74f8f..e72cf1f0dff 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -37,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './completion_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -102,8 +101,18 @@ export class CompletionServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CompletionServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CompletionServiceClient; const servicePath = @@ -123,8 +132,13 @@ export class CompletionServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -145,7 +159,10 @@ export class CompletionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -169,12 +186,24 @@ export class CompletionServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -241,7 +270,7 @@ export class CompletionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -428,7 +457,8 @@ export class CompletionServiceClient { * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). * @param {number} request.maxSuggestions * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value {@link |CompletionConfig.max_suggestions}. + * to the configured value + * {@link google.cloud.retail.v2.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions}. * * The maximum allowed max suggestions is 20. If it is set higher, it will be * capped by 20. @@ -504,7 +534,7 @@ export class CompletionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -532,8 +562,8 @@ export class CompletionServiceClient { * Required. The desired input location of the data. * @param {string} request.notificationPubsubTopic * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * {@link google.longrunning.Operation|Operation}. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * @param {object} [options] @@ -626,7 +656,7 @@ export class CompletionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -652,11 +682,12 @@ export class CompletionServiceClient { protos.google.cloud.retail.v2.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importCompletionData, this._gaxModule.createDefaultBackoffSettings() @@ -927,6 +958,61 @@ export class CompletionServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -976,6 +1062,128 @@ export class CompletionServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1057,6 +1265,77 @@ export class CompletionServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json index dd7dfb7a71b..cd900335805 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/completion_service_proto_list.json @@ -3,6 +3,8 @@ "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", @@ -10,6 +12,8 @@ "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/control_service_client.ts b/packages/google-cloud-retail/src/v2/control_service_client.ts new file mode 100644 index 00000000000..9aa011ee197 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/control_service_client.ts @@ -0,0 +1,1633 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/control_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './control_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for modifying Control. + * @class + * @memberof v2 + */ +export class ControlServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + controlServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ControlServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ControlServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ControlServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listControls: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'controls' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.ControlService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.controlServiceStub) { + return this.controlServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.ControlService. + this.controlServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.ControlService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.ControlService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const controlServiceStubMethods = [ + 'createControl', + 'deleteControl', + 'updateControl', + 'getControl', + 'listControls', + ]; + for (const methodName of controlServiceStubMethods) { + const callPromise = this.controlServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.controlServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a Control. + * + * If the {@link google.cloud.retail.v2.Control|Control} to create already exists, + * an ALREADY_EXISTS error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full resource name of parent catalog. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {google.cloud.retail.v2.Control} request.control + * Required. The Control to create. + * @param {string} request.controlId + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-_/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/control_service.create_control.js + * region_tag:retail_v2_generated_ControlService_CreateControl_async + */ + createControl( + request?: protos.google.cloud.retail.v2.ICreateControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.ICreateControlRequest | undefined, + {} | undefined + ] + >; + createControl( + request: protos.google.cloud.retail.v2.ICreateControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.ICreateControlRequest | null | undefined, + {} | null | undefined + > + ): void; + createControl( + request: protos.google.cloud.retail.v2.ICreateControlRequest, + callback: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.ICreateControlRequest | null | undefined, + {} | null | undefined + > + ): void; + createControl( + request?: protos.google.cloud.retail.v2.ICreateControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IControl, + | protos.google.cloud.retail.v2.ICreateControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.ICreateControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.ICreateControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createControl(request, options, callback); + } + /** + * Deletes a Control. + * + * If the {@link google.cloud.retail.v2.Control|Control} to delete does not exist, + * a NOT_FOUND error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/control_service.delete_control.js + * region_tag:retail_v2_generated_ControlService_DeleteControl_async + */ + deleteControl( + request?: protos.google.cloud.retail.v2.IDeleteControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteControlRequest | undefined, + {} | undefined + ] + >; + deleteControl( + request: protos.google.cloud.retail.v2.IDeleteControlRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteControlRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteControl( + request: protos.google.cloud.retail.v2.IDeleteControlRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteControlRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteControl( + request?: protos.google.cloud.retail.v2.IDeleteControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.IDeleteControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteControl(request, options, callback); + } + /** + * Updates a Control. + * + * {@link google.cloud.retail.v2.Control|Control} cannot be set to a different + * oneof field, if so an INVALID_ARGUMENT is returned. If the + * {@link google.cloud.retail.v2.Control|Control} to update does not exist, a + * NOT_FOUND error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.Control} request.control + * Required. The Control to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.Control|Control} to update. The following are NOT + * supported: + * + * * {@link google.cloud.retail.v2.Control.name|Control.name} + * + * If not set or empty, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/control_service.update_control.js + * region_tag:retail_v2_generated_ControlService_UpdateControl_async + */ + updateControl( + request?: protos.google.cloud.retail.v2.IUpdateControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IUpdateControlRequest | undefined, + {} | undefined + ] + >; + updateControl( + request: protos.google.cloud.retail.v2.IUpdateControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IUpdateControlRequest | null | undefined, + {} | null | undefined + > + ): void; + updateControl( + request: protos.google.cloud.retail.v2.IUpdateControlRequest, + callback: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IUpdateControlRequest | null | undefined, + {} | null | undefined + > + ): void; + updateControl( + request?: protos.google.cloud.retail.v2.IUpdateControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IControl, + | protos.google.cloud.retail.v2.IUpdateControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IUpdateControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IUpdateControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'control.name': request.control!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateControl(request, options, callback); + } + /** + * Gets a Control. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Control]{@link google.cloud.retail.v2.Control}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/control_service.get_control.js + * region_tag:retail_v2_generated_ControlService_GetControl_async + */ + getControl( + request?: protos.google.cloud.retail.v2.IGetControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IGetControlRequest | undefined, + {} | undefined + ] + >; + getControl( + request: protos.google.cloud.retail.v2.IGetControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): void; + getControl( + request: protos.google.cloud.retail.v2.IGetControlRequest, + callback: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): void; + getControl( + request?: protos.google.cloud.retail.v2.IGetControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IGetControlRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IGetControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IControl, + protos.google.cloud.retail.v2.IGetControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getControl(request, options, callback); + } + + /** + * Lists all Controls by their parent + * {@link google.cloud.retail.v2.Catalog|Catalog}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Control]{@link google.cloud.retail.v2.Control}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listControlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listControls( + request?: protos.google.cloud.retail.v2.IListControlsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IControl[], + protos.google.cloud.retail.v2.IListControlsRequest | null, + protos.google.cloud.retail.v2.IListControlsResponse + ] + >; + listControls( + request: protos.google.cloud.retail.v2.IListControlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListControlsRequest, + protos.google.cloud.retail.v2.IListControlsResponse | null | undefined, + protos.google.cloud.retail.v2.IControl + > + ): void; + listControls( + request: protos.google.cloud.retail.v2.IListControlsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListControlsRequest, + protos.google.cloud.retail.v2.IListControlsResponse | null | undefined, + protos.google.cloud.retail.v2.IControl + > + ): void; + listControls( + request?: protos.google.cloud.retail.v2.IListControlsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2.IListControlsRequest, + | protos.google.cloud.retail.v2.IListControlsResponse + | null + | undefined, + protos.google.cloud.retail.v2.IControl + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2.IListControlsRequest, + protos.google.cloud.retail.v2.IListControlsResponse | null | undefined, + protos.google.cloud.retail.v2.IControl + > + ): Promise< + [ + protos.google.cloud.retail.v2.IControl[], + protos.google.cloud.retail.v2.IListControlsRequest | null, + protos.google.cloud.retail.v2.IListControlsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listControls(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Control]{@link google.cloud.retail.v2.Control} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listControlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listControlsStream( + request?: protos.google.cloud.retail.v2.IListControlsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listControls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listControls.createStream( + this.innerApiCalls.listControls as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listControls`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @param {string} [request.filter] + * Optional. A filter to apply on the list results. Supported features: + * + * * List all the products under the parent branch if + * {@link google.cloud.retail.v2.ListControlsRequest.filter|filter} is unset. + * * List controls that are used in a single ServingConfig: + * 'serving_config = "boosted_home_page_cvr"' + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Control]{@link google.cloud.retail.v2.Control}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/control_service.list_controls.js + * region_tag:retail_v2_generated_ControlService_ListControls_async + */ + listControlsAsync( + request?: protos.google.cloud.retail.v2.IListControlsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listControls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listControls.asyncIterate( + this.innerApiCalls['listControls'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.controlServiceStub && !this._terminated) { + return this.controlServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/control_service_client_config.json b/packages/google-cloud-retail/src/v2/control_service_client_config.json new file mode 100644 index 00000000000..004c29452fe --- /dev/null +++ b/packages/google-cloud-retail/src/v2/control_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.retail.v2.ControlService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListControls": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/control_service_proto_list.json b/packages/google-cloud-retail/src/v2/control_service_proto_list.json new file mode 100644 index 00000000000..cd900335805 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/control_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/gapic_metadata.json b/packages/google-cloud-retail/src/v2/gapic_metadata.json index e2fe1b36649..63577bc31d6 100644 --- a/packages/google-cloud-retail/src/v2/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2/gapic_metadata.json @@ -25,6 +25,41 @@ "getDefaultBranch" ] }, + "GetCompletionConfig": { + "methods": [ + "getCompletionConfig" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "updateCompletionConfig" + ] + }, + "GetAttributesConfig": { + "methods": [ + "getAttributesConfig" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "updateAttributesConfig" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "addCatalogAttribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "removeCatalogAttribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replaceCatalogAttribute" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -52,6 +87,41 @@ "getDefaultBranch" ] }, + "GetCompletionConfig": { + "methods": [ + "getCompletionConfig" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "updateCompletionConfig" + ] + }, + "GetAttributesConfig": { + "methods": [ + "getAttributesConfig" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "updateAttributesConfig" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "addCatalogAttribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "removeCatalogAttribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replaceCatalogAttribute" + ] + }, "ListCatalogs": { "methods": [ "listCatalogs", @@ -97,6 +167,74 @@ } } }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls", + "listControlsStream", + "listControlsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ControlServiceClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls", + "listControlsStream", + "listControlsAsync" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -277,6 +415,94 @@ } } }, + "ServingConfigService": { + "clients": { + "grpc": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "createServingConfig" + ] + }, + "DeleteServingConfig": { + "methods": [ + "deleteServingConfig" + ] + }, + "UpdateServingConfig": { + "methods": [ + "updateServingConfig" + ] + }, + "GetServingConfig": { + "methods": [ + "getServingConfig" + ] + }, + "AddControl": { + "methods": [ + "addControl" + ] + }, + "RemoveControl": { + "methods": [ + "removeControl" + ] + }, + "ListServingConfigs": { + "methods": [ + "listServingConfigs", + "listServingConfigsStream", + "listServingConfigsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ServingConfigServiceClient", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "createServingConfig" + ] + }, + "DeleteServingConfig": { + "methods": [ + "deleteServingConfig" + ] + }, + "UpdateServingConfig": { + "methods": [ + "updateServingConfig" + ] + }, + "GetServingConfig": { + "methods": [ + "getServingConfig" + ] + }, + "AddControl": { + "methods": [ + "addControl" + ] + }, + "RemoveControl": { + "methods": [ + "removeControl" + ] + }, + "ListServingConfigs": { + "methods": [ + "listServingConfigs", + "listServingConfigsStream", + "listServingConfigsAsync" + ] + } + } + } + } + }, "UserEventService": { "clients": { "grpc": { diff --git a/packages/google-cloud-retail/src/v2/index.ts b/packages/google-cloud-retail/src/v2/index.ts index 79cde8aa80a..a7e4f6ba79f 100644 --- a/packages/google-cloud-retail/src/v2/index.ts +++ b/packages/google-cloud-retail/src/v2/index.ts @@ -18,7 +18,9 @@ export {CatalogServiceClient} from './catalog_service_client'; export {CompletionServiceClient} from './completion_service_client'; +export {ControlServiceClient} from './control_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; export {SearchServiceClient} from './search_service_client'; +export {ServingConfigServiceClient} from './serving_config_service_client'; export {UserEventServiceClient} from './user_event_service_client'; diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 1c6643737b1..78ba755273c 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -36,7 +36,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -98,8 +97,18 @@ export class PredictionServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new PredictionServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof PredictionServiceClient; const servicePath = @@ -119,8 +128,13 @@ export class PredictionServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -141,7 +155,10 @@ export class PredictionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -165,12 +182,24 @@ export class PredictionServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -225,7 +254,7 @@ export class PredictionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -544,7 +573,7 @@ export class PredictionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); this.initialize(); @@ -812,6 +841,61 @@ export class PredictionServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -861,6 +945,128 @@ export class PredictionServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -942,6 +1148,77 @@ export class PredictionServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json index dd7dfb7a71b..cd900335805 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/prediction_service_proto_list.json @@ -3,6 +3,8 @@ "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", @@ -10,6 +12,8 @@ "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 6e9d68e8378..0c78a503849 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -30,7 +30,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -40,7 +39,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './product_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -103,8 +101,18 @@ export class ProductServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ProductServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ProductServiceClient; const servicePath = @@ -124,8 +132,13 @@ export class ProductServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -146,7 +159,10 @@ export class ProductServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -170,15 +186,27 @@ export class ProductServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -319,7 +347,7 @@ export class ProductServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -550,7 +578,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -642,7 +670,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -753,7 +781,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'product.name': request.product!.name || '', }); this.initialize(); @@ -858,7 +886,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -889,29 +917,24 @@ export class ProductServiceClient { * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig * The desired location of errors incurred during the Import. * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided imported 'products' to update. If - * not set, will by default update all fields. + * Indicates which fields in the provided imported `products` to update. If + * not set, all fields are updated. * @param {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} request.reconciliationMode * The mode of reconciliation between existing products and the products to be * imported. Defaults to * {@link google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * {@link google.longrunning.Operation|Operation}. * * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has * to be within the same project as * {@link google.cloud.retail.v2.ImportProductsRequest.parent|ImportProductsRequest.parent}. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * - * Only supported when - * {@link google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. + * Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + * `pubsub.topics.publish` IAM permission on the topic. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1002,7 +1025,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1028,11 +1051,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importProducts, this._gaxModule.createDefaultBackoffSettings() @@ -1084,6 +1108,13 @@ export class ProductServiceClient { * and * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. * + * The returned {@link |Operation}s will be obsolete after 1 day, and + * {@link |GetOperation} API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the {@link |Operation}s associated with the + * stale updates will not be marked as {@link Operation.done|done} until being + * obsolete. + * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1257,7 +1288,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'inventory.name': request.inventory!.name || '', }); this.initialize(); @@ -1283,11 +1314,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.SetInventoryMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.setInventory, this._gaxModule.createDefaultBackoffSettings() @@ -1311,6 +1343,13 @@ export class ProductServiceClient { * or * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * + * The returned {@link |Operation}s will be obsolete after 1 day, and + * {@link |GetOperation} API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the {@link |Operation}s associated with the + * stale updates will not be marked as {@link Operation.done|done} until being + * obsolete. + * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1462,7 +1501,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1488,11 +1527,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.AddFulfillmentPlacesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.addFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings() @@ -1516,6 +1556,13 @@ export class ProductServiceClient { * or * {@link google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * + * The returned {@link |Operation}s will be obsolete after 1 day, and + * {@link |GetOperation} API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the {@link |Operation}s associated with the + * stale updates will not be marked as {@link Operation.done|done} until being + * obsolete. + * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1662,7 +1709,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1692,11 +1739,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.removeFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings() @@ -1727,6 +1775,13 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * + * The returned {@link |Operation}s will be obsolete after 1 day, and + * {@link |GetOperation} API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the {@link |Operation}s associated with the + * stale updates will not be marked as {@link Operation.done|done} until being + * obsolete. + * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -1860,7 +1915,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1886,11 +1941,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.AddLocalInventoriesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.addLocalInventories, this._gaxModule.createDefaultBackoffSettings() @@ -1919,6 +1975,13 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * + * The returned {@link |Operation}s will be obsolete after 1 day, and + * {@link |GetOperation} API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the {@link |Operation}s associated with the + * stale updates will not be marked as {@link Operation.done|done} until being + * obsolete. + * * This feature is only available for users who have Retail Search enabled. * Please enable Retail Search on Cloud Console before using this feature. * @@ -2036,7 +2099,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -2066,11 +2129,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2.RemoveLocalInventoriesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.removeLocalInventories, this._gaxModule.createDefaultBackoffSettings() @@ -2233,7 +2297,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -2338,7 +2402,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listProducts']; @@ -2452,7 +2516,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listProducts']; @@ -2725,6 +2789,61 @@ export class ProductServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -2841,6 +2960,128 @@ export class ProductServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -2922,6 +3163,77 @@ export class ProductServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2/product_service_proto_list.json b/packages/google-cloud-retail/src/v2/product_service_proto_list.json index dd7dfb7a71b..cd900335805 100644 --- a/packages/google-cloud-retail/src/v2/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/product_service_proto_list.json @@ -3,6 +3,8 @@ "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", @@ -10,6 +12,8 @@ "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 83c19b0ec52..760e3e3584a 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -104,8 +102,18 @@ export class SearchServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SearchServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SearchServiceClient; const servicePath = @@ -125,8 +133,13 @@ export class SearchServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -147,7 +160,10 @@ export class SearchServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -171,15 +187,27 @@ export class SearchServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), branchPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -245,7 +273,7 @@ export class SearchServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -473,7 +501,9 @@ export class SearchServiceClient { * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). * - * Notice that if both {@link |ServingConfig.boost_control_ids} and + * Notice that if both + * {@link google.cloud.retail.v2.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} * are set, the boost conditions from both places are evaluated. If a search * request matches multiple boost conditions, the final boost score is equal @@ -571,6 +601,15 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * + * Notice that if both + * {@link google.cloud.retail.v2.ServingConfig.personalization_spec|ServingConfig.personalization_spec} + * and + * {@link google.cloud.retail.v2.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * are set. + * {@link google.cloud.retail.v2.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * will override + * {@link google.cloud.retail.v2.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -665,7 +704,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); this.initialize(); @@ -777,7 +816,9 @@ export class SearchServiceClient { * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). * - * Notice that if both {@link |ServingConfig.boost_control_ids} and + * Notice that if both + * {@link google.cloud.retail.v2.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} * are set, the boost conditions from both places are evaluated. If a search * request matches multiple boost conditions, the final boost score is equal @@ -875,6 +916,15 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * + * Notice that if both + * {@link google.cloud.retail.v2.ServingConfig.personalization_spec|ServingConfig.personalization_spec} + * and + * {@link google.cloud.retail.v2.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * are set. + * {@link google.cloud.retail.v2.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * will override + * {@link google.cloud.retail.v2.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -917,7 +967,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); const defaultCallSettings = this._defaults['search']; @@ -1037,7 +1087,9 @@ export class SearchServiceClient { * Boost specification to boost certain products. See more details at this * [user guide](https://cloud.google.com/retail/docs/boosting). * - * Notice that if both {@link |ServingConfig.boost_control_ids} and + * Notice that if both + * {@link google.cloud.retail.v2.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} + * and * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} * are set, the boost conditions from both places are evaluated. If a search * request matches multiple boost conditions, the final boost score is equal @@ -1135,6 +1187,15 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * + * Notice that if both + * {@link google.cloud.retail.v2.ServingConfig.personalization_spec|ServingConfig.personalization_spec} + * and + * {@link google.cloud.retail.v2.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * are set. + * {@link google.cloud.retail.v2.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * will override + * {@link google.cloud.retail.v2.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -1178,7 +1239,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); const defaultCallSettings = this._defaults['search']; @@ -1451,6 +1512,61 @@ export class SearchServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified branch resource name string. * @@ -1567,6 +1683,128 @@ export class SearchServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1648,6 +1886,77 @@ export class SearchServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2/search_service_proto_list.json b/packages/google-cloud-retail/src/v2/search_service_proto_list.json index dd7dfb7a71b..cd900335805 100644 --- a/packages/google-cloud-retail/src/v2/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/search_service_proto_list.json @@ -3,6 +3,8 @@ "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", @@ -10,6 +12,8 @@ "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2/serving_config_service_client.ts new file mode 100644 index 00000000000..3ddd9a7772a --- /dev/null +++ b/packages/google-cloud-retail/src/v2/serving_config_service_client.ts @@ -0,0 +1,1824 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/serving_config_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './serving_config_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for modifying ServingConfig. + * @class + * @memberof v2 + */ +export class ServingConfigServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + servingConfigServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ServingConfigServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ServingConfigServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ServingConfigServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServingConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'servingConfigs' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { + get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + }, + {get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'}, + {get: '/v2/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'}, + {get: '/v2/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + + this.descriptors.longrunning = {}; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2.ServingConfigService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.servingConfigServiceStub) { + return this.servingConfigServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2.ServingConfigService. + this.servingConfigServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2.ServingConfigService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2.ServingConfigService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const servingConfigServiceStubMethods = [ + 'createServingConfig', + 'deleteServingConfig', + 'updateServingConfig', + 'getServingConfig', + 'listServingConfigs', + 'addControl', + 'removeControl', + ]; + for (const methodName of servingConfigServiceStubMethods) { + const callPromise = this.servingConfigServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.servingConfigServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a ServingConfig. + * + * A maximum of 100 {@link google.cloud.retail.v2.ServingConfig|ServingConfig}s are + * allowed in a {@link google.cloud.retail.v2.Catalog|Catalog}, otherwise a + * FAILED_PRECONDITION error is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Full resource name of parent. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {google.cloud.retail.v2.ServingConfig} request.servingConfig + * Required. The ServingConfig to create. + * @param {string} request.servingConfigId + * Required. The ID to use for the ServingConfig, which will become the final + * component of the ServingConfig's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-_/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.create_serving_config.js + * region_tag:retail_v2_generated_ServingConfigService_CreateServingConfig_async + */ + createServingConfig( + request?: protos.google.cloud.retail.v2.ICreateServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.ICreateServingConfigRequest | undefined, + {} | undefined + ] + >; + createServingConfig( + request: protos.google.cloud.retail.v2.ICreateServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServingConfig( + request: protos.google.cloud.retail.v2.ICreateServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServingConfig( + request?: protos.google.cloud.retail.v2.ICreateServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.ICreateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.ICreateServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createServingConfig(request, options, callback); + } + /** + * Deletes a ServingConfig. + * + * Returns a NotFound error if the ServingConfig does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ServingConfig to delete. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.delete_serving_config.js + * region_tag:retail_v2_generated_ServingConfigService_DeleteServingConfig_async + */ + deleteServingConfig( + request?: protos.google.cloud.retail.v2.IDeleteServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteServingConfigRequest | undefined, + {} | undefined + ] + >; + deleteServingConfig( + request: protos.google.cloud.retail.v2.IDeleteServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServingConfig( + request: protos.google.cloud.retail.v2.IDeleteServingConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServingConfig( + request?: protos.google.cloud.retail.v2.IDeleteServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2.IDeleteServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2.IDeleteServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteServingConfig(request, options, callback); + } + /** + * Updates a ServingConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2.ServingConfig} request.servingConfig + * Required. The ServingConfig to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Indicates which fields in the provided + * {@link google.cloud.retail.v2.ServingConfig|ServingConfig} to update. The + * following are NOT supported: + * + * * {@link google.cloud.retail.v2.ServingConfig.name|ServingConfig.name} + * + * If not set, all supported fields are updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.update_serving_config.js + * region_tag:retail_v2_generated_ServingConfigService_UpdateServingConfig_async + */ + updateServingConfig( + request?: protos.google.cloud.retail.v2.IUpdateServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IUpdateServingConfigRequest | undefined, + {} | undefined + ] + >; + updateServingConfig( + request: protos.google.cloud.retail.v2.IUpdateServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServingConfig( + request: protos.google.cloud.retail.v2.IUpdateServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServingConfig( + request?: protos.google.cloud.retail.v2.IUpdateServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.IUpdateServingConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IUpdateServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'serving_config.name': request.servingConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateServingConfig(request, options, callback); + } + /** + * Gets a ServingConfig. + * + * Returns a NotFound error if the ServingConfig does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ServingConfig to get. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.get_serving_config.js + * region_tag:retail_v2_generated_ServingConfigService_GetServingConfig_async + */ + getServingConfig( + request?: protos.google.cloud.retail.v2.IGetServingConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IGetServingConfigRequest | undefined, + {} | undefined + ] + >; + getServingConfig( + request: protos.google.cloud.retail.v2.IGetServingConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IGetServingConfigRequest | null | undefined, + {} | null | undefined + > + ): void; + getServingConfig( + request: protos.google.cloud.retail.v2.IGetServingConfigRequest, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IGetServingConfigRequest | null | undefined, + {} | null | undefined + > + ): void; + getServingConfig( + request?: protos.google.cloud.retail.v2.IGetServingConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.IGetServingConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IGetServingConfigRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IGetServingConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getServingConfig(request, options, callback); + } + /** + * Enables a Control on the specified ServingConfig. + * The control is added in the last position of the list of controls + * it belongs to (e.g. if it's a facet spec control it will be applied + * in the last position of servingConfig.facetSpecIds) + * Returns a ALREADY_EXISTS error if the control has already been applied. + * Returns a FAILED_PRECONDITION error if the addition could exceed maximum + * number of control allowed for that type of control. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.servingConfig + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {string} request.controlId + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config - if id is not found a NOT_FOUND error is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.add_control.js + * region_tag:retail_v2_generated_ServingConfigService_AddControl_async + */ + addControl( + request?: protos.google.cloud.retail.v2.IAddControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IAddControlRequest | undefined, + {} | undefined + ] + >; + addControl( + request: protos.google.cloud.retail.v2.IAddControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): void; + addControl( + request: protos.google.cloud.retail.v2.IAddControlRequest, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): void; + addControl( + request?: protos.google.cloud.retail.v2.IAddControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IAddControlRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IAddControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IAddControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + serving_config: request.servingConfig || '', + }); + this.initialize(); + return this.innerApiCalls.addControl(request, options, callback); + } + /** + * Disables a Control on the specified ServingConfig. + * The control is removed from the ServingConfig. + * Returns a NOT_FOUND error if the Control is not enabled for the + * ServingConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.servingConfig + * Required. The source ServingConfig resource name . Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * @param {string} request.controlId + * Required. The id of the control to apply. Assumed to be in the same catalog + * as the serving config. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.remove_control.js + * region_tag:retail_v2_generated_ServingConfigService_RemoveControl_async + */ + removeControl( + request?: protos.google.cloud.retail.v2.IRemoveControlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IRemoveControlRequest | undefined, + {} | undefined + ] + >; + removeControl( + request: protos.google.cloud.retail.v2.IRemoveControlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IRemoveControlRequest | null | undefined, + {} | null | undefined + > + ): void; + removeControl( + request: protos.google.cloud.retail.v2.IRemoveControlRequest, + callback: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IRemoveControlRequest | null | undefined, + {} | null | undefined + > + ): void; + removeControl( + request?: protos.google.cloud.retail.v2.IRemoveControlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2.IServingConfig, + | protos.google.cloud.retail.v2.IRemoveControlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IRemoveControlRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig, + protos.google.cloud.retail.v2.IRemoveControlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + serving_config: request.servingConfig || '', + }); + this.initialize(); + return this.innerApiCalls.removeControl(request, options, callback); + } + + /** + * Lists all ServingConfigs linked to this catalog. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServingConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServingConfigs( + request?: protos.google.cloud.retail.v2.IListServingConfigsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig[], + protos.google.cloud.retail.v2.IListServingConfigsRequest | null, + protos.google.cloud.retail.v2.IListServingConfigsResponse + ] + >; + listServingConfigs( + request: protos.google.cloud.retail.v2.IListServingConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListServingConfigsRequest, + | protos.google.cloud.retail.v2.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2.IServingConfig + > + ): void; + listServingConfigs( + request: protos.google.cloud.retail.v2.IListServingConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2.IListServingConfigsRequest, + | protos.google.cloud.retail.v2.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2.IServingConfig + > + ): void; + listServingConfigs( + request?: protos.google.cloud.retail.v2.IListServingConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2.IListServingConfigsRequest, + | protos.google.cloud.retail.v2.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2.IServingConfig + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2.IListServingConfigsRequest, + | protos.google.cloud.retail.v2.IListServingConfigsResponse + | null + | undefined, + protos.google.cloud.retail.v2.IServingConfig + > + ): Promise< + [ + protos.google.cloud.retail.v2.IServingConfig[], + protos.google.cloud.retail.v2.IListServingConfigsRequest | null, + protos.google.cloud.retail.v2.IListServingConfigsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listServingConfigs(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ServingConfig]{@link google.cloud.retail.v2.ServingConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServingConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServingConfigsStream( + request?: protos.google.cloud.retail.v2.IListServingConfigsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listServingConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServingConfigs.createStream( + this.innerApiCalls.listServingConfigs as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listServingConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The catalog resource name. Format: + * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 100. If a value greater than 100 is provided, at most 100 results are + * returned. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListServingConfigs` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ServingConfig]{@link google.cloud.retail.v2.ServingConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/serving_config_service.list_serving_configs.js + * region_tag:retail_v2_generated_ServingConfigService_ListServingConfigs_async + */ + listServingConfigsAsync( + request?: protos.google.cloud.retail.v2.IListServingConfigsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listServingConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServingConfigs.asyncIterate( + this.innerApiCalls['listServingConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.servingConfigServiceStub && !this._terminated) { + return this.servingConfigServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2/serving_config_service_client_config.json b/packages/google-cloud-retail/src/v2/serving_config_service_client_config.json new file mode 100644 index 00000000000..3f5419b8c62 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/serving_config_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.retail.v2.ServingConfigService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServingConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServingConfigs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RemoveControl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json b/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json new file mode 100644 index 00000000000..cd900335805 --- /dev/null +++ b/packages/google-cloud-retail/src/v2/serving_config_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/retail/v2/catalog.proto", + "../../protos/google/cloud/retail/v2/catalog_service.proto", + "../../protos/google/cloud/retail/v2/common.proto", + "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", + "../../protos/google/cloud/retail/v2/import_config.proto", + "../../protos/google/cloud/retail/v2/prediction_service.proto", + "../../protos/google/cloud/retail/v2/product.proto", + "../../protos/google/cloud/retail/v2/product_service.proto", + "../../protos/google/cloud/retail/v2/promotion.proto", + "../../protos/google/cloud/retail/v2/purge_config.proto", + "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", + "../../protos/google/cloud/retail/v2/user_event.proto", + "../../protos/google/cloud/retail/v2/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index 04a8bafc24e..dbdcc0f6e4c 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -37,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './user_event_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -99,8 +98,18 @@ export class UserEventServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new UserEventServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof UserEventServiceClient; const servicePath = @@ -120,8 +129,13 @@ export class UserEventServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -142,7 +156,10 @@ export class UserEventServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -166,12 +183,24 @@ export class UserEventServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), catalogPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}' ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -260,7 +289,7 @@ export class UserEventServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -466,7 +495,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -568,7 +597,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -705,7 +734,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -731,11 +760,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2.PurgeMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.purgeUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -750,9 +780,9 @@ export class UserEventServiceClient { * 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 + * `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. + * `Operation.metadata` is of type `ImportMetadata`. * * @param {Object} request * The request object that will be sent. @@ -853,7 +883,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -879,11 +909,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -1003,7 +1034,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1029,11 +1060,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2.RejoinUserEventsMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.rejoinUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -1304,6 +1336,61 @@ export class UserEventServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + /** * Return a fully-qualified catalog resource name string. * @@ -1353,6 +1440,128 @@ export class UserEventServiceClient { return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; } + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + /** * Return a fully-qualified product resource name string. * @@ -1434,6 +1643,77 @@ export class UserEventServiceClient { return this.pathTemplates.productPathTemplate.match(productName).product; } + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json index dd7dfb7a71b..cd900335805 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2/user_event_service_proto_list.json @@ -3,6 +3,8 @@ "../../protos/google/cloud/retail/v2/catalog_service.proto", "../../protos/google/cloud/retail/v2/common.proto", "../../protos/google/cloud/retail/v2/completion_service.proto", + "../../protos/google/cloud/retail/v2/control.proto", + "../../protos/google/cloud/retail/v2/control_service.proto", "../../protos/google/cloud/retail/v2/import_config.proto", "../../protos/google/cloud/retail/v2/prediction_service.proto", "../../protos/google/cloud/retail/v2/product.proto", @@ -10,6 +12,8 @@ "../../protos/google/cloud/retail/v2/promotion.proto", "../../protos/google/cloud/retail/v2/purge_config.proto", "../../protos/google/cloud/retail/v2/search_service.proto", + "../../protos/google/cloud/retail/v2/serving_config.proto", + "../../protos/google/cloud/retail/v2/serving_config_service.proto", "../../protos/google/cloud/retail/v2/user_event.proto", "../../protos/google/cloud/retail/v2/user_event_service.proto" ] diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index a4f3f690424..be57f7c8784 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class CatalogServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - */ - constructor(opts?: ClientOptions) { + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CatalogServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CatalogServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class CatalogServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class CatalogServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -260,7 +276,7 @@ export class CatalogServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -488,7 +504,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'catalog.name': request.catalog!.name || '', }); this.initialize(); @@ -632,7 +648,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -726,7 +742,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -824,7 +840,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -941,7 +957,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'completion_config.name': request.completionConfig!.name || '', }); this.initialize(); @@ -1043,7 +1059,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1157,7 +1173,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'attributes_config.name': request.attributesConfig!.name || '', }); this.initialize(); @@ -1267,7 +1283,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ attributes_config: request.attributesConfig || '', }); this.initialize(); @@ -1373,7 +1389,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ attributes_config: request.attributesConfig || '', }); this.initialize(); @@ -1493,7 +1509,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ attributes_config: request.attributesConfig || '', }); this.initialize(); @@ -1615,7 +1631,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1671,7 +1687,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listCatalogs']; @@ -1736,7 +1752,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listCatalogs']; diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index c5ae96988f4..0e7cddd1e88 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -37,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './completion_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -102,8 +101,18 @@ export class CompletionServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CompletionServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CompletionServiceClient; const servicePath = @@ -123,8 +132,13 @@ export class CompletionServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -145,7 +159,10 @@ export class CompletionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -256,7 +273,7 @@ export class CompletionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -526,7 +543,7 @@ export class CompletionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -648,7 +665,7 @@ export class CompletionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -674,11 +691,12 @@ export class CompletionServiceClient { protos.google.cloud.retail.v2alpha.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importCompletionData, this._gaxModule.createDefaultBackoffSettings() diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts index 115d3099ab1..334ff21b3b4 100644 --- a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './control_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class ControlServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ControlServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ControlServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class ControlServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class ControlServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -254,7 +270,7 @@ export class ControlServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -475,7 +491,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -570,7 +586,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -674,7 +690,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'control.name': request.control!.name || '', }); this.initialize(); @@ -760,7 +776,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -869,7 +885,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -917,7 +933,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listControls']; @@ -974,7 +990,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listControls']; diff --git a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts index 0fd3257016d..ff39dc08ade 100644 --- a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -30,7 +30,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -40,7 +39,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './model_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -113,8 +111,18 @@ export class ModelServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ModelServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ModelServiceClient; const servicePath = @@ -134,8 +142,13 @@ export class ModelServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -156,7 +169,10 @@ export class ModelServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -289,7 +305,7 @@ export class ModelServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -499,7 +515,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -586,7 +602,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -673,7 +689,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -763,7 +779,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'model.name': request.model!.name || '', }); this.initialize(); @@ -873,7 +889,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -899,11 +915,12 @@ export class ModelServiceClient { protos.google.cloud.retail.v2alpha.CreateModelMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createModel, this._gaxModule.createDefaultBackoffSettings() @@ -1012,7 +1029,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1038,11 +1055,12 @@ export class ModelServiceClient { protos.google.cloud.retail.v2alpha.TuneModelMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.tuneModel, this._gaxModule.createDefaultBackoffSettings() @@ -1142,7 +1160,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1184,7 +1202,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listModels']; @@ -1235,7 +1253,7 @@ export class ModelServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listModels']; diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index c2ebe0be460..7e752e3eaf5 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -36,7 +36,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -98,8 +97,18 @@ export class PredictionServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new PredictionServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof PredictionServiceClient; const servicePath = @@ -119,8 +128,13 @@ export class PredictionServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -141,7 +155,10 @@ export class PredictionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -240,7 +257,7 @@ export class PredictionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -559,7 +576,7 @@ export class PredictionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index 3e8adbe24f8..aea5c30754e 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -30,7 +30,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -40,7 +39,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './product_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -103,8 +101,18 @@ export class ProductServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - */ - constructor(opts?: ClientOptions) { + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ProductServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ProductServiceClient; const servicePath = @@ -124,8 +132,13 @@ export class ProductServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -146,7 +159,10 @@ export class ProductServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -345,7 +361,7 @@ export class ProductServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -583,7 +599,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -677,7 +693,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -794,7 +810,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'product.name': request.product!.name || '', }); this.initialize(); @@ -906,7 +922,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1073,7 +1089,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1099,11 +1115,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.PurgeProductsMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.purgeProducts, this._gaxModule.createDefaultBackoffSettings() @@ -1258,7 +1275,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1284,11 +1301,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importProducts, this._gaxModule.createDefaultBackoffSettings() @@ -1513,7 +1531,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'inventory.name': request.inventory!.name || '', }); this.initialize(); @@ -1539,11 +1557,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.SetInventoryMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.setInventory, this._gaxModule.createDefaultBackoffSettings() @@ -1718,7 +1737,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1744,11 +1763,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.addFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings() @@ -1918,7 +1938,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1948,11 +1968,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.removeFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings() @@ -2117,7 +2138,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -2143,11 +2164,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.addLocalInventories, this._gaxModule.createDefaultBackoffSettings() @@ -2293,7 +2315,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -2323,11 +2345,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.removeLocalInventories, this._gaxModule.createDefaultBackoffSettings() @@ -2506,7 +2529,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -2621,7 +2644,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listProducts']; @@ -2745,7 +2768,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listProducts']; diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index d83fe6d0618..b7d6f65a638 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -104,8 +102,18 @@ export class SearchServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SearchServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SearchServiceClient; const servicePath = @@ -125,8 +133,13 @@ export class SearchServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -147,7 +160,10 @@ export class SearchServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -260,7 +276,7 @@ export class SearchServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -701,7 +717,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); this.initialize(); @@ -974,7 +990,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); const defaultCallSettings = this._defaults['search']; @@ -1256,7 +1272,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); const defaultCallSettings = this._defaults['search']; diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts index 67dfe6090db..b60abbd17eb 100644 --- a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './serving_config_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class ServingConfigServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ServingConfigServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ServingConfigServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class ServingConfigServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class ServingConfigServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -254,7 +270,7 @@ export class ServingConfigServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -486,7 +502,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -586,7 +602,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -691,7 +707,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'serving_config.name': request.servingConfig!.name || '', }); this.initialize(); @@ -785,7 +801,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -880,7 +896,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ serving_config: request.servingConfig || '', }); this.initialize(); @@ -978,7 +994,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ serving_config: request.servingConfig || '', }); this.initialize(); @@ -1081,7 +1097,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1123,7 +1139,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listServingConfigs']; @@ -1174,7 +1190,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listServingConfigs']; diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index 7f4c4b28421..cc2acb53865 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -37,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './user_event_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -99,8 +98,18 @@ export class UserEventServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new UserEventServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof UserEventServiceClient; const servicePath = @@ -120,8 +129,13 @@ export class UserEventServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -142,7 +156,10 @@ export class UserEventServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -275,7 +292,7 @@ export class UserEventServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -487,7 +504,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -595,7 +612,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -733,7 +750,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -759,11 +776,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2alpha.PurgeMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.purgeUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -881,7 +899,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -907,11 +925,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2alpha.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -1031,7 +1050,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1057,11 +1076,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2alpha.RejoinUserEventsMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.rejoinUserEvents, this._gaxModule.createDefaultBackoffSettings() diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index adc959b94c3..95f7c1cc297 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './catalog_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class CatalogServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CatalogServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CatalogServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class CatalogServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class CatalogServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -257,7 +273,7 @@ export class CatalogServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -485,7 +501,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'catalog.name': request.catalog!.name || '', }); this.initialize(); @@ -629,7 +645,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -723,7 +739,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -815,7 +831,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -932,7 +948,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'completion_config.name': request.completionConfig!.name || '', }); this.initialize(); @@ -1028,7 +1044,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1142,7 +1158,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'attributes_config.name': request.attributesConfig!.name || '', }); this.initialize(); @@ -1246,7 +1262,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ attributes_config: request.attributesConfig || '', }); this.initialize(); @@ -1352,7 +1368,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ attributes_config: request.attributesConfig || '', }); this.initialize(); @@ -1472,7 +1488,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ attributes_config: request.attributesConfig || '', }); this.initialize(); @@ -1594,7 +1610,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1650,7 +1666,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listCatalogs']; @@ -1715,7 +1731,7 @@ export class CatalogServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listCatalogs']; diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index cafa859e713..6ec9214251e 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -37,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './completion_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -102,8 +101,18 @@ export class CompletionServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CompletionServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CompletionServiceClient; const servicePath = @@ -123,8 +132,13 @@ export class CompletionServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -145,7 +159,10 @@ export class CompletionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -253,7 +270,7 @@ export class CompletionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -523,7 +540,7 @@ export class CompletionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ catalog: request.catalog || '', }); this.initialize(); @@ -645,7 +662,7 @@ export class CompletionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -671,11 +688,12 @@ export class CompletionServiceClient { protos.google.cloud.retail.v2beta.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importCompletionData, this._gaxModule.createDefaultBackoffSettings() diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client.ts b/packages/google-cloud-retail/src/v2beta/control_service_client.ts index fb446de3637..a26f22149db 100644 --- a/packages/google-cloud-retail/src/v2beta/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/control_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './control_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class ControlServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ControlServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ControlServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class ControlServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class ControlServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -251,7 +267,7 @@ export class ControlServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -472,7 +488,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -567,7 +583,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -671,7 +687,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'control.name': request.control!.name || '', }); this.initialize(); @@ -757,7 +773,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -866,7 +882,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -914,7 +930,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listControls']; @@ -971,7 +987,7 @@ export class ControlServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listControls']; diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index 87b62347115..d45e499080a 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -36,7 +36,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './prediction_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -98,8 +97,18 @@ export class PredictionServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new PredictionServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof PredictionServiceClient; const servicePath = @@ -119,8 +128,13 @@ export class PredictionServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -141,7 +155,10 @@ export class PredictionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -237,7 +254,7 @@ export class PredictionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -556,7 +573,7 @@ export class PredictionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); this.initialize(); diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index af22deb4419..592f19c4059 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -30,7 +30,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -40,7 +39,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './product_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -103,8 +101,18 @@ export class ProductServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - */ - constructor(opts?: ClientOptions) { + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ProductServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ProductServiceClient; const servicePath = @@ -124,8 +132,13 @@ export class ProductServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -146,7 +159,10 @@ export class ProductServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -331,7 +347,7 @@ export class ProductServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -568,7 +584,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -662,7 +678,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -779,7 +795,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'product.name': request.product!.name || '', }); this.initialize(); @@ -891,7 +907,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1035,7 +1051,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1061,11 +1077,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importProducts, this._gaxModule.createDefaultBackoffSettings() @@ -1290,7 +1307,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'inventory.name': request.inventory!.name || '', }); this.initialize(); @@ -1316,11 +1333,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.SetInventoryMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.setInventory, this._gaxModule.createDefaultBackoffSettings() @@ -1495,7 +1513,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1521,11 +1539,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.AddFulfillmentPlacesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.addFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings() @@ -1695,7 +1714,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1725,11 +1744,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.removeFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings() @@ -1894,7 +1914,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -1920,11 +1940,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.AddLocalInventoriesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.addLocalInventories, this._gaxModule.createDefaultBackoffSettings() @@ -2070,7 +2091,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ product: request.product || '', }); this.initialize(); @@ -2100,11 +2121,12 @@ export class ProductServiceClient { protos.google.cloud.retail.v2beta.RemoveLocalInventoriesMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.removeLocalInventories, this._gaxModule.createDefaultBackoffSettings() @@ -2275,7 +2297,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -2382,7 +2404,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listProducts']; @@ -2498,7 +2520,7 @@ export class ProductServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listProducts']; diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index 4aa4ec66f98..ed36ffabda0 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './search_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -104,8 +102,18 @@ export class SearchServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SearchServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SearchServiceClient; const servicePath = @@ -125,8 +133,13 @@ export class SearchServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -147,7 +160,10 @@ export class SearchServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -257,7 +273,7 @@ export class SearchServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -679,7 +695,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); this.initialize(); @@ -933,7 +949,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); const defaultCallSettings = this._defaults['search']; @@ -1196,7 +1212,7 @@ export class SearchServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ placement: request.placement || '', }); const defaultCallSettings = this._defaults['search']; diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts index 6a8350d1d1f..8d20a942ccd 100644 --- a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -29,7 +29,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -39,7 +38,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './serving_config_service_client_config.json'; - const version = require('../../../package.json').version; /** @@ -101,8 +99,18 @@ export class ServingConfigServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ServingConfigServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ServingConfigServiceClient; const servicePath = @@ -122,8 +130,13 @@ export class ServingConfigServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -144,7 +157,10 @@ export class ServingConfigServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -251,7 +267,7 @@ export class ServingConfigServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -475,7 +491,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -569,7 +585,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -668,7 +684,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'serving_config.name': request.servingConfig!.name || '', }); this.initialize(); @@ -762,7 +778,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -857,7 +873,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ serving_config: request.servingConfig || '', }); this.initialize(); @@ -955,7 +971,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ serving_config: request.servingConfig || '', }); this.initialize(); @@ -1058,7 +1074,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1100,7 +1116,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listServingConfigs']; @@ -1151,7 +1167,7 @@ export class ServingConfigServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listServingConfigs']; diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index b3dc54bcd81..9f5ae621eb6 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -37,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './user_event_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -99,8 +98,18 @@ export class UserEventServiceClient { * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new UserEventServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof UserEventServiceClient; const servicePath = @@ -120,8 +129,13 @@ export class UserEventServiceClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -142,7 +156,10 @@ export class UserEventServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -272,7 +289,7 @@ export class UserEventServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -484,7 +501,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -592,7 +609,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -730,7 +747,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -756,11 +773,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2beta.PurgeMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.purgeUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -878,7 +896,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -904,11 +922,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2beta.ImportMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.importUserEvents, this._gaxModule.createDefaultBackoffSettings() @@ -1028,7 +1047,7 @@ export class UserEventServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1054,11 +1073,12 @@ export class UserEventServiceClient { protos.google.cloud.retail.v2beta.RejoinUserEventsMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.rejoinUserEvents, this._gaxModule.createDefaultBackoffSettings() diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index ed06b81df69..b803c83b7f8 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -594,6 +594,927 @@ describe('v2.CatalogServiceClient', () => { }); }); + describe('getCompletionConfig', () => { + it('invokes getCompletionConfig without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.CompletionConfig() + ); + client.innerApiCalls.getCompletionConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getCompletionConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getCompletionConfig without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.CompletionConfig() + ); + client.innerApiCalls.getCompletionConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCompletionConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.ICompletionConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getCompletionConfig with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getCompletionConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getCompletionConfig(request), expectedError); + assert( + (client.innerApiCalls.getCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getCompletionConfig with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetCompletionConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCompletionConfig(request), expectedError); + }); + }); + + describe('updateCompletionConfig', () => { + it('invokes updateCompletionConfig without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.CompletionConfig() + ); + client.innerApiCalls.updateCompletionConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateCompletionConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCompletionConfig without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.CompletionConfig() + ); + client.innerApiCalls.updateCompletionConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCompletionConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.ICompletionConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateCompletionConfig with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedHeaderRequestParams = 'completion_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCompletionConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateCompletionConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateCompletionConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateCompletionConfig with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() + ); + request.completionConfig = {}; + request.completionConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateCompletionConfig(request), + expectedError + ); + }); + }); + + describe('getAttributesConfig', () => { + it('invokes getAttributesConfig without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.getAttributesConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getAttributesConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAttributesConfig without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.getAttributesConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAttributesConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getAttributesConfig with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAttributesConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAttributesConfig(request), expectedError); + assert( + (client.innerApiCalls.getAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAttributesConfig with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetAttributesConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAttributesConfig(request), expectedError); + }); + }); + + describe('updateAttributesConfig', () => { + it('invokes updateAttributesConfig without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.updateAttributesConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateAttributesConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAttributesConfig without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.updateAttributesConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAttributesConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateAttributesConfig with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedHeaderRequestParams = 'attributes_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAttributesConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateAttributesConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateAttributesConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAttributesConfig with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() + ); + request.attributesConfig = {}; + request.attributesConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateAttributesConfig(request), + expectedError + ); + }); + }); + + describe('addCatalogAttribute', () => { + it('invokes addCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.addCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + assert( + (client.innerApiCalls.addCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + }); + }); + + describe('removeCatalogAttribute', () => { + it('invokes removeCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.removeCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); + assert( + (client.innerApiCalls.removeCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); + }); + }); + + describe('replaceCatalogAttribute', () => { + it('invokes replaceCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.replaceCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.replaceCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes replaceCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.AttributesConfig() + ); + client.innerApiCalls.replaceCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes replaceCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedHeaderRequestParams = 'attributes_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.replaceCatalogAttribute(request), + expectedError + ); + assert( + (client.innerApiCalls.replaceCatalogAttribute as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes replaceCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() + ); + request.attributesConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.replaceCatalogAttribute(request), + expectedError + ); + }); + }); + describe('listCatalogs', () => { it('invokes listCatalogs without error', async () => { const client = new catalogserviceModule.v2.CatalogServiceClient({ @@ -1369,6 +2290,73 @@ describe('v2.CatalogServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -1509,6 +2497,149 @@ describe('v2.CatalogServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('location', () => { const fakePath = '/rendered/path/location'; const expectedParameters = { @@ -1645,5 +2776,81 @@ describe('v2.CatalogServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new catalogserviceModule.v2.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index c026572998b..c1ed1417792 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -1027,6 +1027,73 @@ describe('v2.CompletionServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -1091,6 +1158,149 @@ describe('v2.CompletionServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -1178,5 +1388,81 @@ describe('v2.CompletionServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new completionserviceModule.v2.CompletionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2.ts b/packages/google-cloud-retail/test/gapic_control_service_v2.ts new file mode 100644 index 00000000000..3c8721aea0f --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_control_service_v2.ts @@ -0,0 +1,1936 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as controlserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ControlServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + controlserviceModule.v2.ControlServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + controlserviceModule.v2.ControlServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = controlserviceModule.v2.ControlServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new controlserviceModule.v2.ControlServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + await client.initialize(); + assert(client.controlServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.controlServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.controlServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createControl', () => { + it('invokes createControl without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Control() + ); + client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); + const [response] = await client.createControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createControl without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Control() + ); + client.innerApiCalls.createControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createControl with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateControlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createControl(request), expectedError); + assert( + (client.innerApiCalls.createControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createControl with closed client', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateControlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createControl(request), expectedError); + }); + }); + + describe('deleteControl', () => { + it('invokes deleteControl without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); + const [response] = await client.deleteControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteControl without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteControl( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteControl with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteControl(request), expectedError); + assert( + (client.innerApiCalls.deleteControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteControl with closed client', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteControlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteControl(request), expectedError); + }); + }); + + describe('updateControl', () => { + it('invokes updateControl without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Control() + ); + client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); + const [response] = await client.updateControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateControl without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Control() + ); + client.innerApiCalls.updateControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateControl with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedHeaderRequestParams = 'control.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateControl(request), expectedError); + assert( + (client.innerApiCalls.updateControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateControl with closed client', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateControlRequest() + ); + request.control = {}; + request.control.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateControl(request), expectedError); + }); + }); + + describe('getControl', () => { + it('invokes getControl without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Control() + ); + client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); + const [response] = await client.getControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getControl without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.Control() + ); + client.innerApiCalls.getControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IControl | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getControl with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetControlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getControl(request), expectedError); + assert( + (client.innerApiCalls.getControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getControl with closed client', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetControlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getControl(request), expectedError); + }); + }); + + describe('listControls', () => { + it('invokes listControls without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + ]; + client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); + const [response] = await client.listControls(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listControls without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + ]; + client.innerApiCalls.listControls = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listControls( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IControl[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listControls with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listControls = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listControls(request), expectedError); + assert( + (client.innerApiCalls.listControls as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listControlsStream without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + ]; + client.descriptors.page.listControls.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listControlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.Control[] = []; + stream.on('data', (response: protos.google.cloud.retail.v2.Control) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listControls, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listControlsStream with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listControls.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listControlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.Control[] = []; + stream.on('data', (response: protos.google.cloud.retail.v2.Control) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listControls, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listControls without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + generateSampleMessage(new protos.google.cloud.retail.v2.Control()), + ]; + client.descriptors.page.listControls.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2.IControl[] = []; + const iterable = client.listControlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listControls with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListControlsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listControls.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listControlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2.IControl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listControls.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new controlserviceModule.v2.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 466aee79dfd..40e544d3d44 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -793,6 +793,73 @@ describe('v2.PredictionServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -857,6 +924,149 @@ describe('v2.PredictionServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -944,5 +1154,81 @@ describe('v2.PredictionServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new predictionserviceModule.v2.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 516a55e15b4..920ebfb486a 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -2703,6 +2703,73 @@ describe('v2.ProductServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -2843,6 +2910,149 @@ describe('v2.ProductServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -2930,5 +3140,81 @@ describe('v2.ProductServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new productserviceModule.v2.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index ae72356aa5e..24a784ddc11 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -1020,6 +1020,73 @@ describe('v2.SearchServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('branch', () => { const fakePath = '/rendered/path/branch'; const expectedParameters = { @@ -1160,6 +1227,149 @@ describe('v2.SearchServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -1247,5 +1457,81 @@ describe('v2.SearchServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new searchserviceModule.v2.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts new file mode 100644 index 00000000000..fdb5f3a5103 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts @@ -0,0 +1,2281 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as servingconfigserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.ServingConfigServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + servingconfigserviceModule.v2.ServingConfigServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + servingconfigserviceModule.v2.ServingConfigServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + servingconfigserviceModule.v2.ServingConfigServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + await client.initialize(); + assert(client.servingConfigServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.servingConfigServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.servingConfigServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createServingConfig', () => { + it('invokes createServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.createServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.createServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.createServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createServingConfig(request), expectedError); + assert( + (client.innerApiCalls.createServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.CreateServingConfigRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createServingConfig(request), expectedError); + }); + }); + + describe('deleteServingConfig', () => { + it('invokes deleteServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteServingConfig(request), expectedError); + assert( + (client.innerApiCalls.deleteServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.DeleteServingConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteServingConfig(request), expectedError); + }); + }); + + describe('updateServingConfig', () => { + it('invokes updateServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.updateServingConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.updateServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedHeaderRequestParams = 'serving_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateServingConfig(request), expectedError); + assert( + (client.innerApiCalls.updateServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.UpdateServingConfigRequest() + ); + request.servingConfig = {}; + request.servingConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateServingConfig(request), expectedError); + }); + }); + + describe('getServingConfig', () => { + it('invokes getServingConfig without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getServingConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServingConfig without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.getServingConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServingConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getServingConfig with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetServingConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getServingConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getServingConfig(request), expectedError); + assert( + (client.innerApiCalls.getServingConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServingConfig with closed client', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.GetServingConfigRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getServingConfig(request), expectedError); + }); + }); + + describe('addControl', () => { + it('invokes addControl without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); + const [response] = await client.addControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addControl without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.addControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes addControl with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addControl(request), expectedError); + assert( + (client.innerApiCalls.addControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes addControl with closed client', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.AddControlRequest() + ); + request.servingConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addControl(request), expectedError); + }); + }); + + describe('removeControl', () => { + it('invokes removeControl without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); + const [response] = await client.removeControl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeControl without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ); + client.innerApiCalls.removeControl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeControl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IServingConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes removeControl with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedHeaderRequestParams = 'serving_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.removeControl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.removeControl(request), expectedError); + assert( + (client.innerApiCalls.removeControl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes removeControl with closed client', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.RemoveControlRequest() + ); + request.servingConfig = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.removeControl(request), expectedError); + }); + }); + + describe('listServingConfigs', () => { + it('invokes listServingConfigs without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + ]; + client.innerApiCalls.listServingConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listServingConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServingConfigs without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + ]; + client.innerApiCalls.listServingConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServingConfigs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2.IServingConfig[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listServingConfigs with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listServingConfigs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listServingConfigs(request), expectedError); + assert( + (client.innerApiCalls.listServingConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServingConfigsStream without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + ]; + client.descriptors.page.listServingConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServingConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.ServingConfig[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2.ServingConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServingConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listServingConfigsStream with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServingConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServingConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2.ServingConfig[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2.ServingConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServingConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServingConfigs without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + generateSampleMessage( + new protos.google.cloud.retail.v2.ServingConfig() + ), + ]; + client.descriptors.page.listServingConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2.IServingConfig[] = []; + const iterable = client.listServingConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServingConfigs with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2.ListServingConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServingConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServingConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2.IServingConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServingConfigs.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = + new servingconfigserviceModule.v2.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index c45a9686de5..c66bd3cefb4 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -1538,6 +1538,73 @@ describe('v2.UserEventServiceClient', () => { }); describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('catalog', () => { const fakePath = '/rendered/path/catalog'; const expectedParameters = { @@ -1602,6 +1669,149 @@ describe('v2.UserEventServiceClient', () => { }); }); + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { @@ -1689,5 +1899,81 @@ describe('v2.UserEventServiceClient', () => { ); }); }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new usereventserviceModule.v2.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); From 0df8431885bc693f6611d5f18707607d59e664e4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 20 Sep 2022 15:55:58 -0700 Subject: [PATCH 095/103] feat: Model Services, BatchRemoveCatalogAttributes, ExactSearchableOption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: release Model Services to v2beta version feat: release BatchRemoveCatalogAttributes API to v2beta version feat: release ExactSearchableOption for attribute config to v2beta version feat: release diversity_type for ServingConfig in v2beta version feat: add local inventories info to the Product resource feat: deprecate unused page_token field of PredictionRequest in v2beta version feat: deprecate unused facet_spec field of Control in v2beta version docs: improve documentation of SearchRequest for Search Personalization docs: improve documentation for Fullfillment and Inventory API in ProductService docs: minor documentation fixes and improvements PiperOrigin-RevId: 471846764 Source-Link: https://github.com/googleapis/googleapis/commit/15132940942b0c70083f9c7f6e0bf722fe620a8d Source-Link: https://github.com/googleapis/googleapis-gen/commit/c371ea8df2e34940875d51200cd57e300a2bc0a8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzM3MWVhOGRmMmUzNDk0MDg3NWQ1MTIwMGNkNTdlMzAwYTJiYzBhOCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-typescript v2.17.0 PiperOrigin-RevId: 474338479 Source-Link: https://github.com/googleapis/googleapis/commit/d5d35e0353b59719e8917103b1bc7df2782bf6ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update search-simple-query.test.js * Update search-with-boost-spec.test.js * Update search-with-facet-spec.test.js * Update search-with-filtering.test.js * Update search-with-ordering.test.js * Update search-with-pagination.test.js * Update search-with-query-expansion-spec.test.js * Update search-simple-query.test.js * Update search-with-boost-spec.test.js * Update search-with-facet-spec.test.js * Update search-with-filtering.test.js * Update search-with-ordering.test.js * Update search-with-pagination.test.js * Update search-with-query-expansion-spec.test.js Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- .../google/cloud/retail/v2beta/catalog.proto | 22 +- .../cloud/retail/v2beta/catalog_service.proto | 46 +- .../google/cloud/retail/v2beta/common.proto | 12 +- .../retail/v2beta/completion_service.proto | 6 +- .../google/cloud/retail/v2beta/control.proto | 38 +- .../cloud/retail/v2beta/control_service.proto | 7 +- .../cloud/retail/v2beta/export_config.proto | 4 +- .../cloud/retail/v2beta/import_config.proto | 54 +- .../google/cloud/retail/v2beta/model.proto | 238 + .../cloud/retail/v2beta/model_service.proto | 244 + .../retail/v2beta/prediction_service.proto | 13 +- .../google/cloud/retail/v2beta/product.proto | 15 +- .../cloud/retail/v2beta/product_service.proto | 71 +- .../cloud/retail/v2beta/search_service.proto | 54 +- .../cloud/retail/v2beta/serving_config.proto | 68 +- .../v2beta/serving_config_service.proto | 10 +- .../cloud/retail/v2beta/user_event.proto | 2 +- .../retail/v2beta/user_event_service.proto | 37 +- .../google-cloud-retail/protos/protos.d.ts | 1981 ++++++- packages/google-cloud-retail/protos/protos.js | 4890 ++++++++++++++++- .../google-cloud-retail/protos/protos.json | 770 ++- ...service.batch_remove_catalog_attributes.js | 70 + .../catalog_service.get_completion_config.js | 2 +- ...mpletion_service.import_completion_data.js | 4 +- .../v2beta/control_service.get_control.js | 2 +- .../v2beta/model_service.create_model.js | 74 + .../v2beta/model_service.delete_model.js | 63 + .../v2beta/model_service.list_models.js | 75 + .../v2beta/model_service.pause_model.js | 63 + .../v2beta/model_service.resume_model.js | 63 + .../v2beta/model_service.tune_model.js | 64 + .../v2beta/model_service.update_model.js | 67 + .../v2beta/prediction_service.predict.js | 10 +- .../v2beta/product_service.import_products.js | 18 +- .../generated/v2beta/search_service.search.js | 10 +- .../serving_config_service.add_control.js | 2 +- ...ng_config_service.delete_serving_config.js | 2 +- ...rving_config_service.get_serving_config.js | 2 +- ...ing_config_service.list_serving_configs.js | 2 +- .../serving_config_service.remove_control.js | 2 +- ...t_metadata.google.cloud.retail.v2beta.json | 372 +- .../user_event_service.rejoin_user_events.js | 4 +- packages/google-cloud-retail/src/index.ts | 4 + .../src/v2/catalog_service_client.ts | 26 +- .../src/v2/completion_service_client.ts | 4 +- .../src/v2/control_service_client.ts | 14 +- .../src/v2/prediction_service_client.ts | 2 +- .../src/v2/product_service_client.ts | 26 +- .../src/v2/search_service_client.ts | 6 +- .../src/v2/serving_config_service_client.ts | 18 +- .../src/v2/user_event_service_client.ts | 10 +- .../src/v2alpha/catalog_service_client.ts | 26 +- .../src/v2alpha/completion_service_client.ts | 4 +- .../src/v2alpha/control_service_client.ts | 14 +- .../src/v2alpha/model_service_client.ts | 18 +- .../src/v2alpha/prediction_service_client.ts | 2 +- .../src/v2alpha/product_service_client.ts | 28 +- .../src/v2alpha/search_service_client.ts | 6 +- .../v2alpha/serving_config_service_client.ts | 18 +- .../src/v2alpha/user_event_service_client.ts | 10 +- .../src/v2beta/catalog_service_client.ts | 203 +- .../v2beta/catalog_service_client_config.json | 5 + .../v2beta/catalog_service_proto_list.json | 2 + .../src/v2beta/completion_service_client.ts | 79 +- .../v2beta/completion_service_proto_list.json | 2 + .../src/v2beta/control_service_client.ts | 86 +- .../v2beta/control_service_proto_list.json | 2 + .../src/v2beta/gapic_metadata.json | 98 + .../google-cloud-retail/src/v2beta/index.ts | 1 + .../src/v2beta/model_service_client.ts | 1989 +++++++ .../v2beta/model_service_client_config.json | 54 + .../src/v2beta/model_service_proto_list.json | 22 + .../src/v2beta/prediction_service_client.ts | 77 +- .../v2beta/prediction_service_proto_list.json | 2 + .../src/v2beta/product_service_client.ts | 181 +- .../v2beta/product_service_proto_list.json | 2 + .../src/v2beta/search_service_client.ts | 108 +- .../src/v2beta/search_service_proto_list.json | 2 + .../v2beta/serving_config_service_client.ts | 97 +- .../serving_config_service_proto_list.json | 2 + .../src/v2beta/user_event_service_client.ts | 99 +- .../v2beta/user_event_service_proto_list.json | 2 + .../system-test/fixtures/sample/src/index.js | 1 + .../system-test/fixtures/sample/src/index.ts | 7 + .../test/gapic_catalog_service_v2.ts | 1090 ++-- .../test/gapic_catalog_service_v2alpha.ts | 1090 ++-- .../test/gapic_catalog_service_v2beta.ts | 1359 +++-- .../test/gapic_completion_service_v2.ts | 227 +- .../test/gapic_completion_service_v2alpha.ts | 227 +- .../test/gapic_completion_service_v2beta.ts | 305 +- .../test/gapic_control_service_v2.ts | 534 +- .../test/gapic_control_service_v2alpha.ts | 534 +- .../test/gapic_control_service_v2beta.ts | 610 +- .../test/gapic_model_service_v2alpha.ts | 726 ++- .../test/gapic_model_service_v2beta.ts | 2435 ++++++++ .../test/gapic_prediction_service_v2.ts | 119 +- .../test/gapic_prediction_service_v2alpha.ts | 119 +- .../test/gapic_prediction_service_v2beta.ts | 197 +- .../test/gapic_product_service_v2.ts | 1202 ++-- .../test/gapic_product_service_v2alpha.ts | 1310 ++--- .../test/gapic_product_service_v2beta.ts | 1284 +++-- .../test/gapic_search_service_v2.ts | 168 +- .../test/gapic_search_service_v2alpha.ts | 168 +- .../test/gapic_search_service_v2beta.ts | 244 +- .../test/gapic_serving_config_service_v2.ts | 714 +-- .../gapic_serving_config_service_v2alpha.ts | 714 +-- .../gapic_serving_config_service_v2beta.ts | 791 +-- .../test/gapic_user_event_service_v2.ts | 529 +- .../test/gapic_user_event_service_v2alpha.ts | 529 +- .../test/gapic_user_event_service_v2beta.ts | 605 +- 110 files changed, 22913 insertions(+), 7829 deletions(-) create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model.proto create mode 100644 packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model_service.proto create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.create_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.delete_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.list_models.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.pause_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.resume_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.tune_model.js create mode 100644 packages/google-cloud-retail/samples/generated/v2beta/model_service.update_model.js create mode 100644 packages/google-cloud-retail/src/v2beta/model_service_client.ts create mode 100644 packages/google-cloud-retail/src/v2beta/model_service_client_config.json create mode 100644 packages/google-cloud-retail/src/v2beta/model_service_proto_list.json create mode 100644 packages/google-cloud-retail/test/gapic_model_service_v2beta.ts diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto index 0c2cab63c10..c95e3ac9340 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog.proto @@ -141,6 +141,19 @@ message CatalogAttribute { SEARCHABLE_DISABLED = 2; } + // The status of the exact-searchable option of a catalog attribute. + enum ExactSearchableOption { + // Value used when unset. Defaults to + // [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]. + EXACT_SEARCHABLE_OPTION_UNSPECIFIED = 0; + + // Exact searchable option enabled for an attribute. + EXACT_SEARCHABLE_ENABLED = 1; + + // Exact searchable option disabled for an attribute. + EXACT_SEARCHABLE_DISABLED = 2; + } + // Required. Attribute name. // For example: `color`, `brands`, `attributes.custom_attribute`, such as // `attributes.xyz`. @@ -211,6 +224,11 @@ message CatalogAttribute { // This option works for categorical features only, // does not work for numerical features, inventory filtering. RecommendationsFilteringOption recommendations_filtering_option = 8; + + // If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable. + // This property only applies to textual custom attributes and requires + // indexable set to enabled to enable exact-searchable. + ExactSearchableOption exact_searchable_option = 11; } // Catalog level attribute config. @@ -348,8 +366,8 @@ message MerchantCenterLink { string branch_id = 2; // String representing the destination to import for, all if left empty. - // List of possible values can be found here. - // [https://support.google.com/merchants/answer/7501026] + // List of possible values is given in [Included + // destination](https://support.google.com/merchants/answer/7501026). // List of allowed string values: // "Shopping_ads", "Buy_on_google_listings", "Display_ads", "Local_inventory // _ads", "Free_listings", "Free_local_listings" diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto index fb6f8bca0f0..7001c211324 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/catalog_service.proto @@ -186,6 +186,17 @@ service CatalogService { }; } + // Removes all specified + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s from the + // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig]. + rpc BatchRemoveCatalogAttributes(BatchRemoveCatalogAttributesRequest) + returns (BatchRemoveCatalogAttributesResponse) { + option (google.api.http) = { + post: "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:batchRemoveCatalogAttributes" + body: "*" + }; + } + // Replaces the specified // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] in the // [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig] by updating @@ -341,7 +352,7 @@ message GetDefaultBranchResponse { // method. message GetCompletionConfigRequest { // Required. Full CompletionConfig resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -449,6 +460,39 @@ message RemoveCatalogAttributeRequest { string key = 2 [(google.api.field_behavior) = REQUIRED]; } +// Request for +// [CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributes] +// method. +message BatchRemoveCatalogAttributesRequest { + // Required. The attributes config resource shared by all catalog attributes + // being deleted. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + string attributes_config = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "retail.googleapis.com/AttributesConfig" + } + ]; + + // Required. The attribute name keys of the + // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s to delete. + // A maximum of 1000 catalog attributes can be deleted in a batch. + repeated string attribute_keys = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response of the +// [CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributes]. +message BatchRemoveCatalogAttributesResponse { + // Catalog attributes that were deleted. Only attributes that are not [in + // use][CatalogAttribute.in_use] by products can be deleted. + repeated string deleted_catalog_attributes = 1; + + // Catalog attributes that were reset. Attributes that are [in + // use][CatalogAttribute.in_use] by products cannot be deleted, however their + // configuration properties will reset to default values upon removal request. + repeated string reset_catalog_attributes = 2; +} + // Request for // [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2beta.CatalogService.ReplaceCatalogAttribute] // method. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto index 3a500afc586..fd1247636b4 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/common.proto @@ -72,7 +72,7 @@ enum RecommendationsFilteringOption { // The use case of Cloud Retail Search. enum SearchSolutionUseCase { // The value when it's unspecified. In this case, server behavior defaults to - // [SEARCH_SOLUTION_USE_CASE_SEARCH][]. + // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2beta.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]. SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; // Search use case. Expects the traffic has a non-empty @@ -97,8 +97,8 @@ message Condition { // Value cannot be empty. // Value can have at most 3 terms if specified as a partial match. Each // space separated string is considered as one term. - // Example) "a b c" is 3 terms and allowed, " a b c d" is 4 terms and not - // allowed for partial match. + // For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms + // and not allowed for a partial match. string value = 1; // Whether this is supposed to be a full or partial match. @@ -127,10 +127,12 @@ message Condition { } // A rule is a condition-action pair +// // * A condition defines when a rule is to be triggered. // * An action specifies what occurs on that trigger. -// Currently only boost rules are supported. -// Currently only supported by the search endpoint. +// Currently rules only work for [controls][google.cloud.retail.v2beta.Control] +// with +// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2beta.SolutionType.SOLUTION_TYPE_SEARCH]. message Rule { // A boost action to apply to results matching condition specified above. message BoostAction { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto index 0d6480a1a2e..4db036647f9 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/completion_service.proto @@ -36,7 +36,7 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Auto-completion service for retail. // // This feature is only available for users who have Retail Search enabled. -// Please enable Retail Search on Cloud Console before using this feature. +// Enable Retail Search on Cloud Console before using this feature. service CompletionService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -45,7 +45,7 @@ service CompletionService { // Completes the specified prefix with keyword suggestions. // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { option (google.api.http) = { get: "/v2beta/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" @@ -60,7 +60,7 @@ service CompletionService { // are indexed successfully and ready for serving. The process takes hours. // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc ImportCompletionData(ImportCompletionDataRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto index 2cd59be4b7e..238f0f5fe69 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control.proto @@ -30,8 +30,9 @@ option objc_class_prefix = "RETAIL"; option php_namespace = "Google\\Cloud\\Retail\\V2beta"; option ruby_package = "Google::Cloud::Retail::V2beta"; -// Configures dynamic serving time metadata that is used to pre and post -// process search/recommendation model results. +// Configures dynamic metadata that can be linked to a +// [ServingConfig][google.cloud.retail.v2beta.ServingConfig] and affect search +// or recommendation results at serving time. message Control { option (google.api.resource) = { type: "retail.googleapis.com/Control" @@ -45,7 +46,10 @@ message Control { // INVALID_ARGUMENT will be returned if either condition is violated. oneof control { // A facet specification to perform faceted search. - SearchRequest.FacetSpec facet_spec = 3; + // + // Note that this field is deprecated and will throw NOT_IMPLEMENTED if + // used for creating a control. + SearchRequest.FacetSpec facet_spec = 3 [deprecated = true]; // A rule control - a condition-action pair. // Enacts a set action when the condition is triggered. @@ -63,22 +67,34 @@ message Control { // characters. Otherwise, an INVALID_ARGUMENT error is thrown. string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - // Output only. List of serving configuration ids that that are associated - // with this control. Note the association is managed via the ServingConfig, - // this is an output only denormalizeed view. Assumed to be in the same - // catalog. + // Output only. List of [serving + // configuration][google.cloud.retail.v2beta.ServingConfig] ids that are + // associated with this control in the same + // [Catalog][google.cloud.retail.v2beta.Catalog]. + // + // Note the association is managed via the + // [ServingConfig][google.cloud.retail.v2beta.ServingConfig], this is an + // output only denormalized view. repeated string associated_serving_config_ids = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Required. Immutable. The solution types that the serving config is used - // for. Currently we support setting only one type of solution at creation - // time. + // Required. Immutable. The solution types that the control is used for. + // Currently we support setting only one type of solution at creation time. // // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. // If no solution type is provided at creation time, will default to - // SOLUTION_TYPE_SEARCH. + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2beta.SolutionType.SOLUTION_TYPE_SEARCH]. repeated SolutionType solution_types = 6 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE ]; + + // Specifies the use case for the control. + // Affects what condition fields can be set. + // Only settable by search controls. + // Will default to + // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2beta.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH] + // if not specified. Currently only allow one search_solution_use_case per + // control. + repeated SearchSolutionUseCase search_solution_use_case = 7; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto index 3ec62e6c674..a0a9d2e732f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/control_service.proto @@ -66,7 +66,7 @@ service ControlService { // // [Control][google.cloud.retail.v2beta.Control] cannot be set to a different // oneof field, if so an INVALID_ARGUMENT is returned. If the - // [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a + // [Control][google.cloud.retail.v2beta.Control] to update does not exist, a // NOT_FOUND error is returned. rpc UpdateControl(UpdateControlRequest) returns (Control) { option (google.api.http) = { @@ -84,7 +84,8 @@ service ControlService { option (google.api.method_signature) = "name"; } - // Lists all Controls linked to this catalog. + // Lists all Controls by their parent + // [Catalog][google.cloud.retail.v2beta.Catalog]. rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { option (google.api.http) = { get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/controls" @@ -140,7 +141,7 @@ message DeleteControlRequest { // Request for GetControl method. message GetControlRequest { - // Required. The resource name of the Control to delete. Format: + // Required. The resource name of the Control to get. Format: // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto index 52ef46a42e7..de24f41907a 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/export_config.proto @@ -16,6 +16,8 @@ syntax = "proto3"; package google.cloud.retail.v2beta; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -40,7 +42,7 @@ message ExportErrorsConfig { } } -// Metadata related to the progress of the Export operation. This will be +// Metadata related to the progress of the Export operation. This is // returned by the google.longrunning.Operation.metadata field. message ExportMetadata { // Operation create time. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto index 4e53ca636b2..e544f6471a0 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/import_config.proto @@ -35,7 +35,6 @@ option php_namespace = "Google\\Cloud\\Retail\\V2beta"; option ruby_package = "Google::Cloud::Retail::V2beta"; // 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, @@ -66,12 +65,12 @@ message GcsSource { // // Supported values for control imports: // - // * 'control' (default): One JSON + // * `control` (default): One JSON // [Control][google.cloud.retail.v2beta.Control] per line. // // Supported values for catalog attribute imports: // - // * 'catalog_attribute' (default): One CSV + // * `catalog_attribute` (default): One CSV // [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute] per line. string data_schema = 2; } @@ -83,9 +82,8 @@ message BigQuerySource { oneof partition { // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. + // Only supported in + // [ImportProductsRequest][google.cloud.retail.v2beta.ImportProductsRequest]. google.type.Date partition_date = 6; } @@ -124,8 +122,7 @@ message BigQuerySource { // * `user_event_ga360`: // The schema is available here: // https://support.google.com/analytics/answer/3437719. - // * `user_event_ga4`: This feature is in private preview. Please contact the - // support team for importing Google Analytics 4 events. + // * `user_event_ga4`: // The schema is available here: // https://support.google.com/analytics/answer/7029846. // @@ -156,7 +153,7 @@ message ImportErrorsConfig { // Required. Errors destination. oneof destination { // Google Cloud Storage prefix for import errors. This must be an empty, - // existing Cloud Storage directory. Import errors will be written to + // existing Cloud Storage directory. Import errors are written to // sharded files in this directory, one per line, as a JSON-encoded // `google.rpc.Status` message. string gcs_prefix = 1; @@ -176,16 +173,6 @@ message ImportProductsRequest { // Calculates diff and replaces the entire product dataset. Existing // products may be deleted if they are not present in the source location. - // - // Can only be set while using - // [BigQuerySource][google.cloud.retail.v2beta.BigQuerySource]. And the - // BigQuery dataset must be created in the data location "us (multiple - // regions in United States)", otherwise a PERMISSION_DENIED error is - // thrown. - // - // Add the IAM permission "BigQuery Data Viewer" for - // cloud-retail-customer-data-access@system.gserviceaccount.com before - // using this feature otherwise an error is thrown. FULL = 2; } @@ -208,8 +195,8 @@ message ImportProductsRequest { // 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. + // Indicates which fields in the provided imported `products` to update. If + // not set, all fields are updated. google.protobuf.FieldMask update_mask = 4; // The mode of reconciliation between existing products and the products to be @@ -218,21 +205,16 @@ message ImportProductsRequest { ReconciliationMode reconciliation_mode = 5; // Full Pub/Sub topic name for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has // to be within the same project as // [ImportProductsRequest.parent][google.cloud.retail.v2beta.ImportProductsRequest.parent]. - // Make sure that both - // `cloud-retail-customer-data-access@system.gserviceaccount.com` and - // `service-@gcp-sa-retail.iam.gserviceaccount.com` - // have the `pubsub.topics.publish` IAM permission on the topic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. + // Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + // `pubsub.topics.publish` IAM permission on the topic. string notification_pubsub_topic = 7; } @@ -268,8 +250,8 @@ message ImportCompletionDataRequest { [(google.api.field_behavior) = REQUIRED]; // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. string notification_pubsub_topic = 3; @@ -329,7 +311,7 @@ message CompletionDataInputConfig { } } -// Metadata related to the progress of the Import operation. This will be +// Metadata related to the progress of the Import operation. This is // returned by the google.longrunning.Operation.metadata field. message ImportMetadata { // Operation create time. @@ -349,8 +331,8 @@ message ImportMetadata { string request_id = 5 [deprecated = true]; // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification will be sent to - // specified Pub/Sub topic. The message data will be JSON string of a + // when the import is finished, a notification is sent to + // specified Pub/Sub topic. The message data is JSON string of a // [Operation][google.longrunning.Operation]. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. string notification_pubsub_topic = 6; diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model.proto new file mode 100644 index 00000000000..ea4bd30c6c9 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model.proto @@ -0,0 +1,238 @@ +// Copyright 2022 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.v2beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/retail/v2beta/common.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ModelProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Metadata that describes the training and serving parameters of a +// [Model][google.cloud.retail.v2beta.Model]. A +// [Model][google.cloud.retail.v2beta.Model] can be associated with a +// [ServingConfig][google.cloud.retail.v2beta.ServingConfig] and then queried +// through the Predict API. +message Model { + option (google.api.resource) = { + type: "retail.googleapis.com/Model" + pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}" + }; + + // Represents an ordered combination of valid serving configs, which + // can be used for `PAGE_OPTIMIZATION` recommendations. + message ServingConfigList { + // Optional. A set of valid serving configs that may be used for + // `PAGE_OPTIMIZATION`. + repeated string serving_config_ids = 1 + [(google.api.field_behavior) = OPTIONAL]; + } + + // The serving state of the model. + enum ServingState { + // Unspecified serving state. + SERVING_STATE_UNSPECIFIED = 0; + + // The model is not serving. + INACTIVE = 1; + + // The model is serving and can be queried. + ACTIVE = 2; + + // The model is trained on tuned hyperparameters and can be + // queried. + TUNED = 3; + } + + // The training state of the model. + enum TrainingState { + // Unspecified training state. + TRAINING_STATE_UNSPECIFIED = 0; + + // The model training is paused. + PAUSED = 1; + + // The model is training. + TRAINING = 2; + } + + // Describes whether periodic tuning is enabled for this model + // or not. Periodic tuning is scheduled at most every three months. You can + // start a tuning process manually by using the `TuneModel` + // method, which starts a tuning process immediately and resets the quarterly + // schedule. Enabling or disabling periodic tuning does not affect any + // current tuning processes. + enum PeriodicTuningState { + // Unspecified default value, should never be explicitly set. + PERIODIC_TUNING_STATE_UNSPECIFIED = 0; + + // The model has periodic tuning disabled. Tuning + // can be reenabled by calling the `EnableModelPeriodicTuning` + // method or by calling the `TuneModel` method. + PERIODIC_TUNING_DISABLED = 1; + + // The model cannot be tuned with periodic tuning OR the + // `TuneModel` method. Hide the options in customer UI and + // reject any requests through the backend self serve API. + ALL_TUNING_DISABLED = 3; + + // The model has periodic tuning enabled. Tuning + // can be disabled by calling the `DisableModelPeriodicTuning` + // method. + PERIODIC_TUNING_ENABLED = 2; + } + + // Describes whether this model have sufficient training data + // to be continuously trained. + enum DataState { + // Unspecified default value, should never be explicitly set. + DATA_STATE_UNSPECIFIED = 0; + + // The model has sufficient training data. + DATA_OK = 1; + + // The model does not have sufficient training data. Error + // messages can be queried via Stackdriver. + DATA_ERROR = 2; + } + + // Required. The fully qualified resource name of the model. + // + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + // catalog_id has char limit of 50. + // recommendation_model_id has char limit of 40. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The display name of the model. + // + // Should be human readable, used to display Recommendation Models in the + // Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 + // characters. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The training state that the model is in (e.g. + // `TRAINING` or `PAUSED`). + // + // Since part of the cost of running the service + // is frequency of training - this can be used to determine when to train + // model in order to control cost. If not specified: the default value for + // `CreateModel` method is `TRAINING`. The default value for + // `UpdateModel` method is to keep the state the same as before. + TrainingState training_state = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`. + ServingState serving_state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp the Recommendation Model was created at. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp the Recommendation Model was last updated. E.g. + // if a Recommendation Model was paused - this would be the time the pause was + // initiated. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The type of model e.g. `home-page`. + // + // Currently supported values: `recommended-for-you`, `others-you-may-like`, + // `frequently-bought-together`, `page-optimization`, `similar-items`, + // `buy-it-again`, and `recently-viewed`(readonly value). + // + // This field together with + // [optimization_objective][google.cloud.retail.v2beta.Model.optimization_objective] + // describe model metadata to use to control model training and serving. + // See https://cloud.google.com/retail/docs/models + // for more details on what the model metadata control and which combination + // of parameters are valid. For invalid combinations of parameters (e.g. type + // = `frequently-bought-together` and optimization_objective = `ctr`), you + // receive an error 400 if you try to create/update a recommendation with + // this set of knobs. + string type = 7 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The optimization objective e.g. `cvr`. + // + // Currently supported + // values: `ctr`, `cvr`, `revenue-per-order`. + // + // If not specified, we choose default based on model type. + // Default depends on type of recommendation: + // + // `recommended-for-you` => `ctr` + // + // `others-you-may-like` => `ctr` + // + // `frequently-bought-together` => `revenue_per_order` + // + // This field together with + // [optimization_objective][google.cloud.retail.v2beta.Model.type] + // describe model metadata to use to control model training and serving. + // See https://cloud.google.com/retail/docs/models + // for more details on what the model metadata control and which combination + // of parameters are valid. For invalid combinations of parameters (e.g. type + // = `frequently-bought-together` and optimization_objective = `ctr`), you + // receive an error 400 if you try to create/update a recommendation with + // this set of knobs. + string optimization_objective = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The state of periodic tuning. + // + // The period we use is 3 months - to do a + // one-off tune earlier use the `TuneModel` method. Default value + // is `PERIODIC_TUNING_ENABLED`. + PeriodicTuningState periodic_tuning_state = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The timestamp when the latest successful tune finished. + google.protobuf.Timestamp last_tune_time = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The tune operation associated with the model. + // + // Can be used to determine if there is an ongoing tune for this + // recommendation. Empty field implies no tune is goig on. + string tuning_operation = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of data requirements for this model: `DATA_OK` and + // `DATA_ERROR`. + // + // Recommendation model cannot be trained if the data is in + // `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even + // if serving state is `ACTIVE`: models were trained successfully before, but + // cannot be refreshed because model no longer has sufficient + // data for training. + DataState data_state = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering + // by attributes is enabled for the model. + RecommendationsFilteringOption filtering_option = 18 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The list of valid serving configs associated with the + // PageOptimizationConfig. + repeated ServingConfigList serving_config_lists = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model_service.proto new file mode 100644 index 00000000000..3a9a3c5a360 --- /dev/null +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/model_service.proto @@ -0,0 +1,244 @@ +// Copyright 2022 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.v2beta; + +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/v2beta/model.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Retail.V2Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail"; +option java_multiple_files = true; +option java_outer_classname = "ModelServiceProto"; +option java_package = "com.google.cloud.retail.v2beta"; +option objc_class_prefix = "RETAIL"; +option php_namespace = "Google\\Cloud\\Retail\\V2beta"; +option ruby_package = "Google::Cloud::Retail::V2beta"; + +// Service for performing CRUD operations on models. +// Recommendation models contain all the metadata necessary to generate a set of +// models for the `Predict()` API. A model is queried +// indirectly via a ServingConfig, which associates a model with a +// given Placement (e.g. Frequently Bought Together on Home Page). +// +// This service allows you to do the following: +// +// * Initiate training of a model. +// * Pause training of an existing model. +// * List all the available models along with their metadata. +// * Control their tuning schedule. +service ModelService { + option (google.api.default_host) = "retail.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new model. + rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models" + body: "model" + }; + option (google.api.method_signature) = "parent,model"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.Model" + metadata_type: "google.cloud.retail.v2beta.CreateModelMetadata" + }; + } + + // Pauses the training of an existing model. + rpc PauseModel(PauseModelRequest) returns (Model) { + option (google.api.http) = { + post: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:pause" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Resumes the training of an existing model. + rpc ResumeModel(ResumeModelRequest) returns (Model) { + option (google.api.http) = { + post: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:resume" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an existing model. + rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all the models linked to this event store. + rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models" + }; + option (google.api.method_signature) = "parent"; + } + + // Update of model metadata. Only fields that + // currently can be updated are: `filtering_option` and + // `periodic_tuning_state`. + // If other values are provided, this API method ignores them. + rpc UpdateModel(UpdateModelRequest) returns (Model) { + option (google.api.http) = { + patch: "/v2beta/{model.name=projects/*/locations/*/catalogs/*/models/*}" + body: "model" + }; + option (google.api.method_signature) = "model,update_mask"; + } + + // Tunes an existing model. + rpc TuneModel(TuneModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:tune" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.retail.v2beta.TuneModelResponse" + metadata_type: "google.cloud.retail.v2beta.TuneModelMetadata" + }; + } +} + +// Request for creating a model. +message CreateModelRequest { + // Required. The parent resource under which to create the model. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Required. The payload of the [Model][google.cloud.retail.v2beta.Model] to + // create. + Model model = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Whether to run a dry run to validate the request (without + // actually creating the model). + bool dry_run = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for updating an existing model. +message UpdateModelRequest { + // Required. The body of the updated + // [Model][google.cloud.retail.v2beta.Model]. + Model model = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates which fields in the provided 'model' to + // update. If not set, by default updates all fields. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for pausing training of a model. +message PauseModelRequest { + // Required. The name of the model to pause. + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } + ]; +} + +// Request for resuming training of a model. +message ResumeModelRequest { + // Required. The name of the model to resume. + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for listing models associated with a resource. +message ListModelsRequest { + // Required. The parent for which to list models. + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; + + // Optional. Maximum number of results to return. If unspecified, defaults + // to 50. Max allowed value is 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListModels` + // call. Provide this to retrieve the subsequent page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for deleting a model. +message DeleteModelRequest { + // Required. The resource name of the + // [Model][google.cloud.retail.v2beta.Model] to delete. Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } + ]; +} + +// Response to a ListModelRequest. +message ListModelsResponse { + // List of Models. + repeated Model models = 1; + + // Pagination token, if not returned indicates the last page. + string next_page_token = 2; +} + +// Request to manually start a tuning process now (instead of waiting for +// the periodically scheduled tuning to happen). +message TuneModelRequest { + // Required. The resource name of the model to tune. + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } + ]; +} + +// Metadata associated with a create operation. +message CreateModelMetadata { + // The resource name of the model that this create applies to. + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + string model = 1; +} + +// Metadata associated with a tune operation. +message TuneModelMetadata { + // The resource name of the model that this tune applies to. + // Format: + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + string model = 1; +} + +// Response associated with a tune operation. +message TuneModelResponse {} diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto index d4d18ee1020..1ac3026d63f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/prediction_service.proto @@ -19,6 +19,7 @@ package google.cloud.retail.v2beta; 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/v2beta/user_event.proto"; import "google/protobuf/struct.proto"; @@ -84,14 +85,14 @@ message PredictRequest { // [UserInfo.user_id][google.cloud.retail.v2beta.UserInfo.user_id] unset. 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. + // Maximum number of results to return. 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; - // This field is not used for now; leave it unset. - string page_token = 4; + // This field is not used; leave it unset. + string page_token = 4 [deprecated = true]; // Filter for restricting prediction results with a length limit of 5,000 // characters. Accepts values for tags and the `filterOutOfStockItems` flag. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto index 9490e09fcb8..8b10090136f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product.proto @@ -199,7 +199,7 @@ message Product { // The [type][google.cloud.retail.v2beta.Product.type] of the members must be // either [Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY] or // [Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT] otherwise - // and INVALID_ARGUMENT error is thrown. Should not set it for other types. A + // an INVALID_ARGUMENT error is thrown. Should not set it for other types. A // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is // return. repeated string collection_member_ids = 5; @@ -230,7 +230,7 @@ message Product { // // // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, please replace it with + // hierarchies. If '>' is part of the category name, replace it with // other character(s). // // For example, if a shoes product belongs to both @@ -563,4 +563,15 @@ message Product { // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct]. // Do not set this field in API requests. repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A list of local inventories specific to different places. + // + // This is only available for users who have Retail Search enabled, and it can + // be managed by + // [ProductService.AddLocalInventories][google.cloud.retail.v2beta.ProductService.AddLocalInventories] + // and + // [ProductService.RemoveLocalInventories][google.cloud.retail.v2beta.ProductService.RemoveLocalInventories] + // APIs. + repeated LocalInventory local_inventories = 35 + [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto index a9bfd96581c..0c09943324d 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/product_service.proto @@ -111,9 +111,9 @@ service ProductService { // // This process is asynchronous and does not require the // [Product][google.cloud.retail.v2beta.Product] to exist before updating - // fulfillment information. If the request is valid, the update will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, updates are not immediately manifested in the + // fulfillment information. If the request is valid, the update is enqueued + // and processed downstream. As a consequence, when a response is returned, + // updates are not immediately manifested in the // [Product][google.cloud.retail.v2beta.Product] queried by // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] // or @@ -123,10 +123,10 @@ service ProductService { // [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] // and // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], - // the specified inventory field value(s) will overwrite any existing value(s) + // the specified inventory field value(s) overwrite any existing value(s) // while ignoring the last update time for this field. Furthermore, the last - // update time for the specified inventory fields will be overwritten to the - // time of the + // update times for the specified inventory fields are overwritten by the + // times of the // [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] // or // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] @@ -134,11 +134,11 @@ service ProductService { // // If no inventory fields are set in // [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], - // then any pre-existing inventory information for this product will be used. + // then any pre-existing inventory information for this product is used. // // If no inventory fields are set in // [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], - // then any existing inventory information will be preserved. + // then any existing inventory information is preserved. // // Pre-existing inventory information can only be updated with // [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], @@ -146,8 +146,17 @@ service ProductService { // and // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. // + // The returned [Operation][google.longrunning.Operation]s is obsolete after + // one day, and the [GetOperation][google.longrunning.Operations.GetOperation] + // API returns `NOT_FOUND` afterwards. + // + // If conflicting updates are issued, the + // [Operation][google.longrunning.Operation]s associated with the stale + // updates are not marked as [done][google.longrunning.Operation.done] until + // they are obsolete. + // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v2beta/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" @@ -173,8 +182,17 @@ service ProductService { // or // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // + // The returned [Operation][google.longrunning.Operation]s will be obsolete + // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + // API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the + // [Operation][google.longrunning.Operation]s associated with the stale + // updates will not be marked as [done][google.longrunning.Operation.done] + // until being obsolete. + // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -201,8 +219,17 @@ service ProductService { // or // [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. // + // The returned [Operation][google.longrunning.Operation]s will be obsolete + // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + // API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the + // [Operation][google.longrunning.Operation]s associated with the stale + // updates will not be marked as [done][google.longrunning.Operation.done] + // until being obsolete. + // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -236,8 +263,17 @@ service ProductService { // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] // has no effect on local inventories. // + // The returned [Operation][google.longrunning.Operation]s will be obsolete + // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + // API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the + // [Operation][google.longrunning.Operation]s associated with the stale + // updates will not be marked as [done][google.longrunning.Operation.done] + // until being obsolete. + // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc AddLocalInventories(AddLocalInventoriesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -269,8 +305,17 @@ service ProductService { // [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] // has no effect on local inventories. // + // The returned [Operation][google.longrunning.Operation]s will be obsolete + // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + // API will return NOT_FOUND afterwards. + // + // If conflicting updates are issued, the + // [Operation][google.longrunning.Operation]s associated with the stale + // updates will not be marked as [done][google.longrunning.Operation.done] + // until being obsolete. + // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) returns (google.longrunning.Operation) { option (google.api.http) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto index bf0764fd970..5a1004410e6 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/search_service.proto @@ -37,7 +37,7 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Service for search. // // This feature is only available for users who have Retail Search enabled. -// Please enable Retail Search on Cloud Console before using this feature. +// Enable Retail Search on Cloud Console before using this feature. service SearchService { option (google.api.default_host) = "retail.googleapis.com"; option (google.api.oauth_scopes) = @@ -46,7 +46,7 @@ service SearchService { // Performs a search. // // This feature is only available for users who have Retail Search enabled. - // Please enable Retail Search on Cloud Console before using this feature. + // Enable Retail Search on Cloud Console before using this feature. rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" @@ -364,7 +364,8 @@ message SearchRequest { message QueryExpansionSpec { // Enum describing under which condition query expansion should occur. enum Condition { - // Unspecified query expansion condition. This defaults to + // Unspecified query expansion condition. In this case, server behavior + // defaults to // [Condition.DISABLED][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. CONDITION_UNSPECIFIED = 0; @@ -395,7 +396,8 @@ message SearchRequest { // [Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode.AUTO]. MODE_UNSPECIFIED = 0; - // Let CRS decide whether to use personalization. + // Let CRS decide whether to use personalization based on quality of user + // event data. AUTO = 1; // Disable personalization. @@ -436,15 +438,21 @@ message SearchRequest { // The search mode of each search request. enum SearchMode { // Default value. In this case both product search and faceted search will - // be performed. Both [SearchResponse.SearchResult] and - // [SearchResponse.Facet] will be returned. + // be performed. Both + // [SearchResponse.SearchResult][google.cloud.retail.v2beta.SearchResponse.SearchResult] + // and + // [SearchResponse.Facet][google.cloud.retail.v2beta.SearchResponse.Facet] + // will be returned. SEARCH_MODE_UNSPECIFIED = 0; // Only product search will be performed. The faceted search will be // disabled. // - // Only [SearchResponse.SearchResult] will be returned. - // [SearchResponse.Facet] will not be returned, even if + // Only + // [SearchResponse.SearchResult][google.cloud.retail.v2beta.SearchResponse.SearchResult] + // will be returned. + // [SearchResponse.Facet][google.cloud.retail.v2beta.SearchResponse.Facet] + // will not be returned, even if // [SearchRequest.facet_specs][google.cloud.retail.v2beta.SearchRequest.facet_specs] // or // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2beta.SearchRequest.dynamic_facet_spec] @@ -459,7 +467,9 @@ message SearchRequest { // and // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2beta.SearchRequest.dynamic_facet_spec] // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only - // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] + // [SearchResponse.Facet][google.cloud.retail.v2beta.SearchResponse.Facet] + // will be returned. + // [SearchResponse.SearchResult][google.cloud.retail.v2beta.SearchResponse.SearchResult] // will not be returned. FACETED_SEARCH_ONLY = 2; } @@ -671,7 +681,7 @@ message SearchRequest { // [UserEvent.page_categories][google.cloud.retail.v2beta.UserEvent.page_categories]; // // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, please replace it with + // hierarchies. If '>' is part of the category name, replace it with // other character(s). // // Category pages include special pages such as sales or promotions. For @@ -684,6 +694,15 @@ message SearchRequest { SearchMode search_mode = 31; // The specification for personalization. + // + // Notice that if both + // [ServingConfig.personalization_spec][google.cloud.retail.v2beta.ServingConfig.personalization_spec] + // and + // [SearchRequest.personalization_spec][google.cloud.retail.v2beta.SearchRequest.personalization_spec] + // are set. + // [SearchRequest.personalization_spec][google.cloud.retail.v2beta.SearchRequest.personalization_spec] + // will override + // [ServingConfig.personalization_spec][google.cloud.retail.v2beta.ServingConfig.personalization_spec]. PersonalizationSpec personalization_spec = 32; // The labels applied to a resource must meet the following requirements: @@ -787,6 +806,21 @@ message SearchResponse { // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there // are 10 variants in this product are available in the store "store1". map variant_rollup_values = 5; + + // Specifies previous events related to this product for this user based on + // [UserEvent][google.cloud.retail.v2beta.UserEvent] with same + // [SearchRequest.visitor_id][google.cloud.retail.v2beta.SearchRequest.visitor_id] + // or [UserInfo.user_id][google.cloud.retail.v2beta.UserInfo.user_id]. + // + // This is set only when + // [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.mode] + // is + // [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode.AUTO]. + // + // Possible values: + // + // * `purchased`: Indicates that this product has been purchased before. + repeated string personal_labels = 7; } // A facet result. diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto index 431a4a41149..35d1cf85353 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config.proto @@ -32,14 +32,25 @@ option ruby_package = "Google::Cloud::Retail::V2beta"; // Configures metadata that is used to generate serving time results (e.g. // search results or recommendation predictions). -// The ServingConfig is passed in the search and predict request and together -// with the Catalog.default_branch, generates results. message ServingConfig { option (google.api.resource) = { type: "retail.googleapis.com/ServingConfig" pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" }; + // What type of diversity - data or rule based. + // If none is specified, default to rule based. + enum DiversityType { + // Default value. + DIVERSITY_TYPE_UNSPECIFIED = 0; + + // Rule based diversity. + RULE_BASED_DIVERSITY = 2; + + // Data driven diversity. + DATA_DRIVEN_DIVERSITY = 3; + } + // Immutable. Fully qualified name // `projects/*/locations/global/catalogs/*/servingConfig/*` string name = 1 [(google.api.field_behavior) = IMMUTABLE]; @@ -51,7 +62,8 @@ message ServingConfig { // characters. Otherwise, an INVALID_ARGUMENT error is returned. string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - // The id of the model to use at serving time. + // The id of the model in the same + // [Catalog][google.cloud.retail.v2beta.Catalog] to use at serving time. // Currently only RecommendationModels are supported: // https://cloud.google.com/retail/recommendations-ai/docs/create-models // Can be changed but only to a compatible model (e.g. @@ -70,13 +82,13 @@ message ServingConfig { // click-through and conversion rates. // Allowed values are: // - // * 'no-price-reranking' - // * 'low-price-raranking' - // * 'medium-price-reranking' - // * 'high-price-reranking' + // * `no-price-reranking` + // * `low-price-raranking` + // * `medium-price-reranking` + // * `high-price-reranking` // // If not specified, we choose default based on model type. Default value: - // 'no-price-reranking'. + // `no-price-reranking`. // // Can only be set if // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] @@ -205,16 +217,16 @@ message ServingConfig { repeated string ignore_control_ids = 15; // How much diversity to use in recommendation model results e.g. - // 'medium-diversity' or 'high-diversity'. Currently supported values: + // `medium-diversity` or `high-diversity`. Currently supported values: // - // * 'no-diversity' - // * 'low-diversity' - // * 'medium-diversity' - // * 'high-diversity' - // * 'auto-diversity' + // * `no-diversity` + // * `low-diversity` + // * `medium-diversity` + // * `high-diversity` + // * `auto-diversity` // // If not specified, we choose default based on recommendation model - // type. Default value: 'no-diversity'. + // type. Default value: `no-diversity`. // // Can only be set if // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] @@ -222,13 +234,16 @@ message ServingConfig { // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. string diversity_level = 8; - // Whether to add additional category filters on the 'similar-items' model. + // What kind of diversity to use - data driven or rule based. + DiversityType diversity_type = 20; + + // Whether to add additional category filters on the `similar-items` model. // If not specified, we enable it by default. // Allowed values are: // - // * 'no-category-match': No additional filtering of original results from + // * `no-category-match`: No additional filtering of original results from // the model and the customer's filters. - // * 'relaxed-category-match': Only keep results with categories that match + // * `relaxed-category-match`: Only keep results with categories that match // at least one item categories in the PredictRequests's context item. // * If customer also sends filters in the PredictRequest, then the results // will satisfy both conditions (user given and category match). @@ -239,6 +254,23 @@ message ServingConfig { // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. string enable_category_filter_level = 16; + // The specification for personalization spec. + // + // Can only be set if + // [solution_types][google.cloud.retail.v2beta.ServingConfig.solution_types] + // is + // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2main.SolutionType.SOLUTION_TYPE_SEARCH]. + // + // Notice that if both + // [ServingConfig.personalization_spec][google.cloud.retail.v2beta.ServingConfig.personalization_spec] + // and + // [SearchRequest.personalization_spec][google.cloud.retail.v2beta.SearchRequest.personalization_spec] + // are set. + // [SearchRequest.personalization_spec][google.cloud.retail.v2beta.SearchRequest.personalization_spec] + // will override + // [ServingConfig.personalization_spec][google.cloud.retail.v2beta.ServingConfig.personalization_spec]. + SearchRequest.PersonalizationSpec personalization_spec = 21; + // Required. Immutable. Specifies the solution types that a serving config can // be associated with. Currently we support setting only one type of solution. repeated SolutionType solution_types = 19 [ diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto index e2d5319a463..46bdcd9b04f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/serving_config_service.proto @@ -158,7 +158,7 @@ message UpdateServingConfigRequest { // Request for DeleteServingConfig method. message DeleteServingConfigRequest { // Required. The resource name of the ServingConfig to delete. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -170,7 +170,7 @@ message DeleteServingConfigRequest { // Request for GetServingConfig method. message GetServingConfigRequest { // Required. The resource name of the ServingConfig to get. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -182,7 +182,7 @@ message GetServingConfigRequest { // Request for ListServingConfigs method. message ListServingConfigsRequest { // Required. The catalog resource name. Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } @@ -210,7 +210,7 @@ message ListServingConfigsResponse { // Request for AddControl method. message AddControlRequest { // Required. The source ServingConfig resource name . Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` string serving_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -226,7 +226,7 @@ message AddControlRequest { // Request for RemoveControl method. message RemoveControlRequest { // Required. The source ServingConfig resource name . Format: - // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` string serving_config = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto index 06c8e64c231..3d88483e79f 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event.proto @@ -227,7 +227,7 @@ message UserEvent { // 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 + // hierarchies. If '>' is part of the category name, replace it with // other character(s). // // Category pages include special pages such as sales or promotions. For diff --git a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto index c647a45bb24..74dccdff892 100644 --- a/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto +++ b/packages/google-cloud-retail/protos/google/cloud/retail/v2beta/user_event_service.proto @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; +import "google/api/resource.proto"; import "google/cloud/retail/v2beta/import_config.proto"; import "google/cloud/retail/v2beta/purge_config.proto"; import "google/cloud/retail/v2beta/user_event.proto"; @@ -79,9 +80,9 @@ service UserEventService { // 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 + // `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. + // `Operation.metadata` is of type `ImportMetadata`. rpc ImportUserEvents(ImportUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -94,14 +95,14 @@ service UserEventService { }; } - // Starts 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 method can be used to start a join operation on specified - // events with latest version of product catalog. It can also be used to - // correct events joined with the wrong product catalog. A rejoin operation - // can take hours or days to complete. + // Starts a user-event rejoin operation with latest product catalog. Events + // are not annotated with detailed product information for products that are + // missing from the catalog when the user event is ingested. These + // events are stored as unjoined events with limited usage on training and + // serving. You can use this method to start a join operation on specified + // events with the latest version of product catalog. You can also use this + // method to correct events joined with the wrong product catalog. A rejoin + // operation can take hours or days to complete. rpc RejoinUserEvents(RejoinUserEventsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { @@ -151,11 +152,11 @@ message CollectUserEventRequest { 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. + // `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. + // 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. @@ -174,16 +175,16 @@ message RejoinUserEventsRequest { // 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. + // `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. +// 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. +// Metadata for `RejoinUserEvents` method. message RejoinUserEventsMetadata {} diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index 27ef12657a8..f6b467a7e74 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -34555,6 +34555,9 @@ export namespace google { /** CatalogAttribute recommendationsFilteringOption */ recommendationsFilteringOption?: (google.cloud.retail.v2beta.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2beta.RecommendationsFilteringOption|null); + + /** CatalogAttribute exactSearchableOption */ + exactSearchableOption?: (google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption|null); } /** Represents a CatalogAttribute. */ @@ -34587,6 +34590,9 @@ export namespace google { /** CatalogAttribute recommendationsFilteringOption. */ public recommendationsFilteringOption: (google.cloud.retail.v2beta.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2beta.RecommendationsFilteringOption); + /** CatalogAttribute exactSearchableOption. */ + public exactSearchableOption: (google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption|keyof typeof google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption); + /** * Creates a new CatalogAttribute instance using the specified properties. * @param [properties] Properties to set @@ -34694,6 +34700,13 @@ export namespace google { SEARCHABLE_ENABLED = 1, SEARCHABLE_DISABLED = 2 } + + /** ExactSearchableOption enum. */ + enum ExactSearchableOption { + EXACT_SEARCHABLE_OPTION_UNSPECIFIED = 0, + EXACT_SEARCHABLE_ENABLED = 1, + EXACT_SEARCHABLE_DISABLED = 2 + } } /** Properties of an AttributesConfig. */ @@ -39694,6 +39707,9 @@ export namespace google { /** Product variants */ variants?: (google.cloud.retail.v2beta.IProduct[]|null); + + /** Product localInventories */ + localInventories?: (google.cloud.retail.v2beta.ILocalInventory[]|null); } /** Represents a Product. */ @@ -39804,6 +39820,9 @@ export namespace google { /** Product variants. */ public variants: google.cloud.retail.v2beta.IProduct[]; + /** Product localInventories. */ + public localInventories: google.cloud.retail.v2beta.ILocalInventory[]; + /** Product expiration. */ public expiration?: ("expireTime"|"ttl"); @@ -40706,6 +40725,20 @@ export namespace google { */ public removeCatalogAttribute(request: google.cloud.retail.v2beta.IRemoveCatalogAttributeRequest): Promise; + /** + * Calls BatchRemoveCatalogAttributes. + * @param request BatchRemoveCatalogAttributesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchRemoveCatalogAttributesResponse + */ + public batchRemoveCatalogAttributes(request: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, callback: google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributesCallback): void; + + /** + * Calls BatchRemoveCatalogAttributes. + * @param request BatchRemoveCatalogAttributesRequest message or plain object + * @returns Promise + */ + public batchRemoveCatalogAttributes(request: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest): Promise; + /** * Calls ReplaceCatalogAttribute. * @param request ReplaceCatalogAttributeRequest message or plain object @@ -40793,6 +40826,13 @@ export namespace google { */ type RemoveCatalogAttributeCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.AttributesConfig) => void; + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|batchRemoveCatalogAttributes}. + * @param error Error, if any + * @param [response] BatchRemoveCatalogAttributesResponse + */ + type BatchRemoveCatalogAttributesCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse) => void; + /** * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|replaceCatalogAttribute}. * @param error Error, if any @@ -42043,6 +42083,212 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a BatchRemoveCatalogAttributesRequest. */ + interface IBatchRemoveCatalogAttributesRequest { + + /** BatchRemoveCatalogAttributesRequest attributesConfig */ + attributesConfig?: (string|null); + + /** BatchRemoveCatalogAttributesRequest attributeKeys */ + attributeKeys?: (string[]|null); + } + + /** Represents a BatchRemoveCatalogAttributesRequest. */ + class BatchRemoveCatalogAttributesRequest implements IBatchRemoveCatalogAttributesRequest { + + /** + * Constructs a new BatchRemoveCatalogAttributesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest); + + /** BatchRemoveCatalogAttributesRequest attributesConfig. */ + public attributesConfig: string; + + /** BatchRemoveCatalogAttributesRequest attributeKeys. */ + public attributeKeys: string[]; + + /** + * Creates a new BatchRemoveCatalogAttributesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchRemoveCatalogAttributesRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest; + + /** + * Encodes the specified BatchRemoveCatalogAttributesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest.verify|verify} messages. + * @param message BatchRemoveCatalogAttributesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchRemoveCatalogAttributesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest.verify|verify} messages. + * @param message BatchRemoveCatalogAttributesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchRemoveCatalogAttributesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchRemoveCatalogAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest; + + /** + * Decodes a BatchRemoveCatalogAttributesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchRemoveCatalogAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest; + + /** + * Verifies a BatchRemoveCatalogAttributesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchRemoveCatalogAttributesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchRemoveCatalogAttributesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest; + + /** + * Creates a plain object from a BatchRemoveCatalogAttributesRequest message. Also converts values to other types if specified. + * @param message BatchRemoveCatalogAttributesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchRemoveCatalogAttributesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchRemoveCatalogAttributesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchRemoveCatalogAttributesResponse. */ + interface IBatchRemoveCatalogAttributesResponse { + + /** BatchRemoveCatalogAttributesResponse deletedCatalogAttributes */ + deletedCatalogAttributes?: (string[]|null); + + /** BatchRemoveCatalogAttributesResponse resetCatalogAttributes */ + resetCatalogAttributes?: (string[]|null); + } + + /** Represents a BatchRemoveCatalogAttributesResponse. */ + class BatchRemoveCatalogAttributesResponse implements IBatchRemoveCatalogAttributesResponse { + + /** + * Constructs a new BatchRemoveCatalogAttributesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse); + + /** BatchRemoveCatalogAttributesResponse deletedCatalogAttributes. */ + public deletedCatalogAttributes: string[]; + + /** BatchRemoveCatalogAttributesResponse resetCatalogAttributes. */ + public resetCatalogAttributes: string[]; + + /** + * Creates a new BatchRemoveCatalogAttributesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchRemoveCatalogAttributesResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse; + + /** + * Encodes the specified BatchRemoveCatalogAttributesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse.verify|verify} messages. + * @param message BatchRemoveCatalogAttributesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchRemoveCatalogAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse.verify|verify} messages. + * @param message BatchRemoveCatalogAttributesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchRemoveCatalogAttributesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchRemoveCatalogAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse; + + /** + * Decodes a BatchRemoveCatalogAttributesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchRemoveCatalogAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse; + + /** + * Verifies a BatchRemoveCatalogAttributesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchRemoveCatalogAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchRemoveCatalogAttributesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse; + + /** + * Creates a plain object from a BatchRemoveCatalogAttributesResponse message. Also converts values to other types if specified. + * @param message BatchRemoveCatalogAttributesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchRemoveCatalogAttributesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchRemoveCatalogAttributesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ReplaceCatalogAttributeRequest. */ interface IReplaceCatalogAttributeRequest { @@ -42683,6 +42929,9 @@ export namespace google { /** Control solutionTypes */ solutionTypes?: (google.cloud.retail.v2beta.SolutionType[]|null); + + /** Control searchSolutionUseCase */ + searchSolutionUseCase?: (google.cloud.retail.v2beta.SearchSolutionUseCase[]|null); } /** Represents a Control. */ @@ -42712,6 +42961,9 @@ export namespace google { /** Control solutionTypes. */ public solutionTypes: google.cloud.retail.v2beta.SolutionType[]; + /** Control searchSolutionUseCase. */ + public searchSolutionUseCase: google.cloud.retail.v2beta.SearchSolutionUseCase[]; + /** Control control. */ public control?: ("facetSpec"|"rule"); @@ -44147,6 +44399,9 @@ export namespace google { /** SearchResult variantRollupValues */ variantRollupValues?: ({ [k: string]: google.protobuf.IValue }|null); + + /** SearchResult personalLabels */ + personalLabels?: (string[]|null); } /** Represents a SearchResult. */ @@ -44173,6 +44428,9 @@ export namespace google { /** SearchResult variantRollupValues. */ public variantRollupValues: { [k: string]: google.protobuf.IValue }; + /** SearchResult personalLabels. */ + public personalLabels: string[]; + /** * Creates a new SearchResult instance using the specified properties. * @param [properties] Properties to set @@ -45965,92 +46223,1665 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Represents a PredictionService */ - class PredictionService extends $protobuf.rpc.Service { - - /** - * Constructs a new PredictionService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** Properties of a Model. */ + interface IModel { - /** - * Creates new PredictionService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + /** Model name */ + name?: (string|null); - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @param callback Node-style callback called with the error, if any, and PredictResponse - */ - public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; + /** Model displayName */ + displayName?: (string|null); - /** - * Calls Predict. - * @param request PredictRequest message or plain object - * @returns Promise - */ - public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; - } + /** Model trainingState */ + trainingState?: (google.cloud.retail.v2beta.Model.TrainingState|keyof typeof google.cloud.retail.v2beta.Model.TrainingState|null); - namespace PredictionService { + /** Model servingState */ + servingState?: (google.cloud.retail.v2beta.Model.ServingState|keyof typeof google.cloud.retail.v2beta.Model.ServingState|null); - /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService|predict}. - * @param error Error, if any - * @param [response] PredictResponse - */ - type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; - } + /** Model createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** Properties of a PredictRequest. */ - interface IPredictRequest { + /** Model updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); - /** PredictRequest placement */ - placement?: (string|null); + /** Model type */ + type?: (string|null); - /** PredictRequest userEvent */ - userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + /** Model optimizationObjective */ + optimizationObjective?: (string|null); - /** PredictRequest pageSize */ - pageSize?: (number|null); + /** Model periodicTuningState */ + periodicTuningState?: (google.cloud.retail.v2beta.Model.PeriodicTuningState|keyof typeof google.cloud.retail.v2beta.Model.PeriodicTuningState|null); - /** PredictRequest pageToken */ - pageToken?: (string|null); + /** Model lastTuneTime */ + lastTuneTime?: (google.protobuf.ITimestamp|null); - /** PredictRequest filter */ - filter?: (string|null); + /** Model tuningOperation */ + tuningOperation?: (string|null); - /** PredictRequest validateOnly */ - validateOnly?: (boolean|null); + /** Model dataState */ + dataState?: (google.cloud.retail.v2beta.Model.DataState|keyof typeof google.cloud.retail.v2beta.Model.DataState|null); - /** PredictRequest params */ - params?: ({ [k: string]: google.protobuf.IValue }|null); + /** Model filteringOption */ + filteringOption?: (google.cloud.retail.v2beta.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2beta.RecommendationsFilteringOption|null); - /** PredictRequest labels */ - labels?: ({ [k: string]: string }|null); + /** Model servingConfigLists */ + servingConfigLists?: (google.cloud.retail.v2beta.Model.IServingConfigList[]|null); } - /** Represents a PredictRequest. */ - class PredictRequest implements IPredictRequest { + /** Represents a Model. */ + class Model implements IModel { /** - * Constructs a new PredictRequest. + * Constructs a new Model. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); + constructor(properties?: google.cloud.retail.v2beta.IModel); - /** PredictRequest placement. */ - public placement: string; + /** Model name. */ + public name: string; - /** PredictRequest userEvent. */ + /** Model displayName. */ + public displayName: string; + + /** Model trainingState. */ + public trainingState: (google.cloud.retail.v2beta.Model.TrainingState|keyof typeof google.cloud.retail.v2beta.Model.TrainingState); + + /** Model servingState. */ + public servingState: (google.cloud.retail.v2beta.Model.ServingState|keyof typeof google.cloud.retail.v2beta.Model.ServingState); + + /** Model createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Model updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Model type. */ + public type: string; + + /** Model optimizationObjective. */ + public optimizationObjective: string; + + /** Model periodicTuningState. */ + public periodicTuningState: (google.cloud.retail.v2beta.Model.PeriodicTuningState|keyof typeof google.cloud.retail.v2beta.Model.PeriodicTuningState); + + /** Model lastTuneTime. */ + public lastTuneTime?: (google.protobuf.ITimestamp|null); + + /** Model tuningOperation. */ + public tuningOperation: string; + + /** Model dataState. */ + public dataState: (google.cloud.retail.v2beta.Model.DataState|keyof typeof google.cloud.retail.v2beta.Model.DataState); + + /** Model filteringOption. */ + public filteringOption: (google.cloud.retail.v2beta.RecommendationsFilteringOption|keyof typeof google.cloud.retail.v2beta.RecommendationsFilteringOption); + + /** Model servingConfigLists. */ + public servingConfigLists: google.cloud.retail.v2beta.Model.IServingConfigList[]; + + /** + * Creates a new Model instance using the specified properties. + * @param [properties] Properties to set + * @returns Model instance + */ + public static create(properties?: google.cloud.retail.v2beta.IModel): google.cloud.retail.v2beta.Model; + + /** + * Encodes the specified Model message. Does not implicitly {@link google.cloud.retail.v2beta.Model.verify|verify} messages. + * @param message Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IModel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Model message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Model.verify|verify} messages. + * @param message Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IModel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Model message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Model; + + /** + * Decodes a Model message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Model; + + /** + * Verifies a Model message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Model message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Model + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Model; + + /** + * Creates a plain object from a Model message. Also converts values to other types if specified. + * @param message Model + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Model, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Model to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Model + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Model { + + /** Properties of a ServingConfigList. */ + interface IServingConfigList { + + /** ServingConfigList servingConfigIds */ + servingConfigIds?: (string[]|null); + } + + /** Represents a ServingConfigList. */ + class ServingConfigList implements IServingConfigList { + + /** + * Constructs a new ServingConfigList. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.Model.IServingConfigList); + + /** ServingConfigList servingConfigIds. */ + public servingConfigIds: string[]; + + /** + * Creates a new ServingConfigList instance using the specified properties. + * @param [properties] Properties to set + * @returns ServingConfigList instance + */ + public static create(properties?: google.cloud.retail.v2beta.Model.IServingConfigList): google.cloud.retail.v2beta.Model.ServingConfigList; + + /** + * Encodes the specified ServingConfigList message. Does not implicitly {@link google.cloud.retail.v2beta.Model.ServingConfigList.verify|verify} messages. + * @param message ServingConfigList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.Model.IServingConfigList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServingConfigList message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Model.ServingConfigList.verify|verify} messages. + * @param message ServingConfigList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.Model.IServingConfigList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.Model.ServingConfigList; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.Model.ServingConfigList; + + /** + * Verifies a ServingConfigList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServingConfigList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServingConfigList + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.Model.ServingConfigList; + + /** + * Creates a plain object from a ServingConfigList message. Also converts values to other types if specified. + * @param message ServingConfigList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.Model.ServingConfigList, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServingConfigList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServingConfigList + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** ServingState enum. */ + enum ServingState { + SERVING_STATE_UNSPECIFIED = 0, + INACTIVE = 1, + ACTIVE = 2, + TUNED = 3 + } + + /** TrainingState enum. */ + enum TrainingState { + TRAINING_STATE_UNSPECIFIED = 0, + PAUSED = 1, + TRAINING = 2 + } + + /** PeriodicTuningState enum. */ + enum PeriodicTuningState { + PERIODIC_TUNING_STATE_UNSPECIFIED = 0, + PERIODIC_TUNING_DISABLED = 1, + ALL_TUNING_DISABLED = 3, + PERIODIC_TUNING_ENABLED = 2 + } + + /** DataState enum. */ + enum DataState { + DATA_STATE_UNSPECIFIED = 0, + DATA_OK = 1, + DATA_ERROR = 2 + } + } + + /** Represents a ModelService */ + class ModelService extends $protobuf.rpc.Service { + + /** + * Constructs a new ModelService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new ModelService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ModelService; + + /** + * Calls CreateModel. + * @param request CreateModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createModel(request: google.cloud.retail.v2beta.ICreateModelRequest, callback: google.cloud.retail.v2beta.ModelService.CreateModelCallback): void; + + /** + * Calls CreateModel. + * @param request CreateModelRequest message or plain object + * @returns Promise + */ + public createModel(request: google.cloud.retail.v2beta.ICreateModelRequest): Promise; + + /** + * Calls PauseModel. + * @param request PauseModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Model + */ + public pauseModel(request: google.cloud.retail.v2beta.IPauseModelRequest, callback: google.cloud.retail.v2beta.ModelService.PauseModelCallback): void; + + /** + * Calls PauseModel. + * @param request PauseModelRequest message or plain object + * @returns Promise + */ + public pauseModel(request: google.cloud.retail.v2beta.IPauseModelRequest): Promise; + + /** + * Calls ResumeModel. + * @param request ResumeModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Model + */ + public resumeModel(request: google.cloud.retail.v2beta.IResumeModelRequest, callback: google.cloud.retail.v2beta.ModelService.ResumeModelCallback): void; + + /** + * Calls ResumeModel. + * @param request ResumeModelRequest message or plain object + * @returns Promise + */ + public resumeModel(request: google.cloud.retail.v2beta.IResumeModelRequest): Promise; + + /** + * Calls DeleteModel. + * @param request DeleteModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteModel(request: google.cloud.retail.v2beta.IDeleteModelRequest, callback: google.cloud.retail.v2beta.ModelService.DeleteModelCallback): void; + + /** + * Calls DeleteModel. + * @param request DeleteModelRequest message or plain object + * @returns Promise + */ + public deleteModel(request: google.cloud.retail.v2beta.IDeleteModelRequest): Promise; + + /** + * Calls ListModels. + * @param request ListModelsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListModelsResponse + */ + public listModels(request: google.cloud.retail.v2beta.IListModelsRequest, callback: google.cloud.retail.v2beta.ModelService.ListModelsCallback): void; + + /** + * Calls ListModels. + * @param request ListModelsRequest message or plain object + * @returns Promise + */ + public listModels(request: google.cloud.retail.v2beta.IListModelsRequest): Promise; + + /** + * Calls UpdateModel. + * @param request UpdateModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Model + */ + public updateModel(request: google.cloud.retail.v2beta.IUpdateModelRequest, callback: google.cloud.retail.v2beta.ModelService.UpdateModelCallback): void; + + /** + * Calls UpdateModel. + * @param request UpdateModelRequest message or plain object + * @returns Promise + */ + public updateModel(request: google.cloud.retail.v2beta.IUpdateModelRequest): Promise; + + /** + * Calls TuneModel. + * @param request TuneModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public tuneModel(request: google.cloud.retail.v2beta.ITuneModelRequest, callback: google.cloud.retail.v2beta.ModelService.TuneModelCallback): void; + + /** + * Calls TuneModel. + * @param request TuneModelRequest message or plain object + * @returns Promise + */ + public tuneModel(request: google.cloud.retail.v2beta.ITuneModelRequest): Promise; + } + + namespace ModelService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|createModel}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|pauseModel}. + * @param error Error, if any + * @param [response] Model + */ + type PauseModelCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Model) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|resumeModel}. + * @param error Error, if any + * @param [response] Model + */ + type ResumeModelCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Model) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|deleteModel}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteModelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|listModels}. + * @param error Error, if any + * @param [response] ListModelsResponse + */ + type ListModelsCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.ListModelsResponse) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|updateModel}. + * @param error Error, if any + * @param [response] Model + */ + type UpdateModelCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.Model) => void; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|tuneModel}. + * @param error Error, if any + * @param [response] Operation + */ + type TuneModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateModelRequest. */ + interface ICreateModelRequest { + + /** CreateModelRequest parent */ + parent?: (string|null); + + /** CreateModelRequest model */ + model?: (google.cloud.retail.v2beta.IModel|null); + + /** CreateModelRequest dryRun */ + dryRun?: (boolean|null); + } + + /** Represents a CreateModelRequest. */ + class CreateModelRequest implements ICreateModelRequest { + + /** + * Constructs a new CreateModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICreateModelRequest); + + /** CreateModelRequest parent. */ + public parent: string; + + /** CreateModelRequest model. */ + public model?: (google.cloud.retail.v2beta.IModel|null); + + /** CreateModelRequest dryRun. */ + public dryRun: boolean; + + /** + * Creates a new CreateModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICreateModelRequest): google.cloud.retail.v2beta.CreateModelRequest; + + /** + * Encodes the specified CreateModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelRequest.verify|verify} messages. + * @param message CreateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICreateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelRequest.verify|verify} messages. + * @param message CreateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateModelRequest; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateModelRequest; + + /** + * Verifies a CreateModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateModelRequest; + + /** + * Creates a plain object from a CreateModelRequest message. Also converts values to other types if specified. + * @param message CreateModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CreateModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateModelRequest. */ + interface IUpdateModelRequest { + + /** UpdateModelRequest model */ + model?: (google.cloud.retail.v2beta.IModel|null); + + /** UpdateModelRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateModelRequest. */ + class UpdateModelRequest implements IUpdateModelRequest { + + /** + * Constructs a new UpdateModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IUpdateModelRequest); + + /** UpdateModelRequest model. */ + public model?: (google.cloud.retail.v2beta.IModel|null); + + /** UpdateModelRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IUpdateModelRequest): google.cloud.retail.v2beta.UpdateModelRequest; + + /** + * Encodes the specified UpdateModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateModelRequest.verify|verify} messages. + * @param message UpdateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IUpdateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateModelRequest.verify|verify} messages. + * @param message UpdateModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IUpdateModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.UpdateModelRequest; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.UpdateModelRequest; + + /** + * Verifies an UpdateModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.UpdateModelRequest; + + /** + * Creates a plain object from an UpdateModelRequest message. Also converts values to other types if specified. + * @param message UpdateModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.UpdateModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PauseModelRequest. */ + interface IPauseModelRequest { + + /** PauseModelRequest name */ + name?: (string|null); + } + + /** Represents a PauseModelRequest. */ + class PauseModelRequest implements IPauseModelRequest { + + /** + * Constructs a new PauseModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPauseModelRequest); + + /** PauseModelRequest name. */ + public name: string; + + /** + * Creates a new PauseModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PauseModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IPauseModelRequest): google.cloud.retail.v2beta.PauseModelRequest; + + /** + * Encodes the specified PauseModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PauseModelRequest.verify|verify} messages. + * @param message PauseModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IPauseModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PauseModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PauseModelRequest.verify|verify} messages. + * @param message PauseModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IPauseModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.PauseModelRequest; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.PauseModelRequest; + + /** + * Verifies a PauseModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PauseModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PauseModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.PauseModelRequest; + + /** + * Creates a plain object from a PauseModelRequest message. Also converts values to other types if specified. + * @param message PauseModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.PauseModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PauseModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PauseModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ResumeModelRequest. */ + interface IResumeModelRequest { + + /** ResumeModelRequest name */ + name?: (string|null); + } + + /** Represents a ResumeModelRequest. */ + class ResumeModelRequest implements IResumeModelRequest { + + /** + * Constructs a new ResumeModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IResumeModelRequest); + + /** ResumeModelRequest name. */ + public name: string; + + /** + * Creates a new ResumeModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ResumeModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IResumeModelRequest): google.cloud.retail.v2beta.ResumeModelRequest; + + /** + * Encodes the specified ResumeModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ResumeModelRequest.verify|verify} messages. + * @param message ResumeModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IResumeModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResumeModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ResumeModelRequest.verify|verify} messages. + * @param message ResumeModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IResumeModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ResumeModelRequest; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ResumeModelRequest; + + /** + * Verifies a ResumeModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResumeModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResumeModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ResumeModelRequest; + + /** + * Creates a plain object from a ResumeModelRequest message. Also converts values to other types if specified. + * @param message ResumeModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ResumeModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResumeModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResumeModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListModelsRequest. */ + interface IListModelsRequest { + + /** ListModelsRequest parent */ + parent?: (string|null); + + /** ListModelsRequest pageSize */ + pageSize?: (number|null); + + /** ListModelsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListModelsRequest. */ + class ListModelsRequest implements IListModelsRequest { + + /** + * Constructs a new ListModelsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListModelsRequest); + + /** ListModelsRequest parent. */ + public parent: string; + + /** ListModelsRequest pageSize. */ + public pageSize: number; + + /** ListModelsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListModelsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListModelsRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListModelsRequest): google.cloud.retail.v2beta.ListModelsRequest; + + /** + * Encodes the specified ListModelsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsRequest.verify|verify} messages. + * @param message ListModelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListModelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListModelsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsRequest.verify|verify} messages. + * @param message ListModelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListModelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListModelsRequest; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListModelsRequest; + + /** + * Verifies a ListModelsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListModelsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListModelsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListModelsRequest; + + /** + * Creates a plain object from a ListModelsRequest message. Also converts values to other types if specified. + * @param message ListModelsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListModelsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListModelsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListModelsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteModelRequest. */ + interface IDeleteModelRequest { + + /** DeleteModelRequest name */ + name?: (string|null); + } + + /** Represents a DeleteModelRequest. */ + class DeleteModelRequest implements IDeleteModelRequest { + + /** + * Constructs a new DeleteModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IDeleteModelRequest); + + /** DeleteModelRequest name. */ + public name: string; + + /** + * Creates a new DeleteModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.IDeleteModelRequest): google.cloud.retail.v2beta.DeleteModelRequest; + + /** + * Encodes the specified DeleteModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteModelRequest.verify|verify} messages. + * @param message DeleteModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IDeleteModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteModelRequest.verify|verify} messages. + * @param message DeleteModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IDeleteModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.DeleteModelRequest; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.DeleteModelRequest; + + /** + * Verifies a DeleteModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.DeleteModelRequest; + + /** + * Creates a plain object from a DeleteModelRequest message. Also converts values to other types if specified. + * @param message DeleteModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.DeleteModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListModelsResponse. */ + interface IListModelsResponse { + + /** ListModelsResponse models */ + models?: (google.cloud.retail.v2beta.IModel[]|null); + + /** ListModelsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListModelsResponse. */ + class ListModelsResponse implements IListModelsResponse { + + /** + * Constructs a new ListModelsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IListModelsResponse); + + /** ListModelsResponse models. */ + public models: google.cloud.retail.v2beta.IModel[]; + + /** ListModelsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListModelsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListModelsResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.IListModelsResponse): google.cloud.retail.v2beta.ListModelsResponse; + + /** + * Encodes the specified ListModelsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsResponse.verify|verify} messages. + * @param message ListModelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.IListModelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListModelsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsResponse.verify|verify} messages. + * @param message ListModelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.IListModelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.ListModelsResponse; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.ListModelsResponse; + + /** + * Verifies a ListModelsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListModelsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListModelsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.ListModelsResponse; + + /** + * Creates a plain object from a ListModelsResponse message. Also converts values to other types if specified. + * @param message ListModelsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.ListModelsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListModelsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListModelsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TuneModelRequest. */ + interface ITuneModelRequest { + + /** TuneModelRequest name */ + name?: (string|null); + } + + /** Represents a TuneModelRequest. */ + class TuneModelRequest implements ITuneModelRequest { + + /** + * Constructs a new TuneModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ITuneModelRequest); + + /** TuneModelRequest name. */ + public name: string; + + /** + * Creates a new TuneModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TuneModelRequest instance + */ + public static create(properties?: google.cloud.retail.v2beta.ITuneModelRequest): google.cloud.retail.v2beta.TuneModelRequest; + + /** + * Encodes the specified TuneModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelRequest.verify|verify} messages. + * @param message TuneModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ITuneModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TuneModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelRequest.verify|verify} messages. + * @param message TuneModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ITuneModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TuneModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TuneModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.TuneModelRequest; + + /** + * Decodes a TuneModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TuneModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.TuneModelRequest; + + /** + * Verifies a TuneModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TuneModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TuneModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.TuneModelRequest; + + /** + * Creates a plain object from a TuneModelRequest message. Also converts values to other types if specified. + * @param message TuneModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.TuneModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TuneModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TuneModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateModelMetadata. */ + interface ICreateModelMetadata { + + /** CreateModelMetadata model */ + model?: (string|null); + } + + /** Represents a CreateModelMetadata. */ + class CreateModelMetadata implements ICreateModelMetadata { + + /** + * Constructs a new CreateModelMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ICreateModelMetadata); + + /** CreateModelMetadata model. */ + public model: string; + + /** + * Creates a new CreateModelMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateModelMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.ICreateModelMetadata): google.cloud.retail.v2beta.CreateModelMetadata; + + /** + * Encodes the specified CreateModelMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelMetadata.verify|verify} messages. + * @param message CreateModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ICreateModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelMetadata.verify|verify} messages. + * @param message CreateModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ICreateModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateModelMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.CreateModelMetadata; + + /** + * Decodes a CreateModelMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.CreateModelMetadata; + + /** + * Verifies a CreateModelMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateModelMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateModelMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.CreateModelMetadata; + + /** + * Creates a plain object from a CreateModelMetadata message. Also converts values to other types if specified. + * @param message CreateModelMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.CreateModelMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateModelMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateModelMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TuneModelMetadata. */ + interface ITuneModelMetadata { + + /** TuneModelMetadata model */ + model?: (string|null); + } + + /** Represents a TuneModelMetadata. */ + class TuneModelMetadata implements ITuneModelMetadata { + + /** + * Constructs a new TuneModelMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ITuneModelMetadata); + + /** TuneModelMetadata model. */ + public model: string; + + /** + * Creates a new TuneModelMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns TuneModelMetadata instance + */ + public static create(properties?: google.cloud.retail.v2beta.ITuneModelMetadata): google.cloud.retail.v2beta.TuneModelMetadata; + + /** + * Encodes the specified TuneModelMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelMetadata.verify|verify} messages. + * @param message TuneModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ITuneModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TuneModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelMetadata.verify|verify} messages. + * @param message TuneModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ITuneModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TuneModelMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TuneModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.TuneModelMetadata; + + /** + * Decodes a TuneModelMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TuneModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.TuneModelMetadata; + + /** + * Verifies a TuneModelMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TuneModelMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TuneModelMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.TuneModelMetadata; + + /** + * Creates a plain object from a TuneModelMetadata message. Also converts values to other types if specified. + * @param message TuneModelMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.TuneModelMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TuneModelMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TuneModelMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TuneModelResponse. */ + interface ITuneModelResponse { + } + + /** Represents a TuneModelResponse. */ + class TuneModelResponse implements ITuneModelResponse { + + /** + * Constructs a new TuneModelResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.ITuneModelResponse); + + /** + * Creates a new TuneModelResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TuneModelResponse instance + */ + public static create(properties?: google.cloud.retail.v2beta.ITuneModelResponse): google.cloud.retail.v2beta.TuneModelResponse; + + /** + * Encodes the specified TuneModelResponse message. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelResponse.verify|verify} messages. + * @param message TuneModelResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2beta.ITuneModelResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TuneModelResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelResponse.verify|verify} messages. + * @param message TuneModelResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2beta.ITuneModelResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TuneModelResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TuneModelResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2beta.TuneModelResponse; + + /** + * Decodes a TuneModelResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TuneModelResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2beta.TuneModelResponse; + + /** + * Verifies a TuneModelResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TuneModelResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TuneModelResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2beta.TuneModelResponse; + + /** + * Creates a plain object from a TuneModelResponse message. Also converts values to other types if specified. + * @param message TuneModelResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2beta.TuneModelResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TuneModelResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TuneModelResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a PredictionService */ + class PredictionService extends $protobuf.rpc.Service { + + /** + * Constructs a new PredictionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): PredictionService; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PredictResponse + */ + public predict(request: google.cloud.retail.v2beta.IPredictRequest, callback: google.cloud.retail.v2beta.PredictionService.PredictCallback): void; + + /** + * Calls Predict. + * @param request PredictRequest message or plain object + * @returns Promise + */ + public predict(request: google.cloud.retail.v2beta.IPredictRequest): Promise; + } + + namespace PredictionService { + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService|predict}. + * @param error Error, if any + * @param [response] PredictResponse + */ + type PredictCallback = (error: (Error|null), response?: google.cloud.retail.v2beta.PredictResponse) => void; + } + + /** Properties of a PredictRequest. */ + interface IPredictRequest { + + /** PredictRequest placement */ + placement?: (string|null); + + /** PredictRequest userEvent */ + userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); + + /** PredictRequest pageSize */ + pageSize?: (number|null); + + /** PredictRequest pageToken */ + pageToken?: (string|null); + + /** PredictRequest filter */ + filter?: (string|null); + + /** PredictRequest validateOnly */ + validateOnly?: (boolean|null); + + /** PredictRequest params */ + params?: ({ [k: string]: google.protobuf.IValue }|null); + + /** PredictRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a PredictRequest. */ + class PredictRequest implements IPredictRequest { + + /** + * Constructs a new PredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2beta.IPredictRequest); + + /** PredictRequest placement. */ + public placement: string; + + /** PredictRequest userEvent. */ public userEvent?: (google.cloud.retail.v2beta.IUserEvent|null); /** PredictRequest pageSize. */ @@ -49109,9 +50940,15 @@ export namespace google { /** ServingConfig diversityLevel */ diversityLevel?: (string|null); + /** ServingConfig diversityType */ + diversityType?: (google.cloud.retail.v2beta.ServingConfig.DiversityType|keyof typeof google.cloud.retail.v2beta.ServingConfig.DiversityType|null); + /** ServingConfig enableCategoryFilterLevel */ enableCategoryFilterLevel?: (string|null); + /** ServingConfig personalizationSpec */ + personalizationSpec?: (google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null); + /** ServingConfig solutionTypes */ solutionTypes?: (google.cloud.retail.v2beta.SolutionType[]|null); } @@ -49170,9 +51007,15 @@ export namespace google { /** ServingConfig diversityLevel. */ public diversityLevel: string; + /** ServingConfig diversityType. */ + public diversityType: (google.cloud.retail.v2beta.ServingConfig.DiversityType|keyof typeof google.cloud.retail.v2beta.ServingConfig.DiversityType); + /** ServingConfig enableCategoryFilterLevel. */ public enableCategoryFilterLevel: string; + /** ServingConfig personalizationSpec. */ + public personalizationSpec?: (google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null); + /** ServingConfig solutionTypes. */ public solutionTypes: google.cloud.retail.v2beta.SolutionType[]; @@ -49254,6 +51097,16 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace ServingConfig { + + /** DiversityType enum. */ + enum DiversityType { + DIVERSITY_TYPE_UNSPECIFIED = 0, + RULE_BASED_DIVERSITY = 2, + DATA_DRIVEN_DIVERSITY = 3 + } + } + /** Represents a ServingConfigService */ class ServingConfigService extends $protobuf.rpc.Service { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index 855c45cbae7..cff7afe8843 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -84638,6 +84638,7 @@ * @property {google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption|null} [dynamicFacetableOption] CatalogAttribute dynamicFacetableOption * @property {google.cloud.retail.v2beta.CatalogAttribute.SearchableOption|null} [searchableOption] CatalogAttribute searchableOption * @property {google.cloud.retail.v2beta.RecommendationsFilteringOption|null} [recommendationsFilteringOption] CatalogAttribute recommendationsFilteringOption + * @property {google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption|null} [exactSearchableOption] CatalogAttribute exactSearchableOption */ /** @@ -84711,6 +84712,14 @@ */ CatalogAttribute.prototype.recommendationsFilteringOption = 0; + /** + * CatalogAttribute exactSearchableOption. + * @member {google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption} exactSearchableOption + * @memberof google.cloud.retail.v2beta.CatalogAttribute + * @instance + */ + CatalogAttribute.prototype.exactSearchableOption = 0; + /** * Creates a new CatalogAttribute instance using the specified properties. * @function create @@ -84749,6 +84758,8 @@ writer.uint32(/* id 9, wireType 0 =*/72).bool(message.inUse); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.type); + if (message.exactSearchableOption != null && Object.hasOwnProperty.call(message, "exactSearchableOption")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.exactSearchableOption); return writer; }; @@ -84811,6 +84822,10 @@ message.recommendationsFilteringOption = reader.int32(); break; } + case 11: { + message.exactSearchableOption = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -84897,6 +84912,15 @@ case 3: break; } + if (message.exactSearchableOption != null && message.hasOwnProperty("exactSearchableOption")) + switch (message.exactSearchableOption) { + default: + return "exactSearchableOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -84986,6 +85010,20 @@ message.recommendationsFilteringOption = 3; break; } + switch (object.exactSearchableOption) { + case "EXACT_SEARCHABLE_OPTION_UNSPECIFIED": + case 0: + message.exactSearchableOption = 0; + break; + case "EXACT_SEARCHABLE_ENABLED": + case 1: + message.exactSearchableOption = 1; + break; + case "EXACT_SEARCHABLE_DISABLED": + case 2: + message.exactSearchableOption = 2; + break; + } return message; }; @@ -85010,6 +85048,7 @@ object.recommendationsFilteringOption = options.enums === String ? "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" : 0; object.inUse = false; object.type = options.enums === String ? "UNKNOWN" : 0; + object.exactSearchableOption = options.enums === String ? "EXACT_SEARCHABLE_OPTION_UNSPECIFIED" : 0; } if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; @@ -85025,6 +85064,8 @@ object.inUse = message.inUse; if (message.type != null && message.hasOwnProperty("type")) object.type = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.AttributeType[message.type] : message.type; + if (message.exactSearchableOption != null && message.hasOwnProperty("exactSearchableOption")) + object.exactSearchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption[message.exactSearchableOption] : message.exactSearchableOption; return object; }; @@ -85118,6 +85159,22 @@ return values; })(); + /** + * ExactSearchableOption enum. + * @name google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption + * @enum {number} + * @property {number} EXACT_SEARCHABLE_OPTION_UNSPECIFIED=0 EXACT_SEARCHABLE_OPTION_UNSPECIFIED value + * @property {number} EXACT_SEARCHABLE_ENABLED=1 EXACT_SEARCHABLE_ENABLED value + * @property {number} EXACT_SEARCHABLE_DISABLED=2 EXACT_SEARCHABLE_DISABLED value + */ + CatalogAttribute.ExactSearchableOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EXACT_SEARCHABLE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "EXACT_SEARCHABLE_ENABLED"] = 1; + values[valuesById[2] = "EXACT_SEARCHABLE_DISABLED"] = 2; + return values; + })(); + return CatalogAttribute; })(); @@ -97495,6 +97552,7 @@ * @property {google.protobuf.ITimestamp|null} [publishTime] Product publishTime * @property {google.protobuf.IFieldMask|null} [retrievableFields] Product retrievableFields * @property {Array.|null} [variants] Product variants + * @property {Array.|null} [localInventories] Product localInventories */ /** @@ -97519,6 +97577,7 @@ this.conditions = []; this.promotions = []; this.variants = []; + this.localInventories = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -97789,6 +97848,14 @@ */ Product.prototype.variants = $util.emptyArray; + /** + * Product localInventories. + * @member {Array.} localInventories + * @memberof google.cloud.retail.v2beta.Product + * @instance + */ + Product.prototype.localInventories = $util.emptyArray; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -97908,6 +97975,9 @@ if (message.promotions != null && message.promotions.length) for (var i = 0; i < message.promotions.length; ++i) $root.google.cloud.retail.v2beta.Promotion.encode(message.promotions[i], writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.localInventories != null && message.localInventories.length) + for (var i = 0; i < message.localInventories.length; ++i) + $root.google.cloud.retail.v2beta.LocalInventory.encode(message.localInventories[i], writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); return writer; }; @@ -98117,6 +98187,12 @@ message.variants.push($root.google.cloud.retail.v2beta.Product.decode(reader, reader.uint32())); break; } + case 35: { + if (!(message.localInventories && message.localInventories.length)) + message.localInventories = []; + message.localInventories.push($root.google.cloud.retail.v2beta.LocalInventory.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -98358,6 +98434,15 @@ return "variants." + error; } } + if (message.localInventories != null && message.hasOwnProperty("localInventories")) { + if (!Array.isArray(message.localInventories)) + return "localInventories: array expected"; + for (var i = 0; i < message.localInventories.length; ++i) { + var error = $root.google.cloud.retail.v2beta.LocalInventory.verify(message.localInventories[i]); + if (error) + return "localInventories." + error; + } + } return null; }; @@ -98585,6 +98670,16 @@ message.variants[i] = $root.google.cloud.retail.v2beta.Product.fromObject(object.variants[i]); } } + if (object.localInventories) { + if (!Array.isArray(object.localInventories)) + throw TypeError(".google.cloud.retail.v2beta.Product.localInventories: array expected"); + message.localInventories = []; + for (var i = 0; i < object.localInventories.length; ++i) { + if (typeof object.localInventories[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Product.localInventories: object expected"); + message.localInventories[i] = $root.google.cloud.retail.v2beta.LocalInventory.fromObject(object.localInventories[i]); + } + } return message; }; @@ -98614,6 +98709,7 @@ object.conditions = []; object.variants = []; object.promotions = []; + object.localInventories = []; } if (options.objects || options.defaults) object.attributes = {}; @@ -98749,6 +98845,11 @@ for (var j = 0; j < message.promotions.length; ++j) object.promotions[j] = $root.google.cloud.retail.v2beta.Promotion.toObject(message.promotions[j], options); } + if (message.localInventories && message.localInventories.length) { + object.localInventories = []; + for (var j = 0; j < message.localInventories.length; ++j) + object.localInventories[j] = $root.google.cloud.retail.v2beta.LocalInventory.toObject(message.localInventories[j], options); + } return object; }; @@ -100926,6 +101027,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|batchRemoveCatalogAttributes}. + * @memberof google.cloud.retail.v2beta.CatalogService + * @typedef BatchRemoveCatalogAttributesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse} [response] BatchRemoveCatalogAttributesResponse + */ + + /** + * Calls BatchRemoveCatalogAttributes. + * @function batchRemoveCatalogAttributes + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest} request BatchRemoveCatalogAttributesRequest message or plain object + * @param {google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributesCallback} callback Node-style callback called with the error, if any, and BatchRemoveCatalogAttributesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CatalogService.prototype.batchRemoveCatalogAttributes = function batchRemoveCatalogAttributes(request, callback) { + return this.rpcCall(batchRemoveCatalogAttributes, $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest, $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse, request, callback); + }, "name", { value: "BatchRemoveCatalogAttributes" }); + + /** + * Calls BatchRemoveCatalogAttributes. + * @function batchRemoveCatalogAttributes + * @memberof google.cloud.retail.v2beta.CatalogService + * @instance + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest} request BatchRemoveCatalogAttributesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.retail.v2beta.CatalogService|replaceCatalogAttribute}. * @memberof google.cloud.retail.v2beta.CatalogService @@ -103767,6 +103901,508 @@ return RemoveCatalogAttributeRequest; })(); + v2beta.BatchRemoveCatalogAttributesRequest = (function() { + + /** + * Properties of a BatchRemoveCatalogAttributesRequest. + * @memberof google.cloud.retail.v2beta + * @interface IBatchRemoveCatalogAttributesRequest + * @property {string|null} [attributesConfig] BatchRemoveCatalogAttributesRequest attributesConfig + * @property {Array.|null} [attributeKeys] BatchRemoveCatalogAttributesRequest attributeKeys + */ + + /** + * Constructs a new BatchRemoveCatalogAttributesRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a BatchRemoveCatalogAttributesRequest. + * @implements IBatchRemoveCatalogAttributesRequest + * @constructor + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest=} [properties] Properties to set + */ + function BatchRemoveCatalogAttributesRequest(properties) { + this.attributeKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchRemoveCatalogAttributesRequest attributesConfig. + * @member {string} attributesConfig + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @instance + */ + BatchRemoveCatalogAttributesRequest.prototype.attributesConfig = ""; + + /** + * BatchRemoveCatalogAttributesRequest attributeKeys. + * @member {Array.} attributeKeys + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @instance + */ + BatchRemoveCatalogAttributesRequest.prototype.attributeKeys = $util.emptyArray; + + /** + * Creates a new BatchRemoveCatalogAttributesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest} BatchRemoveCatalogAttributesRequest instance + */ + BatchRemoveCatalogAttributesRequest.create = function create(properties) { + return new BatchRemoveCatalogAttributesRequest(properties); + }; + + /** + * Encodes the specified BatchRemoveCatalogAttributesRequest message. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest} message BatchRemoveCatalogAttributesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchRemoveCatalogAttributesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attributesConfig != null && Object.hasOwnProperty.call(message, "attributesConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attributesConfig); + if (message.attributeKeys != null && message.attributeKeys.length) + for (var i = 0; i < message.attributeKeys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.attributeKeys[i]); + return writer; + }; + + /** + * Encodes the specified BatchRemoveCatalogAttributesRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest} message BatchRemoveCatalogAttributesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchRemoveCatalogAttributesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchRemoveCatalogAttributesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest} BatchRemoveCatalogAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchRemoveCatalogAttributesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.attributesConfig = reader.string(); + break; + } + case 2: { + if (!(message.attributeKeys && message.attributeKeys.length)) + message.attributeKeys = []; + message.attributeKeys.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchRemoveCatalogAttributesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest} BatchRemoveCatalogAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchRemoveCatalogAttributesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchRemoveCatalogAttributesRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchRemoveCatalogAttributesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + if (!$util.isString(message.attributesConfig)) + return "attributesConfig: string expected"; + if (message.attributeKeys != null && message.hasOwnProperty("attributeKeys")) { + if (!Array.isArray(message.attributeKeys)) + return "attributeKeys: array expected"; + for (var i = 0; i < message.attributeKeys.length; ++i) + if (!$util.isString(message.attributeKeys[i])) + return "attributeKeys: string[] expected"; + } + return null; + }; + + /** + * Creates a BatchRemoveCatalogAttributesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest} BatchRemoveCatalogAttributesRequest + */ + BatchRemoveCatalogAttributesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest(); + if (object.attributesConfig != null) + message.attributesConfig = String(object.attributesConfig); + if (object.attributeKeys) { + if (!Array.isArray(object.attributeKeys)) + throw TypeError(".google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest.attributeKeys: array expected"); + message.attributeKeys = []; + for (var i = 0; i < object.attributeKeys.length; ++i) + message.attributeKeys[i] = String(object.attributeKeys[i]); + } + return message; + }; + + /** + * Creates a plain object from a BatchRemoveCatalogAttributesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest} message BatchRemoveCatalogAttributesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchRemoveCatalogAttributesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.attributeKeys = []; + if (options.defaults) + object.attributesConfig = ""; + if (message.attributesConfig != null && message.hasOwnProperty("attributesConfig")) + object.attributesConfig = message.attributesConfig; + if (message.attributeKeys && message.attributeKeys.length) { + object.attributeKeys = []; + for (var j = 0; j < message.attributeKeys.length; ++j) + object.attributeKeys[j] = message.attributeKeys[j]; + } + return object; + }; + + /** + * Converts this BatchRemoveCatalogAttributesRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchRemoveCatalogAttributesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchRemoveCatalogAttributesRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchRemoveCatalogAttributesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest"; + }; + + return BatchRemoveCatalogAttributesRequest; + })(); + + v2beta.BatchRemoveCatalogAttributesResponse = (function() { + + /** + * Properties of a BatchRemoveCatalogAttributesResponse. + * @memberof google.cloud.retail.v2beta + * @interface IBatchRemoveCatalogAttributesResponse + * @property {Array.|null} [deletedCatalogAttributes] BatchRemoveCatalogAttributesResponse deletedCatalogAttributes + * @property {Array.|null} [resetCatalogAttributes] BatchRemoveCatalogAttributesResponse resetCatalogAttributes + */ + + /** + * Constructs a new BatchRemoveCatalogAttributesResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a BatchRemoveCatalogAttributesResponse. + * @implements IBatchRemoveCatalogAttributesResponse + * @constructor + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse=} [properties] Properties to set + */ + function BatchRemoveCatalogAttributesResponse(properties) { + this.deletedCatalogAttributes = []; + this.resetCatalogAttributes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchRemoveCatalogAttributesResponse deletedCatalogAttributes. + * @member {Array.} deletedCatalogAttributes + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @instance + */ + BatchRemoveCatalogAttributesResponse.prototype.deletedCatalogAttributes = $util.emptyArray; + + /** + * BatchRemoveCatalogAttributesResponse resetCatalogAttributes. + * @member {Array.} resetCatalogAttributes + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @instance + */ + BatchRemoveCatalogAttributesResponse.prototype.resetCatalogAttributes = $util.emptyArray; + + /** + * Creates a new BatchRemoveCatalogAttributesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse} BatchRemoveCatalogAttributesResponse instance + */ + BatchRemoveCatalogAttributesResponse.create = function create(properties) { + return new BatchRemoveCatalogAttributesResponse(properties); + }; + + /** + * Encodes the specified BatchRemoveCatalogAttributesResponse message. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse} message BatchRemoveCatalogAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchRemoveCatalogAttributesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deletedCatalogAttributes != null && message.deletedCatalogAttributes.length) + for (var i = 0; i < message.deletedCatalogAttributes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.deletedCatalogAttributes[i]); + if (message.resetCatalogAttributes != null && message.resetCatalogAttributes.length) + for (var i = 0; i < message.resetCatalogAttributes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.resetCatalogAttributes[i]); + return writer; + }; + + /** + * Encodes the specified BatchRemoveCatalogAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse} message BatchRemoveCatalogAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchRemoveCatalogAttributesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchRemoveCatalogAttributesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse} BatchRemoveCatalogAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchRemoveCatalogAttributesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.deletedCatalogAttributes && message.deletedCatalogAttributes.length)) + message.deletedCatalogAttributes = []; + message.deletedCatalogAttributes.push(reader.string()); + break; + } + case 2: { + if (!(message.resetCatalogAttributes && message.resetCatalogAttributes.length)) + message.resetCatalogAttributes = []; + message.resetCatalogAttributes.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchRemoveCatalogAttributesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse} BatchRemoveCatalogAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchRemoveCatalogAttributesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchRemoveCatalogAttributesResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchRemoveCatalogAttributesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deletedCatalogAttributes != null && message.hasOwnProperty("deletedCatalogAttributes")) { + if (!Array.isArray(message.deletedCatalogAttributes)) + return "deletedCatalogAttributes: array expected"; + for (var i = 0; i < message.deletedCatalogAttributes.length; ++i) + if (!$util.isString(message.deletedCatalogAttributes[i])) + return "deletedCatalogAttributes: string[] expected"; + } + if (message.resetCatalogAttributes != null && message.hasOwnProperty("resetCatalogAttributes")) { + if (!Array.isArray(message.resetCatalogAttributes)) + return "resetCatalogAttributes: array expected"; + for (var i = 0; i < message.resetCatalogAttributes.length; ++i) + if (!$util.isString(message.resetCatalogAttributes[i])) + return "resetCatalogAttributes: string[] expected"; + } + return null; + }; + + /** + * Creates a BatchRemoveCatalogAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse} BatchRemoveCatalogAttributesResponse + */ + BatchRemoveCatalogAttributesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse(); + if (object.deletedCatalogAttributes) { + if (!Array.isArray(object.deletedCatalogAttributes)) + throw TypeError(".google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse.deletedCatalogAttributes: array expected"); + message.deletedCatalogAttributes = []; + for (var i = 0; i < object.deletedCatalogAttributes.length; ++i) + message.deletedCatalogAttributes[i] = String(object.deletedCatalogAttributes[i]); + } + if (object.resetCatalogAttributes) { + if (!Array.isArray(object.resetCatalogAttributes)) + throw TypeError(".google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse.resetCatalogAttributes: array expected"); + message.resetCatalogAttributes = []; + for (var i = 0; i < object.resetCatalogAttributes.length; ++i) + message.resetCatalogAttributes[i] = String(object.resetCatalogAttributes[i]); + } + return message; + }; + + /** + * Creates a plain object from a BatchRemoveCatalogAttributesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse} message BatchRemoveCatalogAttributesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchRemoveCatalogAttributesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.deletedCatalogAttributes = []; + object.resetCatalogAttributes = []; + } + if (message.deletedCatalogAttributes && message.deletedCatalogAttributes.length) { + object.deletedCatalogAttributes = []; + for (var j = 0; j < message.deletedCatalogAttributes.length; ++j) + object.deletedCatalogAttributes[j] = message.deletedCatalogAttributes[j]; + } + if (message.resetCatalogAttributes && message.resetCatalogAttributes.length) { + object.resetCatalogAttributes = []; + for (var j = 0; j < message.resetCatalogAttributes.length; ++j) + object.resetCatalogAttributes[j] = message.resetCatalogAttributes[j]; + } + return object; + }; + + /** + * Converts this BatchRemoveCatalogAttributesResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @instance + * @returns {Object.} JSON object + */ + BatchRemoveCatalogAttributesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchRemoveCatalogAttributesResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchRemoveCatalogAttributesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse"; + }; + + return BatchRemoveCatalogAttributesResponse; + })(); + v2beta.ReplaceCatalogAttributeRequest = (function() { /** @@ -105264,6 +105900,7 @@ * @property {string|null} [displayName] Control displayName * @property {Array.|null} [associatedServingConfigIds] Control associatedServingConfigIds * @property {Array.|null} [solutionTypes] Control solutionTypes + * @property {Array.|null} [searchSolutionUseCase] Control searchSolutionUseCase */ /** @@ -105277,6 +105914,7 @@ function Control(properties) { this.associatedServingConfigIds = []; this.solutionTypes = []; + this.searchSolutionUseCase = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -105331,6 +105969,14 @@ */ Control.prototype.solutionTypes = $util.emptyArray; + /** + * Control searchSolutionUseCase. + * @member {Array.} searchSolutionUseCase + * @memberof google.cloud.retail.v2beta.Control + * @instance + */ + Control.prototype.searchSolutionUseCase = $util.emptyArray; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -105386,6 +106032,12 @@ writer.int32(message.solutionTypes[i]); writer.ldelim(); } + if (message.searchSolutionUseCase != null && message.searchSolutionUseCase.length) { + writer.uint32(/* id 7, wireType 2 =*/58).fork(); + for (var i = 0; i < message.searchSolutionUseCase.length; ++i) + writer.int32(message.searchSolutionUseCase[i]); + writer.ldelim(); + } return writer; }; @@ -105453,6 +106105,17 @@ message.solutionTypes.push(reader.int32()); break; } + case 7: { + if (!(message.searchSolutionUseCase && message.searchSolutionUseCase.length)) + message.searchSolutionUseCase = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.searchSolutionUseCase.push(reader.int32()); + } else + message.searchSolutionUseCase.push(reader.int32()); + break; + } default: reader.skipType(tag & 7); break; @@ -105533,6 +106196,19 @@ break; } } + if (message.searchSolutionUseCase != null && message.hasOwnProperty("searchSolutionUseCase")) { + if (!Array.isArray(message.searchSolutionUseCase)) + return "searchSolutionUseCase: array expected"; + for (var i = 0; i < message.searchSolutionUseCase.length; ++i) + switch (message.searchSolutionUseCase[i]) { + default: + return "searchSolutionUseCase: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } return null; }; @@ -105590,6 +106266,27 @@ break; } } + if (object.searchSolutionUseCase) { + if (!Array.isArray(object.searchSolutionUseCase)) + throw TypeError(".google.cloud.retail.v2beta.Control.searchSolutionUseCase: array expected"); + message.searchSolutionUseCase = []; + for (var i = 0; i < object.searchSolutionUseCase.length; ++i) + switch (object.searchSolutionUseCase[i]) { + default: + case "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": + case 0: + message.searchSolutionUseCase[i] = 0; + break; + case "SEARCH_SOLUTION_USE_CASE_SEARCH": + case 1: + message.searchSolutionUseCase[i] = 1; + break; + case "SEARCH_SOLUTION_USE_CASE_BROWSE": + case 2: + message.searchSolutionUseCase[i] = 2; + break; + } + } return message; }; @@ -105609,6 +106306,7 @@ if (options.arrays || options.defaults) { object.associatedServingConfigIds = []; object.solutionTypes = []; + object.searchSolutionUseCase = []; } if (options.defaults) { object.name = ""; @@ -105638,6 +106336,11 @@ for (var j = 0; j < message.solutionTypes.length; ++j) object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } + if (message.searchSolutionUseCase && message.searchSolutionUseCase.length) { + object.searchSolutionUseCase = []; + for (var j = 0; j < message.searchSolutionUseCase.length; ++j) + object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; + } return object; }; @@ -109301,6 +110004,7 @@ * @property {number|null} [matchingVariantCount] SearchResult matchingVariantCount * @property {Object.|null} [matchingVariantFields] SearchResult matchingVariantFields * @property {Object.|null} [variantRollupValues] SearchResult variantRollupValues + * @property {Array.|null} [personalLabels] SearchResult personalLabels */ /** @@ -109314,6 +110018,7 @@ function SearchResult(properties) { this.matchingVariantFields = {}; this.variantRollupValues = {}; + this.personalLabels = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -109360,6 +110065,14 @@ */ SearchResult.prototype.variantRollupValues = $util.emptyObject; + /** + * SearchResult personalLabels. + * @member {Array.} personalLabels + * @memberof google.cloud.retail.v2beta.SearchResponse.SearchResult + * @instance + */ + SearchResult.prototype.personalLabels = $util.emptyArray; + /** * Creates a new SearchResult instance using the specified properties. * @function create @@ -109400,6 +110113,9 @@ writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); $root.google.protobuf.Value.encode(message.variantRollupValues[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } + if (message.personalLabels != null && message.personalLabels.length) + for (var i = 0; i < message.personalLabels.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.personalLabels[i]); return writer; }; @@ -109492,6 +110208,12 @@ message.variantRollupValues[key] = value; break; } + case 7: { + if (!(message.personalLabels && message.personalLabels.length)) + message.personalLabels = []; + message.personalLabels.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -109558,6 +110280,13 @@ return "variantRollupValues." + error; } } + if (message.personalLabels != null && message.hasOwnProperty("personalLabels")) { + if (!Array.isArray(message.personalLabels)) + return "personalLabels: array expected"; + for (var i = 0; i < message.personalLabels.length; ++i) + if (!$util.isString(message.personalLabels[i])) + return "personalLabels: string[] expected"; + } return null; }; @@ -109602,6 +110331,13 @@ message.variantRollupValues[keys[i]] = $root.google.protobuf.Value.fromObject(object.variantRollupValues[keys[i]]); } } + if (object.personalLabels) { + if (!Array.isArray(object.personalLabels)) + throw TypeError(".google.cloud.retail.v2beta.SearchResponse.SearchResult.personalLabels: array expected"); + message.personalLabels = []; + for (var i = 0; i < object.personalLabels.length; ++i) + message.personalLabels[i] = String(object.personalLabels[i]); + } return message; }; @@ -109618,6 +110354,8 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.personalLabels = []; if (options.objects || options.defaults) { object.matchingVariantFields = {}; object.variantRollupValues = {}; @@ -109644,6 +110382,11 @@ for (var j = 0; j < keys2.length; ++j) object.variantRollupValues[keys2[j]] = $root.google.protobuf.Value.toObject(message.variantRollupValues[keys2[j]], options); } + if (message.personalLabels && message.personalLabels.length) { + object.personalLabels = []; + for (var j = 0; j < message.personalLabels.length; ++j) + object.personalLabels[j] = message.personalLabels[j]; + } return object; }; @@ -113625,317 +114368,299 @@ return BigQueryOutputResult; })(); - v2beta.PredictionService = (function() { + v2beta.Model = (function() { /** - * Constructs a new PredictionService service. + * Properties of a Model. * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictionService - * @extends $protobuf.rpc.Service + * @interface IModel + * @property {string|null} [name] Model name + * @property {string|null} [displayName] Model displayName + * @property {google.cloud.retail.v2beta.Model.TrainingState|null} [trainingState] Model trainingState + * @property {google.cloud.retail.v2beta.Model.ServingState|null} [servingState] Model servingState + * @property {google.protobuf.ITimestamp|null} [createTime] Model createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Model updateTime + * @property {string|null} [type] Model type + * @property {string|null} [optimizationObjective] Model optimizationObjective + * @property {google.cloud.retail.v2beta.Model.PeriodicTuningState|null} [periodicTuningState] Model periodicTuningState + * @property {google.protobuf.ITimestamp|null} [lastTuneTime] Model lastTuneTime + * @property {string|null} [tuningOperation] Model tuningOperation + * @property {google.cloud.retail.v2beta.Model.DataState|null} [dataState] Model dataState + * @property {google.cloud.retail.v2beta.RecommendationsFilteringOption|null} [filteringOption] Model filteringOption + * @property {Array.|null} [servingConfigLists] Model servingConfigLists + */ + + /** + * Constructs a new Model. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a Model. + * @implements IModel * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.retail.v2beta.IModel=} [properties] Properties to set */ - function PredictionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function Model(properties) { + this.servingConfigLists = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; - /** - * Creates new PredictionService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.retail.v2beta.PredictionService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + * Model name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.Model + * @instance */ - PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + Model.prototype.name = ""; /** - * Callback as used by {@link google.cloud.retail.v2beta.PredictionService|predict}. - * @memberof google.cloud.retail.v2beta.PredictionService - * @typedef PredictCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse + * Model displayName. + * @member {string} displayName + * @memberof google.cloud.retail.v2beta.Model + * @instance */ + Model.prototype.displayName = ""; /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2beta.PredictionService + * Model trainingState. + * @member {google.cloud.retail.v2beta.Model.TrainingState} trainingState + * @memberof google.cloud.retail.v2beta.Model * @instance - * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object - * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { - return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); - }, "name", { value: "Predict" }); + Model.prototype.trainingState = 0; /** - * Calls Predict. - * @function predict - * @memberof google.cloud.retail.v2beta.PredictionService + * Model servingState. + * @member {google.cloud.retail.v2beta.Model.ServingState} servingState + * @memberof google.cloud.retail.v2beta.Model * @instance - * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ - - return PredictionService; - })(); - - v2beta.PredictRequest = (function() { + Model.prototype.servingState = 0; /** - * Properties of a PredictRequest. - * @memberof google.cloud.retail.v2beta - * @interface IPredictRequest - * @property {string|null} [placement] PredictRequest placement - * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent - * @property {number|null} [pageSize] PredictRequest pageSize - * @property {string|null} [pageToken] PredictRequest pageToken - * @property {string|null} [filter] PredictRequest filter - * @property {boolean|null} [validateOnly] PredictRequest validateOnly - * @property {Object.|null} [params] PredictRequest params - * @property {Object.|null} [labels] PredictRequest labels + * Model createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.retail.v2beta.Model + * @instance */ + Model.prototype.createTime = null; /** - * Constructs a new PredictRequest. - * @memberof google.cloud.retail.v2beta - * @classdesc Represents a PredictRequest. - * @implements IPredictRequest - * @constructor - * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * Model updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.retail.v2beta.Model + * @instance */ - function PredictRequest(properties) { - this.params = {}; - this.labels = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + Model.prototype.updateTime = null; /** - * PredictRequest placement. - * @member {string} placement - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model type. + * @member {string} type + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.placement = ""; + Model.prototype.type = ""; /** - * PredictRequest userEvent. - * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model optimizationObjective. + * @member {string} optimizationObjective + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.userEvent = null; + Model.prototype.optimizationObjective = ""; /** - * PredictRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model periodicTuningState. + * @member {google.cloud.retail.v2beta.Model.PeriodicTuningState} periodicTuningState + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.pageSize = 0; + Model.prototype.periodicTuningState = 0; /** - * PredictRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model lastTuneTime. + * @member {google.protobuf.ITimestamp|null|undefined} lastTuneTime + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.pageToken = ""; + Model.prototype.lastTuneTime = null; /** - * PredictRequest filter. - * @member {string} filter - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model tuningOperation. + * @member {string} tuningOperation + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.filter = ""; + Model.prototype.tuningOperation = ""; /** - * PredictRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model dataState. + * @member {google.cloud.retail.v2beta.Model.DataState} dataState + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.validateOnly = false; + Model.prototype.dataState = 0; /** - * PredictRequest params. - * @member {Object.} params - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model filteringOption. + * @member {google.cloud.retail.v2beta.RecommendationsFilteringOption} filteringOption + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.params = $util.emptyObject; + Model.prototype.filteringOption = 0; /** - * PredictRequest labels. - * @member {Object.} labels - * @memberof google.cloud.retail.v2beta.PredictRequest + * Model servingConfigLists. + * @member {Array.} servingConfigLists + * @memberof google.cloud.retail.v2beta.Model * @instance */ - PredictRequest.prototype.labels = $util.emptyObject; + Model.prototype.servingConfigLists = $util.emptyArray; /** - * Creates a new PredictRequest instance using the specified properties. + * Creates a new Model instance using the specified properties. * @function create - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2beta.Model * @static - * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance + * @param {google.cloud.retail.v2beta.IModel=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Model} Model instance */ - PredictRequest.create = function create(properties) { - return new PredictRequest(properties); + Model.create = function create(properties) { + return new Model(properties); }; /** - * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * Encodes the specified Model message. Does not implicitly {@link google.cloud.retail.v2beta.Model.verify|verify} messages. * @function encode - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2beta.Model * @static - * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IModel} message Model message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encode = function encode(message, writer) { + Model.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); - if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) - $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.trainingState != null && Object.hasOwnProperty.call(message, "trainingState")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.trainingState); + if (message.servingState != null && Object.hasOwnProperty.call(message, "servingState")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.servingState); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.type); + if (message.optimizationObjective != null && Object.hasOwnProperty.call(message, "optimizationObjective")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.optimizationObjective); + if (message.periodicTuningState != null && Object.hasOwnProperty.call(message, "periodicTuningState")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.periodicTuningState); + if (message.lastTuneTime != null && Object.hasOwnProperty.call(message, "lastTuneTime")) + $root.google.protobuf.Timestamp.encode(message.lastTuneTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.tuningOperation != null && Object.hasOwnProperty.call(message, "tuningOperation")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.tuningOperation); + if (message.dataState != null && Object.hasOwnProperty.call(message, "dataState")) + writer.uint32(/* id 16, wireType 0 =*/128).int32(message.dataState); + if (message.filteringOption != null && Object.hasOwnProperty.call(message, "filteringOption")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.filteringOption); + if (message.servingConfigLists != null && message.servingConfigLists.length) + for (var i = 0; i < message.servingConfigLists.length; ++i) + $root.google.cloud.retail.v2beta.Model.ServingConfigList.encode(message.servingConfigLists[i], writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); return writer; }; /** - * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * Encodes the specified Model message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Model.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2beta.Model * @static - * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {google.cloud.retail.v2beta.IModel} message Model message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + Model.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PredictRequest message from the specified reader or buffer. + * Decodes a Model message from the specified reader or buffer. * @function decode - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2beta.Model * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2beta.Model} Model * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decode = function decode(reader, length) { + Model.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Model(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.placement = reader.string(); + message.name = reader.string(); break; } case 2: { - message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + message.displayName = reader.string(); break; } case 3: { - message.pageSize = reader.int32(); + message.trainingState = reader.int32(); break; } case 4: { - message.pageToken = reader.string(); + message.servingState = reader.int32(); break; } case 5: { - message.filter = reader.string(); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } case 6: { - message.validateOnly = reader.bool(); + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } case 7: { - if (message.params === $util.emptyObject) - message.params = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.params[key] = value; + message.type = reader.string(); break; } case 8: { - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; + message.optimizationObjective = reader.string(); + break; + } + case 11: { + message.periodicTuningState = reader.int32(); + break; + } + case 12: { + message.lastTuneTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 15: { + message.tuningOperation = reader.string(); + break; + } + case 16: { + message.dataState = reader.int32(); + break; + } + case 18: { + message.filteringOption = reader.int32(); + break; + } + case 19: { + if (!(message.servingConfigLists && message.servingConfigLists.length)) + message.servingConfigLists = []; + message.servingConfigLists.push($root.google.cloud.retail.v2beta.Model.ServingConfigList.decode(reader, reader.uint32())); break; } default: @@ -113947,80 +114672,3674 @@ }; /** - * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * Decodes a Model message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2beta.Model * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @returns {google.cloud.retail.v2beta.Model} Model * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PredictRequest.decodeDelimited = function decodeDelimited(reader) { + Model.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PredictRequest message. + * Verifies a Model message. * @function verify - * @memberof google.cloud.retail.v2beta.PredictRequest + * @memberof google.cloud.retail.v2beta.Model * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PredictRequest.verify = function verify(message) { + Model.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.placement != null && message.hasOwnProperty("placement")) - if (!$util.isString(message.placement)) - return "placement: string expected"; - if (message.userEvent != null && message.hasOwnProperty("userEvent")) { - var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); - if (error) - return "userEvent." + error; - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; - if (message.params != null && message.hasOwnProperty("params")) { - if (!$util.isObject(message.params)) - return "params: object expected"; - var key = Object.keys(message.params); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.params[key[i]]); - if (error) - return "params." + error; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.trainingState != null && message.hasOwnProperty("trainingState")) + switch (message.trainingState) { + default: + return "trainingState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.servingState != null && message.hasOwnProperty("servingState")) + switch (message.servingState) { + default: + return "servingState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; } - return null; - }; - - /** - * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.retail.v2beta.PredictRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.optimizationObjective != null && message.hasOwnProperty("optimizationObjective")) + if (!$util.isString(message.optimizationObjective)) + return "optimizationObjective: string expected"; + if (message.periodicTuningState != null && message.hasOwnProperty("periodicTuningState")) + switch (message.periodicTuningState) { + default: + return "periodicTuningState: enum value expected"; + case 0: + case 1: + case 3: + case 2: + break; + } + if (message.lastTuneTime != null && message.hasOwnProperty("lastTuneTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.lastTuneTime); + if (error) + return "lastTuneTime." + error; + } + if (message.tuningOperation != null && message.hasOwnProperty("tuningOperation")) + if (!$util.isString(message.tuningOperation)) + return "tuningOperation: string expected"; + if (message.dataState != null && message.hasOwnProperty("dataState")) + switch (message.dataState) { + default: + return "dataState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.filteringOption != null && message.hasOwnProperty("filteringOption")) + switch (message.filteringOption) { + default: + return "filteringOption: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.servingConfigLists != null && message.hasOwnProperty("servingConfigLists")) { + if (!Array.isArray(message.servingConfigLists)) + return "servingConfigLists: array expected"; + for (var i = 0; i < message.servingConfigLists.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Model.ServingConfigList.verify(message.servingConfigLists[i]); + if (error) + return "servingConfigLists." + error; + } + } + return null; + }; + + /** + * Creates a Model message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Model + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Model} Model + */ + Model.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Model) + return object; + var message = new $root.google.cloud.retail.v2beta.Model(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.trainingState) { + case "TRAINING_STATE_UNSPECIFIED": + case 0: + message.trainingState = 0; + break; + case "PAUSED": + case 1: + message.trainingState = 1; + break; + case "TRAINING": + case 2: + message.trainingState = 2; + break; + } + switch (object.servingState) { + case "SERVING_STATE_UNSPECIFIED": + case 0: + message.servingState = 0; + break; + case "INACTIVE": + case 1: + message.servingState = 1; + break; + case "ACTIVE": + case 2: + message.servingState = 2; + break; + case "TUNED": + case 3: + message.servingState = 3; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Model.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Model.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.type != null) + message.type = String(object.type); + if (object.optimizationObjective != null) + message.optimizationObjective = String(object.optimizationObjective); + switch (object.periodicTuningState) { + case "PERIODIC_TUNING_STATE_UNSPECIFIED": + case 0: + message.periodicTuningState = 0; + break; + case "PERIODIC_TUNING_DISABLED": + case 1: + message.periodicTuningState = 1; + break; + case "ALL_TUNING_DISABLED": + case 3: + message.periodicTuningState = 3; + break; + case "PERIODIC_TUNING_ENABLED": + case 2: + message.periodicTuningState = 2; + break; + } + if (object.lastTuneTime != null) { + if (typeof object.lastTuneTime !== "object") + throw TypeError(".google.cloud.retail.v2beta.Model.lastTuneTime: object expected"); + message.lastTuneTime = $root.google.protobuf.Timestamp.fromObject(object.lastTuneTime); + } + if (object.tuningOperation != null) + message.tuningOperation = String(object.tuningOperation); + switch (object.dataState) { + case "DATA_STATE_UNSPECIFIED": + case 0: + message.dataState = 0; + break; + case "DATA_OK": + case 1: + message.dataState = 1; + break; + case "DATA_ERROR": + case 2: + message.dataState = 2; + break; + } + switch (object.filteringOption) { + case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": + case 0: + message.filteringOption = 0; + break; + case "RECOMMENDATIONS_FILTERING_DISABLED": + case 1: + message.filteringOption = 1; + break; + case "RECOMMENDATIONS_FILTERING_ENABLED": + case 3: + message.filteringOption = 3; + break; + } + if (object.servingConfigLists) { + if (!Array.isArray(object.servingConfigLists)) + throw TypeError(".google.cloud.retail.v2beta.Model.servingConfigLists: array expected"); + message.servingConfigLists = []; + for (var i = 0; i < object.servingConfigLists.length; ++i) { + if (typeof object.servingConfigLists[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.Model.servingConfigLists: object expected"); + message.servingConfigLists[i] = $root.google.cloud.retail.v2beta.Model.ServingConfigList.fromObject(object.servingConfigLists[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Model message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Model + * @static + * @param {google.cloud.retail.v2beta.Model} message Model + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Model.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigLists = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.trainingState = options.enums === String ? "TRAINING_STATE_UNSPECIFIED" : 0; + object.servingState = options.enums === String ? "SERVING_STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.updateTime = null; + object.type = ""; + object.optimizationObjective = ""; + object.periodicTuningState = options.enums === String ? "PERIODIC_TUNING_STATE_UNSPECIFIED" : 0; + object.lastTuneTime = null; + object.tuningOperation = ""; + object.dataState = options.enums === String ? "DATA_STATE_UNSPECIFIED" : 0; + object.filteringOption = options.enums === String ? "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.trainingState != null && message.hasOwnProperty("trainingState")) + object.trainingState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.TrainingState[message.trainingState] : message.trainingState; + if (message.servingState != null && message.hasOwnProperty("servingState")) + object.servingState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.ServingState[message.servingState] : message.servingState; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.optimizationObjective != null && message.hasOwnProperty("optimizationObjective")) + object.optimizationObjective = message.optimizationObjective; + if (message.periodicTuningState != null && message.hasOwnProperty("periodicTuningState")) + object.periodicTuningState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.PeriodicTuningState[message.periodicTuningState] : message.periodicTuningState; + if (message.lastTuneTime != null && message.hasOwnProperty("lastTuneTime")) + object.lastTuneTime = $root.google.protobuf.Timestamp.toObject(message.lastTuneTime, options); + if (message.tuningOperation != null && message.hasOwnProperty("tuningOperation")) + object.tuningOperation = message.tuningOperation; + if (message.dataState != null && message.hasOwnProperty("dataState")) + object.dataState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.DataState[message.dataState] : message.dataState; + if (message.filteringOption != null && message.hasOwnProperty("filteringOption")) + object.filteringOption = options.enums === String ? $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.filteringOption] : message.filteringOption; + if (message.servingConfigLists && message.servingConfigLists.length) { + object.servingConfigLists = []; + for (var j = 0; j < message.servingConfigLists.length; ++j) + object.servingConfigLists[j] = $root.google.cloud.retail.v2beta.Model.ServingConfigList.toObject(message.servingConfigLists[j], options); + } + return object; + }; + + /** + * Converts this Model to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Model + * @instance + * @returns {Object.} JSON object + */ + Model.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Model + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Model + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Model.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Model"; + }; + + Model.ServingConfigList = (function() { + + /** + * Properties of a ServingConfigList. + * @memberof google.cloud.retail.v2beta.Model + * @interface IServingConfigList + * @property {Array.|null} [servingConfigIds] ServingConfigList servingConfigIds + */ + + /** + * Constructs a new ServingConfigList. + * @memberof google.cloud.retail.v2beta.Model + * @classdesc Represents a ServingConfigList. + * @implements IServingConfigList + * @constructor + * @param {google.cloud.retail.v2beta.Model.IServingConfigList=} [properties] Properties to set + */ + function ServingConfigList(properties) { + this.servingConfigIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServingConfigList servingConfigIds. + * @member {Array.} servingConfigIds + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @instance + */ + ServingConfigList.prototype.servingConfigIds = $util.emptyArray; + + /** + * Creates a new ServingConfigList instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2beta.Model.IServingConfigList=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.Model.ServingConfigList} ServingConfigList instance + */ + ServingConfigList.create = function create(properties) { + return new ServingConfigList(properties); + }; + + /** + * Encodes the specified ServingConfigList message. Does not implicitly {@link google.cloud.retail.v2beta.Model.ServingConfigList.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2beta.Model.IServingConfigList} message ServingConfigList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfigList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.servingConfigIds != null && message.servingConfigIds.length) + for (var i = 0; i < message.servingConfigIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.servingConfigIds[i]); + return writer; + }; + + /** + * Encodes the specified ServingConfigList message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.Model.ServingConfigList.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2beta.Model.IServingConfigList} message ServingConfigList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServingConfigList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.Model.ServingConfigList} ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfigList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.Model.ServingConfigList(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.servingConfigIds && message.servingConfigIds.length)) + message.servingConfigIds = []; + message.servingConfigIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServingConfigList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.Model.ServingConfigList} ServingConfigList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServingConfigList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServingConfigList message. + * @function verify + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServingConfigList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.servingConfigIds != null && message.hasOwnProperty("servingConfigIds")) { + if (!Array.isArray(message.servingConfigIds)) + return "servingConfigIds: array expected"; + for (var i = 0; i < message.servingConfigIds.length; ++i) + if (!$util.isString(message.servingConfigIds[i])) + return "servingConfigIds: string[] expected"; + } + return null; + }; + + /** + * Creates a ServingConfigList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.Model.ServingConfigList} ServingConfigList + */ + ServingConfigList.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.Model.ServingConfigList) + return object; + var message = new $root.google.cloud.retail.v2beta.Model.ServingConfigList(); + if (object.servingConfigIds) { + if (!Array.isArray(object.servingConfigIds)) + throw TypeError(".google.cloud.retail.v2beta.Model.ServingConfigList.servingConfigIds: array expected"); + message.servingConfigIds = []; + for (var i = 0; i < object.servingConfigIds.length; ++i) + message.servingConfigIds[i] = String(object.servingConfigIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a ServingConfigList message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {google.cloud.retail.v2beta.Model.ServingConfigList} message ServingConfigList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServingConfigList.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.servingConfigIds = []; + if (message.servingConfigIds && message.servingConfigIds.length) { + object.servingConfigIds = []; + for (var j = 0; j < message.servingConfigIds.length; ++j) + object.servingConfigIds[j] = message.servingConfigIds[j]; + } + return object; + }; + + /** + * Converts this ServingConfigList to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @instance + * @returns {Object.} JSON object + */ + ServingConfigList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServingConfigList + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.Model.ServingConfigList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServingConfigList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.Model.ServingConfigList"; + }; + + return ServingConfigList; + })(); + + /** + * ServingState enum. + * @name google.cloud.retail.v2beta.Model.ServingState + * @enum {number} + * @property {number} SERVING_STATE_UNSPECIFIED=0 SERVING_STATE_UNSPECIFIED value + * @property {number} INACTIVE=1 INACTIVE value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} TUNED=3 TUNED value + */ + Model.ServingState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVING_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INACTIVE"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "TUNED"] = 3; + return values; + })(); + + /** + * TrainingState enum. + * @name google.cloud.retail.v2beta.Model.TrainingState + * @enum {number} + * @property {number} TRAINING_STATE_UNSPECIFIED=0 TRAINING_STATE_UNSPECIFIED value + * @property {number} PAUSED=1 PAUSED value + * @property {number} TRAINING=2 TRAINING value + */ + Model.TrainingState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TRAINING_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PAUSED"] = 1; + values[valuesById[2] = "TRAINING"] = 2; + return values; + })(); + + /** + * PeriodicTuningState enum. + * @name google.cloud.retail.v2beta.Model.PeriodicTuningState + * @enum {number} + * @property {number} PERIODIC_TUNING_STATE_UNSPECIFIED=0 PERIODIC_TUNING_STATE_UNSPECIFIED value + * @property {number} PERIODIC_TUNING_DISABLED=1 PERIODIC_TUNING_DISABLED value + * @property {number} ALL_TUNING_DISABLED=3 ALL_TUNING_DISABLED value + * @property {number} PERIODIC_TUNING_ENABLED=2 PERIODIC_TUNING_ENABLED value + */ + Model.PeriodicTuningState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PERIODIC_TUNING_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PERIODIC_TUNING_DISABLED"] = 1; + values[valuesById[3] = "ALL_TUNING_DISABLED"] = 3; + values[valuesById[2] = "PERIODIC_TUNING_ENABLED"] = 2; + return values; + })(); + + /** + * DataState enum. + * @name google.cloud.retail.v2beta.Model.DataState + * @enum {number} + * @property {number} DATA_STATE_UNSPECIFIED=0 DATA_STATE_UNSPECIFIED value + * @property {number} DATA_OK=1 DATA_OK value + * @property {number} DATA_ERROR=2 DATA_ERROR value + */ + Model.DataState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DATA_OK"] = 1; + values[valuesById[2] = "DATA_ERROR"] = 2; + return values; + })(); + + return Model; + })(); + + v2beta.ModelService = (function() { + + /** + * Constructs a new ModelService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ModelService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ModelService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ModelService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ModelService; + + /** + * Creates new ModelService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.ModelService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ModelService} RPC service. Useful where requests and/or responses are streamed. + */ + ModelService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|createModel}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef CreateModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateModel. + * @function createModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.ICreateModelRequest} request CreateModelRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.CreateModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.createModel = function createModel(request, callback) { + return this.rpcCall(createModel, $root.google.cloud.retail.v2beta.CreateModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateModel" }); + + /** + * Calls CreateModel. + * @function createModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.ICreateModelRequest} request CreateModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|pauseModel}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef PauseModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Model} [response] Model + */ + + /** + * Calls PauseModel. + * @function pauseModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IPauseModelRequest} request PauseModelRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.PauseModelCallback} callback Node-style callback called with the error, if any, and Model + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.pauseModel = function pauseModel(request, callback) { + return this.rpcCall(pauseModel, $root.google.cloud.retail.v2beta.PauseModelRequest, $root.google.cloud.retail.v2beta.Model, request, callback); + }, "name", { value: "PauseModel" }); + + /** + * Calls PauseModel. + * @function pauseModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IPauseModelRequest} request PauseModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|resumeModel}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef ResumeModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Model} [response] Model + */ + + /** + * Calls ResumeModel. + * @function resumeModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IResumeModelRequest} request ResumeModelRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.ResumeModelCallback} callback Node-style callback called with the error, if any, and Model + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.resumeModel = function resumeModel(request, callback) { + return this.rpcCall(resumeModel, $root.google.cloud.retail.v2beta.ResumeModelRequest, $root.google.cloud.retail.v2beta.Model, request, callback); + }, "name", { value: "ResumeModel" }); + + /** + * Calls ResumeModel. + * @function resumeModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IResumeModelRequest} request ResumeModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|deleteModel}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef DeleteModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteModel. + * @function deleteModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteModelRequest} request DeleteModelRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.DeleteModelCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.deleteModel = function deleteModel(request, callback) { + return this.rpcCall(deleteModel, $root.google.cloud.retail.v2beta.DeleteModelRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteModel" }); + + /** + * Calls DeleteModel. + * @function deleteModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IDeleteModelRequest} request DeleteModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|listModels}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef ListModelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.ListModelsResponse} [response] ListModelsResponse + */ + + /** + * Calls ListModels. + * @function listModels + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IListModelsRequest} request ListModelsRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.ListModelsCallback} callback Node-style callback called with the error, if any, and ListModelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.listModels = function listModels(request, callback) { + return this.rpcCall(listModels, $root.google.cloud.retail.v2beta.ListModelsRequest, $root.google.cloud.retail.v2beta.ListModelsResponse, request, callback); + }, "name", { value: "ListModels" }); + + /** + * Calls ListModels. + * @function listModels + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IListModelsRequest} request ListModelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|updateModel}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef UpdateModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.Model} [response] Model + */ + + /** + * Calls UpdateModel. + * @function updateModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateModelRequest} request UpdateModelRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.UpdateModelCallback} callback Node-style callback called with the error, if any, and Model + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.updateModel = function updateModel(request, callback) { + return this.rpcCall(updateModel, $root.google.cloud.retail.v2beta.UpdateModelRequest, $root.google.cloud.retail.v2beta.Model, request, callback); + }, "name", { value: "UpdateModel" }); + + /** + * Calls UpdateModel. + * @function updateModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.IUpdateModelRequest} request UpdateModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.retail.v2beta.ModelService|tuneModel}. + * @memberof google.cloud.retail.v2beta.ModelService + * @typedef TuneModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls TuneModel. + * @function tuneModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.ITuneModelRequest} request TuneModelRequest message or plain object + * @param {google.cloud.retail.v2beta.ModelService.TuneModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ModelService.prototype.tuneModel = function tuneModel(request, callback) { + return this.rpcCall(tuneModel, $root.google.cloud.retail.v2beta.TuneModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "TuneModel" }); + + /** + * Calls TuneModel. + * @function tuneModel + * @memberof google.cloud.retail.v2beta.ModelService + * @instance + * @param {google.cloud.retail.v2beta.ITuneModelRequest} request TuneModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ModelService; + })(); + + v2beta.CreateModelRequest = (function() { + + /** + * Properties of a CreateModelRequest. + * @memberof google.cloud.retail.v2beta + * @interface ICreateModelRequest + * @property {string|null} [parent] CreateModelRequest parent + * @property {google.cloud.retail.v2beta.IModel|null} [model] CreateModelRequest model + * @property {boolean|null} [dryRun] CreateModelRequest dryRun + */ + + /** + * Constructs a new CreateModelRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CreateModelRequest. + * @implements ICreateModelRequest + * @constructor + * @param {google.cloud.retail.v2beta.ICreateModelRequest=} [properties] Properties to set + */ + function CreateModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateModelRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @instance + */ + CreateModelRequest.prototype.parent = ""; + + /** + * CreateModelRequest model. + * @member {google.cloud.retail.v2beta.IModel|null|undefined} model + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @instance + */ + CreateModelRequest.prototype.model = null; + + /** + * CreateModelRequest dryRun. + * @member {boolean} dryRun + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @instance + */ + CreateModelRequest.prototype.dryRun = false; + + /** + * Creates a new CreateModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateModelRequest} CreateModelRequest instance + */ + CreateModelRequest.create = function create(properties) { + return new CreateModelRequest(properties); + }; + + /** + * Encodes the specified CreateModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateModelRequest} message CreateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + $root.google.cloud.retail.v2beta.Model.encode(message.model, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dryRun != null && Object.hasOwnProperty.call(message, "dryRun")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dryRun); + return writer; + }; + + /** + * Encodes the specified CreateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {google.cloud.retail.v2beta.ICreateModelRequest} message CreateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CreateModelRequest} CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.model = $root.google.cloud.retail.v2beta.Model.decode(reader, reader.uint32()); + break; + } + case 3: { + message.dryRun = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CreateModelRequest} CreateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.model != null && message.hasOwnProperty("model")) { + var error = $root.google.cloud.retail.v2beta.Model.verify(message.model); + if (error) + return "model." + error; + } + if (message.dryRun != null && message.hasOwnProperty("dryRun")) + if (typeof message.dryRun !== "boolean") + return "dryRun: boolean expected"; + return null; + }; + + /** + * Creates a CreateModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CreateModelRequest} CreateModelRequest + */ + CreateModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateModelRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.CreateModelRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.model != null) { + if (typeof object.model !== "object") + throw TypeError(".google.cloud.retail.v2beta.CreateModelRequest.model: object expected"); + message.model = $root.google.cloud.retail.v2beta.Model.fromObject(object.model); + } + if (object.dryRun != null) + message.dryRun = Boolean(object.dryRun); + return message; + }; + + /** + * Creates a plain object from a CreateModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {google.cloud.retail.v2beta.CreateModelRequest} message CreateModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.model = null; + object.dryRun = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.model != null && message.hasOwnProperty("model")) + object.model = $root.google.cloud.retail.v2beta.Model.toObject(message.model, options); + if (message.dryRun != null && message.hasOwnProperty("dryRun")) + object.dryRun = message.dryRun; + return object; + }; + + /** + * Converts this CreateModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @instance + * @returns {Object.} JSON object + */ + CreateModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CreateModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CreateModelRequest"; + }; + + return CreateModelRequest; + })(); + + v2beta.UpdateModelRequest = (function() { + + /** + * Properties of an UpdateModelRequest. + * @memberof google.cloud.retail.v2beta + * @interface IUpdateModelRequest + * @property {google.cloud.retail.v2beta.IModel|null} [model] UpdateModelRequest model + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateModelRequest updateMask + */ + + /** + * Constructs a new UpdateModelRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents an UpdateModelRequest. + * @implements IUpdateModelRequest + * @constructor + * @param {google.cloud.retail.v2beta.IUpdateModelRequest=} [properties] Properties to set + */ + function UpdateModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateModelRequest model. + * @member {google.cloud.retail.v2beta.IModel|null|undefined} model + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @instance + */ + UpdateModelRequest.prototype.model = null; + + /** + * UpdateModelRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @instance + */ + UpdateModelRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.UpdateModelRequest} UpdateModelRequest instance + */ + UpdateModelRequest.create = function create(properties) { + return new UpdateModelRequest(properties); + }; + + /** + * Encodes the specified UpdateModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.UpdateModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateModelRequest} message UpdateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + $root.google.cloud.retail.v2beta.Model.encode(message.model, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.UpdateModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2beta.IUpdateModelRequest} message UpdateModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.UpdateModelRequest} UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.UpdateModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.model = $root.google.cloud.retail.v2beta.Model.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.UpdateModelRequest} UpdateModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) { + var error = $root.google.cloud.retail.v2beta.Model.verify(message.model); + if (error) + return "model." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.UpdateModelRequest} UpdateModelRequest + */ + UpdateModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.UpdateModelRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.UpdateModelRequest(); + if (object.model != null) { + if (typeof object.model !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateModelRequest.model: object expected"); + message.model = $root.google.cloud.retail.v2beta.Model.fromObject(object.model); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.retail.v2beta.UpdateModelRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {google.cloud.retail.v2beta.UpdateModelRequest} message UpdateModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.model = null; + object.updateMask = null; + } + if (message.model != null && message.hasOwnProperty("model")) + object.model = $root.google.cloud.retail.v2beta.Model.toObject(message.model, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.UpdateModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.UpdateModelRequest"; + }; + + return UpdateModelRequest; + })(); + + v2beta.PauseModelRequest = (function() { + + /** + * Properties of a PauseModelRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPauseModelRequest + * @property {string|null} [name] PauseModelRequest name + */ + + /** + * Constructs a new PauseModelRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PauseModelRequest. + * @implements IPauseModelRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPauseModelRequest=} [properties] Properties to set + */ + function PauseModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PauseModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @instance + */ + PauseModelRequest.prototype.name = ""; + + /** + * Creates a new PauseModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {google.cloud.retail.v2beta.IPauseModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PauseModelRequest} PauseModelRequest instance + */ + PauseModelRequest.create = function create(properties) { + return new PauseModelRequest(properties); + }; + + /** + * Encodes the specified PauseModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PauseModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {google.cloud.retail.v2beta.IPauseModelRequest} message PauseModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PauseModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified PauseModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PauseModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {google.cloud.retail.v2beta.IPauseModelRequest} message PauseModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PauseModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PauseModelRequest} PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PauseModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PauseModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PauseModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PauseModelRequest} PauseModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PauseModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PauseModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PauseModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a PauseModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PauseModelRequest} PauseModelRequest + */ + PauseModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.PauseModelRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.PauseModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a PauseModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {google.cloud.retail.v2beta.PauseModelRequest} message PauseModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PauseModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this PauseModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @instance + * @returns {Object.} JSON object + */ + PauseModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PauseModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.PauseModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PauseModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.PauseModelRequest"; + }; + + return PauseModelRequest; + })(); + + v2beta.ResumeModelRequest = (function() { + + /** + * Properties of a ResumeModelRequest. + * @memberof google.cloud.retail.v2beta + * @interface IResumeModelRequest + * @property {string|null} [name] ResumeModelRequest name + */ + + /** + * Constructs a new ResumeModelRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ResumeModelRequest. + * @implements IResumeModelRequest + * @constructor + * @param {google.cloud.retail.v2beta.IResumeModelRequest=} [properties] Properties to set + */ + function ResumeModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResumeModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @instance + */ + ResumeModelRequest.prototype.name = ""; + + /** + * Creates a new ResumeModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2beta.IResumeModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ResumeModelRequest} ResumeModelRequest instance + */ + ResumeModelRequest.create = function create(properties) { + return new ResumeModelRequest(properties); + }; + + /** + * Encodes the specified ResumeModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ResumeModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2beta.IResumeModelRequest} message ResumeModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResumeModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified ResumeModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ResumeModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2beta.IResumeModelRequest} message ResumeModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResumeModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ResumeModelRequest} ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResumeModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ResumeModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResumeModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ResumeModelRequest} ResumeModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResumeModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResumeModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResumeModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a ResumeModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ResumeModelRequest} ResumeModelRequest + */ + ResumeModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ResumeModelRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ResumeModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a ResumeModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {google.cloud.retail.v2beta.ResumeModelRequest} message ResumeModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResumeModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ResumeModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @instance + * @returns {Object.} JSON object + */ + ResumeModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResumeModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ResumeModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResumeModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ResumeModelRequest"; + }; + + return ResumeModelRequest; + })(); + + v2beta.ListModelsRequest = (function() { + + /** + * Properties of a ListModelsRequest. + * @memberof google.cloud.retail.v2beta + * @interface IListModelsRequest + * @property {string|null} [parent] ListModelsRequest parent + * @property {number|null} [pageSize] ListModelsRequest pageSize + * @property {string|null} [pageToken] ListModelsRequest pageToken + */ + + /** + * Constructs a new ListModelsRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListModelsRequest. + * @implements IListModelsRequest + * @constructor + * @param {google.cloud.retail.v2beta.IListModelsRequest=} [properties] Properties to set + */ + function ListModelsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListModelsRequest parent. + * @member {string} parent + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @instance + */ + ListModelsRequest.prototype.parent = ""; + + /** + * ListModelsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @instance + */ + ListModelsRequest.prototype.pageSize = 0; + + /** + * ListModelsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @instance + */ + ListModelsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListModelsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {google.cloud.retail.v2beta.IListModelsRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListModelsRequest} ListModelsRequest instance + */ + ListModelsRequest.create = function create(properties) { + return new ListModelsRequest(properties); + }; + + /** + * Encodes the specified ListModelsRequest message. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {google.cloud.retail.v2beta.IListModelsRequest} message ListModelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListModelsRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {google.cloud.retail.v2beta.IListModelsRequest} message ListModelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListModelsRequest} ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListModelsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListModelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListModelsRequest} ListModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListModelsRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListModelsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListModelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListModelsRequest} ListModelsRequest + */ + ListModelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListModelsRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.ListModelsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListModelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {google.cloud.retail.v2beta.ListModelsRequest} message ListModelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListModelsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListModelsRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @instance + * @returns {Object.} JSON object + */ + ListModelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListModelsRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListModelsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListModelsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListModelsRequest"; + }; + + return ListModelsRequest; + })(); + + v2beta.DeleteModelRequest = (function() { + + /** + * Properties of a DeleteModelRequest. + * @memberof google.cloud.retail.v2beta + * @interface IDeleteModelRequest + * @property {string|null} [name] DeleteModelRequest name + */ + + /** + * Constructs a new DeleteModelRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a DeleteModelRequest. + * @implements IDeleteModelRequest + * @constructor + * @param {google.cloud.retail.v2beta.IDeleteModelRequest=} [properties] Properties to set + */ + function DeleteModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @instance + */ + DeleteModelRequest.prototype.name = ""; + + /** + * Creates a new DeleteModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.DeleteModelRequest} DeleteModelRequest instance + */ + DeleteModelRequest.create = function create(properties) { + return new DeleteModelRequest(properties); + }; + + /** + * Encodes the specified DeleteModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.DeleteModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteModelRequest} message DeleteModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.DeleteModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2beta.IDeleteModelRequest} message DeleteModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.DeleteModelRequest} DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.DeleteModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.DeleteModelRequest} DeleteModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.DeleteModelRequest} DeleteModelRequest + */ + DeleteModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.DeleteModelRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.DeleteModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {google.cloud.retail.v2beta.DeleteModelRequest} message DeleteModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.DeleteModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.DeleteModelRequest"; + }; + + return DeleteModelRequest; + })(); + + v2beta.ListModelsResponse = (function() { + + /** + * Properties of a ListModelsResponse. + * @memberof google.cloud.retail.v2beta + * @interface IListModelsResponse + * @property {Array.|null} [models] ListModelsResponse models + * @property {string|null} [nextPageToken] ListModelsResponse nextPageToken + */ + + /** + * Constructs a new ListModelsResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a ListModelsResponse. + * @implements IListModelsResponse + * @constructor + * @param {google.cloud.retail.v2beta.IListModelsResponse=} [properties] Properties to set + */ + function ListModelsResponse(properties) { + this.models = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListModelsResponse models. + * @member {Array.} models + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @instance + */ + ListModelsResponse.prototype.models = $util.emptyArray; + + /** + * ListModelsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @instance + */ + ListModelsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListModelsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {google.cloud.retail.v2beta.IListModelsResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.ListModelsResponse} ListModelsResponse instance + */ + ListModelsResponse.create = function create(properties) { + return new ListModelsResponse(properties); + }; + + /** + * Encodes the specified ListModelsResponse message. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {google.cloud.retail.v2beta.IListModelsResponse} message ListModelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.models != null && message.models.length) + for (var i = 0; i < message.models.length; ++i) + $root.google.cloud.retail.v2beta.Model.encode(message.models[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListModelsResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.ListModelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {google.cloud.retail.v2beta.IListModelsResponse} message ListModelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListModelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.ListModelsResponse} ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.ListModelsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.models && message.models.length)) + message.models = []; + message.models.push($root.google.cloud.retail.v2beta.Model.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListModelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.ListModelsResponse} ListModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListModelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListModelsResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListModelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.models != null && message.hasOwnProperty("models")) { + if (!Array.isArray(message.models)) + return "models: array expected"; + for (var i = 0; i < message.models.length; ++i) { + var error = $root.google.cloud.retail.v2beta.Model.verify(message.models[i]); + if (error) + return "models." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListModelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.ListModelsResponse} ListModelsResponse + */ + ListModelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.ListModelsResponse) + return object; + var message = new $root.google.cloud.retail.v2beta.ListModelsResponse(); + if (object.models) { + if (!Array.isArray(object.models)) + throw TypeError(".google.cloud.retail.v2beta.ListModelsResponse.models: array expected"); + message.models = []; + for (var i = 0; i < object.models.length; ++i) { + if (typeof object.models[i] !== "object") + throw TypeError(".google.cloud.retail.v2beta.ListModelsResponse.models: object expected"); + message.models[i] = $root.google.cloud.retail.v2beta.Model.fromObject(object.models[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListModelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {google.cloud.retail.v2beta.ListModelsResponse} message ListModelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListModelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.models = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.models && message.models.length) { + object.models = []; + for (var j = 0; j < message.models.length; ++j) + object.models[j] = $root.google.cloud.retail.v2beta.Model.toObject(message.models[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListModelsResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @instance + * @returns {Object.} JSON object + */ + ListModelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListModelsResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.ListModelsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListModelsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.ListModelsResponse"; + }; + + return ListModelsResponse; + })(); + + v2beta.TuneModelRequest = (function() { + + /** + * Properties of a TuneModelRequest. + * @memberof google.cloud.retail.v2beta + * @interface ITuneModelRequest + * @property {string|null} [name] TuneModelRequest name + */ + + /** + * Constructs a new TuneModelRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a TuneModelRequest. + * @implements ITuneModelRequest + * @constructor + * @param {google.cloud.retail.v2beta.ITuneModelRequest=} [properties] Properties to set + */ + function TuneModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TuneModelRequest name. + * @member {string} name + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @instance + */ + TuneModelRequest.prototype.name = ""; + + /** + * Creates a new TuneModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {google.cloud.retail.v2beta.ITuneModelRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.TuneModelRequest} TuneModelRequest instance + */ + TuneModelRequest.create = function create(properties) { + return new TuneModelRequest(properties); + }; + + /** + * Encodes the specified TuneModelRequest message. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {google.cloud.retail.v2beta.ITuneModelRequest} message TuneModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TuneModelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified TuneModelRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {google.cloud.retail.v2beta.ITuneModelRequest} message TuneModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TuneModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TuneModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.TuneModelRequest} TuneModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TuneModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.TuneModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TuneModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.TuneModelRequest} TuneModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TuneModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TuneModelRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TuneModelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a TuneModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.TuneModelRequest} TuneModelRequest + */ + TuneModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.TuneModelRequest) + return object; + var message = new $root.google.cloud.retail.v2beta.TuneModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a TuneModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {google.cloud.retail.v2beta.TuneModelRequest} message TuneModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TuneModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this TuneModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @instance + * @returns {Object.} JSON object + */ + TuneModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TuneModelRequest + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.TuneModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TuneModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.TuneModelRequest"; + }; + + return TuneModelRequest; + })(); + + v2beta.CreateModelMetadata = (function() { + + /** + * Properties of a CreateModelMetadata. + * @memberof google.cloud.retail.v2beta + * @interface ICreateModelMetadata + * @property {string|null} [model] CreateModelMetadata model + */ + + /** + * Constructs a new CreateModelMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a CreateModelMetadata. + * @implements ICreateModelMetadata + * @constructor + * @param {google.cloud.retail.v2beta.ICreateModelMetadata=} [properties] Properties to set + */ + function CreateModelMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateModelMetadata model. + * @member {string} model + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @instance + */ + CreateModelMetadata.prototype.model = ""; + + /** + * Creates a new CreateModelMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {google.cloud.retail.v2beta.ICreateModelMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.CreateModelMetadata} CreateModelMetadata instance + */ + CreateModelMetadata.create = function create(properties) { + return new CreateModelMetadata(properties); + }; + + /** + * Encodes the specified CreateModelMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {google.cloud.retail.v2beta.ICreateModelMetadata} message CreateModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateModelMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); + return writer; + }; + + /** + * Encodes the specified CreateModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.CreateModelMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {google.cloud.retail.v2beta.ICreateModelMetadata} message CreateModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateModelMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateModelMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.CreateModelMetadata} CreateModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateModelMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.CreateModelMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateModelMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.CreateModelMetadata} CreateModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateModelMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateModelMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateModelMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a CreateModelMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.CreateModelMetadata} CreateModelMetadata + */ + CreateModelMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.CreateModelMetadata) + return object; + var message = new $root.google.cloud.retail.v2beta.CreateModelMetadata(); + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a CreateModelMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {google.cloud.retail.v2beta.CreateModelMetadata} message CreateModelMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateModelMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this CreateModelMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateModelMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateModelMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.CreateModelMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateModelMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.CreateModelMetadata"; + }; + + return CreateModelMetadata; + })(); + + v2beta.TuneModelMetadata = (function() { + + /** + * Properties of a TuneModelMetadata. + * @memberof google.cloud.retail.v2beta + * @interface ITuneModelMetadata + * @property {string|null} [model] TuneModelMetadata model + */ + + /** + * Constructs a new TuneModelMetadata. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a TuneModelMetadata. + * @implements ITuneModelMetadata + * @constructor + * @param {google.cloud.retail.v2beta.ITuneModelMetadata=} [properties] Properties to set + */ + function TuneModelMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TuneModelMetadata model. + * @member {string} model + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @instance + */ + TuneModelMetadata.prototype.model = ""; + + /** + * Creates a new TuneModelMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {google.cloud.retail.v2beta.ITuneModelMetadata=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.TuneModelMetadata} TuneModelMetadata instance + */ + TuneModelMetadata.create = function create(properties) { + return new TuneModelMetadata(properties); + }; + + /** + * Encodes the specified TuneModelMetadata message. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {google.cloud.retail.v2beta.ITuneModelMetadata} message TuneModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TuneModelMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); + return writer; + }; + + /** + * Encodes the specified TuneModelMetadata message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {google.cloud.retail.v2beta.ITuneModelMetadata} message TuneModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TuneModelMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TuneModelMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.TuneModelMetadata} TuneModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TuneModelMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.TuneModelMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TuneModelMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.TuneModelMetadata} TuneModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TuneModelMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TuneModelMetadata message. + * @function verify + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TuneModelMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a TuneModelMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.TuneModelMetadata} TuneModelMetadata + */ + TuneModelMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.TuneModelMetadata) + return object; + var message = new $root.google.cloud.retail.v2beta.TuneModelMetadata(); + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a TuneModelMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {google.cloud.retail.v2beta.TuneModelMetadata} message TuneModelMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TuneModelMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this TuneModelMetadata to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @instance + * @returns {Object.} JSON object + */ + TuneModelMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TuneModelMetadata + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.TuneModelMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TuneModelMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.TuneModelMetadata"; + }; + + return TuneModelMetadata; + })(); + + v2beta.TuneModelResponse = (function() { + + /** + * Properties of a TuneModelResponse. + * @memberof google.cloud.retail.v2beta + * @interface ITuneModelResponse + */ + + /** + * Constructs a new TuneModelResponse. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a TuneModelResponse. + * @implements ITuneModelResponse + * @constructor + * @param {google.cloud.retail.v2beta.ITuneModelResponse=} [properties] Properties to set + */ + function TuneModelResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new TuneModelResponse instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {google.cloud.retail.v2beta.ITuneModelResponse=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.TuneModelResponse} TuneModelResponse instance + */ + TuneModelResponse.create = function create(properties) { + return new TuneModelResponse(properties); + }; + + /** + * Encodes the specified TuneModelResponse message. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {google.cloud.retail.v2beta.ITuneModelResponse} message TuneModelResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TuneModelResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified TuneModelResponse message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.TuneModelResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {google.cloud.retail.v2beta.ITuneModelResponse} message TuneModelResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TuneModelResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TuneModelResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.TuneModelResponse} TuneModelResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TuneModelResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.TuneModelResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TuneModelResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.TuneModelResponse} TuneModelResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TuneModelResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TuneModelResponse message. + * @function verify + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TuneModelResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a TuneModelResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.TuneModelResponse} TuneModelResponse + */ + TuneModelResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2beta.TuneModelResponse) + return object; + return new $root.google.cloud.retail.v2beta.TuneModelResponse(); + }; + + /** + * Creates a plain object from a TuneModelResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {google.cloud.retail.v2beta.TuneModelResponse} message TuneModelResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TuneModelResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this TuneModelResponse to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @instance + * @returns {Object.} JSON object + */ + TuneModelResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TuneModelResponse + * @function getTypeUrl + * @memberof google.cloud.retail.v2beta.TuneModelResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TuneModelResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.retail.v2beta.TuneModelResponse"; + }; + + return TuneModelResponse; + })(); + + v2beta.PredictionService = (function() { + + /** + * Constructs a new PredictionService service. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function PredictionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (PredictionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = PredictionService; + + /** + * Creates new PredictionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.retail.v2beta.PredictionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {PredictionService} RPC service. Useful where requests and/or responses are streamed. + */ + PredictionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.retail.v2beta.PredictionService|predict}. + * @memberof google.cloud.retail.v2beta.PredictionService + * @typedef PredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.retail.v2beta.PredictResponse} [response] PredictResponse + */ + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @param {google.cloud.retail.v2beta.PredictionService.PredictCallback} callback Node-style callback called with the error, if any, and PredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.predict = function predict(request, callback) { + return this.rpcCall(predict, $root.google.cloud.retail.v2beta.PredictRequest, $root.google.cloud.retail.v2beta.PredictResponse, request, callback); + }, "name", { value: "Predict" }); + + /** + * Calls Predict. + * @function predict + * @memberof google.cloud.retail.v2beta.PredictionService + * @instance + * @param {google.cloud.retail.v2beta.IPredictRequest} request PredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return PredictionService; + })(); + + v2beta.PredictRequest = (function() { + + /** + * Properties of a PredictRequest. + * @memberof google.cloud.retail.v2beta + * @interface IPredictRequest + * @property {string|null} [placement] PredictRequest placement + * @property {google.cloud.retail.v2beta.IUserEvent|null} [userEvent] PredictRequest userEvent + * @property {number|null} [pageSize] PredictRequest pageSize + * @property {string|null} [pageToken] PredictRequest pageToken + * @property {string|null} [filter] PredictRequest filter + * @property {boolean|null} [validateOnly] PredictRequest validateOnly + * @property {Object.|null} [params] PredictRequest params + * @property {Object.|null} [labels] PredictRequest labels + */ + + /** + * Constructs a new PredictRequest. + * @memberof google.cloud.retail.v2beta + * @classdesc Represents a PredictRequest. + * @implements IPredictRequest + * @constructor + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + */ + function PredictRequest(properties) { + this.params = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PredictRequest placement. + * @member {string} placement + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.placement = ""; + + /** + * PredictRequest userEvent. + * @member {google.cloud.retail.v2beta.IUserEvent|null|undefined} userEvent + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.userEvent = null; + + /** + * PredictRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageSize = 0; + + /** + * PredictRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.pageToken = ""; + + /** + * PredictRequest filter. + * @member {string} filter + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.filter = ""; + + /** + * PredictRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.validateOnly = false; + + /** + * PredictRequest params. + * @member {Object.} params + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.params = $util.emptyObject; + + /** + * PredictRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2beta.PredictRequest + * @instance + */ + PredictRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new PredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest=} [properties] Properties to set + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest instance + */ + PredictRequest.create = function create(properties) { + return new PredictRequest(properties); + }; + + /** + * Encodes the specified PredictRequest message. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.placement != null && Object.hasOwnProperty.call(message, "placement")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.placement); + if (message.userEvent != null && Object.hasOwnProperty.call(message, "userEvent")) + $root.google.cloud.retail.v2beta.UserEvent.encode(message.userEvent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.validateOnly); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + for (var keys = Object.keys(message.params), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.params[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified PredictRequest message, length delimited. Does not implicitly {@link google.cloud.retail.v2beta.PredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {google.cloud.retail.v2beta.IPredictRequest} message PredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2beta.PredictRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.placement = reader.string(); + break; + } + case 2: { + message.userEvent = $root.google.cloud.retail.v2beta.UserEvent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.validateOnly = reader.bool(); + break; + } + case 7: { + if (message.params === $util.emptyObject) + message.params = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.params[key] = value; + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PredictRequest message. + * @function verify + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.placement != null && message.hasOwnProperty("placement")) + if (!$util.isString(message.placement)) + return "placement: string expected"; + if (message.userEvent != null && message.hasOwnProperty("userEvent")) { + var error = $root.google.cloud.retail.v2beta.UserEvent.verify(message.userEvent); + if (error) + return "userEvent." + error; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!$util.isObject(message.params)) + return "params: object expected"; + var key = Object.keys(message.params); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.params[key[i]]); + if (error) + return "params." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a PredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2beta.PredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2beta.PredictRequest} PredictRequest */ PredictRequest.fromObject = function fromObject(object) { if (object instanceof $root.google.cloud.retail.v2beta.PredictRequest) @@ -120550,7 +124869,9 @@ * @property {Array.|null} [replacementControlIds] ServingConfig replacementControlIds * @property {Array.|null} [ignoreControlIds] ServingConfig ignoreControlIds * @property {string|null} [diversityLevel] ServingConfig diversityLevel + * @property {google.cloud.retail.v2beta.ServingConfig.DiversityType|null} [diversityType] ServingConfig diversityType * @property {string|null} [enableCategoryFilterLevel] ServingConfig enableCategoryFilterLevel + * @property {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] ServingConfig personalizationSpec * @property {Array.|null} [solutionTypes] ServingConfig solutionTypes */ @@ -120699,6 +125020,14 @@ */ ServingConfig.prototype.diversityLevel = ""; + /** + * ServingConfig diversityType. + * @member {google.cloud.retail.v2beta.ServingConfig.DiversityType} diversityType + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.diversityType = 0; + /** * ServingConfig enableCategoryFilterLevel. * @member {string} enableCategoryFilterLevel @@ -120707,6 +125036,14 @@ */ ServingConfig.prototype.enableCategoryFilterLevel = ""; + /** + * ServingConfig personalizationSpec. + * @member {google.cloud.retail.v2beta.SearchRequest.IPersonalizationSpec|null|undefined} personalizationSpec + * @memberof google.cloud.retail.v2beta.ServingConfig + * @instance + */ + ServingConfig.prototype.personalizationSpec = null; + /** * ServingConfig solutionTypes. * @member {Array.} solutionTypes @@ -120786,6 +125123,10 @@ writer.int32(message.solutionTypes[i]); writer.ldelim(); } + if (message.diversityType != null && Object.hasOwnProperty.call(message, "diversityType")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.diversityType); + if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) + $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); return writer; }; @@ -120898,10 +125239,18 @@ message.diversityLevel = reader.string(); break; } + case 20: { + message.diversityType = reader.int32(); + break; + } case 16: { message.enableCategoryFilterLevel = reader.string(); break; } + case 21: { + message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); + break; + } case 19: { if (!(message.solutionTypes && message.solutionTypes.length)) message.solutionTypes = []; @@ -121031,9 +125380,23 @@ if (message.diversityLevel != null && message.hasOwnProperty("diversityLevel")) if (!$util.isString(message.diversityLevel)) return "diversityLevel: string expected"; + if (message.diversityType != null && message.hasOwnProperty("diversityType")) + switch (message.diversityType) { + default: + return "diversityType: enum value expected"; + case 0: + case 2: + case 3: + break; + } if (message.enableCategoryFilterLevel != null && message.hasOwnProperty("enableCategoryFilterLevel")) if (!$util.isString(message.enableCategoryFilterLevel)) return "enableCategoryFilterLevel: string expected"; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) { + var error = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.verify(message.personalizationSpec); + if (error) + return "personalizationSpec." + error; + } if (message.solutionTypes != null && message.hasOwnProperty("solutionTypes")) { if (!Array.isArray(message.solutionTypes)) return "solutionTypes: array expected"; @@ -121140,8 +125503,27 @@ } if (object.diversityLevel != null) message.diversityLevel = String(object.diversityLevel); + switch (object.diversityType) { + case "DIVERSITY_TYPE_UNSPECIFIED": + case 0: + message.diversityType = 0; + break; + case "RULE_BASED_DIVERSITY": + case 2: + message.diversityType = 2; + break; + case "DATA_DRIVEN_DIVERSITY": + case 3: + message.diversityType = 3; + break; + } if (object.enableCategoryFilterLevel != null) message.enableCategoryFilterLevel = String(object.enableCategoryFilterLevel); + if (object.personalizationSpec != null) { + if (typeof object.personalizationSpec !== "object") + throw TypeError(".google.cloud.retail.v2beta.ServingConfig.personalizationSpec: object expected"); + message.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); + } if (object.solutionTypes) { if (!Array.isArray(object.solutionTypes)) throw TypeError(".google.cloud.retail.v2beta.ServingConfig.solutionTypes: array expected"); @@ -121199,6 +125581,8 @@ object.dynamicFacetSpec = null; object.diversityLevel = ""; object.enableCategoryFilterLevel = ""; + object.diversityType = options.enums === String ? "DIVERSITY_TYPE_UNSPECIFIED" : 0; + object.personalizationSpec = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -121264,6 +125648,10 @@ for (var j = 0; j < message.solutionTypes.length; ++j) object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } + if (message.diversityType != null && message.hasOwnProperty("diversityType")) + object.diversityType = options.enums === String ? $root.google.cloud.retail.v2beta.ServingConfig.DiversityType[message.diversityType] : message.diversityType; + if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) + object.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); return object; }; @@ -121293,6 +125681,22 @@ return typeUrlPrefix + "/google.cloud.retail.v2beta.ServingConfig"; }; + /** + * DiversityType enum. + * @name google.cloud.retail.v2beta.ServingConfig.DiversityType + * @enum {number} + * @property {number} DIVERSITY_TYPE_UNSPECIFIED=0 DIVERSITY_TYPE_UNSPECIFIED value + * @property {number} RULE_BASED_DIVERSITY=2 RULE_BASED_DIVERSITY value + * @property {number} DATA_DRIVEN_DIVERSITY=3 DATA_DRIVEN_DIVERSITY value + */ + ServingConfig.DiversityType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DIVERSITY_TYPE_UNSPECIFIED"] = 0; + values[valuesById[2] = "RULE_BASED_DIVERSITY"] = 2; + values[valuesById[3] = "DATA_DRIVEN_DIVERSITY"] = 3; + return values; + })(); + return ServingConfig; })(); diff --git a/packages/google-cloud-retail/protos/protos.json b/packages/google-cloud-retail/protos/protos.json index 6e41657c3a0..24aeb658c11 100644 --- a/packages/google-cloud-retail/protos/protos.json +++ b/packages/google-cloud-retail/protos/protos.json @@ -8839,6 +8839,10 @@ "recommendationsFilteringOption": { "type": "RecommendationsFilteringOption", "id": 8 + }, + "exactSearchableOption": { + "type": "ExactSearchableOption", + "id": 11 } }, "nested": { @@ -8869,6 +8873,13 @@ "SEARCHABLE_ENABLED": 1, "SEARCHABLE_DISABLED": 2 } + }, + "ExactSearchableOption": { + "values": { + "EXACT_SEARCHABLE_OPTION_UNSPECIFIED": 0, + "EXACT_SEARCHABLE_ENABLED": 1, + "EXACT_SEARCHABLE_DISABLED": 2 + } } } }, @@ -10045,6 +10056,14 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "localInventories": { + "rule": "repeated", + "type": "LocalInventory", + "id": 35, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -10420,6 +10439,22 @@ } ] }, + "BatchRemoveCatalogAttributes": { + "requestType": "BatchRemoveCatalogAttributesRequest", + "responseType": "BatchRemoveCatalogAttributesResponse", + "options": { + "(google.api.http).post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:batchRemoveCatalogAttributes", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:batchRemoveCatalogAttributes", + "body": "*" + } + } + ] + }, "ReplaceCatalogAttribute": { "requestType": "ReplaceCatalogAttributeRequest", "responseType": "AttributesConfig", @@ -10634,6 +10669,40 @@ } } }, + "BatchRemoveCatalogAttributesRequest": { + "fields": { + "attributesConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/AttributesConfig" + } + }, + "attributeKeys": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BatchRemoveCatalogAttributesResponse": { + "fields": { + "deletedCatalogAttributes": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "resetCatalogAttributes": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, "ReplaceCatalogAttributeRequest": { "fields": { "attributesConfig": { @@ -10800,7 +10869,10 @@ "fields": { "facetSpec": { "type": "SearchRequest.FacetSpec", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } }, "rule": { "type": "Rule", @@ -10835,6 +10907,11 @@ "options": { "(google.api.field_behavior)": "IMMUTABLE" } + }, + "searchSolutionUseCase": { + "rule": "repeated", + "type": "SearchSolutionUseCase", + "id": 7 } } }, @@ -11244,6 +11321,11 @@ "keyType": "string", "type": "google.protobuf.Value", "id": 5 + }, + "personalLabels": { + "rule": "repeated", + "type": "string", + "id": 7 } } }, @@ -11607,140 +11689,603 @@ } } }, - "PredictionService": { + "Model": { "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + "(google.api.resource).type": "retail.googleapis.com/Model", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}" }, - "methods": { - "Predict": { - "requestType": "PredictRequest", - "responseType": "PredictResponse", - "options": { - "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", - "(google.api.http).additional_bindings.body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", - "body": "*", - "additional_bindings": { - "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", - "body": "*" - } - } - } - ] - } - } - }, - "PredictRequest": { "fields": { - "placement": { + "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "userEvent": { - "type": "UserEvent", + "displayName": { + "type": "string", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "pageSize": { - "type": "int32", - "id": 3 + "trainingState": { + "type": "TrainingState", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "pageToken": { + "servingState": { + "type": "ServingState", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { "type": "string", - "id": 4 + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, - "filter": { + "optimizationObjective": { "type": "string", - "id": 5 + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "validateOnly": { - "type": "bool", - "id": 6 + "periodicTuningState": { + "type": "PeriodicTuningState", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "params": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 7 + "lastTuneTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "labels": { - "keyType": "string", + "tuningOperation": { "type": "string", - "id": 8 - } - } - }, - "PredictResponse": { - "fields": { - "results": { - "rule": "repeated", - "type": "PredictionResult", - "id": 1 + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "attributionToken": { - "type": "string", - "id": 2 + "dataState": { + "type": "DataState", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } }, - "missingIds": { - "rule": "repeated", - "type": "string", - "id": 3 + "filteringOption": { + "type": "RecommendationsFilteringOption", + "id": 18, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } }, - "validateOnly": { - "type": "bool", - "id": 4 + "servingConfigLists": { + "rule": "repeated", + "type": "ServingConfigList", + "id": 19, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { - "PredictionResult": { + "ServingConfigList": { "fields": { - "id": { + "servingConfigIds": { + "rule": "repeated", "type": "string", - "id": 1 - }, - "metadata": { - "keyType": "string", - "type": "google.protobuf.Value", - "id": 2 - } - } - } - } - }, - "ProductService": { - "options": { - "(google.api.default_host)": "retail.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" - }, - "methods": { - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", - "body": "product" + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ServingState": { + "values": { + "SERVING_STATE_UNSPECIFIED": 0, + "INACTIVE": 1, + "ACTIVE": 2, + "TUNED": 3 + } + }, + "TrainingState": { + "values": { + "TRAINING_STATE_UNSPECIFIED": 0, + "PAUSED": 1, + "TRAINING": 2 + } + }, + "PeriodicTuningState": { + "values": { + "PERIODIC_TUNING_STATE_UNSPECIFIED": 0, + "PERIODIC_TUNING_DISABLED": 1, + "ALL_TUNING_DISABLED": 3, + "PERIODIC_TUNING_ENABLED": 2 + } + }, + "DataState": { + "values": { + "DATA_STATE_UNSPECIFIED": 0, + "DATA_OK": 1, + "DATA_ERROR": 2 + } + } + } + }, + "ModelService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateModel": { + "requestType": "CreateModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models", + "(google.api.http).body": "model", + "(google.api.method_signature)": "parent,model", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.Model", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.CreateModelMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models", + "body": "model" + } + }, + { + "(google.api.method_signature)": "parent,model" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.Model", + "metadata_type": "google.cloud.retail.v2beta.CreateModelMetadata" + } + } + ] + }, + "PauseModel": { + "requestType": "PauseModelRequest", + "responseType": "Model", + "options": { + "(google.api.http).post": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:pause", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:pause", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ResumeModel": { + "requestType": "ResumeModelRequest", + "responseType": "Model", + "options": { + "(google.api.http).post": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:resume", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:resume", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteModel": { + "requestType": "DeleteModelRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListModels": { + "requestType": "ListModelsRequest", + "responseType": "ListModelsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateModel": { + "requestType": "UpdateModelRequest", + "responseType": "Model", + "options": { + "(google.api.http).patch": "/v2beta/{model.name=projects/*/locations/*/catalogs/*/models/*}", + "(google.api.http).body": "model", + "(google.api.method_signature)": "model,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{model.name=projects/*/locations/*/catalogs/*/models/*}", + "body": "model" + } + }, + { + "(google.api.method_signature)": "model,update_mask" + } + ] + }, + "TuneModel": { + "requestType": "TuneModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:tune", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.cloud.retail.v2beta.TuneModelResponse", + "(google.longrunning.operation_info).metadata_type": "google.cloud.retail.v2beta.TuneModelMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:tune", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.retail.v2beta.TuneModelResponse", + "metadata_type": "google.cloud.retail.v2beta.TuneModelMetadata" + } + } + ] + } + } + }, + "CreateModelRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "model": { + "type": "Model", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dryRun": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateModelRequest": { + "fields": { + "model": { + "type": "Model", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "PauseModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Model" + } + } + } + }, + "ResumeModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListModelsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Model" + } + } + } + }, + "ListModelsResponse": { + "fields": { + "models": { + "rule": "repeated", + "type": "Model", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "TuneModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Model" + } + } + } + }, + "CreateModelMetadata": { + "fields": { + "model": { + "type": "string", + "id": 1 + } + } + }, + "TuneModelMetadata": { + "fields": { + "model": { + "type": "string", + "id": 1 + } + } + }, + "TuneModelResponse": { + "fields": {} + }, + "PredictionService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "Predict": { + "requestType": "PredictRequest", + "responseType": "PredictResponse", + "options": { + "(google.api.http).post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict", + "body": "*", + "additional_bindings": { + "post": "/v2beta/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict", + "body": "*" + } } - }, - { - "(google.api.method_signature)": "parent,product,product_id" + } + ] + } + } + }, + "PredictRequest": { + "fields": { + "placement": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "userEvent": { + "type": "UserEvent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "deprecated": true + } + }, + "filter": { + "type": "string", + "id": 5 + }, + "validateOnly": { + "type": "bool", + "id": 6 + }, + "params": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 7 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + } + } + }, + "PredictResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "PredictionResult", + "id": 1 + }, + "attributionToken": { + "type": "string", + "id": 2 + }, + "missingIds": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4 + } + }, + "nested": { + "PredictionResult": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "metadata": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + }, + "ProductService": { + "options": { + "(google.api.default_host)": "retail.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateProduct": { + "requestType": "CreateProductRequest", + "responseType": "Product", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "(google.api.http).body": "product", + "(google.api.method_signature)": "parent,product,product_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*/catalogs/*/branches/*}/products", + "body": "product" + } + }, + { + "(google.api.method_signature)": "parent,product,product_id" } ] }, @@ -12392,10 +12937,18 @@ "type": "string", "id": 8 }, + "diversityType": { + "type": "DiversityType", + "id": 20 + }, "enableCategoryFilterLevel": { "type": "string", "id": 16 }, + "personalizationSpec": { + "type": "SearchRequest.PersonalizationSpec", + "id": 21 + }, "solutionTypes": { "rule": "repeated", "type": "SolutionType", @@ -12404,6 +12957,15 @@ "(google.api.field_behavior)": "IMMUTABLE" } } + }, + "nested": { + "DiversityType": { + "values": { + "DIVERSITY_TYPE_UNSPECIFIED": 0, + "RULE_BASED_DIVERSITY": 2, + "DATA_DRIVEN_DIVERSITY": 3 + } + } } }, "ServingConfigService": { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js new file mode 100644 index 00000000000..bf64469c8e3 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js @@ -0,0 +1,70 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(attributesConfig, attributeKeys) { + // [START retail_v2beta_generated_CatalogService_BatchRemoveCatalogAttributes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The attributes config resource shared by all catalog attributes + * being deleted. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + */ + // const attributesConfig = 'abc123' + /** + * Required. The attribute name keys of the + * CatalogAttribute google.cloud.retail.v2beta.CatalogAttribute s to delete. + * A maximum of 1000 catalog attributes can be deleted in a batch. + */ + // const attributeKeys = 'abc123' + + // Imports the Retail library + const {CatalogServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new CatalogServiceClient(); + + async function callBatchRemoveCatalogAttributes() { + // Construct request + const request = { + attributesConfig, + attributeKeys, + }; + + // Run request + const response = await retailClient.batchRemoveCatalogAttributes(request); + console.log(response); + } + + callBatchRemoveCatalogAttributes(); + // [END retail_v2beta_generated_CatalogService_BatchRemoveCatalogAttributes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js index 9dfa11507a3..29b6a56e821 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/catalog_service.get_completion_config.js @@ -30,7 +30,7 @@ function main(name) { */ /** * Required. Full CompletionConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js index 3916cfa081d..b601643c159 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/completion_service.import_completion_data.js @@ -39,8 +39,8 @@ function main(parent, inputConfig) { // const inputConfig = {} /** * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. */ diff --git a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js index f5b2332f33a..94c590e2ee5 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/control_service.get_control.js @@ -29,7 +29,7 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name of the Control to delete. Format: + * Required. The resource name of the Control to get. Format: * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.create_model.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.create_model.js new file mode 100644 index 00000000000..769cbe1c8a0 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.create_model.js @@ -0,0 +1,74 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, model) { + // [START retail_v2beta_generated_ModelService_CreateModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource under which to create the model. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + */ + // const parent = 'abc123' + /** + * Required. The payload of the Model google.cloud.retail.v2beta.Model to + * create. + */ + // const model = {} + /** + * Optional. Whether to run a dry run to validate the request (without + * actually creating the model). + */ + // const dryRun = true + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callCreateModel() { + // Construct request + const request = { + parent, + model, + }; + + // Run request + const [operation] = await retailClient.createModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateModel(); + // [END retail_v2beta_generated_ModelService_CreateModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.delete_model.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.delete_model.js new file mode 100644 index 00000000000..0b695637824 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.delete_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ModelService_DeleteModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * Model google.cloud.retail.v2beta.Model to delete. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callDeleteModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.deleteModel(request); + console.log(response); + } + + callDeleteModel(); + // [END retail_v2beta_generated_ModelService_DeleteModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.list_models.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.list_models.js new file mode 100644 index 00000000000..25775f3d704 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.list_models.js @@ -0,0 +1,75 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START retail_v2beta_generated_ModelService_ListModels_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent for which to list models. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callListModels() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await retailClient.listModelsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListModels(); + // [END retail_v2beta_generated_ModelService_ListModels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.pause_model.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.pause_model.js new file mode 100644 index 00000000000..a0a676070bd --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.pause_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ModelService_PauseModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the model to pause. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callPauseModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.pauseModel(request); + console.log(response); + } + + callPauseModel(); + // [END retail_v2beta_generated_ModelService_PauseModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.resume_model.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.resume_model.js new file mode 100644 index 00000000000..780bfa01a5b --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.resume_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ModelService_ResumeModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the model to resume. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callResumeModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await retailClient.resumeModel(request); + console.log(response); + } + + callResumeModel(); + // [END retail_v2beta_generated_ModelService_ResumeModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.tune_model.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.tune_model.js new file mode 100644 index 00000000000..2983b757527 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.tune_model.js @@ -0,0 +1,64 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START retail_v2beta_generated_ModelService_TuneModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the model to tune. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + */ + // const name = 'abc123' + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callTuneModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await retailClient.tuneModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTuneModel(); + // [END retail_v2beta_generated_ModelService_TuneModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/model_service.update_model.js b/packages/google-cloud-retail/samples/generated/v2beta/model_service.update_model.js new file mode 100644 index 00000000000..fe8c25f0545 --- /dev/null +++ b/packages/google-cloud-retail/samples/generated/v2beta/model_service.update_model.js @@ -0,0 +1,67 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(model) { + // [START retail_v2beta_generated_ModelService_UpdateModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The body of the updated + * Model google.cloud.retail.v2beta.Model. + */ + // const model = {} + /** + * Optional. Indicates which fields in the provided 'model' to + * update. If not set, by default updates all fields. + */ + // const updateMask = {} + + // Imports the Retail library + const {ModelServiceClient} = require('@google-cloud/retail').v2beta; + + // Instantiates a client + const retailClient = new ModelServiceClient(); + + async function callUpdateModel() { + // Construct request + const request = { + model, + }; + + // Run request + const response = await retailClient.updateModel(request); + console.log(response); + } + + callUpdateModel(); + // [END retail_v2beta_generated_ModelService_UpdateModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js index 13ffa1c27bc..ec652b810ce 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/prediction_service.predict.js @@ -61,14 +61,14 @@ function main(placement, userEvent) { */ // const userEvent = {} /** - * 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. + * Maximum number of results to return. 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. */ // const pageSize = 1234 /** - * This field is not used for now; leave it unset. + * This field is not used; leave it unset. */ // const pageToken = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js index 8010bd30543..701c45762ae 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/product_service.import_products.js @@ -44,8 +44,8 @@ function main(parent, inputConfig) { */ // const errorsConfig = {} /** - * Indicates which fields in the provided imported 'products' to update. If - * not set, will by default update all fields. + * Indicates which fields in the provided imported `products` to update. If + * not set, all fields are updated. */ // const updateMask = {} /** @@ -56,19 +56,15 @@ function main(parent, inputConfig) { // const reconciliationMode = {} /** * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * Operation google.longrunning.Operation. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has * to be within the same project as * ImportProductsRequest.parent google.cloud.retail.v2beta.ImportProductsRequest.parent. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. + * Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + * `pubsub.topics.publish` IAM permission on the topic. */ // const notificationPubsubTopic = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js index 6d8ff0e3ae8..1de2864e0d3 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/search_service.search.js @@ -224,7 +224,7 @@ function main(placement, visitorId) { * the same as * UserEvent.page_categories google.cloud.retail.v2beta.UserEvent.page_categories; * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, please replace it with + * hierarchies. If '>' is part of the category name, 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: @@ -238,6 +238,14 @@ function main(placement, visitorId) { // const searchMode = {} /** * The specification for personalization. + * Notice that if both + * ServingConfig.personalization_spec google.cloud.retail.v2beta.ServingConfig.personalization_spec + * and + * SearchRequest.personalization_spec google.cloud.retail.v2beta.SearchRequest.personalization_spec + * are set. + * SearchRequest.personalization_spec google.cloud.retail.v2beta.SearchRequest.personalization_spec + * will override + * ServingConfig.personalization_spec google.cloud.retail.v2beta.ServingConfig.personalization_spec. */ // const personalizationSpec = {} /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js index 5396a381fae..35d7cd0f8dc 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.add_control.js @@ -30,7 +30,7 @@ function main(servingConfig, controlId) { */ /** * Required. The source ServingConfig resource name . Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` */ // const servingConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js index 2002c69da77..4c97e8ba77e 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.delete_serving_config.js @@ -30,7 +30,7 @@ function main(name) { */ /** * Required. The resource name of the ServingConfig to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js index bf44e361fed..edd8ca8d490 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.get_serving_config.js @@ -30,7 +30,7 @@ function main(name) { */ /** * Required. The resource name of the ServingConfig to get. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` */ // const name = 'abc123' diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js index d22961b4540..ce3eedb99db 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.list_serving_configs.js @@ -30,7 +30,7 @@ function main(parent) { */ /** * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js index 5ec4d631475..e49c6249bce 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/serving_config_service.remove_control.js @@ -30,7 +30,7 @@ function main(servingConfig, controlId) { */ /** * Required. The source ServingConfig resource name . Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` */ // const servingConfig = 'abc123' /** diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 4ab319f44a5..b21c74bc887 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -451,6 +451,50 @@ } } }, + { + "regionTag": "retail_v2beta_generated_CatalogService_BatchRemoveCatalogAttributes_async", + "title": "CatalogService batchRemoveCatalogAttributes Sample", + "origin": "API_DEFINITION", + "description": " Removes all specified [CatalogAttribute][google.cloud.retail.v2beta.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2beta.AttributesConfig].", + "canonical": true, + "file": "catalog_service.batch_remove_catalog_attributes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchRemoveCatalogAttributes", + "fullName": "google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributes", + "async": true, + "parameters": [ + { + "name": "attributes_config", + "type": "TYPE_STRING" + }, + { + "name": "attribute_keys", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse", + "client": { + "shortName": "CatalogServiceClient", + "fullName": "google.cloud.retail.v2beta.CatalogServiceClient" + }, + "method": { + "shortName": "BatchRemoveCatalogAttributes", + "fullName": "google.cloud.retail.v2beta.CatalogService.BatchRemoveCatalogAttributes", + "service": { + "shortName": "CatalogService", + "fullName": "google.cloud.retail.v2beta.CatalogService" + } + } + } + }, { "regionTag": "retail_v2beta_generated_CatalogService_ReplaceCatalogAttribute_async", "title": "CatalogService replaceCatalogAttribute Sample", @@ -503,7 +547,7 @@ "regionTag": "retail_v2beta_generated_CompletionService_CompleteQuery_async", "title": "CatalogService completeQuery Sample", "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "completion_service.complete_query.js", "language": "JAVASCRIPT", @@ -567,7 +611,7 @@ "regionTag": "retail_v2beta_generated_CompletionService_ImportCompletionData_async", "title": "CatalogService importCompletionData Sample", "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "completion_service.import_completion_data.js", "language": "JAVASCRIPT", @@ -703,7 +747,7 @@ "regionTag": "retail_v2beta_generated_ControlService_UpdateControl_async", "title": "CatalogService updateControl Sample", "origin": "API_DEFINITION", - "description": " Updates a Control. [Control][google.cloud.retail.v2beta.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2beta.Control] to delete does not exist, a NOT_FOUND error is returned.", + "description": " Updates a Control. [Control][google.cloud.retail.v2beta.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2beta.Control] to update does not exist, a NOT_FOUND error is returned.", "canonical": true, "file": "control_service.update_control.js", "language": "JAVASCRIPT", @@ -787,7 +831,7 @@ "regionTag": "retail_v2beta_generated_ControlService_ListControls_async", "title": "CatalogService listControls Sample", "origin": "API_DEFINITION", - "description": " Lists all Controls linked to this catalog.", + "description": " Lists all Controls by their parent [Catalog][google.cloud.retail.v2beta.Catalog].", "canonical": true, "file": "control_service.list_controls.js", "language": "JAVASCRIPT", @@ -835,6 +879,306 @@ } } }, + { + "regionTag": "retail_v2beta_generated_ModelService_CreateModel_async", + "title": "CatalogService createModel Sample", + "origin": "API_DEFINITION", + "description": " Creates a new model.", + "canonical": true, + "file": "model_service.create_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateModel", + "fullName": "google.cloud.retail.v2beta.ModelService.CreateModel", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": ".google.cloud.retail.v2beta.Model" + }, + { + "name": "dry_run", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "CreateModel", + "fullName": "google.cloud.retail.v2beta.ModelService.CreateModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ModelService_PauseModel_async", + "title": "CatalogService pauseModel Sample", + "origin": "API_DEFINITION", + "description": " Pauses the training of an existing model.", + "canonical": true, + "file": "model_service.pause_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PauseModel", + "fullName": "google.cloud.retail.v2beta.ModelService.PauseModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Model", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "PauseModel", + "fullName": "google.cloud.retail.v2beta.ModelService.PauseModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ModelService_ResumeModel_async", + "title": "CatalogService resumeModel Sample", + "origin": "API_DEFINITION", + "description": " Resumes the training of an existing model.", + "canonical": true, + "file": "model_service.resume_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResumeModel", + "fullName": "google.cloud.retail.v2beta.ModelService.ResumeModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.Model", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "ResumeModel", + "fullName": "google.cloud.retail.v2beta.ModelService.ResumeModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ModelService_DeleteModel_async", + "title": "CatalogService deleteModel Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing model.", + "canonical": true, + "file": "model_service.delete_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteModel", + "fullName": "google.cloud.retail.v2beta.ModelService.DeleteModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "DeleteModel", + "fullName": "google.cloud.retail.v2beta.ModelService.DeleteModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ModelService_ListModels_async", + "title": "CatalogService listModels Sample", + "origin": "API_DEFINITION", + "description": " Lists all the models linked to this event store.", + "canonical": true, + "file": "model_service.list_models.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListModels", + "fullName": "google.cloud.retail.v2beta.ModelService.ListModels", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.retail.v2beta.ListModelsResponse", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "ListModels", + "fullName": "google.cloud.retail.v2beta.ModelService.ListModels", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ModelService_UpdateModel_async", + "title": "CatalogService updateModel Sample", + "origin": "API_DEFINITION", + "description": " Update of model metadata. Only fields that currently can be updated are: `filtering_option` and `periodic_tuning_state`. If other values are provided, this API method ignores them.", + "canonical": true, + "file": "model_service.update_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateModel", + "fullName": "google.cloud.retail.v2beta.ModelService.UpdateModel", + "async": true, + "parameters": [ + { + "name": "model", + "type": ".google.cloud.retail.v2beta.Model" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.retail.v2beta.Model", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "UpdateModel", + "fullName": "google.cloud.retail.v2beta.ModelService.UpdateModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, + { + "regionTag": "retail_v2beta_generated_ModelService_TuneModel_async", + "title": "CatalogService tuneModel Sample", + "origin": "API_DEFINITION", + "description": " Tunes an existing model.", + "canonical": true, + "file": "model_service.tune_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TuneModel", + "fullName": "google.cloud.retail.v2beta.ModelService.TuneModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ModelServiceClient", + "fullName": "google.cloud.retail.v2beta.ModelServiceClient" + }, + "method": { + "shortName": "TuneModel", + "fullName": "google.cloud.retail.v2beta.ModelService.TuneModel", + "service": { + "shortName": "ModelService", + "fullName": "google.cloud.retail.v2beta.ModelService" + } + } + } + }, { "regionTag": "retail_v2beta_generated_PredictionService_Predict_async", "title": "CatalogService predict Sample", @@ -1146,7 +1490,7 @@ "segments": [ { "start": 25, - "end": 94, + "end": 90, "type": "FULL" } ], @@ -1203,7 +1547,7 @@ "regionTag": "retail_v2beta_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2beta.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update is enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct], the specified inventory field value(s) overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update times for the specified inventory fields are overwritten by the times of the [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2beta.CreateProductRequest.product], then any pre-existing inventory information for this product is used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2beta.SetInventoryRequest.set_mask], then any existing inventory information is preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2beta.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces]. The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates are not marked as [done][google.longrunning.Operation.done] until they are obsolete. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", @@ -1255,7 +1599,7 @@ "regionTag": "retail_v2beta_generated_ProductService_AddFulfillmentPlaces_async", "title": "CatalogService addFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_fulfillment_places.js", "language": "JAVASCRIPT", @@ -1311,7 +1655,7 @@ "regionTag": "retail_v2beta_generated_ProductService_RemoveFulfillmentPlaces_async", "title": "CatalogService removeFulfillmentPlaces Sample", "origin": "API_DEFINITION", - "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2beta.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_fulfillment_places.js", "language": "JAVASCRIPT", @@ -1367,7 +1711,7 @@ "regionTag": "retail_v2beta_generated_ProductService_AddLocalInventories_async", "title": "CatalogService addLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2beta.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.add_local_inventories.js", "language": "JAVASCRIPT", @@ -1423,7 +1767,7 @@ "regionTag": "retail_v2beta_generated_ProductService_RemoveLocalInventories_async", "title": "CatalogService removeLocalInventories Sample", "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Remove local inventory information for a [Product][google.cloud.retail.v2beta.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2beta.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2beta.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2beta.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2beta.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.remove_local_inventories.js", "language": "JAVASCRIPT", @@ -1475,14 +1819,14 @@ "regionTag": "retail_v2beta_generated_SearchService_Search_async", "title": "CatalogService search Sample", "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "search_service.search.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 287, + "end": 295, "type": "FULL" } ], @@ -2047,7 +2391,7 @@ "regionTag": "retail_v2beta_generated_UserEventService_ImportUserEvents_async", "title": "CatalogService importUserEvents Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " 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`.", "canonical": true, "file": "user_event_service.import_user_events.js", "language": "JAVASCRIPT", @@ -2095,7 +2439,7 @@ "regionTag": "retail_v2beta_generated_UserEventService_RejoinUserEvents_async", "title": "CatalogService rejoinUserEvents Sample", "origin": "API_DEFINITION", - "description": " Starts 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 method can be used to start a join operation on specified events with latest version of product catalog. It can also be used to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", + "description": " Starts a user-event rejoin operation with latest product catalog. Events are not annotated with detailed product information for products that are missing from the catalog when the user event is ingested. These events are stored as unjoined events with limited usage on training and serving. You can use this method to start a join operation on specified events with the latest version of product catalog. You can also use this method to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", "canonical": true, "file": "user_event_service.rejoin_user_events.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js index 45f8c89e8c9..9c24f1a5154 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js +++ b/packages/google-cloud-retail/samples/generated/v2beta/user_event_service.rejoin_user_events.js @@ -36,8 +36,8 @@ function main(parent) { /** * 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. + * `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to + * an invalid integer value. */ // const userEventRejoinScope = {} diff --git a/packages/google-cloud-retail/src/index.ts b/packages/google-cloud-retail/src/index.ts index 7fb6963744a..4e17a8307f1 100644 --- a/packages/google-cloud-retail/src/index.ts +++ b/packages/google-cloud-retail/src/index.ts @@ -26,6 +26,8 @@ const CompletionServiceClient = v2beta.CompletionServiceClient; type CompletionServiceClient = v2beta.CompletionServiceClient; const ControlServiceClient = v2beta.ControlServiceClient; type ControlServiceClient = v2beta.ControlServiceClient; +const ModelServiceClient = v2beta.ModelServiceClient; +type ModelServiceClient = v2beta.ModelServiceClient; const PredictionServiceClient = v2beta.PredictionServiceClient; type PredictionServiceClient = v2beta.PredictionServiceClient; const ProductServiceClient = v2beta.ProductServiceClient; @@ -44,6 +46,7 @@ export { CatalogServiceClient, CompletionServiceClient, ControlServiceClient, + ModelServiceClient, PredictionServiceClient, ProductServiceClient, SearchServiceClient, @@ -57,6 +60,7 @@ export default { CatalogServiceClient, CompletionServiceClient, ControlServiceClient, + ModelServiceClient, PredictionServiceClient, ProductServiceClient, SearchServiceClient, diff --git a/packages/google-cloud-retail/src/v2/catalog_service_client.ts b/packages/google-cloud-retail/src/v2/catalog_service_client.ts index 1035f584969..5b75717098a 100644 --- a/packages/google-cloud-retail/src/v2/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2/catalog_service_client.ts @@ -496,7 +496,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name || '', + 'catalog.name': request.catalog!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); @@ -634,7 +634,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.setDefaultBranch(request, options, callback); @@ -722,7 +722,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.getDefaultBranch(request, options, callback); @@ -814,7 +814,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getCompletionConfig(request, options, callback); @@ -924,7 +924,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'completion_config.name': request.completionConfig!.name || '', + 'completion_config.name': request.completionConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCompletionConfig( @@ -1020,7 +1020,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getAttributesConfig(request, options, callback); @@ -1127,7 +1127,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config.name': request.attributesConfig!.name || '', + 'attributes_config.name': request.attributesConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateAttributesConfig( @@ -1231,7 +1231,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.addCatalogAttribute(request, options, callback); @@ -1331,7 +1331,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.removeCatalogAttribute( @@ -1445,7 +1445,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.replaceCatalogAttribute( @@ -1561,7 +1561,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listCatalogs(request, options, callback); @@ -1617,7 +1617,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); @@ -1682,7 +1682,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2/completion_service_client.ts b/packages/google-cloud-retail/src/v2/completion_service_client.ts index e72cf1f0dff..073bef1cafe 100644 --- a/packages/google-cloud-retail/src/v2/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2/completion_service_client.ts @@ -535,7 +535,7 @@ export class CompletionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.completeQuery(request, options, callback); @@ -657,7 +657,7 @@ export class CompletionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importCompletionData(request, options, callback); diff --git a/packages/google-cloud-retail/src/v2/control_service_client.ts b/packages/google-cloud-retail/src/v2/control_service_client.ts index 9aa011ee197..1b1c792b370 100644 --- a/packages/google-cloud-retail/src/v2/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2/control_service_client.ts @@ -483,7 +483,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createControl(request, options, callback); @@ -572,7 +572,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteControl(request, options, callback); @@ -670,7 +670,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'control.name': request.control!.name || '', + 'control.name': request.control!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateControl(request, options, callback); @@ -754,7 +754,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getControl(request, options, callback); @@ -858,7 +858,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listControls(request, options, callback); @@ -906,7 +906,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listControls']; const callSettings = defaultCallSettings.merge(options); @@ -963,7 +963,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listControls']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2/prediction_service_client.ts b/packages/google-cloud-retail/src/v2/prediction_service_client.ts index 78ba755273c..9dc1b1aecf5 100644 --- a/packages/google-cloud-retail/src/v2/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2/prediction_service_client.ts @@ -574,7 +574,7 @@ export class PredictionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); diff --git a/packages/google-cloud-retail/src/v2/product_service_client.ts b/packages/google-cloud-retail/src/v2/product_service_client.ts index 0c78a503849..b43eeb496f0 100644 --- a/packages/google-cloud-retail/src/v2/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2/product_service_client.ts @@ -579,7 +579,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); @@ -671,7 +671,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); @@ -782,7 +782,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name || '', + 'product.name': request.product!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); @@ -887,7 +887,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteProduct(request, options, callback); @@ -1026,7 +1026,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importProducts(request, options, callback); @@ -1289,7 +1289,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'inventory.name': request.inventory!.name || '', + 'inventory.name': request.inventory!.name ?? '', }); this.initialize(); return this.innerApiCalls.setInventory(request, options, callback); @@ -1502,7 +1502,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.addFulfillmentPlaces(request, options, callback); @@ -1710,7 +1710,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.removeFulfillmentPlaces( @@ -1916,7 +1916,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.addLocalInventories(request, options, callback); @@ -2100,7 +2100,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.removeLocalInventories( @@ -2298,7 +2298,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listProducts(request, options, callback); @@ -2403,7 +2403,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); @@ -2517,7 +2517,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2/search_service_client.ts b/packages/google-cloud-retail/src/v2/search_service_client.ts index 760e3e3584a..4f20e8f9bc0 100644 --- a/packages/google-cloud-retail/src/v2/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2/search_service_client.ts @@ -705,7 +705,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); this.initialize(); return this.innerApiCalls.search(request, options, callback); @@ -968,7 +968,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); @@ -1240,7 +1240,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2/serving_config_service_client.ts index 3ddd9a7772a..d23ae556e17 100644 --- a/packages/google-cloud-retail/src/v2/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2/serving_config_service_client.ts @@ -492,7 +492,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createServingConfig(request, options, callback); @@ -586,7 +586,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteServingConfig(request, options, callback); @@ -685,7 +685,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'serving_config.name': request.servingConfig!.name || '', + 'serving_config.name': request.servingConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateServingConfig(request, options, callback); @@ -773,7 +773,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getServingConfig(request, options, callback); @@ -866,7 +866,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - serving_config: request.servingConfig || '', + serving_config: request.servingConfig ?? '', }); this.initialize(); return this.innerApiCalls.addControl(request, options, callback); @@ -958,7 +958,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - serving_config: request.servingConfig || '', + serving_config: request.servingConfig ?? '', }); this.initialize(); return this.innerApiCalls.removeControl(request, options, callback); @@ -1061,7 +1061,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listServingConfigs(request, options, callback); @@ -1103,7 +1103,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listServingConfigs']; const callSettings = defaultCallSettings.merge(options); @@ -1154,7 +1154,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listServingConfigs']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2/user_event_service_client.ts b/packages/google-cloud-retail/src/v2/user_event_service_client.ts index dbdcc0f6e4c..e6e38be5774 100644 --- a/packages/google-cloud-retail/src/v2/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2/user_event_service_client.ts @@ -496,7 +496,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); @@ -598,7 +598,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.collectUserEvent(request, options, callback); @@ -735,7 +735,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.purgeUserEvents(request, options, callback); @@ -884,7 +884,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importUserEvents(request, options, callback); @@ -1035,7 +1035,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.rejoinUserEvents(request, options, callback); diff --git a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts index be57f7c8784..64f1bcf3108 100644 --- a/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/catalog_service_client.ts @@ -505,7 +505,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name || '', + 'catalog.name': request.catalog!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); @@ -649,7 +649,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.setDefaultBranch(request, options, callback); @@ -743,7 +743,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.getDefaultBranch(request, options, callback); @@ -841,7 +841,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getCompletionConfig(request, options, callback); @@ -958,7 +958,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'completion_config.name': request.completionConfig!.name || '', + 'completion_config.name': request.completionConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCompletionConfig( @@ -1060,7 +1060,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getAttributesConfig(request, options, callback); @@ -1174,7 +1174,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config.name': request.attributesConfig!.name || '', + 'attributes_config.name': request.attributesConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateAttributesConfig( @@ -1284,7 +1284,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.addCatalogAttribute(request, options, callback); @@ -1390,7 +1390,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.removeCatalogAttribute( @@ -1510,7 +1510,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.replaceCatalogAttribute( @@ -1632,7 +1632,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listCatalogs(request, options, callback); @@ -1688,7 +1688,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); @@ -1753,7 +1753,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts index 0e7cddd1e88..95593a850d4 100644 --- a/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/completion_service_client.ts @@ -544,7 +544,7 @@ export class CompletionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.completeQuery(request, options, callback); @@ -666,7 +666,7 @@ export class CompletionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importCompletionData(request, options, callback); diff --git a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts index 334ff21b3b4..bfa3e9c0feb 100644 --- a/packages/google-cloud-retail/src/v2alpha/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/control_service_client.ts @@ -492,7 +492,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createControl(request, options, callback); @@ -587,7 +587,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteControl(request, options, callback); @@ -691,7 +691,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'control.name': request.control!.name || '', + 'control.name': request.control!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateControl(request, options, callback); @@ -777,7 +777,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getControl(request, options, callback); @@ -886,7 +886,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listControls(request, options, callback); @@ -934,7 +934,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listControls']; const callSettings = defaultCallSettings.merge(options); @@ -991,7 +991,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listControls']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts index ff39dc08ade..7b82d9b2df3 100644 --- a/packages/google-cloud-retail/src/v2alpha/model_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/model_service_client.ts @@ -516,7 +516,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.pauseModel(request, options, callback); @@ -603,7 +603,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.resumeModel(request, options, callback); @@ -690,7 +690,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteModel(request, options, callback); @@ -780,7 +780,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'model.name': request.model!.name || '', + 'model.name': request.model!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateModel(request, options, callback); @@ -890,7 +890,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createModel(request, options, callback); @@ -1030,7 +1030,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.tuneModel(request, options, callback); @@ -1161,7 +1161,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listModels(request, options, callback); @@ -1203,7 +1203,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listModels']; const callSettings = defaultCallSettings.merge(options); @@ -1254,7 +1254,7 @@ export class ModelServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listModels']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts index 7e752e3eaf5..c9007825523 100644 --- a/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/prediction_service_client.ts @@ -577,7 +577,7 @@ export class PredictionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); diff --git a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts index aea5c30754e..723bc9e25a3 100644 --- a/packages/google-cloud-retail/src/v2alpha/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/product_service_client.ts @@ -600,7 +600,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); @@ -694,7 +694,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); @@ -811,7 +811,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name || '', + 'product.name': request.product!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); @@ -923,7 +923,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteProduct(request, options, callback); @@ -1090,7 +1090,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.purgeProducts(request, options, callback); @@ -1276,7 +1276,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importProducts(request, options, callback); @@ -1532,7 +1532,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'inventory.name': request.inventory!.name || '', + 'inventory.name': request.inventory!.name ?? '', }); this.initialize(); return this.innerApiCalls.setInventory(request, options, callback); @@ -1738,7 +1738,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.addFulfillmentPlaces(request, options, callback); @@ -1939,7 +1939,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.removeFulfillmentPlaces( @@ -2139,7 +2139,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.addLocalInventories(request, options, callback); @@ -2316,7 +2316,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.removeLocalInventories( @@ -2530,7 +2530,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listProducts(request, options, callback); @@ -2645,7 +2645,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); @@ -2769,7 +2769,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts index b7d6f65a638..1c956ee9538 100644 --- a/packages/google-cloud-retail/src/v2alpha/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/search_service_client.ts @@ -718,7 +718,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); this.initialize(); return this.innerApiCalls.search(request, options, callback); @@ -991,7 +991,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); @@ -1273,7 +1273,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts index b60abbd17eb..ea614bd0bc2 100644 --- a/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/serving_config_service_client.ts @@ -503,7 +503,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createServingConfig(request, options, callback); @@ -603,7 +603,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteServingConfig(request, options, callback); @@ -708,7 +708,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'serving_config.name': request.servingConfig!.name || '', + 'serving_config.name': request.servingConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateServingConfig(request, options, callback); @@ -802,7 +802,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getServingConfig(request, options, callback); @@ -897,7 +897,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - serving_config: request.servingConfig || '', + serving_config: request.servingConfig ?? '', }); this.initialize(); return this.innerApiCalls.addControl(request, options, callback); @@ -995,7 +995,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - serving_config: request.servingConfig || '', + serving_config: request.servingConfig ?? '', }); this.initialize(); return this.innerApiCalls.removeControl(request, options, callback); @@ -1098,7 +1098,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listServingConfigs(request, options, callback); @@ -1140,7 +1140,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listServingConfigs']; const callSettings = defaultCallSettings.merge(options); @@ -1191,7 +1191,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listServingConfigs']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts index cc2acb53865..43ed8a39f08 100644 --- a/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2alpha/user_event_service_client.ts @@ -505,7 +505,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); @@ -613,7 +613,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.collectUserEvent(request, options, callback); @@ -751,7 +751,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.purgeUserEvents(request, options, callback); @@ -900,7 +900,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importUserEvents(request, options, callback); @@ -1051,7 +1051,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.rejoinUserEvents(request, options, callback); diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts index 95f7c1cc297..16126450947 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client.ts @@ -202,6 +202,9 @@ export class CatalogServiceClient { locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -319,6 +322,7 @@ export class CatalogServiceClient { 'updateAttributesConfig', 'addCatalogAttribute', 'removeCatalogAttribute', + 'batchRemoveCatalogAttributes', 'replaceCatalogAttribute', ]; for (const methodName of catalogServiceStubMethods) { @@ -502,7 +506,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name || '', + 'catalog.name': request.catalog!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCatalog(request, options, callback); @@ -646,7 +650,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.setDefaultBranch(request, options, callback); @@ -740,7 +744,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.getDefaultBranch(request, options, callback); @@ -752,7 +756,7 @@ export class CatalogServiceClient { * The request object that will be sent. * @param {string} request.name * Required. Full CompletionConfig resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -832,7 +836,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getCompletionConfig(request, options, callback); @@ -949,7 +953,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'completion_config.name': request.completionConfig!.name || '', + 'completion_config.name': request.completionConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCompletionConfig( @@ -1045,7 +1049,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getAttributesConfig(request, options, callback); @@ -1159,7 +1163,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config.name': request.attributesConfig!.name || '', + 'attributes_config.name': request.attributesConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateAttributesConfig( @@ -1263,7 +1267,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.addCatalogAttribute(request, options, callback); @@ -1369,7 +1373,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.removeCatalogAttribute( @@ -1378,6 +1382,115 @@ export class CatalogServiceClient { callback ); } + /** + * Removes all specified + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute}s from the + * {@link google.cloud.retail.v2beta.AttributesConfig|AttributesConfig}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.attributesConfig + * Required. The attributes config resource shared by all catalog attributes + * being deleted. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + * @param {string[]} request.attributeKeys + * Required. The attribute name keys of the + * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute}s to delete. + * A maximum of 1000 catalog attributes can be deleted in a batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchRemoveCatalogAttributesResponse]{@link google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js + * region_tag:retail_v2beta_generated_CatalogService_BatchRemoveCatalogAttributes_async + */ + batchRemoveCatalogAttributes( + request?: protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, + ( + | protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest + | undefined + ), + {} | undefined + ] + >; + batchRemoveCatalogAttributes( + request: protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, + | protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + batchRemoveCatalogAttributes( + request: protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, + | protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + batchRemoveCatalogAttributes( + request?: protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, + | protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, + | protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse, + ( + | protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + attributes_config: request.attributesConfig ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchRemoveCatalogAttributes( + request, + options, + callback + ); + } /** * Replaces the specified * {@link google.cloud.retail.v2beta.CatalogAttribute|CatalogAttribute} in the @@ -1489,7 +1602,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - attributes_config: request.attributesConfig || '', + attributes_config: request.attributesConfig ?? '', }); this.initialize(); return this.innerApiCalls.replaceCatalogAttribute( @@ -1611,7 +1724,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listCatalogs(request, options, callback); @@ -1667,7 +1780,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); @@ -1732,7 +1845,7 @@ export class CatalogServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCatalogs']; const callSettings = defaultCallSettings.merge(options); @@ -2333,6 +2446,68 @@ export class CatalogServiceClient { return this.pathTemplates.locationPathTemplate.match(locationName).location; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json index cd2aebd157d..3554c7046eb 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_client_config.json @@ -79,6 +79,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" }, + "BatchRemoveCatalogAttributes": { + "timeout_millis": 5000, + "retry_codes_name": "idempotent", + "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" + }, "ReplaceCatalogAttribute": { "timeout_millis": 5000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/catalog_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts index 6ec9214251e..52182c21368 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/completion_service_client.ts @@ -43,7 +43,7 @@ const version = require('../../../package.json').version; * Auto-completion service for retail. * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2beta */ @@ -198,6 +198,9 @@ export class CompletionServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -395,7 +398,7 @@ export class CompletionServiceClient { * Completes the specified prefix with keyword suggestions. * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -541,7 +544,7 @@ export class CompletionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - catalog: request.catalog || '', + catalog: request.catalog ?? '', }); this.initialize(); return this.innerApiCalls.completeQuery(request, options, callback); @@ -556,7 +559,7 @@ export class CompletionServiceClient { * are indexed successfully and ready for serving. The process takes hours. * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -568,8 +571,8 @@ export class CompletionServiceClient { * Required. The desired input location of the data. * @param {string} request.notificationPubsubTopic * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * {@link google.longrunning.Operation|Operation}. * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. * @param {object} [options] @@ -663,7 +666,7 @@ export class CompletionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importCompletionData(request, options, callback); @@ -1190,6 +1193,68 @@ export class CompletionServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/completion_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/control_service_client.ts b/packages/google-cloud-retail/src/v2beta/control_service_client.ts index a26f22149db..603bd5bb1b4 100644 --- a/packages/google-cloud-retail/src/v2beta/control_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/control_service_client.ts @@ -196,6 +196,9 @@ export class ControlServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -489,7 +492,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createControl(request, options, callback); @@ -584,7 +587,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteControl(request, options, callback); @@ -594,7 +597,7 @@ export class ControlServiceClient { * * {@link google.cloud.retail.v2beta.Control|Control} cannot be set to a different * oneof field, if so an INVALID_ARGUMENT is returned. If the - * {@link google.cloud.retail.v2beta.Control|Control} to delete does not exist, a + * {@link google.cloud.retail.v2beta.Control|Control} to update does not exist, a * NOT_FOUND error is returned. * * @param {Object} request @@ -688,7 +691,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'control.name': request.control!.name || '', + 'control.name': request.control!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateControl(request, options, callback); @@ -699,7 +702,7 @@ export class ControlServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The resource name of the Control to delete. Format: + * Required. The resource name of the Control to get. Format: * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -774,14 +777,15 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getControl(request, options, callback); } /** - * Lists all Controls linked to this catalog. + * Lists all Controls by their parent + * {@link google.cloud.retail.v2beta.Catalog|Catalog}. * * @param {Object} request * The request object that will be sent. @@ -883,7 +887,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listControls(request, options, callback); @@ -931,7 +935,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listControls']; const callSettings = defaultCallSettings.merge(options); @@ -988,7 +992,7 @@ export class ControlServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listControls']; const callSettings = defaultCallSettings.merge(options); @@ -1486,6 +1490,68 @@ export class ControlServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/control_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json index f9c6514cba0..7bda8b31b52 100644 --- a/packages/google-cloud-retail/src/v2beta/gapic_metadata.json +++ b/packages/google-cloud-retail/src/v2beta/gapic_metadata.json @@ -55,6 +55,11 @@ "removeCatalogAttribute" ] }, + "BatchRemoveCatalogAttributes": { + "methods": [ + "batchRemoveCatalogAttributes" + ] + }, "ReplaceCatalogAttribute": { "methods": [ "replaceCatalogAttribute" @@ -117,6 +122,11 @@ "removeCatalogAttribute" ] }, + "BatchRemoveCatalogAttributes": { + "methods": [ + "batchRemoveCatalogAttributes" + ] + }, "ReplaceCatalogAttribute": { "methods": [ "replaceCatalogAttribute" @@ -235,6 +245,94 @@ } } }, + "ModelService": { + "clients": { + "grpc": { + "libraryClient": "ModelServiceClient", + "rpcs": { + "PauseModel": { + "methods": [ + "pauseModel" + ] + }, + "ResumeModel": { + "methods": [ + "resumeModel" + ] + }, + "DeleteModel": { + "methods": [ + "deleteModel" + ] + }, + "UpdateModel": { + "methods": [ + "updateModel" + ] + }, + "CreateModel": { + "methods": [ + "createModel" + ] + }, + "TuneModel": { + "methods": [ + "tuneModel" + ] + }, + "ListModels": { + "methods": [ + "listModels", + "listModelsStream", + "listModelsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ModelServiceClient", + "rpcs": { + "PauseModel": { + "methods": [ + "pauseModel" + ] + }, + "ResumeModel": { + "methods": [ + "resumeModel" + ] + }, + "DeleteModel": { + "methods": [ + "deleteModel" + ] + }, + "UpdateModel": { + "methods": [ + "updateModel" + ] + }, + "CreateModel": { + "methods": [ + "createModel" + ] + }, + "TuneModel": { + "methods": [ + "tuneModel" + ] + }, + "ListModels": { + "methods": [ + "listModels", + "listModelsStream", + "listModelsAsync" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { diff --git a/packages/google-cloud-retail/src/v2beta/index.ts b/packages/google-cloud-retail/src/v2beta/index.ts index a7e4f6ba79f..74f290ddf79 100644 --- a/packages/google-cloud-retail/src/v2beta/index.ts +++ b/packages/google-cloud-retail/src/v2beta/index.ts @@ -19,6 +19,7 @@ export {CatalogServiceClient} from './catalog_service_client'; export {CompletionServiceClient} from './completion_service_client'; export {ControlServiceClient} from './control_service_client'; +export {ModelServiceClient} from './model_service_client'; export {PredictionServiceClient} from './prediction_service_client'; export {ProductServiceClient} from './product_service_client'; export {SearchServiceClient} from './search_service_client'; diff --git a/packages/google-cloud-retail/src/v2beta/model_service_client.ts b/packages/google-cloud-retail/src/v2beta/model_service_client.ts new file mode 100644 index 00000000000..210906d3140 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/model_service_client.ts @@ -0,0 +1,1989 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/model_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './model_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for performing CRUD operations on models. + * Recommendation models contain all the metadata necessary to generate a set of + * models for the `Predict()` API. A model is queried + * indirectly via a ServingConfig, which associates a model with a + * given Placement (e.g. Frequently Bought Together on Home Page). + * + * This service allows you to do the following: + * + * * Initiate training of a model. + * * Pause training of an existing model. + * * List all the available models along with their metadata. + * * Control their tuning schedule. + * @class + * @memberof v2beta + */ +export class ModelServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + modelServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ModelServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ModelServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ModelServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + attributesConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' + ), + catalogPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}' + ), + completionConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' + ), + controlPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' + ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), + productPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' + ), + servingConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listModels: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'models' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}', + additional_bindings: [ + { + get: '/v2beta/{name=projects/*/locations/*/catalogs/*/operations/*}', + }, + {get: '/v2beta/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2beta/{name=projects/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*/catalogs/*}/operations', + additional_bindings: [ + {get: '/v2beta/{name=projects/*/locations/*}/operations'}, + {get: '/v2beta/{name=projects/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createModelResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.Model' + ) as gax.protobuf.Type; + const createModelMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.CreateModelMetadata' + ) as gax.protobuf.Type; + const tuneModelResponse = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.TuneModelResponse' + ) as gax.protobuf.Type; + const tuneModelMetadata = protoFilesRoot.lookup( + '.google.cloud.retail.v2beta.TuneModelMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createModelResponse.decode.bind(createModelResponse), + createModelMetadata.decode.bind(createModelMetadata) + ), + tuneModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + tuneModelResponse.decode.bind(tuneModelResponse), + tuneModelMetadata.decode.bind(tuneModelMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.retail.v2beta.ModelService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.modelServiceStub) { + return this.modelServiceStub; + } + + // Put together the "service stub" for + // google.cloud.retail.v2beta.ModelService. + this.modelServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.retail.v2beta.ModelService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.retail.v2beta.ModelService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const modelServiceStubMethods = [ + 'createModel', + 'pauseModel', + 'resumeModel', + 'deleteModel', + 'listModels', + 'updateModel', + 'tuneModel', + ]; + for (const methodName of modelServiceStubMethods) { + const callPromise = this.modelServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.modelServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'retail.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'retail.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Pauses the training of an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the model to pause. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Model]{@link google.cloud.retail.v2beta.Model}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.pause_model.js + * region_tag:retail_v2beta_generated_ModelService_PauseModel_async + */ + pauseModel( + request?: protos.google.cloud.retail.v2beta.IPauseModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IPauseModelRequest | undefined, + {} | undefined + ] + >; + pauseModel( + request: protos.google.cloud.retail.v2beta.IPauseModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IPauseModelRequest | null | undefined, + {} | null | undefined + > + ): void; + pauseModel( + request: protos.google.cloud.retail.v2beta.IPauseModelRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IPauseModelRequest | null | undefined, + {} | null | undefined + > + ): void; + pauseModel( + request?: protos.google.cloud.retail.v2beta.IPauseModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IModel, + | protos.google.cloud.retail.v2beta.IPauseModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IPauseModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IPauseModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.pauseModel(request, options, callback); + } + /** + * Resumes the training of an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the model to resume. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Model]{@link google.cloud.retail.v2beta.Model}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.resume_model.js + * region_tag:retail_v2beta_generated_ModelService_ResumeModel_async + */ + resumeModel( + request?: protos.google.cloud.retail.v2beta.IResumeModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IResumeModelRequest | undefined, + {} | undefined + ] + >; + resumeModel( + request: protos.google.cloud.retail.v2beta.IResumeModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IResumeModelRequest | null | undefined, + {} | null | undefined + > + ): void; + resumeModel( + request: protos.google.cloud.retail.v2beta.IResumeModelRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IResumeModelRequest | null | undefined, + {} | null | undefined + > + ): void; + resumeModel( + request?: protos.google.cloud.retail.v2beta.IResumeModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IModel, + | protos.google.cloud.retail.v2beta.IResumeModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IResumeModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IResumeModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.resumeModel(request, options, callback); + } + /** + * Deletes an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.retail.v2beta.Model|Model} to delete. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.delete_model.js + * region_tag:retail_v2beta_generated_ModelService_DeleteModel_async + */ + deleteModel( + request?: protos.google.cloud.retail.v2beta.IDeleteModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteModelRequest | undefined, + {} | undefined + ] + >; + deleteModel( + request: protos.google.cloud.retail.v2beta.IDeleteModelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteModelRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteModel( + request: protos.google.cloud.retail.v2beta.IDeleteModelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteModelRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteModel( + request?: protos.google.cloud.retail.v2beta.IDeleteModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.retail.v2beta.IDeleteModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.retail.v2beta.IDeleteModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteModel(request, options, callback); + } + /** + * Update of model metadata. Only fields that + * currently can be updated are: `filtering_option` and + * `periodic_tuning_state`. + * If other values are provided, this API method ignores them. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.retail.v2beta.Model} request.model + * Required. The body of the updated + * {@link google.cloud.retail.v2beta.Model|Model}. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Indicates which fields in the provided 'model' to + * update. If not set, by default updates all fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Model]{@link google.cloud.retail.v2beta.Model}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.update_model.js + * region_tag:retail_v2beta_generated_ModelService_UpdateModel_async + */ + updateModel( + request?: protos.google.cloud.retail.v2beta.IUpdateModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IUpdateModelRequest | undefined, + {} | undefined + ] + >; + updateModel( + request: protos.google.cloud.retail.v2beta.IUpdateModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IUpdateModelRequest | null | undefined, + {} | null | undefined + > + ): void; + updateModel( + request: protos.google.cloud.retail.v2beta.IUpdateModelRequest, + callback: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IUpdateModelRequest | null | undefined, + {} | null | undefined + > + ): void; + updateModel( + request?: protos.google.cloud.retail.v2beta.IUpdateModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.retail.v2beta.IModel, + | protos.google.cloud.retail.v2beta.IUpdateModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IUpdateModelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.IUpdateModelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'model.name': request.model!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateModel(request, options, callback); + } + + /** + * Creates a new model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource under which to create the model. Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {google.cloud.retail.v2beta.Model} request.model + * Required. The payload of the {@link google.cloud.retail.v2beta.Model|Model} to + * create. + * @param {boolean} [request.dryRun] + * Optional. Whether to run a dry run to validate the request (without + * actually creating the model). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.create_model.js + * region_tag:retail_v2beta_generated_ModelService_CreateModel_async + */ + createModel( + request?: protos.google.cloud.retail.v2beta.ICreateModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createModel( + request: protos.google.cloud.retail.v2beta.ICreateModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createModel( + request: protos.google.cloud.retail.v2beta.ICreateModelRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createModel( + request?: protos.google.cloud.retail.v2beta.ICreateModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createModel(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.create_model.js + * region_tag:retail_v2beta_generated_ModelService_CreateModel_async + */ + async checkCreateModelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.Model, + protos.google.cloud.retail.v2beta.CreateModelMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createModel, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.Model, + protos.google.cloud.retail.v2beta.CreateModelMetadata + >; + } + /** + * Tunes an existing model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the model to tune. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.tune_model.js + * region_tag:retail_v2beta_generated_ModelService_TuneModel_async + */ + tuneModel( + request?: protos.google.cloud.retail.v2beta.ITuneModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + tuneModel( + request: protos.google.cloud.retail.v2beta.ITuneModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + tuneModel( + request: protos.google.cloud.retail.v2beta.ITuneModelRequest, + callback: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + tuneModel( + request?: protos.google.cloud.retail.v2beta.ITuneModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.tuneModel(request, options, callback); + } + /** + * Check the status of the long running operation returned by `tuneModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.tune_model.js + * region_tag:retail_v2beta_generated_ModelService_TuneModel_async + */ + async checkTuneModelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.retail.v2beta.TuneModelResponse, + protos.google.cloud.retail.v2beta.TuneModelMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.tuneModel, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.retail.v2beta.TuneModelResponse, + protos.google.cloud.retail.v2beta.TuneModelMetadata + >; + } + /** + * Lists all the models linked to this event store. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for which to list models. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Model]{@link google.cloud.retail.v2beta.Model}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listModelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listModels( + request?: protos.google.cloud.retail.v2beta.IListModelsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel[], + protos.google.cloud.retail.v2beta.IListModelsRequest | null, + protos.google.cloud.retail.v2beta.IListModelsResponse + ] + >; + listModels( + request: protos.google.cloud.retail.v2beta.IListModelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListModelsRequest, + protos.google.cloud.retail.v2beta.IListModelsResponse | null | undefined, + protos.google.cloud.retail.v2beta.IModel + > + ): void; + listModels( + request: protos.google.cloud.retail.v2beta.IListModelsRequest, + callback: PaginationCallback< + protos.google.cloud.retail.v2beta.IListModelsRequest, + protos.google.cloud.retail.v2beta.IListModelsResponse | null | undefined, + protos.google.cloud.retail.v2beta.IModel + > + ): void; + listModels( + request?: protos.google.cloud.retail.v2beta.IListModelsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.retail.v2beta.IListModelsRequest, + | protos.google.cloud.retail.v2beta.IListModelsResponse + | null + | undefined, + protos.google.cloud.retail.v2beta.IModel + >, + callback?: PaginationCallback< + protos.google.cloud.retail.v2beta.IListModelsRequest, + protos.google.cloud.retail.v2beta.IListModelsResponse | null | undefined, + protos.google.cloud.retail.v2beta.IModel + > + ): Promise< + [ + protos.google.cloud.retail.v2beta.IModel[], + protos.google.cloud.retail.v2beta.IListModelsRequest | null, + protos.google.cloud.retail.v2beta.IListModelsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listModels(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for which to list models. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Model]{@link google.cloud.retail.v2beta.Model} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listModelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listModelsStream( + request?: protos.google.cloud.retail.v2beta.IListModelsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listModels.createStream( + this.innerApiCalls.listModels as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listModels`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent for which to list models. + * Format: + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + * @param {number} [request.pageSize] + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListModels` + * call. Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Model]{@link google.cloud.retail.v2beta.Model}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2beta/model_service.list_models.js + * region_tag:retail_v2beta_generated_ModelService_ListModels_async + */ + listModelsAsync( + request?: protos.google.cloud.retail.v2beta.IListModelsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listModels.asyncIterate( + this.innerApiCalls['listModels'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified attributesConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + attributesConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.attributesConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).project; + } + + /** + * Parse the location from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).location; + } + + /** + * Parse the catalog from AttributesConfig resource. + * + * @param {string} attributesConfigName + * A fully-qualified path representing AttributesConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromAttributesConfigName(attributesConfigName: string) { + return this.pathTemplates.attributesConfigPathTemplate.match( + attributesConfigName + ).catalog; + } + + /** + * Return a fully-qualified catalog resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + catalogPath(project: string, location: string, catalog: string) { + return this.pathTemplates.catalogPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).project; + } + + /** + * Parse the location from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).location; + } + + /** + * Parse the catalog from Catalog resource. + * + * @param {string} catalogName + * A fully-qualified path representing Catalog resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCatalogName(catalogName: string) { + return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; + } + + /** + * Return a fully-qualified completionConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @returns {string} Resource name string. + */ + completionConfigPath(project: string, location: string, catalog: string) { + return this.pathTemplates.completionConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + }); + } + + /** + * Parse the project from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).project; + } + + /** + * Parse the location from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).location; + } + + /** + * Parse the catalog from CompletionConfig resource. + * + * @param {string} completionConfigName + * A fully-qualified path representing CompletionConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromCompletionConfigName(completionConfigName: string) { + return this.pathTemplates.completionConfigPathTemplate.match( + completionConfigName + ).catalog; + } + + /** + * Return a fully-qualified control resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} control + * @returns {string} Resource name string. + */ + controlPath( + project: string, + location: string, + catalog: string, + control: string + ) { + return this.pathTemplates.controlPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + control: control, + }); + } + + /** + * Parse the project from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the project. + */ + matchProjectFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).project; + } + + /** + * Parse the location from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the location. + */ + matchLocationFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).location; + } + + /** + * Parse the catalog from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).catalog; + } + + /** + * Parse the control from Control resource. + * + * @param {string} controlName + * A fully-qualified path representing Control resource. + * @returns {string} A string representing the control. + */ + matchControlFromControlName(controlName: string) { + return this.pathTemplates.controlPathTemplate.match(controlName).control; + } + + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} branch + * @param {string} product + * @returns {string} Resource name string. + */ + productPath( + project: string, + location: string, + catalog: string, + branch: string, + product: string + ) { + return this.pathTemplates.productPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + branch: branch, + product: product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the catalog from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).catalog; + } + + /** + * Parse the branch from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the branch. + */ + matchBranchFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).branch; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this.pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified servingConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} serving_config + * @returns {string} Resource name string. + */ + servingConfigPath( + project: string, + location: string, + catalog: string, + servingConfig: string + ) { + return this.pathTemplates.servingConfigPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + serving_config: servingConfig, + }); + } + + /** + * Parse the project from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .project; + } + + /** + * Parse the location from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .location; + } + + /** + * Parse the catalog from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .catalog; + } + + /** + * Parse the serving_config from ServingConfig resource. + * + * @param {string} servingConfigName + * A fully-qualified path representing ServingConfig resource. + * @returns {string} A string representing the serving_config. + */ + matchServingConfigFromServingConfigName(servingConfigName: string) { + return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName) + .serving_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.modelServiceStub && !this._terminated) { + return this.modelServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-retail/src/v2beta/model_service_client_config.json b/packages/google-cloud-retail/src/v2beta/model_service_client_config.json new file mode 100644 index 00000000000..7b1e02dc61d --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/model_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.retail.v2beta.ModelService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateModel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PauseModel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResumeModel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteModel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListModels": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateModel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TuneModel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-retail/src/v2beta/model_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/model_service_proto_list.json new file mode 100644 index 00000000000..ce2a33ebd29 --- /dev/null +++ b/packages/google-cloud-retail/src/v2beta/model_service_proto_list.json @@ -0,0 +1,22 @@ +[ + "../../protos/google/cloud/retail/v2beta/catalog.proto", + "../../protos/google/cloud/retail/v2beta/catalog_service.proto", + "../../protos/google/cloud/retail/v2beta/common.proto", + "../../protos/google/cloud/retail/v2beta/completion_service.proto", + "../../protos/google/cloud/retail/v2beta/control.proto", + "../../protos/google/cloud/retail/v2beta/control_service.proto", + "../../protos/google/cloud/retail/v2beta/export_config.proto", + "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", + "../../protos/google/cloud/retail/v2beta/prediction_service.proto", + "../../protos/google/cloud/retail/v2beta/product.proto", + "../../protos/google/cloud/retail/v2beta/product_service.proto", + "../../protos/google/cloud/retail/v2beta/promotion.proto", + "../../protos/google/cloud/retail/v2beta/purge_config.proto", + "../../protos/google/cloud/retail/v2beta/search_service.proto", + "../../protos/google/cloud/retail/v2beta/serving_config.proto", + "../../protos/google/cloud/retail/v2beta/serving_config_service.proto", + "../../protos/google/cloud/retail/v2beta/user_event.proto", + "../../protos/google/cloud/retail/v2beta/user_event_service.proto" +] diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts index d45e499080a..c2ad7f54fe2 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_client.ts @@ -194,6 +194,9 @@ export class PredictionServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -408,12 +411,12 @@ export class PredictionServiceClient { * a random unique ID and leave * {@link google.cloud.retail.v2beta.UserInfo.user_id|UserInfo.user_id} unset. * @param {number} request.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. + * Maximum number of results to return. 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. * @param {string} request.pageToken - * This field is not used for now; leave it unset. + * This field is not used; leave it unset. * @param {string} request.filter * Filter for restricting prediction results with a length limit of 5,000 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. @@ -574,7 +577,7 @@ export class PredictionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); this.initialize(); return this.innerApiCalls.predict(request, options, callback); @@ -1067,6 +1070,68 @@ export class PredictionServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/prediction_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/product_service_client.ts b/packages/google-cloud-retail/src/v2beta/product_service_client.ts index 592f19c4059..2ac7ca4c4df 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/product_service_client.ts @@ -201,6 +201,9 @@ export class ProductServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -585,7 +588,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createProduct(request, options, callback); @@ -679,7 +682,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getProduct(request, options, callback); @@ -796,7 +799,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name || '', + 'product.name': request.product!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateProduct(request, options, callback); @@ -908,7 +911,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteProduct(request, options, callback); @@ -938,29 +941,24 @@ export class ProductServiceClient { * @param {google.cloud.retail.v2beta.ImportErrorsConfig} request.errorsConfig * The desired location of errors incurred during the Import. * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided imported 'products' to update. If - * not set, will by default update all fields. + * Indicates which fields in the provided imported `products` to update. If + * not set, all fields are updated. * @param {google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode} request.reconciliationMode * The mode of reconciliation between existing products and the products to be * imported. Defaults to * {@link google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification will be sent to - * specified Pub/Sub topic. The message data will be JSON string of a + * when the import is finished, a notification is sent to + * specified Pub/Sub topic. The message data is JSON string of a * {@link google.longrunning.Operation|Operation}. * * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has * to be within the same project as * {@link google.cloud.retail.v2beta.ImportProductsRequest.parent|ImportProductsRequest.parent}. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * - * Only supported when - * {@link google.cloud.retail.v2beta.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. + * Make sure that `service-@gcp-sa-retail.iam.gserviceaccount.com` has the + * `pubsub.topics.publish` IAM permission on the topic. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1052,7 +1050,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importProducts(request, options, callback); @@ -1099,9 +1097,9 @@ export class ProductServiceClient { * * This process is asynchronous and does not require the * {@link google.cloud.retail.v2beta.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, updates are not immediately manifested in the + * fulfillment information. If the request is valid, the update is enqueued + * and processed downstream. As a consequence, when a response is returned, + * updates are not immediately manifested in the * {@link google.cloud.retail.v2beta.Product|Product} queried by * {@link google.cloud.retail.v2beta.ProductService.GetProduct|ProductService.GetProduct} * or @@ -1111,10 +1109,10 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|ProductService.CreateProduct} * and * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct}, - * the specified inventory field value(s) will overwrite any existing value(s) + * the specified inventory field value(s) overwrite any existing value(s) * while ignoring the last update time for this field. Furthermore, the last - * update time for the specified inventory fields will be overwritten to the - * time of the + * update times for the specified inventory fields are overwritten by the + * times of the * {@link google.cloud.retail.v2beta.ProductService.CreateProduct|ProductService.CreateProduct} * or * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} @@ -1122,11 +1120,11 @@ export class ProductServiceClient { * * If no inventory fields are set in * {@link google.cloud.retail.v2beta.CreateProductRequest.product|CreateProductRequest.product}, - * then any pre-existing inventory information for this product will be used. + * then any pre-existing inventory information for this product is used. * * If no inventory fields are set in * {@link google.cloud.retail.v2beta.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, - * then any existing inventory information will be preserved. + * then any existing inventory information is preserved. * * Pre-existing inventory information can only be updated with * {@link google.cloud.retail.v2beta.ProductService.SetInventory|ProductService.SetInventory}, @@ -1134,8 +1132,17 @@ export class ProductServiceClient { * and * {@link google.cloud.retail.v2beta.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. * + * The returned {@link google.longrunning.Operation|Operation}s is obsolete after + * one day, and the {@link google.longrunning.Operations.GetOperation|GetOperation} + * API returns `NOT_FOUND` afterwards. + * + * If conflicting updates are issued, the + * {@link google.longrunning.Operation|Operation}s associated with the stale + * updates are not marked as {@link google.longrunning.Operation.done|done} until + * they are obsolete. + * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1308,7 +1315,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'inventory.name': request.inventory!.name || '', + 'inventory.name': request.inventory!.name ?? '', }); this.initialize(); return this.innerApiCalls.setInventory(request, options, callback); @@ -1362,8 +1369,17 @@ export class ProductServiceClient { * or * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * + * The returned {@link google.longrunning.Operation|Operation}s will be obsolete + * after 1 day, and {@link google.longrunning.Operations.GetOperation|GetOperation} + * API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the + * {@link google.longrunning.Operation|Operation}s associated with the stale + * updates will not be marked as {@link google.longrunning.Operation.done|done} + * until being obsolete. + * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1514,7 +1530,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.addFulfillmentPlaces(request, options, callback); @@ -1568,8 +1584,17 @@ export class ProductServiceClient { * or * {@link google.cloud.retail.v2beta.ProductService.ListProducts|ProductService.ListProducts}. * + * The returned {@link google.longrunning.Operation|Operation}s will be obsolete + * after 1 day, and {@link google.longrunning.Operations.GetOperation|GetOperation} + * API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the + * {@link google.longrunning.Operation|Operation}s associated with the stale + * updates will not be marked as {@link google.longrunning.Operation.done|done} + * until being obsolete. + * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1715,7 +1740,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.removeFulfillmentPlaces( @@ -1780,8 +1805,17 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * + * The returned {@link google.longrunning.Operation|Operation}s will be obsolete + * after 1 day, and {@link google.longrunning.Operations.GetOperation|GetOperation} + * API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the + * {@link google.longrunning.Operation|Operation}s associated with the stale + * updates will not be marked as {@link google.longrunning.Operation.done|done} + * until being obsolete. + * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -1915,7 +1949,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.addLocalInventories(request, options, callback); @@ -1974,8 +2008,17 @@ export class ProductServiceClient { * {@link google.cloud.retail.v2beta.ProductService.UpdateProduct|ProductService.UpdateProduct} * has no effect on local inventories. * + * The returned {@link google.longrunning.Operation|Operation}s will be obsolete + * after 1 day, and {@link google.longrunning.Operations.GetOperation|GetOperation} + * API will return NOT_FOUND afterwards. + * + * If conflicting updates are issued, the + * {@link google.longrunning.Operation|Operation}s associated with the stale + * updates will not be marked as {@link google.longrunning.Operation.done|done} + * until being obsolete. + * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -2092,7 +2135,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - product: request.product || '', + product: request.product ?? '', }); this.initialize(); return this.innerApiCalls.removeLocalInventories( @@ -2298,7 +2341,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listProducts(request, options, callback); @@ -2405,7 +2448,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); @@ -2521,7 +2564,7 @@ export class ProductServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listProducts']; const callSettings = defaultCallSettings.merge(options); @@ -3086,6 +3129,68 @@ export class ProductServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/product_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/search_service_client.ts b/packages/google-cloud-retail/src/v2beta/search_service_client.ts index ed36ffabda0..ea996eaeafc 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/search_service_client.ts @@ -44,7 +44,7 @@ const version = require('../../../package.json').version; * Service for search. * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * @class * @memberof v2beta */ @@ -202,6 +202,9 @@ export class SearchServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -396,7 +399,7 @@ export class SearchServiceClient { * Performs a search. * * This feature is only available for users who have Retail Search enabled. - * Please enable Retail Search on Cloud Console before using this feature. + * Enable Retail Search on Cloud Console before using this feature. * * @param {Object} request * The request object that will be sent. @@ -590,7 +593,7 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.UserEvent.page_categories|UserEvent.page_categories}; * * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, please replace it with + * hierarchies. If '>' is part of the category name, replace it with * other character(s). * * Category pages include special pages such as sales or promotions. For @@ -601,6 +604,15 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * + * Notice that if both + * {@link google.cloud.retail.v2beta.ServingConfig.personalization_spec|ServingConfig.personalization_spec} + * and + * {@link google.cloud.retail.v2beta.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * are set. + * {@link google.cloud.retail.v2beta.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * will override + * {@link google.cloud.retail.v2beta.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -696,7 +708,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); this.initialize(); return this.innerApiCalls.search(request, options, callback); @@ -896,7 +908,7 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.UserEvent.page_categories|UserEvent.page_categories}; * * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, please replace it with + * hierarchies. If '>' is part of the category name, replace it with * other character(s). * * Category pages include special pages such as sales or promotions. For @@ -907,6 +919,15 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * + * Notice that if both + * {@link google.cloud.retail.v2beta.ServingConfig.personalization_spec|ServingConfig.personalization_spec} + * and + * {@link google.cloud.retail.v2beta.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * are set. + * {@link google.cloud.retail.v2beta.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * will override + * {@link google.cloud.retail.v2beta.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -950,7 +971,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); @@ -1158,7 +1179,7 @@ export class SearchServiceClient { * {@link google.cloud.retail.v2beta.UserEvent.page_categories|UserEvent.page_categories}; * * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, please replace it with + * hierarchies. If '>' is part of the category name, replace it with * other character(s). * * Category pages include special pages such as sales or promotions. For @@ -1169,6 +1190,15 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * + * Notice that if both + * {@link google.cloud.retail.v2beta.ServingConfig.personalization_spec|ServingConfig.personalization_spec} + * and + * {@link google.cloud.retail.v2beta.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * are set. + * {@link google.cloud.retail.v2beta.SearchRequest.personalization_spec|SearchRequest.personalization_spec} + * will override + * {@link google.cloud.retail.v2beta.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. * @param {number[]} request.labels * The labels applied to a resource must meet the following requirements: * @@ -1213,7 +1243,7 @@ export class SearchServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - placement: request.placement || '', + placement: request.placement ?? '', }); const defaultCallSettings = this._defaults['search']; const callSettings = defaultCallSettings.merge(options); @@ -1778,6 +1808,68 @@ export class SearchServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/search_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts index 8d20a942ccd..144ddd5906e 100644 --- a/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_client.ts @@ -196,6 +196,9 @@ export class ServingConfigServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -492,7 +495,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createServingConfig(request, options, callback); @@ -506,7 +509,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the ServingConfig to delete. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -586,7 +589,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteServingConfig(request, options, callback); @@ -685,7 +688,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'serving_config.name': request.servingConfig!.name || '', + 'serving_config.name': request.servingConfig!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateServingConfig(request, options, callback); @@ -699,7 +702,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name of the ServingConfig to get. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -779,7 +782,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getServingConfig(request, options, callback); @@ -797,7 +800,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.servingConfig * Required. The source ServingConfig resource name . Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` * @param {string} request.controlId * Required. The id of the control to apply. Assumed to be in the same catalog * as the serving config - if id is not found a NOT_FOUND error is returned. @@ -874,7 +877,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - serving_config: request.servingConfig || '', + serving_config: request.servingConfig ?? '', }); this.initialize(); return this.innerApiCalls.addControl(request, options, callback); @@ -889,7 +892,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.servingConfig * Required. The source ServingConfig resource name . Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` * @param {string} request.controlId * Required. The id of the control to apply. Assumed to be in the same catalog * as the serving config. @@ -972,7 +975,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - serving_config: request.servingConfig || '', + serving_config: request.servingConfig ?? '', }); this.initialize(); return this.innerApiCalls.removeControl(request, options, callback); @@ -985,7 +988,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 100. If a value greater than 100 is provided, at most 100 results are @@ -1075,7 +1078,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listServingConfigs(request, options, callback); @@ -1087,7 +1090,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 100. If a value greater than 100 is provided, at most 100 results are @@ -1117,7 +1120,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listServingConfigs']; const callSettings = defaultCallSettings.merge(options); @@ -1137,7 +1140,7 @@ export class ServingConfigServiceClient { * The request object that will be sent. * @param {string} request.parent * Required. The catalog resource name. Format: - * projects/{project_number}/locations/{location_id}/catalogs/{catalog_id} + * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` * @param {number} [request.pageSize] * Optional. Maximum number of results to return. If unspecified, defaults * to 100. If a value greater than 100 is provided, at most 100 results are @@ -1168,7 +1171,7 @@ export class ServingConfigServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listServingConfigs']; const callSettings = defaultCallSettings.merge(options); @@ -1666,6 +1669,68 @@ export class ServingConfigServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/serving_config_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts index 9f5ae621eb6..994a7f011f8 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_client.ts @@ -195,6 +195,9 @@ export class UserEventServiceClient { controlPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' ), + modelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' + ), productPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' ), @@ -502,7 +505,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.writeUserEvent(request, options, callback); @@ -610,7 +613,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.collectUserEvent(request, options, callback); @@ -748,7 +751,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.purgeUserEvents(request, options, callback); @@ -793,9 +796,9 @@ export class UserEventServiceClient { * 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 + * `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. + * `Operation.metadata` is of type `ImportMetadata`. * * @param {Object} request * The request object that will be sent. @@ -897,7 +900,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.importUserEvents(request, options, callback); @@ -938,14 +941,14 @@ export class UserEventServiceClient { >; } /** - * Starts 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 method can be used to start a join operation on specified - * events with latest version of product catalog. It can also be used to - * correct events joined with the wrong product catalog. A rejoin operation - * can take hours or days to complete. + * Starts a user-event rejoin operation with latest product catalog. Events + * are not annotated with detailed product information for products that are + * missing from the catalog when the user event is ingested. These + * events are stored as unjoined events with limited usage on training and + * serving. You can use this method to start a join operation on specified + * events with the latest version of product catalog. You can also use this + * method to correct events joined with the wrong product catalog. A rejoin + * operation can take hours or days to complete. * * @param {Object} request * The request object that will be sent. @@ -955,8 +958,8 @@ export class UserEventServiceClient { * @param {google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope} request.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. + * `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to + * an invalid integer value. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1048,7 +1051,7 @@ export class UserEventServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.rejoinUserEvents(request, options, callback); @@ -1575,6 +1578,68 @@ export class UserEventServiceClient { return this.pathTemplates.controlPathTemplate.match(controlName).control; } + /** + * Return a fully-qualified model resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} catalog + * @param {string} model + * @returns {string} Resource name string. + */ + modelPath(project: string, location: string, catalog: string, model: string) { + return this.pathTemplates.modelPathTemplate.render({ + project: project, + location: location, + catalog: catalog, + model: model, + }); + } + + /** + * Parse the project from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).project; + } + + /** + * Parse the location from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).location; + } + + /** + * Parse the catalog from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the catalog. + */ + matchCatalogFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).catalog; + } + + /** + * Parse the model from Model resource. + * + * @param {string} modelName + * A fully-qualified path representing Model resource. + * @returns {string} A string representing the model. + */ + matchModelFromModelName(modelName: string) { + return this.pathTemplates.modelPathTemplate.match(modelName).model; + } + /** * Return a fully-qualified product resource name string. * diff --git a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json index 7cee73e6f3f..ce2a33ebd29 100644 --- a/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json +++ b/packages/google-cloud-retail/src/v2beta/user_event_service_proto_list.json @@ -7,6 +7,8 @@ "../../protos/google/cloud/retail/v2beta/control_service.proto", "../../protos/google/cloud/retail/v2beta/export_config.proto", "../../protos/google/cloud/retail/v2beta/import_config.proto", + "../../protos/google/cloud/retail/v2beta/model.proto", + "../../protos/google/cloud/retail/v2beta/model_service.proto", "../../protos/google/cloud/retail/v2beta/prediction_service.proto", "../../protos/google/cloud/retail/v2beta/product.proto", "../../protos/google/cloud/retail/v2beta/product_service.proto", diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js index 2416074dc50..e08fd320370 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.js @@ -23,6 +23,7 @@ function main() { const catalogServiceClient = new retail.CatalogServiceClient(); const completionServiceClient = new retail.CompletionServiceClient(); const controlServiceClient = new retail.ControlServiceClient(); + const modelServiceClient = new retail.ModelServiceClient(); const predictionServiceClient = new retail.PredictionServiceClient(); const productServiceClient = new retail.ProductServiceClient(); const searchServiceClient = new retail.SearchServiceClient(); diff --git a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts index d913e8282d1..0d91f723442 100644 --- a/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-retail/system-test/fixtures/sample/src/index.ts @@ -20,6 +20,7 @@ import { CatalogServiceClient, CompletionServiceClient, ControlServiceClient, + ModelServiceClient, PredictionServiceClient, ProductServiceClient, SearchServiceClient, @@ -37,6 +38,9 @@ function doStuffWithCompletionServiceClient(client: CompletionServiceClient) { function doStuffWithControlServiceClient(client: ControlServiceClient) { client.close(); } +function doStuffWithModelServiceClient(client: ModelServiceClient) { + client.close(); +} function doStuffWithPredictionServiceClient(client: PredictionServiceClient) { client.close(); } @@ -66,6 +70,9 @@ function main() { const controlServiceClient = new ControlServiceClient(); doStuffWithControlServiceClient(controlServiceClient); // check that the client instance can be created + const modelServiceClient = new ModelServiceClient(); + doStuffWithModelServiceClient(modelServiceClient); + // check that the client instance can be created const predictionServiceClient = new PredictionServiceClient(); doStuffWithPredictionServiceClient(predictionServiceClient); // check that the client instance can be created diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index b803c83b7f8..5a68219dcb1 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,27 +237,27 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Catalog() ); client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); const [response] = await client.updateCatalog(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog without error using callback', async () => { @@ -254,16 +269,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Catalog() ); @@ -286,11 +298,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog with error', async () => { @@ -302,27 +317,27 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCatalog = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateCatalog(request), expectedError); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog with closed client', async () => { @@ -334,8 +349,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateCatalog(request), expectedError); @@ -352,26 +371,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); const [response] = await client.setDefaultBranch(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch without error using callback', async () => { @@ -383,15 +401,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -414,11 +428,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch with error', async () => { @@ -430,26 +447,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultBranch = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.setDefaultBranch(request), expectedError); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch with closed client', async () => { @@ -461,7 +477,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setDefaultBranch(request), expectedError); @@ -478,26 +497,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchResponse() ); client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); const [response] = await client.getDefaultBranch(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch without error using callback', async () => { @@ -509,15 +527,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchResponse() ); @@ -540,11 +554,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch with error', async () => { @@ -556,26 +573,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getDefaultBranch = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getDefaultBranch(request), expectedError); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch with closed client', async () => { @@ -587,7 +603,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getDefaultBranch(request), expectedError); @@ -604,15 +623,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.CompletionConfig() ); @@ -620,11 +635,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getCompletionConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig without error using callback', async () => { @@ -636,15 +654,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.CompletionConfig() ); @@ -667,11 +681,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig with error', async () => { @@ -683,26 +700,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getCompletionConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getCompletionConfig(request), expectedError); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig with closed client', async () => { @@ -714,7 +730,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getCompletionConfig(request), expectedError); @@ -731,16 +750,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.CompletionConfig() ); @@ -748,11 +764,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateCompletionConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig without error using callback', async () => { @@ -764,16 +783,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.CompletionConfig() ); @@ -796,11 +812,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig with error', async () => { @@ -812,16 +831,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCompletionConfig = stubSimpleCall( undefined, @@ -831,11 +847,14 @@ describe('v2.CatalogServiceClient', () => { client.updateCompletionConfig(request), expectedError ); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig with closed client', async () => { @@ -847,8 +866,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -868,15 +891,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -884,11 +903,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getAttributesConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig without error using callback', async () => { @@ -900,15 +922,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -931,11 +949,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig with error', async () => { @@ -947,26 +968,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getAttributesConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getAttributesConfig(request), expectedError); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig with closed client', async () => { @@ -978,7 +998,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getAttributesConfig(request), expectedError); @@ -995,16 +1018,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1012,11 +1032,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateAttributesConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig without error using callback', async () => { @@ -1028,16 +1051,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1060,11 +1080,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig with error', async () => { @@ -1076,16 +1099,13 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateAttributesConfig = stubSimpleCall( undefined, @@ -1095,11 +1115,14 @@ describe('v2.CatalogServiceClient', () => { client.updateAttributesConfig(request), expectedError ); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig with closed client', async () => { @@ -1111,8 +1134,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1132,15 +1159,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1148,11 +1171,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.addCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addCatalogAttribute without error using callback', async () => { @@ -1164,15 +1190,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1195,11 +1217,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addCatalogAttribute with error', async () => { @@ -1211,26 +1236,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addCatalogAttribute = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.addCatalogAttribute(request), expectedError); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addCatalogAttribute with closed client', async () => { @@ -1242,7 +1266,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.addCatalogAttribute(request), expectedError); @@ -1259,15 +1286,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1275,11 +1299,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.removeCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeCatalogAttribute without error using callback', async () => { @@ -1291,15 +1318,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1322,11 +1346,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeCatalogAttribute with error', async () => { @@ -1338,15 +1365,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( undefined, @@ -1356,11 +1380,14 @@ describe('v2.CatalogServiceClient', () => { client.removeCatalogAttribute(request), expectedError ); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeCatalogAttribute with closed client', async () => { @@ -1372,7 +1399,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1392,15 +1423,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1408,11 +1436,14 @@ describe('v2.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.replaceCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute without error using callback', async () => { @@ -1424,15 +1455,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.AttributesConfig() ); @@ -1455,11 +1483,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute with error', async () => { @@ -1471,15 +1502,12 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall( undefined, @@ -1489,11 +1517,14 @@ describe('v2.CatalogServiceClient', () => { client.replaceCatalogAttribute(request), expectedError ); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute with closed client', async () => { @@ -1505,7 +1536,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1525,15 +1560,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), @@ -1542,11 +1573,14 @@ describe('v2.CatalogServiceClient', () => { client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); const [response] = await client.listCatalogs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogs without error using callback', async () => { @@ -1558,15 +1592,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), @@ -1591,11 +1621,14 @@ describe('v2.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogs with error', async () => { @@ -1607,26 +1640,25 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listCatalogs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listCatalogs(request), expectedError); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogsStream without error', async () => { @@ -1638,8 +1670,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), @@ -1667,11 +1702,12 @@ describe('v2.CatalogServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listCatalogs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1684,8 +1720,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( undefined, @@ -1710,11 +1749,12 @@ describe('v2.CatalogServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listCatalogs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1727,8 +1767,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2.Catalog()), @@ -1748,11 +1791,12 @@ describe('v2.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1765,8 +1809,11 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1783,11 +1830,12 @@ describe('v2.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1938,12 +1986,15 @@ describe('v2.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1974,12 +2025,15 @@ describe('v2.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index de93c616425..771d2cfef7c 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,27 +237,27 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Catalog() ); client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); const [response] = await client.updateCatalog(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog without error using callback', async () => { @@ -254,16 +269,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Catalog() ); @@ -286,11 +298,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog with error', async () => { @@ -302,27 +317,27 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCatalog = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateCatalog(request), expectedError); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog with closed client', async () => { @@ -334,8 +349,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateCatalog(request), expectedError); @@ -352,26 +371,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); const [response] = await client.setDefaultBranch(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch without error using callback', async () => { @@ -383,15 +401,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -414,11 +428,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch with error', async () => { @@ -430,26 +447,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultBranch = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.setDefaultBranch(request), expectedError); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch with closed client', async () => { @@ -461,7 +477,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setDefaultBranch(request), expectedError); @@ -478,26 +497,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() ); client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); const [response] = await client.getDefaultBranch(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch without error using callback', async () => { @@ -509,15 +527,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() ); @@ -540,11 +554,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch with error', async () => { @@ -556,26 +573,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getDefaultBranch = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getDefaultBranch(request), expectedError); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch with closed client', async () => { @@ -587,7 +603,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getDefaultBranch(request), expectedError); @@ -604,15 +623,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompletionConfig() ); @@ -620,11 +635,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getCompletionConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig without error using callback', async () => { @@ -636,15 +654,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompletionConfig() ); @@ -667,11 +681,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig with error', async () => { @@ -683,26 +700,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getCompletionConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getCompletionConfig(request), expectedError); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig with closed client', async () => { @@ -714,7 +730,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getCompletionConfig(request), expectedError); @@ -731,16 +750,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompletionConfig() ); @@ -748,11 +764,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateCompletionConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig without error using callback', async () => { @@ -764,16 +783,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompletionConfig() ); @@ -796,11 +812,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig with error', async () => { @@ -812,16 +831,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCompletionConfig = stubSimpleCall( undefined, @@ -831,11 +847,14 @@ describe('v2alpha.CatalogServiceClient', () => { client.updateCompletionConfig(request), expectedError ); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig with closed client', async () => { @@ -847,8 +866,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -868,15 +891,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -884,11 +903,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getAttributesConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig without error using callback', async () => { @@ -900,15 +922,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -931,11 +949,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig with error', async () => { @@ -947,26 +968,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getAttributesConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getAttributesConfig(request), expectedError); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig with closed client', async () => { @@ -978,7 +998,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getAttributesConfig(request), expectedError); @@ -995,16 +1018,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1012,11 +1032,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateAttributesConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig without error using callback', async () => { @@ -1028,16 +1051,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1060,11 +1080,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig with error', async () => { @@ -1076,16 +1099,13 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateAttributesConfig = stubSimpleCall( undefined, @@ -1095,11 +1115,14 @@ describe('v2alpha.CatalogServiceClient', () => { client.updateAttributesConfig(request), expectedError ); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig with closed client', async () => { @@ -1111,8 +1134,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1132,15 +1159,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1148,11 +1171,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.addCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addCatalogAttribute without error using callback', async () => { @@ -1164,15 +1190,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1195,11 +1217,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addCatalogAttribute with error', async () => { @@ -1211,26 +1236,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addCatalogAttribute = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.addCatalogAttribute(request), expectedError); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addCatalogAttribute with closed client', async () => { @@ -1242,7 +1266,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.addCatalogAttribute(request), expectedError); @@ -1259,15 +1286,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1275,11 +1299,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.removeCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeCatalogAttribute without error using callback', async () => { @@ -1291,15 +1318,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1322,11 +1346,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeCatalogAttribute with error', async () => { @@ -1338,15 +1365,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( undefined, @@ -1356,11 +1380,14 @@ describe('v2alpha.CatalogServiceClient', () => { client.removeCatalogAttribute(request), expectedError ); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeCatalogAttribute with closed client', async () => { @@ -1372,7 +1399,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1392,15 +1423,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1408,11 +1436,14 @@ describe('v2alpha.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.replaceCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute without error using callback', async () => { @@ -1424,15 +1455,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AttributesConfig() ); @@ -1455,11 +1483,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute with error', async () => { @@ -1471,15 +1502,12 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall( undefined, @@ -1489,11 +1517,14 @@ describe('v2alpha.CatalogServiceClient', () => { client.replaceCatalogAttribute(request), expectedError ); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute with closed client', async () => { @@ -1505,7 +1536,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1525,15 +1560,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), @@ -1542,11 +1573,14 @@ describe('v2alpha.CatalogServiceClient', () => { client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); const [response] = await client.listCatalogs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogs without error using callback', async () => { @@ -1558,15 +1592,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), @@ -1591,11 +1621,14 @@ describe('v2alpha.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogs with error', async () => { @@ -1607,26 +1640,25 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listCatalogs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listCatalogs(request), expectedError); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogsStream without error', async () => { @@ -1638,8 +1670,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), @@ -1670,11 +1705,12 @@ describe('v2alpha.CatalogServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listCatalogs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1687,8 +1723,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( undefined, @@ -1716,11 +1755,12 @@ describe('v2alpha.CatalogServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listCatalogs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1733,8 +1773,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), @@ -1754,11 +1797,12 @@ describe('v2alpha.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1771,8 +1815,11 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1789,11 +1836,12 @@ describe('v2alpha.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1944,12 +1992,15 @@ describe('v2alpha.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1980,12 +2031,15 @@ describe('v2alpha.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 9d58e8ec64c..02445c1f3fd 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,27 +237,27 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Catalog() ); client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); const [response] = await client.updateCatalog(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog without error using callback', async () => { @@ -254,16 +269,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Catalog() ); @@ -286,11 +298,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog with error', async () => { @@ -302,27 +317,27 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; - const expectedHeaderRequestParams = 'catalog.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; + const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCatalog = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateCatalog(request), expectedError); - assert( - (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCatalog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCatalog with closed client', async () => { @@ -334,8 +349,12 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); - request.catalog = {}; - request.catalog.name = ''; + request.catalog ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ + 'catalog', + 'name', + ]); + request.catalog.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateCatalog(request), expectedError); @@ -352,26 +371,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); const [response] = await client.setDefaultBranch(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch without error using callback', async () => { @@ -383,15 +401,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -414,11 +428,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch with error', async () => { @@ -430,26 +447,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setDefaultBranch = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.setDefaultBranch(request), expectedError); - assert( - (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setDefaultBranch with closed client', async () => { @@ -461,7 +477,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setDefaultBranch(request), expectedError); @@ -478,26 +497,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchResponse() ); client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); const [response] = await client.getDefaultBranch(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch without error using callback', async () => { @@ -509,15 +527,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchResponse() ); @@ -540,11 +554,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch with error', async () => { @@ -556,26 +573,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getDefaultBranch = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getDefaultBranch(request), expectedError); - assert( - (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDefaultBranch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getDefaultBranch with closed client', async () => { @@ -587,7 +603,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getDefaultBranch(request), expectedError); @@ -604,15 +623,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompletionConfig() ); @@ -620,11 +635,14 @@ describe('v2beta.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getCompletionConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig without error using callback', async () => { @@ -636,15 +654,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompletionConfig() ); @@ -667,11 +681,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig with error', async () => { @@ -683,26 +700,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getCompletionConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getCompletionConfig(request), expectedError); - assert( - (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getCompletionConfig with closed client', async () => { @@ -714,7 +730,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getCompletionConfig(request), expectedError); @@ -731,16 +750,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompletionConfig() ); @@ -748,11 +764,14 @@ describe('v2beta.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateCompletionConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig without error using callback', async () => { @@ -764,16 +783,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompletionConfig() ); @@ -796,11 +812,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig with error', async () => { @@ -812,16 +831,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; - const expectedHeaderRequestParams = 'completion_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; + const expectedHeaderRequestParams = `completion_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateCompletionConfig = stubSimpleCall( undefined, @@ -831,11 +847,14 @@ describe('v2beta.CatalogServiceClient', () => { client.updateCompletionConfig(request), expectedError ); - assert( - (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCompletionConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateCompletionConfig with closed client', async () => { @@ -847,8 +866,12 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateCompletionConfigRequest() ); - request.completionConfig = {}; - request.completionConfig.name = ''; + request.completionConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateCompletionConfigRequest', + ['completionConfig', 'name'] + ); + request.completionConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -868,15 +891,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -884,11 +903,14 @@ describe('v2beta.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getAttributesConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig without error using callback', async () => { @@ -900,15 +922,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -931,11 +949,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig with error', async () => { @@ -947,26 +968,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getAttributesConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getAttributesConfig(request), expectedError); - assert( - (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getAttributesConfig with closed client', async () => { @@ -978,7 +998,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getAttributesConfig(request), expectedError); @@ -995,16 +1018,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -1012,11 +1032,14 @@ describe('v2beta.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateAttributesConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig without error using callback', async () => { @@ -1028,16 +1051,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -1060,11 +1080,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig with error', async () => { @@ -1076,16 +1099,13 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; - const expectedHeaderRequestParams = 'attributes_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; + const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateAttributesConfig = stubSimpleCall( undefined, @@ -1095,11 +1115,14 @@ describe('v2beta.CatalogServiceClient', () => { client.updateAttributesConfig(request), expectedError ); - assert( - (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAttributesConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateAttributesConfig with closed client', async () => { @@ -1111,8 +1134,12 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateAttributesConfigRequest() ); - request.attributesConfig = {}; - request.attributesConfig.name = ''; + request.attributesConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + 'UpdateAttributesConfigRequest', + ['attributesConfig', 'name'] + ); + request.attributesConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1132,15 +1159,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -1148,38 +1171,166 @@ describe('v2beta.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.addCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addCatalogAttribute without error using callback', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() ); + client.innerApiCalls.addCatalogAttribute = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addCatalogAttribute( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addCatalogAttribute with error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addCatalogAttribute = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addCatalogAttribute with closed client', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + ); + const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ + 'attributesConfig', + ]); + request.attributesConfig = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addCatalogAttribute(request), expectedError); + }); + }); + + describe('removeCatalogAttribute', () => { + it('invokes removeCatalogAttribute without error', async () => { + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AttributesConfig() + ); + client.innerApiCalls.removeCatalogAttribute = + stubSimpleCall(expectedResponse); + const [response] = await client.removeCatalogAttribute(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes addCatalogAttribute without error using callback', async () => { + it('invokes removeCatalogAttribute without error using callback', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); - client.innerApiCalls.addCatalogAttribute = + client.innerApiCalls.removeCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.addCatalogAttribute( + client.removeCatalogAttribute( request, ( err?: Error | null, @@ -1195,122 +1346,132 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes addCatalogAttribute with error', async () => { + it('invokes removeCatalogAttribute with error', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.addCatalogAttribute = stubSimpleCall( + client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.addCatalogAttribute(request), expectedError); - assert( - (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError ); + const actualRequest = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes addCatalogAttribute with closed client', async () => { + it('invokes removeCatalogAttribute with closed client', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + 'RemoveCatalogAttributeRequest', + ['attributesConfig'] ); - request.attributesConfig = ''; + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); - await assert.rejects(client.addCatalogAttribute(request), expectedError); + await assert.rejects( + client.removeCatalogAttribute(request), + expectedError + ); }); }); - describe('removeCatalogAttribute', () => { - it('invokes removeCatalogAttribute without error', async () => { + describe('batchRemoveCatalogAttributes', () => { + it('invokes batchRemoveCatalogAttributes without error', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'BatchRemoveCatalogAttributesRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2beta.AttributesConfig() + new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse() ); - client.innerApiCalls.removeCatalogAttribute = + client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCall(expectedResponse); - const [response] = await client.removeCatalogAttribute(request); + const [response] = await client.batchRemoveCatalogAttributes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes removeCatalogAttribute without error using callback', async () => { + it('invokes batchRemoveCatalogAttributes without error using callback', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'BatchRemoveCatalogAttributesRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2beta.AttributesConfig() + new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesResponse() ); - client.innerApiCalls.removeCatalogAttribute = + client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.removeCatalogAttribute( + client.batchRemoveCatalogAttributes( request, ( err?: Error | null, - result?: protos.google.cloud.retail.v2beta.IAttributesConfig | null + result?: protos.google.cloud.retail.v2beta.IBatchRemoveCatalogAttributesResponse | null ) => { if (err) { reject(err); @@ -1322,61 +1483,68 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes removeCatalogAttribute with error', async () => { + it('invokes batchRemoveCatalogAttributes with error', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'BatchRemoveCatalogAttributesRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCall( + client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCall( undefined, expectedError ); await assert.rejects( - client.removeCatalogAttribute(request), + client.batchRemoveCatalogAttributes(request), expectedError ); - assert( - (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes removeCatalogAttribute with closed client', async () => { + it('invokes batchRemoveCatalogAttributes with closed client', async () => { const client = new catalogserviceModule.v2beta.CatalogServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() + new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue( + 'BatchRemoveCatalogAttributesRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( - client.removeCatalogAttribute(request), + client.batchRemoveCatalogAttributes(request), expectedError ); }); @@ -1392,15 +1560,12 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -1408,11 +1573,14 @@ describe('v2beta.CatalogServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.replaceCatalogAttribute(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute without error using callback', async () => { @@ -1424,15 +1592,12 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.AttributesConfig() ); @@ -1455,11 +1620,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute with error', async () => { @@ -1471,15 +1639,12 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; - const expectedHeaderRequestParams = 'attributes_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; + const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall( undefined, @@ -1489,11 +1654,14 @@ describe('v2beta.CatalogServiceClient', () => { client.replaceCatalogAttribute(request), expectedError ); - assert( - (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceCatalogAttribute as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceCatalogAttribute with closed client', async () => { @@ -1505,7 +1673,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); - request.attributesConfig = ''; + const defaultValue1 = getTypeDefaultValue( + 'ReplaceCatalogAttributeRequest', + ['attributesConfig'] + ); + request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -1525,15 +1697,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), @@ -1542,11 +1710,14 @@ describe('v2beta.CatalogServiceClient', () => { client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); const [response] = await client.listCatalogs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogs without error using callback', async () => { @@ -1558,15 +1729,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), @@ -1591,11 +1758,14 @@ describe('v2beta.CatalogServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogs with error', async () => { @@ -1607,26 +1777,25 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listCatalogs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listCatalogs(request), expectedError); - assert( - (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCatalogs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listCatalogsStream without error', async () => { @@ -1638,8 +1807,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), @@ -1670,11 +1842,12 @@ describe('v2beta.CatalogServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listCatalogs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1687,8 +1860,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall( undefined, @@ -1716,11 +1892,12 @@ describe('v2beta.CatalogServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listCatalogs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1733,8 +1910,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Catalog()), @@ -1754,11 +1934,12 @@ describe('v2beta.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1771,8 +1952,11 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1789,11 +1973,12 @@ describe('v2beta.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1944,12 +2129,15 @@ describe('v2beta.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1980,12 +2168,15 @@ describe('v2beta.CatalogServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2695,6 +2886,82 @@ describe('v2beta.CatalogServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new catalogserviceModule.v2beta.CatalogServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index c1ed1417792..29a478c7029 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -30,6 +30,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -219,26 +234,25 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryResponse() ); client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); const [response] = await client.completeQuery(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery without error using callback', async () => { @@ -250,15 +264,11 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryResponse() ); @@ -281,11 +291,14 @@ describe('v2.CompletionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery with error', async () => { @@ -297,26 +310,25 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.completeQuery = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.completeQuery(request), expectedError); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery with closed client', async () => { @@ -328,7 +340,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.completeQuery(request), expectedError); @@ -345,15 +360,11 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -362,11 +373,14 @@ describe('v2.CompletionServiceClient', () => { const [operation] = await client.importCompletionData(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData without error using callback', async () => { @@ -378,15 +392,11 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -416,11 +426,14 @@ describe('v2.CompletionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData with call error', async () => { @@ -432,26 +445,25 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importCompletionData = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importCompletionData(request), expectedError); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData with LRO error', async () => { @@ -463,15 +475,11 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importCompletionData = stubLongRunningCall( undefined, @@ -480,11 +488,14 @@ describe('v2.CompletionServiceClient', () => { ); const [operation] = await client.importCompletionData(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportCompletionDataProgress without error', async () => { @@ -675,12 +686,15 @@ describe('v2.CompletionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -711,12 +725,15 @@ describe('v2.CompletionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index 8a206148e23..f48ecc7d394 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -30,6 +30,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -227,26 +242,25 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() ); client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); const [response] = await client.completeQuery(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery without error using callback', async () => { @@ -259,15 +273,11 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() ); @@ -290,11 +300,14 @@ describe('v2alpha.CompletionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery with error', async () => { @@ -307,26 +320,25 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.completeQuery = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.completeQuery(request), expectedError); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery with closed client', async () => { @@ -339,7 +351,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.completeQuery(request), expectedError); @@ -357,15 +372,11 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -374,11 +385,14 @@ describe('v2alpha.CompletionServiceClient', () => { const [operation] = await client.importCompletionData(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData without error using callback', async () => { @@ -391,15 +405,11 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -429,11 +439,14 @@ describe('v2alpha.CompletionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData with call error', async () => { @@ -446,26 +459,25 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importCompletionData = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importCompletionData(request), expectedError); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData with LRO error', async () => { @@ -478,15 +490,11 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importCompletionData = stubLongRunningCall( undefined, @@ -495,11 +503,14 @@ describe('v2alpha.CompletionServiceClient', () => { ); const [operation] = await client.importCompletionData(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportCompletionDataProgress without error', async () => { @@ -696,12 +707,15 @@ describe('v2alpha.CompletionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -733,12 +747,15 @@ describe('v2alpha.CompletionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index f7dc6abce63..501f17dcfe2 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -30,6 +30,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -234,26 +249,25 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryResponse() ); client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); const [response] = await client.completeQuery(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery without error using callback', async () => { @@ -267,15 +281,11 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryResponse() ); @@ -298,11 +308,14 @@ describe('v2beta.CompletionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery with error', async () => { @@ -316,26 +329,25 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - request.catalog = ''; - const expectedHeaderRequestParams = 'catalog='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; + const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.completeQuery = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.completeQuery(request), expectedError); - assert( - (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeQuery as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes completeQuery with closed client', async () => { @@ -349,7 +361,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - request.catalog = ''; + const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ + 'catalog', + ]); + request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.completeQuery(request), expectedError); @@ -368,15 +383,11 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -385,11 +396,14 @@ describe('v2beta.CompletionServiceClient', () => { const [operation] = await client.importCompletionData(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData without error using callback', async () => { @@ -403,15 +417,11 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -441,11 +451,14 @@ describe('v2beta.CompletionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData with call error', async () => { @@ -459,26 +472,25 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importCompletionData = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importCompletionData(request), expectedError); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importCompletionData with LRO error', async () => { @@ -492,15 +504,11 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importCompletionData = stubLongRunningCall( undefined, @@ -509,11 +517,14 @@ describe('v2beta.CompletionServiceClient', () => { ); const [operation] = await client.importCompletionData(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCompletionData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportCompletionDataProgress without error', async () => { @@ -716,12 +727,15 @@ describe('v2beta.CompletionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -754,12 +768,15 @@ describe('v2beta.CompletionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1374,6 +1391,84 @@ describe('v2beta.CompletionServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new completionserviceModule.v2beta.CompletionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2.ts b/packages/google-cloud-retail/test/gapic_control_service_v2.ts index 3c8721aea0f..38a7237b58d 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,26 +237,25 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Control() ); client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); const [response] = await client.createControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl without error using callback', async () => { @@ -253,15 +267,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Control() ); @@ -284,11 +294,14 @@ describe('v2.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl with error', async () => { @@ -300,26 +313,25 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createControl(request), expectedError); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl with closed client', async () => { @@ -331,7 +343,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createControl(request), expectedError); @@ -348,26 +363,25 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); const [response] = await client.deleteControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl without error using callback', async () => { @@ -379,15 +393,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -410,11 +420,14 @@ describe('v2.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl with error', async () => { @@ -426,26 +439,25 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteControl(request), expectedError); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl with closed client', async () => { @@ -457,7 +469,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteControl(request), expectedError); @@ -474,27 +489,27 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Control() ); client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); const [response] = await client.updateControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl without error using callback', async () => { @@ -506,16 +521,13 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Control() ); @@ -538,11 +550,14 @@ describe('v2.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl with error', async () => { @@ -554,27 +569,27 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateControl(request), expectedError); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl with closed client', async () => { @@ -586,8 +601,12 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateControl(request), expectedError); @@ -604,26 +623,23 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Control() ); client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); const [response] = await client.getControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl without error using callback', async () => { @@ -635,15 +651,9 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Control() ); @@ -666,11 +676,14 @@ describe('v2.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl with error', async () => { @@ -682,26 +695,23 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getControl(request), expectedError); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl with closed client', async () => { @@ -713,7 +723,8 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getControl(request), expectedError); @@ -730,15 +741,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Control()), generateSampleMessage(new protos.google.cloud.retail.v2.Control()), @@ -747,11 +754,14 @@ describe('v2.ControlServiceClient', () => { client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); const [response] = await client.listControls(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControls without error using callback', async () => { @@ -763,15 +773,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Control()), generateSampleMessage(new protos.google.cloud.retail.v2.Control()), @@ -796,11 +802,14 @@ describe('v2.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControls with error', async () => { @@ -812,26 +821,25 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listControls = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listControls(request), expectedError); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControlsStream without error', async () => { @@ -843,8 +851,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Control()), generateSampleMessage(new protos.google.cloud.retail.v2.Control()), @@ -872,11 +883,12 @@ describe('v2.ControlServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listControls, request) ); - assert.strictEqual( - ( - client.descriptors.page.listControls.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -889,8 +901,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listControls.createStream = stubPageStreamingCall( undefined, @@ -915,11 +930,12 @@ describe('v2.ControlServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listControls, request) ); - assert.strictEqual( - ( - client.descriptors.page.listControls.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -932,8 +948,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Control()), generateSampleMessage(new protos.google.cloud.retail.v2.Control()), @@ -953,11 +972,12 @@ describe('v2.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listControls.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -970,8 +990,11 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -988,11 +1011,12 @@ describe('v2.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listControls.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1143,12 +1167,15 @@ describe('v2.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1179,12 +1206,15 @@ describe('v2.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts index ef1a3b83c11..6b1eeb28690 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,26 +237,25 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Control() ); client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); const [response] = await client.createControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl without error using callback', async () => { @@ -253,15 +267,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Control() ); @@ -284,11 +294,14 @@ describe('v2alpha.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl with error', async () => { @@ -300,26 +313,25 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createControl(request), expectedError); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl with closed client', async () => { @@ -331,7 +343,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createControl(request), expectedError); @@ -348,26 +363,25 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); const [response] = await client.deleteControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl without error using callback', async () => { @@ -379,15 +393,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -410,11 +420,14 @@ describe('v2alpha.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl with error', async () => { @@ -426,26 +439,25 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteControl(request), expectedError); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl with closed client', async () => { @@ -457,7 +469,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteControl(request), expectedError); @@ -474,27 +489,27 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Control() ); client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); const [response] = await client.updateControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl without error using callback', async () => { @@ -506,16 +521,13 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Control() ); @@ -538,11 +550,14 @@ describe('v2alpha.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl with error', async () => { @@ -554,27 +569,27 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateControl(request), expectedError); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl with closed client', async () => { @@ -586,8 +601,12 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateControl(request), expectedError); @@ -604,26 +623,23 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Control() ); client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); const [response] = await client.getControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl without error using callback', async () => { @@ -635,15 +651,9 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Control() ); @@ -666,11 +676,14 @@ describe('v2alpha.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl with error', async () => { @@ -682,26 +695,23 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getControl(request), expectedError); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl with closed client', async () => { @@ -713,7 +723,8 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getControl(request), expectedError); @@ -730,15 +741,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), @@ -747,11 +754,14 @@ describe('v2alpha.ControlServiceClient', () => { client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); const [response] = await client.listControls(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControls without error using callback', async () => { @@ -763,15 +773,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), @@ -796,11 +802,14 @@ describe('v2alpha.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControls with error', async () => { @@ -812,26 +821,25 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listControls = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listControls(request), expectedError); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControlsStream without error', async () => { @@ -843,8 +851,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), @@ -875,11 +886,12 @@ describe('v2alpha.ControlServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listControls, request) ); - assert.strictEqual( - ( - client.descriptors.page.listControls.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -892,8 +904,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listControls.createStream = stubPageStreamingCall( undefined, @@ -921,11 +936,12 @@ describe('v2alpha.ControlServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listControls, request) ); - assert.strictEqual( - ( - client.descriptors.page.listControls.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -938,8 +954,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), @@ -959,11 +978,12 @@ describe('v2alpha.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listControls.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -976,8 +996,11 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -994,11 +1017,12 @@ describe('v2alpha.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listControls.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1149,12 +1173,15 @@ describe('v2alpha.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1185,12 +1212,15 @@ describe('v2alpha.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts index 5e4d27297ec..ac93d3ab474 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,26 +237,25 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Control() ); client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); const [response] = await client.createControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl without error using callback', async () => { @@ -253,15 +267,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Control() ); @@ -284,11 +294,14 @@ describe('v2beta.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl with error', async () => { @@ -300,26 +313,25 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createControl(request), expectedError); - assert( - (client.innerApiCalls.createControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createControl with closed client', async () => { @@ -331,7 +343,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createControl(request), expectedError); @@ -348,26 +363,25 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); const [response] = await client.deleteControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl without error using callback', async () => { @@ -379,15 +393,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -410,11 +420,14 @@ describe('v2beta.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl with error', async () => { @@ -426,26 +439,25 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteControl(request), expectedError); - assert( - (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteControl with closed client', async () => { @@ -457,7 +469,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteControl(request), expectedError); @@ -474,27 +489,27 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Control() ); client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); const [response] = await client.updateControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl without error using callback', async () => { @@ -506,16 +521,13 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Control() ); @@ -538,11 +550,14 @@ describe('v2beta.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl with error', async () => { @@ -554,27 +569,27 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; - const expectedHeaderRequestParams = 'control.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; + const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateControl(request), expectedError); - assert( - (client.innerApiCalls.updateControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateControl with closed client', async () => { @@ -586,8 +601,12 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); - request.control = {}; - request.control.name = ''; + request.control ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ + 'control', + 'name', + ]); + request.control.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateControl(request), expectedError); @@ -604,26 +623,23 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Control() ); client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); const [response] = await client.getControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl without error using callback', async () => { @@ -635,15 +651,9 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Control() ); @@ -666,11 +676,14 @@ describe('v2beta.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl with error', async () => { @@ -682,26 +695,23 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getControl(request), expectedError); - assert( - (client.innerApiCalls.getControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getControl with closed client', async () => { @@ -713,7 +723,8 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getControl(request), expectedError); @@ -730,15 +741,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), @@ -747,11 +754,14 @@ describe('v2beta.ControlServiceClient', () => { client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); const [response] = await client.listControls(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControls without error using callback', async () => { @@ -763,15 +773,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), @@ -796,11 +802,14 @@ describe('v2beta.ControlServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControls with error', async () => { @@ -812,26 +821,25 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listControls = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listControls(request), expectedError); - assert( - (client.innerApiCalls.listControls as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listControls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listControlsStream without error', async () => { @@ -843,8 +851,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), @@ -875,11 +886,12 @@ describe('v2beta.ControlServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listControls, request) ); - assert.strictEqual( - ( - client.descriptors.page.listControls.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -892,8 +904,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listControls.createStream = stubPageStreamingCall( undefined, @@ -921,11 +936,12 @@ describe('v2beta.ControlServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listControls, request) ); - assert.strictEqual( - ( - client.descriptors.page.listControls.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -938,8 +954,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Control()), @@ -959,11 +978,12 @@ describe('v2beta.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listControls.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -976,8 +996,11 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -994,11 +1017,12 @@ describe('v2beta.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listControls.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listControls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1149,12 +1173,15 @@ describe('v2beta.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1185,12 +1212,15 @@ describe('v2beta.ControlServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1775,6 +1805,82 @@ describe('v2beta.ControlServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new controlserviceModule.v2beta.ControlServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts index 8f6dca90e46..cf393194a0c 100644 --- a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts @@ -32,6 +32,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -259,26 +274,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Model() ); client.innerApiCalls.pauseModel = stubSimpleCall(expectedResponse); const [response] = await client.pauseModel(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes pauseModel without error using callback', async () => { @@ -290,15 +302,9 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Model() ); @@ -321,11 +327,14 @@ describe('v2alpha.ModelServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes pauseModel with error', async () => { @@ -337,26 +346,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.pauseModel = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.pauseModel(request), expectedError); - assert( - (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes pauseModel with closed client', async () => { @@ -368,7 +374,8 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.pauseModel(request), expectedError); @@ -385,26 +392,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Model() ); client.innerApiCalls.resumeModel = stubSimpleCall(expectedResponse); const [response] = await client.resumeModel(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes resumeModel without error using callback', async () => { @@ -416,15 +420,9 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Model() ); @@ -447,11 +445,14 @@ describe('v2alpha.ModelServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes resumeModel with error', async () => { @@ -463,26 +464,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.resumeModel = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.resumeModel(request), expectedError); - assert( - (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes resumeModel with closed client', async () => { @@ -494,7 +492,8 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.resumeModel(request), expectedError); @@ -511,26 +510,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); const [response] = await client.deleteModel(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteModel without error using callback', async () => { @@ -542,15 +538,9 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -573,11 +563,14 @@ describe('v2alpha.ModelServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteModel with error', async () => { @@ -589,26 +582,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteModel = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteModel(request), expectedError); - assert( - (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteModel with closed client', async () => { @@ -620,7 +610,8 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteModel(request), expectedError); @@ -637,27 +628,27 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); - request.model = {}; - request.model.name = ''; - const expectedHeaderRequestParams = 'model.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Model() ); client.innerApiCalls.updateModel = stubSimpleCall(expectedResponse); const [response] = await client.updateModel(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateModel without error using callback', async () => { @@ -669,16 +660,13 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); - request.model = {}; - request.model.name = ''; - const expectedHeaderRequestParams = 'model.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Model() ); @@ -701,11 +689,14 @@ describe('v2alpha.ModelServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateModel with error', async () => { @@ -717,27 +708,27 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); - request.model = {}; - request.model.name = ''; - const expectedHeaderRequestParams = 'model.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateModel = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateModel(request), expectedError); - assert( - (client.innerApiCalls.updateModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateModel with closed client', async () => { @@ -749,8 +740,12 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); - request.model = {}; - request.model.name = ''; + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateModel(request), expectedError); @@ -767,15 +762,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -783,11 +774,14 @@ describe('v2alpha.ModelServiceClient', () => { const [operation] = await client.createModel(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createModel without error using callback', async () => { @@ -799,15 +793,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -837,11 +827,14 @@ describe('v2alpha.ModelServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createModel with call error', async () => { @@ -853,26 +846,25 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createModel = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.createModel(request), expectedError); - assert( - (client.innerApiCalls.createModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createModel with LRO error', async () => { @@ -884,15 +876,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createModel = stubLongRunningCall( undefined, @@ -901,11 +889,14 @@ describe('v2alpha.ModelServiceClient', () => { ); const [operation] = await client.createModel(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkCreateModelProgress without error', async () => { @@ -957,15 +948,9 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -973,11 +958,14 @@ describe('v2alpha.ModelServiceClient', () => { const [operation] = await client.tuneModel(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tuneModel without error using callback', async () => { @@ -989,15 +977,9 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1027,11 +1009,14 @@ describe('v2alpha.ModelServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tuneModel with call error', async () => { @@ -1043,26 +1028,23 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.tuneModel = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.tuneModel(request), expectedError); - assert( - (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tuneModel with LRO error', async () => { @@ -1074,15 +1056,9 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.tuneModel = stubLongRunningCall( undefined, @@ -1091,11 +1067,14 @@ describe('v2alpha.ModelServiceClient', () => { ); const [operation] = await client.tuneModel(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkTuneModelProgress without error', async () => { @@ -1147,15 +1126,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), @@ -1164,11 +1139,14 @@ describe('v2alpha.ModelServiceClient', () => { client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); const [response] = await client.listModels(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listModels as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listModels without error using callback', async () => { @@ -1180,15 +1158,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), @@ -1213,11 +1187,14 @@ describe('v2alpha.ModelServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listModels as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listModels with error', async () => { @@ -1229,26 +1206,25 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listModels = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listModels(request), expectedError); - assert( - (client.innerApiCalls.listModels as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listModelsStream without error', async () => { @@ -1260,8 +1236,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), @@ -1292,11 +1271,12 @@ describe('v2alpha.ModelServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listModels, request) ); - assert.strictEqual( - (client.descriptors.page.listModels.createStream as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1309,8 +1289,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listModels.createStream = stubPageStreamingCall( undefined, @@ -1338,11 +1321,12 @@ describe('v2alpha.ModelServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listModels, request) ); - assert.strictEqual( - (client.descriptors.page.listModels.createStream as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1355,8 +1339,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), @@ -1376,11 +1363,12 @@ describe('v2alpha.ModelServiceClient', () => { ).args[1], request ); - assert.strictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listModels.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1393,8 +1381,11 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall( undefined, @@ -1413,11 +1404,12 @@ describe('v2alpha.ModelServiceClient', () => { ).args[1], request ); - assert.strictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( - 0 - ).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listModels.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1568,12 +1560,15 @@ describe('v2alpha.ModelServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1604,12 +1599,15 @@ describe('v2alpha.ModelServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts new file mode 100644 index 00000000000..873631d0b29 --- /dev/null +++ b/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts @@ -0,0 +1,2435 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as modelserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.ModelServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + modelserviceModule.v2beta.ModelServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + modelserviceModule.v2beta.ModelServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = modelserviceModule.v2beta.ModelServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new modelserviceModule.v2beta.ModelServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.modelServiceStub, undefined); + await client.initialize(); + assert(client.modelServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.modelServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.modelServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('pauseModel', () => { + it('invokes pauseModel without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PauseModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Model() + ); + client.innerApiCalls.pauseModel = stubSimpleCall(expectedResponse); + const [response] = await client.pauseModel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pauseModel without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PauseModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Model() + ); + client.innerApiCalls.pauseModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pauseModel with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PauseModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.pauseModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pauseModel with closed client', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.PauseModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pauseModel(request), expectedError); + }); + }); + + describe('resumeModel', () => { + it('invokes resumeModel without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ResumeModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Model() + ); + client.innerApiCalls.resumeModel = stubSimpleCall(expectedResponse); + const [response] = await client.resumeModel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resumeModel without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ResumeModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Model() + ); + client.innerApiCalls.resumeModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resumeModel with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ResumeModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.resumeModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resumeModel with closed client', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ResumeModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.resumeModel(request), expectedError); + }); + }); + + describe('deleteModel', () => { + it('invokes deleteModel without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); + const [response] = await client.deleteModel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteModel without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteModel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteModel with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteModel with closed client', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.DeleteModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteModel(request), expectedError); + }); + }); + + describe('updateModel', () => { + it('invokes updateModel without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateModelRequest() + ); + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedHeaderRequestParams = `model.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Model() + ); + client.innerApiCalls.updateModel = stubSimpleCall(expectedResponse); + const [response] = await client.updateModel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateModel without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateModelRequest() + ); + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedHeaderRequestParams = `model.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.retail.v2beta.Model() + ); + client.innerApiCalls.updateModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateModel with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateModelRequest() + ); + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedHeaderRequestParams = `model.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateModel with closed client', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.UpdateModelRequest() + ); + request.model ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ + 'model', + 'name', + ]); + request.model.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateModel(request), expectedError); + }); + }); + + describe('createModel', () => { + it('invokes createModel without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.createModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createModel without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.IModel, + protos.google.cloud.retail.v2beta.ICreateModelMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createModel with call error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createModel with LRO error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.CreateModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateModelProgress without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateModelProgress with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkCreateModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('tuneModel', () => { + it('invokes tuneModel without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.TuneModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.tuneModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.tuneModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tuneModel without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.TuneModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.tuneModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.tuneModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.retail.v2beta.ITuneModelResponse, + protos.google.cloud.retail.v2beta.ITuneModelMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tuneModel with call error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.TuneModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.tuneModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.tuneModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tuneModel with LRO error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.TuneModelRequest() + ); + const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.tuneModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.tuneModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tuneModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkTuneModelProgress without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkTuneModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTuneModelProgress with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkTuneModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listModels', () => { + it('invokes listModels without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + ]; + client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); + const [response] = await client.listModels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listModels without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + ]; + client.innerApiCalls.listModels = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listModels( + request, + ( + err?: Error | null, + result?: protos.google.cloud.retail.v2beta.IModel[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listModels with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listModels = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listModels(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listModelsStream without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + ]; + client.descriptors.page.listModels.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Model[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Model) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listModels, request) + ); + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listModelsStream with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listModels.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.retail.v2beta.Model[] = []; + stream.on( + 'data', + (response: protos.google.cloud.retail.v2beta.Model) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listModels, request) + ); + assert( + (client.descriptors.page.listModels.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listModels without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + generateSampleMessage(new protos.google.cloud.retail.v2beta.Model()), + ]; + client.descriptors.page.listModels.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.retail.v2beta.IModel[] = []; + const iterable = client.listModelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert( + (client.descriptors.page.listModels.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listModels with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.ListModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listModelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.retail.v2beta.IModel[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listModels.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert( + (client.descriptors.page.listModels.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('attributesConfig', () => { + const fakePath = '/rendered/path/attributesConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.attributesConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.attributesConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('attributesConfigPath', () => { + const result = client.attributesConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.attributesConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAttributesConfigName', () => { + const result = client.matchProjectFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAttributesConfigName', () => { + const result = client.matchLocationFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromAttributesConfigName', () => { + const result = client.matchCatalogFromAttributesConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('catalog', () => { + const fakePath = '/rendered/path/catalog'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.catalogPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.catalogPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('catalogPath', () => { + const result = client.catalogPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.catalogPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCatalogName', () => { + const result = client.matchProjectFromCatalogName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCatalogName', () => { + const result = client.matchLocationFromCatalogName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCatalogName', () => { + const result = client.matchCatalogFromCatalogName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.catalogPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('completionConfig', () => { + const fakePath = '/rendered/path/completionConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.completionConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.completionConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('completionConfigPath', () => { + const result = client.completionConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.completionConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCompletionConfigName', () => { + const result = client.matchProjectFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCompletionConfigName', () => { + const result = client.matchLocationFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromCompletionConfigName', () => { + const result = client.matchCatalogFromCompletionConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.completionConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('control', () => { + const fakePath = '/rendered/path/control'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + control: 'controlValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.controlPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.controlPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('controlPath', () => { + const result = client.controlPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'controlValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.controlPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromControlName', () => { + const result = client.matchProjectFromControlName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromControlName', () => { + const result = client.matchLocationFromControlName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromControlName', () => { + const result = client.matchCatalogFromControlName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchControlFromControlName', () => { + const result = client.matchControlFromControlName(fakePath); + assert.strictEqual(result, 'controlValue'); + assert( + (client.pathTemplates.controlPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('product', () => { + const fakePath = '/rendered/path/product'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + branch: 'branchValue', + product: 'productValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.productPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.productPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('productPath', () => { + const result = client.productPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'branchValue', + 'productValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.productPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProductName', () => { + const result = client.matchProjectFromProductName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProductName', () => { + const result = client.matchLocationFromProductName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromProductName', () => { + const result = client.matchCatalogFromProductName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBranchFromProductName', () => { + const result = client.matchBranchFromProductName(fakePath); + assert.strictEqual(result, 'branchValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProductFromProductName', () => { + const result = client.matchProductFromProductName(fakePath); + assert.strictEqual(result, 'productValue'); + assert( + (client.pathTemplates.productPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('servingConfig', () => { + const fakePath = '/rendered/path/servingConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + serving_config: 'servingConfigValue', + }; + const client = new modelserviceModule.v2beta.ModelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servingConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servingConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servingConfigPath', () => { + const result = client.servingConfigPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'servingConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servingConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServingConfigName', () => { + const result = client.matchProjectFromServingConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServingConfigName', () => { + const result = client.matchLocationFromServingConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromServingConfigName', () => { + const result = client.matchCatalogFromServingConfigName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServingConfigFromServingConfigName', () => { + const result = client.matchServingConfigFromServingConfigName(fakePath); + assert.strictEqual(result, 'servingConfigValue'); + assert( + (client.pathTemplates.servingConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index 40e544d3d44..c2231a2935c 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -25,6 +25,21 @@ import * as predictionserviceModule from '../src'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -182,26 +197,25 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.PredictResponse() ); client.innerApiCalls.predict = stubSimpleCall(expectedResponse); const [response] = await client.predict(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict without error using callback', async () => { @@ -213,15 +227,11 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.PredictResponse() ); @@ -244,11 +254,14 @@ describe('v2.PredictionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict with error', async () => { @@ -260,23 +273,22 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); await assert.rejects(client.predict(request), expectedError); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict with closed client', async () => { @@ -288,7 +300,10 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - request.placement = ''; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.predict(request), expectedError); @@ -441,12 +456,15 @@ describe('v2.PredictionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -477,12 +495,15 @@ describe('v2.PredictionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index 26dc609c27a..ad8716f3052 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -25,6 +25,21 @@ import * as predictionserviceModule from '../src'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -190,26 +205,25 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictResponse() ); client.innerApiCalls.predict = stubSimpleCall(expectedResponse); const [response] = await client.predict(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict without error using callback', async () => { @@ -222,15 +236,11 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictResponse() ); @@ -253,11 +263,14 @@ describe('v2alpha.PredictionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict with error', async () => { @@ -270,23 +283,22 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); await assert.rejects(client.predict(request), expectedError); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict with closed client', async () => { @@ -299,7 +311,10 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - request.placement = ''; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.predict(request), expectedError); @@ -456,12 +471,15 @@ describe('v2alpha.PredictionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -493,12 +511,15 @@ describe('v2alpha.PredictionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index 7c0c245035d..b6039372430 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -25,6 +25,21 @@ import * as predictionserviceModule from '../src'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -197,26 +212,25 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictResponse() ); client.innerApiCalls.predict = stubSimpleCall(expectedResponse); const [response] = await client.predict(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict without error using callback', async () => { @@ -230,15 +244,11 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictResponse() ); @@ -261,11 +271,14 @@ describe('v2beta.PredictionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict with error', async () => { @@ -279,23 +292,22 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); await assert.rejects(client.predict(request), expectedError); - assert( - (client.innerApiCalls.predict as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.predict as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.predict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes predict with closed client', async () => { @@ -309,7 +321,10 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - request.placement = ''; + const defaultValue1 = getTypeDefaultValue('PredictRequest', [ + 'placement', + ]); + request.placement = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.predict(request), expectedError); @@ -470,12 +485,15 @@ describe('v2beta.PredictionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -508,12 +526,15 @@ describe('v2beta.PredictionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1128,6 +1149,84 @@ describe('v2beta.PredictionServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new predictionserviceModule.v2beta.PredictionServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 920ebfb486a..8b636b09549 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -32,6 +32,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -259,26 +274,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); const [response] = await client.createProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct without error using callback', async () => { @@ -290,15 +304,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); @@ -321,11 +331,14 @@ describe('v2.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct with error', async () => { @@ -337,26 +350,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createProduct(request), expectedError); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct with closed client', async () => { @@ -368,7 +380,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProduct(request), expectedError); @@ -385,26 +400,23 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); const [response] = await client.getProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct without error using callback', async () => { @@ -416,15 +428,9 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); @@ -447,11 +453,14 @@ describe('v2.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct with error', async () => { @@ -463,26 +472,23 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProduct(request), expectedError); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct with closed client', async () => { @@ -494,7 +500,8 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProduct(request), expectedError); @@ -511,27 +518,27 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); const [response] = await client.updateProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct without error using callback', async () => { @@ -543,16 +550,13 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.Product() ); @@ -575,11 +579,14 @@ describe('v2.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct with error', async () => { @@ -591,27 +598,27 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateProduct(request), expectedError); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct with closed client', async () => { @@ -623,8 +630,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateProduct(request), expectedError); @@ -641,26 +652,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); const [response] = await client.deleteProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct without error using callback', async () => { @@ -672,15 +682,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -703,11 +709,14 @@ describe('v2.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct with error', async () => { @@ -719,26 +728,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteProduct(request), expectedError); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct with closed client', async () => { @@ -750,7 +758,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteProduct(request), expectedError); @@ -767,15 +778,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -784,11 +791,14 @@ describe('v2.ProductServiceClient', () => { const [operation] = await client.importProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts without error using callback', async () => { @@ -800,15 +810,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -838,11 +844,14 @@ describe('v2.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts with call error', async () => { @@ -854,26 +863,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importProducts = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importProducts(request), expectedError); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts with LRO error', async () => { @@ -885,15 +893,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importProducts = stubLongRunningCall( undefined, @@ -902,11 +906,14 @@ describe('v2.ProductServiceClient', () => { ); const [operation] = await client.importProducts(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportProductsProgress without error', async () => { @@ -961,16 +968,13 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -978,11 +982,14 @@ describe('v2.ProductServiceClient', () => { const [operation] = await client.setInventory(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory without error using callback', async () => { @@ -994,16 +1001,13 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1033,11 +1037,14 @@ describe('v2.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory with call error', async () => { @@ -1049,27 +1056,27 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setInventory = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.setInventory(request), expectedError); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory with LRO error', async () => { @@ -1081,16 +1088,13 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setInventory = stubLongRunningCall( undefined, @@ -1099,11 +1103,14 @@ describe('v2.ProductServiceClient', () => { ); const [operation] = await client.setInventory(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkSetInventoryProgress without error', async () => { @@ -1155,15 +1162,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1172,11 +1175,14 @@ describe('v2.ProductServiceClient', () => { const [operation] = await client.addFulfillmentPlaces(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces without error using callback', async () => { @@ -1188,15 +1194,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1226,11 +1228,14 @@ describe('v2.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces with call error', async () => { @@ -1242,26 +1247,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.addFulfillmentPlaces(request), expectedError); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces with LRO error', async () => { @@ -1273,15 +1277,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1290,11 +1290,14 @@ describe('v2.ProductServiceClient', () => { ); const [operation] = await client.addFulfillmentPlaces(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkAddFulfillmentPlacesProgress without error', async () => { @@ -1349,15 +1352,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1366,11 +1366,14 @@ describe('v2.ProductServiceClient', () => { const [operation] = await client.removeFulfillmentPlaces(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces without error using callback', async () => { @@ -1382,15 +1385,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1420,11 +1420,14 @@ describe('v2.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces with call error', async () => { @@ -1436,15 +1439,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1454,11 +1454,14 @@ describe('v2.ProductServiceClient', () => { client.removeFulfillmentPlaces(request), expectedError ); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces with LRO error', async () => { @@ -1470,15 +1473,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1487,11 +1487,14 @@ describe('v2.ProductServiceClient', () => { ); const [operation] = await client.removeFulfillmentPlaces(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { @@ -1547,15 +1550,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1564,11 +1563,14 @@ describe('v2.ProductServiceClient', () => { const [operation] = await client.addLocalInventories(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories without error using callback', async () => { @@ -1580,15 +1582,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1618,11 +1616,14 @@ describe('v2.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories with call error', async () => { @@ -1634,26 +1635,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addLocalInventories = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.addLocalInventories(request), expectedError); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories with LRO error', async () => { @@ -1665,15 +1665,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addLocalInventories = stubLongRunningCall( undefined, @@ -1682,11 +1678,14 @@ describe('v2.ProductServiceClient', () => { ); const [operation] = await client.addLocalInventories(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkAddLocalInventoriesProgress without error', async () => { @@ -1741,15 +1740,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1758,11 +1754,14 @@ describe('v2.ProductServiceClient', () => { const [operation] = await client.removeLocalInventories(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories without error using callback', async () => { @@ -1774,15 +1773,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1812,11 +1808,14 @@ describe('v2.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories with call error', async () => { @@ -1828,15 +1827,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeLocalInventories = stubLongRunningCall( undefined, @@ -1846,11 +1842,14 @@ describe('v2.ProductServiceClient', () => { client.removeLocalInventories(request), expectedError ); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories with LRO error', async () => { @@ -1862,15 +1861,12 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeLocalInventories = stubLongRunningCall( undefined, @@ -1879,11 +1875,14 @@ describe('v2.ProductServiceClient', () => { ); const [operation] = await client.removeLocalInventories(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRemoveLocalInventoriesProgress without error', async () => { @@ -1938,15 +1937,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Product()), generateSampleMessage(new protos.google.cloud.retail.v2.Product()), @@ -1955,11 +1950,14 @@ describe('v2.ProductServiceClient', () => { client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); const [response] = await client.listProducts(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProducts without error using callback', async () => { @@ -1971,15 +1969,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Product()), generateSampleMessage(new protos.google.cloud.retail.v2.Product()), @@ -2004,11 +1998,14 @@ describe('v2.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProducts with error', async () => { @@ -2020,26 +2017,25 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProducts = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProducts(request), expectedError); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProductsStream without error', async () => { @@ -2051,8 +2047,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Product()), generateSampleMessage(new protos.google.cloud.retail.v2.Product()), @@ -2080,11 +2079,12 @@ describe('v2.ProductServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProducts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2097,8 +2097,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProducts.createStream = stubPageStreamingCall( undefined, @@ -2123,11 +2126,12 @@ describe('v2.ProductServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProducts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2140,8 +2144,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2.Product()), generateSampleMessage(new protos.google.cloud.retail.v2.Product()), @@ -2161,11 +2168,12 @@ describe('v2.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2178,8 +2186,11 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2196,11 +2207,12 @@ describe('v2.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2351,12 +2363,15 @@ describe('v2.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -2387,12 +2402,15 @@ describe('v2.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index 68b4016422a..e3b08937a7e 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -32,6 +32,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -259,26 +274,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); const [response] = await client.createProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct without error using callback', async () => { @@ -290,15 +304,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); @@ -321,11 +331,14 @@ describe('v2alpha.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct with error', async () => { @@ -337,26 +350,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createProduct(request), expectedError); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct with closed client', async () => { @@ -368,7 +380,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProduct(request), expectedError); @@ -385,26 +400,23 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); const [response] = await client.getProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct without error using callback', async () => { @@ -416,15 +428,9 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); @@ -447,11 +453,14 @@ describe('v2alpha.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct with error', async () => { @@ -463,26 +472,23 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProduct(request), expectedError); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct with closed client', async () => { @@ -494,7 +500,8 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProduct(request), expectedError); @@ -511,27 +518,27 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); const [response] = await client.updateProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct without error using callback', async () => { @@ -543,16 +550,13 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.Product() ); @@ -575,11 +579,14 @@ describe('v2alpha.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct with error', async () => { @@ -591,27 +598,27 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateProduct(request), expectedError); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct with closed client', async () => { @@ -623,8 +630,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateProduct(request), expectedError); @@ -641,26 +652,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); const [response] = await client.deleteProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct without error using callback', async () => { @@ -672,15 +682,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -703,11 +709,14 @@ describe('v2alpha.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct with error', async () => { @@ -719,26 +728,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteProduct(request), expectedError); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct with closed client', async () => { @@ -750,7 +758,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteProduct(request), expectedError); @@ -767,15 +778,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -784,11 +791,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.purgeProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeProducts without error using callback', async () => { @@ -800,15 +810,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -838,11 +844,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeProducts with call error', async () => { @@ -854,26 +863,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeProducts = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.purgeProducts(request), expectedError); - assert( - (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeProducts with LRO error', async () => { @@ -885,15 +893,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeProducts = stubLongRunningCall( undefined, @@ -902,11 +906,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.purgeProducts(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkPurgeProductsProgress without error', async () => { @@ -961,15 +968,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -978,11 +981,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.importProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts without error using callback', async () => { @@ -994,15 +1000,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1032,11 +1034,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts with call error', async () => { @@ -1048,26 +1053,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importProducts = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importProducts(request), expectedError); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts with LRO error', async () => { @@ -1079,15 +1083,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importProducts = stubLongRunningCall( undefined, @@ -1096,11 +1096,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.importProducts(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportProductsProgress without error', async () => { @@ -1155,16 +1158,13 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1172,11 +1172,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.setInventory(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory without error using callback', async () => { @@ -1188,16 +1191,13 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1227,11 +1227,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory with call error', async () => { @@ -1243,27 +1246,27 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setInventory = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.setInventory(request), expectedError); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory with LRO error', async () => { @@ -1275,16 +1278,13 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setInventory = stubLongRunningCall( undefined, @@ -1293,11 +1293,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.setInventory(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkSetInventoryProgress without error', async () => { @@ -1349,15 +1352,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1366,11 +1365,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.addFulfillmentPlaces(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces without error using callback', async () => { @@ -1382,15 +1384,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1420,11 +1418,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces with call error', async () => { @@ -1436,26 +1437,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.addFulfillmentPlaces(request), expectedError); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces with LRO error', async () => { @@ -1467,15 +1467,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1484,11 +1480,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.addFulfillmentPlaces(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkAddFulfillmentPlacesProgress without error', async () => { @@ -1543,15 +1542,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1560,11 +1556,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.removeFulfillmentPlaces(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces without error using callback', async () => { @@ -1576,15 +1575,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1614,11 +1610,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces with call error', async () => { @@ -1630,15 +1629,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1648,11 +1644,14 @@ describe('v2alpha.ProductServiceClient', () => { client.removeFulfillmentPlaces(request), expectedError ); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces with LRO error', async () => { @@ -1664,15 +1663,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1681,11 +1677,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.removeFulfillmentPlaces(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { @@ -1741,15 +1740,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1758,11 +1753,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.addLocalInventories(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories without error using callback', async () => { @@ -1774,15 +1772,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1812,11 +1806,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories with call error', async () => { @@ -1828,26 +1825,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addLocalInventories = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.addLocalInventories(request), expectedError); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories with LRO error', async () => { @@ -1859,15 +1855,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addLocalInventories = stubLongRunningCall( undefined, @@ -1876,11 +1868,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.addLocalInventories(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkAddLocalInventoriesProgress without error', async () => { @@ -1935,15 +1930,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1952,11 +1944,14 @@ describe('v2alpha.ProductServiceClient', () => { const [operation] = await client.removeLocalInventories(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories without error using callback', async () => { @@ -1968,15 +1963,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -2006,11 +1998,14 @@ describe('v2alpha.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories with call error', async () => { @@ -2022,15 +2017,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeLocalInventories = stubLongRunningCall( undefined, @@ -2040,11 +2032,14 @@ describe('v2alpha.ProductServiceClient', () => { client.removeLocalInventories(request), expectedError ); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories with LRO error', async () => { @@ -2056,15 +2051,12 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeLocalInventories = stubLongRunningCall( undefined, @@ -2073,11 +2065,14 @@ describe('v2alpha.ProductServiceClient', () => { ); const [operation] = await client.removeLocalInventories(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRemoveLocalInventoriesProgress without error', async () => { @@ -2132,15 +2127,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), @@ -2149,11 +2140,14 @@ describe('v2alpha.ProductServiceClient', () => { client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); const [response] = await client.listProducts(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProducts without error using callback', async () => { @@ -2165,15 +2159,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), @@ -2198,11 +2188,14 @@ describe('v2alpha.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProducts with error', async () => { @@ -2214,26 +2207,25 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProducts = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProducts(request), expectedError); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProductsStream without error', async () => { @@ -2245,8 +2237,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), @@ -2277,11 +2272,12 @@ describe('v2alpha.ProductServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProducts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2294,8 +2290,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProducts.createStream = stubPageStreamingCall( undefined, @@ -2323,11 +2322,12 @@ describe('v2alpha.ProductServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProducts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2340,8 +2340,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), @@ -2361,11 +2364,12 @@ describe('v2alpha.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2378,8 +2382,11 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2396,11 +2403,12 @@ describe('v2alpha.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2551,12 +2559,15 @@ describe('v2alpha.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -2587,12 +2598,15 @@ describe('v2alpha.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 12021ec27e3..3747db6783d 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -32,6 +32,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -259,26 +274,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); const [response] = await client.createProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct without error using callback', async () => { @@ -290,15 +304,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); @@ -321,11 +331,14 @@ describe('v2beta.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct with error', async () => { @@ -337,26 +350,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createProduct(request), expectedError); - assert( - (client.innerApiCalls.createProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createProduct with closed client', async () => { @@ -368,7 +380,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createProduct(request), expectedError); @@ -385,26 +400,23 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); const [response] = await client.getProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct without error using callback', async () => { @@ -416,15 +428,9 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); @@ -447,11 +453,14 @@ describe('v2beta.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct with error', async () => { @@ -463,26 +472,23 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getProduct(request), expectedError); - assert( - (client.innerApiCalls.getProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProduct with closed client', async () => { @@ -494,7 +500,8 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getProduct(request), expectedError); @@ -511,27 +518,27 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); const [response] = await client.updateProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct without error using callback', async () => { @@ -543,16 +550,13 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.Product() ); @@ -575,11 +579,14 @@ describe('v2beta.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct with error', async () => { @@ -591,27 +598,27 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; - const expectedHeaderRequestParams = 'product.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; + const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateProduct(request), expectedError); - assert( - (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProduct with closed client', async () => { @@ -623,8 +630,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); - request.product = {}; - request.product.name = ''; + request.product ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ + 'product', + 'name', + ]); + request.product.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateProduct(request), expectedError); @@ -641,26 +652,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); const [response] = await client.deleteProduct(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct without error using callback', async () => { @@ -672,15 +682,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -703,11 +709,14 @@ describe('v2beta.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct with error', async () => { @@ -719,26 +728,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteProduct = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteProduct(request), expectedError); - assert( - (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProduct as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteProduct with closed client', async () => { @@ -750,7 +758,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteProduct(request), expectedError); @@ -767,15 +778,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -784,11 +791,14 @@ describe('v2beta.ProductServiceClient', () => { const [operation] = await client.importProducts(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts without error using callback', async () => { @@ -800,15 +810,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -838,11 +844,14 @@ describe('v2beta.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts with call error', async () => { @@ -854,26 +863,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importProducts = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importProducts(request), expectedError); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importProducts with LRO error', async () => { @@ -885,15 +893,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importProducts = stubLongRunningCall( undefined, @@ -902,11 +906,14 @@ describe('v2beta.ProductServiceClient', () => { ); const [operation] = await client.importProducts(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportProductsProgress without error', async () => { @@ -961,16 +968,13 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -978,11 +982,14 @@ describe('v2beta.ProductServiceClient', () => { const [operation] = await client.setInventory(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory without error using callback', async () => { @@ -994,16 +1001,13 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1033,11 +1037,14 @@ describe('v2beta.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory with call error', async () => { @@ -1049,27 +1056,27 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setInventory = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.setInventory(request), expectedError); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setInventory with LRO error', async () => { @@ -1081,16 +1088,13 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); - request.inventory = {}; - request.inventory.name = ''; - const expectedHeaderRequestParams = 'inventory.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.inventory ??= {}; + const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ + 'inventory', + 'name', + ]); + request.inventory.name = defaultValue1; + const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setInventory = stubLongRunningCall( undefined, @@ -1099,11 +1103,14 @@ describe('v2beta.ProductServiceClient', () => { ); const [operation] = await client.setInventory(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.setInventory as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkSetInventoryProgress without error', async () => { @@ -1155,15 +1162,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1172,11 +1175,14 @@ describe('v2beta.ProductServiceClient', () => { const [operation] = await client.addFulfillmentPlaces(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces without error using callback', async () => { @@ -1188,15 +1194,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1226,11 +1228,14 @@ describe('v2beta.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces with call error', async () => { @@ -1242,26 +1247,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.addFulfillmentPlaces(request), expectedError); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addFulfillmentPlaces with LRO error', async () => { @@ -1270,18 +1274,14 @@ describe('v2beta.ProductServiceClient', () => { projectId: 'bogus', }); client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() - ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const request = generateSampleMessage( + new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() + ); + const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1290,11 +1290,14 @@ describe('v2beta.ProductServiceClient', () => { ); const [operation] = await client.addFulfillmentPlaces(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkAddFulfillmentPlacesProgress without error', async () => { @@ -1349,15 +1352,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1366,11 +1366,14 @@ describe('v2beta.ProductServiceClient', () => { const [operation] = await client.removeFulfillmentPlaces(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces without error using callback', async () => { @@ -1382,15 +1385,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1420,11 +1420,14 @@ describe('v2beta.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces with call error', async () => { @@ -1436,15 +1439,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1454,11 +1454,14 @@ describe('v2beta.ProductServiceClient', () => { client.removeFulfillmentPlaces(request), expectedError ); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeFulfillmentPlaces with LRO error', async () => { @@ -1470,15 +1473,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveFulfillmentPlacesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall( undefined, @@ -1487,11 +1487,14 @@ describe('v2beta.ProductServiceClient', () => { ); const [operation] = await client.removeFulfillmentPlaces(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeFulfillmentPlaces as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { @@ -1547,15 +1550,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1564,11 +1563,14 @@ describe('v2beta.ProductServiceClient', () => { const [operation] = await client.addLocalInventories(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories without error using callback', async () => { @@ -1580,15 +1582,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1618,11 +1616,14 @@ describe('v2beta.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories with call error', async () => { @@ -1634,26 +1635,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addLocalInventories = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.addLocalInventories(request), expectedError); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addLocalInventories with LRO error', async () => { @@ -1665,15 +1665,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ + 'product', + ]); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addLocalInventories = stubLongRunningCall( undefined, @@ -1682,11 +1678,14 @@ describe('v2beta.ProductServiceClient', () => { ); const [operation] = await client.addLocalInventories(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkAddLocalInventoriesProgress without error', async () => { @@ -1741,15 +1740,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1758,11 +1754,14 @@ describe('v2beta.ProductServiceClient', () => { const [operation] = await client.removeLocalInventories(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories without error using callback', async () => { @@ -1774,15 +1773,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1812,11 +1808,14 @@ describe('v2beta.ProductServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories with call error', async () => { @@ -1828,15 +1827,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeLocalInventories = stubLongRunningCall( undefined, @@ -1846,11 +1842,14 @@ describe('v2beta.ProductServiceClient', () => { client.removeLocalInventories(request), expectedError ); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeLocalInventories with LRO error', async () => { @@ -1862,15 +1861,12 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); - request.product = ''; - const expectedHeaderRequestParams = 'product='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RemoveLocalInventoriesRequest', + ['product'] + ); + request.product = defaultValue1; + const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeLocalInventories = stubLongRunningCall( undefined, @@ -1879,11 +1875,14 @@ describe('v2beta.ProductServiceClient', () => { ); const [operation] = await client.removeLocalInventories(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeLocalInventories as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRemoveLocalInventoriesProgress without error', async () => { @@ -1938,15 +1937,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), @@ -1955,11 +1950,14 @@ describe('v2beta.ProductServiceClient', () => { client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); const [response] = await client.listProducts(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProducts without error using callback', async () => { @@ -1971,15 +1969,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), @@ -2004,11 +1998,14 @@ describe('v2beta.ProductServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProducts with error', async () => { @@ -2020,26 +2017,25 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProducts = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listProducts(request), expectedError); - assert( - (client.innerApiCalls.listProducts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProducts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProductsStream without error', async () => { @@ -2051,8 +2047,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), @@ -2083,11 +2082,12 @@ describe('v2beta.ProductServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProducts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2100,8 +2100,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProducts.createStream = stubPageStreamingCall( undefined, @@ -2129,11 +2132,12 @@ describe('v2beta.ProductServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProducts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2146,8 +2150,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), generateSampleMessage(new protos.google.cloud.retail.v2beta.Product()), @@ -2167,11 +2174,12 @@ describe('v2beta.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2184,8 +2192,11 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2202,11 +2213,12 @@ describe('v2beta.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listProducts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2357,12 +2369,15 @@ describe('v2beta.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -2393,12 +2408,15 @@ describe('v2beta.ProductServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -3059,6 +3077,82 @@ describe('v2beta.ProductServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new productserviceModule.v2beta.ProductServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index 24a784ddc11..1ea1309ddbe 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,15 +237,9 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.SearchResponse.SearchResult() @@ -245,11 +254,14 @@ describe('v2.SearchServiceClient', () => { client.innerApiCalls.search = stubSimpleCall(expectedResponse); const [response] = await client.search(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes search without error using callback', async () => { @@ -261,15 +273,9 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.SearchResponse.SearchResult() @@ -302,11 +308,14 @@ describe('v2.SearchServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes search with error', async () => { @@ -318,23 +327,20 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); await assert.rejects(client.search(request), expectedError); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes searchStream without error', async () => { @@ -346,8 +352,9 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.SearchResponse.SearchResult() @@ -387,10 +394,12 @@ describe('v2.SearchServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.search, request) ); - assert.strictEqual( - (client.descriptors.page.search.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -403,8 +412,9 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.search.createStream = stubPageStreamingCall( undefined, @@ -435,10 +445,12 @@ describe('v2.SearchServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.search, request) ); - assert.strictEqual( - (client.descriptors.page.search.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -451,8 +463,9 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.SearchResponse.SearchResult() @@ -478,10 +491,12 @@ describe('v2.SearchServiceClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -494,8 +509,9 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.search.asyncIterate = stubAsyncIterationCall( undefined, @@ -514,10 +530,12 @@ describe('v2.SearchServiceClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -668,12 +686,15 @@ describe('v2.SearchServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -704,12 +725,15 @@ describe('v2.SearchServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index 67c841bb4d8..b7357f949f7 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,15 +237,9 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() @@ -245,11 +254,14 @@ describe('v2alpha.SearchServiceClient', () => { client.innerApiCalls.search = stubSimpleCall(expectedResponse); const [response] = await client.search(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes search without error using callback', async () => { @@ -261,15 +273,9 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() @@ -302,11 +308,14 @@ describe('v2alpha.SearchServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes search with error', async () => { @@ -318,23 +327,20 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); await assert.rejects(client.search(request), expectedError); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes searchStream without error', async () => { @@ -346,8 +352,9 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() @@ -387,10 +394,12 @@ describe('v2alpha.SearchServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.search, request) ); - assert.strictEqual( - (client.descriptors.page.search.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -403,8 +412,9 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.search.createStream = stubPageStreamingCall( undefined, @@ -435,10 +445,12 @@ describe('v2alpha.SearchServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.search, request) ); - assert.strictEqual( - (client.descriptors.page.search.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -451,8 +463,9 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult() @@ -478,10 +491,12 @@ describe('v2alpha.SearchServiceClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -494,8 +509,9 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.search.asyncIterate = stubAsyncIterationCall( undefined, @@ -514,10 +530,12 @@ describe('v2alpha.SearchServiceClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -668,12 +686,15 @@ describe('v2alpha.SearchServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -704,12 +725,15 @@ describe('v2alpha.SearchServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index d6bbcd1f0ae..291b995b141 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -222,15 +237,9 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() @@ -245,11 +254,14 @@ describe('v2beta.SearchServiceClient', () => { client.innerApiCalls.search = stubSimpleCall(expectedResponse); const [response] = await client.search(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes search without error using callback', async () => { @@ -261,15 +273,9 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() @@ -302,11 +308,14 @@ describe('v2beta.SearchServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes search with error', async () => { @@ -318,23 +327,20 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); await assert.rejects(client.search(request), expectedError); - assert( - (client.innerApiCalls.search as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.search as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.search as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes searchStream without error', async () => { @@ -346,8 +352,9 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() @@ -387,10 +394,12 @@ describe('v2beta.SearchServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.search, request) ); - assert.strictEqual( - (client.descriptors.page.search.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -403,8 +412,9 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.search.createStream = stubPageStreamingCall( undefined, @@ -435,10 +445,12 @@ describe('v2beta.SearchServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.search, request) ); - assert.strictEqual( - (client.descriptors.page.search.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -451,8 +463,9 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchResponse.SearchResult() @@ -478,10 +491,12 @@ describe('v2beta.SearchServiceClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -494,8 +509,9 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - request.placement = ''; - const expectedHeaderRequestParams = 'placement='; + const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + request.placement = defaultValue1; + const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.search.asyncIterate = stubAsyncIterationCall( undefined, @@ -514,10 +530,12 @@ describe('v2beta.SearchServiceClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.search.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -668,12 +686,15 @@ describe('v2beta.SearchServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -704,12 +725,15 @@ describe('v2beta.SearchServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1370,6 +1394,82 @@ describe('v2beta.SearchServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new searchserviceModule.v2beta.SearchServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts index fdb5f3a5103..747b7737286 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -231,15 +246,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -247,11 +258,14 @@ describe('v2.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.createServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig without error using callback', async () => { @@ -264,15 +278,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -295,11 +305,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig with error', async () => { @@ -312,26 +325,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createServingConfig(request), expectedError); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig with closed client', async () => { @@ -344,7 +356,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createServingConfig(request), expectedError); @@ -362,15 +377,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -378,11 +389,14 @@ describe('v2.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.deleteServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig without error using callback', async () => { @@ -395,15 +409,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -426,11 +436,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig with error', async () => { @@ -443,26 +456,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteServingConfig(request), expectedError); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig with closed client', async () => { @@ -475,7 +487,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteServingConfig(request), expectedError); @@ -493,16 +508,13 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -510,11 +522,14 @@ describe('v2.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig without error using callback', async () => { @@ -527,16 +542,13 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -559,11 +571,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig with error', async () => { @@ -576,27 +591,27 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateServingConfig(request), expectedError); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig with closed client', async () => { @@ -609,8 +624,12 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateServingConfig(request), expectedError); @@ -628,26 +647,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); const [response] = await client.getServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig without error using callback', async () => { @@ -660,15 +678,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -691,11 +705,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig with error', async () => { @@ -708,26 +725,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getServingConfig(request), expectedError); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig with closed client', async () => { @@ -740,7 +756,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getServingConfig(request), expectedError); @@ -758,26 +777,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); const [response] = await client.addControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl without error using callback', async () => { @@ -790,15 +808,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -821,11 +835,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl with error', async () => { @@ -838,26 +855,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.addControl(request), expectedError); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl with closed client', async () => { @@ -870,7 +886,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - request.servingConfig = ''; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.addControl(request), expectedError); @@ -888,26 +907,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); const [response] = await client.removeControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl without error using callback', async () => { @@ -920,15 +938,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() ); @@ -951,11 +965,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl with error', async () => { @@ -968,26 +985,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.removeControl(request), expectedError); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl with closed client', async () => { @@ -1000,7 +1016,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - request.servingConfig = ''; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.removeControl(request), expectedError); @@ -1018,15 +1037,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() @@ -1042,11 +1057,14 @@ describe('v2.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listServingConfigs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigs without error using callback', async () => { @@ -1059,15 +1077,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() @@ -1098,11 +1112,14 @@ describe('v2.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigs with error', async () => { @@ -1115,26 +1132,25 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listServingConfigs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listServingConfigs(request), expectedError); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigsStream without error', async () => { @@ -1147,8 +1163,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() @@ -1185,11 +1204,12 @@ describe('v2.ServingConfigServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listServingConfigs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1203,8 +1223,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1230,11 +1253,12 @@ describe('v2.ServingConfigServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listServingConfigs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1248,8 +1272,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2.ServingConfig() @@ -1275,11 +1302,12 @@ describe('v2.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1293,8 +1321,11 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1311,11 +1342,12 @@ describe('v2.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1470,12 +1502,15 @@ describe('v2.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1507,12 +1542,15 @@ describe('v2.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts index ace7d68058c..2e320f159d0 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -233,15 +248,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -249,11 +260,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.createServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig without error using callback', async () => { @@ -266,15 +280,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -297,11 +307,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig with error', async () => { @@ -314,26 +327,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createServingConfig(request), expectedError); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig with closed client', async () => { @@ -346,7 +358,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createServingConfig(request), expectedError); @@ -364,15 +379,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -380,11 +391,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.deleteServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig without error using callback', async () => { @@ -397,15 +411,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -428,11 +438,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig with error', async () => { @@ -445,26 +458,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteServingConfig(request), expectedError); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig with closed client', async () => { @@ -477,7 +489,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteServingConfig(request), expectedError); @@ -495,16 +510,13 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -512,11 +524,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig without error using callback', async () => { @@ -529,16 +544,13 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -561,11 +573,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig with error', async () => { @@ -578,27 +593,27 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateServingConfig(request), expectedError); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig with closed client', async () => { @@ -611,8 +626,12 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateServingConfig(request), expectedError); @@ -630,26 +649,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); const [response] = await client.getServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig without error using callback', async () => { @@ -662,15 +680,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -693,11 +707,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig with error', async () => { @@ -710,26 +727,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getServingConfig(request), expectedError); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig with closed client', async () => { @@ -742,7 +758,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getServingConfig(request), expectedError); @@ -760,26 +779,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); const [response] = await client.addControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl without error using callback', async () => { @@ -792,15 +810,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -823,11 +837,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl with error', async () => { @@ -840,26 +857,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.addControl(request), expectedError); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl with closed client', async () => { @@ -872,7 +888,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - request.servingConfig = ''; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.addControl(request), expectedError); @@ -890,26 +909,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); const [response] = await client.removeControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl without error using callback', async () => { @@ -922,15 +940,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() ); @@ -953,11 +967,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl with error', async () => { @@ -970,26 +987,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.removeControl(request), expectedError); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl with closed client', async () => { @@ -1002,7 +1018,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - request.servingConfig = ''; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.removeControl(request), expectedError); @@ -1020,15 +1039,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() @@ -1044,11 +1059,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listServingConfigs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigs without error using callback', async () => { @@ -1061,15 +1079,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() @@ -1100,11 +1114,14 @@ describe('v2alpha.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigs with error', async () => { @@ -1117,26 +1134,25 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listServingConfigs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listServingConfigs(request), expectedError); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigsStream without error', async () => { @@ -1149,8 +1165,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() @@ -1188,11 +1207,12 @@ describe('v2alpha.ServingConfigServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listServingConfigs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1206,8 +1226,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1234,11 +1257,12 @@ describe('v2alpha.ServingConfigServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listServingConfigs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1252,8 +1276,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2alpha.ServingConfig() @@ -1279,11 +1306,12 @@ describe('v2alpha.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1297,8 +1325,11 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1316,11 +1347,12 @@ describe('v2alpha.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1475,12 +1507,15 @@ describe('v2alpha.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1512,12 +1547,15 @@ describe('v2alpha.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts index c6e21e6c597..199dd19ee0b 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf, operationsProtos, LocationProtos} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -233,15 +248,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -249,11 +260,14 @@ describe('v2beta.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.createServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig without error using callback', async () => { @@ -266,15 +280,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -297,11 +307,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig with error', async () => { @@ -314,26 +327,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createServingConfig(request), expectedError); - assert( - (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createServingConfig with closed client', async () => { @@ -346,7 +358,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createServingConfig(request), expectedError); @@ -364,15 +379,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -380,11 +391,14 @@ describe('v2beta.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.deleteServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig without error using callback', async () => { @@ -397,15 +411,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -428,11 +438,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig with error', async () => { @@ -445,26 +458,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteServingConfig(request), expectedError); - assert( - (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteServingConfig with closed client', async () => { @@ -477,7 +489,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteServingConfig(request), expectedError); @@ -495,16 +510,13 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -512,11 +524,14 @@ describe('v2beta.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig without error using callback', async () => { @@ -529,16 +544,13 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -561,11 +573,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig with error', async () => { @@ -578,27 +593,27 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; - const expectedHeaderRequestParams = 'serving_config.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; + const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateServingConfig(request), expectedError); - assert( - (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateServingConfig with closed client', async () => { @@ -611,8 +626,12 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); - request.servingConfig = {}; - request.servingConfig.name = ''; + request.servingConfig ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ + 'servingConfig', + 'name', + ]); + request.servingConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateServingConfig(request), expectedError); @@ -630,26 +649,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); const [response] = await client.getServingConfig(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig without error using callback', async () => { @@ -662,15 +680,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -693,11 +707,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig with error', async () => { @@ -710,26 +727,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getServingConfig = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getServingConfig(request), expectedError); - assert( - (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServingConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getServingConfig with closed client', async () => { @@ -742,7 +758,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getServingConfig(request), expectedError); @@ -760,26 +779,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); const [response] = await client.addControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl without error using callback', async () => { @@ -792,15 +810,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -823,11 +837,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl with error', async () => { @@ -840,26 +857,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.addControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.addControl(request), expectedError); - assert( - (client.innerApiCalls.addControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes addControl with closed client', async () => { @@ -872,7 +888,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - request.servingConfig = ''; + const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.addControl(request), expectedError); @@ -890,26 +909,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); const [response] = await client.removeControl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl without error using callback', async () => { @@ -922,15 +940,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() ); @@ -953,11 +967,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl with error', async () => { @@ -970,26 +987,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - request.servingConfig = ''; - const expectedHeaderRequestParams = 'serving_config='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; + const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.removeControl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.removeControl(request), expectedError); - assert( - (client.innerApiCalls.removeControl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeControl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes removeControl with closed client', async () => { @@ -1002,7 +1018,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - request.servingConfig = ''; + const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ + 'servingConfig', + ]); + request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.removeControl(request), expectedError); @@ -1020,15 +1039,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() @@ -1044,11 +1059,14 @@ describe('v2beta.ServingConfigServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listServingConfigs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigs without error using callback', async () => { @@ -1061,15 +1079,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() @@ -1100,11 +1114,14 @@ describe('v2beta.ServingConfigServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigs with error', async () => { @@ -1117,26 +1134,25 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listServingConfigs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listServingConfigs(request), expectedError); - assert( - (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServingConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listServingConfigsStream without error', async () => { @@ -1149,8 +1165,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() @@ -1187,11 +1206,12 @@ describe('v2beta.ServingConfigServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listServingConfigs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1205,8 +1225,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1232,11 +1255,12 @@ describe('v2beta.ServingConfigServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listServingConfigs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1250,8 +1274,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.retail.v2beta.ServingConfig() @@ -1277,11 +1304,12 @@ describe('v2beta.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1295,8 +1323,11 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1314,11 +1345,12 @@ describe('v2beta.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listServingConfigs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1473,12 +1505,15 @@ describe('v2beta.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1510,12 +1545,15 @@ describe('v2beta.ServingConfigServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2115,6 +2153,83 @@ describe('v2beta.ServingConfigServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = + new servingconfigserviceModule.v2beta.ServingConfigServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index c66bd3cefb4..f16879e1ad4 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -30,6 +30,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -219,26 +234,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.UserEvent() ); client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); const [response] = await client.writeUserEvent(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent without error using callback', async () => { @@ -250,15 +264,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2.UserEvent() ); @@ -281,11 +291,14 @@ describe('v2.UserEventServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent with error', async () => { @@ -297,26 +310,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.writeUserEvent = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.writeUserEvent(request), expectedError); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent with closed client', async () => { @@ -328,7 +340,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.writeUserEvent(request), expectedError); @@ -345,26 +360,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); const [response] = await client.collectUserEvent(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent without error using callback', async () => { @@ -376,15 +390,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -404,11 +414,14 @@ describe('v2.UserEventServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent with error', async () => { @@ -420,26 +433,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.collectUserEvent = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.collectUserEvent(request), expectedError); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent with closed client', async () => { @@ -451,7 +463,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.collectUserEvent(request), expectedError); @@ -468,15 +483,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -485,11 +496,14 @@ describe('v2.UserEventServiceClient', () => { const [operation] = await client.purgeUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents without error using callback', async () => { @@ -501,15 +515,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -539,11 +549,14 @@ describe('v2.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents with call error', async () => { @@ -555,26 +568,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.purgeUserEvents(request), expectedError); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents with LRO error', async () => { @@ -586,15 +598,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeUserEvents = stubLongRunningCall( undefined, @@ -603,11 +611,14 @@ describe('v2.UserEventServiceClient', () => { ); const [operation] = await client.purgeUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkPurgeUserEventsProgress without error', async () => { @@ -662,15 +673,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -679,11 +686,14 @@ describe('v2.UserEventServiceClient', () => { const [operation] = await client.importUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents without error using callback', async () => { @@ -695,15 +705,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -733,11 +739,14 @@ describe('v2.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents with call error', async () => { @@ -749,26 +758,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importUserEvents(request), expectedError); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents with LRO error', async () => { @@ -780,15 +788,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importUserEvents = stubLongRunningCall( undefined, @@ -797,11 +801,14 @@ describe('v2.UserEventServiceClient', () => { ); const [operation] = await client.importUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportUserEventsProgress without error', async () => { @@ -856,15 +863,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -873,11 +876,14 @@ describe('v2.UserEventServiceClient', () => { const [operation] = await client.rejoinUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents without error using callback', async () => { @@ -889,15 +895,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -927,11 +929,14 @@ describe('v2.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents with call error', async () => { @@ -943,26 +948,25 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.rejoinUserEvents(request), expectedError); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents with LRO error', async () => { @@ -974,15 +978,11 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( undefined, @@ -991,11 +991,14 @@ describe('v2.UserEventServiceClient', () => { ); const [operation] = await client.rejoinUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRejoinUserEventsProgress without error', async () => { @@ -1186,12 +1189,15 @@ describe('v2.UserEventServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1222,12 +1228,15 @@ describe('v2.UserEventServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index 2ac9beaf1ac..c7a6fcc2b95 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -30,6 +30,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -220,26 +235,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UserEvent() ); client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); const [response] = await client.writeUserEvent(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent without error using callback', async () => { @@ -251,15 +265,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2alpha.UserEvent() ); @@ -282,11 +292,14 @@ describe('v2alpha.UserEventServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent with error', async () => { @@ -298,26 +311,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.writeUserEvent = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.writeUserEvent(request), expectedError); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent with closed client', async () => { @@ -329,7 +341,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.writeUserEvent(request), expectedError); @@ -346,26 +361,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); const [response] = await client.collectUserEvent(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent without error using callback', async () => { @@ -377,15 +391,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -405,11 +415,14 @@ describe('v2alpha.UserEventServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent with error', async () => { @@ -421,26 +434,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.collectUserEvent = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.collectUserEvent(request), expectedError); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent with closed client', async () => { @@ -452,7 +464,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.collectUserEvent(request), expectedError); @@ -469,15 +484,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -486,11 +497,14 @@ describe('v2alpha.UserEventServiceClient', () => { const [operation] = await client.purgeUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents without error using callback', async () => { @@ -502,15 +516,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -540,11 +550,14 @@ describe('v2alpha.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents with call error', async () => { @@ -556,26 +569,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.purgeUserEvents(request), expectedError); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents with LRO error', async () => { @@ -587,15 +599,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeUserEvents = stubLongRunningCall( undefined, @@ -604,11 +612,14 @@ describe('v2alpha.UserEventServiceClient', () => { ); const [operation] = await client.purgeUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkPurgeUserEventsProgress without error', async () => { @@ -663,15 +674,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -680,11 +687,14 @@ describe('v2alpha.UserEventServiceClient', () => { const [operation] = await client.importUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents without error using callback', async () => { @@ -696,15 +706,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -734,11 +740,14 @@ describe('v2alpha.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents with call error', async () => { @@ -750,26 +759,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importUserEvents(request), expectedError); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents with LRO error', async () => { @@ -781,15 +789,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importUserEvents = stubLongRunningCall( undefined, @@ -798,11 +802,14 @@ describe('v2alpha.UserEventServiceClient', () => { ); const [operation] = await client.importUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportUserEventsProgress without error', async () => { @@ -857,15 +864,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -874,11 +877,14 @@ describe('v2alpha.UserEventServiceClient', () => { const [operation] = await client.rejoinUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents without error using callback', async () => { @@ -890,15 +896,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -928,11 +930,14 @@ describe('v2alpha.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents with call error', async () => { @@ -944,26 +949,25 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.rejoinUserEvents(request), expectedError); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents with LRO error', async () => { @@ -975,15 +979,11 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( undefined, @@ -992,11 +992,14 @@ describe('v2alpha.UserEventServiceClient', () => { ); const [operation] = await client.rejoinUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRejoinUserEventsProgress without error', async () => { @@ -1187,12 +1190,15 @@ describe('v2alpha.UserEventServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1223,12 +1229,15 @@ describe('v2alpha.UserEventServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index cc2e587c18e..0578a311be5 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -30,6 +30,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -219,26 +234,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.UserEvent() ); client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); const [response] = await client.writeUserEvent(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent without error using callback', async () => { @@ -250,15 +264,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.retail.v2beta.UserEvent() ); @@ -281,11 +291,14 @@ describe('v2beta.UserEventServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent with error', async () => { @@ -297,26 +310,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.writeUserEvent = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.writeUserEvent(request), expectedError); - assert( - (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.writeUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes writeUserEvent with closed client', async () => { @@ -328,7 +340,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.writeUserEvent(request), expectedError); @@ -345,26 +360,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); const [response] = await client.collectUserEvent(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent without error using callback', async () => { @@ -376,15 +390,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -404,11 +414,14 @@ describe('v2beta.UserEventServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent with error', async () => { @@ -420,26 +433,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.collectUserEvent = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.collectUserEvent(request), expectedError); - assert( - (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.collectUserEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes collectUserEvent with closed client', async () => { @@ -451,7 +463,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.collectUserEvent(request), expectedError); @@ -468,15 +483,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -485,11 +496,14 @@ describe('v2beta.UserEventServiceClient', () => { const [operation] = await client.purgeUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents without error using callback', async () => { @@ -501,15 +515,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -539,11 +549,14 @@ describe('v2beta.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents with call error', async () => { @@ -555,26 +568,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.purgeUserEvents(request), expectedError); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes purgeUserEvents with LRO error', async () => { @@ -586,15 +598,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.purgeUserEvents = stubLongRunningCall( undefined, @@ -603,11 +611,14 @@ describe('v2beta.UserEventServiceClient', () => { ); const [operation] = await client.purgeUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.purgeUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkPurgeUserEventsProgress without error', async () => { @@ -662,15 +673,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -679,11 +686,14 @@ describe('v2beta.UserEventServiceClient', () => { const [operation] = await client.importUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents without error using callback', async () => { @@ -695,15 +705,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -733,11 +739,14 @@ describe('v2beta.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents with call error', async () => { @@ -749,26 +758,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.importUserEvents(request), expectedError); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes importUserEvents with LRO error', async () => { @@ -780,15 +788,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.importUserEvents = stubLongRunningCall( undefined, @@ -797,11 +801,14 @@ describe('v2beta.UserEventServiceClient', () => { ); const [operation] = await client.importUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkImportUserEventsProgress without error', async () => { @@ -856,15 +863,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -873,11 +876,14 @@ describe('v2beta.UserEventServiceClient', () => { const [operation] = await client.rejoinUserEvents(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents without error using callback', async () => { @@ -889,15 +895,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -927,11 +929,14 @@ describe('v2beta.UserEventServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents with call error', async () => { @@ -943,26 +948,25 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.rejoinUserEvents(request), expectedError); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rejoinUserEvents with LRO error', async () => { @@ -974,15 +978,11 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rejoinUserEvents = stubLongRunningCall( undefined, @@ -991,11 +991,14 @@ describe('v2beta.UserEventServiceClient', () => { ); const [operation] = await client.rejoinUserEvents(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rejoinUserEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkRejoinUserEventsProgress without error', async () => { @@ -1186,12 +1189,15 @@ describe('v2beta.UserEventServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1222,12 +1228,15 @@ describe('v2beta.UserEventServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -1812,6 +1821,82 @@ describe('v2beta.UserEventServiceClient', () => { }); }); + describe('model', () => { + const fakePath = '/rendered/path/model'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + catalog: 'catalogValue', + model: 'modelValue', + }; + const client = new usereventserviceModule.v2beta.UserEventServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.modelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.modelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('modelPath', () => { + const result = client.modelPath( + 'projectValue', + 'locationValue', + 'catalogValue', + 'modelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.modelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromModelName', () => { + const result = client.matchProjectFromModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromModelName', () => { + const result = client.matchLocationFromModelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCatalogFromModelName', () => { + const result = client.matchCatalogFromModelName(fakePath); + assert.strictEqual(result, 'catalogValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchModelFromModelName', () => { + const result = client.matchModelFromModelName(fakePath); + assert.strictEqual(result, 'modelValue'); + assert( + (client.pathTemplates.modelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('product', () => { const fakePath = '/rendered/path/product'; const expectedParameters = { From 8a72f9579aefa4a7d454507df2ab88584bd85239 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 20 Sep 2022 16:51:17 -0700 Subject: [PATCH 096/103] chore(main): release 2.1.0 (#193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 2.1.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-retail/CHANGELOG.md | 42 +++++++++++++++++++ packages/google-cloud-retail/package.json | 2 +- ...ippet_metadata.google.cloud.retail.v2.json | 2 +- ..._metadata.google.cloud.retail.v2alpha.json | 2 +- ...t_metadata.google.cloud.retail.v2beta.json | 2 +- .../google-cloud-retail/samples/package.json | 2 +- 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index 889b81105ef..ca5b4c194af 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +## [2.1.0](https://github.com/googleapis/nodejs-retail/compare/v2.0.0...v2.1.0) (2022-09-20) + + +### Features + +* add local inventories info to the Product resource ([166a195](https://github.com/googleapis/nodejs-retail/commit/166a195d3d8b2d858418a6058ee72c5dd9036463)) +* allow adding labels in search requests ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow adding labels in search requests ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow disabling spell check in search requests ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow disabling spell check in search requests ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow enabling recommendation filtering on custom attributes ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow enabling recommendation filtering on custom attributes ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow returning min/max values on search numeric facets ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow returning min/max values on search numeric facets ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow skiping default branch protection when doing product full import ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow to return min/max values on search numeric facets ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow to use serving configs as an alias of placements ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow using serving configs as an alias of placements ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* allow using serving configs as an alias of placements ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* Model Services, BatchRemoveCatalogAttributes, ExactSearchableOption ([be33b58](https://github.com/googleapis/nodejs-retail/commit/be33b5817ce85ca245fc08a9598c7c1b48cb84fc)) +* new model service to manage recommendation models ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* release AttributesConfig APIs to v2 version ([166a195](https://github.com/googleapis/nodejs-retail/commit/166a195d3d8b2d858418a6058ee72c5dd9036463)) +* release CompletionConfig APIs to v2 version ([166a195](https://github.com/googleapis/nodejs-retail/commit/166a195d3d8b2d858418a6058ee72c5dd9036463)) +* release Control and ServingConfig serivces to v2 version ([166a195](https://github.com/googleapis/nodejs-retail/commit/166a195d3d8b2d858418a6058ee72c5dd9036463)) +* return output BigQuery table on product / event export response ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* return output BigQuery table on product / event export response ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* support case insensitive match on search facets ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* support case insensitive match on search facets ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* support case insensitive match on search facets ([b20cb74](https://github.com/googleapis/nodejs-retail/commit/b20cb7417e6e8daf3745d75224b2ea87a21680a1)) +* Support regapic LRO ([c074f6c](https://github.com/googleapis/nodejs-retail/commit/c074f6c8125d16e375c6c0bc8bae6b2e84ed56f9)) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#206](https://github.com/googleapis/nodejs-retail/issues/206)) ([166a195](https://github.com/googleapis/nodejs-retail/commit/166a195d3d8b2d858418a6058ee72c5dd9036463)) +* Better support for fallback mode ([#204](https://github.com/googleapis/nodejs-retail/issues/204)) ([4256e26](https://github.com/googleapis/nodejs-retail/commit/4256e2690e9d66a9083a13962b8f9f706e4db710)) +* Change import long to require ([#205](https://github.com/googleapis/nodejs-retail/issues/205)) ([9acff3d](https://github.com/googleapis/nodejs-retail/commit/9acff3daf2571f5a087f85882ed50b23be52d4e8)) +* **deps:** Update dependency @google-cloud/storage to v6 ([#185](https://github.com/googleapis/nodejs-retail/issues/185)) ([d0e7c2f](https://github.com/googleapis/nodejs-retail/commit/d0e7c2fdd9306c8b162a4b1bd676937f60bcd1cb)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-retail/issues/1553)) ([#208](https://github.com/googleapis/nodejs-retail/issues/208)) ([a079b82](https://github.com/googleapis/nodejs-retail/commit/a079b82805b9550d9a7772ec620d70e5d28bc5a2)) +* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-retail/issues/1546)) ([#207](https://github.com/googleapis/nodejs-retail/issues/207)) ([b742392](https://github.com/googleapis/nodejs-retail/commit/b7423929a30f635880eff37f479f95498cbfcde5)) +* use google-gax v3.3.0 ([a079b82](https://github.com/googleapis/nodejs-retail/commit/a079b82805b9550d9a7772ec620d70e5d28bc5a2)) + ## [2.0.0](https://github.com/googleapis/nodejs-retail/compare/v1.8.1...v2.0.0) (2022-06-20) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 801300cddd3..850e4f0e378 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "2.0.0", + "version": "2.1.0", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 21749b266a3..72503ee9959 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "2.0.0", + "version": "2.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index 134afe8d94a..b315bc7c5b7 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "2.0.0", + "version": "2.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index b21c74bc887..97f2fc52f5a 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "2.0.0", + "version": "2.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index 0794a15e611..a1e9c64d61b 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^2.0.0", + "@google-cloud/retail": "^2.1.0", "@google-cloud/bigquery": "^6.0.0", "@google-cloud/storage": "^6.0.0" }, From 3a022576b1d5d3de23ecfc311e78ad6a265f1d60 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 28 Sep 2022 17:50:22 +0000 Subject: [PATCH 097/103] test: use fully qualified type names (#218) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 477369320 Source-Link: https://github.com/googleapis/googleapis/commit/6954c4da0f0ca8198157c9ad3507674e2ba608e7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/81e5272671bd1c5c8ac15a44bd25922f0b93eae6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODFlNTI3MjY3MWJkMWM1YzhhYzE1YTQ0YmQyNTkyMmYwYjkzZWFlNiJ9 chore: override API mixins when needed PiperOrigin-RevId: 477248447 Source-Link: https://github.com/googleapis/googleapis/commit/4689c7380444972caf11fd1b96e7ec1f864b7dfb Source-Link: https://github.com/googleapis/googleapis-gen/commit/c4059786a5cd805a0151d95b477fbc486bcbcedc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQwNTk3ODZhNWNkODA1YTAxNTFkOTViNDc3ZmJjNDg2YmNiY2VkYyJ9 chore: revert removal of LRO mixin PiperOrigin-RevId: 476177134 Source-Link: https://github.com/googleapis/googleapis/commit/174b42d8190c6608153133f9c0dc51e7a8f9d3b0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/9b252d4e53b1dffc40f74d57654fc4ab1cfc0f54 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWIyNTJkNGU1M2IxZGZmYzQwZjc0ZDU3NjU0ZmM0YWIxY2ZjMGY1NCJ9 test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: https://github.com/googleapis/googleapis/commit/7a129736313ceb1f277c3b7f7e16d2e04cc901dd Source-Link: https://github.com/googleapis/googleapis-gen/commit/370c729e2ba062a167449c27882ba5f379c5c34d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 --- .../test/gapic_catalog_service_v2.ts | 253 +++++++------- .../test/gapic_catalog_service_v2alpha.ts | 253 +++++++------- .../test/gapic_catalog_service_v2beta.ts | 261 +++++++------- .../test/gapic_completion_service_v2.ts | 56 ++-- .../test/gapic_completion_service_v2alpha.ts | 56 ++-- .../test/gapic_completion_service_v2beta.ts | 56 ++-- .../test/gapic_control_service_v2.ts | 157 +++++---- .../test/gapic_control_service_v2alpha.ts | 157 +++++---- .../test/gapic_control_service_v2beta.ts | 157 +++++---- .../test/gapic_model_service_v2alpha.ts | 189 +++++++---- .../test/gapic_model_service_v2beta.ts | 189 +++++++---- .../test/gapic_prediction_service_v2.ts | 28 +- .../test/gapic_prediction_service_v2alpha.ts | 28 +- .../test/gapic_prediction_service_v2beta.ts | 28 +- .../test/gapic_product_service_v2.ts | 289 +++++++++------- .../test/gapic_product_service_v2alpha.ts | 317 ++++++++++-------- .../test/gapic_product_service_v2beta.ts | 289 +++++++++------- .../test/gapic_search_service_v2.ts | 35 +- .../test/gapic_search_service_v2alpha.ts | 35 +- .../test/gapic_search_service_v2beta.ts | 35 +- .../test/gapic_serving_config_service_v2.ts | 221 ++++++------ .../gapic_serving_config_service_v2alpha.ts | 221 ++++++------ .../gapic_serving_config_service_v2beta.ts | 221 ++++++------ .../test/gapic_user_event_service_v2.ts | 140 ++++---- .../test/gapic_user_event_service_v2alpha.ts | 140 ++++---- .../test/gapic_user_event_service_v2beta.ts | 140 ++++---- 26 files changed, 2296 insertions(+), 1655 deletions(-) diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts index 5a68219dcb1..5ba3c5b3c7a 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2.ts @@ -238,10 +238,10 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -270,10 +270,10 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -318,10 +318,10 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -350,10 +350,10 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -371,9 +371,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -401,9 +402,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -447,9 +449,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -477,9 +480,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -497,9 +501,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -527,9 +532,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -573,9 +579,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -603,9 +610,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -623,9 +631,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -654,9 +663,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -700,9 +710,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -730,9 +741,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -752,7 +764,7 @@ describe('v2.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -785,7 +797,7 @@ describe('v2.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -833,7 +845,7 @@ describe('v2.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -868,7 +880,7 @@ describe('v2.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -891,9 +903,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -922,9 +935,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -968,9 +982,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -998,9 +1013,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1020,7 +1036,7 @@ describe('v2.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1053,7 +1069,7 @@ describe('v2.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1101,7 +1117,7 @@ describe('v2.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1136,7 +1152,7 @@ describe('v2.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1159,9 +1175,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1190,9 +1207,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1236,9 +1254,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1266,9 +1285,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1287,7 +1307,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1319,7 +1339,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1366,7 +1386,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1400,7 +1420,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1424,7 +1444,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1456,7 +1476,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1503,7 +1523,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1537,7 +1557,7 @@ describe('v2.CatalogServiceClient', () => { new protos.google.cloud.retail.v2.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1560,9 +1580,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1592,9 +1613,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1640,9 +1662,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1670,9 +1693,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1720,9 +1744,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1767,9 +1792,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1809,9 +1835,10 @@ describe('v2.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts index 771d2cfef7c..64ae0b5c311 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2alpha.ts @@ -238,10 +238,10 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -270,10 +270,10 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -318,10 +318,10 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -350,10 +350,10 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -371,9 +371,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -401,9 +402,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -447,9 +449,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -477,9 +480,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -497,9 +501,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -527,9 +532,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -573,9 +579,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -603,9 +610,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -623,9 +631,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -654,9 +663,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -700,9 +710,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -730,9 +741,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -752,7 +764,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -785,7 +797,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -833,7 +845,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -868,7 +880,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -891,9 +903,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -922,9 +935,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -968,9 +982,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -998,9 +1013,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1020,7 +1036,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1053,7 +1069,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1101,7 +1117,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1136,7 +1152,7 @@ describe('v2alpha.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1159,9 +1175,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1190,9 +1207,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1236,9 +1254,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1266,9 +1285,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1287,7 +1307,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1319,7 +1339,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1366,7 +1386,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1400,7 +1420,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1424,7 +1444,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1456,7 +1476,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1503,7 +1523,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1537,7 +1557,7 @@ describe('v2alpha.CatalogServiceClient', () => { new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1560,9 +1580,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1592,9 +1613,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1640,9 +1662,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1670,9 +1693,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1723,9 +1747,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1773,9 +1798,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1815,9 +1841,10 @@ describe('v2alpha.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts index 02445c1f3fd..c24f91ecb78 100644 --- a/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_catalog_service_v2beta.ts @@ -238,10 +238,10 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -270,10 +270,10 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -318,10 +318,10 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedHeaderRequestParams = `catalog.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -350,10 +350,10 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateCatalogRequest() ); request.catalog ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateCatalogRequest', [ - 'catalog', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateCatalogRequest', + ['catalog', 'name'] + ); request.catalog.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -371,9 +371,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -401,9 +402,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -447,9 +449,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -477,9 +480,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('SetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -497,9 +501,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -527,9 +532,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -573,9 +579,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -603,9 +610,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetDefaultBranchRequest() ); - const defaultValue1 = getTypeDefaultValue('GetDefaultBranchRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetDefaultBranchRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -623,9 +631,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -654,9 +663,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -700,9 +710,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -730,9 +741,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetCompletionConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetCompletionConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetCompletionConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -752,7 +764,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2beta.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -785,7 +797,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2beta.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -833,7 +845,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2beta.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -868,7 +880,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.completionConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateCompletionConfigRequest', + '.google.cloud.retail.v2beta.UpdateCompletionConfigRequest', ['completionConfig', 'name'] ); request.completionConfig.name = defaultValue1; @@ -891,9 +903,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -922,9 +935,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -968,9 +982,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -998,9 +1013,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetAttributesConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetAttributesConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetAttributesConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1020,7 +1036,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2beta.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1053,7 +1069,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2beta.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1101,7 +1117,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2beta.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1136,7 +1152,7 @@ describe('v2beta.CatalogServiceClient', () => { ); request.attributesConfig ??= {}; const defaultValue1 = getTypeDefaultValue( - 'UpdateAttributesConfigRequest', + '.google.cloud.retail.v2beta.UpdateAttributesConfigRequest', ['attributesConfig', 'name'] ); request.attributesConfig.name = defaultValue1; @@ -1159,9 +1175,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1190,9 +1207,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1236,9 +1254,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedHeaderRequestParams = `attributes_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1266,9 +1285,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddCatalogAttributeRequest() ); - const defaultValue1 = getTypeDefaultValue('AddCatalogAttributeRequest', [ - 'attributesConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddCatalogAttributeRequest', + ['attributesConfig'] + ); request.attributesConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1287,7 +1307,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1319,7 +1339,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1366,7 +1386,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1400,7 +1420,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveCatalogAttributeRequest', + '.google.cloud.retail.v2beta.RemoveCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1424,7 +1444,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'BatchRemoveCatalogAttributesRequest', + '.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1456,7 +1476,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'BatchRemoveCatalogAttributesRequest', + '.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1503,7 +1523,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'BatchRemoveCatalogAttributesRequest', + '.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1537,7 +1557,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'BatchRemoveCatalogAttributesRequest', + '.google.cloud.retail.v2beta.BatchRemoveCatalogAttributesRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1561,7 +1581,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1593,7 +1613,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1640,7 +1660,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1674,7 +1694,7 @@ describe('v2beta.CatalogServiceClient', () => { new protos.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ReplaceCatalogAttributeRequest', + '.google.cloud.retail.v2beta.ReplaceCatalogAttributeRequest', ['attributesConfig'] ); request.attributesConfig = defaultValue1; @@ -1697,9 +1717,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1729,9 +1750,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1777,9 +1799,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1807,9 +1830,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1860,9 +1884,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1910,9 +1935,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1952,9 +1978,10 @@ describe('v2beta.CatalogServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListCatalogsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListCatalogsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListCatalogsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts index 29a478c7029..4d4026f71bb 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2.ts @@ -234,9 +234,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -264,9 +265,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -310,9 +312,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -340,9 +343,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -360,9 +364,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -392,9 +397,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -445,9 +451,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -475,9 +482,10 @@ describe('v2.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts index f48ecc7d394..81af904d155 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2alpha.ts @@ -242,9 +242,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -273,9 +274,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -320,9 +322,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -351,9 +354,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -372,9 +376,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -405,9 +410,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -459,9 +465,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -490,9 +497,10 @@ describe('v2alpha.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts index 501f17dcfe2..8884b5a0ced 100644 --- a/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_completion_service_v2beta.ts @@ -249,9 +249,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -281,9 +282,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -329,9 +331,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedHeaderRequestParams = `catalog=${defaultValue1}`; const expectedError = new Error('expected'); @@ -361,9 +364,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CompleteQueryRequest() ); - const defaultValue1 = getTypeDefaultValue('CompleteQueryRequest', [ - 'catalog', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CompleteQueryRequest', + ['catalog'] + ); request.catalog = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -383,9 +387,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -417,9 +422,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -472,9 +478,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -504,9 +511,10 @@ describe('v2beta.CompletionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportCompletionDataRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportCompletionDataRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportCompletionDataRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2.ts b/packages/google-cloud-retail/test/gapic_control_service_v2.ts index 38a7237b58d..743368fabf8 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2.ts @@ -237,9 +237,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -267,9 +268,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -313,9 +315,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -343,9 +346,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -363,9 +367,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -393,9 +398,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -439,9 +445,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -469,9 +476,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -490,10 +498,10 @@ describe('v2.ControlServiceClient', () => { new protos.google.cloud.retail.v2.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -522,10 +530,10 @@ describe('v2.ControlServiceClient', () => { new protos.google.cloud.retail.v2.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -570,10 +578,10 @@ describe('v2.ControlServiceClient', () => { new protos.google.cloud.retail.v2.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -602,10 +610,10 @@ describe('v2.ControlServiceClient', () => { new protos.google.cloud.retail.v2.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -623,7 +631,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -651,7 +662,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -695,7 +709,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -723,7 +740,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -741,9 +761,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -773,9 +794,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -821,9 +843,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -851,9 +874,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -901,9 +925,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -948,9 +973,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -990,9 +1016,10 @@ describe('v2.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts index 6b1eeb28690..9a8f29da17e 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2alpha.ts @@ -237,9 +237,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -267,9 +268,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -313,9 +315,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -343,9 +346,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -363,9 +367,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -393,9 +398,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -439,9 +445,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -469,9 +476,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -490,10 +498,10 @@ describe('v2alpha.ControlServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -522,10 +530,10 @@ describe('v2alpha.ControlServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -570,10 +578,10 @@ describe('v2alpha.ControlServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -602,10 +610,10 @@ describe('v2alpha.ControlServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -623,7 +631,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -651,7 +662,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -695,7 +709,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -723,7 +740,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -741,9 +761,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -773,9 +794,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -821,9 +843,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -851,9 +874,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -904,9 +928,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -954,9 +979,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -996,9 +1022,10 @@ describe('v2alpha.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts index ac93d3ab474..97c5e698653 100644 --- a/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_control_service_v2beta.ts @@ -237,9 +237,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -267,9 +268,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -313,9 +315,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -343,9 +346,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateControlRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateControlRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateControlRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -363,9 +367,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -393,9 +398,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -439,9 +445,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -469,9 +476,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteControlRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteControlRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -490,10 +498,10 @@ describe('v2beta.ControlServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -522,10 +530,10 @@ describe('v2beta.ControlServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -570,10 +578,10 @@ describe('v2beta.ControlServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedHeaderRequestParams = `control.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -602,10 +610,10 @@ describe('v2beta.ControlServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateControlRequest() ); request.control ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateControlRequest', [ - 'control', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateControlRequest', + ['control', 'name'] + ); request.control.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -623,7 +631,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -651,7 +662,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -695,7 +709,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -723,7 +740,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetControlRequest() ); - const defaultValue1 = getTypeDefaultValue('GetControlRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetControlRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -741,9 +761,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -773,9 +794,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -821,9 +843,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -851,9 +874,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -904,9 +928,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -954,9 +979,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -996,9 +1022,10 @@ describe('v2beta.ControlServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListControlsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListControlsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListControlsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts index cf393194a0c..0152b44a329 100644 --- a/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_model_service_v2alpha.ts @@ -274,7 +274,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -302,7 +305,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -346,7 +352,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -374,7 +383,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -392,7 +404,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -420,7 +435,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -464,7 +482,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -492,7 +513,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -510,7 +534,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -538,7 +565,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -582,7 +612,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -610,7 +643,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -629,10 +665,10 @@ describe('v2alpha.ModelServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -661,10 +697,10 @@ describe('v2alpha.ModelServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -709,10 +745,10 @@ describe('v2alpha.ModelServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -741,10 +777,10 @@ describe('v2alpha.ModelServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -762,9 +798,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -793,9 +830,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -846,9 +884,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -876,9 +915,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -948,7 +988,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -977,7 +1020,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1028,7 +1074,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1056,7 +1105,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1126,9 +1178,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1158,9 +1211,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1206,9 +1260,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1236,9 +1291,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1289,9 +1345,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1339,9 +1396,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1381,9 +1439,10 @@ describe('v2alpha.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts index 873631d0b29..68cc5ecaa5e 100644 --- a/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_model_service_v2beta.ts @@ -274,7 +274,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -302,7 +305,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -346,7 +352,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -374,7 +383,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PauseModelRequest() ); - const defaultValue1 = getTypeDefaultValue('PauseModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PauseModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -392,7 +404,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -420,7 +435,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -464,7 +482,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -492,7 +513,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ResumeModelRequest() ); - const defaultValue1 = getTypeDefaultValue('ResumeModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ResumeModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -510,7 +534,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -538,7 +565,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -582,7 +612,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -610,7 +643,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteModelRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -629,10 +665,10 @@ describe('v2beta.ModelServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -661,10 +697,10 @@ describe('v2beta.ModelServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -709,10 +745,10 @@ describe('v2beta.ModelServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedHeaderRequestParams = `model.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -741,10 +777,10 @@ describe('v2beta.ModelServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateModelRequest() ); request.model ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateModelRequest', [ - 'model', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateModelRequest', + ['model', 'name'] + ); request.model.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -762,9 +798,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -793,9 +830,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -846,9 +884,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -876,9 +915,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateModelRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateModelRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateModelRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -948,7 +988,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -977,7 +1020,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1028,7 +1074,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1056,7 +1105,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.TuneModelRequest() ); - const defaultValue1 = getTypeDefaultValue('TuneModelRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.TuneModelRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1126,9 +1178,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1158,9 +1211,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1206,9 +1260,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1236,9 +1291,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1289,9 +1345,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1339,9 +1396,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1381,9 +1439,10 @@ describe('v2beta.ModelServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListModelsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListModelsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListModelsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts index c2231a2935c..6b9559a4537 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2.ts @@ -197,9 +197,10 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -227,9 +228,10 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -273,9 +275,10 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -300,9 +303,10 @@ describe('v2.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts index ad8716f3052..d2eadb2f26e 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2alpha.ts @@ -205,9 +205,10 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -236,9 +237,10 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -283,9 +285,10 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -311,9 +314,10 @@ describe('v2alpha.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); diff --git a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts index b6039372430..c66a4dd8a47 100644 --- a/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_prediction_service_v2beta.ts @@ -212,9 +212,10 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -244,9 +245,10 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -292,9 +294,10 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -321,9 +324,10 @@ describe('v2beta.PredictionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PredictRequest() ); - const defaultValue1 = getTypeDefaultValue('PredictRequest', [ - 'placement', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PredictRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2.ts b/packages/google-cloud-retail/test/gapic_product_service_v2.ts index 8b636b09549..ca7e4f8f11f 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2.ts @@ -274,9 +274,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -304,9 +305,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -350,9 +352,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -380,9 +383,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -400,7 +404,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -428,7 +435,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -472,7 +482,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -500,7 +513,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -519,10 +535,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -551,10 +567,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -599,10 +615,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -631,10 +647,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -652,9 +668,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -682,9 +699,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -728,9 +746,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -758,9 +777,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -778,9 +798,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -810,9 +831,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -863,9 +885,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -893,9 +916,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -969,10 +993,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1002,10 +1026,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1057,10 +1081,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1089,10 +1113,10 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1162,9 +1186,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1194,9 +1219,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1247,9 +1273,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1277,9 +1304,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1353,7 +1381,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1386,7 +1414,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1440,7 +1468,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1474,7 +1502,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1550,9 +1578,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1582,9 +1611,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1635,9 +1665,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1665,9 +1696,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1741,7 +1773,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1774,7 +1806,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1828,7 +1860,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1862,7 +1894,7 @@ describe('v2.ProductServiceClient', () => { new protos.google.cloud.retail.v2.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1937,9 +1969,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1969,9 +2002,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2017,9 +2051,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2047,9 +2082,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2097,9 +2133,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2144,9 +2181,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2186,9 +2224,10 @@ describe('v2.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts index e3b08937a7e..d5069580f7d 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2alpha.ts @@ -274,9 +274,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -304,9 +305,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -350,9 +352,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -380,9 +383,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -400,7 +404,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -428,7 +435,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -472,7 +482,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -500,7 +513,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -519,10 +535,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -551,10 +567,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -599,10 +615,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -631,10 +647,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -652,9 +668,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -682,9 +699,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -728,9 +746,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -758,9 +777,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -778,9 +798,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -810,9 +831,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -863,9 +885,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -893,9 +916,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -968,9 +992,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1000,9 +1025,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1053,9 +1079,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1083,9 +1110,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1159,10 +1187,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1192,10 +1220,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1247,10 +1275,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1279,10 +1307,10 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1352,9 +1380,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1384,9 +1413,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1437,9 +1467,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1467,9 +1498,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1543,7 +1575,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1576,7 +1608,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1630,7 +1662,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1664,7 +1696,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1740,9 +1772,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1772,9 +1805,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1825,9 +1859,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1855,9 +1890,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1931,7 +1967,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1964,7 +2000,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -2018,7 +2054,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -2052,7 +2088,7 @@ describe('v2alpha.ProductServiceClient', () => { new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -2127,9 +2163,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2159,9 +2196,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2207,9 +2245,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2237,9 +2276,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2290,9 +2330,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2340,9 +2381,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2382,9 +2424,10 @@ describe('v2alpha.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts index 3747db6783d..660a9af5ab2 100644 --- a/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_product_service_v2beta.ts @@ -274,9 +274,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -304,9 +305,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -350,9 +352,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -380,9 +383,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateProductRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateProductRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateProductRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -400,7 +404,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -428,7 +435,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -472,7 +482,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -500,7 +513,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetProductRequest() ); - const defaultValue1 = getTypeDefaultValue('GetProductRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -519,10 +535,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -551,10 +567,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -599,10 +615,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedHeaderRequestParams = `product.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -631,10 +647,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateProductRequest() ); request.product ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateProductRequest', [ - 'product', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateProductRequest', + ['product', 'name'] + ); request.product.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -652,9 +668,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -682,9 +699,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -728,9 +746,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -758,9 +777,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteProductRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteProductRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteProductRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -778,9 +798,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -810,9 +831,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -863,9 +885,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -893,9 +916,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -969,10 +993,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1002,10 +1026,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1057,10 +1081,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1089,10 +1113,10 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.SetInventoryRequest() ); request.inventory ??= {}; - const defaultValue1 = getTypeDefaultValue('SetInventoryRequest', [ - 'inventory', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SetInventoryRequest', + ['inventory', 'name'] + ); request.inventory.name = defaultValue1; const expectedHeaderRequestParams = `inventory.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1162,9 +1186,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1194,9 +1219,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1247,9 +1273,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1277,9 +1304,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddFulfillmentPlacesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddFulfillmentPlacesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1353,7 +1381,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1386,7 +1414,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1440,7 +1468,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1474,7 +1502,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveFulfillmentPlacesRequest', + '.google.cloud.retail.v2beta.RemoveFulfillmentPlacesRequest', ['product'] ); request.product = defaultValue1; @@ -1550,9 +1578,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1582,9 +1611,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1635,9 +1665,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1665,9 +1696,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddLocalInventoriesRequest() ); - const defaultValue1 = getTypeDefaultValue('AddLocalInventoriesRequest', [ - 'product', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddLocalInventoriesRequest', + ['product'] + ); request.product = defaultValue1; const expectedHeaderRequestParams = `product=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1741,7 +1773,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1774,7 +1806,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1828,7 +1860,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1862,7 +1894,7 @@ describe('v2beta.ProductServiceClient', () => { new protos.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RemoveLocalInventoriesRequest', + '.google.cloud.retail.v2beta.RemoveLocalInventoriesRequest', ['product'] ); request.product = defaultValue1; @@ -1937,9 +1969,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1969,9 +2002,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2017,9 +2051,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2047,9 +2082,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2100,9 +2136,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2150,9 +2187,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -2192,9 +2230,10 @@ describe('v2beta.ProductServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListProductsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListProductsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListProductsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2.ts b/packages/google-cloud-retail/test/gapic_search_service_v2.ts index 1ea1309ddbe..4de050e5d16 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2.ts @@ -237,7 +237,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -273,7 +276,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -327,7 +333,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -352,7 +361,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -412,7 +424,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -463,7 +478,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -509,7 +527,10 @@ describe('v2.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts index b7357f949f7..950a2d19973 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2alpha.ts @@ -237,7 +237,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -273,7 +276,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -327,7 +333,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -352,7 +361,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -412,7 +424,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -463,7 +478,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -509,7 +527,10 @@ describe('v2alpha.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts index 291b995b141..478f1e4a2e5 100644 --- a/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_search_service_v2beta.ts @@ -237,7 +237,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -273,7 +276,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -327,7 +333,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -352,7 +361,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -412,7 +424,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); @@ -463,7 +478,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedResponse = [ @@ -509,7 +527,10 @@ describe('v2beta.SearchServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.SearchRequest() ); - const defaultValue1 = getTypeDefaultValue('SearchRequest', ['placement']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.SearchRequest', + ['placement'] + ); request.placement = defaultValue1; const expectedHeaderRequestParams = `placement=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts index 747b7737286..346b6342ef0 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2.ts @@ -246,9 +246,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -278,9 +279,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -325,9 +327,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -356,9 +359,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -377,9 +381,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -409,9 +414,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -456,9 +462,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -487,9 +494,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -509,10 +517,10 @@ describe('v2.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -543,10 +551,10 @@ describe('v2.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -592,10 +600,10 @@ describe('v2.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -625,10 +633,10 @@ describe('v2.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -647,9 +655,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -678,9 +687,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -725,9 +735,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -756,9 +767,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -777,9 +789,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -808,9 +821,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -855,9 +869,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -886,9 +901,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -907,9 +923,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -938,9 +955,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -985,9 +1003,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1016,9 +1035,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1037,9 +1057,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1077,9 +1098,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1132,9 +1154,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1163,9 +1186,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1223,9 +1247,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1272,9 +1297,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1321,9 +1347,10 @@ describe('v2.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts index 2e320f159d0..774f8047da0 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2alpha.ts @@ -248,9 +248,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -280,9 +281,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -327,9 +329,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -358,9 +361,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -379,9 +383,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -411,9 +416,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -458,9 +464,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -489,9 +496,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -511,10 +519,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -545,10 +553,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -594,10 +602,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -627,10 +635,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -649,9 +657,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -680,9 +689,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -727,9 +737,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -758,9 +769,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -779,9 +791,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -810,9 +823,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -857,9 +871,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -888,9 +903,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -909,9 +925,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -940,9 +957,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -987,9 +1005,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1018,9 +1037,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1039,9 +1059,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1079,9 +1100,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1134,9 +1156,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1165,9 +1188,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1226,9 +1250,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1276,9 +1301,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1325,9 +1351,10 @@ describe('v2alpha.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts index 199dd19ee0b..6118920ca29 100644 --- a/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_serving_config_service_v2beta.ts @@ -248,9 +248,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -280,9 +281,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -327,9 +329,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -358,9 +361,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CreateServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateServingConfigRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CreateServingConfigRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -379,9 +383,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -411,9 +416,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -458,9 +464,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -489,9 +496,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.DeleteServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.DeleteServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -511,10 +519,10 @@ describe('v2beta.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -545,10 +553,10 @@ describe('v2beta.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -594,10 +602,10 @@ describe('v2beta.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedHeaderRequestParams = `serving_config.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -627,10 +635,10 @@ describe('v2beta.ServingConfigServiceClient', () => { new protos.google.cloud.retail.v2beta.UpdateServingConfigRequest() ); request.servingConfig ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateServingConfigRequest', [ - 'servingConfig', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.UpdateServingConfigRequest', + ['servingConfig', 'name'] + ); request.servingConfig.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -649,9 +657,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -680,9 +689,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -727,9 +737,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -758,9 +769,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.GetServingConfigRequest() ); - const defaultValue1 = getTypeDefaultValue('GetServingConfigRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.GetServingConfigRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -779,9 +791,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -810,9 +823,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -857,9 +871,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -888,9 +903,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.AddControlRequest() ); - const defaultValue1 = getTypeDefaultValue('AddControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.AddControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -909,9 +925,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -940,9 +957,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -987,9 +1005,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedHeaderRequestParams = `serving_config=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1018,9 +1037,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RemoveControlRequest() ); - const defaultValue1 = getTypeDefaultValue('RemoveControlRequest', [ - 'servingConfig', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RemoveControlRequest', + ['servingConfig'] + ); request.servingConfig = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1039,9 +1059,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1079,9 +1100,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1134,9 +1156,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1165,9 +1188,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1225,9 +1249,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1274,9 +1299,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -1323,9 +1349,10 @@ describe('v2beta.ServingConfigServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ListServingConfigsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListServingConfigsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ListServingConfigsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts index f16879e1ad4..7c64b40f5ae 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2.ts @@ -234,9 +234,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -264,9 +265,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -310,9 +312,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -340,9 +343,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -360,9 +364,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -390,9 +395,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -433,9 +439,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -463,9 +470,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -483,9 +491,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -515,9 +524,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -568,9 +578,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -598,9 +609,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -673,9 +685,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -705,9 +718,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -758,9 +772,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -788,9 +803,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -863,9 +879,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -895,9 +912,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -948,9 +966,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -978,9 +997,10 @@ describe('v2.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts index c7a6fcc2b95..7ed133b4807 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2alpha.ts @@ -235,9 +235,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -265,9 +266,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -311,9 +313,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -341,9 +344,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -361,9 +365,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -391,9 +396,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -434,9 +440,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -464,9 +471,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -484,9 +492,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -516,9 +525,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -569,9 +579,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -599,9 +610,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -674,9 +686,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -706,9 +719,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -759,9 +773,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -789,9 +804,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -864,9 +880,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -896,9 +913,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -949,9 +967,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -979,9 +998,10 @@ describe('v2alpha.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2alpha.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts index 0578a311be5..fce1c1fb696 100644 --- a/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts +++ b/packages/google-cloud-retail/test/gapic_user_event_service_v2beta.ts @@ -234,9 +234,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -264,9 +265,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -310,9 +312,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -340,9 +343,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.WriteUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('WriteUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.WriteUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -360,9 +364,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -390,9 +395,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -433,9 +439,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -463,9 +470,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.CollectUserEventRequest() ); - const defaultValue1 = getTypeDefaultValue('CollectUserEventRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.CollectUserEventRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -483,9 +491,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -515,9 +524,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -568,9 +578,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -598,9 +609,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.PurgeUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('PurgeUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.PurgeUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -673,9 +685,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -705,9 +718,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -758,9 +772,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -788,9 +803,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.ImportUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('ImportUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.ImportUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -863,9 +879,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -895,9 +912,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -948,9 +966,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -978,9 +997,10 @@ describe('v2beta.UserEventServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.retail.v2beta.RejoinUserEventsRequest() ); - const defaultValue1 = getTypeDefaultValue('RejoinUserEventsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.retail.v2beta.RejoinUserEventsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); From bfdf5075458bdd082bc213ca9ee66513b774149e Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 16 Nov 2022 01:24:14 +0100 Subject: [PATCH 098/103] chore(deps): update dependency @types/node to v18 (#219) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^16.0.0` -> `^18.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/16.18.3/18.11.9) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/compatibility-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/confidence-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-retail). --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 850e4f0e378..c36795f956c 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@types/mocha": "^9.0.0", - "@types/node": "^16.0.0", + "@types/node": "^18.0.0", "@types/sinon": "^10.0.0", "c8": "^7.3.5", "gts": "^3.1.0", From 1d8a34148907c220c7a97adc1be46a0a70594677 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 16 Nov 2022 01:33:52 +0100 Subject: [PATCH 099/103] chore(deps): update dependency jsdoc to v4 (#223) --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index c36795f956c..46a7c3651f5 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -50,7 +50,7 @@ "@types/sinon": "^10.0.0", "c8": "^7.3.5", "gts": "^3.1.0", - "jsdoc": "^3.6.6", + "jsdoc": "^4.0.0", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", "linkinator": "^4.0.0", From b07becb4e8a791d0662b08b4c691dc027258dddd Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 15 Nov 2022 16:42:13 -0800 Subject: [PATCH 100/103] fix(deps): use google-gax v3.5.2 (#221) --- packages/google-cloud-retail/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 46a7c3651f5..5d0e3f8e309 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -42,7 +42,7 @@ "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { - "google-gax": "^3.3.0" + "google-gax": "^3.5.2" }, "devDependencies": { "@types/mocha": "^9.0.0", From 36bdec5e1bbf106f6d257bf3f48ef8c096033d6b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 15 Nov 2022 16:52:11 -0800 Subject: [PATCH 101/103] samples: pull in latest typeless bot, clean up some comments (#224) samples: pull in latest typeless bot, clean up some comments Source-Link: https://github.com/googleapis/synthtool/commit/0a68e568b6911b60bb6fd452eba4848b176031d8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:5b05f26103855c3a15433141389c478d1d3fe088fb5d4e3217c4793f6b3f245e Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> Co-authored-by: gcf-merge-on-green[bot] <60162190+gcf-merge-on-green[bot]@users.noreply.github.com> --- .../google-cloud-retail/protos/protos.d.ts | 2 +- packages/google-cloud-retail/protos/protos.js | 602 +++++++++++++++--- 2 files changed, 525 insertions(+), 79 deletions(-) diff --git a/packages/google-cloud-retail/protos/protos.d.ts b/packages/google-cloud-retail/protos/protos.d.ts index f6b467a7e74..1d348e9aa9b 100644 --- a/packages/google-cloud-retail/protos/protos.d.ts +++ b/packages/google-cloud-retail/protos/protos.d.ts @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Long = require("long"); import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-retail/protos/protos.js b/packages/google-cloud-retail/protos/protos.js index cff7afe8843..b8840714673 100644 --- a/packages/google-cloud-retail/protos/protos.js +++ b/packages/google-cloud-retail/protos/protos.js @@ -561,6 +561,12 @@ if (object.inUse != null) message.inUse = Boolean(object.inUse); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "UNKNOWN": case 0: message.type = 0; @@ -575,6 +581,12 @@ break; } switch (object.indexableOption) { + default: + if (typeof object.indexableOption === "number") { + message.indexableOption = object.indexableOption; + break; + } + break; case "INDEXABLE_OPTION_UNSPECIFIED": case 0: message.indexableOption = 0; @@ -589,6 +601,12 @@ break; } switch (object.dynamicFacetableOption) { + default: + if (typeof object.dynamicFacetableOption === "number") { + message.dynamicFacetableOption = object.dynamicFacetableOption; + break; + } + break; case "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": case 0: message.dynamicFacetableOption = 0; @@ -603,6 +621,12 @@ break; } switch (object.searchableOption) { + default: + if (typeof object.searchableOption === "number") { + message.searchableOption = object.searchableOption; + break; + } + break; case "SEARCHABLE_OPTION_UNSPECIFIED": case 0: message.searchableOption = 0; @@ -643,15 +667,15 @@ if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) - object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; + object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.IndexableOption[message.indexableOption] === undefined ? message.indexableOption : $root.google.cloud.retail.v2.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) - object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; + object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] === undefined ? message.dynamicFacetableOption : $root.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) - object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.SearchableOption[message.searchableOption] === undefined ? message.searchableOption : $root.google.cloud.retail.v2.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; if (message.inUse != null && message.hasOwnProperty("inUse")) object.inUse = message.inUse; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.AttributeType[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.retail.v2.CatalogAttribute.AttributeType[message.type] === undefined ? message.type : $root.google.cloud.retail.v2.CatalogAttribute.AttributeType[message.type] : message.type; return object; }; @@ -982,6 +1006,12 @@ } } switch (object.attributeConfigLevel) { + default: + if (typeof object.attributeConfigLevel === "number") { + message.attributeConfigLevel = object.attributeConfigLevel; + break; + } + break; case "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": case 0: message.attributeConfigLevel = 0; @@ -1026,7 +1056,7 @@ object.catalogAttributes[keys2[j]] = $root.google.cloud.retail.v2.CatalogAttribute.toObject(message.catalogAttributes[keys2[j]], options); } if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) - object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; + object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2.AttributeConfigLevel[message.attributeConfigLevel] === undefined ? message.attributeConfigLevel : $root.google.cloud.retail.v2.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; return object; }; @@ -9679,6 +9709,12 @@ message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } switch (object.reconciliationMode) { + default: + if (typeof object.reconciliationMode === "number") { + message.reconciliationMode = object.reconciliationMode; + break; + } + break; case "RECONCILIATION_MODE_UNSPECIFIED": case 0: message.reconciliationMode = 0; @@ -9728,7 +9764,7 @@ if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] === undefined ? message.reconciliationMode : $root.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; if (message.requestId != null && message.hasOwnProperty("requestId")) object.requestId = message.requestId; if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) @@ -13448,6 +13484,12 @@ if (object.id != null) message.id = String(object.id); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -13529,6 +13571,12 @@ message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); } switch (object.availability) { + default: + if (typeof object.availability === "number") { + message.availability = object.availability; + break; + } + break; case "AVAILABILITY_UNSPECIFIED": case 0: message.availability = 0; @@ -13713,7 +13761,7 @@ if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2.Product.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.retail.v2.Product.Type[message.type] === undefined ? message.type : $root.google.cloud.retail.v2.Product.Type[message.type] : message.type; if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) object.primaryProductId = message.primaryProductId; if (message.collectionMemberIds && message.collectionMemberIds.length) { @@ -13767,7 +13815,7 @@ if (message.availableTime != null && message.hasOwnProperty("availableTime")) object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2.Product.Availability[message.availability] : message.availability; + object.availability = options.enums === String ? $root.google.cloud.retail.v2.Product.Availability[message.availability] === undefined ? message.availability : $root.google.cloud.retail.v2.Product.Availability[message.availability] : message.availability; if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); if (message.fulfillmentInfo && message.fulfillmentInfo.length) { @@ -20662,6 +20710,10 @@ for (var i = 0; i < object.solutionTypes.length; ++i) switch (object.solutionTypes[i]) { default: + if (typeof object.solutionTypes[i] === "number") { + message.solutionTypes[i] = object.solutionTypes[i]; + break; + } case "SOLUTION_TYPE_UNSPECIFIED": case 0: message.solutionTypes[i] = 0; @@ -20683,6 +20735,10 @@ for (var i = 0; i < object.searchSolutionUseCase.length; ++i) switch (object.searchSolutionUseCase[i]) { default: + if (typeof object.searchSolutionUseCase[i] === "number") { + message.searchSolutionUseCase[i] = object.searchSolutionUseCase[i]; + break; + } case "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": case 0: message.searchSolutionUseCase[i] = 0; @@ -20739,12 +20795,12 @@ if (message.solutionTypes && message.solutionTypes.length) { object.solutionTypes = []; for (var j = 0; j < message.solutionTypes.length; ++j) - object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] === undefined ? message.solutionTypes[j] : $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } if (message.searchSolutionUseCase && message.searchSolutionUseCase.length) { object.searchSolutionUseCase = []; for (var j = 0; j < message.searchSolutionUseCase.length; ++j) - object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; + object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2.SearchSolutionUseCase[message.searchSolutionUseCase[j]] === undefined ? message.searchSolutionUseCase[j] : $root.google.cloud.retail.v2.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; } return object; }; @@ -30031,6 +30087,12 @@ message.pageCategories[i] = String(object.pageCategories[i]); } switch (object.searchMode) { + default: + if (typeof object.searchMode === "number") { + message.searchMode = object.searchMode; + break; + } + break; case "SEARCH_MODE_UNSPECIFIED": case 0: message.searchMode = 0; @@ -30146,7 +30208,7 @@ if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) object.canonicalFilter = message.canonicalFilter; if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] === undefined ? message.searchMode : $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); var keys2; @@ -31099,6 +31161,12 @@ return object; var message = new $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -31131,7 +31199,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; return object; }; @@ -31847,6 +31915,12 @@ return object; var message = new $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec(); switch (object.condition) { + default: + if (typeof object.condition === "number") { + message.condition = object.condition; + break; + } + break; case "CONDITION_UNSPECIFIED": case 0: message.condition = 0; @@ -31883,7 +31957,7 @@ object.pinUnexpandedResults = false; } if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + object.condition = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] === undefined ? message.condition : $root.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) object.pinUnexpandedResults = message.pinUnexpandedResults; return object; @@ -32090,6 +32164,12 @@ return object; var message = new $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -32122,7 +32202,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; return object; }; @@ -32327,6 +32407,12 @@ return object; var message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -32359,7 +32445,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; return object; }; @@ -34849,6 +34935,10 @@ for (var i = 0; i < object.solutionTypes.length; ++i) switch (object.solutionTypes[i]) { default: + if (typeof object.solutionTypes[i] === "number") { + message.solutionTypes[i] = object.solutionTypes[i]; + break; + } case "SOLUTION_TYPE_UNSPECIFIED": case 0: message.solutionTypes[i] = 0; @@ -34963,7 +35053,7 @@ if (message.solutionTypes && message.solutionTypes.length) { object.solutionTypes = []; for (var j = 0; j < message.solutionTypes.length; ++j) - object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] === undefined ? message.solutionTypes[j] : $root.google.cloud.retail.v2.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); @@ -38010,6 +38100,12 @@ if (object.parent != null) message.parent = String(object.parent); switch (object.userEventRejoinScope) { + default: + if (typeof object.userEventRejoinScope === "number") { + message.userEventRejoinScope = object.userEventRejoinScope; + break; + } + break; case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": case 0: message.userEventRejoinScope = 0; @@ -38046,7 +38142,7 @@ if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] === undefined ? message.userEventRejoinScope : $root.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; return object; }; @@ -39018,6 +39114,12 @@ if (object.inUse != null) message.inUse = Boolean(object.inUse); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "UNKNOWN": case 0: message.type = 0; @@ -39032,6 +39134,12 @@ break; } switch (object.indexableOption) { + default: + if (typeof object.indexableOption === "number") { + message.indexableOption = object.indexableOption; + break; + } + break; case "INDEXABLE_OPTION_UNSPECIFIED": case 0: message.indexableOption = 0; @@ -39046,6 +39154,12 @@ break; } switch (object.dynamicFacetableOption) { + default: + if (typeof object.dynamicFacetableOption === "number") { + message.dynamicFacetableOption = object.dynamicFacetableOption; + break; + } + break; case "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": case 0: message.dynamicFacetableOption = 0; @@ -39060,6 +39174,12 @@ break; } switch (object.searchableOption) { + default: + if (typeof object.searchableOption === "number") { + message.searchableOption = object.searchableOption; + break; + } + break; case "SEARCHABLE_OPTION_UNSPECIFIED": case 0: message.searchableOption = 0; @@ -39074,6 +39194,12 @@ break; } switch (object.recommendationsFilteringOption) { + default: + if (typeof object.recommendationsFilteringOption === "number") { + message.recommendationsFilteringOption = object.recommendationsFilteringOption; + break; + } + break; case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": case 0: message.recommendationsFilteringOption = 0; @@ -39115,17 +39241,17 @@ if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) - object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; + object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption[message.indexableOption] === undefined ? message.indexableOption : $root.google.cloud.retail.v2alpha.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) - object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; + object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] === undefined ? message.dynamicFacetableOption : $root.google.cloud.retail.v2alpha.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) - object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption[message.searchableOption] === undefined ? message.searchableOption : $root.google.cloud.retail.v2alpha.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; if (message.recommendationsFilteringOption != null && message.hasOwnProperty("recommendationsFilteringOption")) - object.recommendationsFilteringOption = options.enums === String ? $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.recommendationsFilteringOption] : message.recommendationsFilteringOption; + object.recommendationsFilteringOption = options.enums === String ? $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.recommendationsFilteringOption] === undefined ? message.recommendationsFilteringOption : $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.recommendationsFilteringOption] : message.recommendationsFilteringOption; if (message.inUse != null && message.hasOwnProperty("inUse")) object.inUse = message.inUse; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.AttributeType[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.CatalogAttribute.AttributeType[message.type] === undefined ? message.type : $root.google.cloud.retail.v2alpha.CatalogAttribute.AttributeType[message.type] : message.type; return object; }; @@ -39456,6 +39582,12 @@ } } switch (object.attributeConfigLevel) { + default: + if (typeof object.attributeConfigLevel === "number") { + message.attributeConfigLevel = object.attributeConfigLevel; + break; + } + break; case "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": case 0: message.attributeConfigLevel = 0; @@ -39500,7 +39632,7 @@ object.catalogAttributes[keys2[j]] = $root.google.cloud.retail.v2alpha.CatalogAttribute.toObject(message.catalogAttributes[keys2[j]], options); } if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) - object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2alpha.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; + object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2alpha.AttributeConfigLevel[message.attributeConfigLevel] === undefined ? message.attributeConfigLevel : $root.google.cloud.retail.v2alpha.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; return object; }; @@ -48766,6 +48898,12 @@ message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } switch (object.reconciliationMode) { + default: + if (typeof object.reconciliationMode === "number") { + message.reconciliationMode = object.reconciliationMode; + break; + } + break; case "RECONCILIATION_MODE_UNSPECIFIED": case 0: message.reconciliationMode = 0; @@ -48818,7 +48956,7 @@ if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] === undefined ? message.reconciliationMode : $root.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; if (message.requestId != null && message.hasOwnProperty("requestId")) object.requestId = message.requestId; if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) @@ -52512,6 +52650,12 @@ if (object.id != null) message.id = String(object.id); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -52593,6 +52737,12 @@ message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); } switch (object.availability) { + default: + if (typeof object.availability === "number") { + message.availability = object.availability; + break; + } + break; case "AVAILABILITY_UNSPECIFIED": case 0: message.availability = 0; @@ -52766,7 +52916,7 @@ if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Type[message.type] === undefined ? message.type : $root.google.cloud.retail.v2alpha.Product.Type[message.type] : message.type; if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) object.primaryProductId = message.primaryProductId; if (message.collectionMemberIds && message.collectionMemberIds.length) { @@ -52820,7 +52970,7 @@ if (message.availableTime != null && message.hasOwnProperty("availableTime")) object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; + object.availability = options.enums === String ? $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] === undefined ? message.availability : $root.google.cloud.retail.v2alpha.Product.Availability[message.availability] : message.availability; if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); if (message.fulfillmentInfo && message.fulfillmentInfo.length) { @@ -59740,6 +59890,10 @@ for (var i = 0; i < object.solutionTypes.length; ++i) switch (object.solutionTypes[i]) { default: + if (typeof object.solutionTypes[i] === "number") { + message.solutionTypes[i] = object.solutionTypes[i]; + break; + } case "SOLUTION_TYPE_UNSPECIFIED": case 0: message.solutionTypes[i] = 0; @@ -59761,6 +59915,10 @@ for (var i = 0; i < object.searchSolutionUseCase.length; ++i) switch (object.searchSolutionUseCase[i]) { default: + if (typeof object.searchSolutionUseCase[i] === "number") { + message.searchSolutionUseCase[i] = object.searchSolutionUseCase[i]; + break; + } case "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": case 0: message.searchSolutionUseCase[i] = 0; @@ -59822,12 +59980,12 @@ if (message.solutionTypes && message.solutionTypes.length) { object.solutionTypes = []; for (var j = 0; j < message.solutionTypes.length; ++j) - object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] === undefined ? message.solutionTypes[j] : $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } if (message.searchSolutionUseCase && message.searchSolutionUseCase.length) { object.searchSolutionUseCase = []; for (var j = 0; j < message.searchSolutionUseCase.length; ++j) - object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; + object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchSolutionUseCase[message.searchSolutionUseCase[j]] === undefined ? message.searchSolutionUseCase[j] : $root.google.cloud.retail.v2alpha.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; } return object; }; @@ -60603,6 +60761,12 @@ message.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.fromObject(object.queryExpansionSpec); } switch (object.relevanceThreshold) { + default: + if (typeof object.relevanceThreshold === "number") { + message.relevanceThreshold = object.relevanceThreshold; + break; + } + break; case "RELEVANCE_THRESHOLD_UNSPECIFIED": case 0: message.relevanceThreshold = 0; @@ -60639,6 +60803,12 @@ message.pageCategories[i] = String(object.pageCategories[i]); } switch (object.searchMode) { + default: + if (typeof object.searchMode === "number") { + message.searchMode = object.searchMode; + break; + } + break; case "SEARCH_MODE_UNSPECIFIED": case 0: message.searchMode = 0; @@ -60741,7 +60911,7 @@ if (message.queryExpansionSpec != null && message.hasOwnProperty("queryExpansionSpec")) object.queryExpansionSpec = $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.toObject(message.queryExpansionSpec, options); if (message.relevanceThreshold != null && message.hasOwnProperty("relevanceThreshold")) - object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; + object.relevanceThreshold = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] === undefined ? message.relevanceThreshold : $root.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold[message.relevanceThreshold] : message.relevanceThreshold; if (message.variantRollupKeys && message.variantRollupKeys.length) { object.variantRollupKeys = []; for (var j = 0; j < message.variantRollupKeys.length; ++j) @@ -60757,7 +60927,7 @@ if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) object.canonicalFilter = message.canonicalFilter; if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] === undefined ? message.searchMode : $root.google.cloud.retail.v2alpha.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); var keys2; @@ -61710,6 +61880,12 @@ return object; var message = new $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -61742,7 +61918,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; return object; }; @@ -62458,6 +62634,12 @@ return object; var message = new $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec(); switch (object.condition) { + default: + if (typeof object.condition === "number") { + message.condition = object.condition; + break; + } + break; case "CONDITION_UNSPECIFIED": case 0: message.condition = 0; @@ -62494,7 +62676,7 @@ object.pinUnexpandedResults = false; } if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + object.condition = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] === undefined ? message.condition : $root.google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) object.pinUnexpandedResults = message.pinUnexpandedResults; return object; @@ -62701,6 +62883,12 @@ return object; var message = new $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -62733,7 +62921,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; return object; }; @@ -62938,6 +63126,12 @@ return object; var message = new $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -62970,7 +63164,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; return object; }; @@ -68366,6 +68560,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.trainingState) { + default: + if (typeof object.trainingState === "number") { + message.trainingState = object.trainingState; + break; + } + break; case "TRAINING_STATE_UNSPECIFIED": case 0: message.trainingState = 0; @@ -68380,6 +68580,12 @@ break; } switch (object.servingState) { + default: + if (typeof object.servingState === "number") { + message.servingState = object.servingState; + break; + } + break; case "SERVING_STATE_UNSPECIFIED": case 0: message.servingState = 0; @@ -68412,6 +68618,12 @@ if (object.optimizationObjective != null) message.optimizationObjective = String(object.optimizationObjective); switch (object.periodicTuningState) { + default: + if (typeof object.periodicTuningState === "number") { + message.periodicTuningState = object.periodicTuningState; + break; + } + break; case "PERIODIC_TUNING_STATE_UNSPECIFIED": case 0: message.periodicTuningState = 0; @@ -68437,6 +68649,12 @@ if (object.tuningOperation != null) message.tuningOperation = String(object.tuningOperation); switch (object.dataState) { + default: + if (typeof object.dataState === "number") { + message.dataState = object.dataState; + break; + } + break; case "DATA_STATE_UNSPECIFIED": case 0: message.dataState = 0; @@ -68451,6 +68669,12 @@ break; } switch (object.filteringOption) { + default: + if (typeof object.filteringOption === "number") { + message.filteringOption = object.filteringOption; + break; + } + break; case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": case 0: message.filteringOption = 0; @@ -68512,9 +68736,9 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; if (message.trainingState != null && message.hasOwnProperty("trainingState")) - object.trainingState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.TrainingState[message.trainingState] : message.trainingState; + object.trainingState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.TrainingState[message.trainingState] === undefined ? message.trainingState : $root.google.cloud.retail.v2alpha.Model.TrainingState[message.trainingState] : message.trainingState; if (message.servingState != null && message.hasOwnProperty("servingState")) - object.servingState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.ServingState[message.servingState] : message.servingState; + object.servingState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.ServingState[message.servingState] === undefined ? message.servingState : $root.google.cloud.retail.v2alpha.Model.ServingState[message.servingState] : message.servingState; if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.updateTime != null && message.hasOwnProperty("updateTime")) @@ -68524,20 +68748,20 @@ if (message.optimizationObjective != null && message.hasOwnProperty("optimizationObjective")) object.optimizationObjective = message.optimizationObjective; if (message.periodicTuningState != null && message.hasOwnProperty("periodicTuningState")) - object.periodicTuningState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.PeriodicTuningState[message.periodicTuningState] : message.periodicTuningState; + object.periodicTuningState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.PeriodicTuningState[message.periodicTuningState] === undefined ? message.periodicTuningState : $root.google.cloud.retail.v2alpha.Model.PeriodicTuningState[message.periodicTuningState] : message.periodicTuningState; if (message.lastTuneTime != null && message.hasOwnProperty("lastTuneTime")) object.lastTuneTime = $root.google.protobuf.Timestamp.toObject(message.lastTuneTime, options); if (message.tuningOperation != null && message.hasOwnProperty("tuningOperation")) object.tuningOperation = message.tuningOperation; if (message.dataState != null && message.hasOwnProperty("dataState")) - object.dataState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.DataState[message.dataState] : message.dataState; + object.dataState = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.DataState[message.dataState] === undefined ? message.dataState : $root.google.cloud.retail.v2alpha.Model.DataState[message.dataState] : message.dataState; if (message.pageOptimizationConfig != null && message.hasOwnProperty("pageOptimizationConfig")) { object.pageOptimizationConfig = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.toObject(message.pageOptimizationConfig, options); if (options.oneofs) object.trainingConfig = "pageOptimizationConfig"; } if (message.filteringOption != null && message.hasOwnProperty("filteringOption")) - object.filteringOption = options.enums === String ? $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.filteringOption] : message.filteringOption; + object.filteringOption = options.enums === String ? $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.filteringOption] === undefined ? message.filteringOption : $root.google.cloud.retail.v2alpha.RecommendationsFilteringOption[message.filteringOption] : message.filteringOption; if (message.servingConfigLists && message.servingConfigLists.length) { object.servingConfigLists = []; for (var j = 0; j < message.servingConfigLists.length; ++j) @@ -68788,6 +69012,12 @@ } } switch (object.restriction) { + default: + if (typeof object.restriction === "number") { + message.restriction = object.restriction; + break; + } + break; case "RESTRICTION_UNSPECIFIED": case 0: message.restriction = 0; @@ -68839,7 +69069,7 @@ object.panels[j] = $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Panel.toObject(message.panels[j], options); } if (message.restriction != null && message.hasOwnProperty("restriction")) - object.restriction = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction[message.restriction] : message.restriction; + object.restriction = options.enums === String ? $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction[message.restriction] === undefined ? message.restriction : $root.google.cloud.retail.v2alpha.Model.PageOptimizationConfig.Restriction[message.restriction] : message.restriction; return object; }; @@ -80751,6 +80981,10 @@ for (var i = 0; i < object.solutionTypes.length; ++i) switch (object.solutionTypes[i]) { default: + if (typeof object.solutionTypes[i] === "number") { + message.solutionTypes[i] = object.solutionTypes[i]; + break; + } case "SOLUTION_TYPE_UNSPECIFIED": case 0: message.solutionTypes[i] = 0; @@ -80864,7 +81098,7 @@ if (message.solutionTypes && message.solutionTypes.length) { object.solutionTypes = []; for (var j = 0; j < message.solutionTypes.length; ++j) - object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] === undefined ? message.solutionTypes[j] : $root.google.cloud.retail.v2alpha.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } return object; }; @@ -83909,6 +84143,12 @@ if (object.parent != null) message.parent = String(object.parent); switch (object.userEventRejoinScope) { + default: + if (typeof object.userEventRejoinScope === "number") { + message.userEventRejoinScope = object.userEventRejoinScope; + break; + } + break; case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": case 0: message.userEventRejoinScope = 0; @@ -83945,7 +84185,7 @@ if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] === undefined ? message.userEventRejoinScope : $root.google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; return object; }; @@ -84941,6 +85181,12 @@ if (object.inUse != null) message.inUse = Boolean(object.inUse); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "UNKNOWN": case 0: message.type = 0; @@ -84955,6 +85201,12 @@ break; } switch (object.indexableOption) { + default: + if (typeof object.indexableOption === "number") { + message.indexableOption = object.indexableOption; + break; + } + break; case "INDEXABLE_OPTION_UNSPECIFIED": case 0: message.indexableOption = 0; @@ -84969,6 +85221,12 @@ break; } switch (object.dynamicFacetableOption) { + default: + if (typeof object.dynamicFacetableOption === "number") { + message.dynamicFacetableOption = object.dynamicFacetableOption; + break; + } + break; case "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED": case 0: message.dynamicFacetableOption = 0; @@ -84983,6 +85241,12 @@ break; } switch (object.searchableOption) { + default: + if (typeof object.searchableOption === "number") { + message.searchableOption = object.searchableOption; + break; + } + break; case "SEARCHABLE_OPTION_UNSPECIFIED": case 0: message.searchableOption = 0; @@ -84997,6 +85261,12 @@ break; } switch (object.recommendationsFilteringOption) { + default: + if (typeof object.recommendationsFilteringOption === "number") { + message.recommendationsFilteringOption = object.recommendationsFilteringOption; + break; + } + break; case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": case 0: message.recommendationsFilteringOption = 0; @@ -85011,6 +85281,12 @@ break; } switch (object.exactSearchableOption) { + default: + if (typeof object.exactSearchableOption === "number") { + message.exactSearchableOption = object.exactSearchableOption; + break; + } + break; case "EXACT_SEARCHABLE_OPTION_UNSPECIFIED": case 0: message.exactSearchableOption = 0; @@ -85053,19 +85329,19 @@ if (message.key != null && message.hasOwnProperty("key")) object.key = message.key; if (message.indexableOption != null && message.hasOwnProperty("indexableOption")) - object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; + object.indexableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.IndexableOption[message.indexableOption] === undefined ? message.indexableOption : $root.google.cloud.retail.v2beta.CatalogAttribute.IndexableOption[message.indexableOption] : message.indexableOption; if (message.dynamicFacetableOption != null && message.hasOwnProperty("dynamicFacetableOption")) - object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; + object.dynamicFacetableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] === undefined ? message.dynamicFacetableOption : $root.google.cloud.retail.v2beta.CatalogAttribute.DynamicFacetableOption[message.dynamicFacetableOption] : message.dynamicFacetableOption; if (message.searchableOption != null && message.hasOwnProperty("searchableOption")) - object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; + object.searchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.SearchableOption[message.searchableOption] === undefined ? message.searchableOption : $root.google.cloud.retail.v2beta.CatalogAttribute.SearchableOption[message.searchableOption] : message.searchableOption; if (message.recommendationsFilteringOption != null && message.hasOwnProperty("recommendationsFilteringOption")) - object.recommendationsFilteringOption = options.enums === String ? $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.recommendationsFilteringOption] : message.recommendationsFilteringOption; + object.recommendationsFilteringOption = options.enums === String ? $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.recommendationsFilteringOption] === undefined ? message.recommendationsFilteringOption : $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.recommendationsFilteringOption] : message.recommendationsFilteringOption; if (message.inUse != null && message.hasOwnProperty("inUse")) object.inUse = message.inUse; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.AttributeType[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.AttributeType[message.type] === undefined ? message.type : $root.google.cloud.retail.v2beta.CatalogAttribute.AttributeType[message.type] : message.type; if (message.exactSearchableOption != null && message.hasOwnProperty("exactSearchableOption")) - object.exactSearchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption[message.exactSearchableOption] : message.exactSearchableOption; + object.exactSearchableOption = options.enums === String ? $root.google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption[message.exactSearchableOption] === undefined ? message.exactSearchableOption : $root.google.cloud.retail.v2beta.CatalogAttribute.ExactSearchableOption[message.exactSearchableOption] : message.exactSearchableOption; return object; }; @@ -85412,6 +85688,12 @@ } } switch (object.attributeConfigLevel) { + default: + if (typeof object.attributeConfigLevel === "number") { + message.attributeConfigLevel = object.attributeConfigLevel; + break; + } + break; case "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED": case 0: message.attributeConfigLevel = 0; @@ -85456,7 +85738,7 @@ object.catalogAttributes[keys2[j]] = $root.google.cloud.retail.v2beta.CatalogAttribute.toObject(message.catalogAttributes[keys2[j]], options); } if (message.attributeConfigLevel != null && message.hasOwnProperty("attributeConfigLevel")) - object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2beta.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; + object.attributeConfigLevel = options.enums === String ? $root.google.cloud.retail.v2beta.AttributeConfigLevel[message.attributeConfigLevel] === undefined ? message.attributeConfigLevel : $root.google.cloud.retail.v2beta.AttributeConfigLevel[message.attributeConfigLevel] : message.attributeConfigLevel; return object; }; @@ -94704,6 +94986,12 @@ message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } switch (object.reconciliationMode) { + default: + if (typeof object.reconciliationMode === "number") { + message.reconciliationMode = object.reconciliationMode; + break; + } + break; case "RECONCILIATION_MODE_UNSPECIFIED": case 0: message.reconciliationMode = 0; @@ -94753,7 +95041,7 @@ if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); if (message.reconciliationMode != null && message.hasOwnProperty("reconciliationMode")) - object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; + object.reconciliationMode = options.enums === String ? $root.google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] === undefined ? message.reconciliationMode : $root.google.cloud.retail.v2beta.ImportProductsRequest.ReconciliationMode[message.reconciliationMode] : message.reconciliationMode; if (message.requestId != null && message.hasOwnProperty("requestId")) object.requestId = message.requestId; if (message.notificationPubsubTopic != null && message.hasOwnProperty("notificationPubsubTopic")) @@ -98473,6 +98761,12 @@ if (object.id != null) message.id = String(object.id); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_UNSPECIFIED": case 0: message.type = 0; @@ -98554,6 +98848,12 @@ message.availableTime = $root.google.protobuf.Timestamp.fromObject(object.availableTime); } switch (object.availability) { + default: + if (typeof object.availability === "number") { + message.availability = object.availability; + break; + } + break; case "AVAILABILITY_UNSPECIFIED": case 0: message.availability = 0; @@ -98738,7 +99038,7 @@ if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Type[message.type] === undefined ? message.type : $root.google.cloud.retail.v2beta.Product.Type[message.type] : message.type; if (message.primaryProductId != null && message.hasOwnProperty("primaryProductId")) object.primaryProductId = message.primaryProductId; if (message.collectionMemberIds && message.collectionMemberIds.length) { @@ -98792,7 +99092,7 @@ if (message.availableTime != null && message.hasOwnProperty("availableTime")) object.availableTime = $root.google.protobuf.Timestamp.toObject(message.availableTime, options); if (message.availability != null && message.hasOwnProperty("availability")) - object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; + object.availability = options.enums === String ? $root.google.cloud.retail.v2beta.Product.Availability[message.availability] === undefined ? message.availability : $root.google.cloud.retail.v2beta.Product.Availability[message.availability] : message.availability; if (message.availableQuantity != null && message.hasOwnProperty("availableQuantity")) object.availableQuantity = $root.google.protobuf.Int32Value.toObject(message.availableQuantity, options); if (message.fulfillmentInfo && message.fulfillmentInfo.length) { @@ -106252,6 +106552,10 @@ for (var i = 0; i < object.solutionTypes.length; ++i) switch (object.solutionTypes[i]) { default: + if (typeof object.solutionTypes[i] === "number") { + message.solutionTypes[i] = object.solutionTypes[i]; + break; + } case "SOLUTION_TYPE_UNSPECIFIED": case 0: message.solutionTypes[i] = 0; @@ -106273,6 +106577,10 @@ for (var i = 0; i < object.searchSolutionUseCase.length; ++i) switch (object.searchSolutionUseCase[i]) { default: + if (typeof object.searchSolutionUseCase[i] === "number") { + message.searchSolutionUseCase[i] = object.searchSolutionUseCase[i]; + break; + } case "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED": case 0: message.searchSolutionUseCase[i] = 0; @@ -106334,12 +106642,12 @@ if (message.solutionTypes && message.solutionTypes.length) { object.solutionTypes = []; for (var j = 0; j < message.solutionTypes.length; ++j) - object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] === undefined ? message.solutionTypes[j] : $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } if (message.searchSolutionUseCase && message.searchSolutionUseCase.length) { object.searchSolutionUseCase = []; for (var j = 0; j < message.searchSolutionUseCase.length; ++j) - object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; + object.searchSolutionUseCase[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SearchSolutionUseCase[message.searchSolutionUseCase[j]] === undefined ? message.searchSolutionUseCase[j] : $root.google.cloud.retail.v2beta.SearchSolutionUseCase[message.searchSolutionUseCase[j]] : message.searchSolutionUseCase[j]; } return object; }; @@ -107103,6 +107411,12 @@ message.pageCategories[i] = String(object.pageCategories[i]); } switch (object.searchMode) { + default: + if (typeof object.searchMode === "number") { + message.searchMode = object.searchMode; + break; + } + break; case "SEARCH_MODE_UNSPECIFIED": case 0: message.searchMode = 0; @@ -107218,7 +107532,7 @@ if (message.canonicalFilter != null && message.hasOwnProperty("canonicalFilter")) object.canonicalFilter = message.canonicalFilter; if (message.searchMode != null && message.hasOwnProperty("searchMode")) - object.searchMode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] : message.searchMode; + object.searchMode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] === undefined ? message.searchMode : $root.google.cloud.retail.v2beta.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); var keys2; @@ -108171,6 +108485,12 @@ return object; var message = new $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -108203,7 +108523,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode[message.mode] : message.mode; return object; }; @@ -108919,6 +109239,12 @@ return object; var message = new $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec(); switch (object.condition) { + default: + if (typeof object.condition === "number") { + message.condition = object.condition; + break; + } + break; case "CONDITION_UNSPECIFIED": case 0: message.condition = 0; @@ -108955,7 +109281,7 @@ object.pinUnexpandedResults = false; } if (message.condition != null && message.hasOwnProperty("condition")) - object.condition = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; + object.condition = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] === undefined ? message.condition : $root.google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition[message.condition] : message.condition; if (message.pinUnexpandedResults != null && message.hasOwnProperty("pinUnexpandedResults")) object.pinUnexpandedResults = message.pinUnexpandedResults; return object; @@ -109162,6 +109488,12 @@ return object; var message = new $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -109194,7 +109526,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.Mode[message.mode] : message.mode; return object; }; @@ -109399,6 +109731,12 @@ return object; var message = new $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec(); switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; case "MODE_UNSPECIFIED": case 0: message.mode = 0; @@ -109431,7 +109769,7 @@ if (options.defaults) object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode[message.mode] === undefined ? message.mode : $root.google.cloud.retail.v2beta.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; return object; }; @@ -114804,6 +115142,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.trainingState) { + default: + if (typeof object.trainingState === "number") { + message.trainingState = object.trainingState; + break; + } + break; case "TRAINING_STATE_UNSPECIFIED": case 0: message.trainingState = 0; @@ -114818,6 +115162,12 @@ break; } switch (object.servingState) { + default: + if (typeof object.servingState === "number") { + message.servingState = object.servingState; + break; + } + break; case "SERVING_STATE_UNSPECIFIED": case 0: message.servingState = 0; @@ -114850,6 +115200,12 @@ if (object.optimizationObjective != null) message.optimizationObjective = String(object.optimizationObjective); switch (object.periodicTuningState) { + default: + if (typeof object.periodicTuningState === "number") { + message.periodicTuningState = object.periodicTuningState; + break; + } + break; case "PERIODIC_TUNING_STATE_UNSPECIFIED": case 0: message.periodicTuningState = 0; @@ -114875,6 +115231,12 @@ if (object.tuningOperation != null) message.tuningOperation = String(object.tuningOperation); switch (object.dataState) { + default: + if (typeof object.dataState === "number") { + message.dataState = object.dataState; + break; + } + break; case "DATA_STATE_UNSPECIFIED": case 0: message.dataState = 0; @@ -114889,6 +115251,12 @@ break; } switch (object.filteringOption) { + default: + if (typeof object.filteringOption === "number") { + message.filteringOption = object.filteringOption; + break; + } + break; case "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED": case 0: message.filteringOption = 0; @@ -114950,9 +115318,9 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; if (message.trainingState != null && message.hasOwnProperty("trainingState")) - object.trainingState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.TrainingState[message.trainingState] : message.trainingState; + object.trainingState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.TrainingState[message.trainingState] === undefined ? message.trainingState : $root.google.cloud.retail.v2beta.Model.TrainingState[message.trainingState] : message.trainingState; if (message.servingState != null && message.hasOwnProperty("servingState")) - object.servingState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.ServingState[message.servingState] : message.servingState; + object.servingState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.ServingState[message.servingState] === undefined ? message.servingState : $root.google.cloud.retail.v2beta.Model.ServingState[message.servingState] : message.servingState; if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.updateTime != null && message.hasOwnProperty("updateTime")) @@ -114962,15 +115330,15 @@ if (message.optimizationObjective != null && message.hasOwnProperty("optimizationObjective")) object.optimizationObjective = message.optimizationObjective; if (message.periodicTuningState != null && message.hasOwnProperty("periodicTuningState")) - object.periodicTuningState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.PeriodicTuningState[message.periodicTuningState] : message.periodicTuningState; + object.periodicTuningState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.PeriodicTuningState[message.periodicTuningState] === undefined ? message.periodicTuningState : $root.google.cloud.retail.v2beta.Model.PeriodicTuningState[message.periodicTuningState] : message.periodicTuningState; if (message.lastTuneTime != null && message.hasOwnProperty("lastTuneTime")) object.lastTuneTime = $root.google.protobuf.Timestamp.toObject(message.lastTuneTime, options); if (message.tuningOperation != null && message.hasOwnProperty("tuningOperation")) object.tuningOperation = message.tuningOperation; if (message.dataState != null && message.hasOwnProperty("dataState")) - object.dataState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.DataState[message.dataState] : message.dataState; + object.dataState = options.enums === String ? $root.google.cloud.retail.v2beta.Model.DataState[message.dataState] === undefined ? message.dataState : $root.google.cloud.retail.v2beta.Model.DataState[message.dataState] : message.dataState; if (message.filteringOption != null && message.hasOwnProperty("filteringOption")) - object.filteringOption = options.enums === String ? $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.filteringOption] : message.filteringOption; + object.filteringOption = options.enums === String ? $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.filteringOption] === undefined ? message.filteringOption : $root.google.cloud.retail.v2beta.RecommendationsFilteringOption[message.filteringOption] : message.filteringOption; if (message.servingConfigLists && message.servingConfigLists.length) { object.servingConfigLists = []; for (var j = 0; j < message.servingConfigLists.length; ++j) @@ -125504,6 +125872,12 @@ if (object.diversityLevel != null) message.diversityLevel = String(object.diversityLevel); switch (object.diversityType) { + default: + if (typeof object.diversityType === "number") { + message.diversityType = object.diversityType; + break; + } + break; case "DIVERSITY_TYPE_UNSPECIFIED": case 0: message.diversityType = 0; @@ -125531,6 +125905,10 @@ for (var i = 0; i < object.solutionTypes.length; ++i) switch (object.solutionTypes[i]) { default: + if (typeof object.solutionTypes[i] === "number") { + message.solutionTypes[i] = object.solutionTypes[i]; + break; + } case "SOLUTION_TYPE_UNSPECIFIED": case 0: message.solutionTypes[i] = 0; @@ -125646,10 +126024,10 @@ if (message.solutionTypes && message.solutionTypes.length) { object.solutionTypes = []; for (var j = 0; j < message.solutionTypes.length; ++j) - object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; + object.solutionTypes[j] = options.enums === String ? $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] === undefined ? message.solutionTypes[j] : $root.google.cloud.retail.v2beta.SolutionType[message.solutionTypes[j]] : message.solutionTypes[j]; } if (message.diversityType != null && message.hasOwnProperty("diversityType")) - object.diversityType = options.enums === String ? $root.google.cloud.retail.v2beta.ServingConfig.DiversityType[message.diversityType] : message.diversityType; + object.diversityType = options.enums === String ? $root.google.cloud.retail.v2beta.ServingConfig.DiversityType[message.diversityType] === undefined ? message.diversityType : $root.google.cloud.retail.v2beta.ServingConfig.DiversityType[message.diversityType] : message.diversityType; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2beta.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); return object; @@ -128711,6 +129089,12 @@ if (object.parent != null) message.parent = String(object.parent); switch (object.userEventRejoinScope) { + default: + if (typeof object.userEventRejoinScope === "number") { + message.userEventRejoinScope = object.userEventRejoinScope; + break; + } + break; case "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED": case 0: message.userEventRejoinScope = 0; @@ -128747,7 +129131,7 @@ if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; if (message.userEventRejoinScope != null && message.hasOwnProperty("userEventRejoinScope")) - object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; + object.userEventRejoinScope = options.enums === String ? $root.google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] === undefined ? message.userEventRejoinScope : $root.google.cloud.retail.v2beta.RejoinUserEventsRequest.UserEventRejoinScope[message.userEventRejoinScope] : message.userEventRejoinScope; return object; }; @@ -129536,6 +129920,12 @@ if (object.nameField != null) message.nameField = String(object.nameField); switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; case "HISTORY_UNSPECIFIED": case 0: message.history = 0; @@ -129560,6 +129950,10 @@ for (var i = 0; i < object.style.length; ++i) switch (object.style[i]) { default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } case "STYLE_UNSPECIFIED": case 0: message.style[i] = 0; @@ -129607,7 +130001,7 @@ if (message.nameField != null && message.hasOwnProperty("nameField")) object.nameField = message.nameField; if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; if (message.plural != null && message.hasOwnProperty("plural")) object.plural = message.plural; if (message.singular != null && message.hasOwnProperty("singular")) @@ -129615,7 +130009,7 @@ if (message.style && message.style.length) { object.style = []; for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; } return object; }; @@ -133670,6 +134064,12 @@ if (object.number != null) message.number = object.number | 0; switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; case "LABEL_OPTIONAL": case 1: message.label = 1; @@ -133684,6 +134084,12 @@ break; } switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_DOUBLE": case 1: message.type = 1; @@ -133810,9 +134216,9 @@ if (message.number != null && message.hasOwnProperty("number")) object.number = message.number; if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; if (message.typeName != null && message.hasOwnProperty("typeName")) object.typeName = message.typeName; if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) @@ -136159,6 +136565,12 @@ if (object.javaStringCheckUtf8 != null) message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; case "SPEED": case 1: message.optimizeFor = 1; @@ -136267,7 +136679,7 @@ if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) object.javaOuterClassname = message.javaOuterClassname; if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) object.javaMultipleFiles = message.javaMultipleFiles; if (message.goPackage != null && message.hasOwnProperty("goPackage")) @@ -137069,6 +137481,12 @@ return object; var message = new $root.google.protobuf.FieldOptions(); switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; case "STRING": case 0: message.ctype = 0; @@ -137085,6 +137503,12 @@ if (object.packed != null) message.packed = Boolean(object.packed); switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; case "JS_NORMAL": case 0: message.jstype = 0; @@ -137123,6 +137547,10 @@ for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) switch (object[".google.api.fieldBehavior"][i]) { default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } case "FIELD_BEHAVIOR_UNSPECIFIED": case 0: message[".google.api.fieldBehavior"][i] = 0; @@ -137193,7 +137621,7 @@ object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; if (message.packed != null && message.hasOwnProperty("packed")) object.packed = message.packed; if (message.deprecated != null && message.hasOwnProperty("deprecated")) @@ -137201,7 +137629,7 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) object.lazy = message.lazy; if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) @@ -137214,7 +137642,7 @@ if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { object[".google.api.fieldBehavior"] = []; for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) - object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; } if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); @@ -138591,6 +139019,12 @@ if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; case "IDEMPOTENCY_UNKNOWN": case 0: message.idempotencyLevel = 0; @@ -138660,7 +139094,7 @@ if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -140415,6 +140849,12 @@ if (object.end != null) message.end = object.end | 0; switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; case "NONE": case 0: message.semantic = 0; @@ -140464,7 +140904,7 @@ if (message.end != null && message.hasOwnProperty("end")) object.end = message.end; if (message.semantic != null && message.hasOwnProperty("semantic")) - object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -144024,6 +144464,12 @@ return object; var message = new $root.google.protobuf.Value(); switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; case "NULL_VALUE": case 0: message.nullValue = 0; @@ -144062,7 +144508,7 @@ options = {}; var object = {}; if (message.nullValue != null && message.hasOwnProperty("nullValue")) { - object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; if (options.oneofs) object.kind = "nullValue"; } From 022a5949cc63d30a86de39aad2ca0813d9466d66 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 01:02:14 +0000 Subject: [PATCH 102/103] chore(main): release 2.1.1 (#225) :robot: I have created a release *beep* *boop* --- ## [2.1.1](https://togithub.com/googleapis/nodejs-retail/compare/v2.1.0...v2.1.1) (2022-11-16) ### Bug Fixes * **deps:** Use google-gax v3.5.2 ([#221](https://togithub.com/googleapis/nodejs-retail/issues/221)) ([5eb17fc](https://togithub.com/googleapis/nodejs-retail/commit/5eb17fc9c340cacbb8627442c58597015a2d4134)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- packages/google-cloud-retail/CHANGELOG.md | 7 +++++++ packages/google-cloud-retail/package.json | 2 +- .../v2/snippet_metadata.google.cloud.retail.v2.json | 2 +- .../snippet_metadata.google.cloud.retail.v2alpha.json | 2 +- .../snippet_metadata.google.cloud.retail.v2beta.json | 2 +- packages/google-cloud-retail/samples/package.json | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-retail/CHANGELOG.md b/packages/google-cloud-retail/CHANGELOG.md index ca5b4c194af..cfd45fa220e 100644 --- a/packages/google-cloud-retail/CHANGELOG.md +++ b/packages/google-cloud-retail/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.1.1](https://github.com/googleapis/nodejs-retail/compare/v2.1.0...v2.1.1) (2022-11-16) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#221](https://github.com/googleapis/nodejs-retail/issues/221)) ([5eb17fc](https://github.com/googleapis/nodejs-retail/commit/5eb17fc9c340cacbb8627442c58597015a2d4134)) + ## [2.1.0](https://github.com/googleapis/nodejs-retail/compare/v2.0.0...v2.1.0) (2022-09-20) diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index 5d0e3f8e309..f5379bb17a6 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/retail", - "version": "2.1.0", + "version": "2.1.1", "description": "Retail client for Node.js", "repository": "googleapis/nodejs-retail", "license": "Apache-2.0", diff --git a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 72503ee9959..8273b0d7a5b 100644 --- a/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/packages/google-cloud-retail/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "2.1.0", + "version": "2.1.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json index b315bc7c5b7..c71708f06aa 100644 --- a/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json +++ b/packages/google-cloud-retail/samples/generated/v2alpha/snippet_metadata.google.cloud.retail.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "2.1.0", + "version": "2.1.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json index 97f2fc52f5a..62c6e5c26a8 100644 --- a/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json +++ b/packages/google-cloud-retail/samples/generated/v2beta/snippet_metadata.google.cloud.retail.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-retail", - "version": "2.1.0", + "version": "2.1.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-retail/samples/package.json b/packages/google-cloud-retail/samples/package.json index a1e9c64d61b..c4e6019e866 100644 --- a/packages/google-cloud-retail/samples/package.json +++ b/packages/google-cloud-retail/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha" }, "dependencies": { - "@google-cloud/retail": "^2.1.0", + "@google-cloud/retail": "^2.1.1", "@google-cloud/bigquery": "^6.0.0", "@google-cloud/storage": "^6.0.0" }, From c85fd04dd0b96bbea852251f06a5aea9d1397f47 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 15 Nov 2022 17:10:06 -0800 Subject: [PATCH 103/103] build: add release-please config, fix owlbot-config --- .release-please-manifest.json | 48 +- .../{.github => }/.OwlBot.yaml | 6 +- packages/google-cloud-retail/.mocharc.js | 2 +- packages/google-cloud-retail/.prettierrc.js | 2 +- .../google-cloud-retail/.repo-metadata.json | 4 +- packages/google-cloud-retail/README.md | 160 +- packages/google-cloud-retail/package.json | 13 +- .../google-cloud-retail/samples/README.md | 2640 ++++++++++++++++- packages/google-cloud-retail/src/index.ts | 2 +- release-please-config.json | 51 +- 10 files changed, 2853 insertions(+), 75 deletions(-) rename packages/google-cloud-retail/{.github => }/.OwlBot.yaml (79%) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 16c6eb41325..b0d24feb613 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,16 +1,16 @@ { "packages/gapic-node-templating": "0.0.0", "packages/google-api-apikeys": "0.1.3", - "packages/google-cloud-baremetalsolution": "0.2.2", + "packages/google-api-servicecontrol": "2.0.3", "packages/google-api-servicemanagement": "1.1.3", - "packages/google-cloud-apigateway": "2.1.2", "packages/google-api-serviceusage": "2.1.2", - "packages/google-api-servicecontrol": "2.0.3", "packages/google-appengine": "2.1.2", "packages/google-cloud-accessapproval": "2.1.2", + "packages/google-cloud-apigateway": "2.1.2", "packages/google-cloud-apigeeconnect": "2.1.3", "packages/google-cloud-asset": "4.5.0", "packages/google-cloud-assuredworkloads": "3.5.0", + "packages/google-cloud-baremetalsolution": "0.2.2", "packages/google-cloud-batch": "0.3.2", "packages/google-cloud-beyondcorp-appconnections": "0.2.3", "packages/google-cloud-beyondcorp-appconnectors": "0.3.3", @@ -23,50 +23,50 @@ "packages/google-cloud-bigquery-datatransfer": "3.1.5", "packages/google-cloud-bigquery-reservation": "2.0.4", "packages/google-cloud-bigquery-storage": "3.2.0", - "packages/google-cloud-binaryauthorization": "2.1.1", "packages/google-cloud-billing": "3.1.3", "packages/google-cloud-billing-budgets": "4.1.2", + "packages/google-cloud-binaryauthorization": "2.1.1", "packages/google-cloud-certificatemanager": "0.6.2", + "packages/google-cloud-channel": "2.2.0", "packages/google-cloud-clouddms": "2.1.2", "packages/google-cloud-contactcenterinsights": "2.1.2", - "packages/google-cloud-channel": "2.2.0", "packages/google-cloud-contentwarehouse": "0.1.2", "packages/google-cloud-datafusion": "2.1.2", "packages/google-cloud-datalabeling": "3.1.1", "packages/google-cloud-dataplex": "2.2.2", "packages/google-cloud-dataproc": "4.1.1", - "packages/google-cloud-datastream": "2.1.2", "packages/google-cloud-dataqna": "2.0.2", + "packages/google-cloud-datastream": "2.1.2", "packages/google-cloud-deploy": "2.2.2", - "packages/google-cloud-dialogflow-cx": "3.1.2", "packages/google-cloud-dialogflow": "5.3.0", + "packages/google-cloud-dialogflow-cx": "3.1.2", "packages/google-cloud-discoveryengine": "0.2.0", - "packages/google-cloud-gkebackup": "0.2.2", - "packages/google-cloud-eventarc-publishing": "2.3.0", + "packages/google-cloud-documentai": "6.1.0", + "packages/google-cloud-domains": "2.1.2", "packages/google-cloud-essentialcontacts": "2.0.2", "packages/google-cloud-eventarc": "2.2.0", - "packages/google-cloud-domains": "2.1.2", - "packages/google-cloud-gaming": "3.1.3", + "packages/google-cloud-eventarc-publishing": "2.3.0", "packages/google-cloud-functions": "2.2.3", - "packages/google-cloud-documentai": "6.1.0", + "packages/google-cloud-gaming": "3.1.3", + "packages/google-cloud-gkebackup": "0.2.2", "packages/google-cloud-gkeconnect-gateway": "2.0.5", "packages/google-cloud-gkehub": "3.2.2", "packages/google-cloud-gkemulticloud": "0.1.4", - "packages/google-cloud-kms": "3.1.0", - "packages/google-cloud-ids": "2.1.2", "packages/google-cloud-iap": "2.0.3", + "packages/google-cloud-ids": "2.1.2", "packages/google-cloud-iot": "3.1.2", + "packages/google-cloud-kms": "3.1.0", "packages/google-cloud-language": "5.1.2", - "packages/google-cloud-mediatranslation": "3.0.5", "packages/google-cloud-lifesciences": "2.1.2", + "packages/google-cloud-mediatranslation": "3.0.5", "packages/google-cloud-memcache": "2.1.4", "packages/google-cloud-metastore": "3.1.2", "packages/google-cloud-monitoring": "3.0.3", - "packages/google-cloud-orgpolicy": "2.0.3", - "packages/google-cloud-optimization": "2.1.1", - "packages/google-cloud-networksecurity": "1.0.2", "packages/google-cloud-networkmanagement": "2.3.1", + "packages/google-cloud-networksecurity": "1.0.2", "packages/google-cloud-notebooks": "2.1.2", + "packages/google-cloud-optimization": "2.1.1", + "packages/google-cloud-orgpolicy": "2.0.3", "packages/google-cloud-osconfig": "2.1.2", "packages/google-cloud-oslogin": "4.0.4", "packages/google-cloud-phishingprotection": "3.0.6", @@ -76,10 +76,10 @@ "packages/google-cloud-redis": "3.1.5", "packages/google-cloud-resourcemanager": "4.1.3", "packages/google-cloud-resourcesettings": "2.0.3", - "packages/google-cloud-security-privateca": "4.1.2", - "packages/google-cloud-secretmanager": "4.1.4", + "packages/google-cloud-retail": "2.1.1", "packages/google-cloud-scheduler": "3.0.5", "packages/google-cloud-secretmanager": "4.1.4", + "packages/google-cloud-security-privateca": "4.1.2", "packages/google-cloud-security-publicca": "0.1.3", "packages/google-cloud-servicedirectory": "4.0.4", "packages/google-cloud-shell": "2.0.4", @@ -90,19 +90,19 @@ "packages/google-cloud-video-livestream": "0.3.4", "packages/google-cloud-video-transcoder": "2.2.3", "packages/google-cloud-videointelligence": "4.1.1", - "packages/google-cloud-vpcaccess": "2.1.3", "packages/google-cloud-vmmigration": "2.2.1", + "packages/google-cloud-vpcaccess": "2.1.3", + "packages/google-cloud-webrisk": "3.2.0", "packages/google-cloud-websecurityscanner": "2.1.3", "packages/google-cloud-workflows-executions": "2.2.0", - "packages/google-cloud-webrisk": "3.2.0", "packages/google-container": "4.4.0", "packages/google-dataflow": "2.0.1", "packages/google-devtools-artifactregistry": "2.0.2", - "packages/google-devtools-containeranalysis": "4.4.1", "packages/google-devtools-cloudbuild": "3.2.0", + "packages/google-devtools-containeranalysis": "4.4.1", "packages/google-iam": "0.2.2", - "packages/google-identity-accesscontextmanager": "2.2.0", "packages/google-iam-credentials": "2.0.2", + "packages/google-identity-accesscontextmanager": "2.2.0", "packages/google-maps-addressvalidation": "0.1.0", "packages/google-maps-routing": "0.2.1", "packages/google-monitoring-dashboard": "2.8.0", diff --git a/packages/google-cloud-retail/.github/.OwlBot.yaml b/packages/google-cloud-retail/.OwlBot.yaml similarity index 79% rename from packages/google-cloud-retail/.github/.OwlBot.yaml rename to packages/google-cloud-retail/.OwlBot.yaml index 85b7e5ac443..a83221d6d9e 100644 --- a/packages/google-cloud-retail/.github/.OwlBot.yaml +++ b/packages/google-cloud-retail/.OwlBot.yaml @@ -11,13 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -docker: - image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest deep-remove-regex: - /owl-bot-staging deep-copy-regex: - - source: /google/cloud/retail/(.*)/.*-nodejs/(.*) - dest: /owl-bot-staging/$1/$2 + - source: /google/cloud/retail/(.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-retail/$1 diff --git a/packages/google-cloud-retail/.mocharc.js b/packages/google-cloud-retail/.mocharc.js index 0b600509bed..cdb7b752160 100644 --- a/packages/google-cloud-retail/.mocharc.js +++ b/packages/google-cloud-retail/.mocharc.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/.prettierrc.js b/packages/google-cloud-retail/.prettierrc.js index d1b95106f4c..d546a4ad546 100644 --- a/packages/google-cloud-retail/.prettierrc.js +++ b/packages/google-cloud-retail/.prettierrc.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-retail/.repo-metadata.json b/packages/google-cloud-retail/.repo-metadata.json index 629f2b90f04..22035054335 100644 --- a/packages/google-cloud-retail/.repo-metadata.json +++ b/packages/google-cloud-retail/.repo-metadata.json @@ -6,11 +6,11 @@ "default_version": "v2beta", "language": "nodejs", "name_pretty": "Retail API", - "repo": "googleapis/nodejs-retail", + "repo": "googleapis/google-cloud-node", "product_documentation": "https://cloud.google.com/recommendations/", "requires_billing": true, "name": "retail", - "issue_tracker": "https://github.com/googleapis/nodejs-retail/issues", + "issue_tracker": "https://github.com/googleapis/google-cloud-node/issues", "api_shortname": "retail", "library_type": "GAPIC_AUTO", "codeowner_team": "@googleapis/cloud-retail-team" diff --git a/packages/google-cloud-retail/README.md b/packages/google-cloud-retail/README.md index ce8867a072e..1ca590f9d1b 100644 --- a/packages/google-cloud-retail/README.md +++ b/packages/google-cloud-retail/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Retail API: Node.js Client](https://github.com/googleapis/nodejs-retail) +# [Retail API: Node.js Client](https://github.com/googleapis/google-cloud-node) [![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/retail.svg)](https://www.npmjs.org/package/@google-cloud/retail) @@ -14,11 +14,11 @@ Retail client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-retail/blob/main/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-retail/CHANGELOG.md). * [Retail API Node.js Client API Reference][client-docs] * [Retail API Documentation][product-docs] -* [github.com/googleapis/nodejs-retail](https://github.com/googleapis/nodejs-retail) +* [github.com/googleapis/google-cloud-node/packages/google-cloud-retail](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-retail) Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in [Client Libraries Explained][explained]. @@ -82,11 +82,157 @@ listCatalogs(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-retail/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Quickstart | [source code](https://github.com/googleapis/nodejs-retail/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Catalog_service.add_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.add_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.add_catalog_attribute.js,samples/README.md) | +| Catalog_service.get_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.get_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.get_attributes_config.js,samples/README.md) | +| Catalog_service.get_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.get_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.get_completion_config.js,samples/README.md) | +| Catalog_service.get_default_branch | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.get_default_branch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.get_default_branch.js,samples/README.md) | +| Catalog_service.list_catalogs | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.list_catalogs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.list_catalogs.js,samples/README.md) | +| Catalog_service.remove_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.remove_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.remove_catalog_attribute.js,samples/README.md) | +| Catalog_service.replace_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.replace_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.replace_catalog_attribute.js,samples/README.md) | +| Catalog_service.set_default_branch | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.set_default_branch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.set_default_branch.js,samples/README.md) | +| Catalog_service.update_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.update_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.update_attributes_config.js,samples/README.md) | +| Catalog_service.update_catalog | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.update_catalog.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.update_catalog.js,samples/README.md) | +| Catalog_service.update_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.update_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.update_completion_config.js,samples/README.md) | +| Completion_service.complete_query | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/completion_service.complete_query.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/completion_service.complete_query.js,samples/README.md) | +| Completion_service.import_completion_data | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/completion_service.import_completion_data.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/completion_service.import_completion_data.js,samples/README.md) | +| Control_service.create_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.create_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.create_control.js,samples/README.md) | +| Control_service.delete_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.delete_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.delete_control.js,samples/README.md) | +| Control_service.get_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.get_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.get_control.js,samples/README.md) | +| Control_service.list_controls | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.list_controls.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.list_controls.js,samples/README.md) | +| Control_service.update_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.update_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.update_control.js,samples/README.md) | +| Prediction_service.predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/prediction_service.predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/prediction_service.predict.js,samples/README.md) | +| Product_service.add_fulfillment_places | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.add_fulfillment_places.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.add_fulfillment_places.js,samples/README.md) | +| Product_service.add_local_inventories | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.add_local_inventories.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.add_local_inventories.js,samples/README.md) | +| Product_service.create_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.create_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.create_product.js,samples/README.md) | +| Product_service.delete_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.delete_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.delete_product.js,samples/README.md) | +| Product_service.get_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.get_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.get_product.js,samples/README.md) | +| Product_service.import_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.import_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.import_products.js,samples/README.md) | +| Product_service.list_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.list_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.list_products.js,samples/README.md) | +| Product_service.remove_fulfillment_places | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.remove_fulfillment_places.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.remove_fulfillment_places.js,samples/README.md) | +| Product_service.remove_local_inventories | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.remove_local_inventories.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.remove_local_inventories.js,samples/README.md) | +| Product_service.set_inventory | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.set_inventory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.set_inventory.js,samples/README.md) | +| Product_service.update_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.update_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.update_product.js,samples/README.md) | +| Search_service.search | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/search_service.search.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/search_service.search.js,samples/README.md) | +| Serving_config_service.add_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.add_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.add_control.js,samples/README.md) | +| Serving_config_service.create_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.create_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.create_serving_config.js,samples/README.md) | +| Serving_config_service.delete_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.delete_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.delete_serving_config.js,samples/README.md) | +| Serving_config_service.get_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.get_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.get_serving_config.js,samples/README.md) | +| Serving_config_service.list_serving_configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.list_serving_configs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.list_serving_configs.js,samples/README.md) | +| Serving_config_service.remove_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.remove_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.remove_control.js,samples/README.md) | +| Serving_config_service.update_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.update_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.update_serving_config.js,samples/README.md) | +| User_event_service.collect_user_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.collect_user_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.collect_user_event.js,samples/README.md) | +| User_event_service.import_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.import_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.import_user_events.js,samples/README.md) | +| User_event_service.purge_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.purge_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.purge_user_events.js,samples/README.md) | +| User_event_service.rejoin_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.rejoin_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.rejoin_user_events.js,samples/README.md) | +| User_event_service.write_user_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.write_user_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.write_user_event.js,samples/README.md) | +| Catalog_service.add_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js,samples/README.md) | +| Catalog_service.get_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_attributes_config.js,samples/README.md) | +| Catalog_service.get_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_completion_config.js,samples/README.md) | +| Catalog_service.get_default_branch | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_default_branch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_default_branch.js,samples/README.md) | +| Catalog_service.list_catalogs | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.list_catalogs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.list_catalogs.js,samples/README.md) | +| Catalog_service.remove_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js,samples/README.md) | +| Catalog_service.replace_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js,samples/README.md) | +| Catalog_service.set_default_branch | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.set_default_branch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.set_default_branch.js,samples/README.md) | +| Catalog_service.update_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_attributes_config.js,samples/README.md) | +| Catalog_service.update_catalog | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_catalog.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_catalog.js,samples/README.md) | +| Catalog_service.update_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_completion_config.js,samples/README.md) | +| Completion_service.complete_query | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/completion_service.complete_query.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/completion_service.complete_query.js,samples/README.md) | +| Completion_service.import_completion_data | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/completion_service.import_completion_data.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/completion_service.import_completion_data.js,samples/README.md) | +| Control_service.create_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.create_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.create_control.js,samples/README.md) | +| Control_service.delete_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.delete_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.delete_control.js,samples/README.md) | +| Control_service.get_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.get_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.get_control.js,samples/README.md) | +| Control_service.list_controls | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.list_controls.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.list_controls.js,samples/README.md) | +| Control_service.update_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.update_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.update_control.js,samples/README.md) | +| Model_service.create_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.create_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.create_model.js,samples/README.md) | +| Model_service.delete_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.delete_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.delete_model.js,samples/README.md) | +| Model_service.list_models | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.list_models.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.list_models.js,samples/README.md) | +| Model_service.pause_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.pause_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.pause_model.js,samples/README.md) | +| Model_service.resume_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.resume_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.resume_model.js,samples/README.md) | +| Model_service.tune_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.tune_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.tune_model.js,samples/README.md) | +| Model_service.update_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.update_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.update_model.js,samples/README.md) | +| Prediction_service.predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/prediction_service.predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/prediction_service.predict.js,samples/README.md) | +| Product_service.add_fulfillment_places | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_fulfillment_places.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_fulfillment_places.js,samples/README.md) | +| Product_service.add_local_inventories | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_local_inventories.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_local_inventories.js,samples/README.md) | +| Product_service.create_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.create_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.create_product.js,samples/README.md) | +| Product_service.delete_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.delete_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.delete_product.js,samples/README.md) | +| Product_service.get_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.get_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.get_product.js,samples/README.md) | +| Product_service.import_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.import_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.import_products.js,samples/README.md) | +| Product_service.list_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.list_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.list_products.js,samples/README.md) | +| Product_service.purge_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.purge_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.purge_products.js,samples/README.md) | +| Product_service.remove_fulfillment_places | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_fulfillment_places.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_fulfillment_places.js,samples/README.md) | +| Product_service.remove_local_inventories | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_local_inventories.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_local_inventories.js,samples/README.md) | +| Product_service.set_inventory | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.set_inventory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.set_inventory.js,samples/README.md) | +| Product_service.update_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.update_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.update_product.js,samples/README.md) | +| Search_service.search | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/search_service.search.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/search_service.search.js,samples/README.md) | +| Serving_config_service.add_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.add_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.add_control.js,samples/README.md) | +| Serving_config_service.create_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.create_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.create_serving_config.js,samples/README.md) | +| Serving_config_service.delete_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.delete_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.delete_serving_config.js,samples/README.md) | +| Serving_config_service.get_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.get_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.get_serving_config.js,samples/README.md) | +| Serving_config_service.list_serving_configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.list_serving_configs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.list_serving_configs.js,samples/README.md) | +| Serving_config_service.remove_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.remove_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.remove_control.js,samples/README.md) | +| Serving_config_service.update_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.update_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.update_serving_config.js,samples/README.md) | +| User_event_service.collect_user_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.collect_user_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.collect_user_event.js,samples/README.md) | +| User_event_service.import_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.import_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.import_user_events.js,samples/README.md) | +| User_event_service.purge_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.purge_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.purge_user_events.js,samples/README.md) | +| User_event_service.rejoin_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.rejoin_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.rejoin_user_events.js,samples/README.md) | +| User_event_service.write_user_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.write_user_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.write_user_event.js,samples/README.md) | +| Catalog_service.add_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.add_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.add_catalog_attribute.js,samples/README.md) | +| Catalog_service.batch_remove_catalog_attributes | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js,samples/README.md) | +| Catalog_service.get_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_attributes_config.js,samples/README.md) | +| Catalog_service.get_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_completion_config.js,samples/README.md) | +| Catalog_service.get_default_branch | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_default_branch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_default_branch.js,samples/README.md) | +| Catalog_service.list_catalogs | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.list_catalogs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.list_catalogs.js,samples/README.md) | +| Catalog_service.remove_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js,samples/README.md) | +| Catalog_service.replace_catalog_attribute | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js,samples/README.md) | +| Catalog_service.set_default_branch | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.set_default_branch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.set_default_branch.js,samples/README.md) | +| Catalog_service.update_attributes_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_attributes_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_attributes_config.js,samples/README.md) | +| Catalog_service.update_catalog | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_catalog.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_catalog.js,samples/README.md) | +| Catalog_service.update_completion_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_completion_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_completion_config.js,samples/README.md) | +| Completion_service.complete_query | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/completion_service.complete_query.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/completion_service.complete_query.js,samples/README.md) | +| Completion_service.import_completion_data | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/completion_service.import_completion_data.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/completion_service.import_completion_data.js,samples/README.md) | +| Control_service.create_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.create_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.create_control.js,samples/README.md) | +| Control_service.delete_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.delete_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.delete_control.js,samples/README.md) | +| Control_service.get_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.get_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.get_control.js,samples/README.md) | +| Control_service.list_controls | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.list_controls.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.list_controls.js,samples/README.md) | +| Control_service.update_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.update_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.update_control.js,samples/README.md) | +| Model_service.create_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.create_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.create_model.js,samples/README.md) | +| Model_service.delete_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.delete_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.delete_model.js,samples/README.md) | +| Model_service.list_models | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.list_models.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.list_models.js,samples/README.md) | +| Model_service.pause_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.pause_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.pause_model.js,samples/README.md) | +| Model_service.resume_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.resume_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.resume_model.js,samples/README.md) | +| Model_service.tune_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.tune_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.tune_model.js,samples/README.md) | +| Model_service.update_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.update_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.update_model.js,samples/README.md) | +| Prediction_service.predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/prediction_service.predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/prediction_service.predict.js,samples/README.md) | +| Product_service.add_fulfillment_places | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.add_fulfillment_places.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.add_fulfillment_places.js,samples/README.md) | +| Product_service.add_local_inventories | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.add_local_inventories.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.add_local_inventories.js,samples/README.md) | +| Product_service.create_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.create_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.create_product.js,samples/README.md) | +| Product_service.delete_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.delete_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.delete_product.js,samples/README.md) | +| Product_service.get_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.get_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.get_product.js,samples/README.md) | +| Product_service.import_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.import_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.import_products.js,samples/README.md) | +| Product_service.list_products | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.list_products.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.list_products.js,samples/README.md) | +| Product_service.remove_fulfillment_places | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_fulfillment_places.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_fulfillment_places.js,samples/README.md) | +| Product_service.remove_local_inventories | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_local_inventories.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_local_inventories.js,samples/README.md) | +| Product_service.set_inventory | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.set_inventory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.set_inventory.js,samples/README.md) | +| Product_service.update_product | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.update_product.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.update_product.js,samples/README.md) | +| Search_service.search | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/search_service.search.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/search_service.search.js,samples/README.md) | +| Serving_config_service.add_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.add_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.add_control.js,samples/README.md) | +| Serving_config_service.create_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.create_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.create_serving_config.js,samples/README.md) | +| Serving_config_service.delete_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.delete_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.delete_serving_config.js,samples/README.md) | +| Serving_config_service.get_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.get_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.get_serving_config.js,samples/README.md) | +| Serving_config_service.list_serving_configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.list_serving_configs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.list_serving_configs.js,samples/README.md) | +| Serving_config_service.remove_control | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.remove_control.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.remove_control.js,samples/README.md) | +| Serving_config_service.update_serving_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.update_serving_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.update_serving_config.js,samples/README.md) | +| User_event_service.collect_user_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.collect_user_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.collect_user_event.js,samples/README.md) | +| User_event_service.import_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.import_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.import_user_events.js,samples/README.md) | +| User_event_service.purge_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.purge_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.purge_user_events.js,samples/README.md) | +| User_event_service.rejoin_user_events | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.rejoin_user_events.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.rejoin_user_events.js,samples/README.md) | +| User_event_service.write_user_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.write_user_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.write_user_event.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/quickstart.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/test/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/test/quickstart.js,samples/README.md) | @@ -136,7 +282,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-retail/blob/main/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md`, the `samples/README.md`, and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -148,7 +294,7 @@ to its templates in Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-retail/blob/main/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/retail/latest [product-docs]: https://cloud.google.com/recommendations/ diff --git a/packages/google-cloud-retail/package.json b/packages/google-cloud-retail/package.json index f5379bb17a6..909eb0d60e4 100644 --- a/packages/google-cloud-retail/package.json +++ b/packages/google-cloud-retail/package.json @@ -2,7 +2,11 @@ "name": "@google-cloud/retail", "version": "2.1.1", "description": "Retail client for Node.js", - "repository": "googleapis/nodejs-retail", + "repository": { + "type": "git", + "directory": "packages/google-cloud-retail", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, "license": "Apache-2.0", "author": "Google LLC", "main": "build/src/index.js", @@ -36,9 +40,9 @@ "fix": "gts fix", "lint": "gts check", "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", + "system-test": "npm run compile && c8 mocha build/system-test", "test": "c8 mocha build/test", - "samples-test": "cd samples/ && npm link ../ && npm test", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", "prelint": "cd samples; npm link ../; npm i" }, "dependencies": { @@ -65,5 +69,6 @@ }, "engines": { "node": ">=12.0.0" - } + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-retail" } diff --git a/packages/google-cloud-retail/samples/README.md b/packages/google-cloud-retail/samples/README.md index a46baa3ac51..ccdc4ee0229 100644 --- a/packages/google-cloud-retail/samples/README.md +++ b/packages/google-cloud-retail/samples/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Retail API: Node.js Samples](https://github.com/googleapis/nodejs-retail) +# [Retail API: Node.js Samples](https://github.com/googleapis/google-cloud-node) [![Open in Cloud Shell][shell_img]][shell_link] @@ -12,12 +12,158 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Catalog_service.add_catalog_attribute](#catalog_service.add_catalog_attribute) + * [Catalog_service.get_attributes_config](#catalog_service.get_attributes_config) + * [Catalog_service.get_completion_config](#catalog_service.get_completion_config) + * [Catalog_service.get_default_branch](#catalog_service.get_default_branch) + * [Catalog_service.list_catalogs](#catalog_service.list_catalogs) + * [Catalog_service.remove_catalog_attribute](#catalog_service.remove_catalog_attribute) + * [Catalog_service.replace_catalog_attribute](#catalog_service.replace_catalog_attribute) + * [Catalog_service.set_default_branch](#catalog_service.set_default_branch) + * [Catalog_service.update_attributes_config](#catalog_service.update_attributes_config) + * [Catalog_service.update_catalog](#catalog_service.update_catalog) + * [Catalog_service.update_completion_config](#catalog_service.update_completion_config) + * [Completion_service.complete_query](#completion_service.complete_query) + * [Completion_service.import_completion_data](#completion_service.import_completion_data) + * [Control_service.create_control](#control_service.create_control) + * [Control_service.delete_control](#control_service.delete_control) + * [Control_service.get_control](#control_service.get_control) + * [Control_service.list_controls](#control_service.list_controls) + * [Control_service.update_control](#control_service.update_control) + * [Prediction_service.predict](#prediction_service.predict) + * [Product_service.add_fulfillment_places](#product_service.add_fulfillment_places) + * [Product_service.add_local_inventories](#product_service.add_local_inventories) + * [Product_service.create_product](#product_service.create_product) + * [Product_service.delete_product](#product_service.delete_product) + * [Product_service.get_product](#product_service.get_product) + * [Product_service.import_products](#product_service.import_products) + * [Product_service.list_products](#product_service.list_products) + * [Product_service.remove_fulfillment_places](#product_service.remove_fulfillment_places) + * [Product_service.remove_local_inventories](#product_service.remove_local_inventories) + * [Product_service.set_inventory](#product_service.set_inventory) + * [Product_service.update_product](#product_service.update_product) + * [Search_service.search](#search_service.search) + * [Serving_config_service.add_control](#serving_config_service.add_control) + * [Serving_config_service.create_serving_config](#serving_config_service.create_serving_config) + * [Serving_config_service.delete_serving_config](#serving_config_service.delete_serving_config) + * [Serving_config_service.get_serving_config](#serving_config_service.get_serving_config) + * [Serving_config_service.list_serving_configs](#serving_config_service.list_serving_configs) + * [Serving_config_service.remove_control](#serving_config_service.remove_control) + * [Serving_config_service.update_serving_config](#serving_config_service.update_serving_config) + * [User_event_service.collect_user_event](#user_event_service.collect_user_event) + * [User_event_service.import_user_events](#user_event_service.import_user_events) + * [User_event_service.purge_user_events](#user_event_service.purge_user_events) + * [User_event_service.rejoin_user_events](#user_event_service.rejoin_user_events) + * [User_event_service.write_user_event](#user_event_service.write_user_event) + * [Catalog_service.add_catalog_attribute](#catalog_service.add_catalog_attribute) + * [Catalog_service.get_attributes_config](#catalog_service.get_attributes_config) + * [Catalog_service.get_completion_config](#catalog_service.get_completion_config) + * [Catalog_service.get_default_branch](#catalog_service.get_default_branch) + * [Catalog_service.list_catalogs](#catalog_service.list_catalogs) + * [Catalog_service.remove_catalog_attribute](#catalog_service.remove_catalog_attribute) + * [Catalog_service.replace_catalog_attribute](#catalog_service.replace_catalog_attribute) + * [Catalog_service.set_default_branch](#catalog_service.set_default_branch) + * [Catalog_service.update_attributes_config](#catalog_service.update_attributes_config) + * [Catalog_service.update_catalog](#catalog_service.update_catalog) + * [Catalog_service.update_completion_config](#catalog_service.update_completion_config) + * [Completion_service.complete_query](#completion_service.complete_query) + * [Completion_service.import_completion_data](#completion_service.import_completion_data) + * [Control_service.create_control](#control_service.create_control) + * [Control_service.delete_control](#control_service.delete_control) + * [Control_service.get_control](#control_service.get_control) + * [Control_service.list_controls](#control_service.list_controls) + * [Control_service.update_control](#control_service.update_control) + * [Model_service.create_model](#model_service.create_model) + * [Model_service.delete_model](#model_service.delete_model) + * [Model_service.list_models](#model_service.list_models) + * [Model_service.pause_model](#model_service.pause_model) + * [Model_service.resume_model](#model_service.resume_model) + * [Model_service.tune_model](#model_service.tune_model) + * [Model_service.update_model](#model_service.update_model) + * [Prediction_service.predict](#prediction_service.predict) + * [Product_service.add_fulfillment_places](#product_service.add_fulfillment_places) + * [Product_service.add_local_inventories](#product_service.add_local_inventories) + * [Product_service.create_product](#product_service.create_product) + * [Product_service.delete_product](#product_service.delete_product) + * [Product_service.get_product](#product_service.get_product) + * [Product_service.import_products](#product_service.import_products) + * [Product_service.list_products](#product_service.list_products) + * [Product_service.purge_products](#product_service.purge_products) + * [Product_service.remove_fulfillment_places](#product_service.remove_fulfillment_places) + * [Product_service.remove_local_inventories](#product_service.remove_local_inventories) + * [Product_service.set_inventory](#product_service.set_inventory) + * [Product_service.update_product](#product_service.update_product) + * [Search_service.search](#search_service.search) + * [Serving_config_service.add_control](#serving_config_service.add_control) + * [Serving_config_service.create_serving_config](#serving_config_service.create_serving_config) + * [Serving_config_service.delete_serving_config](#serving_config_service.delete_serving_config) + * [Serving_config_service.get_serving_config](#serving_config_service.get_serving_config) + * [Serving_config_service.list_serving_configs](#serving_config_service.list_serving_configs) + * [Serving_config_service.remove_control](#serving_config_service.remove_control) + * [Serving_config_service.update_serving_config](#serving_config_service.update_serving_config) + * [User_event_service.collect_user_event](#user_event_service.collect_user_event) + * [User_event_service.import_user_events](#user_event_service.import_user_events) + * [User_event_service.purge_user_events](#user_event_service.purge_user_events) + * [User_event_service.rejoin_user_events](#user_event_service.rejoin_user_events) + * [User_event_service.write_user_event](#user_event_service.write_user_event) + * [Catalog_service.add_catalog_attribute](#catalog_service.add_catalog_attribute) + * [Catalog_service.batch_remove_catalog_attributes](#catalog_service.batch_remove_catalog_attributes) + * [Catalog_service.get_attributes_config](#catalog_service.get_attributes_config) + * [Catalog_service.get_completion_config](#catalog_service.get_completion_config) + * [Catalog_service.get_default_branch](#catalog_service.get_default_branch) + * [Catalog_service.list_catalogs](#catalog_service.list_catalogs) + * [Catalog_service.remove_catalog_attribute](#catalog_service.remove_catalog_attribute) + * [Catalog_service.replace_catalog_attribute](#catalog_service.replace_catalog_attribute) + * [Catalog_service.set_default_branch](#catalog_service.set_default_branch) + * [Catalog_service.update_attributes_config](#catalog_service.update_attributes_config) + * [Catalog_service.update_catalog](#catalog_service.update_catalog) + * [Catalog_service.update_completion_config](#catalog_service.update_completion_config) + * [Completion_service.complete_query](#completion_service.complete_query) + * [Completion_service.import_completion_data](#completion_service.import_completion_data) + * [Control_service.create_control](#control_service.create_control) + * [Control_service.delete_control](#control_service.delete_control) + * [Control_service.get_control](#control_service.get_control) + * [Control_service.list_controls](#control_service.list_controls) + * [Control_service.update_control](#control_service.update_control) + * [Model_service.create_model](#model_service.create_model) + * [Model_service.delete_model](#model_service.delete_model) + * [Model_service.list_models](#model_service.list_models) + * [Model_service.pause_model](#model_service.pause_model) + * [Model_service.resume_model](#model_service.resume_model) + * [Model_service.tune_model](#model_service.tune_model) + * [Model_service.update_model](#model_service.update_model) + * [Prediction_service.predict](#prediction_service.predict) + * [Product_service.add_fulfillment_places](#product_service.add_fulfillment_places) + * [Product_service.add_local_inventories](#product_service.add_local_inventories) + * [Product_service.create_product](#product_service.create_product) + * [Product_service.delete_product](#product_service.delete_product) + * [Product_service.get_product](#product_service.get_product) + * [Product_service.import_products](#product_service.import_products) + * [Product_service.list_products](#product_service.list_products) + * [Product_service.remove_fulfillment_places](#product_service.remove_fulfillment_places) + * [Product_service.remove_local_inventories](#product_service.remove_local_inventories) + * [Product_service.set_inventory](#product_service.set_inventory) + * [Product_service.update_product](#product_service.update_product) + * [Search_service.search](#search_service.search) + * [Serving_config_service.add_control](#serving_config_service.add_control) + * [Serving_config_service.create_serving_config](#serving_config_service.create_serving_config) + * [Serving_config_service.delete_serving_config](#serving_config_service.delete_serving_config) + * [Serving_config_service.get_serving_config](#serving_config_service.get_serving_config) + * [Serving_config_service.list_serving_configs](#serving_config_service.list_serving_configs) + * [Serving_config_service.remove_control](#serving_config_service.remove_control) + * [Serving_config_service.update_serving_config](#serving_config_service.update_serving_config) + * [User_event_service.collect_user_event](#user_event_service.collect_user_event) + * [User_event_service.import_user_events](#user_event_service.import_user_events) + * [User_event_service.purge_user_events](#user_event_service.purge_user_events) + * [User_event_service.rejoin_user_events](#user_event_service.rejoin_user_events) + * [User_event_service.write_user_event](#user_event_service.write_user_event) + * [Quickstart](#quickstart) * [Quickstart](#quickstart) ## Before you begin Before running the samples, make sure you've followed the steps outlined in -[Using the client library](https://github.com/googleapis/nodejs-retail#using-the-client-library). +[Using the client library](https://github.com/googleapis/google-cloud-node#using-the-client-library). `cd samples` @@ -29,16 +175,2498 @@ Before running the samples, make sure you've followed the steps outlined in +### Catalog_service.add_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.add_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.add_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.add_catalog_attribute.js` + + +----- + + + + +### Catalog_service.get_attributes_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.get_attributes_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.get_attributes_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.get_attributes_config.js` + + +----- + + + + +### Catalog_service.get_completion_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.get_completion_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.get_completion_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.get_completion_config.js` + + +----- + + + + +### Catalog_service.get_default_branch + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.get_default_branch.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.get_default_branch.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.get_default_branch.js` + + +----- + + + + +### Catalog_service.list_catalogs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.list_catalogs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.list_catalogs.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.list_catalogs.js` + + +----- + + + + +### Catalog_service.remove_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.remove_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.remove_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.remove_catalog_attribute.js` + + +----- + + + + +### Catalog_service.replace_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.replace_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.replace_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.replace_catalog_attribute.js` + + +----- + + + + +### Catalog_service.set_default_branch + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.set_default_branch.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.set_default_branch.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.set_default_branch.js` + + +----- + + + + +### Catalog_service.update_attributes_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.update_attributes_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.update_attributes_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.update_attributes_config.js` + + +----- + + + + +### Catalog_service.update_catalog + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.update_catalog.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.update_catalog.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.update_catalog.js` + + +----- + + + + +### Catalog_service.update_completion_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/catalog_service.update_completion_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/catalog_service.update_completion_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/catalog_service.update_completion_config.js` + + +----- + + + + +### Completion_service.complete_query + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/completion_service.complete_query.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/completion_service.complete_query.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/completion_service.complete_query.js` + + +----- + + + + +### Completion_service.import_completion_data + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/completion_service.import_completion_data.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/completion_service.import_completion_data.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/completion_service.import_completion_data.js` + + +----- + + + + +### Control_service.create_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.create_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.create_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/control_service.create_control.js` + + +----- + + + + +### Control_service.delete_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.delete_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.delete_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/control_service.delete_control.js` + + +----- + + + + +### Control_service.get_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.get_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.get_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/control_service.get_control.js` + + +----- + + + + +### Control_service.list_controls + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.list_controls.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.list_controls.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/control_service.list_controls.js` + + +----- + + + + +### Control_service.update_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/control_service.update_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/control_service.update_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/control_service.update_control.js` + + +----- + + + + +### Prediction_service.predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/prediction_service.predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/prediction_service.predict.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/prediction_service.predict.js` + + +----- + + + + +### Product_service.add_fulfillment_places + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.add_fulfillment_places.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.add_fulfillment_places.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.add_fulfillment_places.js` + + +----- + + + + +### Product_service.add_local_inventories + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.add_local_inventories.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.add_local_inventories.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.add_local_inventories.js` + + +----- + + + + +### Product_service.create_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.create_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.create_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.create_product.js` + + +----- + + + + +### Product_service.delete_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.delete_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.delete_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.delete_product.js` + + +----- + + + + +### Product_service.get_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.get_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.get_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.get_product.js` + + +----- + + + + +### Product_service.import_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.import_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.import_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.import_products.js` + + +----- + + + + +### Product_service.list_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.list_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.list_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.list_products.js` + + +----- + + + + +### Product_service.remove_fulfillment_places + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.remove_fulfillment_places.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.remove_fulfillment_places.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.remove_fulfillment_places.js` + + +----- + + + + +### Product_service.remove_local_inventories + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.remove_local_inventories.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.remove_local_inventories.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.remove_local_inventories.js` + + +----- + + + + +### Product_service.set_inventory + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.set_inventory.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.set_inventory.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.set_inventory.js` + + +----- + + + + +### Product_service.update_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/product_service.update_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/product_service.update_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/product_service.update_product.js` + + +----- + + + + +### Search_service.search + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/search_service.search.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/search_service.search.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/search_service.search.js` + + +----- + + + + +### Serving_config_service.add_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.add_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.add_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.add_control.js` + + +----- + + + + +### Serving_config_service.create_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.create_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.create_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.create_serving_config.js` + + +----- + + + + +### Serving_config_service.delete_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.delete_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.delete_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.delete_serving_config.js` + + +----- + + + + +### Serving_config_service.get_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.get_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.get_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.get_serving_config.js` + + +----- + + + + +### Serving_config_service.list_serving_configs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.list_serving_configs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.list_serving_configs.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.list_serving_configs.js` + + +----- + + + + +### Serving_config_service.remove_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.remove_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.remove_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.remove_control.js` + + +----- + + + + +### Serving_config_service.update_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/serving_config_service.update_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/serving_config_service.update_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/serving_config_service.update_serving_config.js` + + +----- + + + + +### User_event_service.collect_user_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.collect_user_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.collect_user_event.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/user_event_service.collect_user_event.js` + + +----- + + + + +### User_event_service.import_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.import_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.import_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/user_event_service.import_user_events.js` + + +----- + + + + +### User_event_service.purge_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.purge_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.purge_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/user_event_service.purge_user_events.js` + + +----- + + + + +### User_event_service.rejoin_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.rejoin_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.rejoin_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/user_event_service.rejoin_user_events.js` + + +----- + + + + +### User_event_service.write_user_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2/user_event_service.write_user_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2/user_event_service.write_user_event.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2/user_event_service.write_user_event.js` + + +----- + + + + +### Catalog_service.add_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js` + + +----- + + + + +### Catalog_service.get_attributes_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_attributes_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_attributes_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_attributes_config.js` + + +----- + + + + +### Catalog_service.get_completion_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_completion_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_completion_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_completion_config.js` + + +----- + + + + +### Catalog_service.get_default_branch + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_default_branch.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_default_branch.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.get_default_branch.js` + + +----- + + + + +### Catalog_service.list_catalogs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.list_catalogs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.list_catalogs.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.list_catalogs.js` + + +----- + + + + +### Catalog_service.remove_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js` + + +----- + + + + +### Catalog_service.replace_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js` + + +----- + + + + +### Catalog_service.set_default_branch + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.set_default_branch.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.set_default_branch.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.set_default_branch.js` + + +----- + + + + +### Catalog_service.update_attributes_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_attributes_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_attributes_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_attributes_config.js` + + +----- + + + + +### Catalog_service.update_catalog + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_catalog.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_catalog.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_catalog.js` + + +----- + + + + +### Catalog_service.update_completion_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_completion_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_completion_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/catalog_service.update_completion_config.js` + + +----- + + + + +### Completion_service.complete_query + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/completion_service.complete_query.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/completion_service.complete_query.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/completion_service.complete_query.js` + + +----- + + + + +### Completion_service.import_completion_data + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/completion_service.import_completion_data.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/completion_service.import_completion_data.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/completion_service.import_completion_data.js` + + +----- + + + + +### Control_service.create_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.create_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.create_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/control_service.create_control.js` + + +----- + + + + +### Control_service.delete_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.delete_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.delete_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/control_service.delete_control.js` + + +----- + + + + +### Control_service.get_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.get_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.get_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/control_service.get_control.js` + + +----- + + + + +### Control_service.list_controls + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.list_controls.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.list_controls.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/control_service.list_controls.js` + + +----- + + + + +### Control_service.update_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/control_service.update_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/control_service.update_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/control_service.update_control.js` + + +----- + + + + +### Model_service.create_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.create_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.create_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.create_model.js` + + +----- + + + + +### Model_service.delete_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.delete_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.delete_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.delete_model.js` + + +----- + + + + +### Model_service.list_models + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.list_models.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.list_models.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.list_models.js` + + +----- + + + + +### Model_service.pause_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.pause_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.pause_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.pause_model.js` + + +----- + + + + +### Model_service.resume_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.resume_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.resume_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.resume_model.js` + + +----- + + + + +### Model_service.tune_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.tune_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.tune_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.tune_model.js` + + +----- + + + + +### Model_service.update_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/model_service.update_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/model_service.update_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/model_service.update_model.js` + + +----- + + + + +### Prediction_service.predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/prediction_service.predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/prediction_service.predict.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/prediction_service.predict.js` + + +----- + + + + +### Product_service.add_fulfillment_places + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_fulfillment_places.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_fulfillment_places.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_fulfillment_places.js` + + +----- + + + + +### Product_service.add_local_inventories + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_local_inventories.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_local_inventories.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.add_local_inventories.js` + + +----- + + + + +### Product_service.create_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.create_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.create_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.create_product.js` + + +----- + + + + +### Product_service.delete_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.delete_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.delete_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.delete_product.js` + + +----- + + + + +### Product_service.get_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.get_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.get_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.get_product.js` + + +----- + + + + +### Product_service.import_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.import_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.import_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.import_products.js` + + +----- + + + + +### Product_service.list_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.list_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.list_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.list_products.js` + + +----- + + + + +### Product_service.purge_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.purge_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.purge_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.purge_products.js` + + +----- + + + + +### Product_service.remove_fulfillment_places + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_fulfillment_places.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_fulfillment_places.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_fulfillment_places.js` + + +----- + + + + +### Product_service.remove_local_inventories + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_local_inventories.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_local_inventories.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.remove_local_inventories.js` + + +----- + + + + +### Product_service.set_inventory + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.set_inventory.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.set_inventory.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.set_inventory.js` + + +----- + + + + +### Product_service.update_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/product_service.update_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/product_service.update_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/product_service.update_product.js` + + +----- + + + + +### Search_service.search + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/search_service.search.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/search_service.search.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/search_service.search.js` + + +----- + + + + +### Serving_config_service.add_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.add_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.add_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.add_control.js` + + +----- + + + + +### Serving_config_service.create_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.create_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.create_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.create_serving_config.js` + + +----- + + + + +### Serving_config_service.delete_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.delete_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.delete_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.delete_serving_config.js` + + +----- + + + + +### Serving_config_service.get_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.get_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.get_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.get_serving_config.js` + + +----- + + + + +### Serving_config_service.list_serving_configs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.list_serving_configs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.list_serving_configs.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.list_serving_configs.js` + + +----- + + + + +### Serving_config_service.remove_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.remove_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.remove_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.remove_control.js` + + +----- + + + + +### Serving_config_service.update_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.update_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.update_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/serving_config_service.update_serving_config.js` + + +----- + + + + +### User_event_service.collect_user_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.collect_user_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.collect_user_event.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.collect_user_event.js` + + +----- + + + + +### User_event_service.import_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.import_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.import_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.import_user_events.js` + + +----- + + + + +### User_event_service.purge_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.purge_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.purge_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.purge_user_events.js` + + +----- + + + + +### User_event_service.rejoin_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.rejoin_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.rejoin_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.rejoin_user_events.js` + + +----- + + + + +### User_event_service.write_user_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.write_user_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.write_user_event.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2alpha/user_event_service.write_user_event.js` + + +----- + + + + +### Catalog_service.add_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.add_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.add_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.add_catalog_attribute.js` + + +----- + + + + +### Catalog_service.batch_remove_catalog_attributes + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.batch_remove_catalog_attributes.js` + + +----- + + + + +### Catalog_service.get_attributes_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_attributes_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_attributes_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_attributes_config.js` + + +----- + + + + +### Catalog_service.get_completion_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_completion_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_completion_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_completion_config.js` + + +----- + + + + +### Catalog_service.get_default_branch + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_default_branch.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_default_branch.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.get_default_branch.js` + + +----- + + + + +### Catalog_service.list_catalogs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.list_catalogs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.list_catalogs.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.list_catalogs.js` + + +----- + + + + +### Catalog_service.remove_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.remove_catalog_attribute.js` + + +----- + + + + +### Catalog_service.replace_catalog_attribute + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.replace_catalog_attribute.js` + + +----- + + + + +### Catalog_service.set_default_branch + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.set_default_branch.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.set_default_branch.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.set_default_branch.js` + + +----- + + + + +### Catalog_service.update_attributes_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_attributes_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_attributes_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_attributes_config.js` + + +----- + + + + +### Catalog_service.update_catalog + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_catalog.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_catalog.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_catalog.js` + + +----- + + + + +### Catalog_service.update_completion_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_completion_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_completion_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/catalog_service.update_completion_config.js` + + +----- + + + + +### Completion_service.complete_query + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/completion_service.complete_query.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/completion_service.complete_query.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/completion_service.complete_query.js` + + +----- + + + + +### Completion_service.import_completion_data + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/completion_service.import_completion_data.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/completion_service.import_completion_data.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/completion_service.import_completion_data.js` + + +----- + + + + +### Control_service.create_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.create_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.create_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/control_service.create_control.js` + + +----- + + + + +### Control_service.delete_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.delete_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.delete_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/control_service.delete_control.js` + + +----- + + + + +### Control_service.get_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.get_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.get_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/control_service.get_control.js` + + +----- + + + + +### Control_service.list_controls + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.list_controls.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.list_controls.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/control_service.list_controls.js` + + +----- + + + + +### Control_service.update_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/control_service.update_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/control_service.update_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/control_service.update_control.js` + + +----- + + + + +### Model_service.create_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.create_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.create_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.create_model.js` + + +----- + + + + +### Model_service.delete_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.delete_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.delete_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.delete_model.js` + + +----- + + + + +### Model_service.list_models + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.list_models.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.list_models.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.list_models.js` + + +----- + + + + +### Model_service.pause_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.pause_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.pause_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.pause_model.js` + + +----- + + + + +### Model_service.resume_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.resume_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.resume_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.resume_model.js` + + +----- + + + + +### Model_service.tune_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.tune_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.tune_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.tune_model.js` + + +----- + + + + +### Model_service.update_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/model_service.update_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/model_service.update_model.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/model_service.update_model.js` + + +----- + + + + +### Prediction_service.predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/prediction_service.predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/prediction_service.predict.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/prediction_service.predict.js` + + +----- + + + + +### Product_service.add_fulfillment_places + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.add_fulfillment_places.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.add_fulfillment_places.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.add_fulfillment_places.js` + + +----- + + + + +### Product_service.add_local_inventories + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.add_local_inventories.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.add_local_inventories.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.add_local_inventories.js` + + +----- + + + + +### Product_service.create_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.create_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.create_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.create_product.js` + + +----- + + + + +### Product_service.delete_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.delete_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.delete_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.delete_product.js` + + +----- + + + + +### Product_service.get_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.get_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.get_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.get_product.js` + + +----- + + + + +### Product_service.import_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.import_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.import_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.import_products.js` + + +----- + + + + +### Product_service.list_products + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.list_products.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.list_products.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.list_products.js` + + +----- + + + + +### Product_service.remove_fulfillment_places + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_fulfillment_places.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_fulfillment_places.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_fulfillment_places.js` + + +----- + + + + +### Product_service.remove_local_inventories + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_local_inventories.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_local_inventories.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.remove_local_inventories.js` + + +----- + + + + +### Product_service.set_inventory + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.set_inventory.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.set_inventory.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.set_inventory.js` + + +----- + + + + +### Product_service.update_product + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/product_service.update_product.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/product_service.update_product.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/product_service.update_product.js` + + +----- + + + + +### Search_service.search + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/search_service.search.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/search_service.search.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/search_service.search.js` + + +----- + + + + +### Serving_config_service.add_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.add_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.add_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.add_control.js` + + +----- + + + + +### Serving_config_service.create_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.create_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.create_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.create_serving_config.js` + + +----- + + + + +### Serving_config_service.delete_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.delete_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.delete_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.delete_serving_config.js` + + +----- + + + + +### Serving_config_service.get_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.get_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.get_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.get_serving_config.js` + + +----- + + + + +### Serving_config_service.list_serving_configs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.list_serving_configs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.list_serving_configs.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.list_serving_configs.js` + + +----- + + + + +### Serving_config_service.remove_control + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.remove_control.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.remove_control.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.remove_control.js` + + +----- + + + + +### Serving_config_service.update_serving_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.update_serving_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.update_serving_config.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/serving_config_service.update_serving_config.js` + + +----- + + + + +### User_event_service.collect_user_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.collect_user_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.collect_user_event.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/user_event_service.collect_user_event.js` + + +----- + + + + +### User_event_service.import_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.import_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.import_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/user_event_service.import_user_events.js` + + +----- + + + + +### User_event_service.purge_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.purge_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.purge_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/user_event_service.purge_user_events.js` + + +----- + + + + +### User_event_service.rejoin_user_events + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.rejoin_user_events.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.rejoin_user_events.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/user_event_service.rejoin_user_events.js` + + +----- + + + + +### User_event_service.write_user_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v2beta/user_event_service.write_user_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v2beta/user_event_service.write_user_event.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v2beta/user_event_service.write_user_event.js` + + +----- + + + + +### Quickstart + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/quickstart.js` + + +----- + + + + ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-retail/blob/main/samples/quickstart.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/test/quickstart.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/test/quickstart.js,samples/README.md) __Usage:__ -`node samples/quickstart.js` +`node /workspace/google-cloud-node/samples/test/quickstart.js` @@ -46,5 +2674,5 @@ __Usage:__ [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-retail&page=editor&open_in_editor=samples/README.md +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=samples/README.md [product-docs]: https://cloud.google.com/recommendations/ diff --git a/packages/google-cloud-retail/src/index.ts b/packages/google-cloud-retail/src/index.ts index 4e17a8307f1..016870e8792 100644 --- a/packages/google-cloud-retail/src/index.ts +++ b/packages/google-cloud-retail/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/release-please-config.json b/release-please-config.json index 48791614588..9252de03a28 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,16 +2,16 @@ "initial-version": "0.1.0", "packages": { "packages/google-api-apikeys": {}, - "packages/google-cloud-baremetalsolution": {}, + "packages/google-api-servicecontrol": {}, "packages/google-api-servicemanagement": {}, - "packages/google-cloud-apigateway": {}, "packages/google-api-serviceusage": {}, - "packages/google-api-servicecontrol": {}, "packages/google-appengine": {}, "packages/google-cloud-accessapproval": {}, + "packages/google-cloud-apigateway": {}, "packages/google-cloud-apigeeconnect": {}, "packages/google-cloud-asset": {}, "packages/google-cloud-assuredworkloads": {}, + "packages/google-cloud-baremetalsolution": {}, "packages/google-cloud-batch": {}, "packages/google-cloud-beyondcorp-appconnections": {}, "packages/google-cloud-beyondcorp-appconnectors": {}, @@ -24,50 +24,50 @@ "packages/google-cloud-bigquery-datatransfer": {}, "packages/google-cloud-bigquery-reservation": {}, "packages/google-cloud-bigquery-storage": {}, - "packages/google-cloud-binaryauthorization": {}, "packages/google-cloud-billing": {}, "packages/google-cloud-billing-budgets": {}, + "packages/google-cloud-binaryauthorization": {}, "packages/google-cloud-certificatemanager": {}, + "packages/google-cloud-channel": {}, "packages/google-cloud-clouddms": {}, "packages/google-cloud-contactcenterinsights": {}, - "packages/google-cloud-channel": {}, "packages/google-cloud-contentwarehouse": {}, "packages/google-cloud-datafusion": {}, "packages/google-cloud-datalabeling": {}, "packages/google-cloud-dataplex": {}, "packages/google-cloud-dataproc": {}, - "packages/google-cloud-datastream": {}, "packages/google-cloud-dataqna": {}, + "packages/google-cloud-datastream": {}, "packages/google-cloud-deploy": {}, - "packages/google-cloud-dialogflow-cx": {}, "packages/google-cloud-dialogflow": {}, + "packages/google-cloud-dialogflow-cx": {}, "packages/google-cloud-discoveryengine": {}, - "packages/google-cloud-gkebackup": {}, - "packages/google-cloud-eventarc-publishing": {}, + "packages/google-cloud-documentai": {}, + "packages/google-cloud-domains": {}, "packages/google-cloud-essentialcontacts": {}, "packages/google-cloud-eventarc": {}, - "packages/google-cloud-domains": {}, - "packages/google-cloud-gaming": {}, + "packages/google-cloud-eventarc-publishing": {}, "packages/google-cloud-functions": {}, - "packages/google-cloud-documentai": {}, + "packages/google-cloud-gaming": {}, + "packages/google-cloud-gkebackup": {}, "packages/google-cloud-gkeconnect-gateway": {}, "packages/google-cloud-gkehub": {}, "packages/google-cloud-gkemulticloud": {}, - "packages/google-cloud-kms": {}, - "packages/google-cloud-ids": {}, "packages/google-cloud-iap": {}, + "packages/google-cloud-ids": {}, "packages/google-cloud-iot": {}, + "packages/google-cloud-kms": {}, "packages/google-cloud-language": {}, - "packages/google-cloud-mediatranslation": {}, "packages/google-cloud-lifesciences": {}, + "packages/google-cloud-mediatranslation": {}, "packages/google-cloud-memcache": {}, "packages/google-cloud-metastore": {}, "packages/google-cloud-monitoring": {}, - "packages/google-cloud-orgpolicy": {}, - "packages/google-cloud-optimization": {}, - "packages/google-cloud-networksecurity": {}, "packages/google-cloud-networkmanagement": {}, + "packages/google-cloud-networksecurity": {}, "packages/google-cloud-notebooks": {}, + "packages/google-cloud-optimization": {}, + "packages/google-cloud-orgpolicy": {}, "packages/google-cloud-osconfig": {}, "packages/google-cloud-oslogin": {}, "packages/google-cloud-phishingprotection": {}, @@ -77,9 +77,10 @@ "packages/google-cloud-redis": {}, "packages/google-cloud-resourcemanager": {}, "packages/google-cloud-resourcesettings": {}, - "packages/google-cloud-security-privateca": {}, - "packages/google-cloud-secretmanager": {}, + "packages/google-cloud-retail": {}, "packages/google-cloud-scheduler": {}, + "packages/google-cloud-secretmanager": {}, + "packages/google-cloud-security-privateca": {}, "packages/google-cloud-security-publicca": {}, "packages/google-cloud-servicedirectory": {}, "packages/google-cloud-shell": {}, @@ -90,19 +91,19 @@ "packages/google-cloud-video-livestream": {}, "packages/google-cloud-video-transcoder": {}, "packages/google-cloud-videointelligence": {}, - "packages/google-cloud-vpcaccess": {}, "packages/google-cloud-vmmigration": {}, + "packages/google-cloud-vpcaccess": {}, + "packages/google-cloud-webrisk": {}, "packages/google-cloud-websecurityscanner": {}, "packages/google-cloud-workflows-executions": {}, - "packages/google-cloud-webrisk": {}, "packages/google-container": {}, "packages/google-dataflow": {}, "packages/google-devtools-artifactregistry": {}, - "packages/google-devtools-containeranalysis": {}, "packages/google-devtools-cloudbuild": {}, + "packages/google-devtools-containeranalysis": {}, "packages/google-iam": {}, - "packages/google-identity-accesscontextmanager": {}, "packages/google-iam-credentials": {}, + "packages/google-identity-accesscontextmanager": {}, "packages/google-maps-addressvalidation": {}, "packages/google-maps-routing": {}, "packages/google-monitoring-dashboard": {}, @@ -116,4 +117,4 @@ } ], "release-type": "node" -} \ No newline at end of file +}